temporal-fmt 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -113,6 +113,16 @@ A few things worth knowing:
113
113
  - this is an opinionated tradeoff but ensures `yy` is deterministic without an external date reference
114
114
  - **`hh`/`h` (12-hour) without an `a` token throws** — same if a format string mixes `HH`/`H` with `hh`/`h`,
115
115
  even when both agree on the same hour. `parse` won't guess which one is authoritative; pick one.
116
+ - **`HH`/`H` combined with `a` is allowed, and cross-checked** — `parse('HH:mm a', '13:05 PM')` succeeds since
117
+ 13:05 can only mean PM, but `parse('HH:mm a', '01:05 PM')` throws: the day period contradicts the hour.
118
+ This is different from mixing `HH` with `hh`/`h` above — there's only one hour token here, `a` just confirms it.
119
+ - **`a` (AM/PM) matches case-insensitively** — `pm`, `Pm`, and `PM` all parse the same way. Month and weekday
120
+ names (`MMMM`, `EEEE`, etc.) stay case-sensitive; only the day-period marker is case-folded.
121
+ - **`S` through `SSSSSSSSS` reach micro/nanosecond precision, not just milliseconds.** `SSS` is unchanged (3-digit
122
+ ms). Wider tokens expose whatever sub-millisecond precision the `Temporal` value actually carries — useful for
123
+ round-tripping machine-generated timestamps (DB exports, instrumentation logs) without silently truncating to
124
+ ms. Format truncates to the requested width (never rounds); parse right-pads short input, so `SSSSSSSSS` reading
125
+ `.5` means 500ms-worth of nanoseconds (`500000000`), not 5 nanoseconds.
116
126
  - **`MMMM`/`MMM` name matching assumes a 12-month calendar** — the vocabulary
117
127
  it matches against is generated from 12 Gregorian reference dates, so a
