rrule-temporal 2.2.9 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/totext.js CHANGED
@@ -1 +1 @@
1
- import{r as e,t}from"./src-DOMrjyRf.js";const n={weekdayNames:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],units:{year:{singular:`year`,plural:`years`},month:{singular:`month`,plural:`months`},week:{singular:`week`,plural:`weeks`},day:{singular:`day`,plural:`days`},hour:{singular:`hour`,plural:`hours`},minute:{singular:`minute`,plural:`minutes`},second:{singular:`second`,plural:`seconds`}},words:{every:`every`,weekday:`weekday`,on:`on`,in:`in`,on_the:`on the`,day_of_month:`day of the month`,day_of_year:`day of the year`,in_week:`in week`,at:`at`,at_minute:`at minute`,at_second:`at second`,until:`until`,for:`for`,time:`time`,times:`times`,instance:`instance`,week_starts_on:`week starts on`,with:`with`,additional_date:`additional date`,additional_dates:`additional dates`,excluding:`excluding`,date:`date`,dates:`dates`,and:`and`,last:`last`,starting_from:`starting from`},ordinal:e=>{let t=Math.abs(e),n=t%10==1&&t%100!=11?`st`:t%10==2&&t%100!=12?`nd`:t%10==3&&t%100!=13?`rd`:`th`;return e<0?`last`:`${t}${n}`}},r={en:n,de:{weekdayNames:[`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`,`Sonntag`],monthNames:[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`],units:{year:{singular:`Jahr`,plural:`Jahre`},month:{singular:`Monat`,plural:`Monate`},week:{singular:`Woche`,plural:`Wochen`},day:{singular:`Tag`,plural:`Tage`},hour:{singular:`Stunde`,plural:`Stunden`},minute:{singular:`Minute`,plural:`Minuten`},second:{singular:`Sekunde`,plural:`Sekunden`}},words:{every:`jede/n/s`,weekday:`Werktag`,on:`am`,in:`im`,on_the:`am`,day_of_month:`Tag des Monats`,day_of_year:`Tag des Jahres`,in_week:`in Kalenderwoche`,at:`um`,at_minute:`in Minute`,at_second:`in Sekunde`,until:`bis`,for:`für`,time:`Mal`,times:`Mal`,instance:`Vorkommen`,week_starts_on:`Woche beginnt am`,with:`mit`,additional_date:`zusätzlichem Datum`,additional_dates:`zusätzlichen Daten`,excluding:`ohne`,date:`Datum`,dates:`Daten`,and:`und`,last:`letzter`,starting_from:`beginnend am`},ordinal:e=>e<0?`letzten`:`${Math.abs(e)}.`},es:{weekdayNames:[`lunes`,`martes`,`miércoles`,`jueves`,`viernes`,`sábado`,`domingo`],monthNames:[`enero`,`febrero`,`marzo`,`abril`,`mayo`,`junio`,`julio`,`agosto`,`septiembre`,`octubre`,`noviembre`,`diciembre`],units:{year:{singular:`año`,plural:`años`},month:{singular:`mes`,plural:`meses`},week:{singular:`semana`,plural:`semanas`},day:{singular:`día`,plural:`días`},hour:{singular:`hora`,plural:`horas`},minute:{singular:`minuto`,plural:`minutos`},second:{singular:`segundo`,plural:`segundos`}},words:{every:`cada`,weekday:`día de la semana`,on:`en`,in:`en`,on_the:`el`,day_of_month:`día del mes`,day_of_year:`día del año`,in_week:`en la semana`,at:`a las`,at_minute:`en el minuto`,at_second:`en el segundo`,until:`hasta`,for:`durante`,time:`vez`,times:`veces`,instance:`ocasión`,week_starts_on:`la semana comienza el`,with:`con`,additional_date:`fecha adicional`,additional_dates:`fechas adicionales`,excluding:`excluyendo`,date:`fecha`,dates:`fechas`,and:`y`,last:`último`,starting_from:`a partir de`},ordinal:e=>e<0?`último`:`${Math.abs(e)}º`},hi:{weekdayNames:[`सोमवार`,`मंगलवार`,`बुधवार`,`गुरुवार`,`शुक्रवार`,`शनिवार`,`रविवार`],monthNames:[`जनवरी`,`फरवरी`,`मार्च`,`अप्रैल`,`मई`,`जून`,`जुलाई`,`अगस्त`,`सितंबर`,`अक्टूबर`,`नवंबर`,`दिसंबर`],units:{year:{singular:`साल`,plural:`साल`},month:{singular:`महीना`,plural:`महीने`},week:{singular:`सप्ताह`,plural:`सप्ताह`},day:{singular:`दिन`,plural:`दिन`},hour:{singular:`घंटा`,plural:`घंटे`},minute:{singular:`मिनट`,plural:`मिनट`},second:{singular:`सेकंड`,plural:`सेकंड`}},words:{every:`हर`,weekday:`सप्ताह का दिन`,on:`को`,in:`में`,on_the:`को`,day_of_month:`महीने का दिन`,day_of_year:`साल का दिन`,in_week:`सप्ताह`,at:`पर`,at_minute:`मिनट पर`,at_second:`सेकंड पर`,until:`तक`,for:`के लिए`,time:`बार`,times:`बार`,instance:`बार`,week_starts_on:`सप्ताह शुरू होता है`,with:`साथ`,additional_date:`अतिरिक्त तारीख`,additional_dates:`अतिरिक्त तारीखें`,excluding:`को छोड़कर`,date:`तारीख`,dates:`तारीखें`,and:`और`,last:`आखिरी`,starting_from:`से शुरू`},ordinal:e=>e<0?`आखिरी`:`${Math.abs(e)}वां`},yue:{weekdayNames:[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`],monthNames:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],units:{year:{singular:`年`,plural:`年`},month:{singular:`月`,plural:`月`},week:{singular:`週`,plural:`週`},day:{singular:`日`,plural:`日`},hour:{singular:`小時`,plural:`小時`},minute:{singular:`分鐘`,plural:`分鐘`},second:{singular:`秒`,plural:`秒`}},words:{every:`每`,weekday:`平日`,on:`在`,in:`於`,on_the:`在`,day_of_month:`月的日子`,day_of_year:`年的日子`,in_week:`第`,at:`在`,at_minute:`在第`,at_second:`在第`,until:`直到`,for:`共`,time:`次`,times:`次`,instance:`次`,week_starts_on:`星期開始於`,with:`帶有`,additional_date:`額外日期`,additional_dates:`額外日期`,excluding:`排除`,date:`日期`,dates:`日期`,and:`和`,last:`最後`,starting_from:`由`},ordinal:e=>e<0?`最後`:`第${Math.abs(e)}`},ar:{weekdayNames:[`الاثنين`,`الثلاثاء`,`الأربعاء`,`الخميس`,`الجمعة`,`السبت`,`الأحد`],monthNames:[`يناير`,`فبراير`,`مارس`,`أبريل`,`مايو`,`يونيو`,`يوليو`,`أغسطس`,`سبتمبر`,`أكتوبر`,`نوفمبر`,`ديسمبر`],units:{year:{singular:`سنة`,plural:`سنوات`},month:{singular:`شهر`,plural:`أشهر`},week:{singular:`أسبوع`,plural:`أسابيع`},day:{singular:`يوم`,plural:`أيام`},hour:{singular:`ساعة`,plural:`ساعات`},minute:{singular:`دقيقة`,plural:`دقائق`},second:{singular:`ثانية`,plural:`ثواني`}},words:{every:`كل`,weekday:`يوم من أيام الأسبوع`,on:`في`,in:`في`,on_the:`في الـ`,day_of_month:`يوم من الشهر`,day_of_year:`يوم من السنة`,in_week:`في الأسبوع`,at:`عند`,at_minute:`في الدقيقة`,at_second:`في الثانية`,until:`حتى`,for:`لمدة`,time:`مرة`,times:`مرات`,instance:`مرة`,week_starts_on:`يبدأ الأسبوع يوم`,with:`مع`,additional_date:`تاريخ إضافي`,additional_dates:`تواريخ إضافية`,excluding:`باستثناء`,date:`تاريخ`,dates:`تواريخ`,and:`و`,last:`الأخير`,starting_from:`ابتداءً من`},ordinal:e=>{if(e<0)return`الأخير`;let t=Math.abs(e);return{1:`الأول`,2:`الثاني`,3:`الثالث`,4:`الرابع`,5:`الخامس`,6:`السادس`,7:`السابع`,8:`الثامن`,9:`التاسع`,10:`العاشر`,11:`الحادي عشر`,12:`الثاني عشر`,13:`الثالث عشر`}[t]||t.toString()}},he:{weekdayNames:[`יום שני`,`יום שלישי`,`יום רביעי`,`יום חמישי`,`יום שישי`,`יום שבת`,`יום ראשון`],monthNames:[`ינואר`,`פברואר`,`מרץ`,`אפריל`,`מאי`,`יוני`,`יולי`,`אוגוסט`,`ספטמבר`,`אוקטובר`,`נובמבר`,`דצמבר`],units:{year:{singular:`שנה`,plural:`שנים`},month:{singular:`חודש`,plural:`חודשים`},week:{singular:`שבוע`,plural:`שבועות`},day:{singular:`יום`,plural:`ימים`},hour:{singular:`שעה`,plural:`שעות`},minute:{singular:`דקה`,plural:`דקות`},second:{singular:`שניה`,plural:`שניות`}},words:{every:`כל`,weekday:`יום חול`,on:`ב`,in:`ב`,on_the:`ב`,day_of_month:`יום בחודש`,day_of_year:`יום בשנה`,in_week:`בשבוע`,at:`בשעה`,at_minute:`בדקה`,at_second:`בשניה`,until:`עד`,for:`במשך`,time:`פעם`,times:`פעמים`,instance:`פעם`,week_starts_on:`שבוע מתחיל ב`,with:`עם`,additional_date:`תאריך נוסף`,additional_dates:`תאריכים נוספים`,excluding:`למעט`,date:`תאריך`,dates:`תאריכים`,and:`ו`,last:`אחרון`,starting_from:`החל מ`},ordinal:e=>{if(e<0)return`אחרון`;let t=Math.abs(e);return{1:`ראשון`,2:`שני`,3:`שלישי`,4:`רביעי`,5:`חמישי`,6:`שישי`,7:`שביעי`,8:`שמיני`,9:`תשיעי`,10:`עשירי`,11:`אחד עשר`,12:`שנים עשר`,13:`שלושה עשר`}[t]||t.toString()}},zh:{weekdayNames:[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`],monthNames:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],units:{year:{singular:`年`,plural:`年`},month:{singular:`月`,plural:`月`},week:{singular:`周`,plural:`周`},day:{singular:`日`,plural:`日`},hour:{singular:`小时`,plural:`小时`},minute:{singular:`分钟`,plural:`分钟`},second:{singular:`秒`,plural:`秒`}},words:{every:`每`,weekday:`工作日`,on:`在`,in:`在`,on_the:`在`,day_of_month:`月的日子`,day_of_year:`年的日子`,in_week:`第`,at:`在`,at_minute:`在第`,at_second:`在第`,until:`直到`,for:`共`,time:`次`,times:`次`,instance:`次`,week_starts_on:`星期开始于`,with:`带有`,additional_date:`额外日期`,additional_dates:`额外日期`,excluding:`排除`,date:`日期`,dates:`日期`,and:`和`,last:`最后`,starting_from:`从`},ordinal:e=>e<0?`最后`:`第${Math.abs(e)}`},fr:{weekdayNames:[`lundi`,`mardi`,`mercredi`,`jeudi`,`vendredi`,`samedi`,`dimanche`],monthNames:[`janvier`,`février`,`mars`,`avril`,`mai`,`juin`,`juillet`,`août`,`septembre`,`octobre`,`novembre`,`décembre`],units:{year:{singular:`année`,plural:`ans`},month:{singular:`mois`,plural:`mois`},week:{singular:`semaine`,plural:`semaines`},day:{singular:`jour`,plural:`jours`},hour:{singular:`heure`,plural:`heures`},minute:{singular:`minute`,plural:`minutes`},second:{singular:`seconde`,plural:`secondes`}},words:{every:`chaque`,weekday:`jour de semaine`,on:`le`,in:`dans`,on_the:`le`,day_of_month:`jour du mois`,day_of_year:`jour de l'année`,in_week:`dans la semaine`,at:`à`,at_minute:`à la minute`,at_second:`à la seconde`,until:`jusqu'au`,for:`pendant`,time:`fois`,times:`fois`,instance:`occurrence`,week_starts_on:`la semaine commence le`,with:`avec`,additional_date:`date supplémentaire`,additional_dates:`dates supplémentaires`,excluding:`en excluant`,date:`date`,dates:`dates`,and:`et`,last:`dernier`,starting_from:`à partir du`},ordinal:e=>{let t=Math.abs(e);return e<0?`dernier`:t===1?`1er`:`${t}e`}}},i=typeof process<`u`&&process.env?process.env.TOTEXT_LANGS:void 0,a=i?i.split(`,`).map(e=>e.trim()).filter(Boolean):Object.keys(r),o={};for(let e of a)r[e]&&(o[e]=r[e]);const s=e.slice(0,5),c=RegExp(`^([+-]?\\d+)?(${e.join(`|`)})$`),l=Object.fromEntries(e.map((e,t)=>[e,t]));function u(e){let t=Math.abs(e),n=t%10==1&&t%100!=11?`st`:t%10==2&&t%100!=12?`nd`:t%10==3&&t%100!=13?`rd`:`th`;return e<0?`last`:`${t}${n}`}function d(e,t){return t.ordinal?t.ordinal(e):u(e)}function f(e,t=e=>`${e}`,n){let r=e.map(t);return r.length===1?r[0]:r.slice(0,-1).join(`, `)+` ${n} `+r[r.length-1]}function p(e,t){if(typeof e==`number`)return e.toString();let n=e.toUpperCase().match(c);if(!n)return e;let r=n[1]?parseInt(n[1],10):0,i=l[n[2]],a=t.weekdayNames[i];return r===0?a:r===-1?`${t.words.last} ${a}`:`${d(r,t)} ${a}`}function m(e,t,n,r,i){let a={hour:`numeric`,timeZone:`UTC`};i&&(a.second=`2-digit`),(i||r)&&(a.minute=`2-digit`);let o=new Date(Date.UTC(2e3,0,1,n,r,i));try{return new Intl.DateTimeFormat(t,a).format(o)}catch{return new Intl.DateTimeFormat(`en`,a).format(o)}}function h(t){return e[t.dayOfWeek-1]}function g(e,t){let n={timeZone:e.timeZoneId,timeZoneName:`short`,hour:`numeric`},r;try{r=new Intl.DateTimeFormat(t,n)}catch{r=Intl.DateTimeFormat(`en`,n)}return r.formatToParts(new Date(e.epochMilliseconds)).find(e=>e.type===`timeZoneName`)?.value||e.timeZoneId}function _(e,t){let n={dateStyle:`long`,timeZone:e.timeZoneId},r=new Date(e.epochMilliseconds);try{return new Intl.DateTimeFormat(t,n).format(r)}catch{return new Intl.DateTimeFormat(`en`,n).format(r)}}function v(r,i,a={}){let c=(typeof r==`string`?new t({rruleString:r}):r).options(),l=i??Intl.DateTimeFormat().resolvedOptions().locale,u=l.split(`-`)[0],v=o[u]||n,y=o[u]?l:`en`,{freq:b,interval:x=1,count:S,until:C,byDay:w,byHour:T,byMinute:E,bySecond:D,byMonth:O,byMonthDay:k,byYearDay:A,byWeekNo:j,bySetPos:M,wkst:N,rDate:P,exDate:F}=c,I=b===`YEARLY`||b===`MONTHLY`||b===`WEEKLY`||b===`DAILY`,L=!!(T||E||D),R=c.dtstart.hour!==0||c.dtstart.minute!==0||c.dtstart.second!==0,z=I&&(L||R),B=w??(b===`WEEKLY`?[h(c.dtstart)]:void 0),V=T??(z?[c.dtstart.hour]:void 0),H=V?E??[c.dtstart.minute]:E,U=V?D??[c.dtstart.second]:D,W=[v.words.every],G={YEARLY:`year`,MONTHLY:`month`,WEEKLY:`week`,DAILY:`day`,HOURLY:`hour`,MINUTELY:`minute`,SECONDLY:`second`}[b],K=v.units[G],q=B?.map(e=>e.toUpperCase()),J=q&&q.length===s.length&&s.every(e=>q.includes(e)),Y=q&&q.length===e.length&&e.every(e=>q.includes(e));if(b===`WEEKLY`&&x===1&&J?W.push(v.words.weekday):b===`WEEKLY`&&x===1&&Y?W.push(v.units.day.singular):x===1?W.push(K.singular):W.push(x.toString(),K.plural),(b===`WEEKLY`&&B&&!J&&!Y||B&&b!==`WEEKLY`)&&W.push(v.words.on,f(B,e=>p(e,v),v.words.and)),O&&W.push(v.words.in,f(O,e=>v.monthNames[e-1],v.words.and)),k&&W.push(v.words.on_the,f(k,e=>d(e,v),v.words.and),v.words.day_of_month),A&&W.push(v.words.on_the,f(A,e=>d(e,v),v.words.and),v.words.day_of_year),j&&W.push(v.words.in_week,f(j,e=>e.toString(),v.words.and)),V){let e=H??[0],t=U??[0],n=V.flatMap(n=>e.flatMap(e=>t.map(t=>m(c.dtstart,y,n,e,t))));W.push(v.words.at,f(n,void 0,v.words.and)),a.excludeTzAbbreviation||W.push(g(c.dtstart,y))}if(!V&&H&&W.push(v.words.at_minute,f(H,void 0,v.words.and)),!V&&!H&&U&&W.push(v.words.at_second,f(U,void 0,v.words.and)),a.includeDtstart&&W.push(v.words.starting_from,_(c.dtstart,y)),C?W.push(v.words.until,_(C,y)):S!==void 0&&W.push(v.words.for,S.toString(),S===1?v.words.time:v.words.times),M&&W.push(v.words.on_the,f(M,e=>d(e,v),v.words.and),v.words.instance),N){let e=p(N,v);W.push(v.words.week_starts_on,e)}if(P&&P.length&&W.push(v.words.with,`${P.length}`,P.length===1?v.words.additional_date:v.words.additional_dates),F&&F.length&&W.push(v.words.excluding,`${F.length}`,F.length===1?v.words.date:v.words.dates),c.rscale){let e=c.rscale,t=c.skip;W.push(`(RSCALE=${e}${t?`;SKIP=${t}`:``})`)}return W.join(` `)}export{v as toText};
1
+ import{r as e,t}from"./src-IhLL05ky.js";const n={weekdayNames:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],units:{year:{singular:`year`,plural:`years`},month:{singular:`month`,plural:`months`},week:{singular:`week`,plural:`weeks`},day:{singular:`day`,plural:`days`},hour:{singular:`hour`,plural:`hours`},minute:{singular:`minute`,plural:`minutes`},second:{singular:`second`,plural:`seconds`}},words:{every:`every`,weekday:`weekday`,on:`on`,in:`in`,on_the:`on the`,day_of_month:`day of the month`,day_of_year:`day of the year`,in_week:`in week`,at:`at`,at_minute:`at minute`,at_second:`at second`,until:`until`,for:`for`,time:`time`,times:`times`,instance:`instance`,week_starts_on:`week starts on`,with:`with`,additional_date:`additional date`,additional_dates:`additional dates`,excluding:`excluding`,date:`date`,dates:`dates`,and:`and`,last:`last`,starting_from:`starting from`},ordinal:e=>{let t=Math.abs(e),n=t%10==1&&t%100!=11?`st`:t%10==2&&t%100!=12?`nd`:t%10==3&&t%100!=13?`rd`:`th`;return e<0?`last`:`${t}${n}`}},r={en:n,de:{weekdayNames:[`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`,`Sonntag`],monthNames:[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`],units:{year:{singular:`Jahr`,plural:`Jahre`},month:{singular:`Monat`,plural:`Monate`},week:{singular:`Woche`,plural:`Wochen`},day:{singular:`Tag`,plural:`Tage`},hour:{singular:`Stunde`,plural:`Stunden`},minute:{singular:`Minute`,plural:`Minuten`},second:{singular:`Sekunde`,plural:`Sekunden`}},words:{every:`jede/n/s`,weekday:`Werktag`,on:`am`,in:`im`,on_the:`am`,day_of_month:`Tag des Monats`,day_of_year:`Tag des Jahres`,in_week:`in Kalenderwoche`,at:`um`,at_minute:`in Minute`,at_second:`in Sekunde`,until:`bis`,for:`für`,time:`Mal`,times:`Mal`,instance:`Vorkommen`,week_starts_on:`Woche beginnt am`,with:`mit`,additional_date:`zusätzlichem Datum`,additional_dates:`zusätzlichen Daten`,excluding:`ohne`,date:`Datum`,dates:`Daten`,and:`und`,last:`letzter`,starting_from:`beginnend am`},ordinal:e=>e<0?`letzten`:`${Math.abs(e)}.`},es:{weekdayNames:[`lunes`,`martes`,`miércoles`,`jueves`,`viernes`,`sábado`,`domingo`],monthNames:[`enero`,`febrero`,`marzo`,`abril`,`mayo`,`junio`,`julio`,`agosto`,`septiembre`,`octubre`,`noviembre`,`diciembre`],units:{year:{singular:`año`,plural:`años`},month:{singular:`mes`,plural:`meses`},week:{singular:`semana`,plural:`semanas`},day:{singular:`día`,plural:`días`},hour:{singular:`hora`,plural:`horas`},minute:{singular:`minuto`,plural:`minutos`},second:{singular:`segundo`,plural:`segundos`}},words:{every:`cada`,weekday:`día de la semana`,on:`en`,in:`en`,on_the:`el`,day_of_month:`día del mes`,day_of_year:`día del año`,in_week:`en la semana`,at:`a las`,at_minute:`en el minuto`,at_second:`en el segundo`,until:`hasta`,for:`durante`,time:`vez`,times:`veces`,instance:`ocasión`,week_starts_on:`la semana comienza el`,with:`con`,additional_date:`fecha adicional`,additional_dates:`fechas adicionales`,excluding:`excluyendo`,date:`fecha`,dates:`fechas`,and:`y`,last:`último`,starting_from:`a partir de`},ordinal:e=>e<0?`último`:`${Math.abs(e)}º`},hi:{weekdayNames:[`सोमवार`,`मंगलवार`,`बुधवार`,`गुरुवार`,`शुक्रवार`,`शनिवार`,`रविवार`],monthNames:[`जनवरी`,`फरवरी`,`मार्च`,`अप्रैल`,`मई`,`जून`,`जुलाई`,`अगस्त`,`सितंबर`,`अक्टूबर`,`नवंबर`,`दिसंबर`],units:{year:{singular:`साल`,plural:`साल`},month:{singular:`महीना`,plural:`महीने`},week:{singular:`सप्ताह`,plural:`सप्ताह`},day:{singular:`दिन`,plural:`दिन`},hour:{singular:`घंटा`,plural:`घंटे`},minute:{singular:`मिनट`,plural:`मिनट`},second:{singular:`सेकंड`,plural:`सेकंड`}},words:{every:`हर`,weekday:`सप्ताह का दिन`,on:`को`,in:`में`,on_the:`को`,day_of_month:`महीने का दिन`,day_of_year:`साल का दिन`,in_week:`सप्ताह`,at:`पर`,at_minute:`मिनट पर`,at_second:`सेकंड पर`,until:`तक`,for:`के लिए`,time:`बार`,times:`बार`,instance:`बार`,week_starts_on:`सप्ताह शुरू होता है`,with:`साथ`,additional_date:`अतिरिक्त तारीख`,additional_dates:`अतिरिक्त तारीखें`,excluding:`को छोड़कर`,date:`तारीख`,dates:`तारीखें`,and:`और`,last:`आखिरी`,starting_from:`से शुरू`},ordinal:e=>e<0?`आखिरी`:`${Math.abs(e)}वां`},yue:{weekdayNames:[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`],monthNames:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],units:{year:{singular:`年`,plural:`年`},month:{singular:`月`,plural:`月`},week:{singular:`週`,plural:`週`},day:{singular:`日`,plural:`日`},hour:{singular:`小時`,plural:`小時`},minute:{singular:`分鐘`,plural:`分鐘`},second:{singular:`秒`,plural:`秒`}},words:{every:`每`,weekday:`平日`,on:`在`,in:`於`,on_the:`在`,day_of_month:`月的日子`,day_of_year:`年的日子`,in_week:`第`,at:`在`,at_minute:`在第`,at_second:`在第`,until:`直到`,for:`共`,time:`次`,times:`次`,instance:`次`,week_starts_on:`星期開始於`,with:`帶有`,additional_date:`額外日期`,additional_dates:`額外日期`,excluding:`排除`,date:`日期`,dates:`日期`,and:`和`,last:`最後`,starting_from:`由`},ordinal:e=>e<0?`最後`:`第${Math.abs(e)}`},ar:{weekdayNames:[`الاثنين`,`الثلاثاء`,`الأربعاء`,`الخميس`,`الجمعة`,`السبت`,`الأحد`],monthNames:[`يناير`,`فبراير`,`مارس`,`أبريل`,`مايو`,`يونيو`,`يوليو`,`أغسطس`,`سبتمبر`,`أكتوبر`,`نوفمبر`,`ديسمبر`],units:{year:{singular:`سنة`,plural:`سنوات`},month:{singular:`شهر`,plural:`أشهر`},week:{singular:`أسبوع`,plural:`أسابيع`},day:{singular:`يوم`,plural:`أيام`},hour:{singular:`ساعة`,plural:`ساعات`},minute:{singular:`دقيقة`,plural:`دقائق`},second:{singular:`ثانية`,plural:`ثواني`}},words:{every:`كل`,weekday:`يوم من أيام الأسبوع`,on:`في`,in:`في`,on_the:`في الـ`,day_of_month:`يوم من الشهر`,day_of_year:`يوم من السنة`,in_week:`في الأسبوع`,at:`عند`,at_minute:`في الدقيقة`,at_second:`في الثانية`,until:`حتى`,for:`لمدة`,time:`مرة`,times:`مرات`,instance:`مرة`,week_starts_on:`يبدأ الأسبوع يوم`,with:`مع`,additional_date:`تاريخ إضافي`,additional_dates:`تواريخ إضافية`,excluding:`باستثناء`,date:`تاريخ`,dates:`تواريخ`,and:`و`,last:`الأخير`,starting_from:`ابتداءً من`},ordinal:e=>{if(e<0)return`الأخير`;let t=Math.abs(e);return{1:`الأول`,2:`الثاني`,3:`الثالث`,4:`الرابع`,5:`الخامس`,6:`السادس`,7:`السابع`,8:`الثامن`,9:`التاسع`,10:`العاشر`,11:`الحادي عشر`,12:`الثاني عشر`,13:`الثالث عشر`}[t]||t.toString()}},he:{weekdayNames:[`יום שני`,`יום שלישי`,`יום רביעי`,`יום חמישי`,`יום שישי`,`יום שבת`,`יום ראשון`],monthNames:[`ינואר`,`פברואר`,`מרץ`,`אפריל`,`מאי`,`יוני`,`יולי`,`אוגוסט`,`ספטמבר`,`אוקטובר`,`נובמבר`,`דצמבר`],units:{year:{singular:`שנה`,plural:`שנים`},month:{singular:`חודש`,plural:`חודשים`},week:{singular:`שבוע`,plural:`שבועות`},day:{singular:`יום`,plural:`ימים`},hour:{singular:`שעה`,plural:`שעות`},minute:{singular:`דקה`,plural:`דקות`},second:{singular:`שניה`,plural:`שניות`}},words:{every:`כל`,weekday:`יום חול`,on:`ב`,in:`ב`,on_the:`ב`,day_of_month:`יום בחודש`,day_of_year:`יום בשנה`,in_week:`בשבוע`,at:`בשעה`,at_minute:`בדקה`,at_second:`בשניה`,until:`עד`,for:`במשך`,time:`פעם`,times:`פעמים`,instance:`פעם`,week_starts_on:`שבוע מתחיל ב`,with:`עם`,additional_date:`תאריך נוסף`,additional_dates:`תאריכים נוספים`,excluding:`למעט`,date:`תאריך`,dates:`תאריכים`,and:`ו`,last:`אחרון`,starting_from:`החל מ`},ordinal:e=>{if(e<0)return`אחרון`;let t=Math.abs(e);return{1:`ראשון`,2:`שני`,3:`שלישי`,4:`רביעי`,5:`חמישי`,6:`שישי`,7:`שביעי`,8:`שמיני`,9:`תשיעי`,10:`עשירי`,11:`אחד עשר`,12:`שנים עשר`,13:`שלושה עשר`}[t]||t.toString()}},zh:{weekdayNames:[`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`,`星期日`],monthNames:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],units:{year:{singular:`年`,plural:`年`},month:{singular:`月`,plural:`月`},week:{singular:`周`,plural:`周`},day:{singular:`日`,plural:`日`},hour:{singular:`小时`,plural:`小时`},minute:{singular:`分钟`,plural:`分钟`},second:{singular:`秒`,plural:`秒`}},words:{every:`每`,weekday:`工作日`,on:`在`,in:`在`,on_the:`在`,day_of_month:`月的日子`,day_of_year:`年的日子`,in_week:`第`,at:`在`,at_minute:`在第`,at_second:`在第`,until:`直到`,for:`共`,time:`次`,times:`次`,instance:`次`,week_starts_on:`星期开始于`,with:`带有`,additional_date:`额外日期`,additional_dates:`额外日期`,excluding:`排除`,date:`日期`,dates:`日期`,and:`和`,last:`最后`,starting_from:`从`},ordinal:e=>e<0?`最后`:`第${Math.abs(e)}`},fr:{weekdayNames:[`lundi`,`mardi`,`mercredi`,`jeudi`,`vendredi`,`samedi`,`dimanche`],monthNames:[`janvier`,`février`,`mars`,`avril`,`mai`,`juin`,`juillet`,`août`,`septembre`,`octobre`,`novembre`,`décembre`],units:{year:{singular:`année`,plural:`ans`},month:{singular:`mois`,plural:`mois`},week:{singular:`semaine`,plural:`semaines`},day:{singular:`jour`,plural:`jours`},hour:{singular:`heure`,plural:`heures`},minute:{singular:`minute`,plural:`minutes`},second:{singular:`seconde`,plural:`secondes`}},words:{every:`chaque`,weekday:`jour de semaine`,on:`le`,in:`dans`,on_the:`le`,day_of_month:`jour du mois`,day_of_year:`jour de l'année`,in_week:`dans la semaine`,at:`à`,at_minute:`à la minute`,at_second:`à la seconde`,until:`jusqu'au`,for:`pendant`,time:`fois`,times:`fois`,instance:`occurrence`,week_starts_on:`la semaine commence le`,with:`avec`,additional_date:`date supplémentaire`,additional_dates:`dates supplémentaires`,excluding:`en excluant`,date:`date`,dates:`dates`,and:`et`,last:`dernier`,starting_from:`à partir du`},ordinal:e=>{let t=Math.abs(e);return e<0?`dernier`:t===1?`1er`:`${t}e`}}},i=typeof process<`u`&&process.env?process.env.TOTEXT_LANGS:void 0,a=i?i.split(`,`).map(e=>e.trim()).filter(Boolean):Object.keys(r),o={};for(let e of a)r[e]&&(o[e]=r[e]);const s=e.slice(0,5),c=RegExp(`^([+-]?\\d+)?(${e.join(`|`)})$`),l=Object.fromEntries(e.map((e,t)=>[e,t]));function u(e){let t=Math.abs(e),n=t%10==1&&t%100!=11?`st`:t%10==2&&t%100!=12?`nd`:t%10==3&&t%100!=13?`rd`:`th`;return e<0?`last`:`${t}${n}`}function d(e,t){return t.ordinal?t.ordinal(e):u(e)}function f(e,t=e=>`${e}`,n){let r=e.map(t);return r.length===1?r[0]:r.slice(0,-1).join(`, `)+` ${n} `+r[r.length-1]}function p(e,t){if(typeof e==`number`)return e.toString();let n=e.toUpperCase().match(c);if(!n)return e;let r=n[1]?parseInt(n[1],10):0,i=l[n[2]],a=t.weekdayNames[i];return r===0?a:r===-1?`${t.words.last} ${a}`:`${d(r,t)} ${a}`}function m(e,t,n,r,i){let a={hour:`numeric`,timeZone:`UTC`};i&&(a.second=`2-digit`),(i||r)&&(a.minute=`2-digit`);let o=new Date(Date.UTC(2e3,0,1,n,r,i));try{return new Intl.DateTimeFormat(t,a).format(o)}catch{return new Intl.DateTimeFormat(`en`,a).format(o)}}function h(t){return e[t.dayOfWeek-1]}function g(e,t){let n={timeZone:e.timeZoneId,timeZoneName:`short`,hour:`numeric`},r;try{r=new Intl.DateTimeFormat(t,n)}catch{r=Intl.DateTimeFormat(`en`,n)}return r.formatToParts(new Date(e.epochMilliseconds)).find(e=>e.type===`timeZoneName`)?.value||e.timeZoneId}function _(e,t){let n={dateStyle:`long`,timeZone:e.timeZoneId},r=new Date(e.epochMilliseconds);try{return new Intl.DateTimeFormat(t,n).format(r)}catch{return new Intl.DateTimeFormat(`en`,n).format(r)}}function v(r,i,a={}){let c=(typeof r==`string`?new t({rruleString:r}):r).options(),l=i??Intl.DateTimeFormat().resolvedOptions().locale,u=l.split(`-`)[0],v=o[u]||n,y=o[u]?l:`en`,{freq:b,interval:x=1,count:S,until:C,byDay:w,byHour:T,byMinute:E,bySecond:D,byMonth:O,byMonthDay:k,byYearDay:A,byWeekNo:j,bySetPos:M,wkst:N,rDate:P,exDate:F}=c,I=b===`YEARLY`||b===`MONTHLY`||b===`WEEKLY`||b===`DAILY`,L=!!(T||E||D),R=c.dtstart.hour!==0||c.dtstart.minute!==0||c.dtstart.second!==0,z=I&&(L||R),B=w??(b===`WEEKLY`?[h(c.dtstart)]:void 0),V=T??(z?[c.dtstart.hour]:void 0),H=V?E??[c.dtstart.minute]:E,U=V?D??[c.dtstart.second]:D,W=[v.words.every],G={YEARLY:`year`,MONTHLY:`month`,WEEKLY:`week`,DAILY:`day`,HOURLY:`hour`,MINUTELY:`minute`,SECONDLY:`second`}[b],K=v.units[G],q=B?.map(e=>e.toUpperCase()),J=q&&q.length===s.length&&s.every(e=>q.includes(e)),Y=q&&q.length===e.length&&e.every(e=>q.includes(e));if(b===`WEEKLY`&&x===1&&J?W.push(v.words.weekday):b===`WEEKLY`&&x===1&&Y?W.push(v.units.day.singular):x===1?W.push(K.singular):W.push(x.toString(),K.plural),(b===`WEEKLY`&&B&&!J&&!Y||B&&b!==`WEEKLY`)&&W.push(v.words.on,f(B,e=>p(e,v),v.words.and)),O&&W.push(v.words.in,f(O,e=>v.monthNames[e-1],v.words.and)),k&&W.push(v.words.on_the,f(k,e=>d(e,v),v.words.and),v.words.day_of_month),A&&W.push(v.words.on_the,f(A,e=>d(e,v),v.words.and),v.words.day_of_year),j&&W.push(v.words.in_week,f(j,e=>e.toString(),v.words.and)),V){let e=H??[0],t=U??[0],n=V.flatMap(n=>e.flatMap(e=>t.map(t=>m(c.dtstart,y,n,e,t))));W.push(v.words.at,f(n,void 0,v.words.and)),a.excludeTzAbbreviation||W.push(g(c.dtstart,y))}if(!V&&H&&W.push(v.words.at_minute,f(H,void 0,v.words.and)),!V&&!H&&U&&W.push(v.words.at_second,f(U,void 0,v.words.and)),a.includeDtstart&&W.push(v.words.starting_from,_(c.dtstart,y)),C?W.push(v.words.until,_(C,y)):S!==void 0&&W.push(v.words.for,S.toString(),S===1?v.words.time:v.words.times),M&&W.push(v.words.on_the,f(M,e=>d(e,v),v.words.and),v.words.instance),N){let e=p(N,v);W.push(v.words.week_starts_on,e)}if(P&&P.length&&W.push(v.words.with,`${P.length}`,P.length===1?v.words.additional_date:v.words.additional_dates),F&&F.length&&W.push(v.words.excluding,`${F.length}`,F.length===1?v.words.date:v.words.dates),c.rscale){let e=c.rscale,t=c.skip;W.push(`(RSCALE=${e}${t?`;SKIP=${t}`:``})`)}return W.join(` `)}export{v as toText};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrule-temporal",
3
- "version": "2.2.9",
3
+ "version": "2.3.0",
4
4
  "description": "Recurrence rule (rrule) processing using Temporal PlainDate/PlainDateTime, with cross-timezone and cross-calendar rrule support",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -1,2 +0,0 @@
1
- const e=(e,t)=>`Non-positive ${e}: ${t}`,t=(e,t)=>`Non-finite ${e}: ${t}`,n=e=>`Cannot convert bigint to ${e}`,r=(e,t,n,r)=>i(e,t)+`; must be between ${n}-${r}`,i=(e,t)=>`Invalid ${e}: ${t}`;function a(e){return e===void 0?Object.create(null):f(e)}function o(e,r=`number`){if(typeof e==`bigint`)throw TypeError(n(r));if(e=Number(e),!Number.isFinite(e))throw RangeError(t(r,e));return e}function s(e,t){return Math.trunc(o(e,t))||0}function c(e,t){return l(s(e,t),t)}function l(t,n=`number`){if(t<=0)throw RangeError(e(n,t));return t}function u(e,t,n){return Math.min(Math.max(e,t),n)}function d(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function f(e){if(!d(e))throw TypeError(`Invalid object`);return e}const p=i,m=e=>`Missing ${e}`,h=e=>`No valid fields: `+e.join(),g=(e,t,n)=>i(e,t)+`; must be `+Object.keys(n).join(),_=e=>`Missing year`+(e?`/era/eraYear`:``),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 se(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 ce=e=>le({name:e},1),le=(e,t)=>de(e=>({value:e,configurable:1,writable:!t}),e),ue=e=>({[Symbol.toStringTag]:{value:e,configurable:1}});function de(e,t){let n={};for(let r in t)n[r]=e(t[r],r);return n}function fe(e,t){let n={};for(let r of e)n[r]=t;return n}function pe(e){let t={};for(let n of e)t[n]=e=>e[n];return t}function S(e,t,n=Object.create(null)){for(let r of e)n[r]=t[r];return n}function me(e,t,n){for(let r of e)if(t[r]!==n[r])return 0;return 1}function he(e,t,n){let r={...n};for(let n=0;n<t;n++)r[e[n]]=0;return r}function C(e,...t){return(...n)=>e(...t,...n)}function ge(){}function _e(e){return e[0].toUpperCase()+e.substring(1)}function w(...e){return[].concat(...e).sort()}function ve(e){return RegExp(`^${e}$`,`i`)}function ye(e){return parseInt(e.padEnd(9,`0`))}function be(e){return e&&e!==`+`?-1:1}function xe(e){return e===void 0?0:parseInt(e)}function Se(e,t){return String(t).padStart(e,`0`)}const Ce=C(Se,2);function T(e,t){return Math.sign(e-t)}function E(e,t){return e<t?-1:e>t?1:0}function we(e,t){let n=e/t;return e%t<0n?n-1n:n}function Te(e,t){let n=we(e,t);return[n,e-n*t]}function Ee(e,t){return[Math.floor(e/t),De(e,t)]}function De(e,t){return(e%t+t)%t}function Oe(e,t){return Math.trunc(e/t)||0}function ke(e,t){return e%t||0}function Ae(e,t=1){return t*(.5+e/5)}function je(e){return Math.abs(e%1)===.5}const Me={bce:-1,ce:0};function Ne(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 Pe(e){return e===void 0?`iso8601`:e===0?`gregory`:e.id}const Fe=/^M(\d{2})(L?)$/;function Ie(e){let t=Fe.exec(e);return t||b((e=>`Invalid monthCode: ${e}`)(e)),[parseInt(t[1]),!!t[2]]}function Le(e,t){return`M`+Ce(e)+(t?`L`:``)}function Re(e,t,n){return e+(t||n&&e>=n?1:0)}function ze(e,t){return e-(t&&e>=t?1:0)}const Be={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},Ve=Object.keys(Be),He=864e5,Ue=1e3,We=1e6,Ge=1e9,Ke=6e10,qe=36e11,Je=864e11,Ye=[1,Ue,We,Ge,Ke,qe,Je],Xe=BigInt(Ue),Ze=BigInt(We),Qe=BigInt(Ge),$e=BigInt(Ke),et=BigInt(qe),D=BigInt(Je);function tt(e,t){let n=Number(e/D),r=Number(e%D);return Je/t*n+(Math.trunc(r/t)+r%t/t)}const O=Ve.slice(0,6),nt=pe(O),rt=[`year`],it=[`day`],at=[`day`,`month`,`year`],ot=[`offset`],st=[`timeZone`],ct=[`era`,`eraYear`],lt=[`era`,`eraYear`,`year`],ut=[`month`,`monthCode`],dt=[`day`,`month`,`monthCode`],ft=w(O),pt=w(ct,rt),mt=w(ut,rt),ht=w(ct,mt),gt=w([`monthCode`],rt),_t=w(ct,gt),vt=w(it,[`monthCode`]),yt=w(it,mt),bt=w(it,ct,mt),xt=w(yt,O),St=w(bt,O),Ct=w(yt,O,ot),wt=w(bt,O,ot),Tt=w(yt,O,ot,st),Et=w(bt,O,ot,st),Dt=w(it,gt),Ot=w(it,ct,gt),kt=fe(O,0);function At(e){return Mt(e,1),e}const jt={hour:23,minute:59,second:59};function Mt(e,t){let n={};for(let r of O)n[r]=oe(r,e[r],0,jt[r]||999,t);return n}function Nt(e){return Ft(e)*Ge+It(e)}function Pt(e){return 1e3*Ft(e)+e.millisecond}function Ft(e){return 3600*e.hour+60*e.minute+e.second}function It(e){return e.millisecond*We+e.microsecond*Ue+e.nanosecond}function Lt(e){let[t,n]=Ee(e,Je);return[Rt(n),t]}function Rt(e){let[t,n]=Ee(e,We),[r,i]=Ee(n,Ue);return zt(t,r,i)}function zt(e,t=0,n=0){let[r,i]=Ee(e,36e5),[a,o]=Ee(i,6e4),[s,c]=Ee(o,1e3);return{hour:r,minute:a,second:s,millisecond:c,microsecond:t,nanosecond:n}}function Bt(e){let[t,n]=Te(e,Qe);return[Number(t),Number(n)]}function Vt(e){return Ut(e)+BigInt(Nt(e))}function Ht(e){return Wt(e)+Pt(e)}function Ut(e){return BigInt(Gt(e))*D}function Wt(e){return 864e5*Gt(e)}function Gt(e){return Kt(e.year,e.month,e.day)}function Kt(e,t=1,n=1){let r=t-1;return e+=Math.floor(r/12),t=De(r,12),Date.UTC(e%400-400,t,0)/864e5+146097*(Oe(e,400)+1)+n}function qt(e){let[t,n]=Te(e,D);return{...Yt(Number(t)),...Rt(Number(n))}}function Jt(e,t=0,n=0){let[r,i]=Ee(e,864e5);return{...Yt(r),...zt(i,t,n)}}function Yt(e){let t=new Date(864e5*De(e,146097));return{year:t.getUTCFullYear()+400*Math.floor(e/146097),month:t.getUTCMonth()+1,day:t.getUTCDate()}}function Xt(e,t){return Math.trunc((t-e)/864e5)}function Zt(e){return[e,0]}function Qt(e,t){if(!t)return{year:1972,month:e}}function $t(e,t,n){return{year:e,month:t,day:n}}function en(e,t){switch(t){case 2:return nn(e)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function tn(e){return nn(e)?366:365}function nn(e){return e%4==0&&(e%100!=0||e%400==0)}function rn(e,t,n){return e+=Oe(n,12),(t+=ke(n,12))<1?(e--,t+=12):t>12&&(e++,t-=12),{year:e,month:t}}function an(e,t,n,r){return 12*(n-e)+r-t}function on(e){return De(Kt(e.year,e.month,e.day)+4,7)||7}function sn(e){return Kt(e.year,e.month,e.day)-Kt(e.year)+1}function cn(e){let t=e.year,n=Math.floor((sn(e)-on(e)+10)/7),r=ln(t);return n<1?n=r=ln(--t):n>r&&(n=1,r=ln(++t)),{weekOfYear:n,yearOfWeek:t,Ie:r}}function ln(e){let t=on({year:e,month:1,day:1});return t===4||t===3&&nn(e)?53:52}function un({year:e}){return e<1?{era:`bce`,eraYear:1-e}:{era:`ce`,eraYear:e}}function dn(e){return fn(e),At(e)}function fn(e){return mn(e,1),e}function pn(e){return me(at,e,mn(e))}function mn(e,t){let{year:n}=e,r=ae(e,`month`,1,12,t);return{year:n,month:r,day:ae(e,`day`,1,en(n,r),t)}}function k(e,t){return e?e.ie(t):t}function hn(e,t,n){return e?e.O(t,n):Zt(n)}function gn(e,t){return e===0?un(t):e?e.h(t):{}}function _n(e,t,n,r){return e?e.je(t,n,r):$t(t,n,r)}function vn(e,t){return e?e.k(t):12}function yn(e,t,n){return e?e.p(t,n):en(t,n)}function bn(e,t){let{year:n,month:r}=k(e,t),[i,a]=hn(e,n,r);return Le(i,a)}function xn(e,t){let{year:n}=k(e,t);return e?e.u(n):nn(n)}function Sn(e,t){let{year:n}=k(e,t);return vn(e,n)}function Cn(e,t){let{year:n,month:r}=k(e,t);return yn(e,n,r)}function wn(e,t){let{year:n}=k(e,t);return e?e.j(n):tn(n)}function Tn(e,t){if(!e)return sn(t);let{year:n}=k(e,t),r=_n(e,n,1,1);return Gt(t)-Gt(r)+1}function En(e,t){return e===void 0?cn(t).weekOfYear:void 0}function Dn(e,t){return e===void 0?cn(t).yearOfWeek:void 0}const A=Ve.map(e=>e+`s`),On=pe(A),kn=w(A),An=A.slice(0,6),jn=A.slice(6),Mn=jn.slice(1),Nn=A.reduce((e,t,n)=>(e[t]=n,e),{}),j=fe(A,0),Pn=fe(An,0),Fn=C(he,A);function In(e,t){return t??b(m(e)),t}const M=C(Ln,`string`);function Ln(e,t,n=e){return typeof t!==e&&x(p(n,t)),t}function Rn(e,t=`number`){return Number.isInteger(e)||b(((e,t)=>`Non-integer ${e}: ${t}`)(t,e)),e||0}function zn(e){return typeof e==`symbol`&&x(`Cannot convert Symbol to string`),String(e)}function Bn(e,t){return d(e)?String(e):M(e,t)}function Vn(e){return typeof e==`boolean`?BigInt(e?1:0):typeof e==`string`?BigInt(e):(typeof e!=`bigint`&&x(`Invalid bigint: ${e}`),e)}function Hn(e,t){return Rn(o(e,t),t)}function Un(e,t){return typeof e==`string`?((e,t)=>{let n=Object.create(null);return n[e]=t,n})(t,e):f(e)}const Wn=`smallestUnit`,Gn={constrain:0,reject:1},Kn={compatible:0,reject:1,earlier:2,later:3},qn={reject:0,use:1,prefer:2,ignore:3},Jn={auto:0,never:1,critical:2,always:3},Yn={auto:0,never:1,critical:2},Xn={auto:0,never:1},Zn={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},Qn=[Math.floor,e=>je(e)?Math.floor(e):Math.round(e),Math.ceil,e=>je(e)?Math.ceil(e):Math.round(e),Math.trunc,e=>je(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=>je(e)?(e=Math.trunc(e)||0)+e%2:Math.round(e)],$n={previous:-1,next:1};function er(e){let t=e.roundingIncrement;return t===void 0?1:s(t,`roundingIncrement`)}function tr(e){let t=e.fractionalSecondDigits;if(t!==void 0){if(typeof t!=`number`){if(zn(t)===`auto`)return;b(p(`fractionalSecondDigits`,t))}t=oe(`fractionalSecondDigits`,Math.floor(t),0,9,1)}return t}function nr(e,t,n=0,r){let i=t[e];if(i===void 0)return r?n:void 0;if(i=zn(i),i===`auto`)return r?n:null;let a=Be[i];return a===void 0&&(a=Nn[i]),a===void 0&&b(g(e,i,Be)),a}function rr(e,t,n,r=0){let i=n[e];if(i===void 0)return r;let a=zn(i),o=t[a];return o===void 0&&b(g(e,a,t)),o}const ir=C(nr,Wn),ar=C(nr,`largestUnit`),or=C(nr,`unit`),sr=C(rr,`overflow`,Gn),cr=C(rr,`disambiguation`,Kn),lr=C(rr,`offset`,qn),ur=C(rr,`calendarName`,Jn),dr=C(rr,`timeZoneName`,Yn),fr=C(rr,`offset`,Xn),pr=C(rr,`roundingMode`,Zn),mr=C(rr,`direction`,$n);function hr(e,t,n,r){let i=r?Je:Ye[t+1];if(i){let n=Ye[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 gr(e,t,n,r){return t!=null&&oe(e,t,n,r,1,Ve),t}function _r(e,t){t>e&&b(`smallestUnit > largestUnit`)}function vr(e,t,n,r=9,i=0,o=4){t=a(t);let s=ar(t,i),c=er(t),l=pr(t,o),u=ir(t,i,1);return s=gr(`largestUnit`,s,i,r),u=gr(Wn,u,i,r),s==null?s=Math.max(n,u):_r(s,u),c=hr(c,u,1),e&&(l=(e=>e<4?(e+2)%4:e)(l)),[s,u,c,l]}function yr(e,t=6,n){let r=er(e=Un(e,Wn)),i=pr(e,7),a=ir(e);return a=In(Wn,a),a=gr(Wn,a,0,t),r=hr(r,a,void 0,n),[a,r,i]}function N(e,t){return S(at,e,S(O,t))}function P(e){return e===void 0?0:sr(f(e))}function br(e,t=0){e=a(e);let n=cr(e),r=lr(e,t);return[sr(e),r,n]}const xr=BigInt(1e8)*D,Sr=BigInt(-1e8)*D,Cr=Sr-D,wr=-3261848;function Tr(e){let t=12*e.year+e.month;return(t<wr||t>3309129)&&b(`Out-of-bounds date`),e}function Er(e,t=1){return Or(Ut(e),t),e}function Dr(e){let t=Ut(e);return Or(t),t!==Cr||Nt(e)||b(`Out-of-bounds date`),e}function Or(e,t=1){(e<(t?Cr:Sr)||e>xr)&&b(`Out-of-bounds date`)}function kr(e){return(e<Sr||e>xr)&&b(`Out-of-bounds date`),e}function Ar(e,t){return kr(Ut(e)+BigInt(Nt(e)-t))}function jr(e){return{epochNanoseconds:e}}function Mr(e,t,n){return{calendar:n,timeZone:t,epochNanoseconds:e}}function Nr(e,t){return S(O,e,F(e,t))}function F(e,t){return S(at,e,{calendar:t})}function Pr(e){return S(O,e)}function I(e){return S(A,e,{sign:na(e)})}function Fr(e){return t=e.epochNanoseconds,Number(we(t,Ze));var t}function Ir(e){return e.epochNanoseconds}function Lr(e,t,n){let r=da(t),[i,a]=((e,t)=>{let n=t((e=Un(e,`unit`)).relativeTo),r=or(e);return r=In(`unit`,r),[r,n]})(n,e);if(!a&&Ji(Math.max(i,r),a))return zr(t,i);if(a||b(`Missing relativeTo`),!t.sign&&Ji(i,a))return 0;let o=Hi(a),s=o.G(o.i,t);Gi(o,s);let c=o.re(o.i,s,i);return Ji(i,a)?zr(c,i):Rr(c,o.V(s),i,o)}function Rr(e,t,n,r){let i=na(e)||1,a=Br(Fn(n,e),n,i,r,t),o=a.ae,s=a.de,c=Number(s-o),l=Number(t-o);return a.ye[A[n]]+l/c*i}function zr(e,t){return tt(aa(e),Ye[t])}function Br(e,t,n,r,i){let a=A[t],o=e,s=0,c=Vr(o,a,n,r);return i&&!((e,t,n,r)=>r>0?E(t,e)<=0&&E(e,n)<=0:E(n,e)<=0&&E(e,t)<=0)(i,c.ae,c.de,Math.sign(n))&&(o={...e,[a]:e[a]+n},s=1,c=Vr(o,a,n,r)),{...c,ye:o,He:s}}function Vr(e,t,n,r){let i={...e,[t]:e[t]+n};return{ae:Ui(r,e),de:Ui(r,i),Ae:i}}function Hr(e,t,n){let r=n-t,i=e-t;if(!i)return 0;let a=i<0n?-i:i,o=r<0n?-r:r,s=E(i,0n)===E(r,0n)?1:-1;return E(a,o)<=0?a===o?s:Ae(E(2n*a,o),s):Number(i)/Number(r)}function Ur(e,t,n,r){let{epochNanoseconds:i}=e,{timeZone:a,calendar:o}=e;if(t===0&&n===1)return{epochNanoseconds:i,timeZone:a,calendar:o};if(t===6){let t=N(L(e),kt),n=N(yi(t,1),kt),o=di(a,t),s=di(a,n);i=ri(Hr(i,o,s),r)?s:o}else{let o=L(e),s=o.offsetNanoseconds;i=li(a,Kr(o,Yr(t,n),r),s,2,0,1)}return{epochNanoseconds:i,timeZone:a,calendar:o}}function Wr(e){let{timeZone:t}=e,n=N(L(e),kt),r=N(yi(n,1),kt),i=di(t,n);return tt(di(t,r)-i,qe)}function Gr(e){let{timeZone:t,calendar:n}=e;return Mr(di(t,N(L(e),kt)),t,n)}function Kr(e,t,n){let[r,i]=qr(e,t,n),a=N(yi(e,i),r);return Dr(a),a}function qr(e,t,n){return Lt(ni(Nt(e),t,n))}function Jr(e){return ni(e,Ke,7)}function Yr(e,t){return Ye[e]*t}function Xr(e,t){return BigInt(Ye[e])*BigInt(t)}function Zr(e,t,n){let r=Math.min(da(e),6);return ca($r(aa(e),BigInt(t),n),r)}function Qr(e,t,n,r,i,a,o){if(r===0&&i===1)return e;let s=na(e)||1,[c,l,u]=(Ji(r,o.i)?Wi(o.i)&&r<6&&n>=6?ai:ii:oi)(s,e,t,n,r,i,a,o);return u&&r!==7&&(c=((e,t,n,r,i,a)=>{for(let o=r+1;o<=n;o++){if(o===7&&n!==7)continue;let r=Fn(o,e);r[A[o]]+=i;let s=E(t,Ui(a,r));if(s&&s!==i)break;e=r}return e})(c,l,n,Math.max(6,r),s,o)),c}function $r(e,t,n){return ti(e,t,n,e/t%2n)}function ei(e,t,n){let[r,i]=Te(e,D),a=r*D;return a+ti(i,t,n,(a/t+i/t)%2n)}function ti(e,t,n,r){let i=e/t,a=e%t,o=0;a&&(o=Ae(E(2n*(a<0n?-a:a),t),Math.sign(Number(a))));let s=ri(Number(r)+o,n);return(i-r+BigInt(s))*t}function ni(e,t,n){return ri(e/t,n)*t}function ri(e,t){return Qn[t](e)}function ii(e,t,n,r,i,a,o){let s=aa(t),c=$r(s,Xr(i,a),o),l=c-s,u=Math.sign(Number(c/D)-Number(s/D))===e,d=ca(c,Math.min(r,6));return[{...t,...d},n+l,u]}function ai(e,t,n,r,i,a,o,s){let c=Number(oa(t)),l=Yr(i,a),u=ni(c,l,o),d=Br({...t,...Pn},6,e,s,n),f=d.ae,p=d.de,m=u-Number(p-f),h=0;m&&Math.sign(m)!==e?n=f+BigInt(u):(h+=e,u=ni(m,l,o),n=p+BigInt(u));let g=la(u);return[{...t,...g,days:t.days+h},n,!!h]}function oi(e,t,n,r,i,a,o,s){let c=A[i],l=Fn(i,t);i===7&&(t={...t,weeks:t.weeks+Math.trunc(t.days/7)}),l[c]=Oe(t[c],a)*a;let u=Br(l,i,a*e,s,n),d=u.ae,f=u.de,p=Hr(n,d,f),m=u.ye[c],h=u.Ae[c],g=ni(m+p*e*a,a,o),_=g===h;return l[c]=g,[l,_?f:d,u.He||_]}function si(e,t){return e.timeZone.U(e.epochNanoseconds,(e=>{let t=mr(Un(e,`direction`),0);return t||b(p(`direction`,t)),t})(t))}const L=se(ci,WeakMap);function ci(e){let{epochNanoseconds:t,timeZone:n}=e,r=n.C(t);return{...qt(t+BigInt(r)),offsetNanoseconds:r}}function li(e,t,n,r=0,i=0,a,o){if(n!==void 0&&r===1&&(r===1||o))return Ar(t,n);r!==2&&r!==0||Er(t,0);let s=e.R(t);if(n!==void 0&&r!==3){let e=((e,t,n,r)=>{let i=Vt(t);r&&(n=Jr(n));for(let t of e){let e=Number(i-t);if(r&&(e=Jr(e)),e===n)return t}})(s,t,n,a);if(e!==void 0)return e;r===0&&b(`Invalid TimeZone offset`)}return o?Vt(t):ui(e,t,i,s)}function ui(e,t,n=0,r=e.R(t)){if(r.length===1)return r[0];if(n===1&&b(`Ambiguous offset`),r.length)return r[n===3?1:0];let i=Vt(t),a=((e,t)=>{let n=e.C(t-D);return(e=>(e>864e11&&b(`Out-of-bounds TimeZone gap`),e))(e.C(t+D)-n)})(e,i),o=qt(i+BigInt(a*(n===2?-1:1)));return(r=e.R(o))[n===2?0:r.length-1]}function di(e,t){let n=e.R(t);if(n.length)return n[0];let r=Vt(t)-D;return e.U(r,1)}function fi(e,t,n,r,i){let a=P(i);return r.sign&&da(r)<8&&b(`Cannot use small units`),_i(t,bi(t,Er(_i(t,n)),e?R(r):r,a))}function pi(e,t){return kr(e+(ua(n=t)&&b(`Cannot use large units`),oa(n)));var n}function mi(e,t,n){let{calendar:r,epochNanoseconds:i,timeZone:a}=e,o=oa(t),s=i;if(ua(t)){let i=L(e);s=ui(a,N(gi(r,i,{...t,...Pn},n),i))+o}else s+=o,P(n);return{...e,epochNanoseconds:kr(s)}}function hi(e,t,n,r){let[i,a]=vi(t,n),o=N(gi(e,t,{...n,...Pn,days:n.days+a},r),i);return Dr(o),o}function gi(e,t,n,r){if(n.years||n.months||n.weeks)return bi(e,t,n,P(r));P(r);let i=n.days+Number(oa(n)/D);return i?Er(yi(t,i)):t}function _i(e,t){return yi(t,1-k(e,t).day)}function vi(e,t){let n=oa(t),r=Number(n/D),i=Number(n%D),[a,o]=Lt(Nt(e)+i);return[a,r+o]}function yi(e,t){return t?Yt(Gt(e)+t):e}function bi(e,t,n,r){let{years:i,months:a,weeks:o,days:s}=n,c;if(s+=Number(oa(n)/D),i||a)c=xi(e,t,i,a,r);else{if(!o&&!s)return t;c=t}return(o||s)&&(c=yi(c,7*o+s)),Er(c)}function xi(e,t,n,r,i){let{year:a,month:o,day:s}=k(e,t);if(n){let[t,r]=hn(e,a,o);a+=n,o=Si(e,t,r,e?e.q(a):void 0,i),o=oe(`month`,o,1,vn(e,a),i)}if(r){let t=e?e.N(a,o,r):rn(a,o,r);({year:a,month:o}=t)}return s=oe(`day`,s,1,yn(e,a,o),i),_n(e,a,o,s)}function Si(e,t,n,r,i){if(n){let n=e?e.m:void 0;return r!==void 0&&(n<0||r===t+1)?r:(i===1&&b(v),n<0?-n:t)}return Re(t,0,r)}function Ci(e,t){return Pe(e)!==Pe(t)&&b(`Mismatching Calendars`),e}function wi(e,t){return e.o!==t.o&&b(`Mismatching TimeZones`),e}function Ti(e){return e.timeZone.id}function Ei(e,t,n,r){let[i,a,o,s]=vr(e,r,3,5),c=zi(t.epochNanoseconds,n.epochNanoseconds,i,a,o,s);return I(e?R(c):c)}function Di(e,t,n,r,i){let[a,o,s,c]=vr(e,i,5),l=n.epochNanoseconds,u=r.epochNanoseconds,d;return E(u,l)?a<6?d=zi(l,u,a,o,s,c):(d=Ni(wi(n.timeZone,r.timeZone),t,n,r,a),d=Qr(d,u,a,o,s,c,Vi(n,Ir,mi))):d=j,I(e?R(d):d)}function Oi(e,t,n,r,i){let[a,o,s,c]=vr(e,i,6),l=Vt(n),u=Vt(r),d=E(u,l),f;return d?a<=6?f=zi(l,u,a,o,s,c):(f=Fi(t,n,r,d,a),f=Qr(f,u,a,o,s,c,Vi(n,Vt,C(hi,t)))):f=j,I(e?R(f):f)}function ki(e,t,n,r,i){let[a,o,s,c]=vr(e,i,6,9,6);return ji(e,t,n,r,a,o,s,c)}function Ai(e,t,n,r,i){let[a,o,s,c]=vr(e,i,9,9,8),l=_i(t,n),u=_i(t,r);return Li(l,u)?ji(e,t,Er(l),Er(u),a,o,s,c,8):I(j)}function ji(e,t,n,r,i,a,o,s,c=6){let l=Ut(n),u=Ut(r),d;return E(u,l)?i===6?d=zi(l,u,i,a,o,s):(d=Ii(t,n,r,i),a===c&&o===1||(d=Qr(d,u,i,a,o,s,Vi(n,Ut,C(gi,t))))):d=j,I(e?R(d):d)}function Mi(e,t,n,r){let[i,a,o,s]=vr(e,r,5,5),c=ni(Nt(n)-Nt(t),Yr(a,o),s),l={...j,...la(c,i)};return I(e?R(l):l)}function Ni(e,t,n,r,i){let a=E(r.epochNanoseconds,n.epochNanoseconds);if(!a)return j;if(i<6)return{...j,...ca(r.epochNanoseconds-n.epochNanoseconds,i)};if(!Li(L(n),L(r)))return{...j,...ca(r.epochNanoseconds-n.epochNanoseconds,5)};let[o,s,c]=Ri(e,n,r,a);return{...i===6?{...j,days:Bi(o,s)}:Ii(t,o,s,i),...la(c)}}function Pi(e,t,n,r){let i=Vt(t),a=Vt(n),o=E(a,i);return o?r<=6?{...j,...ca(a-i,r)}:Fi(e,t,n,o,r):j}function Fi(e,t,n,r,i){let a=n,o=Nt(n)-Nt(t);return Math.sign(o)===-r&&(a=yi(n,-r),o+=864e11*r),{...Ii(e,t,a,i),...la(o)}}function Ii(e,t,n,r){if(r<=7){let e=Bi(t,n);return r===7?{...j,weeks:Oe(e,7),days:ke(e,7)}:{...j,days:e}}let i=k(e,t),a=k(e,n);if(r===8){let{year:r,month:o,day:s}=i,{year:c,month:l,day:u}=a,d=Math.sign(T(c,r)||T(l,o)||Bi(t,n)),f=0,p=0;if(d){f=e?e.ne(r,o,c,l):an(r,o,c,l);let i=xi(e,t,0,f,0);d*T(s,u)>0&&(f-=d,i=xi(e,t,0,f,0)),p=Bi(i,n)}return{...j,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=yn(e,l,u),r=0;if(Math.sign(d-c)===-t){let i=n,a=e?e.N(l,u,-t):rn(l,u,-t);({year:l,month:u}=a),f=l-o,p=u-s,n=yn(e,l,u),r=t<0?-i:n}if(m=d-Math.min(c,n)+r,f){let[n,r]=hn(e,o,s),[i,a]=hn(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&&-vn(e,l);l-=t,f=l-o,p=u-Si(e,n,r,e?e.q(l):void 0,0)+(i||vn(e,l))}else if(e){let t=Si(e,n,r,e.q(l),0);p=e.ne(l,t,l,u)}}}return{...j,years:f,months:p,days:m}}function Li(e,t){return T(e.year,t.year)||T(e.month,t.month)||T(e.day,t.day)}function Ri(e,t,n,r){let i=L(t),a=L(n),o=n.epochNanoseconds,s=0,c=Nt(a)-Nt(i);Math.sign(c)===-r&&s++;let l=s+(r>0?1:0);for(;s<=l;s++){let t=yi(a,s*-r),n=ui(e,N(t,i));if(E(o,n)!==-r)return[i,t,Number(o-n)]}}function zi(e,t,n,r,i,a){return{...j,...ca($r(t-e,Xr(r,i),a),n)}}function Bi(e,t){return Gt(t)-Gt(e)}function Vi(e,t,n){return{i:e,V:t,G:n}}function Hi(e){let{calendar:t}=e;if(Wi(e)){let{timeZone:n}=e;return{i:e,V:Ir,G:mi,re:C(Ni,n,t)}}return{i:Ki(e),V:Vt,G:C(hi,t),re:C(Pi,t)}}function Ui(e,t){return e.V(e.G(e.i,t))}function Wi(e){return`timeZone`in e}function Gi(e,t){Wi(e.i)||(qi(e.i),qi(t))}function Ki(e){return N(e,`hour`in e?e:kt)}function qi(e){Dr(Ki(e))}function Ji(e,t){return e<=6-(t&&Wi(t)?1:0)}function Yi(e,t,n){let r={};for(let i=t;i>=0;i--){let t=Ye[i];r[n[i]]=Oe(e,t),e=ke(e,t)}return r}const Xi=2**53;function Zi(e,t,n,r,i){let o=e(a(i).relativeTo),s=Math.max(da(n),da(r));if(Ji(s,o))return Qi(t,n,r,s);o||b(`Missing relativeTo`),t&&(r=R(r));let c=Hi(o),l=c.G(c.i,n),u=c.G(l,r);return I(c.re(c.i,u,s))}function Qi(e,t,n,r){return I(ra(((e,t,n,r)=>{let i=aa(e)+aa(t)*BigInt(r?-1:1);return Number.isFinite(Number(i/D))||b(`Out-of-bounds date`),{...j,...ca(i,n)}})(t,n,r,e)))}function $i(e,t,n){let r=da(t),[i,a,o,s,c]=((e,t,n)=>{e=Un(e,Wn);let r=ar(e),i=n(e.relativeTo),a=er(e),o=pr(e,7),s=ir(e);return r===void 0&&s===void 0&&b(`Required smallestUnit or largestUnit`),s??=0,r??=Math.max(s,t),_r(r,s),a=hr(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 I(ra(((e,t,n,r,i)=>{let a=$r(aa(e),Xr(n,r),i);return{...j,...ca(a,t)}})(t,i,a,o,s)));let l=c&&Wi(c)&&i>=6&&a<6;if(!t.sign&&!l)return t;c||b(`Missing relativeTo`);let u=Hi(c),d=u.G(u.i,t);Gi(u,d);let f=u.re(u.i,d,i);return f=Qr(f,u.V(d),i,a,o,s,u),I(f)}function ea(e){return e.sign===-1?ta(e):e}function ta(e){return I(R(e))}function R(e){let t={};for(let n of A)t[n]=-1*e[n]||0;return t}function na(e,t=A){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 ra(e){for(let t of Mn)oe(t,e[t],-4294967295,4294967295,1);let t=aa(e);return ia(Number(t/Qe)),e}function ia(e){Number.isSafeInteger(e)||b(`Out-of-bounds duration`)}function aa(e){return BigInt(e.days)*D+oa(e)}function oa(e){return BigInt(e.hours)*et+BigInt(e.minutes)*$e+sa(e)}function sa(e){return BigInt(e.seconds)*Qe+BigInt(e.milliseconds)*Ze+BigInt(e.microseconds)*Xe+BigInt(e.nanoseconds)}function ca(e,t=6){let n=Number(e/D),r=Number(e%D),i=Ye[t],a=t<=3?Number(e/BigInt(i)):Je/i*n+Oe(r,i);Number.isFinite(a)||b(`Out-of-bounds date`),t<=3&&Math.abs(a)/(Ge/Ye[t])>=Xi&&b(`Out-of-bounds date`);let o=Yi(r,t,A);return o[A[t]]=a,o}function la(e,t=5){return Yi(e,t,A)}function ua(e){return!!na(e,jn)}function da(e){let t=9;for(;t>0&&!e[A[t]];t--);return t}function fa(e,t){return E(e.epochNanoseconds,t.epochNanoseconds)}function pa(e,t){return E(e.epochNanoseconds,t.epochNanoseconds)}function ma(e,t,n,r){let i=e(a(r).relativeTo),o=Math.max(da(t),da(n));if(me(A,t,n))return 0;if(Ji(o,i))return E(aa(t),aa(n));i||b(`Missing relativeTo`);let s=Hi(i);return E(Ui(s,t),Ui(s,n))}function ha(e,t){return ga(e,t)||_a(e,t)}function ga(e,t){return T(Gt(e),Gt(t))}function _a(e,t){return T(Nt(e),Nt(t))}function va(e,t){return!fa(e,t)}function ya(e,t){return!pa(e,t)&&e.timeZone.o===t.timeZone.o&&e.calendar===t.calendar}function ba(e,t){return!ha(e,t)&&e.calendar===t.calendar}function xa(e,t){return!ga(e,t)&&e.calendar===t.calendar}function Sa(e,t){return!ga(e,t)&&e.calendar===t.calendar}function Ca(e,t){return!ga(e,t)&&e.calendar===t.calendar}function wa(e,t){return!_a(e,t)}function Ta(e){return e===0?Me:e?e.l:void 0}function z(e,t,n=t){return Ta(e)?n:t}function Ea(e,t){let n=e||void 0,r=Ta(e),{era:i,eraYear:a,year:o}=t;if(o!==void 0&&(o=s(o,`year`)),a!==void 0&&(a=s(a,`eraYear`)),i!==void 0||a!==void 0){i!==void 0&&a!==void 0||x(`Mismatching era/eraYear`),r||b(`Forbidden era/eraYear`);let e=Ne(i),t=r[e];t===void 0&&b((e=>`Invalid era: ${e}`)(i));let s=n?.te?n.te(a,e,t):ka(a,t);o!==void 0&&o!==s&&b(`Mismatching year/eraYear`),o=s}else o===void 0&&x(_(r));return o}function Da(e,t,n,r,i){let{month:a,monthCode:o}=t;if(o!==void 0){let t=((e,t,n,r,i=Ie(t))=>{let a=e?e.q(n):void 0,[o,s]=i,c=Re(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=Re(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,vn(e,n),r)}function Oa(e,t,n,r,i){return ae(t,`day`,1,yn(e,r,n),i)}function ka(e,t){return(t+e)*(Math.sign(t)||1)||0}function Aa(e,t){return Mt(S(O,{...kt,...e}),t)}const ja=ve(`([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?`);function Ma(e){let t=Na(e);return t===void 0&&b(ne(e)),t}function Na(e,t){let n=ja.exec(e);if(n&&(e=>(e=>{e[0]!==`T`&&e[0]!==`t`||(e=e.slice(1));let t=e.search(/[.,]/),n=t<0?e:e.slice(0,t),r=n.split(`:`);return r.length===1?/^(?:\d{2}|\d{4}|\d{6})$/i.test(n):(r.length===2||r.length===3)&&r.every(e=>e.length===2&&/^\d{2}$/i.test(e))})(e.slice(1)))(n[0]))return((e,t)=>{let n=e[4]||e[5];return t&&n&&b(re(n)),r=(xe(e[2])*qe+xe(e[3])*Ke+xe(e[4])*Ge+ye(e[5]||``))*be(e[1]),Math.abs(r)>=864e11&&b(`Out-of-bounds offset`),r;var r})(n,t)}const Pa={era:Bn,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 M(n.call(e),t)}return M(e,t)})(e,t)},day:c},Fa=fe(O,s),Ia=fe(A,Hn),La={offset(e){return Ma(Bn(e))}},Ra=Object.assign({},Pa,Fa),za=Object.assign({},Ra,La);function B(e,t,n,r,i=!r){let a={},o=0;for(let i of t){let t=e[i];if(t!==void 0){o=1;let e=n[i];e&&(t=e(t,i)),a[i]=t}else r&&r.includes(i)&&x(m(i))}return i&&!o&&x(h(t)),a}function Ba(e,t=kt,n){let r=N(e,t);return Dr(r),Nr(r,n)}function Va(e,t,n){return Ua(e,t,Ga(e,t),P(n))}function Ha(e,t,n){let r=Ga(e,t),i=n();return[Ua(e,t,r,i[0]),...i]}function Ua(e,t,n,r){let i=n[1],a=Da(e,t,i,r,n[0]);return F(Er(_n(e,i,a,Oa(e,t,a,i,r))),e)}function Wa(e){if(e.monthCode!==void 0)return Ie(e.monthCode)}function Ga(e,t){let n=Ta(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`)),[Wa(t),Ea(e,t)]}function Ka(e,t,n){let r=Ta(e);t.year!==void 0||t.era!==void 0&&t.eraYear!==void 0||x(_(r)),t.monthCode===void 0&&t.month===void 0&&x(`Missing month/monthCode`);let i=Wa(t),a=Ea(e,t);return F(Tr(_n(e,a,Da(e,t,a,P(n),i),1)),e)}function qa(e,t,n){let r=e===void 0,i=Ta(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=Wa(t),o=t.eraYear!==void 0||t.year!==void 0?Ea(e,t):void 0,s=P(n),c,l,u;if(o===void 0&&r&&(o=1972),o!==void 0){r||Er(_n(e,o,1,1));let n=Da(e,t,o,s,a);c=Oa(e,t,n,o,s),[l,u]=hn(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=Oa(e,t,Da(e,t,n,s,a),n,s);else{let n=s===0&&e?e.ke?.(l,u,t.day):void 0;c=n===void 0?t.day:n}}u&&((e&&e.Z?.[l])??1/0)<t.day&&(s===1&&b(v),u=0,c=ie(t.day,1,(e&&e.X)??1/0));let d=e?e.v(l,!!u,c):Qt(l,!!u);for(;!d&&s===0&&c>1;)c--,d=e?e.v(l,!!u,c):Qt(l,!!u);d||b(`Cannot guess year`);let{year:f,month:p}=d;return F(Er(_n(e,f,p,c)),e)}const Ja=Intl.DateTimeFormat;function Ya(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 Xa={El_Aaiun:17,Tucuman:12,Tirane:11,Riga:10,Simferopol:9,Vienna:9,Tunis:8,Boa_Vista:6,Fortaleza:6,Maceio:6,Noronha:6,Recife:6,Gaza:6,Hebron:6,DeNoronha:6},Za=-388152e4;function Qa(e,t=4){let n=tr(e);return[pr(e,4),...to(gr(Wn,ir(e),0,t),n)]}function $a(e){return ur(a(e))}function eo(e,t){return Qa(a(e),t)}function to(e,t){return e==null?[t===void 0?1:10**(9-t),t]:[Ye[e],e<4?9-3*e:-1]}function no(e,t,n){let[r,i,o,s]=(e=>{let t=tr(e=a(e)),n=pr(e,4),r=ir(e);return[e.timeZone,n,...to(gr(Wn,r,0,4),t)]})(n),c=r!==void 0;return((e,t,n,r,i,a)=>{n=ei(n,BigInt(i),r);let o=t.C(n);return ho(qt(n+BigInt(o)),a)+(e?bo(Jr(o)):`Z`)})(c,Po(c?e(r):`UTC`),t.epochNanoseconds,i,o,s)}function ro(e,t){let n=(e=>{e=a(e);let t=ur(e),n=tr(e),r=fr(e),i=pr(e,4),o=ir(e);return[t,dr(e),r,i,...to(gr(Wn,o,0,4),n)]})(t);return((e,t,n,r,i,a,o,s,c,l)=>{r=ei(r,BigInt(c),s);let u=n.C(r);return ho(qt(r+BigInt(u)),l)+bo(Jr(u),o)+xo(t,a)+So(e,i)})(e.calendar,e.timeZone.id,e.timeZone,e.epochNanoseconds,...n)}function io(e,t){let n=(e=>(e=a(e),[ur(e),...Qa(e)]))(t);return((e,t,n,r,i,a)=>ho(Kr(t,i,r),a)+So(e,n))(e.calendar,e,...n)}function ao(e,t){return n=e.calendar,r=e,i=$a(t),go(r)+So(n,i);var n,r,i}function oo(e,t){return co(e.calendar,_o,e,$a(t))}function so(e,t){return co(e.calendar,vo,e,$a(t))}function co(e,t,n,r){return r===1?e===void 0?t(n):go(n):r>1||r===0&&e!==void 0?go(n)+Co(Pe(e),r===2):t(n)}function lo(e,t){return((e,t,n,r)=>yo(qr(e,n,t)[0],r))(e,...eo(t))}function uo(e,t){let[n,r,i]=eo(t,3);return r>1&&ra(e={...e,...Zr(e,r,n)}),fo(e,i)}function fo(e,t){let{sign:n}=e,r=n===-1?R(e):e,{hours:i,minutes:a}=r,o=sa(r),s=Number(o/Qe),c=Number(o%Qe);ia(s);let l=To(c,t),u=t>=0||!n||l;return(n<0?`-`:``)+`P`+po({Y:mo(r.years),M:mo(r.months),W:mo(r.weeks),D:mo(r.days)})+(i||a||s||u?`T`+po({H:mo(i),M:mo(a),S:mo(s,u)+l}):``)}function po(e){let t=[];for(let n in e){let r=e[n];r&&t.push(r,n)}return t.join(``)}function mo(e,t){if(!e&&!t)return``;let n=Object.create(null);return n.useGrouping=0,e.toLocaleString(`fullwide`,n)}function ho(e,t){return go(e)+`T`+yo(e,t)}function go(e){return _o(e)+`-`+Ce(e.day)}function _o(e){let{year:t}=e;return(t<0||t>9999?Eo(t)+Se(6,Math.abs(t)):Se(4,t))+`-`+Ce(e.month)}function vo(e){return Ce(e.month)+`-`+Ce(e.day)}function yo(e,t){let n=[Ce(e.hour),Ce(e.minute)];return t!==-1&&n.push(Ce(e.second)+((e,t,n,r)=>To(e*We+t*Ue+n,r))(e.millisecond,e.microsecond,e.nanosecond,t)),n.join(`:`)}function bo(e,t=0){if(t===1)return``;let[n,r]=Ee(Math.abs(e),qe),[i,a]=Ee(r,Ke),[o,s]=Ee(a,Ge);return Eo(e)+Ce(n)+`:`+Ce(i)+(o||s?`:`+Ce(o)+To(s):``)}function xo(e,t){return t===1?``:`[`+(t===2?`!`:``)+e+`]`}function So(e,t){return t>1||t===0&&e!==void 0?Co(Pe(e),t===2):``}function Co(e,t){return`[`+(t?`!`:``)+`u-ca=`+e+`]`}const wo=/0+$/;function To(e,t){let n=Se(9,e);return n=t===void 0?n.replace(wo,``):n.slice(0,t),n?`.`+n:``}function Eo(e){return e<0?`-`:`+`}const Do=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,Oo=/[^\w\/:+-]+/;function ko(e){return Ao(M(e))}function Ao(e){return jo(e).id}function jo(e){let t=e.toUpperCase(),n=(e=>{let t=Na(e,1);if(t!==void 0)return{id:bo(t),_:t,o:t}})(t);return n?{kind:`fixed`,...n}:Mo(t===`UTC`?`UTC`:(e=>(Oo.test(e)&&b(te(e)),Do.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?_e(e).replace(/island|noronha|murdo|rivadavia|urville/,_e):e)).join(`/`)))(e))}const Mo=se(e=>{if(e===`UTC`)return{kind:`utc`,id:e,o:e};let t=No(e.toUpperCase());return{kind:`named`,id:e,format:t,o:t.resolvedOptions().timeZone}}),No=se(e=>new Ja(`en-u-hc-h23`,{calendar:`iso8601`,timeZone:e,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}));function Po(e){let t=jo(e);return Fo(t.id,t)}const Fo=se((e,t)=>t.kind===`named`?new Lo(e,t.o,t.format):new Io(e,t.o,t.kind===`fixed`?t._:0));var Io=class{constructor(e,t,n){this.id=e,this.o=t,this._=n}C(){return this._}R(e){return[Ar(e,this._)]}U(){}},Lo=class{constructor(e,t,n){this.id=e,this.o=t,this.qe=((e,t)=>{let n=se(e),r=se(zo),i=86400*t;function a(e){let[t,a]=Bo(e,i),s=Vo(t),c=Vo(a),l=n(s),u=n(c);return l===u?l:o(r(s,c),l,u,e)}function o(t,n,r,i){let a,o;for(;(i===void 0||(a=i<t[0]?n:i>=t[1]?r:void 0)===void 0)&&(o=t[1]-t[0]);){let n=t[0]+Math.floor(o/2);e(n)===r?t[1]=n:t[0]=n+1}return a}return{Ee(e){let t=a(e-86400),n=a(e+86400),r=e-t,i=e-n;if(t===n)return[r];let o=a(r);return o===a(i)?[e-o]:t>n?[r,i]:[]},De:a,U:function e(t,a){if(a>0&&t>=864e10)return;if(a<0){if(t<=Za)return;let n=Ro()+94867200;if(t>n)return e(n,-1)}let[s,c]=Bo(a>0?Math.max(t,Za):t,i),l=i*a,u=a>0?Math.max(t,Ro())+94867200:Za,d=()=>a<0?c>u:s<u;for(;d();){let e=Vo(s),i=Vo(c),u=n(e),d=n(i);if(u!==d){let n=r(e,i);o(n,u,d);let s=n[0];if((T(s,t)||1)===a)return s}s+=l,c+=l}}}})((e=>t=>{let n=Ya(e,1e3*t);return 86400*Kt((e=>{let t=e.relatedYear;if(t!==void 0)return parseInt(t);let n=parseInt(e.year);return e.era!==void 0&&Ne(e.era)===`bce`?1-n:n})(n),parseInt(n.month),parseInt(n.day))+3600*parseInt(n.hour)+60*parseInt(n.minute)+parseInt(n.second)-t})(n),(e=>Xa[e.split(`/`).pop()]||60)(e))}C(e){return this.qe.De((e=>Bt(e)[0])(e))*Ge}R(e){let t=86400*Gt(e)+Ft(e),n=It(e);return this.qe.Ee(t).map(e=>kr(BigInt(e)*Qe+BigInt(n)))}U(e,t){let[n,r]=Bt(e),i=this.qe.U(n+(t>0||r?1:0),t);if(i!==void 0)return BigInt(i)*Qe}};function Ro(){return Math.floor(Date.now()/1e3)}function zo(e,t){return[e,t]}function Bo(e,t){let n=Math.floor(e/t)*t;return[n,n+t]}function Vo(e){return ie(e,-1e10,864e10)}function Ho(e,t,n){let r=B(n,z(t,Tt,Et),za,[],0);if(r.timeZone!==void 0){let n=Va(t,r),i=Aa(r),a=Po(e(r.timeZone));return{epochNanoseconds:li(a,N(n,i),r.offset),timeZone:a,calendar:t}}return Va(t,r)}function Uo(e,t,n,r){let i=B(n,z(t,Tt,Et),za,st,0),a=e(i.timeZone),[o,s,c,l]=Ha(t,i,()=>br(r)),u=Aa(i,s),d=Po(a);return Mr(li(d,N(o,u),i.offset,c,l),d,t)}function Wo(e,t,n){let r=B(t,z(e,xt,St),Ra,[],0),[i,a]=Ha(e,r,()=>[P(n)]);return Ba(i,Aa(r,a),e)}function Go(e,t,n,r=[]){return Va(e,B(t,z(e,yt,bt),Pa,r),n)}function Ko(e,t,n,r){return Ka(e,B(t,z(e,mt,ht),Pa,r),n)}function qo(e,t,n,r){let i=B(n,z(e,yt,bt),Pa,it,0);return t&&i.month!==void 0&&i.monthCode===void 0&&i.year===void 0&&(i.year=1972),qa(e,i,r)}function Jo(e,t){return Aa(B(e,ft,Fa,[],1),P(t))}function Yo(e){let t=B(e,kn,Ia);return I(ra({...j,...t}))}function Xo(e){b(ne(e))}function Zo(e){let t=Ts(e=Bn(e)),n;return t||Xo(e),t.F?n=0:t.offset?n=Ma(t.offset):Xo(e),t.timeZoneId&&Na(t.timeZoneId,1),dn(t),jr(Ar(t,n))}function Qo(e,t){let n=Ts(M(e));return n||Xo(e),n.timeZoneId?ps(n,t,void 0):(n.F&&Xo(e),hs(n,t))}function $o(e,t,n){let r=Ts(M(e));return r&&r.timeZoneId||Xo(e),ps(r,t,n)}function es(e,t){let n=Ts(M(e));return n&&!n.F||Xo(e),ms(n,t)}function ts(e,t){let n=us(ls(M(e)),void 0,t);return F(n,n.calendar)}function ns(e,t){let n=Es(M(e));if(n)return rs(n),F(Tr(fn(n)),t(n.calendarId));let r=us(ls(e),ds,t),{calendar:i}=r;return F(_i(i,r),i)}function rs(e){e.calendarId!==`iso8601`&&b(re(e.calendarId))}function is(e,t){let n=Ds(M(e));if(n)return rs(n),F(fn(n),t(n.calendarId));let r=us(ls(e),fs,t),{calendar:i}=r,{year:a,month:o,day:s}=k(i,r),[c,l]=hn(i,a,o),{year:u,month:d}=((e,t,n,r)=>{let i=e?e.v(t,n,r):Qt(t,n);return i||b(`Cannot guess year`),i})(i,c,l,s);return F(Er(_n(i,u,d,s)),i)}function as(e){let t=(e=>{let t=Os(e);return t?(js(t[13]),ks(t,1)):void 0})(e=M(e)),n;return t||(t=Ts(e),t?(t.fe||Xo(e),t.F&&b(re(`Z`)),rs(t)):Xo(e)),(n=Es(e))&&pn(n)&&Xo(e),(n=Ds(e))&&pn(n)&&Xo(e),Pr(At(t))}function os(e){let t=(e=>{let t=ws.exec(e);return t?(e=>{let t=0,n=0,r=0,i={years:a(e[2]),months:a(e[3]),weeks:a(e[4]),days:a(e[5]),hours:a(e[6],e[7],5),minutes:a(e[8],e[9],4),seconds:a(e[10],e[11],3),...Yi(r,2,A)};return t||b(h(A)),be(e[1])<0&&(i=R(i)),i;function a(e,i,a){let o=0,s=0;return a&&([o,r]=Ee(r,Ye[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=ye(i)*(Ye[a]/Ge),n=1)),o+s}})(t):void 0})(M(e));return t||Xo(e),I(ra(t))}function ss(e){let t=Ts(e)||Es(e)||Ds(e);if(t)return t.calendarId;let n=Os(e);return n?js(n[13]).calendarId:e}function cs(e){let t=Ts(e);return t&&(t.timeZoneId||t.F&&`UTC`||t.offset)||e}function ls(e){let t=Ts(e);return t&&!t.F||Xo(e),t}function us(e,t,n){return t&&e.calendarId===`iso8601`?(fn(e),e.fe&&At(e),hs(t(e),n)):e.fe?ms(e,n):hs(e,n)}function ds(e){let t=12*e.year+e.month===wr?20:1;return{...e,day:t}}function fs(e){return{...e,year:1972}}function ps(e,t,n){let r=Po(Ao(e.timeZoneId)),i;if(dn(e),e.fe){let t=e.offset?Ma(e.offset):void 0,[,o,s]=br(n);i=li(r,e,t,o,s,!(r._||e.offset===void 0||(a=e.offset,a.replace(/\D/g,``).length>4)),e.F)}else br(n),i=di(r,e);var a;return kr(i),Mr(i,r,t(e.calendarId))}function ms(e,t){return dn(e),Dr(e),{...N(e,e),calendar:t(e.calendarId)}}function hs(e,t){return fn(e),Er(e),{calendar:t(e.calendarId),year:e.year,month:e.month,day:e.day}}function gs(e){return`(\\d{2})(?:(:?)(\\d{2})(?:\\${e}(\\d{2})(?:[.,](\\d{1,9}))?)?)?`}function _s(e){return`([+-])`+gs(e)}const vs=`(?:(?:([+-])(\\d{6}))|(\\d{4}))(-?)(\\d{2})\\4(\\d{2})(?:[T ]`+gs(8)+`(Z|`+_s(15)+`)?)?`,ys=ve(`(?:(?:([+-])(\\d{6}))|(\\d{4}))-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})`),bs=ve(`(?:--)?(\\d{2})-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})`),xs=ve(vs+`((?:\\[(!?)([^\\]]*)\\]){0,9})`),Ss=ve(`T?`+gs(2)+`(${_s(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`),Cs=RegExp(`\\[(!?)([^\\]]*)\\]`,`g`),ws=ve(`([+-])?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 Ts(e){let t=xs.exec(e);return t?(e=>{let t=e[12],n=(t||``).toUpperCase()===`Z`;return{year:As(e),month:parseInt(e[5]),day:parseInt(e[6]),...ks(e,7),...js(e[19]),fe:!!e[7],F:n,offset:n?void 0:t}})(t):void 0}function Es(e){let t=ys.exec(e);if(t)return(e=>({year:As(e),month:parseInt(e[4]),day:1,...js(e[5])}))(t)}function Ds(e){let t=bs.exec(e);return t?(e=>({year:1972,month:parseInt(e[1]),day:parseInt(e[2]),...js(e[3])}))(t):void 0}function Os(e){let t=Ss.exec(e);if(t)return t[6]&&Ma(t[6]),t}function ks(e,t){let n=xe(e[t+3]);return{...Lt(ye(e[t+4]||``))[0],hour:xe(e[t]),minute:xe(e[t+2]),second:n===60?59:n}}function As(e){let t=be(e[1]),n=parseInt(e[2]||e[3]);return t<0&&!n&&b(re(-0)),t*n}function js(e){let t,n,r=[];return e.replace(Cs,(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 Ms(e,t,n){let r=Object.assign(Object.create(null),t);return Ns(r,n,ut),Ta(e)&&(Ns(r,n,lt),e&&e.le&&Ns(r,n,dt,ct)),r}function Ns(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 Ps(e,t,n){let{calendar:r,timeZone:i}=e,a=z(r,Ct,wt),o=L(e),{year:s,month:c,day:l}=k(r,o),u={year:s,monthCode:Vs(r,s,c),day:l,hour:o.hour,minute:o.minute,second:o.second,millisecond:o.millisecond,microsecond:o.microsecond,nanosecond:o.nanosecond,offset:o.offsetNanoseconds},d=B(t,a,za),f=Ms(r,u,d),p={...u,...d},[m,h,g,_]=Ha(r,f,()=>br(n,2));return Mr(li(i,N(m,Mt(p,h)),p.offset,g,_),i,r)}function Fs(e,t,n){let{calendar:r}=e,i=z(r,xt,St),{year:a,month:o,day:s}=k(r,e),c={year:a,monthCode:Vs(r,a,o),day:s,hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond,microsecond:e.microsecond,nanosecond:e.nanosecond},l=B(t,i,Ra),u=Ms(r,c,l),d={...c,...l},[f,p]=Ha(r,u,()=>[P(n)]);return Ba(f,Mt(d,p),r)}function Is(e,t,n){let{calendar:r}=e,i=z(r,yt,bt),{year:a,month:o,day:s}=k(r,e);return Va(r,Ms(r,{year:a,monthCode:Vs(r,a,o),day:s},B(t,i,Pa)),n)}function Ls(e,t,n){let{calendar:r}=e,i=z(r,mt,ht),{year:a,month:o}=k(r,e);return Ka(r,Ms(r,{year:a,monthCode:Vs(r,a,o)},B(t,i,Pa)),n)}function Rs(e,t,n){let{calendar:r}=e,i=z(r,yt,bt),{year:a,month:o,day:s}=k(r,e);return qa(r,Ms(r,{monthCode:Vs(r,a,o),day:s},B(t,i,Pa)),n)}function zs(e,t,n){return((e,t,n)=>Aa({...S(ft,e),...B(t,ft,Fa)},P(n)))(e,t,n)}function Bs(e,t){return I((n=e,r=t,ra({...n,...B(r,kn,Ia)})));var n,r}function Vs(e,t,n){let[r,i]=hn(e,t,n);return Le(r,i)}function Hs(e,t,n){return Mr(e.epochNanoseconds,t,n)}function Us(e){return jr(e.epochNanoseconds)}function Ws(e){return Nr(L(e),e.calendar)}function Gs(e){return F(L(e),e.calendar)}function Ks(e){return Pr(L(e))}function qs(e,t,n){return Mr(kr(((e,t,n)=>ui(e,t,(e=>cr(a(e)))(n)))(t,e,n)),t,e.calendar)}function Js(e,t,n,r){let i=e(r.timeZone),a=r.plainTime,o=a===void 0?void 0:t(a),s=Po(i),c;return c=o?ui(s,N(n,o)):di(s,N(n,kt)),Mr(c,s,n.calendar)}function Ys(e,t,n){return $s(e,S(z(e,gt,_t),t),B(f(n),it,Pa,[]))}function Xs(e,t,n){let r=z(e,rt,pt);return $s(e,S(vt,t),B(f(n),r,Pa,[]))}function Zs(e,t){return qa(e,B(t,vt,Pa))}function Qs(e,t,n){return Ka(e,B(t,z(e,gt,_t),Pa),n)}function $s(e,t,n){let r=z(e,Dt,Ot),i=Ms(e,t,n);return i=B(i,r,Pa,[]),Va(e,i)}function ec(e){return jr(kr(BigInt(Hn(e))*Ze))}function tc(e){return jr(kr(Vn(e)))}function nc(e){return e.timeZone=`UTC`,[`full`,`long`].includes(e.timeStyle)&&(e.timeStyle=`medium`),e}function rc(e,t){return e.timeZone!==void 0&&x(`Cannot specify TimeZone`),e.timeZone=t,e}function ic(e,t,n){let r=e.resolvedOptions().calendar;!n&&t.calendar===void 0||Pe(t.calendar)===r||b(`Mismatching Calendars`)}function ac(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 oc={year:`numeric`,month:`numeric`,day:`numeric`},sc={hour:`numeric`,minute:`numeric`,second:`numeric`},cc=Object.assign({},oc,sc),lc=Object.assign({},cc,{timeZoneName:`short`}),uc={year:`numeric`,month:`numeric`},dc={month:`numeric`,day:`numeric`},fc=[`weekday`,`year`,`month`,`day`,`dateStyle`],pc=[`dayPeriod`,`hour`,`minute`,`second`,`fractionalSecondDigits`,`timeStyle`],mc=fc.concat(pc),hc=[`weekday`,`day`].concat(pc),gc=[`weekday`,`year`].concat(pc),_c=ac(mc,[],[],cc),vc=ac(mc,[],[],lc),yc=ac(mc,[],[`timeZoneName`],cc),bc=ac(fc,pc,[`timeZoneName`],oc),xc=ac(pc,fc,[`timeZoneName`,`era`],sc),Sc=ac([`year`,`month`,`dateStyle`],hc,[`timeZoneName`],uc,{full:{year:`numeric`,month:`long`},long:{year:`numeric`,month:`long`},medium:{year:`numeric`,month:`short`},short:{year:`2-digit`,month:`numeric`}}),Cc=ac([`month`,`day`,`dateStyle`],gc,[`timeZoneName`,`era`],dc,{full:{month:`long`,day:`numeric`},long:{month:`long`,day:`numeric`},medium:{month:`short`,day:`numeric`},short:{month:`numeric`,day:`numeric`}});function wc(e,t){let{timeZone:n}=e,r=L(e),{offsetNanoseconds:i}=r,a=t||kt,o;return o=t?li(n,N(r,a),i,2):di(n,N(r,a)),Mr(o,n,e.calendar)}function Tc(e){let t=Ec(),n=e.C(t);return qt(t+BigInt(n))}function Ec(){return BigInt(Date.now())*Ze}function Dc(){return new Ja().resolvedOptions().timeZone}const Oc=`PlainYearMonth`,kc=`PlainMonthDay`,Ac=`PlainDate`,jc=`PlainDateTime`,Mc=`PlainTime`,Nc=`ZonedDateTime`,Pc=`Instant`,Fc=`Duration`;function Ic(e,t,n,...r){Object.defineProperties(t,ce(e)),Object.defineProperties(t.prototype,ue(`Temporal.`+e));for(let e of r)Lc(t.prototype,n,e);return t}function Lc(e,t,n){Object.defineProperties(e,de(e=>({get(){return e(t(this))},configurable:1}),n))}const Rc=ge.name===`noop`?e=>{Object.defineProperty(e,`_str_`,{value:e.toJSON()})}:ge;function zc(){x(`Invalid calling context`)}function Bc(){x(`Cannot use valueOf`)}const Vc={era(e){return gn(e.calendar,e).era},eraYear(e){return gn(e.calendar,e).eraYear},year(e){return k(e.calendar,e).year},month(e){return k(e.calendar,e).month},monthCode(e){return bn(e.calendar,e)}},Hc={era(e){return gn(e.calendar,e).era},eraYear(e){return gn(e.calendar,e).eraYear},year(e){return k(e.calendar,e).year},month(e){return k(e.calendar,e).month},monthCode(e){return bn(e.calendar,e)},day(e){return k(e.calendar,e).day}},Uc={monthCode(e){return bn(e.calendar,e)},day(e){return k(e.calendar,e).day}},Wc={daysInMonth(e){return Cn(e.calendar,e)},daysInYear(e){return wn(e.calendar,e)},monthsInYear(e){return Sn(e.calendar,e)},inLeapYear(e){return xn(e.calendar,e)}},Gc={dayOfWeek(e){return on(e)},dayOfYear(e){return Tn(e.calendar,e)},weekOfYear(e){return En(e.calendar,e)},yearOfWeek(e){return Dn(e.calendar,e)},daysInWeek(){return 7},daysInMonth(e){return Cn(e.calendar,e)},daysInYear(e){return wn(e.calendar,e)},monthsInYear(e){return Sn(e.calendar,e)},inLeapYear(e){return xn(e.calendar,e)}};function Kc(e){return pe(Object.keys(e))}Kc(Wc),Kc(Gc);function qc(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 $t(n(e),t,r)},se(e,t,r){return Kt(n(e),t,r)*He},O(e,t){return Zt(t)},v(e,t){let n=Qt(e,t);return n&&{year:r(n.year),month:n.month}},u(e){return nn(n(e))},k(){return 12},p(e,t){return en(n(e),t)},j(e){return tn(n(e))},q(){},h(t){return e.h?.(t,r(t.year))||{}},N(e,t,i){let a=rn(n(e),t,i);return{year:r(a.year),month:a.month}},ne(e,t,r,i){return an(n(e),t,n(r),i)}}}function Jc(e,t){let n=Yc(e);return{m:t.m,Z:t.Z,X:t.X,ie:n.he,je:C(Zc,n),se:C(Qc,n),O:C($c,n,t.m),v:C(ol,n,t.m,t.Ce),u:C(tl,n,t.m),k:C(il,n),p:C(rl,n),j:C(nl,n),q:C(el,n,t.m),h:C(al,n),N:C(sl,n),ne:C(cl,n)}}function Yc(e){let t=(e=>new Ja(`en-u-hc-h23`,{calendar:e,timeZone:`UTC`,era:`short`,year:`numeric`,month:`short`,day:`numeric`}))(e);function n(e){return{...Xc(n=Ya(t,e)),month:0,Fe:n.month,day:parseInt(n.day)};var n}let r=(e=>{let t=e(0).year-1970;return se(function(n){let r=Kt(n-t)*He,i,a=0,o=[],s=[];do r+=400*He;while((i=e(r)).year<=n);do r+=(1-i.day)*He,i.year===n&&(o.push(r),s.push(i.Fe)),r-=He,(++a>500||r<-864e13)&&b();while((i=e(r)).year>=n);return{$:o.reverse(),we:s.reverse()}})})(n);return{he:((e,t)=>se(n=>{let r=Wt(n),i=e(r);return{...i,month:ll(t,i.year,r)}},WeakMap))(n,r),K:r}}function Xc(e){return{era:void 0,eraYear:void 0,year:parseInt(e.relatedYear||e.year)}}function Zc(e,t,n,r){return Jt(Qc(e,t,n,r))}function Qc(e,t,n=1,r=1){return e.K(t).$[n-1]+(r-1)*He}function $c(e,t,n,r){let i=el(e,t,n);return[ze(r,i),i===r]}function el(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 tl(e,t,n){if(t!==void 0)return il(e,n)>12;let r=nl(e,n);return r>nl(e,n-1)||r>nl(e,n+1)}function nl(e,t){return Xt(Qc(e,t),Qc(e,t+1))}function rl(e,t,n){let{$:r}=e.K(t),i=n+1,a=r;return i>r.length&&(i=1,a=e.K(t+1).$),Xt(r[n-1],a[i-1])}function il(e,t){return e.K(t).$.length}function al(e,t){let n=e.he(t);return{era:n.era,eraYear:n.eraYear}}function ol(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=el(e,t,s),d=ze(c,u),f=c===u;(T(r,d)||T(Number(i),Number(f))||T(a,l))===1&&s--;for(let n=0;n<100;n++){let o=s-n,c=el(e,t,o),l=Re(r,i,c);if(i===(l===c)&&a<=rl(e,o,l))return{year:o,month:l}}}function sl(e,t,n,r){if(r)if(Number.isSafeInteger(n+=r)||b(`Out-of-bounds date`),r<0)for(;n<1;)n+=il(e,--t);else{let r;for(;n>(r=il(e,t));)n-=r,t++}return{year:t,month:n}}function cl(e,t,n,r,i){let a=T(t,r)||T(n,i);if(!a)return 0;if(t===r)return i-n;if(a<0){let a=il(e,t)-n+i;for(let n=t+1;n<r;n++)a+=il(e,n);return a}return-cl(e,r,i,t,n)}function ll(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 ul=2440588;function dl(e){let t=e.J(2441683),n=se(t=>e.J(Gt(t)+2440588),WeakMap);function r(t,n){let r=e.q?.(t);return[ze(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 Yt(e.L(t,n,r)-2440588)},se(t,n=1,r=1){return(e.L(t,n,r)-2440588)*He},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);(T(n,s)||T(Number(i),Number(c))||T(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=Re(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||ge,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 fl(e.k,t,n,r,i)}}}function fl(e,t,n,r,i){let a=T(t,r)||T(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-fl(e,r,i,t,n)}const pl={be:0},ml={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 hl(e){return Jc(e,ml)}const gl={am:0},_l={am:0,aa:0},vl={aa:0};function yl(e,t,n=0,r=0){return dl({l:t,te(e,t,n){return t===`aa`&&r?e-5500:ka(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-bl(e,n,1,1))/30);return[n,r,t+1-bl(e,n,r,1)]})(e,t);return{year:r+n,month:i,day:a}},L(t,r,i){return bl(e,t-n,r,i)},p(e,t){return((e,t)=>t%13==0?xl(e)+5:30)(e-n,t)},j(e){return 365+xl(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 bl(e,t,n,r){return e+365*t+Math.floor(t/4)+30*(n-1)+r-1}function xl(e){return Math.floor(De(e,4)/3)}const Sl={am:0};function Cl(e){return De(7*e+1,19)<7}function wl(e){let t=Math.floor((235*e-234)/19),n=29*t+Math.floor((12084+13753*t)/25920);return De(3*(n+1),7)<3&&(n+=1),n}function Tl(e){return wl(e)+(e=>{let t=wl(e-1),n=wl(e);return wl(e+1)-n===356?2:n-t===382?1:0})(e)}function El(e){return Tl(e+1)-Tl(e)}function Dl(e,t){let n=t>=6&&!Cl(e)?t+1:t;if(n===4||n===7||n===9||n===11||n===13)return 29;let r=(e=>{let t=El(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?Cl(e)?30:0:30}const Ol={shaka:0},kl=[1392,1390,1391,1392,1391,1392,1389,1392,1392,1390,1391,1390];function Al(e,t,n){return dl({l:{bh:-1,ah:0},J:e,L:t,p(e,t){return n&&Pl(e)?rl(n,e,t):((e,t)=>29+t%2+(t===12&&Nl(e)?1:0))(e,t)},j(e){return n&&Pl(e)?nl(n,e):Nl(e)?355:354},k(){return 12},u(e){return this.j(e)>354},v(e,t,r){let i=n&&!t&&r===30&&kl[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 jl(e,t,n,r){return r+Math.ceil(29.5*(n-1))+354*(t-1)+Math.floor((3+11*t)/30)+e-1}function Ml(e,t){let n=Math.floor((30*(t-e)+10646)/10631),r=Math.min(12,Math.ceil((t-(29+jl(e,n,1,1)))/29.5)+1);return{year:n,month:r,day:t-jl(e,n,r,1)+1}}function Nl(e){return De(14+11*e,30)<11}function Pl(e){return e>=1300&&e<=1600}function Fl(e,t){let n=t-1948440;if(n<460322||n>=566987)return Ml(1948440,t);let{year:r,month:i,day:a}=e.he(Yt(t-ul));return{year:r,month:i,day:a}}function Il(e,t,n,r){return Pl(t)?Qc(e,t,n,r)/He+ul:jl(1948440,t,n,r)}const Ll=Object.assign({},Me,{meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018});function Rl(e){let t=Gt(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-Ll[n]}:un(e)}const zl={ap:0},Bl=[0,31,62,93,124,155,186,216,246,276,306,336];function Vl(e){return De(25*e+11,33)<8}const Hl={broc:-1,roc:0},Ul=[`buddhist`,()=>qc({ve:543,l:pl,h(e,t){return{era:`be`,eraYear:t}}})],Wl=[`chinese`,hl],Gl=[`coptic`,()=>yl(1824665,gl)],Kl=[`dangi`,hl],ql=new Map([Ul,Wl,Gl,Kl,[`ethiopic`,()=>yl(1723856,_l,0,1)],[`ethioaa`,()=>yl(1723856,vl,5500)],[`hebrew`,()=>dl({l:Sl,m:-6,J(e){let t=e-347997,n=Math.floor((25920*t/765433*19+234)/235)+1,r=Tl(n),i=Math.floor(t-r);for(;i<1;)n--,r=Tl(n),i=Math.floor(t-r);let a=1,o=0;for(;o<i;)o+=Dl(n,a),a++;return a--,o-=Dl(n,a),{year:n,month:a,day:i-o}},L(e,t,n){let r=Tl(e);for(let n=1;n<t;n++)r+=Dl(e,n);return r+n+347997},p:Dl,j:El,k(e){return Cl(e)?13:12},u:Cl,q(e){return Cl(e)?6:void 0},O(e,t){return Cl(e)&&t===6?[5,1]:[t-(Cl(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 dl({l:Ol,J(e){let t=Yt(e-ul),n=t.year-78,r=e-(Kt(t.year,1,1)+ul),i;if(r<80?(n--,i=nn(t.year-1)?31:30,r+=i+155+90+10):(i=nn(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 nn(r)?(i=31,a=Kt(r,3,21)+ul):(i=30,a=Kt(r,3,22)+ul),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&&nn(e+78)||t>=2&&t<=6?31:30},j(e){return nn(e+78)?366:365},k(){return 12},u(e){return this.j(e)>365},h({year:e}){return{era:`shaka`,eraYear:e}}})}],[`japanese`,()=>qc({l:Ll,le:1,h:Rl})],[`islamic-civil`,()=>Al(C(Ml,1948440),C(jl,1948440))],[`islamic-tbla`,()=>Al(C(Ml,1948439),C(jl,1948439))],[`islamic-umalqura`,e=>{let t=Yc(e);return Al(C(Fl,t),C(Il,t),t)}],[`persian`,()=>dl({l:zl,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-Bl[i]+1}},L(e,t,n){return 1948319+365*(e-1)+Math.floor((8*e+21)/33)+Bl[t-1]+n},p(e,t){return t<=6?31:t<=11||Vl(e)?30:29},j(e){return Vl(e)?366:365},k(){return 12},u:Vl,h({year:e}){return{era:`ap`,eraYear:e}}})],[`roc`,()=>qc({ve:-1911,l:Hl,h(e,t){return t<1?{era:`broc`,eraYear:1-t}:{era:`roc`,eraYear:t}}})]]),Jl={islamic:1,"islamic-rgsa":1},Yl={"ethiopic-amete-alem":`ethioaa`,islamicc:`islamic-civil`},Xl=se((e,t)=>{let n=t(e);return n.id=e,n});function Zl(e){let t=Ql(e);return t||b(ee(e)),Xl(...t)}function Ql(e){Jl[e]&&b(ee(e));let t=Yl[e]||e,n=ql.get(t);return n&&[t,n]}function $l(e){let t=M(e).toLowerCase();return t===`iso8601`?void 0:t===`gregory`?0:Zl(t)}function eu(e=`iso8601`){return $l(e)}const tu=new WeakMap,nu=Ic(Nc,class{constructor(e,t,n=void 0){let r=kr(Vn(e)),i=Po(ko(t)),a=eu(n);ou(this,Mr(r,i,a))}static from(e,t=void 0){return V(au(e,t))}static compare(e,t){return pa(au(e),au(t))}get calendarId(){return Pe(H(this).calendar)}get timeZoneId(){return H(this).timeZone.id}get epochMilliseconds(){return Fr(H(this))}get epochNanoseconds(){return Ir(H(this))}get offset(){return bo(L(H(this)).offsetNanoseconds)}get offsetNanoseconds(){return L(H(this)).offsetNanoseconds}get hoursInDay(){return Wr(H(this))}with(e,t=void 0){return V(Ps(H(this),ju(e),t))}withCalendar(e){return V({...H(this),calendar:ed(e)})}withTimeZone(e){return V({...H(this),timeZone:Po(su(e))})}withPlainTime(e=void 0){return V(wc(H(this),Ru(e)))}add(e,t=void 0){return V(mi(H(this),K(e),t))}subtract(e,t=void 0){return V(mi(H(this),R(K(e)),t))}until(e,t=void 0){let n=H(this),r=au(e);return G(I(Di(0,Ci(n.calendar,r.calendar),n,r,t)))}since(e,t=void 0){let n=H(this),r=au(e);return G(I(Di(1,Ci(n.calendar,r.calendar),n,r,t)))}round(e){let t=H(this),[n,r,i]=yr(e);return V(Ur(t,n,r,i))}startOfDay(){return V(Gr(H(this)))}equals(e){return ya(H(this),au(e))}toInstant(){return uu(Us(H(this)))}toPlainDateTime(){return Hu(Ws(H(this)))}toPlainDate(){return Ju(Gs(H(this)))}toPlainTime(){return Pu(Ks(H(this)))}toLocaleString(e=void 0,t={}){let n=H(this),r=new Ja(e,rc(vc(t),Ti(n)));return ic(r,n),r.format(Fr(n))}toString(e=void 0){return ro(H(this),e)}toJSON(){return ro(H(this))}getTimeZoneTransition(e){let t=H(this),n=si(t,e);return n?V({...t,epochNanoseconds:n}):null}valueOf(){return Bc()}},ru,Hc,Gc,nt);function V(e){return ou(Object.create(nu.prototype),e)}function H(e){return iu(e)||zc()}function ru(e){let t=H(e);return{...L(t),calendar:t.calendar}}function iu(e){return tu.get(e)}function au(e,t){if(y(e)){let n=iu(e);return n?(br(t),n):Uo(su,Qu(e),e,t)}return $o(e,$l,t)}function ou(e,t){return tu.set(e,t),Rc(e),e}function su(e){if(y(e)){let t=iu(e);return t||x(te(e)),t.timeZone.id}return(e=>Ao(cs(M(e))))(e)}const cu=new WeakMap,lu=Ic(Pc,class{constructor(e){let t=kr(Vn(e));hu(this,jr(t))}static from(e){return uu(pu(e))}static fromEpochMilliseconds(e){return uu(ec(e))}static fromEpochNanoseconds(e){return uu(tc(e))}static compare(e,t){return fa(pu(e),pu(t))}get epochMilliseconds(){return Fr(du(this))}get epochNanoseconds(){return Ir(du(this))}add(e){return uu(jr(pi(du(this).epochNanoseconds,K(e))))}subtract(e){return uu(jr(pi(du(this).epochNanoseconds,R(K(e)))))}until(e,t=void 0){return G(Ei(0,du(this),pu(e),t))}since(e,t=void 0){return G(Ei(1,du(this),pu(e),t))}round(e){let t=du(this),[n,r,i]=yr(e,5,1);return uu(jr(ei(t.epochNanoseconds,Xr(n,r),i)))}equals(e){return va(du(this),pu(e))}toZonedDateTimeISO(e){return V(Hs(du(this),Po(su(e))))}toLocaleString(e=void 0,t={}){let n=du(this);return new Ja(e,_c(t)).format(Fr(n))}toString(e=void 0){return no(su,du(this),e)}toJSON(){return no(su,du(this))}valueOf(){return Bc()}});function uu(e){return hu(Object.create(lu.prototype),e)}function du(e){return fu(e)||zc()}function fu(e){return cu.get(e)}function pu(e){if(y(e)){let t=fu(e);if(t)return t;let n=iu(e);if(n)return jr(n.epochNanoseconds)}return Zo(e)}const{toTemporalInstant:mu}={toTemporalInstant(){let e=Date.prototype.valueOf.call(this);return uu(jr(BigInt(Rn(e))*Ze))}};function hu(e,t){return cu.set(e,t),Rc(e),e}const gu=new WeakMap,_u=Ic(kc,class{constructor(e,t,n=void 0,r){let i=s(e),a=s(t),o=eu(n),c=Er(fn({year:s(r??1972),month:i,day:a}));Su(this,F(c,o))}static from(e,t=void 0){return vu(xu(e,t))}get calendarId(){return Pe(yu(this).calendar)}with(e,t=void 0){return vu(Rs(yu(this),ju(e),t))}equals(e){return Ca(yu(this),xu(e))}toPlainDate(e){return Ju(Xs(yu(this).calendar,this,e))}toLocaleString(e=void 0,t={}){let n=yu(this),r=new Ja(e,nc(Cc(t)));return ic(r,n,1),r.format(Wt(n))}toString(e=void 0){return so(yu(this),e)}toJSON(){return so(yu(this))}valueOf(){return Bc()}},yu,Uc);function vu(e){return Su(Object.create(_u.prototype),e)}function yu(e){return bu(e)||zc()}function bu(e){return gu.get(e)}function xu(e,t){if(y(e)){let n=bu(e);if(n)return P(t),n;let r=$u(e);return qo(r===void 0?void 0:r,r===void 0,e,t)}let n=is(e,$l);return P(t),n}function Su(e,t){return gu.set(e,t),Rc(e),e}const Cu=new WeakMap,wu=Ic(Oc,class{constructor(e,t,n=void 0,r){let i=s(e),a=s(t),o=eu(n),c=Tr(fn({year:i,month:a,day:s(r??1)}));ku(this,F(c,o))}static from(e,t=void 0){return Tu(Ou(e,t))}static compare(e,t){return ga(Ou(e),Ou(t))}get calendarId(){return Pe(Eu(this).calendar)}with(e,t=void 0){return Tu(Ls(Eu(this),ju(e),t))}add(e,t=void 0){let n=Eu(this);return Tu(F(fi(0,n.calendar,n,K(e),t),n.calendar))}subtract(e,t=void 0){let n=Eu(this);return Tu(F(fi(1,n.calendar,n,K(e),t),n.calendar))}until(e,t=void 0){let n=Eu(this),r=Ou(e);return G(Ai(0,Ci(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=Eu(this),r=Ou(e);return G(Ai(1,Ci(n.calendar,r.calendar),n,r,t))}equals(e){return Sa(Eu(this),Ou(e))}toPlainDate(e){return Ju(Ys(Eu(this).calendar,this,e))}toLocaleString(e=void 0,t={}){let n=Eu(this),r=new Ja(e,nc(Sc(t)));return ic(r,n,1),r.format(Wt(n))}toString(e=void 0){return oo(Eu(this),e)}toJSON(){return oo(Eu(this))}valueOf(){return Bc()}},Eu,Vc,Wc);function Tu(e){return ku(Object.create(wu.prototype),e)}function Eu(e){return Du(e)||zc()}function Du(e){return Cu.get(e)}function Ou(e,t){if(y(e)){let n=Du(e);return n?(P(t),n):Ko(Qu(e),e,t)}let n=ns(e,$l);return P(t),n}function ku(e,t){return Cu.set(e,t),Rc(e),e}function Au(e){if(!y(e))return;let t=fu(e);return t?[Pc,t]:(t=iu(e),t?[Nc,t]:(t=Uu(e),t?[jc,t]:(t=Yu(e),t?[Ac,t]:(t=Iu(e),t?[Mc,t]:(t=Du(e),t?[Oc,t]:(t=bu(e),t?[kc,t]:(t=id(e),t?[Fc,t]:void 0)))))))}function ju(e){return(Au(e)||e.calendar!==void 0||e.timeZone!==void 0)&&x(`Invalid bag`),e}const Mu=new WeakMap,Nu=Ic(Mc,class{constructor(e=0,t=0,n=0,r=0,i=0,a=0){zu(this,At(de(s,{hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a})))}static from(e,t=void 0){return Pu(Lu(e,t))}static compare(e,t){return _a(Lu(e),Lu(t))}with(e,t=void 0){return Pu(zs(Fu(this),ju(e),t))}add(e){return Pu(vi(Fu(this),K(e))[0])}subtract(e){return Pu(vi(Fu(this),R(K(e)))[0])}until(e,t=void 0){return G(Mi(0,Fu(this),Lu(e),t))}since(e,t=void 0){return G(Mi(1,Fu(this),Lu(e),t))}round(e){let t=Fu(this),[n,r,i]=yr(e,5);return Pu(qr(t,Yr(n,r),i)[0])}equals(e){return wa(Fu(this),Lu(e))}toLocaleString(e=void 0,t={}){let n=Fu(this);return new Ja(e,nc(xc(t))).format(Pt(n))}toString(e=void 0){return lo(Fu(this),e)}toJSON(){return lo(Fu(this))}valueOf(){return Bc()}},Fu,nt);function Pu(e){return zu(Object.create(Nu.prototype),e)}function Fu(e){return Iu(e)||zc()}function Iu(e){return Mu.get(e)}function Lu(e,t){if(y(e)){let n=Iu(e);if(n)return P(t),n;let r=Uu(e);if(r)return P(t),Pr(r);let i=iu(e);return i?(P(t),Ks(i)):Jo(e,t)}let n=as(e);return P(t),n}function Ru(e){return e===void 0?void 0:Lu(e)}function zu(e,t){return Mu.set(e,t),Rc(e),e}const Bu=new WeakMap,Vu=Ic(jc,class{constructor(e,t,n,r=0,i=0,a=0,o=0,c=0,l=0,u=void 0){let d=Dr(dn(de(s,{year:e,month:t,day:n,hour:r,minute:i,second:a,millisecond:o,microsecond:c,nanosecond:l}))),f=eu(u);Gu(this,Nr(d,f))}static from(e,t=void 0){return Hu(Wu(e,t))}static compare(e,t){return ha(Wu(e),Wu(t))}get calendarId(){return Pe(U(this).calendar)}with(e,t=void 0){return Hu(Fs(U(this),ju(e),t))}withCalendar(e){return Hu(Nr(U(this),ed(e)))}withPlainTime(e=void 0){let t=U(this);return Hu(Ba(t,Ru(e),t.calendar))}add(e,t=void 0){let n=U(this);return Hu(Nr(hi(n.calendar,n,K(e),t),n.calendar))}subtract(e,t=void 0){let n=U(this);return Hu(Nr(hi(n.calendar,n,R(K(e)),t),n.calendar))}until(e,t=void 0){let n=U(this),r=Wu(e);return G(Oi(0,Ci(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=U(this),r=Wu(e);return G(Oi(1,Ci(n.calendar,r.calendar),n,r,t))}round(e){let t=U(this),[n,r,i]=yr(e);return Hu(Nr(Kr(t,Yr(n,r),i),t.calendar))}equals(e){return ba(U(this),Wu(e))}toZonedDateTime(e,t=void 0){return V(qs(U(this),Po(su(e)),t))}toPlainDate(){let e=U(this);return Ju(F(e,e.calendar))}toPlainTime(){return Pu(Pr(U(this)))}toLocaleString(e=void 0,t={}){let n=U(this),r=new Ja(e,nc(yc(t)));return ic(r,n),r.format(Ht(n))}toString(e=void 0){return io(U(this),e)}toJSON(){return io(U(this))}valueOf(){return Bc()}},U,Hc,Gc,nt);function Hu(e){return Gu(Object.create(Vu.prototype),e)}function U(e){return Uu(e)||zc()}function Uu(e){return Bu.get(e)}function Wu(e,t){if(y(e)){let n=Uu(e);if(n)return P(t),n;let r=Yu(e);if(r)return P(t),Nr(N(r,kt),r.calendar);let i=iu(e);return i?(P(t),Ws(i)):Wo(Qu(e),e,t)}let n=es(e,$l);return P(t),n}function Gu(e,t){return Bu.set(e,t),Rc(e),e}const Ku=new WeakMap,qu=Ic(Ac,class{constructor(e,t,n,r=void 0){let i=Er(fn(de(s,{year:e,month:t,day:n}))),a=eu(r);Zu(this,F(i,a))}static from(e,t=void 0){return Ju(Xu(e,t))}static compare(e,t){return ga(Xu(e),Xu(t))}get calendarId(){return Pe(W(this).calendar)}with(e,t=void 0){return Ju(Is(W(this),ju(e),t))}withCalendar(e){return Ju(F(W(this),ed(e)))}add(e,t=void 0){let n=W(this);return Ju(F(gi(n.calendar,n,K(e),t),n.calendar))}subtract(e,t=void 0){let n=W(this);return Ju(F(gi(n.calendar,n,R(K(e)),t),n.calendar))}until(e,t=void 0){let n=W(this),r=Xu(e);return G(ki(0,Ci(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=W(this),r=Xu(e);return G(ki(1,Ci(n.calendar,r.calendar),n,r,t))}equals(e){return xa(W(this),Xu(e))}toZonedDateTime(e){let t=y(e)?{timeZone:e.timeZone,plainTime:e.plainTime}:{timeZone:e};return V(Js(su,Lu,W(this),t))}toPlainDateTime(e=void 0){let t=W(this);return Hu(Ba(t,Ru(e),t.calendar))}toPlainYearMonth(){return Tu(Qs(W(this).calendar,this))}toPlainMonthDay(){return vu(Zs(W(this).calendar,this))}toLocaleString(e=void 0,t={}){let n=W(this),r=new Ja(e,nc(bc(t)));return ic(r,n),r.format(Wt(n))}toString(e=void 0){return ao(W(this),e)}toJSON(){return ao(W(this))}valueOf(){return Bc()}},W,Hc,Gc);function Ju(e){return Zu(Object.create(qu.prototype),e)}function W(e){return Yu(e)||zc()}function Yu(e){return Ku.get(e)}function Xu(e,t){if(y(e)){let n=Yu(e);if(n)return P(t),n;let r=Uu(e);if(r)return P(t),F(r,r.calendar);let i=iu(e);return i?(P(t),Gs(i)):Go(Qu(e),e,t)}let n=ts(e,$l);return P(t),n}function Zu(e,t){return Ku.set(e,t),Rc(e),e}function Qu(e){let t=$u(e);return t===void 0?void 0:t}function $u(e){let{calendar:t}=e;if(t!==void 0)return ed(t)}function ed(e){if(y(e)){let t=Yu(e)||Uu(e)||iu(e)||bu(e)||Du(e);return t||x(ee(e)),t.calendar}return(e=>$l(ss(M(e))))(e)}const td=new WeakMap,nd=Ic(Fc,class{constructor(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0){let u=ra(de(Hn,{years:e,months:t,weeks:n,days:r,hours:i,minutes:a,seconds:o,milliseconds:s,microseconds:c,nanoseconds:l}));od(this,I(u))}static from(e){return G(K(e))}static compare(e,t,n=void 0){return ma(ad,K(e),K(t),n)}get sign(){return rd(this).sign}get blank(){return!rd(this).sign}with(e){return G(Bs(rd(this),e))}negated(){return G(ta(rd(this)))}abs(){return G(ea(rd(this)))}add(e,t=void 0){return G(Zi(ad,0,rd(this),K(e),t))}subtract(e,t=void 0){return G(Zi(ad,1,rd(this),K(e),t))}round(e){return G($i(ad,rd(this),e))}total(e){return Lr(ad,rd(this),e)}toLocaleString(e=void 0,t){let n=rd(this);return Intl.DurationFormat?new Intl.DurationFormat(e,t).format(n):uo(n,t)}toString(e=void 0){return uo(rd(this),e)}toJSON(){return uo(rd(this))}valueOf(){return Bc()}},rd,On);function G(e){return od(Object.create(nd.prototype),e)}function rd(e){return id(e)||zc()}function id(e){return td.get(e)}function K(e){return y(e)?id(e)||Yo(e):os(e)}function ad(e){if(e!==void 0){if(y(e)){let t=iu(e);if(t)return t;let n=Yu(e);if(n)return n;let r=Uu(e);return r?F(r,r.calendar):Ho(su,Qu(e),e)}return Qo(e,$l)}}function od(e,t){return td.set(e,t),Rc(e),e}const sd=Object.defineProperties({},{...ue(`Temporal.Now`),...le({timeZoneId(){return Dc()},instant(){return uu(jr(Ec()))},zonedDateTimeISO(e=Dc()){let t=Po(su(e));return V(Mr(Ec(),t))},plainDateTimeISO(e=Dc()){return Hu(Nr(Tc(Po(su(e)))))},plainDateISO(e=Dc()){return Ju(F(Tc(Po(su(e)))))},plainTimeISO(e=Dc()){return Pu(Pr(Tc(Po(su(e)))))}})}),cd=Object.defineProperties({},{...ue(`Temporal`),...le({PlainYearMonth:wu,PlainMonthDay:_u,PlainDate:qu,PlainTime:Nu,PlainDateTime:Vu,ZonedDateTime:nu,Instant:lu,Duration:nd,Now:sd})}),q=globalThis.Temporal??cd,ld=q!==cd,ud=1e3,dd=864e5;180*dd;const fd=400*dd,pd=30*36e5,md=864e13;function hd(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))*ud:null}var gd=class{constructor(e){this.tzid=e,this.transitions=[],this.offsets=[],this.coverStart=0,this.coverEnd=0,this.covered=!1,this.fixedOffsetMs=hd(e)}zonedAt(e){return new q.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-fd:this.coverStart,r=!this.covered||t>this.coverEnd?t+fd:this.coverEnd;if(n=Math.max(n,Math.min(e,-md)),r=Math.min(r,Math.max(t,md)),n=Math.floor(n/ud)*ud,r=Math.ceil(r/ud)*ud,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(ld)break;let a=Math.ceil((Math.max(n.epochMilliseconds,Date.now())+15552e6)/ud)*ud;if(a>=t||a>md)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>ud;){let n=e+Math.floor((t-e)/2/ud)*ud;n<=e&&(n=e+ud),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-pd,e+pd);let t=this.offsetMsAt(e-pd),n=e-t;if(this.offsetMsAt(n)===t)return{epochMs:n,pushed:!1};let r=this.offsetMsAt(e+pd),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=e-((n+i)%dd+dd)%dd;if(o>=0?o<a:o+dd<a)return!0}return!1}};const _d=new Map;function vd(e){let t=_d.get(e);return t||(t=new gd(e),_d.set(e,t)),t}const yd=[`YEARLY`,`MONTHLY`,`WEEKLY`,`DAILY`,`HOURLY`,`MINUTELY`,`SECONDLY`],bd=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],J={MO:1,TU:2,WE:3,TH:4,FR:5,SA:6,SU:7},xd=new Set(yd),Sd=new Set(bd),Cd=RegExp(`^([+-]?\\d{1,2})?(${bd.join(`|`)})$`),wd=RegExp(`(${bd.join(`|`)})$`),Td=1e3,Ed=60*Td,Dd=60*Ed,Y=24*Dd,Od=7*Y,kd=[31,28,31,30,31,30,31,31,30,31,30,31],Ad=[0,3,2,5,0,3,5,1,4,6,2,4],X=BigInt(1e6),jd=BigInt(1e9),Md=BigInt(60)*jd,Nd=BigInt(60)*Md,Pd=BigInt(24)*Nd,Fd=BigInt(7)*Pd,Id=864e13,Ld=1e3;function Rd(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 zd(e){for(let t=1;t<e.length;t++)if(!(e[t]>e[t-1]))return!1;return!0}function Bd(e){let t=0;for(let n of e??[])t|=1<<n-1;return t}function Vd(e,t){return e===0||(e&1<<t-1)!=0}function Hd(e,t){let n=e/t;return e%t<0n?n-1n:n}function Ud(e,t){return-Hd(-e,t)}function Wd(e,t){return Number(t?Hd(e,X)+1n:Ud(e,X))}function Gd(e,t){return Number(t?Ud(e,X)-1n:Hd(e,X))}function Z(e){return Number.isSafeInteger(e)&&e>=-Id&&e<=Id}function Kd(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 qd(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 Jd(e){return((e+3)%7+7)%7+1}function Q(e,t){return(e-1+t%7+7)%7+1}function $(e){let t=e.toUpperCase().match(wd)?.[1];return!t||!Sd.has(t)?null:t}function Yd(e){let t=e.toUpperCase().match(Cd);if(!t)return null;let n=t[1]?parseInt(t[1],10):0,r=t[2];return!r||!Sd.has(r)?null:{ord:n,weekday:r}}function Xd(e){return typeof e==`object`&&!!e&&typeof e.timeZoneId==`string`&&typeof e.toString==`function`}function Zd(e){let t=e.epochNanoseconds;return typeof t==`bigint`?t:void 0}function Qd(e,t){if(!Xd(e))throw Error(`${t} must be a ZonedDateTime`);if(e instanceof q.ZonedDateTime)return e;try{let t=Zd(e);if(t!==void 0){let n=e.calendarId;return new q.ZonedDateTime(t,e.timeZoneId,typeof n==`string`?n:`iso8601`)}return q.ZonedDateTime.from(e.toString())}catch{throw Error(`${t} must be a ZonedDateTime`)}}function $d(e,t){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)||e.toISOString(),BigInt(t)*X}if(!Xd(e))throw Error(`${t} must be a ZonedDateTime`);return Zd(e)??Qd(e,t).epochNanoseconds}function ef(e,t){if(e?.length)return e.map(e=>Qd(e,t))}function tf(e){return typeof e.rruleString==`string`}function nf(e,t){let n=[...e??[],...ef(t,`Manual date`)??[]];return n.length>0?n:void 0}function rf(e){return e.replace(/\r?\n[ \t]/g,``)}function af(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 q.PlainDate.from(i).toZonedDateTime({timeZone:t});if(e.endsWith(`Z`)){let n=`${i}T${e.slice(9,15)}Z`;return q.Instant.from(n).toZonedDateTimeISO(t||`UTC`)}else{let n=`${i}T${e.slice(9)}`;return q.PlainDateTime.from(n).toZonedDateTime(t)}}function of(e,t,n){let r=[];for(let i of e){let e=sf(i,t);if(!e)continue;let a=e.tzid||n,o=e.value.split(`,`);r.push(...o.map(t=>af(t,a,e.valueType)))}return r}function sf(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 cf(e,t,n){let r=e.trim();if(n&&!/^[+-]?\d+$/.test(r))throw Error(`Invalid ${t} value: ${e}`);return parseInt(r,10)}function lf(e,t=!1,n=!1,r=`number`){let i=e.split(`,`).map(e=>cf(e,r,n));return t?i.sort((e,t)=>e-t):i}function uf(e,t=!1){return e.split(`,`).map(e=>{let n=e.trim();if(/^\d+L$/i.test(n))return n.toUpperCase();let r=cf(n,`BYMONTH`,t);return/^M\d{2}L?$/i.test(n)?n:r})}function df(e,t,n,r=!1){let i=rf(e).trim(),a,o=t,s=`DATE-TIME`,c=!1,l=!1,u,d=[],f=[];if(/^DTSTART/im.test(i)){let e=i.split(/\s+/),n=e.find(e=>e.match(/^DTSTART/i)),r=e.find(e=>e.match(/^RRULE:/i)),p=e.filter(e=>e.match(/^EXDATE/i)),m=e.filter(e=>e.match(/^RDATE/i)),h=sf(n,`DTSTART`);if(!h)throw Error(`Invalid DTSTART in ICS snippet`);let{valueType:g,tzid:_,value:v}=h;s=(g||(v?.includes(`T`)?`DATE-TIME`:`DATE`)).toUpperCase()===`DATE`?`DATE`:`DATE-TIME`,c=!!_,l=!!v?.endsWith(`Z`),a=af(v,_??t??o??`UTC`,s),o=_??a.timeZoneId??t??o??`UTC`,u=r,d=of(p,`EXDATE`,o??`UTC`),f=of(m,`RDATE`,o??`UTC`)}else a=n?Qd(n,`dtstart`):void 0,u=i,a&&(o=a.timeZoneId,s=`DATE-TIME`,c=!0,l=a.timeZoneId===`UTC`);let p=u?u.replace(/^RRULE:/i,``).split(`;`):[],m={dtstart:a,tzid:o,exDate:d.length>0?d:void 0,rDate:f.length>0?f:void 0},h;for(let e of p){let[t,n]=e.split(`=`);if(t)switch(t.toUpperCase()){case`RSCALE`:n&&(m.rscale=n.toUpperCase(),h&&!m.skip&&(m.skip=h,h=void 0));break;case`SKIP`:{let e=(n||``).toUpperCase();if(![`OMIT`,`BACKWARD`,`FORWARD`].includes(e))throw Error(`Invalid SKIP value: ${n}`);m.rscale?m.skip=e:h=e;break}case`FREQ`:m.freq=n.toUpperCase();break;case`INTERVAL`:m.interval=cf(n,`INTERVAL`,r);break;case`COUNT`:if(!r&&/^\+?infinity$/i.test(n.trim()))break;m.count=cf(n,`COUNT`,r);break;case`UNTIL`:{let e=n.includes(`T`);if(s===`DATE`){if(e)throw Error(`UNTIL rule part MUST have the same value type as DTSTART`);m.until=af(n,o||`UTC`,`DATE`);break}if(!e){if(r)throw Error(`UNTIL rule part MUST have the same value type as DTSTART`);let e=af(n,o||`UTC`,`DATE`).with({hour:23,minute:59,second:59,millisecond:0,microsecond:0,nanosecond:0});m.until=c||l?e.withTimeZone(`UTC`):e;break}if((c||l)&&!n.endsWith(`Z`))throw Error(`UNTIL rule part MUST always be specified as a date with UTC time`);m.until=af(n,o||`UTC`,`DATE-TIME`);break}case`BYHOUR`:m.byHour=lf(n,!0,r,`BYHOUR`);break;case`BYMINUTE`:m.byMinute=lf(n,!0,r,`BYMINUTE`);break;case`BYSECOND`:m.bySecond=lf(n,!0,r,`BYSECOND`);break;case`BYDAY`:m.byDay=n.split(`,`).map(e=>e.toUpperCase());break;case`BYMONTH`:m.byMonth=uf(n,r);break;case`BYMONTHDAY`:m.byMonthDay=lf(n,!1,r,`BYMONTHDAY`);break;case`BYYEARDAY`:m.byYearDay=lf(n,!1,r,`BYYEARDAY`);break;case`BYWEEKNO`:m.byWeekNo=lf(n,!1,r,`BYWEEKNO`);break;case`BYSETPOS`:m.bySetPos=lf(n,!1,r,`BYSETPOS`);break;case`WKST`:m.wkst=n?.toUpperCase();break}}if(h&&!m.rscale)throw Error(`SKIP MUST NOT be present unless RSCALE is present`);return h&&m.rscale&&!m.skip&&(m.skip=h),m}var ff=class e{static{this.rscaleCalendarSupport={}}static normalizeToPolyfill(e){return Qd(e,`Date`)}toPublicDate(e){if(!e)return null;let t=this.outputTemporal?.ZonedDateTime;if(!t||t===q.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===q.ZonedDateTime?e:e.map(e=>this.toPublicDate(e))}constructor(t){this.outputTemporal=t.temporal;let n;if(tf(t)){let r=df(t.rruleString,t.tzid,t.dtstart,t.strict??!1);if(!r.dtstart)throw Error(`dtstart is required - provide it either in rruleString or as a separate parameter`);let i=e.normalizeToPolyfill(r.dtstart);this.tzid=r.tzid??t.tzid??`UTC`,this.originalDtstart=i,n={...r,dtstart:i,rDate:nf(r.rDate,t.rDate),exDate:nf(r.exDate,t.exDate),count:t.count??r.count,until:t.until?e.normalizeToPolyfill(t.until):r.until,strict:t.strict,maxIterations:t.maxIterations,maxCandidateEvaluations:t.maxCandidateEvaluations,includeDtstart:t.includeDtstart,cache:t.cache,temporal:t.temporal,tzid:this.tzid}}else{let e=Qd(t.dtstart,`Manual dtstart`);n={...t,dtstart:e,until:t.until?Qd(t.until,`Manual until`):void 0,rDate:ef(t.rDate,`Manual rDate`),exDate:ef(t.exDate,`Manual exDate`)},n.tzid=n.tzid||e.timeZoneId,this.tzid=n.tzid,this.originalDtstart=e}if(!n.freq)throw Error(`RRULE must include FREQ`);if(n.interval=n.interval??1,!(n.interval>0))throw Error(`Cannot create RRule: interval must be greater than 0`);if(!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.timeSlotOffsetsMs=this.buildTimeSlotOffsetsMs(),this.hasUniqueTimeSlotOffsets=this.timeSlotOffsetsMs===void 0||new Set(this.timeSlotOffsetsMs).size===this.timeSlotOffsetsMs.length,this.numericByMonths=this.opts.byMonth?.filter(e=>typeof e==`number`)}buildParsedByDayTokens(e){if(!e?.length)return;let t=e.map(e=>{let t=Yd(e);return t?{ord:t.ord,weekday:t.weekday,isoDay:J[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=Yd(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(!xd.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(!Sd.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)=>q.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)=>q.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&&q.ZonedDateTime.compare(e,r)<0||i&&q.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&&q.ZonedDateTime.compare(s,r)<0||i&&q.ZonedDateTime.compare(s,i)>0||e.push(s))}e.sort((e,t)=>q.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&&q.PlainDate.compare(i,u)<0||d&&q.PlainDate.compare(i,d)>0)continue;let s=u&&q.PlainDate.compare(i,u)===0,f=d&&q.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)=>q.ZonedDateTime.compare(e,t));for(let e of l)if(!(n&&q.ZonedDateTime.compare(e,n)<0)&&!(r&&q.ZonedDateTime.compare(e,r)>0)&&!t(e))return!1;return!0}visitUtcPeriodCandidates(e,t,n,r,i){let a=this.timeSlotOffsetsMs;if(this.tzid!==`UTC`||this.originalDtstart.timeZoneId!==`UTC`||![`iso8601`,`gregory`].includes(e.calendarId)||this.opts.rscale!==void 0||this.opts.byYearDay||this.opts.byWeekNo||this.opts.byMonth?.some(e=>typeof e!=`number`)||!a?.length||!this.hasUniqueTimeSlotOffsets||!Number.isSafeInteger(this.opts.interval)||e.year<=-271821||e.year>=275760||!(this.opts.byDay||this.opts.byMonthDay))return null;let o;if(this.opts.freq===`MONTHLY`){let t=Kd(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)]*Y+a[e%a.length],l=e=>{let t=0,n=s;for(;t<n;){let r=t+Math.floor((n-t)/2);c(r)<e?t=r+1:n=r}return t},u=n?l(Number(Ud(n.epochNanoseconds,X))):0,d=r?l(Number(Hd(r.epochNanoseconds,X))+1):s,f=n=>t(new q.ZonedDateTime(BigInt(c(n))*X,`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=J,n=this.opts.byDay.map(e=>$(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)=>q.ZonedDateTime.compare(e,t))[0];if(t&&q.ZonedDateTime.compare(t,this.originalDtstart)>=0){e=t;break}}}else if(q.ZonedDateTime.compare(a,this.originalDtstart)>=0){e=a;break}}n++}}if(this.opts.byDay?.length&&!this.opts.byWeekNo){let t=J;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(q.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=>$(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&&q.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&&q.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&&q.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(q.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`||n||!(r||i)||![`iso8601`,`gregory`].includes(this.originalDtstart.calendarId)||!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?.length?Math.min(...o.map(e=>Math.abs(e))):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){return new e({...this.cloneOptions(),...t,...this.cloneUpdateOptions(t),tzid:t.tzid??this.opts.tzid,dtstart:t.dtstart??this.opts.dtstart})}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 q.ZonedDateTime(e,`UTC`,this.originalDtstart.calendarId)}utcZdtFromEpochMilliseconds(e){return this.utcZdtFromEpochNanoseconds(BigInt(e)*X)}canUseUtcCalendarFastPaths(){return this.tzid===`UTC`&&this.originalDtstart.timeZoneId===this.tzid&&[`iso8601`,`gregory`].includes(this.originalDtstart.calendarId)}canUseUtcEpochMillisecondsPrecision(){return this.canUseEpochMillisecondsPrecisionFlag}buildTimeSlotOffsetsMs(){if(!this.canUseEpochMillisecondsPrecisionFlag)return;let e=this.opts.byHour??[this.originalDtstart.hour],t=this.opts.byMinute??[this.originalDtstart.minute],n=this.opts.bySecond??[this.originalDtstart.second],r=this.originalDtstart.millisecond,i=[];for(let a of e)for(let e of t)for(let t of n)i.push(((a*60+e)*60+t)*Td+r);return i}createNumericQueryPlan(e,t,n,r){let i=n(0),a=n(t-1);if(!i||!a||!Z(i.epochMilliseconds)||!Z(a.epochMilliseconds)||i.epochMilliseconds>a.epochMilliseconds)return null;let o=(e,t,i)=>{if(r)return Math.max(0,Math.min(i,r(e,t)));let a=0,o=i;for(;a<o;){let r=a+Math.floor((o-a)/2),i=n(r);if(!i){o=r;continue}let s=BigInt(i.epochMilliseconds)*X;(t?s>e:s>=e)?o=r:a=r+1}return a},s=this.opts.until?.epochNanoseconds,c=s===void 0?t:o(s,!0,t);return{kind:e,count:c,maximumCount:t,select:e=>!Number.isSafeInteger(e)||e<0||e>=t?null:n(e),lowerBound:(e,t)=>o(e,t,c)}}buildFixedStepNumericQueryPlan(e){let t;switch(this.opts.freq){case`HOURLY`:t=Dd;break;case`MINUTELY`:t=Ed;break;case`SECONDLY`:t=Td;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 Z(t)?{epochMilliseconds:t,periodIndex:e,occurrenceIndex:e}:null},a=BigInt(n)*X,o=BigInt(r)*X,s=BigInt(e);return this.createNumericQueryPlan(`fixed-step`,e,i,(t,n)=>{let r=t-a,i=n?Hd(r,o)+1n:Ud(r,o);return i<=0n?0:i>=s?e:Number(i)})}resolveNumericWallMilliseconds(e){if(!Z(e))return null;if(this.tzid===`UTC`)return e;let t=this.getZoneResolver().epochMsForWall(e);return t.pushed||!Z(t.epochMs)?null:t.epochMs}numericQueryGapHazard(e,t){if(this.tzid===`UTC`)return!1;let n=this.originalDtstart.epochMilliseconds;return 200*366*Y,t-n>632448e7?!0:this.getZoneResolver().timeOfDayMayHitGap(e,n-Y,t+Y)}buildDailyNumericQueryPlan(e){let t=this.opts.interval,n=this.originalDtstart.epochMilliseconds,r=this.tzid===`UTC`?n:this.wallMsOf(this.originalDtstart),i=Math.floor(r/Y),a=Jd(i),o=Bd(this.simpleByDayIsoDays);if(!(this.opts.byHour||this.opts.byMinute||this.opts.bySecond)){let n=r-i*Y,s=this.simpleByDayIsoDays?.length?this.findFirstMatchingDailyStep(a,t,this.simpleByDayIsoDays):0;if(s===null)return null;let c=7/Rd(t,7),l=[];for(let e=0;e<c;e++)Vd(o,Q(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*Y,d=this.resolveNumericWallMilliseconds(u);return d===null?null:{epochMilliseconds:d,periodIndex:a,occurrenceIndex:e}}),d=u?.select(e-1);return d&&this.numericQueryGapHazard(n,d.epochMilliseconds)?null:u}let s=this.timeSlotOffsetsMs;if(!s?.length||!this.hasUniqueTimeSlotOffsets||!zd(s))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=Q(a,u),p=7/Rd(t,7),m=c;if(Vd(o,f)){let e=this.numericFirstPeriodSkip(c,e=>d*Y+s[e]);if(e===null)return null;m=e}let h=c-m,g=[];for(let e=0;e<p;e++)Vd(o,Q(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*Y+s[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)*Y+s[a%c],ee=this.resolveNumericWallMilliseconds(v);return ee===null?null:{epochMilliseconds:ee,periodIndex:l,occurrenceIndex:e}}),ee=v?.select(e-1);return ee&&s.some(e=>this.numericQueryGapHazard(e,ee.epochMilliseconds))?null:v}buildWeeklyNumericQueryPlan(e){let t=this.timeSlotOffsetsMs;if(!t?.length||!this.hasUniqueTimeSlotOffsets||!zd(t))return null;let n=t.length,r=this.originalDtstart.epochMilliseconds,i=this.tzid===`UTC`?r:this.wallMsOf(this.originalDtstart),a=Math.floor(i/Y),o=Jd(a),s=J[$(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||!zd(c))return null;let l=a-(o-s+7)%7,u=c.length*n,d=(e,r)=>(e+c[Math.floor(r/n)])*Y+t[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&&t.some(e=>this.numericQueryGapHazard(e,h.epochMilliseconds))?null:m}buildMonthlyNumericQueryPlan(e){let t=this.opts.interval;if(!this.timeSlotOffsetsMs?.length||!this.hasUniqueTimeSlotOffsets||this.opts.byMonth?.some(e=>typeof e!=`number`)||this.opts.bySetPos&&new Set(this.opts.bySetPos).size!==this.opts.bySetPos.length)return null;let n=this.originalDtstart.year*12+(this.originalDtstart.month-1);return this.buildCalendarNumericQueryPlan(`monthly`,e,4800/Rd(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=Kd(a,o,1);return Z(c*Y)?s.map(e=>c+e-1):[]})}numericPeriodShape(e){if(!e||!zd(e))return null;let t=e.length*this.timeSlotOffsetsMs.length,n=this.opts.bySetPos;if(!n?.length||t===0)return{days:e,candidates:t,count:t};let r=[];for(let e of n){let n=e>0?e-1:t+e;n>=0&&n<t&&r.push(n)}if(r.length>1){r.sort((e,t)=>e-t);let e=1;for(let t=1;t<r.length;t++)r[t]!==r[e-1]&&(r[e++]=r[t]);r.length=e}return{days:e,candidates:t,count:r.length,selected:r}}numericPeriodWall(e,t){let n=this.timeSlotOffsetsMs,r=e.selected?e.selected[t]:t;return e.days[Math.floor(r/n.length)]*Y+n[r%n.length]}numericFirstPeriodSkip(e,t){let n=this.originalDtstart.epochMilliseconds;if(e===0)return 0;if(this.tzid===`UTC`){if(!Z(t(0))||!Z(t(e-1)))return null;let r=0,i=e;for(;r<i;){let e=r+Math.floor((i-r)/2);t(e)>=n?i=e:r=e+1}return r}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.timeSlotOffsetsMs;if(!zd(a))return null;let 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 _&&a.some(e=>this.numericQueryGapHazard(e,_.epochMilliseconds))?null:g}generateYearlyOccurrenceDaysUtc(e){let t=!!(this.opts.byDay||this.opts.byMonthDay);this.numericByMonths?.length;let n=this.numericByMonths?.length?[...this.numericByMonths].sort((e,t)=>e-t):t?[1,2,3,4,5,6,7,8,9,10,11,12]:[this.originalDtstart.month],r=[];if(this.hasOrdinalByDay&&!this.numericByMonths?.length){let t=this.isGregorianLeapYear(e)?366:365,n=this.gregorianIsoDayOfWeek(e,1,1),i=Q(n,t-1),a=new Set;for(let e of this.parsedByDayTokens??[]){if(e.ord===0)continue;let r=e.ord>0?1+(e.isoDay-n+7)%7+7*(e.ord-1):t-(i-e.isoDay+7)%7+7*(e.ord+1);r>=1&&r<=t&&a.add(r)}for(let t of[...a].sort((e,t)=>e-t)){let n=t,i=1;for(;n>this.daysInGregorianMonth(e,i);)n-=this.daysInGregorianMonth(e,i),i+=1;r.push({month:i,day:n})}}else for(let i of n){let n;n=t?this.generateMonthlyOccurrenceDaysUtc(e,i):this.originalDtstart.day<=this.daysInGregorianMonth(e,i)?[this.originalDtstart.day]:[];for(let e of n)r.push({month:i,day:e})}return r.map(({month:t,day:n})=>Kd(e,t,n))}generateYearlyOccurrenceEpochsUtc(e){let t=this.timeSlotOffsetsMs;if(!t?.length)return[];let n=[];for(let r of this.generateYearlyOccurrenceDaysUtc(e)){let e=r*Y;if(!Z(e))return[];for(let r of t)n.push(e+r)}if(n.sort((e,t)=>e-t),!this.opts.bySetPos?.length)return n;let r=this.applyBySetPosToSortedList(n).sort((e,t)=>e-t);return r.filter((e,t)=>t===0||e!==r[t-1])}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.timeSlotOffsetsMs;if(!n?.length||!this.hasUniqueTimeSlotOffsets||this.opts.byMonth?.some(e=>typeof e!=`number`)||this.opts.byYearDay||this.opts.byWeekNo)return null;let r=!!(this.opts.byDay||this.opts.byMonthDay),i=!!this.opts.byMonth&&!r;if(!this.opts.byMonth&&!r&&n.length!==1||i&&(n.length!==1||this.opts.bySetPos)||this.hasOrdinalByDay&&!this.numericByMonths?.length&&(this.opts.byMonthDay||this.parsedByDayTokens?.some(e=>e.ord===0)))return null;let a=this.originalDtstart.year;return this.buildCalendarNumericQueryPlan(`yearly`,e,400/Rd(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=>Z(e*Y))?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||!this.hasUniqueTimeSlotOffsets?null:this.buildDailyNumericQueryPlan(e);case`WEEKLY`:return n||this.hasOrdinalByDay||!this.hasUniqueTimeSlotOffsets?null:this.buildWeeklyNumericQueryPlan(e);case`MONTHLY`:return this.opts.byYearDay||this.opts.byWeekNo||!(this.opts.byDay||this.opts.byMonthDay)||!this.hasUniqueTimeSlotOffsets?null:this.buildMonthlyNumericQueryPlan(e);case`YEARLY`:return this.buildYearlyNumericQueryPlan(e);default:return null}}getNumericQueryPlan(){if(this.numericQueryPlanCache!==void 0)return this.numericQueryPlanCache;try{this.numericQueryPlanCache=this.buildNumericQueryPlan(),this.numericQueryPlanCache&&this.tzid!==`UTC`&&this.resolveNumericWallMilliseconds(this.wallMsOf(this.originalDtstart))!==this.originalDtstart.epochMilliseconds&&(this.numericQueryPlanCache=null)}catch{this.numericQueryPlanCache=null}return this.numericQueryPlanCache}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),u=this.tzid===`UTC`?this.originalDtstart.epochMilliseconds:this.wallMsOf(this.originalDtstart),d=Math.floor(u/Y),f=this.timeSlotOffsetsMs;switch(t){case`HOURLY`:case`MINUTELY`:case`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`?Dd:t===`MINUTELY`?Ed:Td)*e;return Number.isSafeInteger(r)?{stepMilliseconds:r,candidatesPerPeriod:1,periodOfWall:()=>0,wallsForPeriod:()=>null}:null}case`DAILY`:{if(c||this.hasOrdinalByDay||!f?.length||!this.hasUniqueTimeSlotOffsets)return null;let t=this.simpleByDayIsoDays;if(t?.length&&this.findFirstMatchingDailyStep(Jd(d),e,t)===null)return null;let n=Bd(t);return{candidatesPerPeriod:f.length,periodOfWall:t=>Math.floor((Math.floor(t/Y)-d)/e),wallsForPeriod:t=>{let r=d+t*e;return Number.isSafeInteger(r)?Vd(n,Jd(r))?f.map(e=>r*Y+e):[]:null}}}case`WEEKLY`:{if(c||this.hasOrdinalByDay||!f?.length||!this.hasUniqueTimeSlotOffsets)return null;let t=Jd(d),r=J[$(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=i.flatMap(e=>f.map(t=>e*Y+t)),o=d-(t-r+7)%7,s=7*e;return{candidatesPerPeriod:a.length,periodOfWall:e=>Math.floor((Math.floor(e/Y)-o)/s),wallsForPeriod:e=>{let t=o+e*s;return Number.isSafeInteger(t)?a.map(e=>t*Y+e):null}}}case`MONTHLY`:{if(a||o||!f?.length||!this.hasUniqueTimeSlotOffsets||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 Z(Kd(i.year,i.month,1)*Y)?i:null};return{candidatesPerPeriod:62*f.length,periodOfWall:n=>{let{year:r,month:i}=qd(Math.floor(n/Y));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=Kd(t.year,t.month,1)*Y;return[r,r+this.daysInGregorianMonth(t.year,t.month)*Y]}:void 0}}case`YEARLY`:{if(a||o||!f?.length||!this.hasUniqueTimeSlotOffsets||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((qd(Math.floor(n/Y)).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:[Kd(t,1,1)*Y,Kd(t+1,1,1)*Y]}: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=Q(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.hasUniqueTimeSlotOffsets?this._allUtcDailyExpanded(t):null:this._allUtcDailySimple();case`HOURLY`:return this._allUtcFixedStepSimple(Nd*BigInt(this.opts.interval));case`MINUTELY`:return this._allUtcFixedStepSimple(Md*BigInt(this.opts.interval));case`SECONDLY`:return this._allUtcFixedStepSimple(jd*BigInt(this.opts.interval))}return this.canUseUtcMonthlyFastPath(e)?this._allUtcMonthlyByDayOrMonthDay():this.canUseUtcWeeklyFastPath(e)?this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this.hasUniqueTimeSlotOffsets?this._allUtcWeeklyExpanded(t):null:this._allUtcWeeklySimple():null}_allUtcFixedStepSimple(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=0;if(this.canUseUtcEpochMillisecondsPrecision()){let r=this.originalDtstart.epochMilliseconds,i=Number(e/X),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*Y,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=Q(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=Q(s,t)}return e}let i=BigInt(t)*Pd,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=Q(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=Q(s,t)}return e}_allUtcDailyExpanded(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=this.timeSlotOffsetsMs,r=this.originalDtstart.epochMilliseconds,i=this.firstExpandedEpochMs(e),a=this.opts.until?.epochMilliseconds,o=this.opts.interval,s=this.simpleByDayIsoDays,c=Math.floor(r/Y),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=Q(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*Y;for(let r of n){let n=e+r;if(!(n<i)&&(a!==void 0&&n>a||(t.push(this.utcZdtFromEpochMilliseconds(n)),this.assertFastPathBudget(t),this.shouldBreakForCountLimit(t.length))))return t}}c+=o,l=Q(l,o)}}_allUtcWeeklySimple(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.originalDtstart,n=J[$(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*Od,c=n-i*Y;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let t of r){let r=c+t*Y;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)*Fd,l=o-BigInt(i)*Pd;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let t of r){let n=l+BigInt(t)*Pd;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/Y),o=this.opts.until?.epochMilliseconds,s=this.timeSlotOffsetsMs,c=J[$(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)*Y;for(let e of s){let r=n+e;if(!(r<i)&&(o!==void 0&&r>o||(t.push(this.utcZdtFromEpochMilliseconds(r)),this.assertFastPathBudget(t),this.shouldBreakForCountLimit(t.length))))return t}}f+=d}}hasSingleExpandedTimeSlot(){if(this.timeSlotOffsetsMs)return this.timeSlotOffsetsMs.length===1;let e=this.opts.byHour??[this.originalDtstart.hour],t=this.opts.byMinute??[this.originalDtstart.minute],n=this.opts.bySecond??[this.originalDtstart.second];return e.length===1&&t.length===1&&n.length===1}buildMonthlyOccurrenceOnDay(e,t){let n=e.day===t?e:e.with({day:t});return this.applyTimeOverride(n)}applyBySetPosToSortedList(e){let{bySetPos:t}=this.opts;if(!t||!t.length||e.length===0)return e;let n=[],r=e.length;for(let i of t){let t=i>0?i-1:r+i;t>=0&&t<r&&n.push(e[t])}return n}generateMonthlyOccurrenceDays(e){let{byDay:t,byMonth:n,byMonthDay:r}=this.opts,i=e.day===1?e:e.with({day:1});if(n&&!n.includes(e.month))return[];let a=i.add({months:1}).subtract({days:1}).day,o=[];if(r&&r.length>0&&(o=r.map(e=>e>0?e:a+e+1).filter(e=>e>=1&&e<=a),o=[...new Set(o)].sort((e,t)=>e-t)),!t&&r&&r.length>0)return o;if(!t)return[e.day];let s=this.parsedByDayTokens;if(!s?.length)return[];let c=i.dayOfWeek,l=(c-1+a-1)%7+1,u=new Set;for(let{ord:e,isoDay:t}of s)if(e===0){let e=1+(t-c+7)%7;for(;e<=a;)u.add(e),e+=7}else{let n;n=e>0?1+(t-c+7)%7+7*(e-1):a-(l-t+7)%7+7*(e+1),n>=1&&n<=a&&u.add(n)}let d=[...u].sort((e,t)=>e-t);if(r&&r.length>0){if(o.length===0)return[];let e=new Set(o);d=d.filter(t=>e.has(t))}return d}isGregorianLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}daysInGregorianMonth(e,t){return t===2&&this.isGregorianLeapYear(e)?29:kd[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)+Ad[t-1]+n)%7+7)%7;return i===0?7:i}monthIndexToYearMonth(e){let t=Math.floor(e/12);return{year:t,month:e-t*12+1}}generateMonthlyOccurrenceDaysUtc(e,t){if(this.numericByMonths&&this.numericByMonths.length>0&&!this.numericByMonths.includes(t))return[];let n=this.opts.byMonthDay,r=this.opts.byDay,i=this.daysInGregorianMonth(e,t),a=[];if(n&&n.length>0&&(a=n.map(e=>e>0?e:i+e+1).filter(e=>e>=1&&e<=i),a=[...new Set(a)].sort((e,t)=>e-t)),!r&&n&&n.length>0)return a;if(!r){let e=this.originalDtstart.day;return e>=1&&e<=i?[e]:[]}let o=this.parsedByDayTokens;if(!o?.length)return[];let s=this.gregorianIsoDayOfWeek(e,t,1),c=Q(s,i-1),l=new Set;for(let{ord:e,isoDay:t}of o)if(e===0){let e=1+(t-s+7)%7;for(;e<=i;)l.add(e),e+=7}else{let n;n=e>0?1+(t-s+7)%7+7*(e-1):i-(c-t+7)%7+7*(e+1),n>=1&&n<=i&&l.add(n)}let u=[...l].sort((e,t)=>e-t);if(n&&n.length>0){if(a.length===0)return[];let e=new Set(a);u=u.filter(t=>e.has(t))}return u}generateMonthlyOccurrenceEpochsUtc(e,t){let n=this.generateMonthlyOccurrenceDaysUtc(e,t);if(n.length===0)return[];let r=Kd(e,t,1)*Y;if(!Z(r))return[];let i=this.timeSlotOffsetsMs??[0];if(this.opts.bySetPos&&this.opts.bySetPos.length>0){if(i.length===1){let e=this.applyBySetPosToSortedList(n).sort((e,t)=>e-t),t=i[0];return e.filter((t,n)=>n===0||t!==e[n-1]).map(e=>r+(e-1)*Y+t)}let e=[];for(let t of n){let n=r+(t-1)*Y;for(let t of i)e.push(n+t)}let t=this.applyBySetPosToSortedList(e).sort((e,t)=>e-t);return t.filter((e,n)=>n===0||e!==t[n-1])}let a=[];for(let e of n){let t=r+(e-1)*Y;for(let e of i)a.push(t+e)}return a}_allUtcMonthlyByDayOrMonthDay(){let e=[],t=this.originalDtstart.epochMilliseconds,n=this.opts.until?.epochMilliseconds,r=0;if(!this.addDtstartIfNeeded(e))return e;let i=this.opts.until?.withTimeZone(this.tzid).withCalendar(`iso8601`),a=i?i.year*12+i.month-1:void 0,o=this.originalDtstart.year*12+(this.originalDtstart.month-1);for(;;){if(a!==void 0&&o>a)return e;if(++r>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let{year:i,month:s}=this.monthIndexToYearMonth(o),c=this.generateMonthlyOccurrenceEpochsUtc(i,s);for(let r of c)if(!(r<t)&&(n!==void 0&&r>n||(e.push(this.utcZdtFromEpochMilliseconds(r)),this.assertFastPathBudget(e),this.shouldBreakForCountLimit(e.length))))return e;o+=this.opts.interval}}getZoneResolver(){return this.zoneResolver??=vd(this.tzid)}zdtFromEpochMs(e){if(ld||this.tzid===`UTC`)return new q.ZonedDateTime(BigInt(e)*X,this.tzid,this.originalDtstart.calendarId);let t=this.emitAnchorZdt;return t?t.add({milliseconds:e-t.epochMilliseconds}):(t=this.emitAnchorZdt=new q.ZonedDateTime(BigInt(e)*X,this.tzid,this.originalDtstart.calendarId),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*Y}else return!0;return 150*366*Y,n-t>474336e7?!0:this.getZoneResolver().timeOfDayMayHitGap(e,t-Y,n+Y)}tzFastPathCountSpanMs(e){let t=this.opts.interval,n=this.timeSlotOffsetsMs?.length??1,r=this.wallMsOf(this.originalDtstart);switch(this.opts.freq){case`DAILY`:{let i=this.simpleByDayIsoDays,a=i?.length?7/Rd(t,7):1,o=a;if(i?.length){let e=Jd(Math.floor(r/Y));o=0;for(let n=0;n<a;n++)i.includes(Q(e,n*t))&&o++;if(o===0)return 0}return(Math.ceil(e/(o*n))+1)*a*t*Y}case`WEEKLY`:{let r=this.opts.byDay?this.allByDayIsoDays?.length??0:1;return r===0?0:(Math.ceil(e/(r*n))+1)*t*Od}}}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.hasUniqueTimeSlotOffsets?this._allTzDailyExpanded(t):null:this._allTzDailySimple();break;case`HOURLY`:case`MINUTELY`:case`SECONDLY`:if(!this.opts.byDay&&!this.opts.byHour&&!this.opts.byMinute&&!this.opts.bySecond){let e=this.opts.freq===`HOURLY`?Dd:this.opts.freq===`MINUTELY`?Ed:Td;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.hasUniqueTimeSlotOffsets?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/Y),i=n-r*Y;if(this.tzFastPathGapHazard(i))return null;let a=this.opts.interval,o=this.simpleByDayIsoDays,s=this.opts.until?.epochMilliseconds,c=Jd(r);if(o?.length){let t=this.findFirstMatchingDailyStep(c,a,o);if(t===null)return e;r+=t*a,c=Q(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*Y+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=Q(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.timeSlotOffsetsMs;for(let e of a)if(this.tzFastPathGapHazard(e))return null;let o=this.opts.interval,s=this.simpleByDayIsoDays,c=this.opts.until?.epochMilliseconds,l=Math.floor(i/Y),u=Jd(l);if(s?.length){let e=this.findFirstMatchingDailyStep(u,o,s);if(e===null)return t;let n=e*o;l+=n,u=Q(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*Y;for(let i of a){let a=n.epochMsForWall(e+i);if(a.pushed)return null;if(!(a.epochMs<r)&&(c!==void 0&&a.epochMs>c||(t.push(this.zdtFromEpochMs(a.epochMs)),this.assertFastPathBudget(t),this.shouldBreakForCountLimit(t.length))))return t}}l+=o,u=Q(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%Y+Y)%Y/Dd)},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/Y),o=i-a*Y;if(this.tzFastPathGapHazard(o))return null;let s=Jd(a),c=J[$(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)*Y+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/Y),s=this.timeSlotOffsetsMs;for(let e of s)if(this.tzFastPathGapHazard(e))return null;let c=Jd(o),l=J[$(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)*Y;for(let e of s){let a=n.epochMsForWall(r+e);if(a.pushed)return null;if(!(a.epochMs<i)&&(f!==void 0&&a.epochMs>f||(t.push(this.zdtFromEpochMs(a.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.timeSlotOffsetsMs[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=Kd(a,l,1)*Y,n=e+this.daysInGregorianMonth(a,l)*Y;if(t.timeOfDayMayHitGap(i,e-Y,n+Y))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 q.ZonedDateTime.compare(e,n)<0?!0:this.opts.until&&q.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=J,s=this.opts.byDay?[...this.allByDayIsoDays??[]]:this.opts.byMonthDay&&this.opts.byMonthDay.length>0?[...Object.values(o)]:[a.dayOfWeek],c=o[$(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(q.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&&q.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&&q.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&&q.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&&q.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&&q.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=vd(l),f=i===`HOURLY`?Nd:i===`MINUTELY`?Md:jd,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(Hd(e,X)),ie=(e,t)=>{let n=d.nextTransitionAfter(re(e),Number(Ud(t,X)));if(n===void 0)return;let r=BigInt(n)*X;return r>e&&r<=t?r:void 0},y,b=e=>{if(ld||l===`UTC`)return new q.ZonedDateTime(e,l,u);y??=new q.ZonedDateTime(e,l,u);let t=e-y.epochNanoseconds,n=Hd(t,X);return y.add({milliseconds:Number(n),nanoseconds:Number(t-n*X)})},x=e=>e.toZonedDateTime(l).epochNanoseconds,ae=(e,t)=>ie(e,e+t-1n)??e+t,oe,se,ce=!1,le=0n,ue=0;for(;;){if(++ue>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let i=m+le*p;if(h!==void 0&&i-2n*f>h)break;let o=re(i),s=o+d.offsetMsAt(o),l=Math.floor(s/Y),y=s-l*Y,de=Math.floor(y/Dd),fe=Math.floor(y/Ed)%60,pe=Math.floor(y/Td)%60;if(g&&le>0n){let e=i-Nd;if(ie(e,i)!==void 0){let t=re(e),n=t+d.offsetMsAt(t);if(Math.floor(n/Dd)===Math.floor(s/Dd)){le+=1n;continue}}}if(l!==oe){let{year:e,month:t}=qd(l);oe=l,se=new q.PlainDate(e,t,l-Kd(e,t,1)+1,u),ce=this.matchesSubDailyDate(se)}let S;if(!ce)S=x(this.nextSubDailyDateCandidate(se));else if(a&&!a.includes(de)){let e=a.find(e=>e>de)??24,t=BigInt((fe*60+pe)*1e3)*X+ne;S=ae(i,BigInt(e-de)*Nd-t)}else if(_&&!_.includes(fe)){let e=_.find(e=>e>fe)??60,t=BigInt(pe*1e3)*X+ne;S=ae(i,BigInt(e-fe)*Md-t)}else if(v&&!v.includes(pe)){let e=v.find(e=>e>pe)??60;S=ae(i,BigInt(e-pe)*jd-ne)}if(S!==void 0){if(h!==void 0&&S>h)break;let e=S-m,t=e<=0n?0n:Ud(e,p);le=t>le?t:le+1n;continue}let me=[],he;for(let e of ee??[fe])for(let t of te??[pe]){this.recordCandidateEvaluation(n);let r=BigInt((e-fe)*60+(t-pe))*jd,a=i+r;if(r===0n||ie(r<0n?a:i,r<0n?i:a)===void 0){me.push(a);continue}he??=b(i);let o=he.with({minute:e,second:t});o.hour===de&&o.minute===e&&o.second===t&&me.push(o.epochNanoseconds)}me.sort((e,t)=>e<t?-1:e>t?1:0);let C=c?.length?this.applyBySetPosToSortedList(me).sort((e,t)=>e<t?-1:e>t?1:0):me;for(let i=0;i<C.length;i++){let a=C[i];if(!(a<m||i>0&&a===C[i-1])&&!this.processOccurrence(b(a),t,r,e,void 0,n))return this.applyCountLimitAndMergeRDates(t,e)}le+=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&&q.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&&q.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)}mergeAndDeduplicateRDates(e){this.opts.rDate&&e.push(...this.opts.rDate);let t=e.map(e=>e.epochNanoseconds),n=!0;for(let e=1;e<t.length;e++)if(t[e-1]>t[e]){n=!1;break}n||(e=e.map((e,t)=>t).sort((e,n)=>t[e]<t[n]?-1:t[e]>t[n]?1:0).map(t=>e[t]),t.sort((e,t)=>e<t?-1:e>t?1:0));let r=[];for(let n=0;n<e.length;n++)(n===0||t[n]!==t[n-1])&&r.push(e[n]);return r}isExcluded(e){return this.isExcludedEpoch(e.epochNanoseconds)}isExcludedEpoch(e){return!this.opts.exDate||this.opts.exDate.length===0?!1:(this.exDateEpochNs===void 0&&(this.exDateEpochNs=new Set(this.opts.exDate.map(e=>e.epochNanoseconds))),this.exDateEpochNs.has(e))}getNumericRDates(){if(this.numericRDatesCache)return this.numericRDatesCache;let e=[...this.opts.rDate??[]].sort((e,t)=>e.epochNanoseconds<t.epochNanoseconds?-1:e.epochNanoseconds>t.epochNanoseconds?1:0),t=[],n;for(let r of e)r.epochNanoseconds!==n&&(n=r.epochNanoseconds,this.isExcludedEpoch(n)||t.push(r));return this.numericRDatesCache=t}numericRDateLowerBound(e,t){let n=this.getNumericRDates(),r=0,i=n.length;for(;r<i;){let a=r+Math.floor((i-r)/2),o=n[a].epochNanoseconds;(t?o>e:o>=e)?i=a:r=a+1}return r}excludeExDates(e){return!this.opts.exDate||this.opts.exDate.length===0?e:e.filter(e=>!this.isExcluded(e))}applyCountLimitAndMergeRDates(e,t){let n=this.opts.count===void 0?e:e.slice(0,Math.max(this.opts.count,0)),r=this.mergeAndDeduplicateRDates(n),i=this.excludeExDates(r);return!t||!this.opts.rDate&&!this.opts.exDate?i:this.applyIterator(i,t)}iterateRecurrenceSet(t){let n=[],r=[...this.opts.rDate??[]].sort((e,t)=>q.ZonedDateTime.compare(e,t)),i=0,a,o=!1,s=e=>{let r=e.epochNanoseconds;return a===r||(a=r,this.isExcluded(e))?!0:t(e,n.length)?(n.push(e),!0):(o=!0,!1)},c=e=>{for(;i<r.length&&r[i].epochNanoseconds<e;)if(!s(r[i++]))return!1;return!0},l=e=>{if(!c(e.epochNanoseconds)||!s(e))return!1;for(;i<r.length&&r[i].epochNanoseconds===e.epochNanoseconds;)i++;return!0};for((this.opts.count===void 0||this.opts.count>0)&&new e({...this.cloneOptions(),rDate:void 0,exDate:void 0,cache:!1}).allInternal(l);!o&&i<r.length&&s(r[i++]););return n}applyIterator(e,t){let n=[];for(let r of e){if(!t(r,n.length))break;n.push(r)}return n}shouldBreakForCountLimit(e){return this.opts.count===void 0?!1:e>=this.opts.count}hasTimeOfDayBetween(e,t){if(q.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=q.PlainTime.from({hour:o,minute:r,second:i,millisecond:n.millisecond,microsecond:n.microsecond,nanosecond:n.nanosecond});if(q.PlainTime.compare(a,e)>=0&&q.PlainTime.compare(a,t)<0)return!0}return!1}assertNumericCandidateReachable(e){if(e&&e.periodIndex>=this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`)}numericExhaustionCandidate(e){return e.count<e.maximumCount?e.select(e.count):e.count>0?e.select(e.count-1):null}tryNumericNext(e,t){let n=this.getNumericQueryPlan();if(!n)return{handled:!1};let r=n.lowerBound(e,!t);if(!this.opts.rDate&&!this.opts.exDate){if(r>=n.count)return this.assertNumericCandidateReachable(this.numericExhaustionCandidate(n)),{handled:!0,value:null};let e=n.select(r);return e?(this.assertNumericCandidateReachable(e),{handled:!0,value:this.zdtFromEpochMs(e.epochMilliseconds)}):{handled:!1}}let i=this.getNumericRDates()[this.numericRDateLowerBound(e,!t)];for(;r<n.count;){let e=n.select(r);if(!e)return{handled:!1};let t=BigInt(e.epochMilliseconds)*X;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)*X)){o=e;break}--a}let s=this.getNumericRDates(),c=this.numericRDateLowerBound(e,t)-1,l=c>=0?s[c]:null;return!o||l&&l.epochNanoseconds>BigInt(o.epochMilliseconds)*X?{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)*X;this.isExcludedEpoch(n)||c.push(this.zdtFromEpochMs(t.epochMilliseconds))}let l=this.getNumericRDates(),u=this.numericRDateLowerBound(e,!n),d=this.numericRDateLowerBound(t,n),f=[],p=0,m=u;for(;p<c.length||m<d;){let e=c[p],t=l[m];!t||e&&e.epochNanoseconds<=t.epochNanoseconds?(f.push(e),p+=1,t&&t.epochNanoseconds===e.epochNanoseconds&&(m+=1)):(f.push(t),m+=1)}return{handled:!0,value:f}}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)return null;let r=this.getZoneResolver();if(this.timeSlotOffsetsMs.some(e=>r.timeOfDayMayHitGap(e,n[0]-Y,n[1]+Y)))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)*X)}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,Ld),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(!Z(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-Y));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,Ld),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+Y);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(!Z(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-Y)),f=e.periodOfWall(u?o:o+Y);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.getNumericRDates()[this.numericRDateLowerBound(e,!t)]:void 0,i=this.periodScanForward(n,Wd(e,!t),r?Gd(r.epochNanoseconds,!1):void 0);return i===void 0?{handled:!1}:r&&(i===null||BigInt(i)*X>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.getNumericRDates()[r]:null,a=this.periodScanBackward(n,Gd(e,!t),i?Wd(i.epochNanoseconds,!1):void 0);return a===void 0||this.periodScanForward(n,Wd(e,t),void 0,2)===void 0?{handled:!1}:i&&(a===null||BigInt(a)*X<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,Wd(e,!n),Gd(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.getNumericRDates(),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=$d(t,`after`),a=$d(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 q.ZonedDateTime(i,this.tzid,this.originalDtstart.calendarId),l=new q.ZonedDateTime(a,this.tzid,this.originalDtstart.calendarId),u={...this.opts};(!u.until||q.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())&&q.ZonedDateTime.compare(m,o)>0&&this.hasTimeOfDayBetween(o.toPlainTime(),m.toPlainTime())&&(--u,m=p());let h=e.normalizeToPolyfill(this.opts.dtstart);return q.ZonedDateTime.compare(m,h)<0&&(m=h),m}matches(e){let t=$d(e,`date`);return this.nextInternal(t,!0)?.epochNanoseconds===t}occursOn(e){let t=q.PlainDate.from(e.toString()),n=t.toZonedDateTime({timeZone:this.tzid,plainTime:q.PlainTime.from(`00:00`)});if(!n.toPlainDate().equals(t))return!1;let r=t.add({days:1}).toZonedDateTime({timeZone:this.tzid,plainTime:q.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 q.ZonedDateTime(e,this.tzid))):a(this),i}next(e=new Date,t=!1){return this.toPublicDate(this.nextInternal($d(e,`after`),t))}alignedQueryStart(e){let t=this.jumpAlignedDtstart(e);return{dtstart:t,includeDtstart:this.includeDtstart&&t.epochNanoseconds===this.originalDtstart.epochNanoseconds}}ruleFromAlignedDtstart(t){let n=this.alignedQueryStart(t);return n.dtstart.epochNanoseconds===this.originalDtstart.epochNanoseconds?this:new e({...this.opts,temporal:this.outputTemporal,...n})}previous(e=new Date,t=!1){let n=$d(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.getNumericRDates()[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 q.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 q.ZonedDateTime(r,i.tzid,i.originalDtstart.calendarId));let o=i.ruleFromAlignedDtstart(t),l=a(o);if(l||o===i||n)return l}return a(i)}freqDuration(e){switch(this.opts.freq){case`YEARLY`:return{years:e};case`MONTHLY`:return{months:e};case`WEEKLY`:return{weeks:e};case`DAILY`:return{days:e};case`HOURLY`:return{hours:e};case`MINUTELY`:return{minutes:e};default:return{seconds:e}}}toString(){let e=this.originalDtstart.toString({smallestUnit:`second`}).replace(/[-:]/g,``),t=`DTSTART;TZID=${this.tzid}:${e.slice(0,15)}`,n=[],{freq:r,interval:i,count:a,until:o,byHour:s,byMinute:c,bySecond:l,byDay:u,byMonth:d,byMonthDay:f,bySetPos:p,byWeekNo:m,byYearDay:h,wkst:g,rDate:_,exDate:v}=this.opts;this.opts.rscale&&n.push(`RSCALE=${this.opts.rscale}`),this.opts.rscale&&this.opts.skip&&n.push(`SKIP=${this.opts.skip}`),n.push(`FREQ=${r}`),i!==1&&n.push(`INTERVAL=${i}`),a!==void 0&&a!==1/0&&n.push(`COUNT=${a}`),o&&n.push(`UNTIL=${this.formatIcsDateTime(o)}`),s&&n.push(`BYHOUR=${s.join(`,`)}`),c&&n.push(`BYMINUTE=${c.join(`,`)}`),l&&n.push(`BYSECOND=${l.join(`,`)}`),u&&n.push(`BYDAY=${u.join(`,`)}`),d&&n.push(`BYMONTH=${d.join(`,`)}`),f&&n.push(`BYMONTHDAY=${f.join(`,`)}`),p&&n.push(`BYSETPOS=${p.join(`,`)}`),m&&n.push(`BYWEEKNO=${m.join(`,`)}`),h&&n.push(`BYYEARDAY=${h.join(`,`)}`),g&&n.push(`WKST=${g}`);let ee=[t,`RRULE:${n.join(`;`)}`];return _&&ee.push(`RDATE:${this.joinDates(_)}`),v&&ee.push(`EXDATE:${this.joinDates(v)}`),ee.join(`
2
- `)}formatIcsDateTime(e){return e.toInstant().toString().replace(/[-:]/g,``).slice(0,15)+`Z`}joinDates(e){return e.map(e=>this.formatIcsDateTime(e))}generateMonthlyDateCandidates(e){let t=e.day===1?e:e.with({day:1});if(!this.opts.byDay&&!this.opts.byMonthDay)return[e];let n=this.generateMonthlyOccurrenceDays(t);return n.length===0?[]:n.map(e=>t.with({day:e}))}generateMonthlyOccurrences(e){let t=[];return this.visitDateTimeCandidates(this.generateMonthlyDateCandidates(e.toPlainDate()),1,e=>(t.push(e),!0)),t}generateYearlyDateCandidates(e){let t=this.opts.byMonth?this.opts.byMonth.filter(e=>typeof e==`number`).sort((e,t)=>e-t):this.opts.byMonthDay||this.opts.byDay?[1,2,3,4,5,6,7,8,9,10,11,12]:[this.originalDtstart.month],n=[],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;if(r&&!this.opts.byMonth&&!a){let t=J;for(let r of this.opts.byDay){let i=Yd(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=Yd(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){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);for(let e of this.opts.byWeekNo){if(e>0&&e>t||e<0&&-e>t)continue;let a=e>0?e-1:t+e,o=r.add({weeks:a});n.push(...this.addByDayDates(i,o))}}return this.sortedUniqueDateCandidates(n)}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=J,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)=>q.ZonedDateTime.compare(e,t));return this.applyBySetPosToSortedList(n).sort((e,t)=>q.ZonedDateTime.compare(e,t))}isoWeekByDay(e){let t=J,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=>$(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=cd.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=cd.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 cd.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=cd.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 cd.ZonedDateTime.from(e.toString())}rscaleDate(e){return q.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 q.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=J[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=J,r=t.map(e=>$(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=J,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=Yd(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=J,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=>$(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=J,l=c[this.opts.wkst||`MO`],u=this.opts.byDay?.length?this.opts.byDay.map(e=>$(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 J}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return yd}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return bd}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ff}});