temporal-fmt 0.9.2 → 0.9.3

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.
Files changed (36) hide show
  1. package/README.md +166 -1
  2. package/dist/chunk-4JDAJSEM.js +35 -0
  3. package/dist/chunk-4JDAJSEM.js.map +1 -0
  4. package/dist/{chunk-F4RGUDA3.js → chunk-4XRE37WT.js} +2 -2
  5. package/dist/chunk-GMGZZG6I.js +2 -0
  6. package/dist/chunk-GMGZZG6I.js.map +1 -0
  7. package/dist/{chunk-R52YOKI3.js → chunk-NPKJ7QFK.js} +2 -2
  8. package/dist/{chunk-NBXF7V5B.js → chunk-R4YEFOVE.js} +2 -2
  9. package/dist/{chunk-4JWGUR4O.js → chunk-SSPABEUR.js} +2 -2
  10. package/dist/format.cjs +5 -5
  11. package/dist/format.cjs.map +1 -1
  12. package/dist/format.js +1 -1
  13. package/dist/index.cjs +24 -24
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/interval.cjs +2 -2
  18. package/dist/interval.cjs.map +1 -1
  19. package/dist/interval.js +1 -1
  20. package/dist/parse.cjs +9 -9
  21. package/dist/parse.cjs.map +1 -1
  22. package/dist/parse.js +1 -1
  23. package/dist/pattern.d.cts +1 -0
  24. package/dist/pattern.d.ts +1 -0
  25. package/dist/relativeTime.cjs +1 -1
  26. package/dist/relativeTime.cjs.map +1 -1
  27. package/dist/relativeTime.js +1 -1
  28. package/package.json +1 -1
  29. package/dist/chunk-C5YESWFT.js +0 -2
  30. package/dist/chunk-C5YESWFT.js.map +0 -1
  31. package/dist/chunk-YB6YAG7E.js +0 -35
  32. package/dist/chunk-YB6YAG7E.js.map +0 -1
  33. /package/dist/{chunk-F4RGUDA3.js.map → chunk-4XRE37WT.js.map} +0 -0
  34. /package/dist/{chunk-R52YOKI3.js.map → chunk-NPKJ7QFK.js.map} +0 -0
  35. /package/dist/{chunk-NBXF7V5B.js.map → chunk-R4YEFOVE.js.map} +0 -0
  36. /package/dist/{chunk-4JWGUR4O.js.map → chunk-SSPABEUR.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as nr,b as tr}from"./chunk-NBXF7V5B.js";import{a as Er,b as xr,c as Cr,d as Rr,e as Fr,f as $r,g as Ir,h as Ar,i as Or}from"./chunk-J2AQNXF2.js";import{a as _n,b as Ln,c as Hn,d as Un,e as $e,f as Gn,g as Zn,h as Wn,i as Yn,j as Bn,k as Xn,l as qn,m as Kn,n as Jn,o as Qn}from"./chunk-2JHEV7ZF.js";import{a as ir,b as sr,c as lr,d as mr,e as ur,f as dr,g as cr,h as fr,i as pr,j as yr,k as gr,l as hr,m as Tr,n as wr}from"./chunk-F4RGUDA3.js";import{a as L,b as at,c as it,e as he}from"./chunk-4JWGUR4O.js";import{a as rr,b as or,c as ar}from"./chunk-XH46JNPK.js";import{a as st,b as Ae,c as K,d as lt,e as mt,f as ut,g as dt}from"./chunk-YB6YAG7E.js";import{a as q,b as et,c as nt,d as tt,e as rt,f as ot}from"./chunk-R52YOKI3.js";import{a as _,b as X}from"./chunk-C5YESWFT.js";import{b as Vn,c as A}from"./chunk-3MZLTVP3.js";import{a as Fn,b as w,c as pe,d as $n,e as ye,f as In,g as An,h as On,i as Pn,j as zn,k as ge,l as Nn,o as jn,p as Ie}from"./chunk-5U5WJ465.js";import{a as vr,b as br,c as Sr,d as kr,e as Mr,f as Dr}from"./chunk-ZGMTY52O.js";import{A as Nt,a as v,b as ct,c as ft,d as pt,e as yt,f as gt,g as ht,h as Tt,i as wt,j as vt,k as bt,l as St,m as kt,n as Mt,o as Dt,p as Et,q as xt,r as Ct,s as Rt,t as Ft,u as $t,v as It,w as At,x as Ot,y as Pt,z as zt}from"./chunk-VQXUMFB2.js";import{a as J,b as _t,c as Lt,d as Ht,e as Ut,f as jt,g as Gt,h as Zt,i as Wt,j as Yt,k as Bt,l as Xt,m as qt,n as Kt,o as Jt,p as Qt,q as Vt,r as er}from"./chunk-UJR6DHXY.js";import{a as gn,b as hn,c as Tn,d as wn,e as vn,f as bn,g as Sn,h as kn,i as Mn,j as Dn,k as En,l as xn,m as Cn,n as Rn}from"./chunk-EHLRZULM.js";import{a as fe,b as Fe}from"./chunk-C6ZZ62ET.js";function Oe(e,n){if(e===null||typeof e!="object")throw new Error(`temporal-fmt: formatDistance expects Temporal values, got ${n} = ${String(e)}.`);let t=e,r=typeof t.year=="number",a=typeof t.month=="number",o=typeof t.day=="number";if(r!==a||a!==o)throw new Error(`temporal-fmt: formatDistance got a ${n} with a partial date (some of year/month/day missing). Pass a full Temporal.PlainDate / PlainDateTime / ZonedDateTime.`);return{year:r?t.year:void 0,month:a?t.month:void 0,day:o?t.day:void 0,hour:typeof t.hour=="number"?t.hour:void 0,minute:typeof t.minute=="number"?t.minute:void 0,second:typeof t.second=="number"?t.second:void 0,millisecond:typeof t.millisecond=="number"?t.millisecond:void 0}}var Te=2e3,Q=1e3,V=60*Q,ee=60*V,F=24*ee;function Pr(e,n,t){let r=0;if(e>=Te)for(let a=Te;a<e;a++)r+=fe(a)?366:365;else for(let a=e;a<Te;a++)r-=fe(a)?366:365;return r+=Fe(e,n,t)-1,r}function Pe(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 n=Pr(e.year,e.month,e.day),t=e.hour??0,r=e.minute??0,a=e.second??0,o=e.millisecond??0;return n*F+t*ee+r*V+a*Q+o}var zr={seconds:60,minutes:60,hours:24,days:30,months:365};function Nr(e){let n={...zr,...e};for(let d of Object.keys(n)){let i=n[d];if(typeof i!="number"||!Number.isFinite(i)||i<=0)throw new Error(`temporal-fmt: formatDistance cutoff "${d}" must be a positive finite number (got ${String(i)}).`)}let t=n.seconds*Q,r=n.minutes*V,a=n.hours*ee,o=n.days*F,s=n.months*F;if(!(t<=r&&r<=a&&a<=o&&o<=s))throw new Error(`temporal-fmt: formatDistance cutoffs must be monotonically non-decreasing in equivalent ms (seconds \u2264 minutes \u2264 hours \u2264 days \u2264 months). Got: seconds=${n.seconds}s, minutes=${n.minutes}min, hours=${n.hours}h, days=${n.days}d, months=${n.months}d \u2014 pick a sequence where each boundary is at least as large as the one before it.`);return[{maxMs:t,unit:"second"},{maxMs:r,unit:"minute"},{maxMs:a,unit:"hour"},{maxMs:o,unit:"day"},{maxMs:s,unit:"month"}]}var G=new Map,_r=100;function Lr(e,n){let t=`${Hr(e)}|${n}`,r=G.get(t);if(r)return r;if(G.size>=_r){let a=G.keys().next().value;a!==void 0&&G.delete(a)}try{r=new Intl.RelativeTimeFormat(Ie(e),{numeric:n})}catch(a){throw new ge({actual:e,reason:a.message})}return G.set(t,r),r}function Hr(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function ze(e,n,t={}){let r=Oe(e,"date1"),a=Oe(n,"date2"),o=Pe(r)-Pe(a),s=Math.abs(o),d=Nr(t.cutoffs),i="year";for(let{maxMs:c,unit:g}of d)if(s<c){i=g;break}let m=jr(i),l=Math.round(o/m),T=t.numeric??"auto",y=t.locale??_;return Lr(y,T).format(l,i)}function Ur(e,n={}){let t=new Date,r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()};return ze(e,r,n)}function jr(e){switch(e){case"second":return Q;case"minute":return V;case"hour":return ee;case"day":return F;case"week":return 7*F;case"month":return 30*F;case"quarter":return 91*F;case"year":return 365*F;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}var Ne=100,H=[];function Gr(e){if(typeof e.language!="string"||e.language.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires a non-empty language string.");if(!Array.isArray(e.matchers)||e.matchers.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires at least one matcher.");let n=H.findIndex(t=>t.language===e.language);if(n>=0)H[n]=e;else{if(H.length>=Ne)throw new RangeError(`temporal-fmt: registerRelativeGrammar reached the ${Ne}-grammar limit.`);H.push(e)}}function _e(e,n,t){for(let r of H)if(r.language===e)for(let a of r.matchers){let o=a(n);if(o===null)continue;let s=A();if(o.resolve){let d=o.resolve(t);return s.PlainDate.from(d,{overflow:"reject"})}return s.PlainDate.from({year:o.year??t.year,month:o.month??t.month,day:o.day??t.day},{overflow:"reject"})}return null}function Zr(){return H.map(e=>e.language)}function k(e){return e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Wr(e,n){/* c8 ignore start @preserve -- unreachable through the only call
1
+ import{a as nr,b as tr}from"./chunk-R4YEFOVE.js";import{a as Er,b as xr,c as Cr,d as Rr,e as Fr,f as $r,g as Ir,h as Ar,i as Or}from"./chunk-J2AQNXF2.js";import{a as _n,b as Ln,c as Hn,d as Un,e as $e,f as Gn,g as Zn,h as Wn,i as Yn,j as Bn,k as Xn,l as qn,m as Kn,n as Jn,o as Qn}from"./chunk-2JHEV7ZF.js";import{a as ir,b as sr,c as lr,d as mr,e as ur,f as dr,g as cr,h as fr,i as pr,j as yr,k as gr,l as hr,m as Tr,n as wr}from"./chunk-4XRE37WT.js";import{a as L,b as at,c as it,e as he}from"./chunk-SSPABEUR.js";import{a as rr,b as or,c as ar}from"./chunk-XH46JNPK.js";import{a as st,b as Ae,c as K,d as lt,e as mt,f as ut,g as dt}from"./chunk-4JDAJSEM.js";import{a as q,b as et,c as nt,d as tt,e as rt,f as ot}from"./chunk-NPKJ7QFK.js";import{a as _,b as X}from"./chunk-GMGZZG6I.js";import{b as Vn,c as A}from"./chunk-3MZLTVP3.js";import{a as Fn,b as w,c as pe,d as $n,e as ye,f as In,g as An,h as On,i as Pn,j as zn,k as ge,l as Nn,o as jn,p as Ie}from"./chunk-5U5WJ465.js";import{a as vr,b as br,c as Sr,d as kr,e as Mr,f as Dr}from"./chunk-ZGMTY52O.js";import{A as Nt,a as v,b as ct,c as ft,d as pt,e as yt,f as gt,g as ht,h as Tt,i as wt,j as vt,k as bt,l as St,m as kt,n as Mt,o as Dt,p as Et,q as xt,r as Ct,s as Rt,t as Ft,u as $t,v as It,w as At,x as Ot,y as Pt,z as zt}from"./chunk-VQXUMFB2.js";import{a as J,b as _t,c as Lt,d as Ht,e as Ut,f as jt,g as Gt,h as Zt,i as Wt,j as Yt,k as Bt,l as Xt,m as qt,n as Kt,o as Jt,p as Qt,q as Vt,r as er}from"./chunk-UJR6DHXY.js";import{a as gn,b as hn,c as Tn,d as wn,e as vn,f as bn,g as Sn,h as kn,i as Mn,j as Dn,k as En,l as xn,m as Cn,n as Rn}from"./chunk-EHLRZULM.js";import{a as fe,b as Fe}from"./chunk-C6ZZ62ET.js";function Oe(e,n){if(e===null||typeof e!="object")throw new Error(`temporal-fmt: formatDistance expects Temporal values, got ${n} = ${String(e)}.`);let t=e,r=typeof t.year=="number",a=typeof t.month=="number",o=typeof t.day=="number";if(r!==a||a!==o)throw new Error(`temporal-fmt: formatDistance got a ${n} with a partial date (some of year/month/day missing). Pass a full Temporal.PlainDate / PlainDateTime / ZonedDateTime.`);return{year:r?t.year:void 0,month:a?t.month:void 0,day:o?t.day:void 0,hour:typeof t.hour=="number"?t.hour:void 0,minute:typeof t.minute=="number"?t.minute:void 0,second:typeof t.second=="number"?t.second:void 0,millisecond:typeof t.millisecond=="number"?t.millisecond:void 0}}var Te=2e3,Q=1e3,V=60*Q,ee=60*V,F=24*ee;function Pr(e,n,t){let r=0;if(e>=Te)for(let a=Te;a<e;a++)r+=fe(a)?366:365;else for(let a=e;a<Te;a++)r-=fe(a)?366:365;return r+=Fe(e,n,t)-1,r}function Pe(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 n=Pr(e.year,e.month,e.day),t=e.hour??0,r=e.minute??0,a=e.second??0,o=e.millisecond??0;return n*F+t*ee+r*V+a*Q+o}var zr={seconds:60,minutes:60,hours:24,days:30,months:365};function Nr(e){let n={...zr,...e};for(let d of Object.keys(n)){let i=n[d];if(typeof i!="number"||!Number.isFinite(i)||i<=0)throw new Error(`temporal-fmt: formatDistance cutoff "${d}" must be a positive finite number (got ${String(i)}).`)}let t=n.seconds*Q,r=n.minutes*V,a=n.hours*ee,o=n.days*F,s=n.months*F;if(!(t<=r&&r<=a&&a<=o&&o<=s))throw new Error(`temporal-fmt: formatDistance cutoffs must be monotonically non-decreasing in equivalent ms (seconds \u2264 minutes \u2264 hours \u2264 days \u2264 months). Got: seconds=${n.seconds}s, minutes=${n.minutes}min, hours=${n.hours}h, days=${n.days}d, months=${n.months}d \u2014 pick a sequence where each boundary is at least as large as the one before it.`);return[{maxMs:t,unit:"second"},{maxMs:r,unit:"minute"},{maxMs:a,unit:"hour"},{maxMs:o,unit:"day"},{maxMs:s,unit:"month"}]}var G=new Map,_r=100;function Lr(e,n){let t=`${Hr(e)}|${n}`,r=G.get(t);if(r)return r;if(G.size>=_r){let a=G.keys().next().value;a!==void 0&&G.delete(a)}try{r=new Intl.RelativeTimeFormat(Ie(e),{numeric:n})}catch(a){throw new ge({actual:e,reason:a.message})}return G.set(t,r),r}function Hr(e){try{return new Intl.Locale(e.replace(/_/g,"-")).toString().toLowerCase()}catch{return e}}function ze(e,n,t={}){let r=Oe(e,"date1"),a=Oe(n,"date2"),o=Pe(r)-Pe(a),s=Math.abs(o),d=Nr(t.cutoffs),i="year";for(let{maxMs:c,unit:g}of d)if(s<c){i=g;break}let m=jr(i),l=Math.round(o/m),T=t.numeric??"auto",y=t.locale??_;return Lr(y,T).format(l,i)}function Ur(e,n={}){let t=new Date,r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()};return ze(e,r,n)}function jr(e){switch(e){case"second":return Q;case"minute":return V;case"hour":return ee;case"day":return F;case"week":return 7*F;case"month":return 30*F;case"quarter":return 91*F;case"year":return 365*F;default:throw new Error(`temporal-fmt: formatDistance hit unhandled unit "${String(e)}".`)}}var Ne=100,H=[];function Gr(e){if(typeof e.language!="string"||e.language.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires a non-empty language string.");if(!Array.isArray(e.matchers)||e.matchers.length===0)throw new Error("temporal-fmt: registerRelativeGrammar requires at least one matcher.");let n=H.findIndex(t=>t.language===e.language);if(n>=0)H[n]=e;else{if(H.length>=Ne)throw new RangeError(`temporal-fmt: registerRelativeGrammar reached the ${Ne}-grammar limit.`);H.push(e)}}function _e(e,n,t){for(let r of H)if(r.language===e)for(let a of r.matchers){let o=a(n);if(o===null)continue;let s=A();if(o.resolve){let d=o.resolve(t);return s.PlainDate.from(d,{overflow:"reject"})}return s.PlainDate.from({year:o.year??t.year,month:o.month??t.month,day:o.day??t.day},{overflow:"reject"})}return null}function Zr(){return H.map(e=>e.language)}function k(e){return e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Wr(e,n){/* c8 ignore start @preserve -- unreachable through the only call
2
2
  * site (fuzzyCorrectEnglish): `a` is always a word that already
3
3
  * failed the `vocabulary.includes(word)` exact-match check, so
4
4
  * a === b never holds against any `b` drawn from that same
@@ -23,7 +23,7 @@ import{a as nr,b as tr}from"./chunk-NBXF7V5B.js";import{a as Er,b as xr,c as Cr,
23
23
  * forms (day/week/month/year across en/es/fr/de), so the branches
24
24
  * above already cover every string that can reach this function.
25
25
  * Kept as a tripwire for the type checker in case a grammar adds a
26
- * unit word here without a matching regex update. */throw new Error(`temporal-fmt: parseRelative internal error \u2014 unrecognized unit word "${e}".`);/* c8 ignore stop @preserve */}function no(e,n,t={}){let r=n,a=A(),o=(e??"").trim().replace(/\s+/g," ");if(o.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");if(o.length>te)throw new RangeError(`temporal-fmt: parseRelative input is too large (maximum ${te} characters).`);let s=k(o),d=Vr(t.locale),i={temporal:a,reference:r},m=_e(eo(t.locale),o,{year:r.year,month:r.month,day:r.day,dayOfWeek:r.dayOfWeek});if(m!==null)return m;let l=y=>{for(let f of d.matchers){let c=y.match(f.pattern);if(c)return f.resolve(c,i)}return be},T=l(s);if(T!==be)return T;if(t.fuzzy){if(d!==Z)throw new Error("temporal-fmt: parseRelative's { fuzzy: true } option currently only supports English. Pass no locale (or locale: 'en'), or omit { fuzzy: true } for this locale.");let y=Xr(s);if(y!==void 0){let f=l(y);if(f!==be)return f}}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${o}". `+d.supportedHint)}var be=Symbol("temporal-fmt: parseRelative no match");function M(e){return typeof e=="object"&&e!==null}function x(e){return n=>{try{return e(n)}catch{return!1}}}function h(e,n){return typeof e[n]=="function"}function $(e,n){return M(e)?e[Symbol.toStringTag]===`Temporal.${n}`:!1}var Xe=x(function(n){if($(n,"PlainDate"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour>"u"&&h(t,"toPlainDateTime")&&h(t,"withCalendar")}),qe=x(function(n){if($(n,"PlainTime"))return!0;if(!M(n))return!1;let t=n;return typeof t.hour=="number"&&typeof t.year>"u"&&!h(t,"withCalendar")&&!h(t,"toPlainDate")&&!h(t,"toPlainDateTime")}),Ke=x(function(n){if($(n,"PlainDateTime"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&h(t,"withPlainTime")&&!h(t,"toInstant")}),Je=x(function(n){if($(n,"ZonedDateTime"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&h(t,"withTimeZone")&&h(t,"toInstant")}),Qe=x(function(n){if($(n,"Instant"))return!0;if(!M(n))return!1;let t=n;return h(t,"toZonedDateTimeISO")&&!h(t,"toInstant")&&typeof t.year>"u"}),Ve=x(function(n){if($(n,"PlainYearMonth"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day>"u"&&h(t,"toPlainDate")}),en=x(function(n){if($(n,"PlainMonthDay"))return!0;if(!M(n))return!1;let t=n;return typeof t.year>"u"&&typeof t.month>"u"&&typeof t.day=="number"&&typeof t.monthCode=="string"&&h(t,"toPlainDate")}),nn=x(function(n){return $(n,"Duration")?!0:M(n)?h(n,"total"):!1}),tn=x(function(n){if(!M(n))return!1;let t=n[Symbol.toStringTag];if(typeof t=="string"&&t.startsWith("Temporal."))return!0;let r=n;return h(r,"toInstant")||h(r,"toPlainDate")||h(r,"toPlainDateTime")||h(r,"toPlainTime")||h(r,"toPlainYearMonth")||h(r,"toPlainMonthDay")||h(r,"toZonedDateTime")||h(r,"toZonedDateTimeISO")||h(r,"withCalendar")||h(r,"withPlainTime")||h(r,"withTimeZone")||h(r,"total")});function to(e){if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="object"){let n=e.constructor;return n&&typeof n.name=="string"&&n.name!=="Object"?`instance of ${n.name}`:"plain object"}return typeof e}function C(e,n,t){if(!n(e))throw new Error(`temporal-fmt: expected a Temporal.${t}, got ${to(e)}.`)}function ro(e){C(e,tn,"object (Instant, PlainDate, PlainTime, PlainDateTime, ZonedDateTime, Duration, PlainYearMonth, or PlainMonthDay)")}function oo(e){C(e,Qe,"Instant")}function ao(e){C(e,Xe,"PlainDate")}function io(e){C(e,qe,"PlainTime")}function so(e){C(e,Ke,"PlainDateTime")}function lo(e){C(e,Je,"ZonedDateTime")}function mo(e){C(e,Ve,"PlainYearMonth")}function uo(e){C(e,en,"PlainMonthDay")}function co(e){C(e,nn,"Duration")}var u={year:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth"],month:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth","PlainMonthDay"],day:["PlainDate","PlainDateTime","ZonedDateTime","PlainMonthDay"],hour:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],minute:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],second:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],millisecond:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],dayOfWeek:["PlainDate","PlainDateTime","ZonedDateTime"],timeZoneId:["ZonedDateTime"],offset:["ZonedDateTime"]},R={yyyy:{meaning:"Four-digit year (preserves sign for BCE; no truncation).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!0},yy:{meaning:"Two-digit year (year % 100). Throws on negative years.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!1},MMMM:{meaning:'Long month name (locale-aware, e.g. "January", "janvier").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},MMM:{meaning:'Short month name (locale-aware, e.g. "Jan", "janv.").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},MM:{meaning:"Two-digit month (01-12, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},M:{meaning:"One- or two-digit month (1-12, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},dd:{meaning:"Two-digit day-of-month (01-31, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!0},d:{meaning:"One- or two-digit day-of-month (1-31, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!0},EEEE:{meaning:'Long weekday name (locale-aware, e.g. "Monday", "lundi"). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},EEE:{meaning:'Short weekday name (locale-aware, e.g. "Mon", "lun."). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},HH:{meaning:"Two-digit hour, 24-hour clock (00-23, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},H:{meaning:"One- or two-digit hour, 24-hour clock (0-23, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},hh:{meaning:"Two-digit hour, 12-hour clock (01-12, zero-padded). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},h:{meaning:"One- or two-digit hour, 12-hour clock (1-12, no padding). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},mm:{meaning:"Two-digit minute (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.minute,roundTripSafe:!0},m:{meaning:"One- or two-digit minute (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.minute,roundTripSafe:!0},ss:{meaning:"Two-digit second (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.second,roundTripSafe:!0},s:{meaning:"One- or two-digit second (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.second,roundTripSafe:!0},S:{meaning:"Fractional second, 1 digit (tenths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SS:{meaning:"Fractional second, 2 digits (hundredths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSS:{meaning:"Fractional second, 3 digits (milliseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSS:{meaning:"Fractional second, 4 digits (tens of microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSS:{meaning:"Fractional second, 5 digits (hundred-thousandths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSS:{meaning:"Fractional second, 6 digits (microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSSS:{meaning:"Fractional second, 7 digits (tens of nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSSSS:{meaning:"Fractional second, 8 digits (hundred-millionths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSSSSS:{meaning:"Fractional second, 9 digits (nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},a:{meaning:'Day period (locale-aware: "AM"/"PM", "\u5348\u524D"/"\u5348\u5F8C", etc.). Required alongside 12-hour tokens on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},zzz:{meaning:'IANA time zone id (e.g. "America/New_York") or fixed offset ("+05:30"). Requires full date+time on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.timeZoneId,roundTripSafe:!0},X:{meaning:"Numeric UTC offset, short (Z for UTC, \xB1HH[MM] otherwise). Minutes omitted when zero.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},XX:{meaning:"Numeric UTC offset, no colon (Z for UTC, \xB1HHMM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},XXX:{meaning:"Numeric UTC offset, with colon (Z for UTC, \xB1HH:MM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},x:{meaning:"Numeric UTC offset, short, never Z (always \xB1HH[MM]). Lowercase variant of X.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},xx:{meaning:"Numeric UTC offset, no colon, never Z (always \xB1HHMM). Lowercase variant of XX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},xxx:{meaning:"Numeric UTC offset, with colon, never Z (always \xB1HH:MM). Lowercase variant of XXX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},do:{meaning:'Ordinal day-of-month with English suffix ("1st", "2nd", "3rd", "4th", ... 21st, 22nd, ...). Format-only \u2014 not parseable.',formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},Q:{meaning:"Quarter as a digit (1-4). Derived from month.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},QQQ:{meaning:'Quarter with "Q" prefix ("Q1".."Q4"). Derived from month.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},ww:{meaning:"ISO 8601 week number (01-53). Format-only \u2014 week alone can't reconstruct a date.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!1},RRRR:{meaning:"ISO 8601 week-numbering year (4-digit, may differ from calendar year at year boundaries). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!1},D:{meaning:"Day of year, unpadded (1-366). Format-only \u2014 parsing requires resolving against a year.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},DD:{meaning:"Day of year, 2-digit minimum (01-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},DDD:{meaning:"Day of year, 3-digit zero-padded (001-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},LLLL:{meaning:"Stand-alone long month name (nominative case in Slavic locales). Identical to MMMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},LLL:{meaning:"Stand-alone short month name. Identical to MMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},cccc:{meaning:"Stand-alone long weekday name. Identical to EEEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},ccc:{meaning:"Stand-alone short weekday name. Identical to EEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},GGGG:{meaning:'Long era name (locale-aware, e.g. "Anno Domini"/"Before Christ"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!1},G:{meaning:'Short era name (locale-aware, e.g. "AD"/"BC"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!1},zzzz:{meaning:'Localized long timezone name (e.g. "Eastern Standard Time"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.timeZoneId,roundTripSafe:!1},z:{meaning:'Localized short timezone name (e.g. "EST"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.timeZoneId,roundTripSafe:!1}},me=Object.keys(R);function fo(e){return q(e)}function rn(){return X.map(([e])=>({name:e,metadata:R[e]}))}function po(e){return R[e]}function W(e){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);let n=q(e),t=[],r=new Set,a=new Set,o=!0,s=!1,d=!1,i=!1,m=!0,l=[],T=0,y=[],f=()=>{y.length>=2&&l.push({code:"AMBIGUOUS_NUMERIC_RUN",message:`Adjacent unpadded numeric tokens "${y.join("")}" with no separator can be ambiguous to parse. Add a separator or use the padded form (e.g. "MM" instead of "M").`}),y.length=0};for(let p of n){if(p.kind==="literal"){T+=p.value.length,f();continue}let E=R[p.value];if(!E){l.push({code:"UNKNOWN_TOKEN_NO_METADATA",message:`Token "${p.value}" is recognized by the tokenizer but has no metadata entry in tokenMetadata.ts \u2014 this is a bug in temporal-fmt.`}),T+=p.value.length;continue}t.push({name:p.value,position:T,metadata:E});let Re=he(p.value);if(Re&&r.add(Re.field),t.length===1)for(let Y of E.supportedTypes)a.add(Y);else{let Y=new Set;for(let B of a)E.supportedTypes.includes(B)&&Y.add(B);a.clear();for(let B of Y)a.add(B)}E.parseCapable||(o=!1,l.push({code:"FORMAT_ONLY_TOKEN",message:`Token "${p.value}" is format-only \u2014 it can't be parsed back into a value. Use a parse-capable variant (e.g. "d" instead of "do") if you need round-trip.`})),E.localeSensitive&&(s=!0),E.calendarSensitive&&(d=!0),E.timezoneSensitive&&(i=!0),E.roundTripSafe||(m=!1),Ae.has(p.value)?y.push(p.value):f(),T+=p.value.length}f();let c=t.map(p=>p.name),g=c.some(p=>p==="hh"||p==="h"),D=c.some(p=>p==="HH"||p==="H"),pn=c.some(p=>p==="a");g&&!pn&&l.push({code:"TWELVE_HOUR_WITHOUT_A",message:`12-hour token ("hh"/"h") used without an "a" (AM/PM) token \u2014 parse() can't tell AM from PM and throws at runtime.`}),g&&D&&l.push({code:"MIXED_12_AND_24_HOUR",message:"Mixing 24-hour and 12-hour tokens \u2014 parse() refuses to guess which is authoritative and throws at runtime."});let Ce=c.some(p=>p==="X"||p==="XX"||p==="XXX"||p==="x"||p==="xx"||p==="xxx"),yn=c.some(p=>p==="zzz");return Ce&&yn&&l.push({code:"ZZZ_WITH_OFFSET_TOKEN",message:`Format string has both "zzz" and an offset token \u2014 parse() cross-checks them and throws if the parsed offset disagrees with the zone's actual offset.`}),Ce&&!r.has("year")&&l.push({code:"OFFSET_WITHOUT_FULL_DATE",message:"Offset token used without a full date \u2014 parse() needs a complete date and time to build a ZonedDateTime and throws at runtime otherwise."}),{tokens:t,requiredFields:[...r].sort(),compatibleTypes:[...a].sort(),parseable:o,localeSensitive:s,calendarSensitive:d,timezoneSensitive:i,ambiguous:l.some(p=>p.code==="AMBIGUOUS_NUMERIC_RUN"),roundTripSafe:m&&o,warnings:l}}function yo(e){let n=W(e),t=[];t.push(`Format string: "${e}"`),t.push(`Tokens (${n.tokens.length}):`);for(let r of n.tokens)t.push(` ${r.name} @${r.position} \u2014 ${r.metadata.meaning}`);if(n.requiredFields.length>0&&t.push(`Required fields: ${n.requiredFields.join(", ")}`),n.compatibleTypes.length>0&&t.push(`Compatible Temporal types: ${n.compatibleTypes.join(", ")}`),t.push(`Parseable: ${n.parseable?"yes":"no"}`),t.push(`Locale-sensitive: ${n.localeSensitive?"yes":"no"}`),t.push(`Calendar-sensitive: ${n.calendarSensitive?"yes":"no"}`),t.push(`Timezone-sensitive: ${n.timezoneSensitive?"yes":"no"}`),t.push(`Ambiguous: ${n.ambiguous?"yes":"no"}`),t.push(`Round-trip safe: ${n.roundTripSafe?"yes":"no"}`),n.warnings.length>0){t.push("Warnings:");for(let r of n.warnings)t.push(` [${r.code}] ${r.message}`)}return t.join(`
26
+ * unit word here without a matching regex update. */throw new Error(`temporal-fmt: parseRelative internal error \u2014 unrecognized unit word "${e}".`);/* c8 ignore stop @preserve */}function no(e,n,t={}){let r=n,a=A(),o=(e??"").trim().replace(/\s+/g," ");if(o.length===0)throw new Error("temporal-fmt: parseRelative got an empty input string.");if(o.length>te)throw new RangeError(`temporal-fmt: parseRelative input is too large (maximum ${te} characters).`);let s=k(o),d=Vr(t.locale),i={temporal:a,reference:r},m=_e(eo(t.locale),o,{year:r.year,month:r.month,day:r.day,dayOfWeek:r.dayOfWeek});if(m!==null)return m;let l=y=>{for(let f of d.matchers){let c=y.match(f.pattern);if(c)return f.resolve(c,i)}return be},T=l(s);if(T!==be)return T;if(t.fuzzy){if(d!==Z)throw new Error("temporal-fmt: parseRelative's { fuzzy: true } option currently only supports English. Pass no locale (or locale: 'en'), or omit { fuzzy: true } for this locale.");let y=Xr(s);if(y!==void 0){let f=l(y);if(f!==be)return f}}throw new Error(`temporal-fmt: parseRelative doesn't recognize "${o}". `+d.supportedHint)}var be=Symbol("temporal-fmt: parseRelative no match");function M(e){return typeof e=="object"&&e!==null}function x(e){return n=>{try{return e(n)}catch{return!1}}}function h(e,n){return typeof e[n]=="function"}function $(e,n){return M(e)?e[Symbol.toStringTag]===`Temporal.${n}`:!1}var Xe=x(function(n){if($(n,"PlainDate"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour>"u"&&h(t,"toPlainDateTime")&&h(t,"withCalendar")}),qe=x(function(n){if($(n,"PlainTime"))return!0;if(!M(n))return!1;let t=n;return typeof t.hour=="number"&&typeof t.year>"u"&&!h(t,"withCalendar")&&!h(t,"toPlainDate")&&!h(t,"toPlainDateTime")}),Ke=x(function(n){if($(n,"PlainDateTime"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&h(t,"withPlainTime")&&!h(t,"toInstant")}),Je=x(function(n){if($(n,"ZonedDateTime"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day=="number"&&typeof t.hour=="number"&&h(t,"withTimeZone")&&h(t,"toInstant")}),Qe=x(function(n){if($(n,"Instant"))return!0;if(!M(n))return!1;let t=n;return h(t,"toZonedDateTimeISO")&&!h(t,"toInstant")&&typeof t.year>"u"}),Ve=x(function(n){if($(n,"PlainYearMonth"))return!0;if(!M(n))return!1;let t=n;return typeof t.year=="number"&&typeof t.month=="number"&&typeof t.day>"u"&&h(t,"toPlainDate")}),en=x(function(n){if($(n,"PlainMonthDay"))return!0;if(!M(n))return!1;let t=n;return typeof t.year>"u"&&typeof t.month>"u"&&typeof t.day=="number"&&typeof t.monthCode=="string"&&h(t,"toPlainDate")}),nn=x(function(n){return $(n,"Duration")?!0:M(n)?h(n,"total"):!1}),tn=x(function(n){if(!M(n))return!1;let t=n[Symbol.toStringTag];if(typeof t=="string"&&t.startsWith("Temporal."))return!0;let r=n;return h(r,"toInstant")||h(r,"toPlainDate")||h(r,"toPlainDateTime")||h(r,"toPlainTime")||h(r,"toPlainYearMonth")||h(r,"toPlainMonthDay")||h(r,"toZonedDateTime")||h(r,"toZonedDateTimeISO")||h(r,"withCalendar")||h(r,"withPlainTime")||h(r,"withTimeZone")||h(r,"total")});function to(e){if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="object"){let n=e.constructor;return n&&typeof n.name=="string"&&n.name!=="Object"?`instance of ${n.name}`:"plain object"}return typeof e}function C(e,n,t){if(!n(e))throw new Error(`temporal-fmt: expected a Temporal.${t}, got ${to(e)}.`)}function ro(e){C(e,tn,"object (Instant, PlainDate, PlainTime, PlainDateTime, ZonedDateTime, Duration, PlainYearMonth, or PlainMonthDay)")}function oo(e){C(e,Qe,"Instant")}function ao(e){C(e,Xe,"PlainDate")}function io(e){C(e,qe,"PlainTime")}function so(e){C(e,Ke,"PlainDateTime")}function lo(e){C(e,Je,"ZonedDateTime")}function mo(e){C(e,Ve,"PlainYearMonth")}function uo(e){C(e,en,"PlainMonthDay")}function co(e){C(e,nn,"Duration")}var u={year:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth"],month:["PlainDate","PlainDateTime","ZonedDateTime","PlainYearMonth","PlainMonthDay"],day:["PlainDate","PlainDateTime","ZonedDateTime","PlainMonthDay"],hour:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],minute:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],second:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],millisecond:["PlainTime","PlainDateTime","ZonedDateTime","Instant"],dayOfWeek:["PlainDate","PlainDateTime","ZonedDateTime"],timeZoneId:["ZonedDateTime"],offset:["ZonedDateTime"]},R={yyyy:{meaning:"Four-digit year (preserves sign for BCE; no truncation).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!0},yy:{meaning:"Two-digit year (year % 100). Throws on negative years.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!1},y:{meaning:"Unpadded year, any width (preserves sign for BCE; no truncation, no minimum digits). Cannot sit directly next to another digit-reading token or a literal starting with a digit \u2014 there would be no way to tell where it ends.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!0},MMMM:{meaning:'Long month name (locale-aware, e.g. "January", "janvier").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},MMM:{meaning:'Short month name (locale-aware, e.g. "Jan", "janv.").',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},MM:{meaning:"Two-digit month (01-12, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},M:{meaning:"One- or two-digit month (1-12, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},dd:{meaning:"Two-digit day-of-month (01-31, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!0},d:{meaning:"One- or two-digit day-of-month (1-31, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!0},EEEE:{meaning:'Long weekday name (locale-aware, e.g. "Monday", "lundi"). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},EEE:{meaning:'Short weekday name (locale-aware, e.g. "Mon", "lun."). Parse cross-checks against the parsed date.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},HH:{meaning:"Two-digit hour, 24-hour clock (00-23, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},H:{meaning:"One- or two-digit hour, 24-hour clock (0-23, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},hh:{meaning:"Two-digit hour, 12-hour clock (01-12, zero-padded). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},h:{meaning:"One- or two-digit hour, 12-hour clock (1-12, no padding). Requires `a` token on parse.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},mm:{meaning:"Two-digit minute (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.minute,roundTripSafe:!0},m:{meaning:"One- or two-digit minute (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.minute,roundTripSafe:!0},ss:{meaning:"Two-digit second (00-59, zero-padded).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.second,roundTripSafe:!0},s:{meaning:"One- or two-digit second (0-59, no padding).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.second,roundTripSafe:!0},S:{meaning:"Fractional second, 1 digit (tenths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SS:{meaning:"Fractional second, 2 digits (hundredths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSS:{meaning:"Fractional second, 3 digits (milliseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSS:{meaning:"Fractional second, 4 digits (tens of microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSS:{meaning:"Fractional second, 5 digits (hundred-thousandths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSS:{meaning:"Fractional second, 6 digits (microseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSSS:{meaning:"Fractional second, 7 digits (tens of nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSSSS:{meaning:"Fractional second, 8 digits (hundred-millionths of a second).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},SSSSSSSSS:{meaning:"Fractional second, 9 digits (nanoseconds).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.millisecond,roundTripSafe:!0},a:{meaning:'Day period (locale-aware: "AM"/"PM", "\u5348\u524D"/"\u5348\u5F8C", etc.). Required alongside 12-hour tokens on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!1,supportedTypes:u.hour,roundTripSafe:!0},zzz:{meaning:'IANA time zone id (e.g. "America/New_York") or fixed offset ("+05:30"). Requires full date+time on parse.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.timeZoneId,roundTripSafe:!0},X:{meaning:"Numeric UTC offset, short (Z for UTC, \xB1HH[MM] otherwise). Minutes omitted when zero.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},XX:{meaning:"Numeric UTC offset, no colon (Z for UTC, \xB1HHMM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},XXX:{meaning:"Numeric UTC offset, with colon (Z for UTC, \xB1HH:MM otherwise).",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},x:{meaning:"Numeric UTC offset, short, never Z (always \xB1HH[MM]). Lowercase variant of X.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},xx:{meaning:"Numeric UTC offset, no colon, never Z (always \xB1HHMM). Lowercase variant of XX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},xxx:{meaning:"Numeric UTC offset, with colon, never Z (always \xB1HH:MM). Lowercase variant of XXX.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.offset,roundTripSafe:!0},do:{meaning:'Ordinal day-of-month with English suffix ("1st", "2nd", "3rd", "4th", ... 21st, 22nd, ...). Format-only \u2014 not parseable.',formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},Q:{meaning:"Quarter as a digit (1-4). Derived from month.",formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},QQQ:{meaning:'Quarter with "Q" prefix ("Q1".."Q4"). Derived from month.',formatCapable:!0,parseCapable:!0,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},ww:{meaning:"ISO 8601 week number (01-53). Format-only \u2014 week alone can't reconstruct a date.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!1},RRRR:{meaning:"ISO 8601 week-numbering year (4-digit, may differ from calendar year at year boundaries). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!1},D:{meaning:"Day of year, unpadded (1-366). Format-only \u2014 parsing requires resolving against a year.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},DD:{meaning:"Day of year, 2-digit minimum (01-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},DDD:{meaning:"Day of year, 3-digit zero-padded (001-366). Format-only.",formatCapable:!0,parseCapable:!1,localeSensitive:!1,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.day,roundTripSafe:!1},LLLL:{meaning:"Stand-alone long month name (nominative case in Slavic locales). Identical to MMMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},LLL:{meaning:"Stand-alone short month name. Identical to MMM in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.month,roundTripSafe:!0},cccc:{meaning:"Stand-alone long weekday name. Identical to EEEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},ccc:{meaning:"Stand-alone short weekday name. Identical to EEE in most locales.",formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.dayOfWeek,roundTripSafe:!0},GGGG:{meaning:'Long era name (locale-aware, e.g. "Anno Domini"/"Before Christ"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!1},G:{meaning:'Short era name (locale-aware, e.g. "AD"/"BC"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!0,timezoneSensitive:!1,supportedTypes:u.year,roundTripSafe:!1},zzzz:{meaning:'Localized long timezone name (e.g. "Eastern Standard Time"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.timeZoneId,roundTripSafe:!1},z:{meaning:'Localized short timezone name (e.g. "EST"). Format-only.',formatCapable:!0,parseCapable:!1,localeSensitive:!0,calendarSensitive:!1,timezoneSensitive:!0,supportedTypes:u.timeZoneId,roundTripSafe:!1}},me=Object.keys(R);function fo(e){return q(e)}function rn(){return X.map(([e])=>({name:e,metadata:R[e]}))}function po(e){return R[e]}function W(e){if(e.length>1e3)throw new Error(`temporal-fmt: format string exceeds maximum length of ${1e3} characters (got ${e.length}).`);let n=q(e),t=[],r=new Set,a=new Set,o=!0,s=!1,d=!1,i=!1,m=!0,l=[],T=0,y=[],f=()=>{y.length>=2&&l.push({code:"AMBIGUOUS_NUMERIC_RUN",message:`Adjacent unpadded numeric tokens "${y.join("")}" with no separator can be ambiguous to parse. Add a separator or use the padded form (e.g. "MM" instead of "M").`}),y.length=0};for(let p of n){if(p.kind==="literal"){T+=p.value.length,f();continue}let E=R[p.value];if(!E){l.push({code:"UNKNOWN_TOKEN_NO_METADATA",message:`Token "${p.value}" is recognized by the tokenizer but has no metadata entry in tokenMetadata.ts \u2014 this is a bug in temporal-fmt.`}),T+=p.value.length;continue}t.push({name:p.value,position:T,metadata:E});let Re=he(p.value);if(Re&&r.add(Re.field),t.length===1)for(let Y of E.supportedTypes)a.add(Y);else{let Y=new Set;for(let B of a)E.supportedTypes.includes(B)&&Y.add(B);a.clear();for(let B of Y)a.add(B)}E.parseCapable||(o=!1,l.push({code:"FORMAT_ONLY_TOKEN",message:`Token "${p.value}" is format-only \u2014 it can't be parsed back into a value. Use a parse-capable variant (e.g. "d" instead of "do") if you need round-trip.`})),E.localeSensitive&&(s=!0),E.calendarSensitive&&(d=!0),E.timezoneSensitive&&(i=!0),E.roundTripSafe||(m=!1),Ae.has(p.value)?y.push(p.value):f(),T+=p.value.length}f();let c=t.map(p=>p.name),g=c.some(p=>p==="hh"||p==="h"),D=c.some(p=>p==="HH"||p==="H"),pn=c.some(p=>p==="a");g&&!pn&&l.push({code:"TWELVE_HOUR_WITHOUT_A",message:`12-hour token ("hh"/"h") used without an "a" (AM/PM) token \u2014 parse() can't tell AM from PM and throws at runtime.`}),g&&D&&l.push({code:"MIXED_12_AND_24_HOUR",message:"Mixing 24-hour and 12-hour tokens \u2014 parse() refuses to guess which is authoritative and throws at runtime."});let Ce=c.some(p=>p==="X"||p==="XX"||p==="XXX"||p==="x"||p==="xx"||p==="xxx"),yn=c.some(p=>p==="zzz");return Ce&&yn&&l.push({code:"ZZZ_WITH_OFFSET_TOKEN",message:`Format string has both "zzz" and an offset token \u2014 parse() cross-checks them and throws if the parsed offset disagrees with the zone's actual offset.`}),Ce&&!r.has("year")&&l.push({code:"OFFSET_WITHOUT_FULL_DATE",message:"Offset token used without a full date \u2014 parse() needs a complete date and time to build a ZonedDateTime and throws at runtime otherwise."}),{tokens:t,requiredFields:[...r].sort(),compatibleTypes:[...a].sort(),parseable:o,localeSensitive:s,calendarSensitive:d,timezoneSensitive:i,ambiguous:l.some(p=>p.code==="AMBIGUOUS_NUMERIC_RUN"),roundTripSafe:m&&o,warnings:l}}function yo(e){let n=W(e),t=[];t.push(`Format string: "${e}"`),t.push(`Tokens (${n.tokens.length}):`);for(let r of n.tokens)t.push(` ${r.name} @${r.position} \u2014 ${r.metadata.meaning}`);if(n.requiredFields.length>0&&t.push(`Required fields: ${n.requiredFields.join(", ")}`),n.compatibleTypes.length>0&&t.push(`Compatible Temporal types: ${n.compatibleTypes.join(", ")}`),t.push(`Parseable: ${n.parseable?"yes":"no"}`),t.push(`Locale-sensitive: ${n.localeSensitive?"yes":"no"}`),t.push(`Calendar-sensitive: ${n.calendarSensitive?"yes":"no"}`),t.push(`Timezone-sensitive: ${n.timezoneSensitive?"yes":"no"}`),t.push(`Ambiguous: ${n.ambiguous?"yes":"no"}`),t.push(`Round-trip safe: ${n.roundTripSafe?"yes":"no"}`),n.warnings.length>0){t.push("Warnings:");for(let r of n.warnings)t.push(` [${r.code}] ${r.message}`)}return t.join(`
27
27
  `)}function go(e){if(e.length>1e3)return!1;try{return q(e),!0}catch{return!1}}function ho(e){return W(e)}function To(e){return he(e)?.field}function De(e){let n=A();try{if(/^\d{4}-\d{2}-\d{2}T/.test(e)||/T\d{2}:\d{2}/.test(e)){if(/[zZ]$/.test(e)||/[+-]\d{2}:?\d{2}$/.test(e)){let t=e;if(/[zZ]$/.test(t))t=t.slice(0,-1)+"+00:00[UTC]";else{let r=/([+-]\d{2}:?\d{2})$/.exec(t);r&&(t=`${t}[${r[1]}]`)}return n.ZonedDateTime.from(t,{overflow:"reject"})}return n.PlainDateTime.from(e,{overflow:"reject"})}if(/^\d{4}-\d{2}-\d{2}/.test(e))return n.PlainDate.from(e,{overflow:"reject"});if(/^\d{2}:\d{2}/.test(e))return n.PlainTime.from(e);throw new Error(`temporal-fmt: parseISO("${e}") doesn't look like an ISO 8601 string.`)}catch(t){throw new ye({input:e,reason:t.message})}}function on(e){let n=e;if(typeof n?.toString!="function")throw new w({reason:`formatISO() expects a Temporal value with toString(), got ${typeof e}.`});return n.toString()}function wo(e){if(!/^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/.exec(e))throw new w({input:e,reason:"does not match RFC 3339 date-time grammar"});let r=e.replace(/[tT]/,"T").replace(/[zZ]$/,"+00:00[UTC]");return De(r)}function vo(e){let n=on(e);if(!/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$/.test(n))throw new w({input:n,reason:"value did not produce RFC 3339-compliant output"});return n}function bo(e){if(!/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s+)?\d{1,2}\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{2,4}\s+\d{2}:\d{2}(?::\d{2})?\s+(?:[+-]\d{4}|[A-Za-z]{1,5})$/.test(e.trim()))throw new w({input:e,reason:"not a valid RFC 2822 date"});let t=Date.parse(e);if(Number.isNaN(t))throw new w({input:e,reason:"not a valid RFC 2822 date"});return j().fromEpochMilliseconds(t)}function So(e){let n=e,t;if(typeof n?.toEpochMilliseconds=="function")t=n.toEpochMilliseconds();else if(typeof n?.epochMilliseconds=="number")t=n.epochMilliseconds;else if(typeof n?.toInstant=="function"){let r=n.toInstant();typeof r.epochMilliseconds=="number"&&(t=r.epochMilliseconds)}if(t===void 0)throw new w({reason:`formatRFC2822() expects a value with epochMilliseconds, toEpochMilliseconds(), or toInstant(), got ${typeof e}.`});return ko(t)}function ko(e){try{let t=new Intl.DateTimeFormat("en-US",{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:"UTC",timeZoneName:"shortOffset",hour12:!1}).formatToParts(new Date(e)),r=i=>t.find(m=>m.type===i)?.value??"",o=r("timeZoneName")?.match(/GMT([+-])(\d+)(?::(\d+))?/),s;if(o){let i=o[1],m=o[2].padStart(2,"0"),l=(o[3]??"0").padStart(2,"0");s=`${i}${m}${l}`;/* c8 ignore start @preserve -- timeZone is hardcoded to 'UTC' above,
28
28
  which always resolves cleanly, so shortOffset always returns a
29
29
  parseable "GMT+0"-shaped string in this environment's ICU. This