118
128
  calendar with a leap month (e.g. Hebrew's 13-month leap years) isn't fully
@@ -178,8 +188,9 @@ yourself.
178
188
  | m | minute | 45 |
179
189
  | ss | 2-digit second | 30 |
180
190
  | s | second | 30 |
181
- | SSS | milliseconds | 000 |
182
- | a | AM/PM | PM |
191
+ | SSS | milliseconds (3 digits) | 000 |
192
+ | SSSSSSSSS...S | fractional second, 1-9 digits — `S` through `SSSSSSSSS`. `SSS` is the common 3-digit millisecond case; wider widths reach micro/nanosecond precision. Format slices from the underlying nanosecond value (never rounds); parse right-pads whatever digits it captured (`.5` under `SSSSSSSSS` means 500,000,000ns, not 5ns) | `SSSSSSSSS` → 123456789 |
193
+ | a | AM/PM (case-insensitive on parse) | PM |
183
194
  | Q | numeric quarter (1-4) | 3 |
184
195
  | QQQ | quarter with "Q" prefix (Q1, Q2, Q3, Q4) | Q3 |
185
196
  | ww | ISO 8601 week (01-53), format-only | 32 |
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var ie=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Ze=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},He=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ve(t))!Ye.call(e,o)&&o!==n&&ie(e,o,{get:()=>t[o],enumerable:!(r=Ue(t,o))||r.enumerable});return e};var je=e=>He(ie({},"__esModule",{value:!0}),e);var Ht={};Ze(Ht,{format:()=>xe,formatDistance:()=>Ae,formatDuration:()=>Le,parse:()=>$e,parseRelative:()=>_e,registerLocaleVocab:()=>Te,setTemporal:()=>Ee});module.exports=je(Ht);var we,be=[];function ke(e){be.push(e)}function Ee(e){we=e;for(let t of be)t()}function ze(){return we??globalThis.Temporal}function F(){let e=ze();if(!e)throw new Error("temporal-fmt: parse() needs a Temporal implementation to construct its result. Call setTemporal(Temporal) once at startup, or assign one to globalThis.Temporal (native on Node 26+, or a polyfill like temporal-polyfill).");return e}var se=new Map;function Ke(e,t){let n=[{key:"monthLong",length:12,label:"long month names"},{key:"monthShort",length:12,label:"short month names"},{key:"weekdayLong",length:7,label:"long weekday names"},{key:"weekdayShort",length:7,label:"short weekday names"},{key:"dayPeriod",length:2,label:"day period markers (AM/PM-equivalent)"}];for(let{key:r,length:o,label:a}of n){let i=e[r];if(i===void 0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}" is missing required field "${r}" (${a}).`);if(!Array.isArray(i))throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}" must be an array, got ${typeof i}.`);if(i.length!==o)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}" must have exactly ${o} entries (got ${i.length}) \u2014 ${a}.`);i.forEach((s,m)=>{if(typeof s!="string"||s.length===0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}[${m}]" must be a non-empty string, got ${String(s)}.`)})}if(M(e.monthLong,"MMMM month",t),M(e.monthShort,"MMM month",t),M(e.weekdayLong,"EEEE weekday",t),M(e.weekdayShort,"EEE weekday",t),e.dayPeriod[0]===e.dayPeriod[1])throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": dayPeriod entries must differ (both are "${e.dayPeriod[0]}"); otherwise parse() can't tell AM from PM.`)}function Te(e,t){if(typeof e!="string"||e.length===0)throw new Error(`temporal-fmt: registerLocaleVocab requires a non-empty locale string, got ${String(e)}.`);Ke(t,e);let n=P(e);se.set(n,{monthLong:[...t.monthLong],monthShort:[...t.monthShort],weekdayLong:[...t.weekdayLong],weekdayShort:[...t.weekdayShort],dayPeriod:[...t.dayPeriod]}),O.delete(n)}function P(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}var O=new Map,We=500;function $(e,t,n){let r=e.formatToParts(t),o=r.findIndex(m=>m.type===n);if(o===-1)throw new Error(`temporal-fmt: locale produced no "${n}" part while building match vocabulary.`);let a=r[o].value,i=r[o-1],s=r[o+1];return i?.type==="literal"&&!/\s/.test(i.value)&&(a=i.value+a),s?.type==="literal"&&!/\s/.test(s.value)&&(a=a+s.value),a}function M(e,t,n){let r=new Map;for(let o=0;o<e.length;o++){let a=r.get(e[o]);if(a!==void 0)throw new Error(`temporal-fmt: locale "${n}" renders ${t} index ${a} and ${o} identically ("${e[o]}"). parse() can't reliably tell these apart for this locale/token, so this combination isn't supported.`);r.set(e[o],o)}}function L(e){let t=P(e);return se.get(t)}function N(e){let t=P(e),n=se.get(t);if(n)return n;let r=O.get(t);if(r)return r;let o=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),a=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),i=[],s=[];for(let y=0;y<12;y++){let T=new Date(Date.UTC(2020,y,1));i.push($(o,T,"month")),s.push($(a,T,"month"))}M(i,"MMMM month",e),M(s,"MMM month",e);let m=new Intl.DateTimeFormat(e,{weekday:"long",timeZone:"UTC"}),c=new Intl.DateTimeFormat(e,{weekday:"short",timeZone:"UTC"}),u=[],l=[];for(let y=0;y<7;y++){let T=new Date(Date.UTC(2024,0,1+y));u.push($(m,T,"weekday")),l.push($(c,T,"weekday"))}M(u,"EEEE weekday",e),M(l,"EEE weekday",e);let d=new Intl.DateTimeFormat(e,{hour:"numeric",hour12:!0,timeZone:"UTC"}),f=$(d,new Date(Date.UTC(2020,0,1,1)),"dayPeriod"),p=$(d,new Date(Date.UTC(2020,0,1,13)),"dayPeriod"),w=[...new Set([f,p])],b={monthLong:i,monthShort:s,weekdayLong:u,weekdayShort:l,dayPeriod:w};if(O.size>=We){let y=O.keys().next().value;y!==void 0&&O.delete(y)}return O.set(t,b),b}var Qe=[0,31,59,90,120,151,181,212,243,273,304,334];function I(e){return e%4===0&&e%100!==0||e%400===0}function _(e){return I(e)?366:365}function ue(e,t,n){let r=Qe[t-1]+n;return t>2&&I(e)&&(r+=1),r}var me=2e3;function qe(e){let t=0;if(e>=me)for(let r=me;r<e;r++)t+=_(r);else for(let r=e;r<me;r++)t-=_(r);return((5+t)%7+7)%7+1}function de(e,t,n,r){let a=ue(e,t,n)+(4-r),i,s;a<1?(i=e-1,s=a+_(i)):a>_(e)?(i=e+1,s=a-_(e)):(i=e,s=a);let c=1+(4-qe(i)+7)%7,u=1+Math.floor((s-c)/7);return{isoYear:i,week:u}}function k(e,t){let n=e<0,r=String(Math.abs(e)).padStart(t,"0");return n?"-"+r:r}var R="en-US",C=new Map,Ge=500;function De(e,t){let n=JSON.stringify([P(e),t]),r=C.get(n);if(r)return r;if(C.size>=Ge){let o=C.keys().next().value;o!==void 0&&C.delete(o)}return r=new Intl.DateTimeFormat(e,t),C.set(n,r),r}var U;ke(()=>{U=void 0});function Xe(){if(U===void 0){U=!1;try{let e=F();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),U=!0}catch{}}return U}function Be(e,t,n,r){let o=e?.calendarId,a={...n,calendar:o&&o!=="iso8601"?o:"gregory"};if(!Xe())return e.toLocaleString(t,a);let{toInstant:i,timeZoneId:s}=e,m=typeof i=="function"&&typeof s=="string",c=m?e.toInstant():e,u={...a,...m?{timeZone:s}:{}},d=De(t,u).formatToParts(c),f=d.findIndex(y=>y.type===r);if(f===-1)throw new Error(`temporal-fmt: locale "${t}" produced no "${r}" part for this token. This usually means the Temporal object is missing the field the token needs.`);let p=d[f].value,w=d[f-1],b=d[f+1];return w?.type==="literal"&&!/\s/.test(w.value)&&(p=w.value+p),b?.type==="literal"&&!/\s/.test(b.value)&&(p=p+b.value),p}function Je(e,t){let n=L(t);if(n)return e<12?n.dayPeriod[0]:n.dayPeriod[1];let r=new Date(Date.UTC(1970,0,1,e)),a=De(t,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(r).find(i=>i.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${t}" produced no "dayPeriod" part for token "a".`);return a.value}function K(e,t,n,r,o,a){return o&&a!==void 0&&a>=0&&a<o.length?o[a]:Be(e,t,n,r)}var W=[["yyyy",e=>k(e.year,4),"year"],["yy",e=>{if(e.year<0)throw new Error(`temporal-fmt: token "yy" doesn't support negative years (got ${e.year}), since truncating to 2 digits would make it indistinguishable from a positive year. Use "yyyy" instead.`);return k(e.year%100,2)},"year"],["MMMM",(e,t)=>{let n=L(t);return K(e,t,{month:"long"},"month",n?.monthLong,e.month-1)},"month"],["MMM",(e,t)=>{let n=L(t);return K(e,t,{month:"short"},"month",n?.monthShort,e.month-1)},"month"],["MM",e=>k(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>k(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,t)=>{let n=L(t);return K(e,t,{weekday:"long"},"weekday",n?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,t)=>{let n=L(t);return K(e,t,{weekday:"short"},"weekday",n?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>k(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>k(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>k(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>k(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSS",e=>k(e.millisecond,3),"millisecond"],["a",(e,t)=>Je(e.hour,t),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["do",e=>{let t=e.day,n=t%10,r=t%100;return r>=11&&r<=13?t+"th":n===1?t+"st":n===2?t+"nd":n===3?t+"rd":t+"th"},"day"],["Q",e=>String(Math.ceil(e.month/3)),"month"],["QQQ",e=>"Q"+Math.ceil(e.month/3),"month"],["ww",e=>{let{week:t}=de(e.year,e.month,e.day,e.dayOfWeek);return k(t,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:t}=de(e.year,e.month,e.day,e.dayOfWeek);return k(t,4)},"dayOfWeek"]];var et=W.map(([e])=>e).sort((e,t)=>t.length-e.length);function Q(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r==="'"){if(e[n+1]==="'"){le(t,"'"),n+=2;continue}let a=n+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in format string "${e}"`);le(t,i),n=a;continue}let o=et.find(a=>e.startsWith(a,n));if(o){t.push({kind:"token",value:o}),n+=o.length;continue}le(t,r),n+=1}return t}function le(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}var tt=new Map(W.map(([e,t,n])=>[e,{fn:t,field:n}]));function xe(e,t,n={}){if(t.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${t.length}).`);let r=n.locale??R,o=Q(t),a="";for(let i of o){if(i.kind==="literal"){a+=i.value;continue}let s=tt.get(i.value);if(!s)throw new Error(`temporal-fmt: unknown token "${i.value}"`);if(e[s.field]===void 0)throw new Error(`temporal-fmt: token "${i.value}" requires "${s.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`);a+=s.fn(e,r)}return a}function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(e){return`(?:${e.map(nt).join("|")})`}var rt="(?:UTC|[+-]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?|[A-Za-z_]+(?:[+-]\\d{1,2})?(?:\\/[A-Za-z0-9_+-]+)*)";function ot(){return rt}var q;function at(){return q||(q=new Set(Intl.supportedValuesOf("timeZone")),q.add("UTC")),q}var it=/^[+-]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/;function Me(e){return it.test(e)||at().has(e)}var st={yy:"\\d{2}",MM:"(?:0[1-9]|1[0-2])",M:"(?:1[0-2]|[1-9])",dd:"(?:0[1-9]|[12]\\d|3[01])",d:"(?:[12]\\d|3[01]|[1-9])",HH:"(?:[01]\\d|2[0-3])",H:"(?:1\\d|2[0-3]|[0-9])",hh:"(?:0[1-9]|1[0-2])",h:"(?:1[0-2]|[1-9])",mm:"(?:[0-5]\\d)",m:"(?:[1-5]\\d|[0-9])",ss:"(?:[0-5]\\d)",s:"(?:[1-5]\\d|[0-9])",SSS:"\\d{3}",Q:"[1-4]"},mt="Q[1-4]",ut=new Set(["do","ww","RRRR"]),dt="-?\\d{4}",lt="-?\\d{4,}",ct=new Set(["yyyy","yy","MM","M","dd","d","HH","H","hh","h","mm","m","ss","s","SSS"]);function Pe(e,t,n){if(e==="yyyy")return n!==void 0&&ct.has(n)?dt:lt;let r=st[e];if(r)return r;if(e==="QQQ")return mt;if(ut.has(e))throw new Error(`temporal-fmt: token "${e}" is format-only \u2014 it can't be parsed back into a value. Use a different token in the parse format string (e.g. "d" for "do", "MM" for "ww").`);let o=N(t);switch(e){case"MMMM":return Y(o.monthLong);case"MMM":return Y(o.monthShort);case"EEEE":return Y(o.weekdayLong);case"EEE":return Y(o.weekdayShort);case"a":return Y(o.dayPeriod);case"zzz":return ot();default:throw new Error(`temporal-fmt: unknown token "${e}"`)}}var ve=new Set(["M","d","H","h","m","s"]),ft={M:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],d:[{digits:1,min:1,max:9},{digits:2,min:10,max:31}],H:[{digits:1,min:0,max:9},{digits:2,min:10,max:23}],h:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],m:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}],s:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}]};function Se(e,t){let n=new Map;function r(o,a){let i=`${o}:${a}`,s=n.get(i);if(s)return s;if(o===t.length){let l=a===e.length?[[]]:[];return n.set(i,l),l}let m=t[o],c=ft[m];if(!c)throw new Error(`temporal-fmt: internal error \u2014 "${m}" is not an unpadded numeric token`);let u=[];for(let{digits:l,min:d,max:f}of c){if(a+l>e.length)continue;let p=e.slice(a,a+l);if(l===2&&p[0]==="0")continue;let w=Number(p);if(!(w<d||w>f)){for(let b of r(o+1,a+l))if(u.push([w,...b]),u.length===2)break;if(u.length===2)break}}return n.set(i,u),u}return r(0,0)}function ht(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t){let n=[],r=[],o="",a=0,i={groupNames:[],tokens:[]},s=()=>{i.tokens.length>=2&&r.push(i),i={groupNames:[],tokens:[]}};for(let[m,c]of e.entries()){if(c.kind==="literal"){o+=ht(c.value),s();continue}let u=`g${a++}`;n.push({name:u,token:c.value});let l=e[m+1],d=l?.kind==="token"?l.value:void 0;o+=`(?<${u}>${Pe(c.value,t,d)})`,ve.has(c.value)?(i.groupNames.push(u),i.tokens.push(c.value)):s()}return s(),{regex:new RegExp(`^(?:${o})$`,"u"),groups:n,ambiguousRuns:r}}var Z=new Map,pt=500;function yt(e,t){let n=JSON.stringify([P(t),e]),r=Z.get(n);if(r)return r;if(Z.size>=pt){let o=Z.keys().next().value;o!==void 0&&Z.delete(o)}return r=Fe(Q(e),t),Z.set(n,r),r}var A=new Map,wt=500;function bt(e){let t=new Intl.Locale(e).toString().toLowerCase();if(A.has(t))return A.get(t);if(A.size>=wt){let i=A.keys().next().value;i!==void 0&&A.delete(i)}let n,r=t.split("-"),o=r.indexOf("u"),a=o===-1?-1:r.indexOf("ca",o+1);if(a!==-1&&a+1<r.length){let i=new Intl.DateTimeFormat(t).resolvedOptions().calendar;n=i==="gregory"?void 0:i}return A.set(t,n),n}function g(e,t,n){e[t]=n}function kt(e,t,n,r,o){let a=N(r);switch(t){case"yyyy":g(e,"year",Number(n));break;case"yy":g(e,"twoDigitYear",Number(n));break;case"MM":case"M":g(e,"month",Number(n));break;case"MMMM":g(e,"month",a.monthLong.indexOf(n)+1);break;case"MMM":g(e,"month",a.monthShort.indexOf(n)+1);break;case"dd":case"d":g(e,"day",Number(n));break;case"EEEE":g(e,"weekdayRaw",n),g(e,"weekdayExpected",a.weekdayLong.indexOf(n)+1);break;case"EEE":g(e,"weekdayRaw",n),g(e,"weekdayExpected",a.weekdayShort.indexOf(n)+1);break;case"HH":case"H":g(e,"hour",Number(n));break;case"hh":case"h":g(e,"hour12",Number(n));break;case"mm":case"m":g(e,"minute",Number(n));break;case"ss":case"s":g(e,"second",Number(n));break;case"SSS":g(e,"millisecond",Number(n));break;case"a":{let i=a.dayPeriod.indexOf(n);if(i<0)throw new Error(`temporal-fmt: unknown day period "${n}" for locale "${r}".`);g(e,"dayPeriodRaw",n),g(e,"isPM",i===1);break}case"zzz":g(e,"timeZoneId",n);break;case"Q":g(e,"quarter",Number(n));break;case"QQQ":g(e,"quarter",Number(n.slice(1)));break}}function Et(e,t){let n=t.indexOf("d");if(n!==-1){let r=e.filter(o=>o[n]<=12);if(r.length>0)return r[0]}return e[0]}function Tt(e){if(e.year!==void 0&&e.twoDigitYear!==void 0)throw new Error('temporal-fmt: format string mixes "yyyy" and "yy" year representations.');if(e.year!==void 0)return e.year;if(e.twoDigitYear!==void 0)return e.twoDigitYear<=68?2e3+e.twoDigitYear:1900+e.twoDigitYear}function Dt(e,t,n){if(e.hour!==void 0&&e.hour12!==void 0)throw new Error(`temporal-fmt: format string "${t}" mixes a 24-hour token ("HH"/"H") with a 12-hour token ("hh"/"h").`);if(e.hour!==void 0){if(e.dayPeriodRaw!==void 0){let r=N(n),o=e.hour<12?r.dayPeriod[0]:r.dayPeriod[1];if(e.dayPeriodRaw!==o)throw new Error(`temporal-fmt: format string "${t}" contains a day period that contradicts the 24-hour value.`)}return e.hour}if(e.hour12!==void 0){if(e.isPM===void 0)throw new Error(`temporal-fmt: format string "${t}" uses a 12-hour token ("hh"/"h") without an "a" token, so parse() can't tell AM from PM.`);return e.hour12%12+(e.isPM?12:0)}}function $e(e,t,n={}){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);if(t.length>1e5)throw new Error(`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${t.length}).`);let r=n.locale??R,o=bt(r),a=yt(e,r),i=a.regex.exec(t);if(!i)throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");if(a.groups.length===0)throw new Error(`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`);for(let{name:h,token:E}of a.groups)if(E==="zzz"&&!Me(i.groups[h]))throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");let s=[];for(let h of a.ambiguousRuns){let E=h.groupNames.map(ae=>i.groups[ae]).join(""),D=Se(E,h.tokens);if(D.length>1){if(!n.lenient)throw new Error(`temporal-fmt: "${E}" in format string "${e}" is ambiguous \u2014 ${D.length} different ways to read tokens "${h.tokens.join("")}" (with no separator between them) are all individually valid (e.g. ${JSON.stringify(D[0])} vs ${JSON.stringify(D[1])}). parse() won't guess; add a separator between these tokens, or use their padded form (e.g. "MM" instead of "M") so each one has a fixed width. Pass { lenient: true } to opt into a documented heuristic that picks one.`);s.push({groupNames:h.groupNames,values:Et(D,h.tokens)})}}let m={},c=new Map;for(let{groupNames:h,values:E}of s)h.forEach((D,ae)=>c.set(D,String(E[ae])));for(let{name:h,token:E}of a.groups){let D=c.get(h)??i.groups[h];kt(m,E,D,r,e)}let u=Tt(m),l=Dt(m,e,r),{month:d,day:f,minute:p,second:w,millisecond:b,timeZoneId:y,weekdayExpected:T,weekdayRaw:Ie,quarter:te}=m,Ce=u!==void 0||d!==void 0||f!==void 0,v=u!==void 0&&d!==void 0&&f!==void 0;if(Ce&&!v)throw new Error(`temporal-fmt: format string "${e}" has an incomplete date \u2014 year, month, and day tokens must all be present together.`);let ne=l!==void 0||p!==void 0||w!==void 0||b!==void 0;if(y!==void 0&&!(v&&ne))throw new Error(`temporal-fmt: format string "${e}" has a "zzz" token but needs a full date and time to build a ZonedDateTime.`);if(T!==void 0&&!v)throw new Error(`temporal-fmt: format string "${e}" has a weekday token ("EEEE"/"EEE") but needs a full date to validate it against.`);if(!v&&!ne)throw new Error(`temporal-fmt: format string "${e}" has no date or time tokens to parse.`);let j=F(),re={hour:l??0,minute:p??0,second:w??0,millisecond:b??0},oe=o?{calendar:o}:{},z={overflow:"reject"},S;try{y!==void 0?S=j.ZonedDateTime.from({year:u,month:d,day:f,...re,...oe,timeZone:y},z):v&&ne?S=j.PlainDateTime.from({year:u,month:d,day:f,...re,...oe},z):v?S=j.PlainDate.from({year:u,month:d,day:f,...oe},z):S=j.PlainTime.from(re,z)}catch(h){throw new Error(`temporal-fmt: "${t}" doesn't describe a valid date/time for format "${e}": ${h.message}`)}if(T!==void 0){let h=S.dayOfWeek;if(h!==T){let E=N(r);throw new Error(`temporal-fmt: "${Ie}" doesn't match the actual weekday (${E.weekdayLong[h-1]}) for the parsed date.`)}}if(te!==void 0&&d!==void 0){let h=Math.ceil(d/3);if(te!==h)throw new Error(`temporal-fmt: format string "${e}" contains a quarter token (Q/QQQ) whose value (Q${te}) disagrees with the parsed month's actual quarter \u2014 month ${d} is in Q${h}.`)}return S}var Oe={y:{longSingular:"year",longPlural:"years",shortSingular:"yr",shortPlural:"yrs",field:"years"},o:{longSingular:"month",longPlural:"months",shortSingular:"mo",shortPlural:"mos",field:"months"},w:{longSingular:"week",longPlural:"weeks",shortSingular:"wk",shortPlural:"wks",field:"weeks"},d:{longSingular:"day",longPlural:"days",shortSingular:"d",shortPlural:"d",field:"days"},h:{longSingular:"hour",longPlural:"hours",shortSingular:"h",shortPlural:"h",field:"hours"},m:{longSingular:"minute",longPlural:"minutes",shortSingular:"m",shortPlural:"m",field:"minutes"},s:{longSingular:"second",longPlural:"seconds",shortSingular:"s",shortPlural:"s",field:"seconds"},S:{longSingular:"millisecond",longPlural:"milliseconds",shortSingular:"ms",shortPlural:"ms",field:"milliseconds"}},xt=Object.keys(Oe).flatMap(e=>[e+e+e,e+e,e]).sort((e,t)=>t.length-e.length);function Mt(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r==="'"){if(e[n+1]==="'"){ce(t,"'"),n+=2;continue}let a=n+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in duration format string "${e}"`);ce(t,i),n=a;continue}let o=xt.find(a=>e.startsWith(a,n));if(o){let a=o[0],i=o.length===1?"numeric":o.length===2?"short":"long";t.push({kind:"token",value:o,unit:a,form:i}),n+=o.length;continue}ce(t,r),n+=1}return t}function ce(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}function Pt(e,t){let n=e[t];if(n==null)return 0;if(typeof n=="number"&&Number.isFinite(n))return n;let r=Number(n);if(!Number.isFinite(r))throw new Error(`temporal-fmt: duration field "${t}" is not a finite number (got ${String(n)}).`);return r}function Le(e,t,n={}){if(t.length>1e3)throw new Error(`temporal-fmt: duration format string exceeds maximum length of ${1e3} characters (got ${t.length}).`);n.locale;let r=n.showZeroValues===!0,o=Mt(t),a="";for(let i of o){if(i.kind==="literal"){a+=i.value;continue}let s=Oe[i.unit];if(!s)throw new Error(`temporal-fmt: unknown duration token "${i.value}"`);let m=Pt(e,s.field);m===0&&!r||(i.form==="numeric"?a+=String(m):i.form==="short"?a+=m+(m===1||m===-1?s.shortSingular:s.shortPlural):a+=m+" "+(m===1||m===-1?s.longSingular:s.longPlural))}return a}function Ne(e,t){if(e===null||typeof e!="object")throw new Error(`temporal-fmt: formatDistance expects Temporal values, got ${t} = ${String(e)}.`);let n=e,r=typeof n.year=="number",o=typeof n.month=="number",a=typeof n.day=="number";if(r!==o||o!==a)throw new Error(`temporal-fmt: formatDistance got a ${t} with a partial date (some of year/month/day missing). Pass a full Temporal.PlainDate / PlainDateTime / ZonedDateTime.`);return{year:r?n.year:void 0,month:o?n.month:void 0,day:a?n.day:void 0,hour:typeof n.hour=="number"?n.hour:void 0,minute:typeof n.minute=="number"?n.minute:void 0,second:typeof n.second=="number"?n.second:void 0,millisecond:typeof n.millisecond=="number"?n.millisecond:void 0}}var fe=2e3,he=1e3,G=60*he,X=60*G,x=24*X;function vt(e,t,n){let r=0;if(e>=fe)for(let o=fe;o<e;o++)r+=I(o)?366:365;else for(let o=e;o<fe;o++)r-=I(o)?366:365;return r+=ue(e,t,n)-1,r}function Re(e){if(e.year===void 0||e.month===void 0||e.day===void 0)throw new Error("temporal-fmt: formatDistance needs a Temporal value with year/month/day fields (PlainDate, PlainDateTime, or ZonedDateTime). A PlainTime or other shape has no anchor date to diff against.");let t=vt(e.year,e.month,e.day),n=e.hour??0,r=e.minute??0,o=e.second??0,a=e.millisecond??0;return t*x+n*X+r*G+o*he+a}var St=[{maxMs:G,unit:"second"},{maxMs:X,unit:"minute"},{maxMs:x,unit:"hour"},{maxMs:30*x,unit:"day"},{maxMs:365*x,unit:"month"}],H=new Map,Ft=100;function $t(e,t){let n=`${Ot(e)}|${t}`,r=H.get(n);if(r)return r;if(H.size>=Ft){let o=H.keys().next().value;o!==void 0&&H.delete(o)}return r=new Intl.RelativeTimeFormat(e,{numeric:t}),H.set(n,r),r}function Ot(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function Ae(e,t,n={}){let r=Ne(e,"date1"),o=Ne(t,"date2"),a=Re(r)-Re(o),i=Math.abs(a),s="year";for(let{maxMs:f,unit:p}of St)if(i<f){s=p;break}let m=Lt(s),c=Math.round(a/m),u=n.numeric??"auto",l=n.locale??R;return $t(l,u).format(c,s)}function Lt(e){switch(e){case"second":return he;case"minute":return G;case"hour":return X;case"day":return x;case"week":return 7*x;case"month":return 30*x;case"quarter":return 91*x;case"year":return 365*x;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}var pe=["January","February","March","April","May","June","July","August","September","October","November","December"],Nt=pe.flatMap((e,t)=>[[e,t+1],[e.slice(0,3),t+1]]),Rt=Nt.map(([e])=>e).join("|"),ye=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],At=ye.join("|");function _t(e){let t=e.toLowerCase(),n=ye.find(r=>r.toLowerCase()===t);return ye.indexOf(n??e)+1}function It(e){let t=e.toLowerCase(),n=pe.findIndex(o=>o.toLowerCase()===t);return n>=0?n+1:pe.findIndex(o=>o.slice(0,3).toLowerCase()===t)+1}function Ct(e){let t=e.dayOfWeek;if(typeof t!="number")throw new Error("temporal-fmt: parseRelative needs a reference date exposing dayOfWeek (a Temporal.PlainDate / PlainDateTime / ZonedDateTime).");return t}function B(e){if(typeof e.year!="number")throw new Error("temporal-fmt: parseRelative reference date is missing year.");return e.year}function J(e){if(typeof e.month!="number")throw new Error("temporal-fmt: parseRelative reference date is missing month.");return e.month}function ee(e){if(typeof e.day!="number")throw new Error("temporal-fmt: parseRelative reference date is missing day.");return e.day}function _e(e,t,n={}){n.locale;let r=t,o=F(),a=(e??"").trim().replace(/\s+/g," ");if(a.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");let i=a.toLowerCase();if(i==="today")return Vt(o,B(r),J(r),ee(r));if(i==="tomorrow")return ge(o,r,1);if(i==="yesterday")return ge(o,r,-1);let s=a.match(new RegExp(`^(next|last|this)\\s+(${At})$`,"i"));if(s){let u=s[1].toLowerCase(),l=s[2],d=Ct(r),f=_t(l),p=Ut(u,d,f);return ge(o,r,p)}let m=a.match(/^(in\s+)?(\d+)\s+(day|week|month|year)s?(?:\s+ago)?$/i);if(m){let u=m[1],l=m[2],d=m[3].toLowerCase(),f=!!u,p=/\bago\b/i.test(a);if(!f&&!p)throw new Error(`temporal-fmt: parseRelative can't tell whether "${a}" is past or future \u2014 use "in ${l} ${d}s" or "${l} ${d}s ago".`);return Yt(o,r,(f?1:-1)*Number(l),d)}let c=a.match(new RegExp(`^(${Rt})\\s+(\\d{1,2})(?:st|nd|rd|th)?(?:,?\\s*(\\d{4}))?$`,"i"));if(c){let u=c[1],l=c[2],d=It(u),f=Number(l);return Zt(o,r,d,f)}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${a}". Supported: weekday refs ("next Tuesday"), day offsets ("today"/"tomorrow"/"yesterday"), unit offsets ("in 3 days", "2 weeks ago"), and month-day ("March 5th").`)}function Ut(e,t,n){if(e==="next"){let r=n-t;return r<=0&&(r+=7),r}if(e==="last"){let r=n-t;return r>=0&&(r-=7),r}return n-t}function Vt(e,t,n,r){return e.PlainDate.from({year:t,month:n,day:r},{overflow:"reject"})}function ge(e,t,n){return e.PlainDate.from({year:B(t),month:J(t),day:ee(t)}).add({days:n})}function Yt(e,t,n,r){let o=e.PlainDate.from({year:B(t),month:J(t),day:ee(t)}),a={};return r==="day"&&(a.days=n),r==="week"&&(a.weeks=n),r==="month"&&(a.months=n),r==="year"&&(a.years=n),o.add(a)}function Zt(e,t,n,r){let o=B(t),a=e.PlainDate.from({year:o,month:J(t),day:ee(t)});try{let i=e.PlainDate.from({year:o,month:n,day:r},{overflow:"reject"});if(!e.PlainDate.compare)throw new Error("temporal-fmt: parseRelative needs Temporal.PlainDate.compare to resolve month-day phrases; the active implementation does not expose it.");return e.PlainDate.compare(i,a)>=0?i:e.PlainDate.from({year:o+1,month:n,day:r},{overflow:"reject"})}catch(i){try{return e.PlainDate.from({year:o+1,month:n,day:r},{overflow:"reject"})}catch{throw new Error(`temporal-fmt: parseRelative can't resolve month ${n} day ${r} \u2014 it isn't a valid date in either ${o} or ${o+1}. Original error: ${i.message}`)}}}0&&(module.exports={format,formatDistance,formatDuration,parse,parseRelative,registerLocaleVocab,setTemporal});
1
+ "use strict";var me=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var je=(e,t)=>{for(var n in t)me(e,n,{get:t[n],enumerable:!0})},ze=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ze(t))!He.call(e,o)&&o!==n&&me(e,o,{get:()=>t[o],enumerable:!(r=Ye(t,o))||r.enumerable});return e};var Ke=e=>ze(me({},"__esModule",{value:!0}),e);var Kt={};je(Kt,{format:()=>Me,formatDistance:()=>Ce,formatDuration:()=>Re,parse:()=>Oe,parseRelative:()=>Ie,registerLocaleVocab:()=>De,setTemporal:()=>Te});module.exports=Ke(Kt);var be,ke=[];function Ee(e){ke.push(e)}function Te(e){be=e;for(let t of ke)t()}function We(){return be??globalThis.Temporal}function F(){let e=We();if(!e)throw new Error("temporal-fmt: parse() needs a Temporal implementation to construct its result. Call setTemporal(Temporal) once at startup, or assign one to globalThis.Temporal (native on Node 26+, or a polyfill like temporal-polyfill).");return e}var ue=new Map;function Qe(e,t){let n=[{key:"monthLong",length:12,label:"long month names"},{key:"monthShort",length:12,label:"short month names"},{key:"weekdayLong",length:7,label:"long weekday names"},{key:"weekdayShort",length:7,label:"short weekday names"},{key:"dayPeriod",length:2,label:"day period markers (AM/PM-equivalent)"}];for(let{key:r,length:o,label:a}of n){let i=e[r];if(i===void 0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}" is missing required field "${r}" (${a}).`);if(!Array.isArray(i))throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}" must be an array, got ${typeof i}.`);if(i.length!==o)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}" must have exactly ${o} entries (got ${i.length}) \u2014 ${a}.`);i.forEach((s,m)=>{if(typeof s!="string"||s.length===0)throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": "${r}[${m}]" must be a non-empty string, got ${String(s)}.`)})}if(D(e.monthLong,"MMMM month",t),D(e.monthShort,"MMM month",t),D(e.weekdayLong,"EEEE weekday",t),D(e.weekdayShort,"EEE weekday",t),e.dayPeriod[0]===e.dayPeriod[1])throw new Error(`temporal-fmt: registerLocaleVocab for locale "${t}": dayPeriod entries must differ (both are "${e.dayPeriod[0]}"); otherwise parse() can't tell AM from PM.`)}function De(e,t){if(typeof e!="string"||e.length===0)throw new Error(`temporal-fmt: registerLocaleVocab requires a non-empty locale string, got ${String(e)}.`);Qe(t,e);let n=M(e);ue.set(n,{monthLong:[...t.monthLong],monthShort:[...t.monthShort],weekdayLong:[...t.weekdayLong],weekdayShort:[...t.weekdayShort],dayPeriod:[...t.dayPeriod]}),L.delete(n)}function M(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}var L=new Map,qe=500;function $(e,t,n){let r=e.formatToParts(t),o=r.findIndex(m=>m.type===n);if(o===-1)throw new Error(`temporal-fmt: locale produced no "${n}" part while building match vocabulary.`);let a=r[o].value,i=r[o-1],s=r[o+1];return i?.type==="literal"&&!/\s/.test(i.value)&&(a=i.value+a),s?.type==="literal"&&!/\s/.test(s.value)&&(a=a+s.value),a}function D(e,t,n){let r=new Map;for(let o=0;o<e.length;o++){let a=r.get(e[o]);if(a!==void 0)throw new Error(`temporal-fmt: locale "${n}" renders ${t} index ${a} and ${o} identically ("${e[o]}"). parse() can't reliably tell these apart for this locale/token, so this combination isn't supported.`);r.set(e[o],o)}}function O(e){let t=M(e);return ue.get(t)}function N(e){let t=M(e),n=ue.get(t);if(n)return n;let r=L.get(t);if(r)return r;let o=new Intl.DateTimeFormat(e,{month:"long",timeZone:"UTC"}),a=new Intl.DateTimeFormat(e,{month:"short",timeZone:"UTC"}),i=[],s=[];for(let w=0;w<12;w++){let x=new Date(Date.UTC(2020,w,1));i.push($(o,x,"month")),s.push($(a,x,"month"))}D(i,"MMMM month",e),D(s,"MMM month",e);let m=new Intl.DateTimeFormat(e,{weekday:"long",timeZone:"UTC"}),l=new Intl.DateTimeFormat(e,{weekday:"short",timeZone:"UTC"}),u=[],c=[];for(let w=0;w<7;w++){let x=new Date(Date.UTC(2024,0,1+w));u.push($(m,x,"weekday")),c.push($(l,x,"weekday"))}D(u,"EEEE weekday",e),D(c,"EEE weekday",e);let d=new Intl.DateTimeFormat(e,{hour:"numeric",hour12:!0,timeZone:"UTC"}),f=$(d,new Date(Date.UTC(2020,0,1,1)),"dayPeriod"),y=$(d,new Date(Date.UTC(2020,0,1,13)),"dayPeriod"),S=[...new Set([f,y])],b={monthLong:i,monthShort:s,weekdayLong:u,weekdayShort:c,dayPeriod:S};if(L.size>=qe){let w=L.keys().next().value;w!==void 0&&L.delete(w)}return L.set(t,b),b}var Ge=[0,31,59,90,120,151,181,212,243,273,304,334];function C(e){return e%4===0&&e%100!==0||e%400===0}function A(e){return C(e)?366:365}function ce(e,t,n){let r=Ge[t-1]+n;return t>2&&C(e)&&(r+=1),r}var de=2e3;function Xe(e){let t=0;if(e>=de)for(let r=de;r<e;r++)t+=A(r);else for(let r=e;r<de;r++)t-=A(r);return((5+t)%7+7)%7+1}function le(e,t,n,r){let a=ce(e,t,n)+(4-r),i,s;a<1?(i=e-1,s=a+A(i)):a>A(e)?(i=e+1,s=a-A(e)):(i=e,s=a);let l=1+(4-Xe(i)+7)%7,u=1+Math.floor((s-l)/7);return{isoYear:i,week:u}}function g(e,t){let n=e<0,r=String(Math.abs(e)).padStart(t,"0");return n?"-"+r:r}g.fraction=function(t,n){let r=t.millisecond*1e6+(t.microsecond??0)*1e3+(t.nanosecond??0);return g(r,9).slice(0,n)};var R="en-US",I=new Map,Be=500;function xe(e,t){let n=JSON.stringify([M(e),t]),r=I.get(n);if(r)return r;if(I.size>=Be){let o=I.keys().next().value;o!==void 0&&I.delete(o)}return r=new Intl.DateTimeFormat(e,t),I.set(n,r),r}var U;Ee(()=>{U=void 0});function Je(){if(U===void 0){U=!1;try{let e=F();new Intl.DateTimeFormat("en-US",{day:"numeric"}).formatToParts(e.PlainDate.from({year:1970,month:1,day:1})),U=!0}catch{}}return U}function et(e,t,n,r){let o=e?.calendarId,a={...n,calendar:o&&o!=="iso8601"?o:"gregory"};if(!Je())return e.toLocaleString(t,a);let{toInstant:i,timeZoneId:s}=e,m=typeof i=="function"&&typeof s=="string",l=m?e.toInstant():e,u={...a,...m?{timeZone:s}:{}},d=xe(t,u).formatToParts(l),f=d.findIndex(w=>w.type===r);if(f===-1)throw new Error(`temporal-fmt: locale "${t}" produced no "${r}" part for this token. This usually means the Temporal object is missing the field the token needs.`);let y=d[f].value,S=d[f-1],b=d[f+1];return S?.type==="literal"&&!/\s/.test(S.value)&&(y=S.value+y),b?.type==="literal"&&!/\s/.test(b.value)&&(y=y+b.value),y}function tt(e,t){let n=O(t);if(n)return e<12?n.dayPeriod[0]:n.dayPeriod[1];let r=new Date(Date.UTC(1970,0,1,e)),a=xe(t,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(r).find(i=>i.type==="dayPeriod");if(!a)throw new Error(`temporal-fmt: locale "${t}" produced no "dayPeriod" part for token "a".`);return a.value}function K(e,t,n,r,o,a){return o&&a!==void 0&&a>=0&&a<o.length?o[a]:et(e,t,n,r)}var W=[["yyyy",e=>g(e.year,4),"year"],["yy",e=>{if(e.year<0)throw new Error(`temporal-fmt: token "yy" doesn't support negative years (got ${e.year}), since truncating to 2 digits would make it indistinguishable from a positive year. Use "yyyy" instead.`);return g(e.year%100,2)},"year"],["MMMM",(e,t)=>{let n=O(t);return K(e,t,{month:"long"},"month",n?.monthLong,e.month-1)},"month"],["MMM",(e,t)=>{let n=O(t);return K(e,t,{month:"short"},"month",n?.monthShort,e.month-1)},"month"],["MM",e=>g(e.month,2),"month"],["M",e=>String(e.month),"month"],["dd",e=>g(e.day,2),"day"],["d",e=>String(e.day),"day"],["EEEE",(e,t)=>{let n=O(t);return K(e,t,{weekday:"long"},"weekday",n?.weekdayLong,e.dayOfWeek-1)},"dayOfWeek"],["EEE",(e,t)=>{let n=O(t);return K(e,t,{weekday:"short"},"weekday",n?.weekdayShort,e.dayOfWeek-1)},"dayOfWeek"],["HH",e=>g(e.hour,2),"hour"],["H",e=>String(e.hour),"hour"],["hh",e=>g(e.hour%12||12,2),"hour"],["h",e=>String(e.hour%12||12),"hour"],["mm",e=>g(e.minute,2),"minute"],["m",e=>String(e.minute),"minute"],["ss",e=>g(e.second,2),"second"],["s",e=>String(e.second),"second"],["SSSSSSSSS",e=>g.fraction(e,9),"millisecond"],["SSSSSSSS",e=>g.fraction(e,8),"millisecond"],["SSSSSSS",e=>g.fraction(e,7),"millisecond"],["SSSSSS",e=>g.fraction(e,6),"millisecond"],["SSSSS",e=>g.fraction(e,5),"millisecond"],["SSSS",e=>g.fraction(e,4),"millisecond"],["SSS",e=>g.fraction(e,3),"millisecond"],["SS",e=>g.fraction(e,2),"millisecond"],["S",e=>g.fraction(e,1),"millisecond"],["a",(e,t)=>tt(e.hour,t),"hour"],["zzz",e=>e.timeZoneId,"timeZoneId"],["do",e=>{let t=e.day,n=t%10,r=t%100;return r>=11&&r<=13?t+"th":n===1?t+"st":n===2?t+"nd":n===3?t+"rd":t+"th"},"day"],["Q",e=>String(Math.ceil(e.month/3)),"month"],["QQQ",e=>"Q"+Math.ceil(e.month/3),"month"],["ww",e=>{let{week:t}=le(e.year,e.month,e.day,e.dayOfWeek);return g(t,2)},"dayOfWeek"],["RRRR",e=>{let{isoYear:t}=le(e.year,e.month,e.day,e.dayOfWeek);return g(t,4)},"dayOfWeek"]];var nt=W.map(([e])=>e).sort((e,t)=>t.length-e.length);function Q(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r==="'"){if(e[n+1]==="'"){fe(t,"'"),n+=2;continue}let a=n+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in format string "${e}"`);fe(t,i),n=a;continue}let o=nt.find(a=>e.startsWith(a,n));if(o){t.push({kind:"token",value:o}),n+=o.length;continue}fe(t,r),n+=1}return t}function fe(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}var rt=new Map(W.map(([e,t,n])=>[e,{fn:t,field:n}]));function Me(e,t,n={}){if(t.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${t.length}).`);let r=n.locale??R,o=Q(t),a="";for(let i of o){if(i.kind==="literal"){a+=i.value;continue}let s=rt.get(i.value);if(!s)throw new Error(`temporal-fmt: unknown token "${i.value}"`);if(e[s.field]===void 0)throw new Error(`temporal-fmt: token "${i.value}" requires "${s.field}", which this Temporal object doesn't have. (e.g. PlainDate has no time fields, PlainTime has no date fields)`);a+=s.fn(e,r)}return a}function ot(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(e,t=!1){let n=e.map(ot);return t?`(?:${n.map(at).join("|")})`:`(?:${n.join("|")})`}function at(e){return e.replace(/[a-zA-Z]/g,t=>`[${t.toLowerCase()}${t.toUpperCase()}]`)}var it="(?:UTC|[+-]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?|[A-Za-z_]+(?:[+-]\\d{1,2})?(?:\\/[A-Za-z0-9_+-]+)*)";function st(){return it}var q;function mt(){return q||(q=new Set(Intl.supportedValuesOf("timeZone")),q.add("UTC")),q}var ut=/^[+-]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/;function Pe(e){return ut.test(e)||mt().has(e)}var dt={yy:"\\d{2}",MM:"(?:0[1-9]|1[0-2])",M:"(?:1[0-2]|[1-9])",dd:"(?:0[1-9]|[12]\\d|3[01])",d:"(?:[12]\\d|3[01]|[1-9])",HH:"(?:[01]\\d|2[0-3])",H:"(?:1\\d|2[0-3]|[0-9])",hh:"(?:0[1-9]|1[0-2])",h:"(?:1[0-2]|[1-9])",mm:"(?:[0-5]\\d)",m:"(?:[1-5]\\d|[0-9])",ss:"(?:[0-5]\\d)",s:"(?:[1-5]\\d|[0-9])",SSSSSSSSS:"\\d{9}",SSSSSSSS:"\\d{8}",SSSSSSS:"\\d{7}",SSSSSS:"\\d{6}",SSSSS:"\\d{5}",SSSS:"\\d{4}",SSS:"\\d{3}",SS:"\\d{2}",S:"\\d",Q:"[1-4]"},ct="Q[1-4]",lt=new Set(["do","ww","RRRR"]),ft="-?\\d{4}",ht="-?\\d{4,}",gt=new Set(["yyyy","yy","MM","M","dd","d","HH","H","hh","h","mm","m","ss","s","SSSSSSSSS","SSSSSSSS","SSSSSSS","SSSSSS","SSSSS","SSSS","SSS","SS","S"]);function ve(e,t,n){if(e==="yyyy")return n!==void 0&&gt.has(n)?ft:ht;let r=dt[e];if(r)return r;if(e==="QQQ")return ct;if(lt.has(e))throw new Error(`temporal-fmt: token "${e}" is format-only \u2014 it can't be parsed back into a value. Use a different token in the parse format string (e.g. "d" for "do", "MM" for "ww").`);let o=N(t);switch(e){case"MMMM":return Y(o.monthLong);case"MMM":return Y(o.monthShort);case"EEEE":return Y(o.weekdayLong);case"EEE":return Y(o.weekdayShort);case"a":return Y(o.dayPeriod,!0);case"zzz":return st();default:throw new Error(`temporal-fmt: unknown token "${e}"`)}}var Fe=new Set(["M","d","H","h","m","s"]),pt={M:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],d:[{digits:1,min:1,max:9},{digits:2,min:10,max:31}],H:[{digits:1,min:0,max:9},{digits:2,min:10,max:23}],h:[{digits:1,min:1,max:9},{digits:2,min:10,max:12}],m:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}],s:[{digits:1,min:0,max:9},{digits:2,min:10,max:59}]};function $e(e,t){let n=new Map;function r(o,a){let i=`${o}:${a}`,s=n.get(i);if(s)return s;if(o===t.length){let c=a===e.length?[[]]:[];return n.set(i,c),c}let m=t[o],l=pt[m];if(!l)throw new Error(`temporal-fmt: internal error \u2014 "${m}" is not an unpadded numeric token`);let u=[];for(let{digits:c,min:d,max:f}of l){if(a+c>e.length)continue;let y=e.slice(a,a+c);if(c===2&&y[0]==="0")continue;let S=Number(y);if(!(S<d||S>f)){for(let b of r(o+1,a+c))if(u.push([S,...b]),u.length===2)break;if(u.length===2)break}}return n.set(i,u),u}return r(0,0)}function yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Le(e,t){let n=[],r=[],o="",a=0,i={groupNames:[],tokens:[]},s=()=>{i.tokens.length>=2&&r.push(i),i={groupNames:[],tokens:[]}};for(let[m,l]of e.entries()){if(l.kind==="literal"){o+=yt(l.value),s();continue}let u=`g${a++}`;n.push({name:u,token:l.value});let c=e[m+1],d=c?.kind==="token"?c.value:void 0;o+=`(?<${u}>${ve(l.value,t,d)})`,Fe.has(l.value)?(i.groupNames.push(u),i.tokens.push(l.value)):s()}return s(),{regex:new RegExp(`^(?:${o})$`,"u"),groups:n,ambiguousRuns:r}}var Z=new Map,St=500;function bt(e,t){let n=JSON.stringify([M(t),e]),r=Z.get(n);if(r)return r;if(Z.size>=St){let o=Z.keys().next().value;o!==void 0&&Z.delete(o)}return r=Le(Q(e),t),Z.set(n,r),r}var _=new Map,kt=500;function Et(e){let t=new Intl.Locale(e).toString().toLowerCase();if(_.has(t))return _.get(t);if(_.size>=kt){let i=_.keys().next().value;i!==void 0&&_.delete(i)}let n,r=t.split("-"),o=r.indexOf("u"),a=o===-1?-1:r.indexOf("ca",o+1);if(a!==-1&&a+1<r.length){let i=new Intl.DateTimeFormat(t).resolvedOptions().calendar;n=i==="gregory"?void 0:i}return _.set(t,n),n}function h(e,t,n){e[t]=n}function Tt(e,t,n,r,o){let a=N(r);switch(t){case"yyyy":h(e,"year",Number(n));break;case"yy":h(e,"twoDigitYear",Number(n));break;case"MM":case"M":h(e,"month",Number(n));break;case"MMMM":h(e,"month",a.monthLong.indexOf(n)+1);break;case"MMM":h(e,"month",a.monthShort.indexOf(n)+1);break;case"dd":case"d":h(e,"day",Number(n));break;case"EEEE":h(e,"weekdayRaw",n),h(e,"weekdayExpected",a.weekdayLong.indexOf(n)+1);break;case"EEE":h(e,"weekdayRaw",n),h(e,"weekdayExpected",a.weekdayShort.indexOf(n)+1);break;case"HH":case"H":h(e,"hour",Number(n));break;case"hh":case"h":h(e,"hour12",Number(n));break;case"mm":case"m":h(e,"minute",Number(n));break;case"ss":case"s":h(e,"second",Number(n));break;case"S":case"SS":case"SSS":case"SSSS":case"SSSSS":case"SSSSSS":case"SSSSSSS":case"SSSSSSSS":case"SSSSSSSSS":{let i=Number(n.padEnd(9,"0"));h(e,"millisecond",Math.floor(i/1e6)),h(e,"microsecond",Math.floor(i/1e3)%1e3),h(e,"nanosecond",i%1e3);break}case"a":{let i=a.dayPeriod.findIndex(s=>s.toLowerCase()===n.toLowerCase());if(i<0)throw new Error(`temporal-fmt: unknown day period "${n}" for locale "${r}".`);h(e,"dayPeriodRaw",n),h(e,"isPM",i===1);break}case"zzz":h(e,"timeZoneId",n);break;case"Q":h(e,"quarter",Number(n));break;case"QQQ":h(e,"quarter",Number(n.slice(1)));break}}function Dt(e,t){let n=t.indexOf("d");if(n!==-1){let r=e.filter(o=>o[n]<=12);if(r.length>0)return r[0]}return e[0]}function xt(e){if(e.year!==void 0&&e.twoDigitYear!==void 0)throw new Error('temporal-fmt: format string mixes "yyyy" and "yy" year representations.');if(e.year!==void 0)return e.year;if(e.twoDigitYear!==void 0)return e.twoDigitYear<=68?2e3+e.twoDigitYear:1900+e.twoDigitYear}function Mt(e,t,n){if(e.hour!==void 0&&e.hour12!==void 0)throw new Error(`temporal-fmt: format string "${t}" mixes a 24-hour token ("HH"/"H") with a 12-hour token ("hh"/"h").`);if(e.hour!==void 0){if(e.dayPeriodRaw!==void 0){let r=N(n),o=e.hour<12?r.dayPeriod[0]:r.dayPeriod[1];if(e.dayPeriodRaw.toLowerCase()!==o?.toLowerCase())throw new Error(`temporal-fmt: format string "${t}" contains a day period that contradicts the 24-hour value.`)}return e.hour}if(e.hour12!==void 0){if(e.isPM===void 0)throw new Error(`temporal-fmt: format string "${t}" uses a 12-hour token ("hh"/"h") without an "a" token, so parse() can't tell AM from PM.`);return e.hour12%12+(e.isPM?12:0)}}function Oe(e,t,n={}){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);if(t.length>1e5)throw new Error(`temporal-fmt: input exceeds maximum length of ${1e5} characters (got ${t.length}).`);let r=n.locale??R,o=Et(r),a=bt(e,r),i=a.regex.exec(t);if(!i)throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");if(a.groups.length===0)throw new Error(`temporal-fmt: format string "${e}" has no tokens \u2014 nothing to parse into a value.`);for(let{name:p,token:k}of a.groups)if(k==="zzz"&&!Pe(i.groups[p]))throw new Error("temporal-fmt: no valid pattern matches the format string and input shape");let s=[];for(let p of a.ambiguousRuns){let k=p.groupNames.map(se=>i.groups[se]).join(""),E=$e(k,p.tokens);if(E.length>1){if(!n.lenient)throw new Error(`temporal-fmt: "${k}" in format string "${e}" is ambiguous \u2014 ${E.length} different ways to read tokens "${p.tokens.join("")}" (with no separator between them) are all individually valid (e.g. ${JSON.stringify(E[0])} vs ${JSON.stringify(E[1])}). parse() won't guess; add a separator between these tokens, or use their padded form (e.g. "MM" instead of "M") so each one has a fixed width. Pass { lenient: true } to opt into a documented heuristic that picks one.`);s.push({groupNames:p.groupNames,values:Dt(E,p.tokens)})}}let m={},l=new Map;for(let{groupNames:p,values:k}of s)p.forEach((E,se)=>l.set(E,String(k[se])));for(let{name:p,token:k}of a.groups){let E=l.get(p)??i.groups[p];Tt(m,k,E,r,e)}let u=xt(m),c=Mt(m,e,r),{month:d,day:f,minute:y,second:S,millisecond:b,microsecond:w,nanosecond:x,timeZoneId:te,weekdayExpected:ne,weekdayRaw:Ue,quarter:re}=m,Ve=u!==void 0||d!==void 0||f!==void 0,P=u!==void 0&&d!==void 0&&f!==void 0;if(Ve&&!P)throw new Error(`temporal-fmt: format string "${e}" has an incomplete date \u2014 year, month, and day tokens must all be present together.`);let oe=c!==void 0||y!==void 0||S!==void 0||b!==void 0;if(te!==void 0&&!(P&&oe))throw new Error(`temporal-fmt: format string "${e}" has a "zzz" token but needs a full date and time to build a ZonedDateTime.`);if(ne!==void 0&&!P)throw new Error(`temporal-fmt: format string "${e}" has a weekday token ("EEEE"/"EEE") but needs a full date to validate it against.`);if(!P&&!oe)throw new Error(`temporal-fmt: format string "${e}" has no date or time tokens to parse.`);let j=F(),ae={hour:c??0,minute:y??0,second:S??0,millisecond:b??0,microsecond:w??0,nanosecond:x??0},ie=o?{calendar:o}:{},z={overflow:"reject"},v;try{te!==void 0?v=j.ZonedDateTime.from({year:u,month:d,day:f,...ae,...ie,timeZone:te},z):P&&oe?v=j.PlainDateTime.from({year:u,month:d,day:f,...ae,...ie},z):P?v=j.PlainDate.from({year:u,month:d,day:f,...ie},z):v=j.PlainTime.from(ae,z)}catch(p){throw new Error(`temporal-fmt: "${t}" doesn't describe a valid date/time for format "${e}": ${p.message}`)}if(ne!==void 0){let p=v.dayOfWeek;if(p!==ne){let k=N(r);throw new Error(`temporal-fmt: "${Ue}" doesn't match the actual weekday (${k.weekdayLong[p-1]}) for the parsed date.`)}}if(re!==void 0&&d!==void 0){let p=Math.ceil(d/3);if(re!==p)throw new Error(`temporal-fmt: format string "${e}" contains a quarter token (Q/QQQ) whose value (Q${re}) disagrees with the parsed month's actual quarter \u2014 month ${d} is in Q${p}.`)}return v}var Ne={y:{longSingular:"year",longPlural:"years",shortSingular:"yr",shortPlural:"yrs",field:"years"},o:{longSingular:"month",longPlural:"months",shortSingular:"mo",shortPlural:"mos",field:"months"},w:{longSingular:"week",longPlural:"weeks",shortSingular:"wk",shortPlural:"wks",field:"weeks"},d:{longSingular:"day",longPlural:"days",shortSingular:"d",shortPlural:"d",field:"days"},h:{longSingular:"hour",longPlural:"hours",shortSingular:"h",shortPlural:"h",field:"hours"},m:{longSingular:"minute",longPlural:"minutes",shortSingular:"m",shortPlural:"m",field:"minutes"},s:{longSingular:"second",longPlural:"seconds",shortSingular:"s",shortPlural:"s",field:"seconds"},S:{longSingular:"millisecond",longPlural:"milliseconds",shortSingular:"ms",shortPlural:"ms",field:"milliseconds"}},Pt=Object.keys(Ne).flatMap(e=>[e+e+e,e+e,e]).sort((e,t)=>t.length-e.length);function vt(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r==="'"){if(e[n+1]==="'"){he(t,"'"),n+=2;continue}let a=n+1,i="",s=!1;for(;a<e.length;){if(e[a]==="'"){if(e[a+1]==="'"){i+="'",a+=2;continue}s=!0,a+=1;break}i+=e[a],a+=1}if(!s)throw new Error(`temporal-fmt: unterminated quote in duration format string "${e}"`);he(t,i),n=a;continue}let o=Pt.find(a=>e.startsWith(a,n));if(o){let a=o[0],i=o.length===1?"numeric":o.length===2?"short":"long";t.push({kind:"token",value:o,unit:a,form:i}),n+=o.length;continue}he(t,r),n+=1}return t}function he(e,t){let n=e[e.length-1];n&&n.kind==="literal"?n.value+=t:e.push({kind:"literal",value:t})}function Ft(e,t){let n=e[t];if(n==null)return 0;if(typeof n=="number"&&Number.isFinite(n))return n;let r=Number(n);if(!Number.isFinite(r))throw new Error(`temporal-fmt: duration field "${t}" is not a finite number (got ${String(n)}).`);return r}function Re(e,t,n={}){if(t.length>1e3)throw new Error(`temporal-fmt: duration format string exceeds maximum length of ${1e3} characters (got ${t.length}).`);n.locale;let r=n.showZeroValues===!0,o=vt(t),a="";for(let i of o){if(i.kind==="literal"){a+=i.value;continue}let s=Ne[i.unit];if(!s)throw new Error(`temporal-fmt: unknown duration token "${i.value}"`);let m=Ft(e,s.field);m===0&&!r||(i.form==="numeric"?a+=String(m):i.form==="short"?a+=m+(m===1||m===-1?s.shortSingular:s.shortPlural):a+=m+" "+(m===1||m===-1?s.longSingular:s.longPlural))}return a}function _e(e,t){if(e===null||typeof e!="object")throw new Error(`temporal-fmt: formatDistance expects Temporal values, got ${t} = ${String(e)}.`);let n=e,r=typeof n.year=="number",o=typeof n.month=="number",a=typeof n.day=="number";if(r!==o||o!==a)throw new Error(`temporal-fmt: formatDistance got a ${t} with a partial date (some of year/month/day missing). Pass a full Temporal.PlainDate / PlainDateTime / ZonedDateTime.`);return{year:r?n.year:void 0,month:o?n.month:void 0,day:a?n.day:void 0,hour:typeof n.hour=="number"?n.hour:void 0,minute:typeof n.minute=="number"?n.minute:void 0,second:typeof n.second=="number"?n.second:void 0,millisecond:typeof n.millisecond=="number"?n.millisecond:void 0}}var ge=2e3,pe=1e3,G=60*pe,X=60*G,T=24*X;function $t(e,t,n){let r=0;if(e>=ge)for(let o=ge;o<e;o++)r+=C(o)?366:365;else for(let o=e;o<ge;o++)r-=C(o)?366:365;return r+=ce(e,t,n)-1,r}function Ae(e){if(e.year===void 0||e.month===void 0||e.day===void 0)throw new Error("temporal-fmt: formatDistance needs a Temporal value with year/month/day fields (PlainDate, PlainDateTime, or ZonedDateTime). A PlainTime or other shape has no anchor date to diff against.");let t=$t(e.year,e.month,e.day),n=e.hour??0,r=e.minute??0,o=e.second??0,a=e.millisecond??0;return t*T+n*X+r*G+o*pe+a}var Lt=[{maxMs:G,unit:"second"},{maxMs:X,unit:"minute"},{maxMs:T,unit:"hour"},{maxMs:30*T,unit:"day"},{maxMs:365*T,unit:"month"}],H=new Map,Ot=100;function Nt(e,t){let n=`${Rt(e)}|${t}`,r=H.get(n);if(r)return r;if(H.size>=Ot){let o=H.keys().next().value;o!==void 0&&H.delete(o)}return r=new Intl.RelativeTimeFormat(e,{numeric:t}),H.set(n,r),r}function Rt(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function Ce(e,t,n={}){let r=_e(e,"date1"),o=_e(t,"date2"),a=Ae(r)-Ae(o),i=Math.abs(a),s="year";for(let{maxMs:f,unit:y}of Lt)if(i<f){s=y;break}let m=_t(s),l=Math.round(a/m),u=n.numeric??"auto",c=n.locale??R;return Nt(c,u).format(l,s)}function _t(e){switch(e){case"second":return pe;case"minute":return G;case"hour":return X;case"day":return T;case"week":return 7*T;case"month":return 30*T;case"quarter":return 91*T;case"year":return 365*T;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}var we=["January","February","March","April","May","June","July","August","September","October","November","December"],At=we.flatMap((e,t)=>[[e,t+1],[e.slice(0,3),t+1]]),Ct=At.map(([e])=>e).join("|"),Se=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],It=Se.join("|");function Ut(e){let t=e.toLowerCase(),n=Se.find(r=>r.toLowerCase()===t);return Se.indexOf(n??e)+1}function Vt(e){let t=e.toLowerCase(),n=we.findIndex(o=>o.toLowerCase()===t);return n>=0?n+1:we.findIndex(o=>o.slice(0,3).toLowerCase()===t)+1}function Yt(e){let t=e.dayOfWeek;if(typeof t!="number")throw new Error("temporal-fmt: parseRelative needs a reference date exposing dayOfWeek (a Temporal.PlainDate / PlainDateTime / ZonedDateTime).");return t}function B(e){if(typeof e.year!="number")throw new Error("temporal-fmt: parseRelative reference date is missing year.");return e.year}function J(e){if(typeof e.month!="number")throw new Error("temporal-fmt: parseRelative reference date is missing month.");return e.month}function ee(e){if(typeof e.day!="number")throw new Error("temporal-fmt: parseRelative reference date is missing day.");return e.day}function Ie(e,t,n={}){n.locale;let r=t,o=F(),a=(e??"").trim().replace(/\s+/g," ");if(a.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");let i=a.toLowerCase();if(i==="today")return Ht(o,B(r),J(r),ee(r));if(i==="tomorrow")return ye(o,r,1);if(i==="yesterday")return ye(o,r,-1);let s=a.match(new RegExp(`^(next|last|this)\\s+(${It})$`,"i"));if(s){let u=s[1].toLowerCase(),c=s[2],d=Yt(r),f=Ut(c),y=Zt(u,d,f);return ye(o,r,y)}let m=a.match(/^(in\s+)?(\d+)\s+(day|week|month|year)s?(?:\s+ago)?$/i);if(m){let u=m[1],c=m[2],d=m[3].toLowerCase(),f=!!u,y=/\bago\b/i.test(a);if(!f&&!y)throw new Error(`temporal-fmt: parseRelative can't tell whether "${a}" is past or future \u2014 use "in ${c} ${d}s" or "${c} ${d}s ago".`);return jt(o,r,(f?1:-1)*Number(c),d)}let l=a.match(new RegExp(`^(${Ct})\\s+(\\d{1,2})(?:st|nd|rd|th)?(?:,?\\s*(\\d{4}))?$`,"i"));if(l){let u=l[1],c=l[2],d=Vt(u),f=Number(c);return zt(o,r,d,f)}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${a}". Supported: weekday refs ("next Tuesday"), day offsets ("today"/"tomorrow"/"yesterday"), unit offsets ("in 3 days", "2 weeks ago"), and month-day ("March 5th").`)}function Zt(e,t,n){if(e==="next"){let r=n-t;return r<=0&&(r+=7),r}if(e==="last"){let r=n-t;return r>=0&&(r-=7),r}return n-t}function Ht(e,t,n,r){return e.PlainDate.from({year:t,month:n,day:r},{overflow:"reject"})}function ye(e,t,n){return e.PlainDate.from({year:B(t),month:J(t),day:ee(t)}).add({days:n})}function jt(e,t,n,r){let o=e.PlainDate.from({year:B(t),month:J(t),day:ee(t)}),a={};return r==="day"&&(a.days=n),r==="week"&&(a.weeks=n),r==="month"&&(a.months=n),r==="year"&&(a.years=n),o.add(a)}function zt(e,t,n,r){let o=B(t),a=e.PlainDate.from({year:o,month:J(t),day:ee(t)});try{let i=e.PlainDate.from({year:o,month:n,day:r},{overflow:"reject"});if(!e.PlainDate.compare)throw new Error("temporal-fmt: parseRelative needs Temporal.PlainDate.compare to resolve month-day phrases; the active implementation does not expose it.");return e.PlainDate.compare(i,a)>=0?i:e.PlainDate.from({year:o+1,month:n,day:r},{overflow:"reject"})}catch(i){try{return e.PlainDate.from({year:o+1,month:n,day:r},{overflow:"reject"})}catch{throw new Error(`temporal-fmt: parseRelative can't resolve month ${n} day ${r} \u2014 it isn't a valid date in either ${o} or ${o+1}. Original error: ${i.message}`)}}}0&&(module.exports={format,formatDistance,formatDuration,parse,parseRelative,registerLocaleVocab,setTemporal});
2
2
  //# sourceMappingURL=index.cjs.map