rrule-temporal 2.2.9 → 2.3.1

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.
@@ -0,0 +1,2 @@
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`:``),v=`Invalid leap month`,ee=e=>i(`Calendar`,e),te=e=>i(`TimeZone`,e),ne=e=>`Cannot parse: ${e}`,re=e=>`Invalid substring: ${e}`,ie=u,y=d;function b(e){throw RangeError(e)}function x(e){throw TypeError(e)}function ae(e,t,n,r,i){return oe(t,((e,t)=>{let n=e[t];return n===void 0&&x(m(t)),n})(e,t),n,r,i)}function oe(e,t,n,i,a,o){let s=ie(t,n,i);return a&&t!==s&&b(((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 S(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 se=e=>ce({name:e},1),ce=(e,t)=>ue(e=>({value:e,configurable:1,writable:!t}),e),le=e=>({[Symbol.toStringTag]:{value:e,configurable:1}});function ue(e,t){let n={};for(let r in t)n[r]=e(t[r],r);return n}function de(e,t){let n={};for(let r of e)n[r]=t;return n}function fe(e){let t={};for(let n of e)t[n]=e=>e[n];return t}function C(e,t,n=Object.create(null)){for(let r of e)n[r]=t[r];return n}function pe(e,t,n){for(let r of e)if(t[r]!==n[r])return 0;return 1}function me(e,t,n){let r={...n};for(let n=0;n<t;n++)r[e[n]]=0;return r}function w(e,...t){return(...n)=>e(...t,...n)}function he(){}function ge(e){return e[0].toUpperCase()+e.substring(1)}function T(...e){return[].concat(...e).sort()}function _e(e){return RegExp(`^${e}$`,`i`)}function ve(e){return parseInt(e.padEnd(9,`0`))}function ye(e){return e&&e!==`+`?-1:1}function be(e){return e===void 0?0:parseInt(e)}function xe(e,t){return String(t).padStart(e,`0`)}const Se=w(xe,2);function E(e,t){return Math.sign(e-t)}function D(e,t){return e<t?-1:e>t?1:0}function Ce(e,t){let n=e/t;return e%t<0n?n-1n:n}function we(e,t){let n=Ce(e,t);return[n,e-n*t]}function Te(e,t){return[Math.floor(e/t),Ee(e,t)]}function Ee(e,t){return(e%t+t)%t}function De(e,t){return Math.trunc(e/t)||0}function Oe(e,t){return e%t||0}function ke(e,t=1){return t*(.5+e/5)}function Ae(e){return Math.abs(e%1)===.5}const je={bce:-1,ce:0};function Me(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 Ne(e){return e===void 0?`iso8601`:e===0?`gregory`:e.id}const Pe=/^M(\d{2})(L?)$/;function Fe(e){let t=Pe.exec(e);return t||b((e=>`Invalid monthCode: ${e}`)(e)),[parseInt(t[1]),!!t[2]]}function Ie(e,t){return`M`+Se(e)+(t?`L`:``)}function Le(e,t,n){return e+(t||n&&e>=n?1:0)}function Re(e,t){return e-(t&&e>=t?1:0)}const ze={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},Be=Object.keys(ze),Ve=864e5,He=1e3,Ue=1e6,We=1e9,Ge=6e10,Ke=36e11,qe=864e11,Je=[1,He,Ue,We,Ge,Ke,qe],Ye=BigInt(He),Xe=BigInt(Ue),Ze=BigInt(We),Qe=BigInt(Ge),$e=BigInt(Ke),O=BigInt(qe);function et(e,t){let n=Number(e/O),r=Number(e%O);return qe/t*n+(Math.trunc(r/t)+r%t/t)}const k=Be.slice(0,6),tt=fe(k),nt=[`year`],rt=[`day`],it=[`day`,`month`,`year`],at=[`offset`],ot=[`timeZone`],st=[`era`,`eraYear`],ct=[`era`,`eraYear`,`year`],lt=[`month`,`monthCode`],ut=[`day`,`month`,`monthCode`],dt=T(k),ft=T(st,nt),pt=T(lt,nt),mt=T(st,pt),ht=T([`monthCode`],nt),gt=T(st,ht),_t=T(rt,[`monthCode`]),vt=T(rt,pt),yt=T(rt,st,pt),bt=T(vt,k),xt=T(yt,k),St=T(vt,k,at),Ct=T(yt,k,at),wt=T(vt,k,at,ot),Tt=T(yt,k,at,ot),Et=T(rt,ht),Dt=T(rt,st,ht),Ot=de(k,0);function kt(e){return jt(e,1),e}const At={hour:23,minute:59,second:59};function jt(e,t){let n={};for(let r of k)n[r]=oe(r,e[r],0,At[r]||999,t);return n}function Mt(e){return Pt(e)*We+Ft(e)}function Nt(e){return 1e3*Pt(e)+e.millisecond}function Pt(e){return 3600*e.hour+60*e.minute+e.second}function Ft(e){return e.millisecond*Ue+e.microsecond*He+e.nanosecond}function It(e){let[t,n]=Te(e,qe);return[Lt(n),t]}function Lt(e){let[t,n]=Te(e,Ue),[r,i]=Te(n,He);return Rt(t,r,i)}function Rt(e,t=0,n=0){let[r,i]=Te(e,36e5),[a,o]=Te(i,6e4),[s,c]=Te(o,1e3);return{hour:r,minute:a,second:s,millisecond:c,microsecond:t,nanosecond:n}}function zt(e){let[t,n]=we(e,Ze);return[Number(t),Number(n)]}function Bt(e){return Ht(e)+BigInt(Mt(e))}function Vt(e){return Ut(e)+Nt(e)}function Ht(e){return BigInt(Wt(e))*O}function Ut(e){return 864e5*Wt(e)}function Wt(e){return Gt(e.year,e.month,e.day)}function Gt(e,t=1,n=1){let r=t-1;return e+=Math.floor(r/12),t=Ee(r,12),Date.UTC(e%400-400,t,0)/864e5+146097*(De(e,400)+1)+n}function Kt(e){let[t,n]=we(e,O);return{...Jt(Number(t)),...Lt(Number(n))}}function qt(e,t=0,n=0){let[r,i]=Te(e,864e5);return{...Jt(r),...Rt(i,t,n)}}function Jt(e){let t=new Date(864e5*Ee(e,146097));return{year:t.getUTCFullYear()+400*Math.floor(e/146097),month:t.getUTCMonth()+1,day:t.getUTCDate()}}function Yt(e,t){return Math.trunc((t-e)/864e5)}function Xt(e){return[e,0]}function Zt(e,t){if(!t)return{year:1972,month:e}}function Qt(e,t,n){return{year:e,month:t,day:n}}function $t(e,t){switch(t){case 2:return tn(e)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function en(e){return tn(e)?366:365}function tn(e){return e%4==0&&(e%100!=0||e%400==0)}function nn(e,t,n){return e+=De(n,12),(t+=Oe(n,12))<1?(e--,t+=12):t>12&&(e++,t-=12),{year:e,month:t}}function rn(e,t,n,r){return 12*(n-e)+r-t}function an(e){return Ee(Gt(e.year,e.month,e.day)+4,7)||7}function on(e){return Gt(e.year,e.month,e.day)-Gt(e.year)+1}function sn(e){let t=e.year,n=Math.floor((on(e)-an(e)+10)/7),r=cn(t);return n<1?n=r=cn(--t):n>r&&(n=1,r=cn(++t)),{weekOfYear:n,yearOfWeek:t,Ie:r}}function cn(e){let t=an({year:e,month:1,day:1});return t===4||t===3&&tn(e)?53:52}function ln({year:e}){return e<1?{era:`bce`,eraYear:1-e}:{era:`ce`,eraYear:e}}function un(e){return dn(e),kt(e)}function dn(e){return pn(e,1),e}function fn(e){return pe(it,e,pn(e))}function pn(e,t){let{year:n}=e,r=ae(e,`month`,1,12,t);return{year:n,month:r,day:ae(e,`day`,1,$t(n,r),t)}}function A(e,t){return e?e.ie(t):t}function mn(e,t,n){return e?e.O(t,n):Xt(n)}function hn(e,t){return e===0?ln(t):e?e.h(t):{}}function gn(e,t,n,r){return e?e.je(t,n,r):Qt(t,n,r)}function _n(e,t){return e?e.k(t):12}function vn(e,t,n){return e?e.p(t,n):$t(t,n)}function yn(e,t){let{year:n,month:r}=A(e,t),[i,a]=mn(e,n,r);return Ie(i,a)}function bn(e,t){let{year:n}=A(e,t);return e?e.u(n):tn(n)}function xn(e,t){let{year:n}=A(e,t);return _n(e,n)}function Sn(e,t){let{year:n,month:r}=A(e,t);return vn(e,n,r)}function Cn(e,t){let{year:n}=A(e,t);return e?e.j(n):en(n)}function wn(e,t){if(!e)return on(t);let{year:n}=A(e,t),r=gn(e,n,1,1);return Wt(t)-Wt(r)+1}function Tn(e,t){return e===void 0?sn(t).weekOfYear:void 0}function En(e,t){return e===void 0?sn(t).yearOfWeek:void 0}const j=Be.map(e=>e+`s`),Dn=fe(j),On=T(j),kn=j.slice(0,6),An=j.slice(6),jn=An.slice(1),Mn=j.reduce((e,t,n)=>(e[t]=n,e),{}),M=de(j,0),Nn=de(kn,0),Pn=w(me,j);function Fn(e,t){return t??b(m(e)),t}const N=w(In,`string`);function In(e,t,n=e){return typeof t!==e&&x(p(n,t)),t}function Ln(e,t=`number`){return Number.isInteger(e)||b(((e,t)=>`Non-integer ${e}: ${t}`)(t,e)),e||0}function Rn(e){return typeof e==`symbol`&&x(`Cannot convert Symbol to string`),String(e)}function zn(e,t){return d(e)?String(e):N(e,t)}function Bn(e){return typeof e==`boolean`?BigInt(e?1:0):typeof e==`string`?BigInt(e):(typeof e!=`bigint`&&x(`Invalid bigint: ${e}`),e)}function Vn(e,t){return Ln(o(e,t),t)}function Hn(e,t){return typeof e==`string`?((e,t)=>{let n=Object.create(null);return n[e]=t,n})(t,e):f(e)}const Un=`smallestUnit`,Wn={constrain:0,reject:1},Gn={compatible:0,reject:1,earlier:2,later:3},Kn={reject:0,use:1,prefer:2,ignore:3},qn={auto:0,never:1,critical:2,always:3},Jn={auto:0,never:1,critical:2},Yn={auto:0,never:1},Xn={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},Zn=[Math.floor,e=>Ae(e)?Math.floor(e):Math.round(e),Math.ceil,e=>Ae(e)?Math.ceil(e):Math.round(e),Math.trunc,e=>Ae(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=>Ae(e)?(e=Math.trunc(e)||0)+e%2:Math.round(e)],Qn={previous:-1,next:1};function $n(e){let t=e.roundingIncrement;return t===void 0?1:s(t,`roundingIncrement`)}function er(e){let t=e.fractionalSecondDigits;if(t!==void 0){if(typeof t!=`number`){if(Rn(t)===`auto`)return;b(p(`fractionalSecondDigits`,t))}t=oe(`fractionalSecondDigits`,Math.floor(t),0,9,1)}return t}function tr(e,t,n=0,r){let i=t[e];if(i===void 0)return r?n:void 0;if(i=Rn(i),i===`auto`)return r?n:null;let a=ze[i];return a===void 0&&(a=Mn[i]),a===void 0&&b(g(e,i,ze)),a}function nr(e,t,n,r=0){let i=n[e];if(i===void 0)return r;let a=Rn(i),o=t[a];return o===void 0&&b(g(e,a,t)),o}const rr=w(tr,Un),ir=w(tr,`largestUnit`),ar=w(tr,`unit`),or=w(nr,`overflow`,Wn),sr=w(nr,`disambiguation`,Gn),cr=w(nr,`offset`,Kn),lr=w(nr,`calendarName`,qn),ur=w(nr,`timeZoneName`,Jn),dr=w(nr,`offset`,Yn),fr=w(nr,`roundingMode`,Xn),pr=w(nr,`direction`,Qn);function mr(e,t,n,r){let i=r?qe:Je[t+1];if(i){let n=Je[t];i%((e=oe(`roundingIncrement`,e,1,i/n-(r?0:1),1))*n)&&b(p(`roundingIncrement`,e))}else e=oe(`roundingIncrement`,e,1,n?10**9:1,1);return e}function hr(e,t,n,r){return t!=null&&oe(e,t,n,r,1,Be),t}function gr(e,t){t>e&&b(`smallestUnit > largestUnit`)}function _r(e,t,n,r=9,i=0,o=4){t=a(t);let s=ir(t,i),c=$n(t),l=fr(t,o),u=rr(t,i,1);return s=hr(`largestUnit`,s,i,r),u=hr(Un,u,i,r),s==null?s=Math.max(n,u):gr(s,u),c=mr(c,u,1),e&&(l=(e=>e<4?(e+2)%4:e)(l)),[s,u,c,l]}function vr(e,t=6,n){let r=$n(e=Hn(e,Un)),i=fr(e,7),a=rr(e);return a=Fn(Un,a),a=hr(Un,a,0,t),r=mr(r,a,void 0,n),[a,r,i]}function P(e,t){return C(it,e,C(k,t))}function F(e){return e===void 0?0:or(f(e))}function yr(e,t=0){e=a(e);let n=sr(e),r=cr(e,t);return[or(e),r,n]}const br=BigInt(1e8)*O,xr=BigInt(-1e8)*O,Sr=xr-O,Cr=-3261848;function wr(e){let t=12*e.year+e.month;return(t<Cr||t>3309129)&&b(`Out-of-bounds date`),e}function Tr(e,t=1){return Dr(Ht(e),t),e}function Er(e){let t=Ht(e);return Dr(t),t!==Sr||Mt(e)||b(`Out-of-bounds date`),e}function Dr(e,t=1){(e<(t?Sr:xr)||e>br)&&b(`Out-of-bounds date`)}function Or(e){return(e<xr||e>br)&&b(`Out-of-bounds date`),e}function kr(e,t){return Or(Ht(e)+BigInt(Mt(e)-t))}function Ar(e){return{epochNanoseconds:e}}function jr(e,t,n){return{calendar:n,timeZone:t,epochNanoseconds:e}}function Mr(e,t){return C(k,e,I(e,t))}function I(e,t){return C(it,e,{calendar:t})}function Nr(e){return C(k,e)}function L(e){return C(j,e,{sign:ta(e)})}function Pr(e){return t=e.epochNanoseconds,Number(Ce(t,Xe));var t}function Fr(e){return e.epochNanoseconds}function Ir(e,t,n){let r=ua(t),[i,a]=((e,t)=>{let n=t((e=Hn(e,`unit`)).relativeTo),r=ar(e);return r=Fn(`unit`,r),[r,n]})(n,e);if(!a&&qi(Math.max(i,r),a))return Rr(t,i);if(a||b(`Missing relativeTo`),!t.sign&&qi(i,a))return 0;let o=Vi(a),s=o.G(o.i,t);Wi(o,s);let c=o.re(o.i,s,i);return qi(i,a)?Rr(c,i):Lr(c,o.V(s),i,o)}function Lr(e,t,n,r){let i=ta(e)||1,a=zr(Pn(n,e),n,i,r,t),o=a.ae,s=a.de,c=Number(s-o),l=Number(t-o);return a.ye[j[n]]+l/c*i}function Rr(e,t){return et(ia(e),Je[t])}function zr(e,t,n,r,i){let a=j[t],o=e,s=0,c=Br(o,a,n,r);return i&&!((e,t,n,r)=>r>0?D(t,e)<=0&&D(e,n)<=0:D(n,e)<=0&&D(e,t)<=0)(i,c.ae,c.de,Math.sign(n))&&(o={...e,[a]:e[a]+n},s=1,c=Br(o,a,n,r)),{...c,ye:o,He:s}}function Br(e,t,n,r){let i={...e,[t]:e[t]+n};return{ae:Hi(r,e),de:Hi(r,i),Ae:i}}function Vr(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=D(i,0n)===D(r,0n)?1:-1;return D(a,o)<=0?a===o?s:ke(D(2n*a,o),s):Number(i)/Number(r)}function Hr(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=P(R(e),Ot),n=P(vi(t,1),Ot),o=ui(a,t),s=ui(a,n);i=ni(Vr(i,o,s),r)?s:o}else{let o=R(e),s=o.offsetNanoseconds;i=ci(a,Gr(o,Jr(t,n),r),s,2,0,1)}return{epochNanoseconds:i,timeZone:a,calendar:o}}function Ur(e){let{timeZone:t}=e,n=P(R(e),Ot),r=P(vi(n,1),Ot),i=ui(t,n);return et(ui(t,r)-i,Ke)}function Wr(e){let{timeZone:t,calendar:n}=e;return jr(ui(t,P(R(e),Ot)),t,n)}function Gr(e,t,n){let[r,i]=Kr(e,t,n),a=P(vi(e,i),r);return Er(a),a}function Kr(e,t,n){return It(ti(Mt(e),t,n))}function qr(e){return ti(e,Ge,7)}function Jr(e,t){return Je[e]*t}function Yr(e,t){return BigInt(Je[e])*BigInt(t)}function Xr(e,t,n){let r=Math.min(ua(e),6);return sa(Qr(ia(e),BigInt(t),n),r)}function Zr(e,t,n,r,i,a,o){if(r===0&&i===1)return e;let s=ta(e)||1,[c,l,u]=(qi(r,o.i)?Ui(o.i)&&r<6&&n>=6?ii:ri:ai)(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=Pn(o,e);r[j[o]]+=i;let s=D(t,Hi(a,r));if(s&&s!==i)break;e=r}return e})(c,l,n,Math.max(6,r),s,o)),c}function Qr(e,t,n){return ei(e,t,n,e/t%2n)}function $r(e,t,n){let[r,i]=we(e,O),a=r*O;return a+ei(i,t,n,(a/t+i/t)%2n)}function ei(e,t,n,r){let i=e/t,a=e%t,o=0;a&&(o=ke(D(2n*(a<0n?-a:a),t),Math.sign(Number(a))));let s=ni(Number(r)+o,n);return(i-r+BigInt(s))*t}function ti(e,t,n){return ni(e/t,n)*t}function ni(e,t){return Zn[t](e)}function ri(e,t,n,r,i,a,o){let s=ia(t),c=Qr(s,Yr(i,a),o),l=c-s,u=Math.sign(Number(c/O)-Number(s/O))===e,d=sa(c,Math.min(r,6));return[{...t,...d},n+l,u]}function ii(e,t,n,r,i,a,o,s){let c=Number(aa(t)),l=Jr(i,a),u=ti(c,l,o),d=zr({...t,...Nn},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=ti(m,l,o),n=p+BigInt(u));let g=ca(u);return[{...t,...g,days:t.days+h},n,!!h]}function ai(e,t,n,r,i,a,o,s){let c=j[i],l=Pn(i,t);i===7&&(t={...t,weeks:t.weeks+Math.trunc(t.days/7)}),l[c]=De(t[c],a)*a;let u=zr(l,i,a*e,s,n),d=u.ae,f=u.de,p=Vr(n,d,f),m=u.ye[c],h=u.Ae[c],g=ti(m+p*e*a,a,o),_=g===h;return l[c]=g,[l,_?f:d,u.He||_]}function oi(e,t){return e.timeZone.U(e.epochNanoseconds,(e=>{let t=pr(Hn(e,`direction`),0);return t||b(p(`direction`,t)),t})(t))}const R=S(si,WeakMap);function si(e){let{epochNanoseconds:t,timeZone:n}=e,r=n.C(t);return{...Kt(t+BigInt(r)),offsetNanoseconds:r}}function ci(e,t,n,r=0,i=0,a,o){if(n!==void 0&&r===1&&(r===1||o))return kr(t,n);r!==2&&r!==0||Tr(t,0);let s=e.R(t);if(n!==void 0&&r!==3){let e=((e,t,n,r)=>{let i=Bt(t);r&&(n=qr(n));for(let t of e){let e=Number(i-t);if(r&&(e=qr(e)),e===n)return t}})(s,t,n,a);if(e!==void 0)return e;r===0&&b(`Invalid TimeZone offset`)}return o?Bt(t):li(e,t,i,s)}function li(e,t,n=0,r=e.R(t)){if(r.length===1)return r[0];if(n===1&&b(`Ambiguous offset`),r.length)return r[n===3?1:0];let i=Bt(t),a=((e,t)=>{let n=e.C(t-O);return(e=>(e>864e11&&b(`Out-of-bounds TimeZone gap`),e))(e.C(t+O)-n)})(e,i),o=Kt(i+BigInt(a*(n===2?-1:1)));return(r=e.R(o))[n===2?0:r.length-1]}function ui(e,t){let n=e.R(t);if(n.length)return n[0];let r=Bt(t)-O;return e.U(r,1)}function di(e,t,n,r,i){let a=F(i);return r.sign&&ua(r)<8&&b(`Cannot use small units`),gi(t,yi(t,Tr(gi(t,n)),e?z(r):r,a))}function fi(e,t){return Or(e+(la(n=t)&&b(`Cannot use large units`),aa(n)));var n}function pi(e,t,n){let{calendar:r,epochNanoseconds:i,timeZone:a}=e,o=aa(t),s=i;if(la(t)){let i=R(e);s=li(a,P(hi(r,i,{...t,...Nn},n),i))+o}else s+=o,F(n);return{...e,epochNanoseconds:Or(s)}}function mi(e,t,n,r){let[i,a]=_i(t,n),o=P(hi(e,t,{...n,...Nn,days:n.days+a},r),i);return Er(o),o}function hi(e,t,n,r){if(n.years||n.months||n.weeks)return yi(e,t,n,F(r));F(r);let i=n.days+Number(aa(n)/O);return i?Tr(vi(t,i)):t}function gi(e,t){return vi(t,1-A(e,t).day)}function _i(e,t){let n=aa(t),r=Number(n/O),i=Number(n%O),[a,o]=It(Mt(e)+i);return[a,r+o]}function vi(e,t){return t?Jt(Wt(e)+t):e}function yi(e,t,n,r){let{years:i,months:a,weeks:o,days:s}=n,c;if(s+=Number(aa(n)/O),i||a)c=bi(e,t,i,a,r);else{if(!o&&!s)return t;c=t}return(o||s)&&(c=vi(c,7*o+s)),Tr(c)}function bi(e,t,n,r,i){let{year:a,month:o,day:s}=A(e,t);if(n){let[t,r]=mn(e,a,o);a+=n,o=xi(e,t,r,e?e.q(a):void 0,i),o=oe(`month`,o,1,_n(e,a),i)}if(r){let t=e?e.N(a,o,r):nn(a,o,r);({year:a,month:o}=t)}return s=oe(`day`,s,1,vn(e,a,o),i),gn(e,a,o,s)}function xi(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&&b(v),n<0?-n:t)}return Le(t,0,r)}function Si(e,t){return Ne(e)!==Ne(t)&&b(`Mismatching Calendars`),e}function Ci(e,t){return e.o!==t.o&&b(`Mismatching TimeZones`),e}function wi(e){return e.timeZone.id}function Ti(e,t,n,r){let[i,a,o,s]=_r(e,r,3,5),c=Ri(t.epochNanoseconds,n.epochNanoseconds,i,a,o,s);return L(e?z(c):c)}function Ei(e,t,n,r,i){let[a,o,s,c]=_r(e,i,5),l=n.epochNanoseconds,u=r.epochNanoseconds,d;return D(u,l)?a<6?d=Ri(l,u,a,o,s,c):(d=Mi(Ci(n.timeZone,r.timeZone),t,n,r,a),d=Zr(d,u,a,o,s,c,Bi(n,Fr,pi))):d=M,L(e?z(d):d)}function Di(e,t,n,r,i){let[a,o,s,c]=_r(e,i,6),l=Bt(n),u=Bt(r),d=D(u,l),f;return d?a<=6?f=Ri(l,u,a,o,s,c):(f=Pi(t,n,r,d,a),f=Zr(f,u,a,o,s,c,Bi(n,Bt,w(mi,t)))):f=M,L(e?z(f):f)}function Oi(e,t,n,r,i){let[a,o,s,c]=_r(e,i,6,9,6);return Ai(e,t,n,r,a,o,s,c)}function ki(e,t,n,r,i){let[a,o,s,c]=_r(e,i,9,9,8),l=gi(t,n),u=gi(t,r);return Ii(l,u)?Ai(e,t,Tr(l),Tr(u),a,o,s,c,8):L(M)}function Ai(e,t,n,r,i,a,o,s,c=6){let l=Ht(n),u=Ht(r),d;return D(u,l)?i===6?d=Ri(l,u,i,a,o,s):(d=Fi(t,n,r,i),a===c&&o===1||(d=Zr(d,u,i,a,o,s,Bi(n,Ht,w(hi,t))))):d=M,L(e?z(d):d)}function ji(e,t,n,r){let[i,a,o,s]=_r(e,r,5,5),c=ti(Mt(n)-Mt(t),Jr(a,o),s),l={...M,...ca(c,i)};return L(e?z(l):l)}function Mi(e,t,n,r,i){let a=D(r.epochNanoseconds,n.epochNanoseconds);if(!a)return M;if(i<6)return{...M,...sa(r.epochNanoseconds-n.epochNanoseconds,i)};if(!Ii(R(n),R(r)))return{...M,...sa(r.epochNanoseconds-n.epochNanoseconds,5)};let[o,s,c]=Li(e,n,r,a);return{...i===6?{...M,days:zi(o,s)}:Fi(t,o,s,i),...ca(c)}}function Ni(e,t,n,r){let i=Bt(t),a=Bt(n),o=D(a,i);return o?r<=6?{...M,...sa(a-i,r)}:Pi(e,t,n,o,r):M}function Pi(e,t,n,r,i){let a=n,o=Mt(n)-Mt(t);return Math.sign(o)===-r&&(a=vi(n,-r),o+=864e11*r),{...Fi(e,t,a,i),...ca(o)}}function Fi(e,t,n,r){if(r<=7){let e=zi(t,n);return r===7?{...M,weeks:De(e,7),days:Oe(e,7)}:{...M,days:e}}let i=A(e,t),a=A(e,n);if(r===8){let{year:r,month:o,day:s}=i,{year:c,month:l,day:u}=a,d=Math.sign(E(c,r)||E(l,o)||zi(t,n)),f=0,p=0;if(d){f=e?e.ne(r,o,c,l):rn(r,o,c,l);let i=bi(e,t,0,f,0);d*E(s,u)>0&&(f-=d,i=bi(e,t,0,f,0)),p=zi(i,n)}return{...M,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=vn(e,l,u),r=0;if(Math.sign(d-c)===-t){let i=n,a=e?e.N(l,u,-t):nn(l,u,-t);({year:l,month:u}=a),f=l-o,p=u-s,n=vn(e,l,u),r=t<0?-i:n}if(m=d-Math.min(c,n)+r,f){let[n,r]=mn(e,o,s),[i,a]=mn(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&&-_n(e,l);l-=t,f=l-o,p=u-xi(e,n,r,e?e.q(l):void 0,0)+(i||_n(e,l))}else if(e){let t=xi(e,n,r,e.q(l),0);p=e.ne(l,t,l,u)}}}return{...M,years:f,months:p,days:m}}function Ii(e,t){return E(e.year,t.year)||E(e.month,t.month)||E(e.day,t.day)}function Li(e,t,n,r){let i=R(t),a=R(n),o=n.epochNanoseconds,s=0,c=Mt(a)-Mt(i);Math.sign(c)===-r&&s++;let l=s+(r>0?1:0);for(;s<=l;s++){let t=vi(a,s*-r),n=li(e,P(t,i));if(D(o,n)!==-r)return[i,t,Number(o-n)]}}function Ri(e,t,n,r,i,a){return{...M,...sa(Qr(t-e,Yr(r,i),a),n)}}function zi(e,t){return Wt(t)-Wt(e)}function Bi(e,t,n){return{i:e,V:t,G:n}}function Vi(e){let{calendar:t}=e;if(Ui(e)){let{timeZone:n}=e;return{i:e,V:Fr,G:pi,re:w(Mi,n,t)}}return{i:Gi(e),V:Bt,G:w(mi,t),re:w(Ni,t)}}function Hi(e,t){return e.V(e.G(e.i,t))}function Ui(e){return`timeZone`in e}function Wi(e,t){Ui(e.i)||(Ki(e.i),Ki(t))}function Gi(e){return P(e,`hour`in e?e:Ot)}function Ki(e){Er(Gi(e))}function qi(e,t){return e<=6-(t&&Ui(t)?1:0)}function Ji(e,t,n){let r={};for(let i=t;i>=0;i--){let t=Je[i];r[n[i]]=De(e,t),e=Oe(e,t)}return r}const Yi=2**53;function Xi(e,t,n,r,i){let o=e(a(i).relativeTo),s=Math.max(ua(n),ua(r));if(qi(s,o))return Zi(t,n,r,s);o||b(`Missing relativeTo`),t&&(r=z(r));let c=Vi(o),l=c.G(c.i,n),u=c.G(l,r);return L(c.re(c.i,u,s))}function Zi(e,t,n,r){return L(na(((e,t,n,r)=>{let i=ia(e)+ia(t)*BigInt(r?-1:1);return Number.isFinite(Number(i/O))||b(`Out-of-bounds date`),{...M,...sa(i,n)}})(t,n,r,e)))}function Qi(e,t,n){let r=ua(t),[i,a,o,s,c]=((e,t,n)=>{e=Hn(e,Un);let r=ir(e),i=n(e.relativeTo),a=$n(e),o=fr(e,7),s=rr(e);return r===void 0&&s===void 0&&b(`Required smallestUnit or largestUnit`),s??=0,r??=Math.max(s,t),gr(r,s),a=mr(a,s,1),a>1&&s>5&&r!==s&&b(`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 L(na(((e,t,n,r,i)=>{let a=Qr(ia(e),Yr(n,r),i);return{...M,...sa(a,t)}})(t,i,a,o,s)));let l=c&&Ui(c)&&i>=6&&a<6;if(!t.sign&&!l)return t;c||b(`Missing relativeTo`);let u=Vi(c),d=u.G(u.i,t);Wi(u,d);let f=u.re(u.i,d,i);return f=Zr(f,u.V(d),i,a,o,s,u),L(f)}function $i(e){return e.sign===-1?ea(e):e}function ea(e){return L(z(e))}function z(e){let t={};for(let n of j)t[n]=-1*e[n]||0;return t}function ta(e,t=j){let n=0;for(let r of t){let t=Math.sign(e[r]);t&&(n&&n!==t&&b(`Cannot mix duration signs`),n=t)}return n}function na(e){for(let t of jn)oe(t,e[t],-4294967295,4294967295,1);let t=ia(e);return ra(Number(t/Ze)),e}function ra(e){Number.isSafeInteger(e)||b(`Out-of-bounds duration`)}function ia(e){return BigInt(e.days)*O+aa(e)}function aa(e){return BigInt(e.hours)*$e+BigInt(e.minutes)*Qe+oa(e)}function oa(e){return BigInt(e.seconds)*Ze+BigInt(e.milliseconds)*Xe+BigInt(e.microseconds)*Ye+BigInt(e.nanoseconds)}function sa(e,t=6){let n=Number(e/O),r=Number(e%O),i=Je[t],a=t<=3?Number(e/BigInt(i)):qe/i*n+De(r,i);Number.isFinite(a)||b(`Out-of-bounds date`),t<=3&&Math.abs(a)/(We/Je[t])>=Yi&&b(`Out-of-bounds date`);let o=Ji(r,t,j);return o[j[t]]=a,o}function ca(e,t=5){return Ji(e,t,j)}function la(e){return!!ta(e,An)}function ua(e){let t=9;for(;t>0&&!e[j[t]];t--);return t}function da(e,t){return D(e.epochNanoseconds,t.epochNanoseconds)}function fa(e,t){return D(e.epochNanoseconds,t.epochNanoseconds)}function pa(e,t,n,r){let i=e(a(r).relativeTo),o=Math.max(ua(t),ua(n));if(pe(j,t,n))return 0;if(qi(o,i))return D(ia(t),ia(n));i||b(`Missing relativeTo`);let s=Vi(i);return D(Hi(s,t),Hi(s,n))}function ma(e,t){return ha(e,t)||ga(e,t)}function ha(e,t){return E(Wt(e),Wt(t))}function ga(e,t){return E(Mt(e),Mt(t))}function _a(e,t){return!da(e,t)}function va(e,t){return!fa(e,t)&&e.timeZone.o===t.timeZone.o&&e.calendar===t.calendar}function ya(e,t){return!ma(e,t)&&e.calendar===t.calendar}function ba(e,t){return!ha(e,t)&&e.calendar===t.calendar}function xa(e,t){return!ha(e,t)&&e.calendar===t.calendar}function Sa(e,t){return!ha(e,t)&&e.calendar===t.calendar}function Ca(e,t){return!ga(e,t)}function wa(e){return e===0?je:e?e.l:void 0}function B(e,t,n=t){return wa(e)?n:t}function Ta(e,t){let n=e||void 0,r=wa(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||x(`Mismatching era/eraYear`),r||b(`Forbidden era/eraYear`);let e=Me(i),t=r[e];t===void 0&&b((e=>`Invalid era: ${e}`)(i));let s=n?.te?n.te(a,e,t):Oa(a,t);o!==void 0&&o!==s&&b(`Mismatching year/eraYear`),o=s}else o===void 0&&x(_(r));return o}function Ea(e,t,n,r,i){let{month:a,monthCode:o}=t;if(o!==void 0){let t=((e,t,n,r,i=Fe(t))=>{let a=e?e.q(n):void 0,[o,s]=i,c=Le(o,s,a);if(s){let t=e?e.m:void 0;t===void 0&&b(v),t>0?(c>t&&b(v),a!==c&&(r===1&&b(v),c=Le(o,0,a))):(c!==-t&&b(v),a===void 0&&r===1&&b(v))}return c})(e,o,n,r,i);a!==void 0&&a!==t&&b(`Mismatching month/monthCode`),a=t,r=1}else a===void 0&&x(`Missing month/monthCode`);return oe(`month`,a,1,_n(e,n),r)}function Da(e,t,n,r,i){return ae(t,`day`,1,vn(e,r,n),i)}function Oa(e,t){return(t+e)*(Math.sign(t)||1)||0}function ka(e,t){return jt(C(k,{...Ot,...e}),t)}const Aa=_e(`([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?`);function ja(e){let t=Ma(e);return t===void 0&&b(ne(e)),t}function Ma(e,t){let n=Aa.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&&b(re(n)),r=(be(e[2])*Ke+be(e[3])*Ge+be(e[4])*We+ve(e[5]||``))*ye(e[1]),Math.abs(r)>=864e11&&b(`Out-of-bounds offset`),r;var r})(n,t)}const Na={era:zn,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 N(n.call(e),t)}return N(e,t)})(e,t)},day:c},Pa=de(k,s),Fa=de(j,Vn),Ia={offset(e){return ja(zn(e))}},La=Object.assign({},Na,Pa),Ra=Object.assign({},La,Ia);function V(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)&&x(m(i))}return i&&!o&&x(h(t)),a}function za(e,t=Ot,n){let r=P(e,t);return Er(r),Mr(r,n)}function Ba(e,t,n){return Ha(e,t,Wa(e,t),F(n))}function Va(e,t,n){let r=Wa(e,t),i=n();return[Ha(e,t,r,i[0]),...i]}function Ha(e,t,n,r){let i=n[1],a=Ea(e,t,i,r,n[0]);return I(Tr(gn(e,i,a,Da(e,t,a,i,r))),e)}function Ua(e){if(e.monthCode!==void 0)return Fe(e.monthCode)}function Wa(e,t){let n=wa(e);return t.year!==void 0||t.era!==void 0&&t.eraYear!==void 0||x(_(n)),t.monthCode===void 0&&t.month===void 0&&x(`Missing month/monthCode`),t.day===void 0&&x(m(`day`)),[Ua(t),Ta(e,t)]}function Ga(e,t,n){let r=wa(e);t.year!==void 0||t.era!==void 0&&t.eraYear!==void 0||x(_(r)),t.monthCode===void 0&&t.month===void 0&&x(`Missing month/monthCode`);let i=Ua(t),a=Ta(e,t);return I(wr(gn(e,a,Ea(e,t,a,F(n),i),1)),e)}function Ka(e,t,n){let r=e===void 0,i=wa(e);t.day===void 0&&x(m(`day`)),r||t.month===void 0||t.year!==void 0||t.era!==void 0&&t.eraYear!==void 0||x(_(i));let a=Ua(t),o=t.eraYear!==void 0||t.year!==void 0?Ta(e,t):void 0,s=F(n),c,l,u;if(o===void 0&&r&&(o=1972),o!==void 0){r||Tr(gn(e,o,1,1));let n=Ea(e,t,o,s,a);c=Da(e,t,n,o,s),[l,u]=mn(e,o,n)}else{t.monthCode===void 0&&x(`Missing month/monthCode`),[l,u]=a;let n=e?e.ge:1972;if(n!==void 0)c=Da(e,t,Ea(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&&b(v),u=0,c=ie(t.day,1,(e&&e.X)??1/0));let d=e?e.v(l,!!u,c):Zt(l,!!u);for(;!d&&s===0&&c>1;)c--,d=e?e.v(l,!!u,c):Zt(l,!!u);d||b(`Cannot guess year`);let{year:f,month:p}=d;return I(Tr(gn(e,f,p,c)),e)}const qa=Intl.DateTimeFormat;function Ja(e,t){t<-864e13&&b(`Out-of-bounds date`);let n=e.formatToParts(t),r={};for(let e of n)r[e.type]=e.value;return r}const Ya={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},Xa=-388152e4;function Za(e,t=4){let n=er(e);return[fr(e,4),...eo(hr(Un,rr(e),0,t),n)]}function Qa(e){return lr(a(e))}function $a(e,t){return Za(a(e),t)}function eo(e,t){return e==null?[t===void 0?1:10**(9-t),t]:[Je[e],e<4?9-3*e:-1]}function to(e,t,n){let[r,i,o,s]=(e=>{let t=er(e=a(e)),n=fr(e,4),r=rr(e);return[e.timeZone,n,...eo(hr(Un,r,0,4),t)]})(n),c=r!==void 0;return((e,t,n,r,i,a)=>{n=$r(n,BigInt(i),r);let o=t.C(n);return mo(Kt(n+BigInt(o)),a)+(e?yo(qr(o)):`Z`)})(c,No(c?e(r):`UTC`),t.epochNanoseconds,i,o,s)}function no(e,t){let n=(e=>{e=a(e);let t=lr(e),n=er(e),r=dr(e),i=fr(e,4),o=rr(e);return[t,ur(e),r,i,...eo(hr(Un,o,0,4),n)]})(t);return((e,t,n,r,i,a,o,s,c,l)=>{r=$r(r,BigInt(c),s);let u=n.C(r);return mo(Kt(r+BigInt(u)),l)+yo(qr(u),o)+bo(t,a)+xo(e,i)})(e.calendar,e.timeZone.id,e.timeZone,e.epochNanoseconds,...n)}function ro(e,t){let n=(e=>(e=a(e),[lr(e),...Za(e)]))(t);return((e,t,n,r,i,a)=>mo(Gr(t,i,r),a)+xo(e,n))(e.calendar,e,...n)}function io(e,t){return n=e.calendar,r=e,i=Qa(t),ho(r)+xo(n,i);var n,r,i}function ao(e,t){return so(e.calendar,go,e,Qa(t))}function oo(e,t){return so(e.calendar,_o,e,Qa(t))}function so(e,t,n,r){return r===1?e===void 0?t(n):ho(n):r>1||r===0&&e!==void 0?ho(n)+So(Ne(e),r===2):t(n)}function co(e,t){return((e,t,n,r)=>vo(Kr(e,n,t)[0],r))(e,...$a(t))}function lo(e,t){let[n,r,i]=$a(t,3);return r>1&&na(e={...e,...Xr(e,r,n)}),uo(e,i)}function uo(e,t){let{sign:n}=e,r=n===-1?z(e):e,{hours:i,minutes:a}=r,o=oa(r),s=Number(o/Ze),c=Number(o%Ze);ra(s);let l=wo(c,t),u=t>=0||!n||l;return(n<0?`-`:``)+`P`+fo({Y:po(r.years),M:po(r.months),W:po(r.weeks),D:po(r.days)})+(i||a||s||u?`T`+fo({H:po(i),M:po(a),S:po(s,u)+l}):``)}function fo(e){let t=[];for(let n in e){let r=e[n];r&&t.push(r,n)}return t.join(``)}function po(e,t){if(!e&&!t)return``;let n=Object.create(null);return n.useGrouping=0,e.toLocaleString(`fullwide`,n)}function mo(e,t){return ho(e)+`T`+vo(e,t)}function ho(e){return go(e)+`-`+Se(e.day)}function go(e){let{year:t}=e;return(t<0||t>9999?To(t)+xe(6,Math.abs(t)):xe(4,t))+`-`+Se(e.month)}function _o(e){return Se(e.month)+`-`+Se(e.day)}function vo(e,t){let n=[Se(e.hour),Se(e.minute)];return t!==-1&&n.push(Se(e.second)+((e,t,n,r)=>wo(e*Ue+t*He+n,r))(e.millisecond,e.microsecond,e.nanosecond,t)),n.join(`:`)}function yo(e,t=0){if(t===1)return``;let[n,r]=Te(Math.abs(e),Ke),[i,a]=Te(r,Ge),[o,s]=Te(a,We);return To(e)+Se(n)+`:`+Se(i)+(o||s?`:`+Se(o)+wo(s):``)}function bo(e,t){return t===1?``:`[`+(t===2?`!`:``)+e+`]`}function xo(e,t){return t>1||t===0&&e!==void 0?So(Ne(e),t===2):``}function So(e,t){return`[`+(t?`!`:``)+`u-ca=`+e+`]`}const Co=/0+$/;function wo(e,t){let n=xe(9,e);return n=t===void 0?n.replace(Co,``):n.slice(0,t),n?`.`+n:``}function To(e){return e<0?`-`:`+`}const Eo=/^(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$/,Do=/[^\w\/:+-]+/;function Oo(e){return ko(N(e))}function ko(e){return Ao(e).id}function Ao(e){let t=e.toUpperCase(),n=(e=>{let t=Ma(e,1);if(t!==void 0)return{id:yo(t),_:t,o:t}})(t);return n?{kind:`fixed`,...n}:jo(t===`UTC`?`UTC`:(e=>(Do.test(e)&&b(te(e)),Eo.test(e)&&b(`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?ge(e).replace(/island|noronha|murdo|rivadavia|urville/,ge):e)).join(`/`)))(e))}const jo=S(e=>{if(e===`UTC`)return{kind:`utc`,id:e,o:e};let t=Mo(e.toUpperCase());return{kind:`named`,id:e,format:t,o:t.resolvedOptions().timeZone}}),Mo=S(e=>new qa(`en-u-hc-h23`,{calendar:`iso8601`,timeZone:e,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}));function No(e){let t=Ao(e);return Po(t.id,t)}const Po=S((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[kr(e,this._)]}U(){}},Io=class{constructor(e,t,n){this.id=e,this.o=t,this.qe=((e,t)=>{let n=S(e),r=S(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<=Xa)return;let n=Lo()+94867200;if(t>n)return e(n,-1)}let[s,c]=zo(a>0?Math.max(t,Xa):t,i),l=i*a,u=a>0?Math.max(t,Lo())+94867200:Xa,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((E(s,t)||1)===a)return s}s+=l,c+=l}}}})((e=>t=>{let n=Ja(e,1e3*t);return 86400*Gt((e=>{let t=e.relatedYear;if(t!==void 0)return parseInt(t);let n=parseInt(e.year);return e.era!==void 0&&Me(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=>Ya[e.split(`/`).pop()]||60)(e))}C(e){return this.qe.De((e=>zt(e)[0])(e))*We}R(e){let t=86400*Wt(e)+Pt(e),n=Ft(e);return this.qe.Ee(t).map(e=>Or(BigInt(e)*Ze+BigInt(n)))}U(e,t){let[n,r]=zt(e),i=this.qe.U(n+(t>0||r?1:0),t);if(i!==void 0)return BigInt(i)*Ze}};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 ie(e,-1e10,864e10)}function Vo(e,t,n){let r=V(n,B(t,wt,Tt),Ra,[],0);if(r.timeZone!==void 0){let n=Ba(t,r),i=ka(r),a=No(e(r.timeZone));return{epochNanoseconds:ci(a,P(n,i),r.offset),timeZone:a,calendar:t}}return Ba(t,r)}function Ho(e,t,n,r){let i=V(n,B(t,wt,Tt),Ra,ot,0),a=e(i.timeZone),[o,s,c,l]=Va(t,i,()=>yr(r)),u=ka(i,s),d=No(a);return jr(ci(d,P(o,u),i.offset,c,l),d,t)}function Uo(e,t,n){let r=V(t,B(e,bt,xt),La,[],0),[i,a]=Va(e,r,()=>[F(n)]);return za(i,ka(r,a),e)}function Wo(e,t,n,r=[]){return Ba(e,V(t,B(e,vt,yt),Na,r),n)}function Go(e,t,n,r){return Ga(e,V(t,B(e,pt,mt),Na,r),n)}function Ko(e,t,n,r){let i=V(n,B(e,vt,yt),Na,rt,0);return t&&i.month!==void 0&&i.monthCode===void 0&&i.year===void 0&&(i.year=1972),Ka(e,i,r)}function qo(e,t){return ka(V(e,dt,Pa,[],1),F(t))}function Jo(e){let t=V(e,On,Fa);return L(na({...M,...t}))}function Yo(e){b(ne(e))}function Xo(e){let t=ws(e=zn(e)),n;return t||Yo(e),t.F?n=0:t.offset?n=ja(t.offset):Yo(e),t.timeZoneId&&Ma(t.timeZoneId,1),un(t),Ar(kr(t,n))}function Zo(e,t){let n=ws(N(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(N(e));return r&&r.timeZoneId||Yo(e),fs(r,t,n)}function $o(e,t){let n=ws(N(e));return n&&!n.F||Yo(e),ps(n,t)}function es(e,t){let n=ls(cs(N(e)),void 0,t);return I(n,n.calendar)}function ts(e,t){let n=Ts(N(e));if(n)return ns(n),I(wr(dn(n)),t(n.calendarId));let r=ls(cs(e),us,t),{calendar:i}=r;return I(gi(i,r),i)}function ns(e){e.calendarId!==`iso8601`&&b(re(e.calendarId))}function rs(e,t){let n=Es(N(e));if(n)return ns(n),I(dn(n),t(n.calendarId));let r=ls(cs(e),ds,t),{calendar:i}=r,{year:a,month:o,day:s}=A(i,r),[c,l]=mn(i,a,o),{year:u,month:d}=((e,t,n,r)=>{let i=e?e.v(t,n,r):Zt(t,n);return i||b(`Cannot guess year`),i})(i,c,l,s);return I(Tr(gn(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=N(e)),n;return t||(t=ws(e),t?(t.fe||Yo(e),t.F&&b(re(`Z`)),ns(t)):Yo(e)),(n=Ts(e))&&fn(n)&&Yo(e),(n=Es(e))&&fn(n)&&Yo(e),Nr(kt(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),...Ji(r,2,j)};return t||b(h(j)),ye(e[1])<0&&(i=z(i)),i;function a(e,i,a){let o=0,s=0;return a&&([o,r]=Te(r,Je[a])),e!==void 0&&(n&&b(re(e)),s=(e=>{let t=parseInt(e);return Number.isFinite(t)||b(re(e)),t})(e),t=1,i&&(r=ve(i)*(Je[a]/We),n=1)),o+s}})(t):void 0})(N(e));return t||Yo(e),L(na(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`?(dn(e),e.fe&&kt(e),ms(t(e),n)):e.fe?ps(e,n):ms(e,n)}function us(e){let t=12*e.year+e.month===Cr?20:1;return{...e,day:t}}function ds(e){return{...e,year:1972}}function fs(e,t,n){let r=No(ko(e.timeZoneId)),i;if(un(e),e.fe){let t=e.offset?ja(e.offset):void 0,[,o,s]=yr(n);i=ci(r,e,t,o,s,!(r._||e.offset===void 0||(a=e.offset,a.replace(/\D/g,``).length>4)),e.F)}else yr(n),i=ui(r,e);var a;return Or(i),jr(i,r,t(e.calendarId))}function ps(e,t){return un(e),Er(e),{...P(e,e),calendar:t(e.calendarId)}}function ms(e,t){return dn(e),Tr(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=_e(`(?:(?:([+-])(\\d{6}))|(\\d{4}))-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})`),ys=_e(`(?:--)?(\\d{2})-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})`),bs=_e(_s+`((?:\\[(!?)([^\\]]*)\\]){0,9})`),xs=_e(`T?`+hs(2)+`(${gs(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`),Ss=RegExp(`\\[(!?)([^\\]]*)\\]`,`g`),Cs=_e(`([+-])?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]&&ja(t[6]),t}function Os(e,t){let n=be(e[t+3]);return{...It(ve(e[t+4]||``))[0],hour:be(e[t]),minute:be(e[t+2]),second:n===60?59:n}}function ks(e){let t=ye(e[1]),n=parseInt(e[2]||e[3]);return t<0&&!n&&b(re(-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))&&b(re(e)):(n&&b(re(e)),n=s),``}),r.length>1&&t&&b(re(e)),{timeZoneId:n,calendarId:r[0]||`iso8601`}}function js(e,t,n){let r=Object.assign(Object.create(null),t);return Ms(r,n,lt),wa(e)&&(Ms(r,n,ct),e&&e.le&&Ms(r,n,ut,st)),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=B(r,St,Ct),o=R(e),{year:s,month:c,day:l}=A(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=V(t,a,Ra),f=js(r,u,d),p={...u,...d},[m,h,g,_]=Va(r,f,()=>yr(n,2));return jr(ci(i,P(m,jt(p,h)),p.offset,g,_),i,r)}function Ps(e,t,n){let{calendar:r}=e,i=B(r,bt,xt),{year:a,month:o,day:s}=A(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=V(t,i,La),u=js(r,c,l),d={...c,...l},[f,p]=Va(r,u,()=>[F(n)]);return za(f,jt(d,p),r)}function Fs(e,t,n){let{calendar:r}=e,i=B(r,vt,yt),{year:a,month:o,day:s}=A(r,e);return Ba(r,js(r,{year:a,monthCode:Bs(r,a,o),day:s},V(t,i,Na)),n)}function Is(e,t,n){let{calendar:r}=e,i=B(r,pt,mt),{year:a,month:o}=A(r,e);return Ga(r,js(r,{year:a,monthCode:Bs(r,a,o)},V(t,i,Na)),n)}function Ls(e,t,n){let{calendar:r}=e,i=B(r,vt,yt),{year:a,month:o,day:s}=A(r,e);return Ka(r,js(r,{monthCode:Bs(r,a,o),day:s},V(t,i,Na)),n)}function Rs(e,t,n){return((e,t,n)=>ka({...C(dt,e),...V(t,dt,Pa)},F(n)))(e,t,n)}function zs(e,t){return L((n=e,r=t,na({...n,...V(r,On,Fa)})));var n,r}function Bs(e,t,n){let[r,i]=mn(e,t,n);return Ie(r,i)}function Vs(e,t,n){return jr(e.epochNanoseconds,t,n)}function Hs(e){return Ar(e.epochNanoseconds)}function Us(e){return Mr(R(e),e.calendar)}function Ws(e){return I(R(e),e.calendar)}function Gs(e){return Nr(R(e))}function Ks(e,t,n){return jr(Or(((e,t,n)=>li(e,t,(e=>sr(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=No(i),c;return c=o?li(s,P(n,o)):ui(s,P(n,Ot)),jr(c,s,n.calendar)}function Js(e,t,n){return Qs(e,C(B(e,ht,gt),t),V(f(n),rt,Na,[]))}function Ys(e,t,n){let r=B(e,nt,ft);return Qs(e,C(_t,t),V(f(n),r,Na,[]))}function Xs(e,t){return Ka(e,V(t,_t,Na))}function Zs(e,t,n){return Ga(e,V(t,B(e,ht,gt),Na),n)}function Qs(e,t,n){let r=B(e,Et,Dt),i=js(e,t,n);return i=V(i,r,Na,[]),Ba(e,i)}function $s(e){return Ar(Or(BigInt(Vn(e))*Xe))}function ec(e){return Ar(Or(Bn(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&&x(`Cannot specify TimeZone`),e.timeZone=t,e}function rc(e,t,n){let r=e.resolvedOptions().calendar;!n&&t.calendar===void 0||Ne(t.calendar)===r||b(`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)&&x(`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=R(e),{offsetNanoseconds:i}=r,a=t||Ot,o;return o=t?ci(n,P(r,a),i,2):ui(n,P(r,a)),jr(o,n,e.calendar)}function wc(e){let t=Tc(),n=e.C(t);return Kt(t+BigInt(n))}function Tc(){return BigInt(Date.now())*Xe}function Ec(){return new qa().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,se(e)),Object.defineProperties(t.prototype,le(`Temporal.`+e));for(let e of r)Ic(t.prototype,n,e);return t}function Ic(e,t,n){Object.defineProperties(e,ue(e=>({get(){return e(t(this))},configurable:1}),n))}const Lc=he.name===`noop`?e=>{Object.defineProperty(e,`_str_`,{value:e.toJSON()})}:he;function Rc(){x(`Invalid calling context`)}function zc(){x(`Cannot use valueOf`)}const Bc={era(e){return hn(e.calendar,e).era},eraYear(e){return hn(e.calendar,e).eraYear},year(e){return A(e.calendar,e).year},month(e){return A(e.calendar,e).month},monthCode(e){return yn(e.calendar,e)}},Vc={era(e){return hn(e.calendar,e).era},eraYear(e){return hn(e.calendar,e).eraYear},year(e){return A(e.calendar,e).year},month(e){return A(e.calendar,e).month},monthCode(e){return yn(e.calendar,e)},day(e){return A(e.calendar,e).day}},Hc={monthCode(e){return yn(e.calendar,e)},day(e){return A(e.calendar,e).day}},Uc={daysInMonth(e){return Sn(e.calendar,e)},daysInYear(e){return Cn(e.calendar,e)},monthsInYear(e){return xn(e.calendar,e)},inLeapYear(e){return bn(e.calendar,e)}},Wc={dayOfWeek(e){return an(e)},dayOfYear(e){return wn(e.calendar,e)},weekOfYear(e){return Tn(e.calendar,e)},yearOfWeek(e){return En(e.calendar,e)},daysInWeek(){return 7},daysInMonth(e){return Sn(e.calendar,e)},daysInYear(e){return Cn(e.calendar,e)},monthsInYear(e){return xn(e.calendar,e)},inLeapYear(e){return bn(e.calendar,e)}};function Gc(e){return fe(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 Qt(n(e),t,r)},se(e,t,r){return Gt(n(e),t,r)*Ve},O(e,t){return Xt(t)},v(e,t){let n=Zt(e,t);return n&&{year:r(n.year),month:n.month}},u(e){return tn(n(e))},k(){return 12},p(e,t){return $t(n(e),t)},j(e){return en(n(e))},q(){},h(t){return e.h?.(t,r(t.year))||{}},N(e,t,i){let a=nn(n(e),t,i);return{year:r(a.year),month:a.month}},ne(e,t,r,i){return rn(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:w(Xc,n),se:w(Zc,n),O:w(Qc,n,t.m),v:w(al,n,t.m,t.Ce),u:w(el,n,t.m),k:w(rl,n),p:w(nl,n),j:w(tl,n),q:w($c,n,t.m),h:w(il,n),N:w(ol,n),ne:w(sl,n)}}function Jc(e){let t=(e=>new qa(`en-u-hc-h23`,{calendar:e,timeZone:`UTC`,era:`short`,year:`numeric`,month:`short`,day:`numeric`}))(e);function n(e){return{...Yc(n=Ja(t,e)),month:0,Fe:n.month,day:parseInt(n.day)};var n}let r=(e=>{let t=e(0).year-1970;return S(function(n){let r=Gt(n-t)*Ve,i,a=0,o=[],s=[];do r+=400*Ve;while((i=e(r)).year<=n);do r+=(1-i.day)*Ve,i.year===n&&(o.push(r),s.push(i.Fe)),r-=Ve,(++a>500||r<-864e13)&&b();while((i=e(r)).year>=n);return{$:o.reverse(),we:s.reverse()}})})(n);return{he:((e,t)=>S(n=>{let r=Ut(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 qt(Zc(e,t,n,r))}function Zc(e,t,n=1,r=1){return e.K(t).$[n-1]+(r-1)*Ve}function Qc(e,t,n,r){let i=$c(e,t,n);return[Re(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 Yt(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).$),Yt(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=Re(c,u),f=c===u;(E(r,d)||E(Number(i),Number(f))||E(a,l))===1&&s--;for(let n=0;n<100;n++){let o=s-n,c=$c(e,t,o),l=Le(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)||b(`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=E(t,r)||E(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;b()}const ll=2440588;function ul(e){let t=e.J(2441683),n=S(t=>e.J(Wt(t)+2440588),WeakMap);function r(t,n){let r=e.q?.(t);return[Re(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 Jt(e.L(t,n,r)-2440588)},se(t,n=1,r=1){return(e.L(t,n,r)-2440588)*Ve},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);(E(n,s)||E(Number(i),Number(c))||E(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=Le(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||he,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)||b(`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=E(t,r)||E(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:Oa(e,n)},ke(e,t,n){return ie(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(Ee(e,4)/3)}const xl={am:0};function Sl(e){return Ee(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 Ee(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 Ee(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(Jt(t-ll));return{year:r,month:i,day:a}}function Fl(e,t,n,r){return Nl(t)?Zc(e,t,n,r)/Ve+ll:Al(1948440,t,n,r)}const Il=Object.assign({},je,{meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018});function Ll(e){let t=Wt(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]}:ln(e)}const Rl={ap:0},zl=[0,31,62,93,124,155,186,216,246,276,306,336];function Bl(e){return Ee(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=Jt(e-ll),n=t.year-78,r=e-(Gt(t.year,1,1)+ll),i;if(r<80?(n--,i=tn(t.year-1)?31:30,r+=i+155+90+10):(i=tn(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 tn(r)?(i=31,a=Gt(r,3,21)+ll):(i=30,a=Gt(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&&tn(e+78)||t>=2&&t<=6?31:30},j(e){return tn(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(w(jl,1948440),w(Al,1948440))],[`islamic-tbla`,()=>kl(w(jl,1948439),w(Al,1948439))],[`islamic-umalqura`,e=>{let t=Jc(e);return kl(w(Pl,t),w(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=S((e,t)=>{let n=t(e);return n.id=e,n});function Xl(e){let t=Zl(e);return t||b(ee(e)),Yl(...t)}function Zl(e){ql[e]&&b(ee(e));let t=Jl[e]||e,n=Kl.get(t);return n&&[t,n]}function Ql(e){let t=N(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=Or(Bn(e)),i=No(Oo(t)),a=$l(n);au(this,jr(r,i,a))}static from(e,t=void 0){return H(iu(e,t))}static compare(e,t){return fa(iu(e),iu(t))}get calendarId(){return Ne(U(this).calendar)}get timeZoneId(){return U(this).timeZone.id}get epochMilliseconds(){return Pr(U(this))}get epochNanoseconds(){return Fr(U(this))}get offset(){return yo(R(U(this)).offsetNanoseconds)}get offsetNanoseconds(){return R(U(this)).offsetNanoseconds}get hoursInDay(){return Ur(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:No(ou(e))})}withPlainTime(e=void 0){return H(Cc(U(this),Lu(e)))}add(e,t=void 0){return H(pi(U(this),q(e),t))}subtract(e,t=void 0){return H(pi(U(this),z(q(e)),t))}until(e,t=void 0){let n=U(this),r=iu(e);return K(L(Ei(0,Si(n.calendar,r.calendar),n,r,t)))}since(e,t=void 0){let n=U(this),r=iu(e);return K(L(Ei(1,Si(n.calendar,r.calendar),n,r,t)))}round(e){let t=U(this),[n,r,i]=vr(e);return H(Hr(t,n,r,i))}startOfDay(){return H(Wr(U(this)))}equals(e){return va(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 qa(e,nc(_c(t),wi(n)));return rc(r,n),r.format(Pr(n))}toString(e=void 0){return no(U(this),e)}toJSON(){return no(U(this))}getTimeZoneTransition(e){let t=U(this),n=oi(t,e);return n?H({...t,epochNanoseconds:n}):null}valueOf(){return zc()}},nu,Vc,Wc,tt);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{...R(t),calendar:t.calendar}}function ru(e){return eu.get(e)}function iu(e,t){if(y(e)){let n=ru(e);return n?(yr(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(y(e)){let t=ru(e);return t||x(te(e)),t.timeZone.id}return(e=>ko(ss(N(e))))(e)}const su=new WeakMap,cu=Fc(Nc,class{constructor(e){let t=Or(Bn(e));mu(this,Ar(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 da(fu(e),fu(t))}get epochMilliseconds(){return Pr(uu(this))}get epochNanoseconds(){return Fr(uu(this))}add(e){return lu(Ar(fi(uu(this).epochNanoseconds,q(e))))}subtract(e){return lu(Ar(fi(uu(this).epochNanoseconds,z(q(e)))))}until(e,t=void 0){return K(Ti(0,uu(this),fu(e),t))}since(e,t=void 0){return K(Ti(1,uu(this),fu(e),t))}round(e){let t=uu(this),[n,r,i]=vr(e,5,1);return lu(Ar($r(t.epochNanoseconds,Yr(n,r),i)))}equals(e){return _a(uu(this),fu(e))}toZonedDateTimeISO(e){return H(Vs(uu(this),No(ou(e))))}toLocaleString(e=void 0,t={}){let n=uu(this);return new qa(e,gc(t)).format(Pr(n))}toString(e=void 0){return to(ou,uu(this),e)}toJSON(){return to(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(y(e)){let t=du(e);if(t)return t;let n=ru(e);if(n)return Ar(n.epochNanoseconds)}return Xo(e)}const{toTemporalInstant:pu}={toTemporalInstant(){let e=Date.prototype.valueOf.call(this);return lu(Ar(BigInt(Ln(e))*Xe))}};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=Tr(dn({year:s(r??1972),month:i,day:a}));xu(this,I(c,o))}static from(e,t=void 0){return _u(bu(e,t))}get calendarId(){return Ne(vu(this).calendar)}with(e,t=void 0){return _u(Ls(vu(this),Au(e),t))}equals(e){return Sa(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 qa(e,tc(Sc(t)));return rc(r,n,1),r.format(Ut(n))}toString(e=void 0){return oo(vu(this),e)}toJSON(){return oo(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(y(e)){let n=yu(e);if(n)return F(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 F(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=wr(dn({year:i,month:a,day:s(r??1)}));Ou(this,I(c,o))}static from(e,t=void 0){return wu(Du(e,t))}static compare(e,t){return ha(Du(e),Du(t))}get calendarId(){return Ne(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(I(di(0,n.calendar,n,q(e),t),n.calendar))}subtract(e,t=void 0){let n=Tu(this);return wu(I(di(1,n.calendar,n,q(e),t),n.calendar))}until(e,t=void 0){let n=Tu(this),r=Du(e);return K(ki(0,Si(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=Tu(this),r=Du(e);return K(ki(1,Si(n.calendar,r.calendar),n,r,t))}equals(e){return xa(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 qa(e,tc(xc(t)));return rc(r,n,1),r.format(Ut(n))}toString(e=void 0){return ao(Tu(this),e)}toJSON(){return ao(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(y(e)){let n=Eu(e);return n?(F(t),n):Go(Zu(e),e,t)}let n=ts(e,Ql);return F(t),n}function Ou(e,t){return Su.set(e,t),Lc(e),e}function ku(e){if(!y(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=rd(e),t?[Pc,t]:void 0)))))))}function Au(e){return(ku(e)||e.calendar!==void 0||e.timeZone!==void 0)&&x(`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,kt(ue(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 ga(Iu(e),Iu(t))}with(e,t=void 0){return Nu(Rs(Pu(this),Au(e),t))}add(e){return Nu(_i(Pu(this),q(e))[0])}subtract(e){return Nu(_i(Pu(this),z(q(e)))[0])}until(e,t=void 0){return K(ji(0,Pu(this),Iu(e),t))}since(e,t=void 0){return K(ji(1,Pu(this),Iu(e),t))}round(e){let t=Pu(this),[n,r,i]=vr(e,5);return Nu(Kr(t,Jr(n,r),i)[0])}equals(e){return Ca(Pu(this),Iu(e))}toLocaleString(e=void 0,t={}){let n=Pu(this);return new qa(e,tc(bc(t))).format(Nt(n))}toString(e=void 0){return co(Pu(this),e)}toJSON(){return co(Pu(this))}valueOf(){return zc()}},Pu,tt);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(y(e)){let n=Fu(e);if(n)return F(t),n;let r=Hu(e);if(r)return F(t),Nr(r);let i=ru(e);return i?(F(t),Gs(i)):qo(e,t)}let n=is(e);return F(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=Er(un(ue(s,{year:e,month:t,day:n,hour:r,minute:i,second:a,millisecond:o,microsecond:c,nanosecond:l}))),f=$l(u);Wu(this,Mr(d,f))}static from(e,t=void 0){return Vu(Uu(e,t))}static compare(e,t){return ma(Uu(e),Uu(t))}get calendarId(){return Ne(W(this).calendar)}with(e,t=void 0){return Vu(Ps(W(this),Au(e),t))}withCalendar(e){return Vu(Mr(W(this),$u(e)))}withPlainTime(e=void 0){let t=W(this);return Vu(za(t,Lu(e),t.calendar))}add(e,t=void 0){let n=W(this);return Vu(Mr(mi(n.calendar,n,q(e),t),n.calendar))}subtract(e,t=void 0){let n=W(this);return Vu(Mr(mi(n.calendar,n,z(q(e)),t),n.calendar))}until(e,t=void 0){let n=W(this),r=Uu(e);return K(Di(0,Si(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=W(this),r=Uu(e);return K(Di(1,Si(n.calendar,r.calendar),n,r,t))}round(e){let t=W(this),[n,r,i]=vr(e);return Vu(Mr(Gr(t,Jr(n,r),i),t.calendar))}equals(e){return ya(W(this),Uu(e))}toZonedDateTime(e,t=void 0){return H(Ks(W(this),No(ou(e)),t))}toPlainDate(){let e=W(this);return qu(I(e,e.calendar))}toPlainTime(){return Nu(Nr(W(this)))}toLocaleString(e=void 0,t={}){let n=W(this),r=new qa(e,tc(vc(t)));return rc(r,n),r.format(Vt(n))}toString(e=void 0){return ro(W(this),e)}toJSON(){return ro(W(this))}valueOf(){return zc()}},W,Vc,Wc,tt);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(y(e)){let n=Hu(e);if(n)return F(t),n;let r=Ju(e);if(r)return F(t),Mr(P(r,Ot),r.calendar);let i=ru(e);return i?(F(t),Us(i)):Uo(Zu(e),e,t)}let n=$o(e,Ql);return F(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=Tr(dn(ue(s,{year:e,month:t,day:n}))),a=$l(r);Xu(this,I(i,a))}static from(e,t=void 0){return qu(Yu(e,t))}static compare(e,t){return ha(Yu(e),Yu(t))}get calendarId(){return Ne(G(this).calendar)}with(e,t=void 0){return qu(Fs(G(this),Au(e),t))}withCalendar(e){return qu(I(G(this),$u(e)))}add(e,t=void 0){let n=G(this);return qu(I(hi(n.calendar,n,q(e),t),n.calendar))}subtract(e,t=void 0){let n=G(this);return qu(I(hi(n.calendar,n,z(q(e)),t),n.calendar))}until(e,t=void 0){let n=G(this),r=Yu(e);return K(Oi(0,Si(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=G(this),r=Yu(e);return K(Oi(1,Si(n.calendar,r.calendar),n,r,t))}equals(e){return ba(G(this),Yu(e))}toZonedDateTime(e){let t=y(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(za(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 qa(e,tc(yc(t)));return rc(r,n),r.format(Ut(n))}toString(e=void 0){return io(G(this),e)}toJSON(){return io(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(y(e)){let n=Ju(e);if(n)return F(t),n;let r=Hu(e);if(r)return F(t),I(r,r.calendar);let i=ru(e);return i?(F(t),Ws(i)):Wo(Zu(e),e,t)}let n=es(e,Ql);return F(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(y(e)){let t=Ju(e)||Hu(e)||ru(e)||yu(e)||Eu(e);return t||x(ee(e)),t.calendar}return(e=>Ql(os(N(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=na(ue(Vn,{years:e,months:t,weeks:n,days:r,hours:i,minutes:a,seconds:o,milliseconds:s,microseconds:c,nanoseconds:l}));ad(this,L(u))}static from(e){return K(q(e))}static compare(e,t,n=void 0){return pa(id,q(e),q(t),n)}get sign(){return nd(this).sign}get blank(){return!nd(this).sign}with(e){return K(zs(nd(this),e))}negated(){return K(ea(nd(this)))}abs(){return K($i(nd(this)))}add(e,t=void 0){return K(Xi(id,0,nd(this),q(e),t))}subtract(e,t=void 0){return K(Xi(id,1,nd(this),q(e),t))}round(e){return K(Qi(id,nd(this),e))}total(e){return Ir(id,nd(this),e)}toLocaleString(e=void 0,t){let n=nd(this);return Intl.DurationFormat?new Intl.DurationFormat(e,t).format(n):lo(n,t)}toString(e=void 0){return lo(nd(this),e)}toJSON(){return lo(nd(this))}valueOf(){return zc()}},nd,Dn);function K(e){return ad(Object.create(td.prototype),e)}function nd(e){return rd(e)||Rc()}function rd(e){return ed.get(e)}function q(e){return y(e)?rd(e)||Jo(e):as(e)}function id(e){if(e!==void 0){if(y(e)){let t=ru(e);if(t)return t;let n=Ju(e);if(n)return n;let r=Hu(e);return r?I(r,r.calendar):Vo(ou,Zu(e),e)}return Zo(e,Ql)}}function ad(e,t){return ed.set(e,t),Lc(e),e}const od=Object.defineProperties({},{...le(`Temporal.Now`),...ce({timeZoneId(){return Ec()},instant(){return lu(Ar(Tc()))},zonedDateTimeISO(e=Ec()){let t=No(ou(e));return H(jr(Tc(),t))},plainDateTimeISO(e=Ec()){return Vu(Mr(wc(No(ou(e)))))},plainDateISO(e=Ec()){return qu(I(wc(No(ou(e)))))},plainTimeISO(e=Ec()){return Nu(Nr(wc(No(ou(e)))))}})}),sd=Object.defineProperties({},{...le(`Temporal`),...ce({PlainYearMonth:Cu,PlainMonthDay:gu,PlainDate:Ku,PlainTime:Mu,PlainDateTime:Bu,ZonedDateTime:tu,Instant:cu,Duration:td,Now:od})}),J=globalThis.Temporal??sd,cd=J!==sd,ld=1e3,ud=864e5;180*ud;const dd=400*ud,fd=30*36e5,pd=864e13;function md(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))*ld:null}var hd=class{constructor(e){this.tzid=e,this.transitions=[],this.offsets=[],this.coverStart=0,this.coverEnd=0,this.covered=!1,this.fixedOffsetMs=md(e)}zonedAt(e){return new J.ZonedDateTime(BigInt(e)*1000000n,this.tzid)}ensureCoverage(e,t){if(this.fixedOffsetMs!==null||this.covered&&e>=this.coverStart&&t<=this.coverEnd)return;let n=!this.covered||e<this.coverStart?e-dd:this.coverStart,r=!this.covered||t>this.coverEnd?t+dd:this.coverEnd;if(n=Math.max(n,Math.min(e,-pd)),r=Math.min(r,Math.max(t,pd)),n=Math.floor(n/ld)*ld,r=Math.ceil(r/ld)*ld,this.covered){if(n<this.coverStart){let e=this.scan(n,this.coverStart);this.transitions=e.transitions.concat(this.transitions),this.offsets=e.offsets.concat(this.offsets.slice(1))}if(r>this.coverEnd){let e=this.scan(this.coverEnd,r);this.transitions=this.transitions.concat(e.transitions),this.offsets=this.offsets.concat(e.offsets.slice(1))}}else{let e=this.scan(n,r);this.transitions=e.transitions,this.offsets=e.offsets}this.coverStart=n,this.coverEnd=r,this.covered=!0}scan(e,t){let n=this.zonedAt(e),r=[],i=[n.offsetNanoseconds/1e6];for(;;){let e=n.getTimeZoneTransition(`next`);if(e){if(e.epochMilliseconds>t)break;r.push(e.epochMilliseconds),i.push(e.offsetNanoseconds/1e6),n=e;continue}if(cd)break;let a=Math.ceil((Math.max(n.epochMilliseconds,Date.now())+15552e6)/ld)*ld;if(a>=t||a>pd)break;let o=this.zonedAt(a),s=i[i.length-1];if(o.offsetNanoseconds/1e6!==s){let e=n.epochMilliseconds,t=a;for(;t-e>ld;){let n=e+Math.floor((t-e)/2/ld)*ld;n<=e&&(n=e+ld),this.zonedAt(n).offsetNanoseconds/1e6===s?e=n:t=n}r.push(t),i.push(this.zonedAt(t).offsetNanoseconds/1e6)}n=o}return{transitions:r,offsets:i}}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]}nextTransitionAfter(e,t){if(this.fixedOffsetMs!==null)return;this.ensureCoverage(e,t);let n=this.transitions,r=0,i=n.length;for(;r<i;){let t=r+i>>1;n[t]<=e?r=t+1:i=t}let a=n[r];return a!==void 0&&a<=t?a:void 0}epochMsForWall(e){if(this.fixedOffsetMs!==null)return{epochMs:e-this.fixedOffsetMs,pushed:!1};this.ensureCoverage(e-fd,e+fd);let t=this.offsetMsAt(e-fd),n=e-t;if(this.offsetMsAt(n)===t)return{epochMs:n,pushed:!1};let r=this.offsetMsAt(e+fd),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);let r=this.transitions,i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e]<t?i=e+1:a=e}for(let t=i;t<r.length&&r[t]<=n;t++){let n=r[t],i=this.offsets[t],a=this.offsets[t+1]-i;if(a<=0)continue;let o=((n+i)%ud+ud)%ud;if((typeof e==`number`?e<o?e+ud:e:e.firstAtOrAfter(o))<o+a)return!0}return!1}};const gd=new Map;function _d(e){let t=gd.get(e);return t||(t=new hd(e),gd.set(e,t)),t}const vd=[`YEARLY`,`MONTHLY`,`WEEKLY`,`DAILY`,`HOURLY`,`MINUTELY`,`SECONDLY`],yd=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],Y={MO:1,TU:2,WE:3,TH:4,FR:5,SA:6,SU:7},bd=new Set(vd),xd=new Set(yd),Sd=RegExp(`^([+-]?\\d{1,2})?(${yd.join(`|`)})$`),Cd=RegExp(`(${yd.join(`|`)})$`),wd=1e3,Td=60*wd,Ed=60*Td,X=24*Ed,Dd=7*X,Od=[31,28,31,30,31,30,31,31,30,31,30,31],kd=[0,3,2,5,0,3,5,1,4,6,2,4],Z=BigInt(1e6),Ad=BigInt(1e9),jd=BigInt(60)*Ad,Md=BigInt(60)*jd,Nd=BigInt(24)*Md,Pd=BigInt(7)*Nd,Fd=864e13,Id=1e3;var Ld=class{constructor(e,t,n,r){let i=t.length*n.length;if(this.length=e.length*i,this.first=e[0]*Ed+t[0]*Td+n[0]*wd+r,this.length===1)return;let a=a=>{let o=e[Math.floor(a/i)],s=t[Math.floor(a%i/n.length)],c=n[a%n.length];return o*Ed+s*Td+c*wd+r};this.length<=32?this.smallOffsets=Array.from({length:this.length},(e,t)=>a(t)):this.denseOffsetAt=a}at(e){return this.smallOffsets?this.smallOffsets[e]:this.denseOffsetAt?this.denseOffsetAt(e):this.first}lowerBound(e){if(e<=this.first)return 0;if(e>=X)return this.length;let t=1,n=this.length;for(;t<n;){let r=t+Math.floor((n-t)/2);this.at(r)<e?t=r+1:n=r}return t}firstAtOrAfter(e){let t=this.lowerBound(e);return t===this.length?X+this.first:this.at(t)}wallsForDays(e,t,n){if(n)return Rd(t.length*this.length,n).map(n=>(e+t[Math.floor(n/this.length)])*X+this.at(n%this.length));let r=[];for(let n of t){let t=(e+n)*X;for(let e=0;e<this.length;e++)r.push(t+this.at(e))}return r}};function Rd(e,t){let n=[];for(let r of t){let t=r>0?r-1:e+r;t>=0&&t<e&&n.push(t)}if(n.length>1){n.sort((e,t)=>e-t);let e=1;for(let t=1;t<n.length;t++)n[t]!==n[e-1]&&(n[e++]=n[t]);n.length=e}return n}function zd(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 Bd(e){for(let t=1;t<e.length;t++)if(!(e[t]>e[t-1]))return!1;return!0}function Vd(e){let t=0;for(let n of e??[])t|=1<<n-1;return t}function Hd(e,t){return e===0||(e&1<<t-1)!=0}function Ud(e,t){let n=e/t;return e%t<0n?n-1n:n}function Wd(e,t){return-Ud(-e,t)}function Gd(e,t){return Number(t?Ud(e,Z)+1n:Wd(e,Z))}function Kd(e,t){return Number(t?Wd(e,Z)-1n:Ud(e,Z))}function Q(e){return Number.isSafeInteger(e)&&e>=-Fd&&e<=Fd}function qd(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 Jd(e){let t=e+719468,n=Math.floor(t/146097),r=t-n*146097,i=Math.floor((r-Math.floor(r/1460)+Math.floor(r/36524)-Math.floor(r/146096))/365),a=r-(365*i+Math.floor(i/4)-Math.floor(i/100)),o=Math.floor((5*a+2)/153),s=o+(o<10?3:-9);return{year:i+n*400+(s<=2?1:0),month:s}}function Yd(e){return((e+3)%7+7)%7+1}function $(e,t){return(e-1+t%7+7)%7+1}function Xd(e){let t=e.toUpperCase().match(Cd)?.[1];return!t||!xd.has(t)?null:t}function Zd(e){let t=e.toUpperCase().match(Sd);if(!t)return null;let n=t[1]?parseInt(t[1],10):0,r=t[2];return!r||!xd.has(r)?null:{ord:n,weekday:r}}function Qd(e){return typeof e==`object`&&!!e&&typeof e.timeZoneId==`string`&&typeof e.toString==`function`}function $d(e){let t=e.epochNanoseconds;return typeof t==`bigint`?t:void 0}function ef(e,t){if(!Qd(e))throw Error(`${t} must be a ZonedDateTime`);if(e instanceof J.ZonedDateTime)return e;try{let t=$d(e);if(t!==void 0){let n=e.calendarId;return new J.ZonedDateTime(t,e.timeZoneId,typeof n==`string`?n:`iso8601`)}return J.ZonedDateTime.from(e.toString())}catch{throw Error(`${t} must be a ZonedDateTime`)}}function tf(e,t){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)||e.toISOString(),BigInt(t)*Z}if(!Qd(e))throw Error(`${t} must be a ZonedDateTime`);return $d(e)??ef(e,t).epochNanoseconds}function nf(e,t){if(e?.length)return e.map(e=>ef(e,t))}function rf(e){return typeof e.rruleString==`string`}function af(e){let t,n;for(let r=0;r<e.length;r++){let i=e[r],a=i.epochNanoseconds;if(t!==void 0&&a<t){let t=new Map;for(let n of e){let e=n.epochNanoseconds;t.has(e)||t.set(e,n)}return[...t.keys()].sort((e,t)=>e<t?-1:e>t?1:0).map(e=>t.get(e))}a===t?n??=e.slice(0,r):n?.push(i),t=a}return n??e}function of(e,t){let n=[...e??[],...nf(t,`Manual date`)??[]];return n.length>0?n:void 0}function sf(e){return e.replace(/\r?\n[ \t]/g,``)}function cf(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 J.PlainDate.from(i).toZonedDateTime({timeZone:t});if(e.endsWith(`Z`)){let n=`${i}T${e.slice(9,15)}Z`;return J.Instant.from(n).toZonedDateTimeISO(t||`UTC`)}else{let n=`${i}T${e.slice(9)}`;return J.PlainDateTime.from(n).toZonedDateTime(t)}}function lf(e,t,n,r){let i=[];for(let a of e){let e=uf(a,t);if(!e)continue;let o=e.tzid||n;for(let t of e.value.split(`,`)){let n=cf(t,o,e.valueType);e.valueType!==`DATE`&&t.includes(`T`)&&r.add(n.epochNanoseconds),i.push(n)}}return i}function uf(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),i=r.startsWith(`"`)&&r.endsWith(`"`)?r.slice(1,-1):r;n===`VALUE`?s=i.toUpperCase():n===`TZID`&&(c=i)}return{valueType:s,tzid:c,value:i}}function df(e,t,n){let r=e.trim();if(n&&!/^[+-]?\d+$/.test(r))throw Error(`Invalid ${t} value: ${e}`);return parseInt(r,10)}function ff(e,t=!1,n=!1,r=`number`){let i=e.split(`,`).map(e=>df(e,r,n));return t?i.sort((e,t)=>e-t):i}function pf(e,t=!1){return e.split(`,`).map(e=>{let n=e.trim();if(/^\d+L$/i.test(n))return n.toUpperCase();let r=df(n,`BYMONTH`,t);return/^M\d{2}L?$/i.test(n)?n:r})}function mf(e,t,n,r=!1){let i=sf(e).trim(),a,o=t,s=`DATE-TIME`,c=!1,l=!1,u,d=[],f=[],p=new Set;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)),m=e.filter(e=>e.match(/^EXDATE/i)),h=e.filter(e=>e.match(/^RDATE/i)),g=uf(n,`DTSTART`);if(!g)throw Error(`Invalid DTSTART in ICS snippet`);let{valueType:_,tzid:v,value:ee}=g;s=(_||(ee?.includes(`T`)?`DATE-TIME`:`DATE`)).toUpperCase()===`DATE`?`DATE`:`DATE-TIME`,c=!!v,l=!!ee?.endsWith(`Z`),a=cf(ee,v??t??o??`UTC`,s),o=v??a.timeZoneId??t??o??`UTC`,u=r,d=lf(m,`EXDATE`,o??`UTC`,p),f=lf(h,`RDATE`,o??`UTC`,p)}else a=n?ef(n,`dtstart`):void 0,u=i,a&&(o=a.timeZoneId,s=`DATE-TIME`,c=!0,l=a.timeZoneId===`UTC`);let m=u?u.replace(/^RRULE:/i,``).split(`;`):[],h={dtstart:a,tzid:o,exDate:d.length>0?d:void 0,rDate:f.length>0?f:void 0},g;for(let e of m){let[t,n]=e.split(`=`);if(t)switch(t.toUpperCase()){case`RSCALE`:n&&(h.rscale=n.toUpperCase(),g&&!h.skip&&(h.skip=g,g=void 0));break;case`SKIP`:{let e=(n||``).toUpperCase();if(![`OMIT`,`BACKWARD`,`FORWARD`].includes(e))throw Error(`Invalid SKIP value: ${n}`);h.rscale?h.skip=e:g=e;break}case`FREQ`:h.freq=n.toUpperCase();break;case`INTERVAL`:h.interval=df(n,`INTERVAL`,r);break;case`COUNT`:if(!r&&/^\+?infinity$/i.test(n.trim()))break;h.count=df(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`);h.until=cf(n,o||`UTC`,`DATE`);break}if(!e){if(r)throw Error(`UNTIL rule part MUST have the same value type as DTSTART`);let e=cf(n,o||`UTC`,`DATE`).with({hour:23,minute:59,second:59,millisecond:0,microsecond:0,nanosecond:0});h.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`);h.until=cf(n,o||`UTC`,`DATE-TIME`);break}case`BYHOUR`:h.byHour=ff(n,!0,r,`BYHOUR`);break;case`BYMINUTE`:h.byMinute=ff(n,!0,r,`BYMINUTE`);break;case`BYSECOND`:h.bySecond=ff(n,!0,r,`BYSECOND`);break;case`BYDAY`:h.byDay=n.split(`,`).map(e=>e.toUpperCase());break;case`BYMONTH`:h.byMonth=pf(n,r);break;case`BYMONTHDAY`:h.byMonthDay=ff(n,!1,r,`BYMONTHDAY`);break;case`BYYEARDAY`:h.byYearDay=ff(n,!1,r,`BYYEARDAY`);break;case`BYWEEKNO`:h.byWeekNo=ff(n,!1,r,`BYWEEKNO`);break;case`BYSETPOS`:h.bySetPos=ff(n,!1,r,`BYSETPOS`);break;case`WKST`:h.wkst=n?.toUpperCase();break}}if(g&&!h.rscale)throw Error(`SKIP MUST NOT be present unless RSCALE is present`);return g&&h.rscale&&!h.skip&&(h.skip=g),{opts:h,dtstartIsDate:s===`DATE`,dateTimes:p}}var hf=class e{static{this.rscaleCalendarSupport={}}static normalizeToPolyfill(e){return ef(e,`Date`)}toPublicDate(e){if(!e)return null;let t=this.outputTemporal?.ZonedDateTime;if(!t||t===J.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===J.ZonedDateTime?e:e.map(e=>this.toPublicDate(e))}constructor(t){this.outputTemporal=t.temporal;let n;if(rf(t)){let{opts:r,dtstartIsDate:i,dateTimes:a}=mf(t.rruleString,t.tzid,t.dtstart,t.strict??!1);i&&a.size>0&&(this.readDateTimes=a);let o=t.allDay??(i?!0:void 0);if(!r.dtstart)throw Error(`dtstart is required - provide it either in rruleString or as a separate parameter`);let s=e.normalizeToPolyfill(r.dtstart);this.tzid=r.tzid??t.tzid??`UTC`,this.originalDtstart=s,n={...r,dtstart:s,rDate:of(r.rDate,t.rDate),exDate:of(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,...o===void 0?{}:{allDay:o}}}else{let e=ef(t.dtstart,`Manual dtstart`);n={...t,dtstart:e,until:t.until?ef(t.until,`Manual until`):void 0,rDate:nf(t.rDate,`Manual rDate`),exDate:nf(t.exDate,`Manual exDate`)},n.tzid=n.tzid||e.timeZoneId,this.tzid=n.tzid,this.originalDtstart=e}let r=this.originalDtstart.calendarId;if(this.epochCalendarId=r===`iso8601`?void 0:r,!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(!Number.isInteger(Number(n.interval)))throw Error(`Cannot create RRule: interval must be an integer`);if(n.count===null&&(n.count=void 0),n.count!==void 0&&Number.isNaN(Number(n.count)))throw Error(`Cannot create RRule: count must be a number`);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.numericByMonths=this.opts.byMonth?.filter(e=>typeof e==`number`)}buildParsedByDayTokens(e){if(!e?.length)return;let t=e.map(e=>{let t=Zd(e);return t?{ord:t.ord,weekday:t.weekday,isoDay:Y[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=Zd(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(!bd.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(!xd.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)=>J.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)=>J.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){e.evaluated+=t,this.assertCandidateBudget(e.evaluated)}assertFastPathBudget(e){this.assertCandidateBudget(e[0]===this.originalDtstart?e.length-1:e.length)}assertCandidateBudget(e){if(e>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&&J.ZonedDateTime.compare(e,r)<0||i&&J.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&&J.ZonedDateTime.compare(s,r)<0||i&&J.ZonedDateTime.compare(s,i)>0||e.push(s))}e.sort((e,t)=>J.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&&J.PlainDate.compare(i,u)<0||d&&J.PlainDate.compare(i,d)>0)continue;let s=u&&J.PlainDate.compare(i,u)===0,f=d&&J.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)=>J.ZonedDateTime.compare(e,t));for(let e of l)if(!(n&&J.ZonedDateTime.compare(e,n)<0)&&!(r&&J.ZonedDateTime.compare(e,r)>0)&&!t(e))return!1;return!0}visitUtcPeriodCandidates(e,t,n,r,i){let a=this.timeSlots;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||!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=qd(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)]*X+a.at(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(Wd(n.epochNanoseconds,Z))):0,d=r?l(Number(Ud(r.epochNanoseconds,Z))+1):s,f=n=>t(new J.ZonedDateTime(BigInt(c(n))*Z,`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=Y,n=this.opts.byDay.map(e=>Xd(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)=>J.ZonedDateTime.compare(e,t))[0];if(t&&J.ZonedDateTime.compare(t,this.originalDtstart)>=0){e=t;break}}}else if(J.ZonedDateTime.compare(a,this.originalDtstart)>=0){e=a;break}}n++}}if(this.opts.byDay?.length&&!this.opts.byWeekNo){let t=Y;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(J.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=>Xd(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&&J.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&&J.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&&J.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(J.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=this.lastByYearDay(e);return this.matchesNumericConstraint(n,t,r)}lastByYearDay(e){return e.with({month:12,day:31}).dayOfYear}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}yearlyDaysNeverMatch(){let{freq:e,byYearDay:t,byWeekNo:n,byDay:r,byMonthDay:i,byMonth:a,bySetPos:o,interval:s=1}=this.opts;if(e!==`YEARLY`||![`iso8601`,`gregory`].includes(this.originalDtstart.calendarId))return!1;if(n){if(!i&&!t)return!1}else if(!(r||i)||!t&&!(this.hasOrdinalByDay&&!a))return!1;if(this.yearlyDaysNeverMatchCache===void 0){let{byHour:e,byMinute:t,bySecond:n}=this.opts,r=(e?.length||1)*(t?.length||1)*(n?.length||1),i=o?.reduce((e,t)=>Math.min(e,Math.abs(t)),1/0)??1,a=!0;try{let e=this.originalDtstart.toPlainDate().with({month:1,day:1});for(let t=0;a&&t<400;t++)a=this.generateYearlyDateCandidates(e.add({years:t*s})).length*r<i}catch{a=!1}this.yearlyDaysNeverMatchCache=a}return this.yearlyDaysNeverMatchCache}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){let n={...this.cloneOptions(),...t,...this.cloneUpdateOptions(t),tzid:t.tzid??this.opts.tzid,dtstart:t.dtstart??this.opts.dtstart},r=new e(n);if(r.opts.allDay&&t.dtstart&&t.allDay===void 0&&!r.hasDateValues()){let{allDay:t,...r}=n;return new e(r)}return r.readDateTimes=this.readDateTimes,r}dtstartIsOccurrence(){if(this.dtstartIsOccurrenceCache!==void 0)return this.dtstartIsOccurrenceCache;let t=this.matchesAll(this.originalDtstart);if(t&&this.opts.bySetPos?.length){let n=new e({...this.opts,temporal:this.outputTemporal,dtstart:this.originalDtstart,includeDtstart:!1,rDate:void 0,exDate:void 0}),r;try{n.allInternal(e=>(r=e.epochNanoseconds,!1))}catch{}t=r===this.originalDtstart.epochNanoseconds}return this.dtstartIsOccurrenceCache=t,t}addDtstartIfNeeded(e,t){if(this.includeDtstart&&!this.dtstartIsOccurrence()){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.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.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.byYearDay&&!this.opts.byWeekNo&&this.canUseEpochMillisecondsPrecisionFlag&&this.hasSingleExpandedTimeSlot()&&!!(this.opts.byDay||this.opts.byMonthDay)}utcZdtFromEpochNanoseconds(e){return new J.ZonedDateTime(e,`UTC`,this.epochCalendarId)}utcZdtFromEpochMilliseconds(e){return this.utcZdtFromEpochNanoseconds(BigInt(e)*Z)}canUseUtcCalendarFastPaths(){return this.tzid===`UTC`&&this.originalDtstart.timeZoneId===this.tzid&&[`iso8601`,`gregory`].includes(this.originalDtstart.calendarId)}canUseUtcEpochMillisecondsPrecision(){return this.canUseEpochMillisecondsPrecisionFlag}get timeSlots(){if(this.canUseEpochMillisecondsPrecisionFlag)return this.timeSlotsCache??=new Ld(this.opts.byHour??[this.originalDtstart.hour],this.opts.byMinute??[this.originalDtstart.minute],this.opts.bySecond??[this.originalDtstart.second],this.originalDtstart.millisecond)}createNumericQueryPlan(e,t,n,r){let i=n(0),a=n(t-1);if(!i||!a||!Q(i.epochMilliseconds)||!Q(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=Gd(e,t),o=0,s=i;for(;o<s;){let e=o+Math.floor((s-o)/2),t=n(e);!t||t.epochMilliseconds>=a?s=e:o=e+1}return o},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=Ed;break;case`MINUTELY`:t=Td;break;case`SECONDLY`:t=wd;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 Q(t)?{epochMilliseconds:t,periodIndex:e,occurrenceIndex:e}:null},a=BigInt(n)*Z,o=BigInt(r)*Z,s=BigInt(e);return this.createNumericQueryPlan(`fixed-step`,e,i,(t,n)=>{let r=t-a,i=n?Ud(r,o)+1n:Wd(r,o);return i<=0n?0:i>=s?e:Number(i)})}resolveNumericWallMilliseconds(e){if(!Q(e))return null;if(this.tzid===`UTC`)return e;let t=this.getZoneResolver().epochMsForWall(e);return t.pushed||!Q(t.epochMs)?null:t.epochMs}numericQueryGapHazard(e,t){if(this.tzid===`UTC`)return!1;let n=this.originalDtstart.epochMilliseconds;return 200*366*X,t-n>632448e7?!0:this.getZoneResolver().timeOfDayMayHitGap(e,n-X,t+X)}buildDailyNumericQueryPlan(e){let t=this.opts.interval,n=this.originalDtstart.epochMilliseconds,r=this.tzid===`UTC`?n:this.wallMsOf(this.originalDtstart),i=Math.floor(r/X),a=Yd(i),o=Vd(this.simpleByDayIsoDays);if(!(this.opts.byHour||this.opts.byMinute||this.opts.bySecond)){let n=r-i*X,s=this.simpleByDayIsoDays?.length?this.findFirstMatchingDailyStep(a,t,this.simpleByDayIsoDays):0;if(s===null)return null;let c=7/zd(t,7),l=[];for(let e=0;e<c;e++)Hd(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*X,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.timeSlots;if(!s?.length)return null;let c=s.length,l=this.simpleByDayIsoDays?.length?this.findFirstMatchingDailyStep(a,t,this.simpleByDayIsoDays):0;if(l===null)return null;let u=l*t,d=i+u,f=$(a,u),p=7/zd(t,7),m=c;if(Hd(o,f)){let e=this.numericFirstPeriodSkip(c,e=>d*X+s.at(e));if(e===null)return null;m=e}let h=c-m,g=[];for(let e=0;e<p;e++)Hd(o,$(f,(1+e)*t))&&g.push(e);let _=g.length*c;if(h===0&&_===0)return null;let v=this.createNumericQueryPlan(`daily`,e,e=>{if(e<h){let t=this.resolveNumericWallMilliseconds(d*X+s.at(m+e));return t===null?null:{epochMilliseconds:t,periodIndex:0,occurrenceIndex:e}}if(_===0)return null;let n=e-h,r=Math.floor(n/_),a=n%_,o=g[Math.floor(a/c)],l=1+r*p+o,f=u+l*t;if(!Number.isSafeInteger(l)||!Number.isSafeInteger(f))return null;let v=(i+f)*X+s.at(a%c),ee=this.resolveNumericWallMilliseconds(v);return ee===null?null:{epochMilliseconds:ee,periodIndex:l,occurrenceIndex:e}}),ee=v?.select(e-1);return ee&&this.numericQueryGapHazard(s,ee.epochMilliseconds)?null:v}buildWeeklyNumericQueryPlan(e){let t=this.timeSlots;if(!t?.length)return null;let n=t.length,r=this.originalDtstart.epochMilliseconds,i=this.tzid===`UTC`?r:this.wallMsOf(this.originalDtstart),a=Math.floor(i/X),o=Yd(a),s=Y[Xd(this.opts.wkst||`MO`)??`MO`]??1,c=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[o]).map(e=>(e-s+7)%7).sort((e,t)=>e-t);if(c.length===0||!Bd(c))return null;let l=a-(o-s+7)%7,u=c.length*n,d=(e,r)=>(e+c[Math.floor(r/n)])*X+t.at(r%n),f=this.numericFirstPeriodSkip(u,e=>d(l,e));if(f===null)return null;let p=u-f,m=this.createNumericQueryPlan(`weekly`,e,e=>{if(e<p){let t=this.resolveNumericWallMilliseconds(d(l,f+e));return t===null?null:{epochMilliseconds:t,periodIndex:0,occurrenceIndex:e}}let t=e-p,n=1+Math.floor(t/u),r=n*this.opts.interval*7;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r))return null;let i=d(l+r,t%u),a=this.resolveNumericWallMilliseconds(i);return a===null?null:{epochMilliseconds:a,periodIndex:n,occurrenceIndex:e}}),h=m?.select(e-1);return h&&this.numericQueryGapHazard(t,h.epochMilliseconds)?null:m}buildMonthlyNumericQueryPlan(e){let t=this.opts.interval;if(!this.timeSlots?.length||this.opts.byMonth?.some(e=>typeof e!=`number`)||this.opts.bySetPos&&new Set(this.opts.bySetPos).size!==this.opts.bySetPos.length)return null;let n=this.originalDtstart.year*12+(this.originalDtstart.month-1);return this.buildCalendarNumericQueryPlan(`monthly`,e,4800/zd(t,4800),e=>{let r=e*t,i=n+r;if(!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null;let{year:a,month:o}=this.monthIndexToYearMonth(i),s=this.generateMonthlyOccurrenceDaysUtc(a,o);if(s.length===0)return s;let c=qd(a,o,1);return Q(c*X)?s.map(e=>c+e-1):[]})}numericPeriodShape(e){if(!e||!Bd(e))return null;let t=e.length*this.timeSlots.length,n=this.opts.bySetPos;if(!n?.length||t===0)return{days:e,candidates:t,count:t};let r=Rd(t,n);return{days:e,candidates:t,count:r.length,selected:r}}numericPeriodWall(e,t){let n=this.timeSlots,r=e.selected?e.selected[t]:t;return e.days[Math.floor(r/n.length)]*X+n.at(r%n.length)}numericFirstPeriodSkip(e,t){let n=this.originalDtstart.epochMilliseconds;if(e===0)return 0;if(this.tzid===`UTC`||e>32){let r=t(0),i=t(e-1);if(!Q(r)||!Q(i))return null;let a;if(this.tzid===`UTC`)a=0;else{let e=r-X,t=i+X;if(Q(e)&&Q(t)){let n=this.getZoneResolver();n.nextTransitionAfter(e,t)===void 0&&(a=n.offsetMsAt(e))}}if(a!==void 0){let r=n+a,i=0,o=e;for(;i<o;){let e=i+Math.floor((o-i)/2);t(e)>=r?o=e:i=e+1}return i}}let r=e;for(let i=0;i<e;i++){let a=this.resolveNumericWallMilliseconds(t(i));if(a===null)return null;if(a>=n)r===e&&(r=i);else if(r!==e)return null}return r}buildCalendarNumericQueryPlan(e,t,n,r,i=!1){let a=this.timeSlots,o,s=e=>{if(o?.periodIndex===e)return o.shape;let t=this.numericPeriodShape(r(e));return t&&(o={periodIndex:e,shape:t}),t},c=s(0);if(!c||i&&this.yearlyCandidateEvaluationCount(c.candidates)>this.maxCandidateEvaluations)return null;let l=this.numericFirstPeriodSkip(c.count,e=>this.numericPeriodWall(c,e));if(l===null)return null;let u=c.count-l,d=Math.max(0,t-u),f=[0],p=[0];for(let e=0;e<n&&f.at(-1)<d;e++){let t=s(1+e);if(!t)return null;f.push(f[e]+t.count),i&&p.push(p[e]+this.yearlyCandidateEvaluationCount(t.candidates))}let m=f.length-1===n,h=f.at(-1);if(h===0&&u<t)return null;if(i){let e=this.yearlyCandidateEvaluationCount(c.candidates);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(e,t,e=>{let t=0,r=c,i=l+e;if(e>=u){if(h===0)return null;let a=e-u,o=m?Math.floor(a/h):0,c=m?a%h:a;if(c>=h)return null;let l=1,d=f.length-1;for(;l<d;){let e=l+Math.floor((d-l)/2);f[e]>c?d=e:l=e+1}let p=l-1;if(t=1+o*n+p,!Number.isSafeInteger(t))return null;let g=s(t);if(!g||(r=g,i=c-f[p],i>=r.count))return null}let a=this.resolveNumericWallMilliseconds(this.numericPeriodWall(r,i));return a===null?null:{epochMilliseconds:a,periodIndex:t,occurrenceIndex:e}}),_=g?.select(t-1);return _&&this.numericQueryGapHazard(a,_.epochMilliseconds)?null:g}generateYearlyOccurrenceDaysUtc(e){if(this.hasOrdinalByDay&&!this.numericByMonths?.length){let t=this.isGregorianLeapYear(e)?366:365,n=this.gregorianIsoDayOfWeek(e,1,1),r=$(n,t-1),i=new Set;for(let e of this.parsedByDayTokens??[]){if(e.ord===0)continue;let a=e.ord>0?1+(e.isoDay-n+7)%7+7*(e.ord-1):t-(r-e.isoDay+7)%7+7*(e.ord+1);a>=1&&a<=t&&i.add(a)}let a=qd(e,1,1);return[...i].sort((e,t)=>e-t).map(e=>a+e-1)}let t=!!(this.opts.byDay||this.opts.byMonthDay),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=[];for(let i of n){let n=qd(e,i,1);if(t)for(let t of this.generateMonthlyOccurrenceDaysUtc(e,i))r.push(n+t-1);else{let t=this.originalDtstart.day;t<=this.daysInGregorianMonth(e,i)&&r.push(n+t-1)}}return r}generateYearlyOccurrenceEpochsUtc(e){let t=this.generateYearlyOccurrenceDaysUtc(e);return t.every(e=>Q(e*X))?this.timeSlots.wallsForDays(0,t,this.opts.bySetPos):[]}yearlyCandidateEvaluationCount(e){let t=this.opts.bySetPos;if(!t?.length)return e;let n=0,r=0;for(let e of t)e>0?n=Math.max(n,e):r=Math.max(r,-e);return Math.min(e,n)+Math.min(e,r)}buildYearlyNumericQueryPlan(e){let t=this.opts.interval,n=this.timeSlots;if(!n?.length||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.year;return this.buildCalendarNumericQueryPlan(`yearly`,e,400/zd(t,400),e=>{let n=e*t,r=a+n;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r))return null;let i=this.generateYearlyOccurrenceDaysUtc(r);return i.every(e=>Q(e*X))?i:[]},r)}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?null:this.buildDailyNumericQueryPlan(e);case`WEEKLY`:return n||this.hasOrdinalByDay?null:this.buildWeeklyNumericQueryPlan(e);case`MONTHLY`:return this.opts.byYearDay||this.opts.byWeekNo||!(this.opts.byDay||this.opts.byMonthDay)?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}buildPeriodQueryPlan(){let e=this.opts.interval;if(this.opts.count!==void 0||!Number.isSafeInteger(e)||e<=0||!Number.isSafeInteger(this.maxIterations)||this.maxIterations<=32||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{freq:t,byDay:n,byMonth:r,byMonthDay:i,byYearDay:a,byWeekNo:o,bySetPos:s}=this.opts,c=!!(r||i||a||o||s),l=!!(this.opts.byHour||this.opts.byMinute||this.opts.bySecond);if(t===`HOURLY`||t===`MINUTELY`||t===`SECONDLY`){if(c||n||l||![`UTC`,`Etc/UTC`,`Etc/GMT`].includes(this.tzid)&&!/^[-+]\d{2}:?\d{2}(?::?\d{2})?$/.test(this.tzid)&&t===`HOURLY`&&e===1)return null;let r=(t===`HOURLY`?Ed:t===`MINUTELY`?Td:wd)*e;return Number.isSafeInteger(r)?{stepMilliseconds:r,candidatesPerPeriod:1,periodOfWall:()=>0,wallsForPeriod:()=>null}:null}let u=this.tzid===`UTC`?this.originalDtstart.epochMilliseconds:this.wallMsOf(this.originalDtstart),d=Math.floor(u/X),f=this.timeSlots;switch(t){case`DAILY`:{if(c||this.hasOrdinalByDay||!f?.length)return null;let t=this.simpleByDayIsoDays;if(t?.length&&this.findFirstMatchingDailyStep(Yd(d),e,t)===null)return null;let n=Vd(t);return{candidatesPerPeriod:f.length,periodOfWall:t=>Math.floor((Math.floor(t/X)-d)/e),wallsForPeriod:t=>{let r=d+t*e;return Number.isSafeInteger(r)?Hd(n,Yd(r))?f.wallsForDays(0,[r]):[]:null}}}case`WEEKLY`:{if(c||this.hasOrdinalByDay||!f?.length)return null;let t=Yd(d),r=Y[Xd(this.opts.wkst||`MO`)??`MO`]??1,i=(n?[...this.allByDayIsoDays??[]]:[t]).map(e=>(e-r+7)%7).sort((e,t)=>e-t);if(i.length===0)return null;let a=d-(t-r+7)%7,o=7*e;return{candidatesPerPeriod:i.length*f.length,periodOfWall:e=>Math.floor((Math.floor(e/X)-a)/o),wallsForPeriod:e=>{let t=a+e*o;return Number.isSafeInteger(t)?f.wallsForDays(t,i):null}}}case`MONTHLY`:{if(a||o||!f?.length||r?.some(e=>typeof e!=`number`))return null;let t=this.originalDtstart.year*12+(this.originalDtstart.month-1),n=n=>{let r=t+n*e;if(!Number.isSafeInteger(r))return null;let i=this.monthIndexToYearMonth(r);return Q(qd(i.year,i.month,1)*X)?i:null};return{candidatesPerPeriod:62*f.length,periodOfWall:n=>{let{year:r,month:i}=Jd(Math.floor(n/X));return Math.floor((r*12+i-1-t)/e)},wallsForPeriod:e=>{let t=n(e);return t&&this.generateMonthlyOccurrenceEpochsUtc(t.year,t.month)},rankedPeriodWallSpan:s?e=>{let t=n(e);if(!t)return null;let r=qd(t.year,t.month,1)*X;return[r,r+this.daysInGregorianMonth(t.year,t.month)*X]}:void 0}}case`YEARLY`:{if(a||o||!f?.length||r?.some(e=>typeof e!=`number`)||!(n||i)&&(f.length!==1||r&&s)||this.hasOrdinalByDay&&!this.numericByMonths?.length&&(i||this.parsedByDayTokens?.some(e=>e.ord===0||Math.abs(e.ord)>52)))return null;let t=this.originalDtstart.year,c=n=>{let r=t+n*e;return Number.isSafeInteger(r)&&r>-271821&&r<275760?r:null};return{candidatesPerPeriod:2*366*f.length,periodOfWall:n=>Math.floor((Jd(Math.floor(n/X)).year-t)/e),wallsForPeriod:e=>{let t=c(e);return t===null?null:this.generateYearlyOccurrenceEpochsUtc(t)},rankedPeriodWallSpan:s?e=>{let t=c(e);return t===null?null:[qd(t,1,1)*X,qd(t+1,1,1)*X]}:void 0}}}return null}getPeriodQueryPlan(){if(this.periodQueryPlanCache!==void 0)return this.periodQueryPlanCache;try{this.periodQueryPlanCache=this.buildPeriodQueryPlan(),this.periodQueryPlanCache&&this.tzid!==`UTC`&&this.resolveNumericWallMilliseconds(this.wallMsOf(this.originalDtstart))!==this.originalDtstart.epochMilliseconds&&(this.periodQueryPlanCache=null)}catch{this.periodQueryPlanCache=null}return this.periodQueryPlanCache}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}firstExpandedEpochMs(e){let t=this.originalDtstart.epochMilliseconds;return e?Math.max(t,e.epochMilliseconds):t}allUtcFastPath(e,t){if(this.canUseUtcLinearFastPath(e))switch(this.opts.freq){case`DAILY`:return this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this._allUtcDailyExpanded(t):this._allUtcDailySimple();case`HOURLY`:return this._allUtcFixedStepSimple(Md*BigInt(this.opts.interval));case`MINUTELY`:return this._allUtcFixedStepSimple(jd*BigInt(this.opts.interval));case`SECONDLY`:return this._allUtcFixedStepSimple(Ad*BigInt(this.opts.interval))}return this.canUseUtcMonthlyFastPath(e)?this._allUtcMonthlyByDayOrMonthDay():this.canUseUtcWeeklyFastPath(e)?this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this._allUtcWeeklyExpanded(t):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/Z),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*X,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.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length)))break;o+=i,s=$(s,t)}return e}let i=BigInt(t)*Nd,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.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length)))break;o+=i,s=$(s,t)}return e}_allUtcDailyExpanded(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=this.timeSlots,r=this.originalDtstart.epochMilliseconds,i=this.firstExpandedEpochMs(e),a=this.opts.until?.epochMilliseconds,o=this.opts.interval,s=this.simpleByDayIsoDays,c=Math.floor(r/X),l=this.originalDtstart.dayOfWeek;if(s?.length){let e=this.findFirstMatchingDailyStep(l,o,s);if(e===null)return t;let n=e*o;c+=n,l=$(l,n)}let u=0;for(;;){if(++u>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(!s||s.includes(l)){let e=c*X,r=n.lowerBound(i-e);for(let i=r;i<n.length;i++){let r=e+n.at(i);if(a!==void 0&&r>a||(t.push(this.utcZdtFromEpochMilliseconds(r)),this.assertFastPathBudget(t),this.shouldBreakForCountLimit(t.length)))return t}}c+=o,l=$(l,o)}}_allUtcWeeklySimple(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.originalDtstart,n=Y[Xd(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*Dd,c=n-i*X;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let t of r){let r=c+t*X;if(!(r<n)&&(o!==void 0&&r>o||(e.push(this.utcZdtFromEpochMilliseconds(r)),this.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length))))return e}c+=s}}let o=t.epochNanoseconds,s=this.opts.until?.epochNanoseconds,c=BigInt(this.opts.interval)*Pd,l=o-BigInt(i)*Nd;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let t of r){let n=l+BigInt(t)*Nd;if(!(n<o)&&(s!==void 0&&n>s||(e.push(this.utcZdtFromEpochNanoseconds(n)),this.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length))))return e}l+=c}}_allUtcWeeklyExpanded(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=this.originalDtstart,r=n.epochMilliseconds,i=this.firstExpandedEpochMs(e),a=Math.floor(r/X),o=this.opts.until?.epochMilliseconds,s=this.timeSlots,c=Y[Xd(this.opts.wkst||`MO`)??`MO`]??1,l=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[n.dayOfWeek]).map(e=>(e-c+7)%7).sort((e,t)=>e-t),u=(n.dayOfWeek-c+7)%7,d=this.opts.interval*7,f=a-u,p=0;for(;;){if(++p>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let e of l){let n=(f+e)*X,r=s.lowerBound(i-n);for(let e=r;e<s.length;e++){let r=n+s.at(e);if(o!==void 0&&r>o||(t.push(this.utcZdtFromEpochMilliseconds(r)),this.assertFastPathBudget(t),this.shouldBreakForCountLimit(t.length)))return t}}f+=d}}hasSingleExpandedTimeSlot(){return(this.opts.byHour?.length??1)===1&&(this.opts.byMinute?.length??1)===1&&(this.opts.bySecond?.length??1)===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;if(n&&!n.includes(e.month))return[];if(!t&&!r)return[e.day];let i=e.day===1?e:e.with({day:1}),a=i.add({months:1}).subtract({days:1}).day;return this.expandedMonthDays(a,t?i.dayOfWeek:1)}isGregorianLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}daysInGregorianMonth(e,t){return t===2&&this.isGregorianLeapYear(e)?29:Od[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)+kd[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.daysInGregorianMonth(e,t);if(!this.opts.byDay&&!this.opts.byMonthDay){let e=this.originalDtstart.day;return e<=n?[e]:[]}let r=this.opts.byDay?this.gregorianIsoDayOfWeek(e,t,1):1,i=(n-28)*7+r-1,a=this.gregorianMonthDayPatterns??=[];return a[i]??=this.expandedMonthDays(n,r)}expandedMonthDays(e,t){let n=this.opts.byMonthDay,r=[];n&&n.length>0&&(r=n.map(t=>t>0?t:e+t+1).filter(t=>t>=1&&t<=e),r=[...new Set(r)].sort((e,t)=>e-t));let i=this.parsedByDayTokens;if(!i?.length)return r;let a=$(t,e-1),o=new Set;for(let{ord:n,isoDay:r}of i)if(n===0){let n=1+(r-t+7)%7;for(;n<=e;)o.add(n),n+=7}else{let i;i=n>0?1+(r-t+7)%7+7*(n-1):e-(a-r+7)%7+7*(n+1),i>=1&&i<=e&&o.add(i)}let s=[...o].sort((e,t)=>e-t);if(n&&n.length>0){if(r.length===0)return[];let e=new Set(r);s=s.filter(t=>e.has(t))}return s}generateMonthlyOccurrenceEpochsUtc(e,t){let n=this.generateMonthlyOccurrenceDaysUtc(e,t);if(n.length===0)return[];let r=qd(e,t,1);return Q(r*X)?this.timeSlots.wallsForDays(r-1,n,this.opts.bySetPos):[]}_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.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length))))return e;o+=this.opts.interval}}getZoneResolver(){return this.zoneResolver??=_d(this.tzid)}zdtFromEpochMs(e){if(cd||this.tzid===`UTC`)return new J.ZonedDateTime(BigInt(e)*Z,this.tzid,this.epochCalendarId);let t=this.emitAnchorZdt;return t?t.add({milliseconds:e-t.epochMilliseconds}):(t=this.emitAnchorZdt=new J.ZonedDateTime(BigInt(e)*Z,this.tzid,this.epochCalendarId),t)}wallMsOf(e){return e.epochMilliseconds+e.offsetNanoseconds/1e6}canUseTzEpochFastPaths(e){return!(e||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.tzFastPathCountSpanMs(this.opts.count);if(e===void 0)return!0;n=t+e+30*X}else return!0;return 150*366*X,n-t>474336e7?!0:this.getZoneResolver().timeOfDayMayHitGap(e,t-X,n+X)}tzFastPathCountSpanMs(e){let t=this.opts.interval,n=this.timeSlots?.length??1,r=this.wallMsOf(this.originalDtstart);switch(this.opts.freq){case`DAILY`:{let i=this.simpleByDayIsoDays,a=i?.length?7/zd(t,7):1,o=a;if(i?.length){let e=Yd(Math.floor(r/X));o=0;for(let n=0;n<a;n++)i.includes($(e,n*t))&&o++;if(o===0)return 0}return(Math.ceil(e/(o*n))+1)*a*t*X}case`WEEKLY`:{let r=this.opts.byDay?this.allByDayIsoDays?.length??0:1;return r===0?0:(Math.ceil(e/(r*n))+1)*t*Dd}}}allTzEpochFastPath(e,t){if(!this.canUseTzEpochFastPaths(e))return null;let n=!this.opts.byMonth&&!this.opts.byMonthDay&&!this.opts.byYearDay&&!this.opts.byWeekNo&&!this.opts.bySetPos;if(n)switch(this.opts.freq){case`DAILY`:if(!this.hasOrdinalByDay)return this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this._allTzDailyExpanded(t):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`?Ed:this.opts.freq===`MINUTELY`?Td:wd;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`&&n&&!this.hasOrdinalByDay?this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this._allTzWeeklyExpanded(t):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/X),i=n-r*X;if(this.tzFastPathGapHazard(i))return null;let a=this.opts.interval,o=this.simpleByDayIsoDays,s=this.opts.until?.epochMilliseconds,c=Yd(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*X+i);if(n.pushed)return null;if(s!==void 0&&n.epochMs>s||(e.push(this.zdtFromEpochMs(n.epochMs)),this.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length)))break}r+=a,c=$(c,a)}return e}_allTzDailyExpanded(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=this.getZoneResolver(),r=this.firstExpandedEpochMs(e),i=this.wallMsOf(this.originalDtstart),a=this.timeSlots;if(this.tzFastPathGapHazard(a))return null;let o=this.opts.interval,s=this.simpleByDayIsoDays,c=this.opts.until?.epochMilliseconds,l=Math.floor(i/X),u=Yd(l);if(s?.length){let e=this.findFirstMatchingDailyStep(u,o,s);if(e===null)return t;let n=e*o;l+=n,u=$(u,n)}let d=0;for(;;){if(++d>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(!s||s.includes(u)){let e=l*X;for(let i=0;i<a.length;i++){let o=a.at(i),s=n.epochMsForWall(e+o);if(s.pushed)return null;if(!(s.epochMs<r)&&(c!==void 0&&s.epochMs>c||(t.push(this.zdtFromEpochMs(s.epochMs)),this.assertFastPathBudget(t),this.shouldBreakForCountLimit(t.length))))return t}}l+=o,u=$(u,o)}}_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%X+X)%X/Ed)},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/X),o=i-a*X;if(this.tzFastPathGapHazard(o))return null;let s=Yd(a),c=Y[Xd(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)*X+o);if(i.pushed)return null;if(!(i.epochMs<r)&&(d!==void 0&&i.epochMs>d||(e.push(this.zdtFromEpochMs(i.epochMs)),this.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length))))return e}p+=f}}_allTzWeeklyExpanded(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=this.getZoneResolver(),r=this.originalDtstart,i=this.firstExpandedEpochMs(e),a=this.wallMsOf(r),o=Math.floor(a/X),s=this.timeSlots;if(this.tzFastPathGapHazard(s))return null;let c=Yd(o),l=Y[Xd(this.opts.wkst||`MO`)??`MO`]??1,u=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[c]).map(e=>(e-l+7)%7).sort((e,t)=>e-t),d=(c-l+7)%7,f=this.opts.until?.epochMilliseconds,p=this.opts.interval*7,m=o-d,h=0;for(;;){if(++h>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let e of u){let r=(m+e)*X;for(let e=0;e<s.length;e++){let a=s.at(e),o=n.epochMsForWall(r+a);if(o.pushed)return null;if(!(o.epochMs<i)&&(f!==void 0&&o.epochMs>f||(t.push(this.zdtFromEpochMs(o.epochMs)),this.assertFastPathBudget(t),this.shouldBreakForCountLimit(t.length))))return t}}m+=p}}_allTzMonthlyByDayOrMonthDay(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.getZoneResolver(),n=this.originalDtstart.epochMilliseconds,r=this.opts.until?.epochMilliseconds,i=this.opts.bySetPos?this.timeSlots.at(0):void 0,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:a,month:l}=this.monthIndexToYearMonth(s);if(i!==void 0){let e=qd(a,l,1)*X,n=e+this.daysInGregorianMonth(a,l)*X;if(t.timeOfDayMayHitGap(i,e-X,n+X))return null}for(let i of this.generateMonthlyOccurrenceEpochsUtc(a,l)){let a=t.epochMsForWall(i);if(a.pushed)return null;if(!(a.epochMs<n)&&(r!==void 0&&a.epochMs>r||(e.push(this.zdtFromEpochMs(a.epochMs)),this.assertFastPathBudget(e),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 J.ZonedDateTime.compare(e,n)<0?!0:this.opts.until&&J.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=Y,s=this.opts.byDay?[...this.allByDayIsoDays??[]]:this.opts.byMonthDay&&this.opts.byMonthDay.length>0?[...Object.values(o)]:[a.dayOfWeek],c=o[Xd(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(J.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&&J.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&&J.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&&J.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&&J.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&&J.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)}_allSubDailyPeriods(e){let t=[],n=this.createCandidateWorkBudget(),r=this.originalDtstart;if(!this.addDtstartIfNeeded(t,e))return this.applyCountLimitAndMergeRDates(t,e);let{freq:i,byHour:a,byMinute:o,bySecond:s,bySetPos:c}=this.opts,l=r.timeZoneId,u=r.calendarId,d=_d(l),f=i===`HOURLY`?Md:i===`MINUTELY`?jd:Ad,p=f*BigInt(this.opts.interval),m=r.epochNanoseconds,h=this.opts.until?.epochNanoseconds,g=i===`HOURLY`&&this.opts.interval===1,_=i===`HOURLY`?void 0:o,v=i===`SECONDLY`?s:void 0,ee=i===`HOURLY`?o:void 0,te=i===`SECONDLY`?void 0:s,ne=BigInt(r.millisecond*1e6+r.microsecond*1e3+r.nanosecond),re=e=>Number(Ud(e,Z)),ie=(e,t)=>{let n=d.nextTransitionAfter(re(e),Number(Wd(t,Z)));if(n===void 0)return;let r=BigInt(n)*Z;return r>e&&r<=t?r:void 0},y,b=e=>{if(cd||l===`UTC`)return new J.ZonedDateTime(e,l,u);y??=new J.ZonedDateTime(e,l,u);let t=e-y.epochNanoseconds,n=Ud(t,Z);return y.add({milliseconds:Number(n),nanoseconds:Number(t-n*Z)})},x=e=>e.toZonedDateTime(l).epochNanoseconds,ae=(e,t)=>ie(e,e+t-1n)??e+t,oe,S,se=!1,ce=0n,le=0;for(;;){if(++le>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let i=m+ce*p;if(h!==void 0&&i-2n*f>h)break;let o=re(i),s=o+d.offsetMsAt(o),l=Math.floor(s/X),y=s-l*X,ue=Math.floor(y/Ed),de=Math.floor(y/Td)%60,fe=Math.floor(y/wd)%60;if(g&&ce>0n){let e=i-Md;if(ie(e,i)!==void 0){let t=re(e),n=t+d.offsetMsAt(t);if(Math.floor(n/Ed)===Math.floor(s/Ed)){ce+=1n;continue}}}if(l!==oe){let{year:e,month:t}=Jd(l);oe=l,S=new J.PlainDate(e,t,l-qd(e,t,1)+1,u),se=this.matchesSubDailyDate(S)}let C;if(!se)C=x(this.nextSubDailyDateCandidate(S));else if(a&&!a.includes(ue)){let e=a.find(e=>e>ue)??24,t=BigInt((de*60+fe)*1e3)*Z+ne;C=ae(i,BigInt(e-ue)*Md-t)}else if(_&&!_.includes(de)){let e=_.find(e=>e>de)??60,t=BigInt(fe*1e3)*Z+ne;C=ae(i,BigInt(e-de)*jd-t)}else if(v&&!v.includes(fe)){let e=v.find(e=>e>fe)??60;C=ae(i,BigInt(e-fe)*Ad-ne)}if(C!==void 0){if(h!==void 0&&C>h)break;let e=C-m,t=e<=0n?0n:Wd(e,p);ce=t>ce?t:ce+1n;continue}let pe=[],me;for(let e of ee??[de])for(let t of te??[fe]){this.recordCandidateEvaluation(n);let r=BigInt((e-de)*60+(t-fe))*Ad,a=i+r;if(r===0n||ie(r<0n?a:i,r<0n?i:a)===void 0){pe.push(a);continue}me??=b(i);let o=me.with({minute:e,second:t});o.hour===ue&&o.minute===e&&o.second===t&&pe.push(o.epochNanoseconds)}pe.sort((e,t)=>e<t?-1:e>t?1:0);let w=c?.length?this.applyBySetPosToSortedList(pe).sort((e,t)=>e<t?-1:e>t?1:0):pe;for(let i=0;i<w.length;i++){let a=w[i];if(!(a<m||i>0&&a===w[i-1])&&!this.processOccurrence(b(a),t,r,e,void 0,n))return this.applyCountLimitAndMergeRDates(t,e)}ce+=1n}return this.applyCountLimitAndMergeRDates(t,e)}matchesSubDailyDate(e){return this.matchesByMonth(e)&&this.matchesByWeekNo(e)&&this.matchesByYearDay(e)&&this.matchesByMonthDay(e)&&this.matchesByDay(e)}nextSubDailyDateCandidate(e){let t=this.numericByMonths;if(t?.length&&!t.includes(e.month)){let n=[...t].sort((e,t)=>e-t),r=n.find(t=>t>e.month);return r===void 0?e.with({month:1,day:1}).add({years:1}).with({month:n[0]}):e.with({month:r,day:1})}if(!this.matchesByWeekNo(e))return e.add({days:8-e.dayOfWeek});if(!this.matchesByYearDay(e)){let t=e.daysInYear,n=this.lastByYearDay(e),r=this.opts.byYearDay.map(e=>e>0?e:n+e+1).filter(n=>n>e.dayOfYear&&n<=t);return r.length?e.add({days:Math.min(...r)-e.dayOfYear}):e.with({month:1,day:1}).add({years:1})}if(!this.matchesByMonthDay(e)){let t=e.daysInMonth,n=this.opts.byMonthDay.map(e=>e>0?e:t+e+1).filter(n=>n>e.day&&n<=t);return n.length?e.with({day:Math.min(...n)}):e.with({day:1}).add({months:1})}if(!this.hasOrdinalByDay&&this.simpleByDayIsoDays?.length){let t=this.simpleByDayIsoDays.map(t=>(t-e.dayOfWeek+6)%7+1);return e.add({days:Math.min(...t)})}return e.add({days:1})}_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&&J.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&&J.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()||this.yearlyDaysNeverMatch()){let t=[];return this.addDtstartIfNeeded(t,e),this.applyCountLimitAndMergeRDates(t,e)}let n=this.allUtcFastPath(e,t);if(n)return this.opts.rDate||this.opts.exDate?this.applyCountLimitAndMergeRDates(n):n;let r=this.allTzEpochFastPath(e,t);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):[`HOURLY`,`MINUTELY`,`SECONDLY`].includes(this.opts.freq)&&!this.opts.rscale&&(this.opts.byMonth||this.opts.byWeekNo||this.opts.byYearDay||this.opts.byMonthDay||this.opts.byDay||this.opts.byHour||this.opts.byMinute||this.opts.bySecond||this.opts.bySetPos)?this._allSubDailyPeriods(e):(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)}mergeRecurrenceDates(e){let t=af(e);if(!this.opts.rDate?.length)return this.excludeExDates(t);let n=this.getSortedRDates(),r=[],i=0,a=n[i]?.epochNanoseconds;for(let e of t){let t=e.epochNanoseconds;for(;a!==void 0&&a<t;)r.push(n[i++]),a=n[i]?.epochNanoseconds;this.isExcludedEpoch(t)||r.push(e),a===t&&(a=n[++i]?.epochNanoseconds)}for(;i<n.length;)r.push(n[i++]);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))}getSortedRDates(){return this.sortedRDatesCache??=this.excludeExDates(af(this.opts.rDate??[]))}numericRDateLowerBound(e,t){let n=this.getSortedRDates(),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,r=n!==void 0&&e.length>n?e.slice(0,Math.max(n,0)):e,i=this.mergeRecurrenceDates(r);return!t||!this.opts.rDate&&!this.opts.exDate?i:this.applyIterator(i,t)}iterateRecurrenceSet(t){let n=[],r=this.getSortedRDates(),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(J.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=J.PlainTime.from({hour:o,minute:r,second:i,millisecond:n.millisecond,microsecond:n.microsecond,nanosecond:n.nanosecond});if(J.PlainTime.compare(a,e)>=0&&J.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.getSortedRDates()[this.numericRDateLowerBound(e,!t)];for(;r<n.count;){let e=n.select(r);if(!e)return{handled:!1};let t=BigInt(e.epochMilliseconds)*Z;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)*Z)){o=e;break}--a}let s=this.getSortedRDates(),c=this.numericRDateLowerBound(e,t)-1,l=c>=0?s[c]:null;return!o||l&&l.epochNanoseconds>BigInt(o.epochMilliseconds)*Z?{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(r.kind!==`fixed-step`&&this.assertCandidateBudget(a-i),!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)*Z;this.isExcludedEpoch(n)||c.push(this.zdtFromEpochMs(t.epochMilliseconds))}let l=this.getSortedRDates(),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}}periodScanBudget(e,t,n){let r=Math.floor((this.maxIterations-16)/t),i=Math.floor(this.maxCandidateEvaluations/(e.candidatesPerPeriod*t))-16;return Math.min(n,r,i)}resolvePeriodEpochs(e,t){if(e.rankedPeriodWallSpan&&this.tzid!==`UTC`){let n=e.rankedPeriodWallSpan(t);if(!n||this.getZoneResolver().timeOfDayMayHitGap(this.timeSlots,n[0]-X,n[1]+X))return null}let n=e.wallsForPeriod(t);if(!n)return null;let r=Array(n.length);for(let e=0;e<n.length;e++){let t=this.resolveNumericWallMilliseconds(n[e]);if(t===null)return null;r[e]=t}return r}isExcludedEpochMilliseconds(e){return!!this.opts.exDate?.length&&this.isExcludedEpoch(BigInt(e)*Z)}periodScanForward(e,t,n,r=1){let i=this.originalDtstart.epochMilliseconds,a=this.opts.until?.epochMilliseconds,o=Math.max(t,i);if(a!==void 0&&o>a)return null;let s=this.periodScanBudget(e,r,Id),c=e=>a!==void 0&&e>a?null:n!==void 0&&e>n?e:this.isExcludedEpochMilliseconds(e)?void 0:e,l=e.stepMilliseconds;if(l!==void 0){let e=i+Math.ceil((o-i)/l)*l;e<o?e+=l:e-l>=o&&(e-=l);for(let t=0;t<s;t++,e+=l){if(!Q(e))return;let t=c(e);if(t!==void 0)return t}return}let u=Math.max(0,e.periodOfWall(this.tzid===`UTC`?o:o-X));for(let t=0;t<s;t++,u++){let t=this.resolvePeriodEpochs(e,u);if(!t)return;for(let e of t){if(e<o)continue;let t=c(e);if(t!==void 0)return t}}}periodScanBackward(e,t,n){let r=this.originalDtstart.epochMilliseconds,i=this.opts.until?.epochMilliseconds,a=i===void 0?t:Math.min(t,i);if(a<r)return null;let o=this.periodScanBudget(e,8,Id),s=e=>e<r?null:n!==void 0&&e<n?e:this.isExcludedEpochMilliseconds(e)?void 0:e,c=e.stepMilliseconds;if(c!==void 0){let e=r+Math.floor((a-r)/c)*c;e>a?e-=c:e+c<=a&&(e+=c);for(let t=0;t<o;t++,e-=c){let t=s(e);if(t!==void 0)return t}return}let l=e.periodOfWall(this.tzid===`UTC`?a:a+X);for(let t=0;t<o;t++,l--){if(l<0)return null;let t=this.resolvePeriodEpochs(e,l);if(!t)return;for(let e=t.length-1;e>=0;e--){let n=t[e];if(n>a)continue;let r=s(n);if(r!==void 0)return r}}}periodEpochsBetween(e,t,n){let r=this.originalDtstart.epochMilliseconds,i=this.opts.until?.epochMilliseconds,a=Math.max(t,r),o=i===void 0?n:Math.min(n,i),s=[];if(a>o)return s;let c=this.periodScanBudget(e,1,1/0),l=e.stepMilliseconds;if(l!==void 0){let e=r+Math.ceil((a-r)/l)*l;if(e<a?e+=l:e-l>=a&&(e-=l),(o-e)/l>=c)return null;for(let t=e;t<=o;t+=l){if(!Q(t))return null;this.isExcludedEpochMilliseconds(t)||s.push(t)}return s}let u=this.tzid===`UTC`,d=Math.max(0,e.periodOfWall(u?a:a-X)),f=e.periodOfWall(u?o:o+X);if(f-d>=c)return null;for(let t=d;t<=f;t++){let n=this.resolvePeriodEpochs(e,t);if(!n)return null;for(let e of n)e<a||e>o||this.isExcludedEpochMilliseconds(e)||s.push(e)}return s}tryPeriodNext(e,t){let n=this.getPeriodQueryPlan();if(!n)return{handled:!1};let r=this.opts.rDate?this.getSortedRDates()[this.numericRDateLowerBound(e,!t)]:void 0,i=this.periodScanForward(n,Gd(e,!t),r?Kd(r.epochNanoseconds,!1):void 0);return i===void 0?{handled:!1}:r&&(i===null||BigInt(i)*Z>r.epochNanoseconds)?{handled:!0,value:r}:{handled:!0,value:i===null?null:this.zdtFromEpochMs(i)}}tryPeriodPrevious(e,t){let n=this.getPeriodQueryPlan();if(!n)return{handled:!1};let r=this.opts.rDate?this.numericRDateLowerBound(e,t)-1:-1,i=r>=0?this.getSortedRDates()[r]:null,a=this.periodScanBackward(n,Kd(e,!t),i?Gd(i.epochNanoseconds,!1):void 0);return a===void 0||this.periodScanForward(n,Gd(e,t),void 0,2)===void 0?{handled:!1}:i&&(a===null||BigInt(a)*Z<i.epochNanoseconds)?{handled:!0,value:i}:{handled:!0,value:a===null?null:this.zdtFromEpochMs(a)}}tryPeriodBetween(e,t,n){if(e>t)return{handled:!1};let r=this.getPeriodQueryPlan();if(!r)return{handled:!1};let i=this.periodEpochsBetween(r,Gd(e,!n),Kd(t,!n));if(!i)return{handled:!1};let a=i.map(e=>this.zdtFromEpochMs(e));if(!this.opts.rDate)return{handled:!0,value:a};let o=this.getSortedRDates(),s=this.numericRDateLowerBound(t,n),c=[],l=0,u=this.numericRDateLowerBound(e,!n);for(;l<a.length||u<s;){let e=a[l],t=u<s?o[u]:void 0;!t||e&&e.epochNanoseconds<=t.epochNanoseconds?(c.push(e),l+=1,t&&t.epochNanoseconds===e.epochNanoseconds&&(u+=1)):(c.push(t),u+=1)}return{handled:!0,value:c}}between(t,n,r=!1){let i=tf(t,`after`),a=tf(n,`before`),o=this.tryNumericBetween(i,a,r);if(o.handled)return this.toPublicDates(o.value);let s=this.tryPeriodBetween(i,a,r);if(s.handled)return this.toPublicDates(s.value);let c=new J.ZonedDateTime(i,this.tzid,this.originalDtstart.calendarId),l=new J.ZonedDateTime(a,this.tzid,this.originalDtstart.calendarId),u={...this.opts};(!u.until||J.ZonedDateTime.compare(l,u.until)<0)&&(u.until=l),u.count===void 0&&Object.assign(u,this.alignedQueryStart(c));let d=new e({...u,strict:u.count===void 0?u.strict:!1,temporal:this.outputTemporal}).allInternal(void 0,u.count===void 0?c:void 0);return this.toPublicDates(d.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())&&J.ZonedDateTime.compare(m,o)>0&&this.hasTimeOfDayBetween(o.toPlainTime(),m.toPlainTime())&&(--u,m=p());let h=e.normalizeToPolyfill(this.opts.dtstart);return J.ZonedDateTime.compare(m,h)<0&&(m=h),m}matches(e){let t=tf(e,`date`);return this.nextInternal(t,!0)?.epochNanoseconds===t}occursOn(e){let t=J.PlainDate.from(e.toString()),n=t.toZonedDateTime({timeZone:this.tzid,plainTime:J.PlainTime.from(`00:00`)});if(!n.toPlainDate().equals(t))return!1;let r=t.add({days:1}).toZonedDateTime({timeZone:this.tzid,plainTime:J.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=this.tryPeriodNext(e,t);if(r.handled)return r.value;let i=null,a=n=>{n.allInternal(n=>(t?n.epochNanoseconds>=e:n.epochNanoseconds>e)?((!i||n.epochNanoseconds<i.epochNanoseconds)&&(i=n),!1):!0)};return this.opts.count===void 0?a(this.ruleFromAlignedDtstart(new J.ZonedDateTime(e,this.tzid))):a(this),i}next(e=new Date,t=!1){return this.toPublicDate(this.nextInternal(tf(e,`after`),t))}alignedQueryStart(e){let t=this.jumpAlignedDtstart(e),n=t.epochNanoseconds!==this.originalDtstart.epochNanoseconds,{freq:r,byWeekNo:i,byDay:a,byMonthDay:o,byYearDay:s}=this.opts,c=n&&r===`YEARLY`&&i&&!a&&!o&&!s;return{dtstart:t,includeDtstart:this.includeDtstart&&!n,...c?{byDay:[yd.find(e=>Y[e]===this.originalDtstart.dayOfWeek)]}:{}}}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=tf(e,`before`),r=this.tryNumericPrevious(n,t);if(r.handled)return this.toPublicDate(r.value);let i=this.tryPeriodPrevious(n,t);if(i.handled)return this.toPublicDate(i.value);let a=null;if(this.opts.rDate?.length){let e=this.numericRDateLowerBound(n,t)-1;a=e>=0?this.getSortedRDates()[e]:null}let o=this.previousFromRule(n,t,a?.epochNanoseconds);return!o||a&&a.epochNanoseconds>o.epochNanoseconds?this.toPublicDate(a):this.toPublicDate(o)}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 J.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 J.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.hasDateValues(),t=this.originalDtstart.toString({smallestUnit:`second`}).replace(/[-:]/g,``),n=e?`DTSTART;VALUE=DATE:${t.slice(0,8)}`:`DTSTART;TZID=${this.tzid}:${t.slice(0,15)}`,r=[],{freq:i,interval:a,count:o,until:s,byHour:c,byMinute:l,bySecond:u,byDay:d,byMonth:f,byMonthDay:p,bySetPos:m,byWeekNo:h,byYearDay:g,wkst:_,rDate:v,exDate:ee}=this.opts;this.opts.rscale&&r.push(`RSCALE=${this.opts.rscale}`),this.opts.rscale&&this.opts.skip&&r.push(`SKIP=${this.opts.skip}`),r.push(`FREQ=${i}`),a!==1&&r.push(`INTERVAL=${a}`),o!==void 0&&o!==1/0&&r.push(`COUNT=${o}`),s&&r.push(`UNTIL=${e?this.formatIcsDate(s):this.formatIcsDateTime(s)}`),c&&r.push(`BYHOUR=${c.join(`,`)}`),l&&r.push(`BYMINUTE=${l.join(`,`)}`),u&&r.push(`BYSECOND=${u.join(`,`)}`),d&&r.push(`BYDAY=${d.join(`,`)}`),f&&r.push(`BYMONTH=${f.join(`,`)}`),p&&r.push(`BYMONTHDAY=${p.join(`,`)}`),m&&r.push(`BYSETPOS=${m.join(`,`)}`),h&&r.push(`BYWEEKNO=${h.join(`,`)}`),g&&r.push(`BYYEARDAY=${g.join(`,`)}`),_&&r.push(`WKST=${_}`);let te=[n,`RRULE:${r.join(`;`)}`];return v&&te.push(...this.formatDateLines(`RDATE`,v,e)),ee&&te.push(...this.formatDateLines(`EXDATE`,ee,e)),te.join(`
2
+ `)}formatDateLines(e,t,n){if(!n)return[`${e}:${this.joinDates(t)}`];let r=[],i=[];for(let e of t)this.isStartOfDay(e)&&!this.readDateTimes?.has(e.epochNanoseconds)?r.push(this.formatIcsDate(e)):i.push(e);let a=[];return r.length&&a.push(`${e};VALUE=DATE:${r.join(`,`)}`),i.length&&a.push(`${e}:${this.joinDates(i)}`),a}hasDateValues(){return this.opts.allDay===!0&&this.isStartOfDay(this.originalDtstart)}isStartOfDay(e){let t=e.withTimeZone(this.tzid);return t.toPlainDate().toZonedDateTime({timeZone:this.tzid}).epochNanoseconds===t.epochNanoseconds}formatIcsDate(e){return e.withTimeZone(this.tzid).toString().slice(0,10).replace(/-/g,``)}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=[],r=this.opts.byDay&&this.opts.byDay.some(e=>/^[+-]?\d/.test(e)),i=this.opts.freq===`YEARLY`&&!this.opts.byWeekNo,a=i&&!!this.opts.byYearDay,o=this.opts.freq===`YEARLY`&&!!this.opts.byWeekNo&&!!(this.opts.byMonthDay||this.opts.byYearDay);if(r&&!this.opts.byMonth&&!a){let t=Y;for(let r of this.opts.byDay){let i=Zd(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)})}s.year===e.year&&n.push(s)}if(i){let r=e.with({month:1,day:1});for(let e of this.opts.byDay){let i=Zd(e);if(!i||i.ord!==0)continue;let a=r.add({days:(t[i.weekday]-r.dayOfWeek+7)%7});for(;a.year===r.year;a=a.add({days:7}))n.push(a)}this.opts.byMonthDay&&(n=n.filter(e=>this.matchesByMonthDay(e)))}}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&&!o){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 o=(this.opts.freq,e.with({month:1,day:1}).add({days:i-1}));(!this.opts.byMonth||this.opts.byMonth.includes(o.month))&&(!a||this.matchesByMonthDay(o)&&this.matchesYearlyByDay(o))&&n.push(o)}}if(this.opts.byWeekNo){let{lastWeek:t,firstWeekStart:r,tokens:i}=this.isoWeekByDay(e),a=o&&!this.opts.byDay?.length?Object.keys(Y):i;for(let e of this.opts.byWeekNo){if(e>0&&e>t||e<0&&-e>t)continue;let i=e>0?e-1:t+e,o=r.add({weeks:i});n.push(...this.addByDayDates(a,o))}o&&(n=n.filter(e=>this.matchesByMonthDay(e)&&this.matchesByYearDay(e)))}return this.sortedUniqueDateCandidates(n)}matchesYearlyByDay(e){if(!this.opts.byDay)return!0;for(let t of this.parsedByDayTokens??[]){if(e.dayOfWeek!==t.isoDay)continue;if(t.ord===0)return!0;let n=this.opts.byMonth?e.day:e.dayOfYear,r=this.opts.byMonth?e.daysInMonth:e.daysInYear;if((t.ord>0?Math.ceil(n/7):-Math.ceil((r-n+1)/7))===t.ord)return!0}return!1}addByDayDates(e,t){let n=Y,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)=>J.ZonedDateTime.compare(e,t));return this.applyBySetPosToSortedList(n).sort((e,t)=>J.ZonedDateTime.compare(e,t))}isoWeekByDay(e){let t=Y,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=>Xd(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=sd.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=sd.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 sd.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=sd.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 sd.ZonedDateTime.from(e.toString())}rscaleDate(e){return J.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 J.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=Y[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=Y,r=t.map(e=>Xd(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=Y,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=Zd(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=Y,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=>Xd(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=Y,l=c[this.opts.wkst||`MO`],u=this.opts.byDay?.length?this.opts.byDay.map(e=>Xd(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 Y}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return vd}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return yd}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return hf}});