Socket
Socket
Sign inDemoInstall

temporal-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

temporal-polyfill - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

CHANGELOG.md

2

dist/global.js

@@ -1,2 +0,2 @@

function n(n,e,t){const r=function(n,e,t){return(o,r)=>{if(void 0===o){const e=r??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[o])throw new RangeError(`Invalid ${n}: ${o}`);return e[o]}}(n,e,t);return(e,t)=>{const i=o(e);return r(i[n],t)}}function e(n,e,t,o){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const r=Math.min(Math.max(n,e),t);if(r!==n&&o===c)throw new RangeError("Invalid overflowed value "+n);return r}function t(n,e){const t={};let o=0;for(const r in e)void 0!==n[r]&&(t[r]=e[r](n[r]),o++);if(!o)throw new TypeError("Invalid object, no keys");return t}function o(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var r=/object|function/;function i(n){return null!==n&&r.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,l(e,(n=>({get:n}))))}function l(n,e){const t={};for(const o in n)t[o]=e(n[o],o);return t}function f(n,e){const t={};return n.forEach(((n,o)=>{t[n]=e(n,o)})),t}function m(n,e,...t){return e instanceof n?e:n.from(e,...t)}var g=class{toJSON(){return this.toString()}},y=class extends g{valueOf(){throw new Error("Cannot convert object using valueOf")}},[p,w]=d(),v=class extends y{constructor(n){super(),w(this,Object.freeze(n))}getISOFields(){return p(this)}},I=1000n,M=1000000n,S=1000000000n,D=60000000000n,F=3600000000000n,O=86400000000000n,T=[1,1e3,1e6,1e9,6e10,36e11,864e11],b=[9,6,3];function N(n){return n<=6}function Y(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),E=["nanosecond","microsecond","millisecond","second","minute","hour"],C=[...E,"day","week","month","year"],P=C.map((n=>n+"s")),U=f(C,((n,e)=>e)),B=f(P,((n,e)=>e));function R(n,e,t,o){let r;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");r=e}else if(r=U[n]??B[n],void 0===r||r<t||r>o)throw new RangeError("Invalid unit "+n);return r}function x(n,e,t,r,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=o(n),u=c.roundingIncrement??1,d=R(c.smallestUnit,e,t,r);if(!s&&a){if(d<6&&864e11%u*T[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?T[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*T[d]>=T[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function k(n,e,t,r,i,s,a){const c=x(n,t,r,i,!a,s);e=Math.max(e,c.smallestUnit);let u=o(n).largestUnit;"auto"===u&&(u=void 0);const d=R(u,e,r,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function j(n,e){return n<e?-1:n>e?1:0}function L(n){return j(n,0)}function q(n,e,t){const o=BigInt(e),r=n/o*o,i=Number(n-r);return r+BigInt(t(i/e))*o}function H(n,e){return(n%e+e)%e}function $(n){return W(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function z(n){return Math.floor(A(n)/1e3)}function A(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function W(n,e,t,o,r,i,s,a,c){return BigInt(G(n,e,t,o,r,i,s))*M+BigInt(a??0)*I+BigInt(c??0)}function G(n,e,t,o,r,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,l,f=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;f<31;f++){h=u-d*f;const n=Date.UTC(g,c-1,h,o??0,r??0,i??0,s??0);if(!tn(n)){l=n+d*f*864e5;break}}return(void 0===l||h<1||h>ln.daysInMonth(a,c))&&on(),m&&(l=new Date(l).setUTCFullYear(a)),l}function J(n){let e=n/M,t=Number(n-e*M);t<0&&(t+=1e6,e-=1n);const o=Math.floor(t/1e3);return t-=1e3*o,{...K(Number(e)),isoMicrosecond:o,isoNanosecond:t}}function K(n){const[e,t]=en(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function Q(n){return en(1e3*n)[0].getUTCFullYear()}function V(n){return Math.floor(G(n)/1e3)}function X(n,e){return Math.round((e-n)/864e5)}function _(n,e){return n+864e5*e}function nn(n,e,t){const[o,r]=en(G(n,e,t));return H(o.getUTCDay()+r,7)||7}function en(n){const e=L(n);let t,o=0;for(;o<31;o++){const r=new Date(n-e*o*864e5);if(!tn(r)){t=r;break}}return void 0===t&&on(),[t,e*o]}function tn(n){return isNaN(n.valueOf())}function on(){throw new RangeError("Date outside of supported range")}function rn(n,e){return String(n).padStart(e,"0")}function sn(n){return n<0?"-":"+"}var an={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{beforeroc:-1,minguo:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},cn=class{constructor(n){this.id=n}monthCode(n,e){return"M"+rn(n,2)}convertMonthCode(n,e){const t=/L$/.test(n),o=parseInt(n.substr(1));if(t)throw new RangeError("Calendar system doesnt support leap months");return[o,!1]}};function un(n,e,t,o){let r=an[dn(n)]?.[t];if(void 0===r){if(!o)throw new Error("Unkown era "+t);r=0}return(r+e)*(L(r)||1)}function dn(n){return n.split("-")[0]}var hn=class extends cn{computeFields(n){const e=K(n);return{era:void 0,eraYear:void 0,year:e.isoYear,month:e.isoMonth,day:e.isoDay}}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},ln=new hn("iso8601"),fn=class extends hn{computeFields(n){const e=super.computeFields(n),{year:t}=e;return{...e,era:t<1?"bce":"ce",eraYear:t<1?-(t-1):t}}},mn=n("calendarName",{auto:0,never:1,always:2},0),gn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},yn={...gn,day:Number},pn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},wn={...yn,...pn},vn={...wn,offset:String},In=f(P,(()=>Number)),Mn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function Sn(n,t=4){const r=o(n),i=r.smallestUnit,s=r.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=R(i,void 0,0,t),d=T[u],a=b[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Dn=n("timeZoneName",{auto:0,never:1},0);function Fn(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/I},epochMilliseconds(){return Number(this.epochNanoseconds/M)},epochSeconds(){return Number(this.epochNanoseconds/S)}})}var On,Tn={calendar:"calendar"};for(const n of C)Tn[n]="iso"+((On=n).charAt(0).toUpperCase()+On.slice(1));function bn(n,e=[]){h(n,f(e.concat("calendar"),(n=>function(){return this.getISOFields()[Tn[n]]})))}var Nn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],Yn=[...Nn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function Zn(n,e){h(n,f(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var En=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0);var Cn=class{constructor(n){this.id=n}},Pn=class extends Cn{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function Un(n,e){const t={},o=n.formatToParts(e);for(const n of o)t[n.type]=n.value;return t}var Bn={bc:"bce",ad:"ce"};function Rn(n){return n=n.toLowerCase().normalize("NFD").replace(/[^a-z0-9]/g,""),Bn[n]||n}var xn=n("offset",{auto:0,never:1},0);function kn(n,e){const t=$(n);jn(t),lo(t,e)}function jn(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&on()}var PlainMonthDay=class extends v{constructor(n,e,t=vo(),o){super({...zt({isoYear:o??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return qn(n.getISOFields());if("object"==typeof n){const o=Mo(n);let r=t(n,Ln);return void 0===r.year&&void 0===n.calendar&&(r={...r,year:1972}),o.monthDayFromFields(r,e)}const o=function(n){const e=Ee.exec(Qe(n));if(e)return{...$e(e),calendar:e[6]?new Calendar2(e[6]):vo()}}(r=String(n))||Le(r)||Xe("monthDay",r);var r;return void 0===o.calendar&&(o.isoYear=1972),qn(Be(o))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,Ln),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=m(PlainMonthDay,n),e.calendar.id===t.calendar.id&&$(e.getISOFields())===$(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?function(n){return rn(n.isoMonth,2)+"-"+rn(n.isoDay,2)}(e):mt(e))+wt(t,o)}toLocaleString(n,e){return ge(this,n,{month:"numeric",day:"numeric",...e,weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};bn(PlainMonthDay),Zn(PlainMonthDay,["monthCode","day"]);var Ln={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function qn(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}var Hn={day:1},PlainYearMonth=class extends v{constructor(n,e,t=vo(),o=1){const r=zt({isoYear:n,isoMonth:e,isoDay:o},c),i=m(Calendar2,t);var s,a;s=r,a=i.id,lo($(s),a),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return zn(n.getISOFields());if("object"==typeof n){const o=t(n,gn);return Mo(n).yearMonthFromFields(o,e)}const o=xe(String(n));return void 0===o.calendar&&(o.isoDay=1),zn(Be(o))}static compare(n,e){return Wn(m(PlainYearMonth,n),m(PlainYearMonth,e))}with(n,e){const t=a(n,gn);return this.calendar.yearMonthFromFields(An(t,this),e)}add(n,e){return $n(this,m(Duration,n),e)}subtract(n,e){return $n(this,m(Duration,n).negated(),e)}until(n,e){return Gt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9))}since(n,e){return Gt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9),!0)}equals(n){return 0===Wn(this,m(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?gt(e):mt(e))+wt(t,o)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",...e,weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function $n(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function zn(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function An(n,e){const t={};let o=!1,r=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,o=!0),void 0!==n.year&&(t.year=n.year,o=!0),o||(t.year=e.year),void 0!==n.month&&(t.month=n.month,r=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,r=!0),r||(t.month=e.month),t}function Wn(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}bn(PlainYearMonth),Zn(PlainYearMonth,Nn);var[Gn,Jn]=d(),ZonedDateTime=class extends v{constructor(n,e,t=vo()){const o=m(TimeZone,e),r=m(Calendar2,t),i=new Instant(n),s=o.getOffsetNanosecondsFor(i),a=J(n+BigInt(s));kn(a,r.id),super({...a,calendar:r,timeZone:o,offset:o.getOffsetStringFor(i)}),Jn(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const o=Mn(e,3),r=u(e);return te(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?oe(t(n,vn),e,r,Mo(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return m(TimeZone,n.timeZone)}(n)):Re(xe(String(n))),e,o)}static compare(n,e){return j(m(ZonedDateTime,n).epochNanoseconds,m(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return Gn(this).epochNanoseconds}get offsetNanoseconds(){return Gn(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,vn),o={...bo(r=t,i=this),offset:r.offset??i.offset};var r,i;const s=Mn(e,0),c=u(e);return En(e),te(oe(o,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=m(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:o}=this,r=o.getInstantFor(t);return new ZonedDateTime(r.epochNanoseconds,o,Do(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return re(this,m(Duration,n),e)}subtract(n,e){return re(this,m(Duration,n).negated(),e)}until(n,e){return ie(this,m(ZonedDateTime,n),e)}since(n,e){return ie(this,m(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const o=at(n);return{day:t(Number(o)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,de(n),t.roundingMode);return Oo(ee(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return he(n,ne(t),t.roundingMode)}(this,n)}equals(n){const e=m(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return te({...this.getISOFields(),...ue,offset:void 0},void 0,3)}get hoursInDay(){return de(this)/36e11}toString(n){const e=Sn(n),t=xn(n),o=Dn(n),r=mn(n),i=he(this,e.roundingIncrement,e.roundingMode).getISOFields();return ft(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,o)+wt(i.calendar.id,r)}toLocaleString(n,e){return function(n,e,t){const o=n.getISOFields(),r=o.calendar.id,i=o.timeZone.id,{timeZone:s}=t;if(void 0!==s&&s!==i)throw new RangeError("Given timeZone must agree");return ye(n.epochMilliseconds,r,e,{timeZone:i,timeZoneName:"short",...t})}(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDateTime(){return Oo(this.getISOFields())}toPlainDate(){return qt(this.getISOFields())}toPlainTime(){return _e(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Kn(n,e,t,o){const r=P[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=P[t];s[e]=n[e]}const a={[r]:i},c=t.add(s),u=c.add(a),d=Qn(c),h=Qn(u),l=Qn(o),f=Number(l-d)/Number(h-d)*i;return s[r]+=f,s}function Qn(n){const{epochNanoseconds:e}=n;return void 0!==e?e:$(n.getISOFields())}function Vn(n,e,t,o,r){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!Y(i))return Yt(_n((ce(o)-ce(t))*(r?-1n:1n),e),i);let u=Kn(n,s,t,o);const d=P[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),r&&(u=Rt(u)),c!==Math.round&&h();let l=Dt(u);return s>0&&(l=r?Tt(l.negated(),i,t).negated():Tt(l,i,t)),l}function Xn(n,e,t){return ct(q(at(n),e,t))}function _n(n,e){return q(n,ne(e),e.roundingMode)}function ne(n){return T[n.smallestUnit]*n.roundingIncrement}function ee(n,e){return{...Lt(n,e.day),...ut(e)}}function te(n,e,t){const{calendar:o,timeZone:r,offset:i,Z:s}=n;let a;if(void 0!==i&&2!==t&&(a=$(n)-BigInt(i),1!==t&&!s)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(a,r.getPossibleInstantsFor(Oo(n)))){if(3===t)throw new RangeError("Mismatching offset/timezone");a=void 0}}return void 0===a&&(a=r.getInstantFor(Oo(n),e).epochNanoseconds),new ZonedDateTime(a,r,o)}function oe(n,e,t,o,r){return{...To(n,e,t,o),timeZone:r,offset:n.offset?(i=n.offset,qe(i)??Xe("timeZone",i)):void 0};var i}function re(n,e,t){const{calendar:o,timeZone:r}=n,i=Ct(e),s=Pt(e),a=o.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:r}),c=at(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,r,o)}function ie(n,e,t,o){const r=k(t,5,0,0,9),{largestUnit:i}=r;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return Vn(se(n,e,i),r,n,e,o)}function se(n,e,t){const o=So(n,e);if(!Y(t))return ae(n,e,t);const r=qt(n.getISOFields());let i,s,a,c,u,d=qt(e.getISOFields());do{s=o.dateUntil(r,d,{largestUnit:C[t]}),i=n.add(s),a=ae(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return Ot(s,a)}function ae(n,e,t){return Yt(ce(e)-ce(n),t)}function ce(n){return n instanceof PlainDateTime?$(n.getISOFields()):n.epochNanoseconds}bn(ZonedDateTime,E),Zn(ZonedDateTime,Yn),Fn(ZonedDateTime);var ue={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function de(n){const e={...n.getISOFields(),...ue,offset:void 0},t=te(e,void 0,3),o=te({...e,...Lt(e,1)},void 0,3);return Number(o.epochNanoseconds-t.epochNanoseconds)}function he(n,e,t){return te({...Co(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}var le=Intl.DateTimeFormat;function fe(n){return void 0===n?n:me(n)}function me(n){return"number"==typeof n||n instanceof Date?n:n instanceof Instant||n instanceof ZonedDateTime?n.epochMilliseconds:A(n.getISOFields())}function ge(n,e,t,o){const r=n.getISOFields(),i=r.calendar.id;let s,{timeZone:a}=t;if(void 0!==a){const e=new TimeZone(a),t=Oo({...ue,...n.getISOFields()});s=e.getInstantFor(t).epochMilliseconds}else s=A(r),a="UTC";return ye(s,i,e,{...t,timeZone:a,timeZoneName:void 0},o)}function ye(n,e,t,o,r){const i=new le(t,{calendar:pe(t)?void 0:e,...o});if((r||"iso8601"!==e)&&e!==i.resolvedOptions().calendar)throw new RangeError("Non-iso calendar mismatch");return i.format(n)}function pe(n){const e=[].concat(n||[]);for(const n of e)if(-1!==n.indexOf("-u-ca-"))return!0;return!1}var we={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},ve=[182,91,273],Ie=class extends Cn{constructor(n){const e=new le("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=we[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const o of e){const[e,r,i]=o,s=n-r,a=n-i;if(e>s&&e>a)return[r];if(!(e<=s&&e<=a))return[r,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(Q(n))]}getOffset(n){const e=Un(this.format,1e3*n);let t=parseInt(e.year);"bce"===Rn(e.era)&&(t=-(t-1));const o=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(o/1e3)-n}getTransition(n,e){const t=Q(n);for(let o=0;o<5;o++){const r=t+o*e,i=this.getTransitionsInYear(r),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const o=i[a+t*e];if(j(o[0],n)===e)return o}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(V(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),o=V(n)-1,r=V(n+1)-1;if(e!==t)return[this.searchTransition(o,r,e,t)];const i=this.searchIsland(e,o);return void 0!==i?[this.searchTransition(o,i[0],e,i[1]),this.searchTransition(i[0],r,i[1],t)]:[]}searchTransition(n,e,t,o){for(;e-n>1;){const o=Math.floor(n+(e-n)/2);this.getOffset(o)===t?n=o:e=o}return[e,t,o]}searchIsland(n,e){for(const t of ve){const o=e+86400*t,r=this.getOffset(o);if(r!==n)return[o,r]}}},Me={UTC:new Pn("UTC",0)};var[Se,De]=d(),TimeZone=class extends g{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),De(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(Me[e])return Me[e];const t=qe(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new Pn(pt(t),Math.trunc(t/1e9))}return Me[e]=new Ie(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=Le(String(n));return new TimeZone(e&&(e.timeZone||e.Z&&"UTC"||void 0!==e.offset&&pt(e.offset))||n)}get id(){return Se(this).id}getOffsetStringFor(n){return pt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=m(Instant,n);return 1e9*Se(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=vo()){const t=m(Instant,n);return Oo({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:m(Calendar2,e)})}getInstantFor(n,e){const t=En(e),o=m(PlainDateTime,n).getISOFields(),r=z(o),i=Se(this).getPossibleOffsets(r);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return Fe(r-s,o)}getPossibleInstantsFor(n){const e=m(PlainDateTime,n).getISOFields(),t=z(e);let o=Se(this).getPossibleOffsets(t);return 2===o.length&&o[0]<o[1]&&(o=[]),o.map((n=>Fe(t-n,e)))}getPreviousTransition(n){const e=m(Instant,n),t=Se(this).getTransition(e.epochSeconds,-1);return t?Fe(t[0]):null}getNextTransition(n){const e=m(Instant,n),t=Se(this).getTransition(e.epochSeconds,1);return t?Fe(t[0]):null}toString(){return this.id}};function Fe(n,e){return new Instant(BigInt(n)*S+(e?BigInt(e.isoMillisecond)*M+BigInt(e.isoMicrosecond)*I+BigInt(e.isoNanosecond):0n))}var Oe="(\\d{2})?:?(\\d{2})?:?(\\d{2})?([.,](\\d{1,9}))?",Te=`([+-])${Oe}`,be=`(Z|${Te})?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?`,Ne=Ve(Te),Ye=Ve(Oe+be),Ze=Ve(`([+-]\\d{6}|\\d{4})-?(\\d{2})?-?(\\d{2})?([T ]${Oe})?`+be),Ee=Ve("(--)?(\\d{2})-?(\\d{2})?"+be),Ce=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Pe=/Z/i,Ue=/\u2212/g;function Be(n){return{...n,calendar:void 0===n.calendar?vo():new Calendar2(n.calendar)}}function Re(n){return{...Be(n),timeZone:new TimeZone(n.timeZone)}}function xe(n){return Le(n)||Xe("dateTime",n)}function ke(n){return function(n){const e=Ye.exec(n);if(e&&e[1])return ze(e.slice(1))}(n)||Le(n)||Xe("time",n)}function je(n){return function(n){const e=Ce.exec(Qe(n));if(e){let n,t,o,r;[n,r]=He(e[8],e[10],5,void 0),[t,r]=He(e[12],e[14],4,r),[o,r]=He(e[16],e[18],3,r);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:Ke(e[2]),months:Ke(e[3]),weeks:Ke(e[4]),days:Ke(e[5]),hours:n,minutes:t,seconds:o});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=ht(BigInt(r||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=Rt(i)),i}}(n)||Xe("duration",n)}function Le(n){const e=Ze.exec(Qe(n));if(e){const n=Pe.test(e[10]);return{...(t=e.slice(1),{isoYear:Je(t[0]),isoMonth:Je(t[1]),isoDay:Je(t[2])}),...ze(e.slice(5)),Z:n,offset:n?0:Ae(e.slice(11)),timeZone:e[18],calendar:e[20]}}var t}function qe(n){const e=Ne.exec(Qe(n));if(e)return Ae(e.slice(1))}function He(n,e,t,o){if(void 0!==n){if(void 0!==o)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?We(e)*(T[t]/1e9):void 0]}if(void 0!==o){const n=Math.trunc(o/T[t]);return[n,o-n*T[t]]}return[void 0,void 0]}function $e(n){return{isoYear:1972,isoMonth:Je(n[2]),isoDay:Je(n[3])}}function ze(n){const e=Ge(n[2]);return{...ut(ht(BigInt(We(n[4]||"")),2)),isoHour:Ge(n[0]),isoMinute:Ge(n[1]),isoSecond:60===e?59:e}}function Ae(n){const e=n[0];if(void 0!==e&&n[1])return("+"===e?1:-1)*function(n){return 36e11*Ge(n[0])+6e10*Ge(n[1])+1e9*Ge(n[2])+We(n[4]||"")}(n.slice(1))}function We(n){return parseInt(n.padEnd(9,"0"))}function Ge(n){return parseInt(n||"0")}function Je(n){return parseInt(n||"1")}function Ke(n){return void 0===n?void 0:parseInt(n)}function Qe(n){return n.replace(Ue,"-")}function Ve(n){return new RegExp(`^${n}$`,"i")}function Xe(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}var PlainTime=class extends v{constructor(n=0,e=0,t=0,o=0,r=0,i=0){super({...nt({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:o,isoMicrosecond:r,isoNanosecond:i},c),calendar:vo()})}static from(n,e){const o=u(e);return _e(n instanceof PlainTime?n.getISOFields():"object"==typeof n?rt(t(n,pn),o):ke(String(n)))}static compare(n,e){return st(m(PlainTime,n),m(PlainTime,e))}with(n,e){return _e(rt(et(a(n,pn),this),u(e)))}add(n){return tt(this,m(Duration,n))}subtract(n){return tt(this,m(Duration,n).negated())}until(n,e){return ot(this,m(PlainTime,n),e)}since(n,e){return ot(m(PlainTime,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5);return _e(ut(Xn(n,ne(t),t.roundingMode)))}(this,n)}equals(n){return 0===st(this,m(PlainTime,n))}toString(n){const e=Sn(n);return yt(ut(Xn(this,e.roundingIncrement,e.roundingMode)),e)}toLocaleString(n,e){return new le(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}).format(Number(at(this)/M))}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return m(PlainDate,n).toPlainDateTime(this)}};function _e(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function nt({isoHour:n,isoMinute:t,isoSecond:o,isoMillisecond:r,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:o=e(o,0,59,a),isoMillisecond:r=e(r,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function et(n,e){return l(pn,((t,o)=>n[o]??e[o]))}function tt(n,e){var t,o;return _e(ut((t=n,o=Pt(e),ct(at(t)+at(o)))))}function ot(n,e,t){const o=k(t,5,0,0,5);return Yt(_n(at(e)-at(n),o),o.largestUnit)}function rt(n,e){return nt(ut(n),e)}function it(n){return m(PlainTime,n??{hour:0})}function st(n,e){return j(at(n),at(e))}function at(n){return BigInt(n.hour)*F+BigInt(n.minute)*D+BigInt(n.second)*S+BigInt(n.millisecond)*M+BigInt(n.microsecond)*I+BigInt(n.nanosecond)}function ct(n){const[e,t]=lt(n);return{...ht(t,5),day:Number(e/O)}}function ut(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function dt(n){return BigInt(n.day)*O+at(n)}function ht(n,e){const t={};for(let o=e;o>=0;o--){const e=BigInt(T[o]),r=n/e;n-=r*e,t[C[o]]=Number(r)}return t}function lt(n){const e=J(n);return[W(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*F+BigInt(t.isoMinute)*D+BigInt(t.isoSecond)*S+BigInt(t.isoMillisecond)*M+BigInt(t.isoMicrosecond)*I+BigInt(t.isoNanosecond))];var t}function ft(n,e){return mt(n)+"T"+yt(n,e)}function mt(n){return gt(n)+"-"+rn(n.isoDay,2)}function gt(n){const{isoYear:e}=n;return(e<1e3||e>9999?sn(e)+rn(Math.abs(e),6):rn(e,4))+"-"+rn(n.isoMonth,2)}function yt(n,e){const t=[rn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(rn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(rn(n.isoSecond,2)+It(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function pt(n){const e=ht(BigInt(Math.abs(n)),5),t=It(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return sn(n)+rn(e.hour,2)+":"+rn(e.minute,2)+(e.second||t?":"+rn(e.second,2)+t:"")}function wt(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function vt(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function It(n,e,t,o,r,i){let s=BigInt(t)+BigInt(e)*I+BigInt(n)*M;r&&(s=q(s,void 0===o?T[i]:Math.pow(10,9-o),r));const a=s<0?-s:s,c=a/S;let u=rn(Number(a-c*S),9);return u=void 0===o?u.replace(/0+$/,""):u.substr(0,o),[u?"."+u:"",Number(c)*(s<0?-1:1)]}bn(PlainTime,E);var[Mt,St]=d(),Duration=class extends y{constructor(n=0,e=0,t=0,o=0,r=0,i=0,s=0,a=0,c=0,u=0){super(),St(this,function(n){const e={};let t=0;for(const o of P){const r=Number(n[o]||0),i=L(n[o]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(r))throw new RangeError("Duration fields must be integers");e[o]=r}return e.sign=t,e}({years:n,months:e,weeks:t,days:o,hours:r,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return Dt("object"==typeof n?t(n,In):je(n))}static compare(n,e,t){return function(n,e,t){const o=m(Duration,n),r=m(Duration,e),i=Et(o),s=Et(r);if(void 0===t&&i&&s)return j(dt(i),dt(s));const a=Ut(t),c=a.add(o),u=a.add(r);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,o(t).relativeTo)}get years(){return Mt(this).years}get months(){return Mt(this).months}get weeks(){return Mt(this).weeks}get days(){return Mt(this).days}get hours(){return Mt(this).hours}get minutes(){return Mt(this).minutes}get seconds(){return Mt(this).seconds}get milliseconds(){return Mt(this).milliseconds}get microseconds(){return Mt(this).microseconds}get nanoseconds(){return Mt(this).nanoseconds}get sign(){return Mt(this).sign}get blank(){return!this.sign}with(n){return Dt({...Mt(this),...a(n,In)})}negated(){return Dt(Rt(Mt(this)))}abs(){return Dt(l(Mt(this),(n=>Math.abs(n))))}add(n,e){return Ft(this,m(Duration,n),o(e).relativeTo)}subtract(n,e){return Ft(this,m(Duration,n).negated(),o(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=Nt(n),o=k(e,t,0,0,9,!1,!0),{largestUnit:r,smallestUnit:s}=o,a=Et(n);if(void 0===e.relativeTo&&a&&N(r)&&N(s)){return Zt(ht(_n(dt(a),o),r))}const c=Bt(e.relativeTo),u=bt(n,r,c);return Vn(u,o,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const o=Et(n);if(void 0===t&&o&&N(e))return Number(dt(o))/T[e];const r=Bt(t),i=bt(n,e,r,!0);return Kn(i,e,r,r.add(i))[P[e]]}(this,R(o(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=Sn(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:o,roundingMode:r}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=It(n.milliseconds,n.microseconds,n.nanoseconds,o,r,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+vt([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+vt([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(Mt(this),e)}toLocaleString(n,e){return this.toString()}};function Dt(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function Ft(n,e,t){const o=Et(n),r=Et(e),i=Math.max(Nt(n),Nt(e));if(void 0===t&&o&&r)return Yt(dt(o)+dt(r),i);const s=Ut(t),a=s.add(n).add(e);return se(s,a,i)}function Ot(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Tt(n,e,t){return t instanceof PlainDate?function(n,e,t){const o=t.add(n);return t.calendar.dateUntil(t,o,{largestUnit:C[e]})}(n,Math.max(6,e),t):bt(n,e,t)}function bt(n,e,t,o){const r=!0!==o&&e>7&&n.weeks;r&&(n=n.with({weeks:0}));const i=t.add(n);let s=se(t,i,e);return r&&(s=Ot(s,new Duration(0,0,r))),s}function Nt(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function Yt(n,e){return Zt(ht(n,e))}function Zt(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function Et(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...Pt(n)}}function Ct(n){return new Duration(n.years,n.months,n.weeks,n.days)}function Pt(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function Ut(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=xe(String(n));return void 0!==e.timeZone?te(Re(e),void 0,0):Oo(Be(e))}}function Bt(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:m(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=Le(String(n));if(e)return void 0!==e.timeZone?te(Re(e),void 0,3):Oo(Be(e));throw new RangeError("Invalid value of relativeTo")}function Rt(n){return l(n,(n=>-n||0))}function xt(n,e,t,o){n=jt(n=kt(n,e.years,t,o),e.months,t,o);let r=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=at(Pt(n)),t=e/O;return[ht(e-t*O,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return r=_(r,7*i.weeks+i.days),K(r)}function kt({year:n,month:t,day:o},r,i,s){n+=r;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?o:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function jt({year:n,month:t,day:o},r,i,s){if(r){if(t+=r,r<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}o=e(o,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:o}}function Lt(n,e){return e?{...K(_(A(n),e)),calendar:n.calendar}:n}function qt(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function Ht(n,e){return{...An(n,e),day:n.day??e.day}}function $t(n,t,o,r,i){return[n=Number(n),t=e(t,1,r.monthsInYear(n),i),o=e(o,1,r.daysInMonth(n,t),i)]}function zt(n,e){const[t,o,r]=$t(n.isoYear,n.isoMonth,n.isoDay,ln,e);return{isoYear:t,isoMonth:o,isoDay:r}}function At(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Wt(n,e){return j(n.year,e.year)||function(n,e){return j(n.month,e.month)||j(n.day,e.day)}(n,e)}function Gt(n,e,t,o){return Vn(So(n,e).dateUntil(n,e,{largestUnit:C[t.largestUnit]}),t,n,e,o)}var PlainDate=class extends v{constructor(n,e,t,o=vo()){const r=zt({isoYear:n,isoMonth:e,isoDay:t},c),i=m(Calendar2,o);!function(n,e){const t=$(n);jn(t+(t<0n?86399999999999n:0n)),lo(t,e)}(r,i.id),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainDate)return qt(n.getISOFields());if("object"==typeof n){const o=t(n,yn);return Mo(n).dateFromFields(o,e)}return qt(Be(xe(String(n))))}static compare(n,e){return At(m(PlainDate,n),m(PlainDate,e))}with(n,e){const t=Ht(a(n,yn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,m(Duration,n).negated(),e)}until(n,e){return Gt(this,m(PlainDate,n),k(e,6,6,6,9))}since(n,e){return Gt(this,m(PlainDate,n),k(e,6,6,6,9),!0)}equals(n){return 0===At(this,m(PlainDate,n))}toString(n){const e=mn(n),t=this.getISOFields();return mt(t)+wt(t.calendar.id,e)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",day:"numeric",...e,hour:void 0,minute:void 0,second:void 0})}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return Oo({...this.getISOFields(),...it(n).getISOFields()})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}};function Jt(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function Kt(n,e,t){let o;if(n instanceof PlainDate)o=n;else if(Jt(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");o=qt(n.getISOFields())}else o=PlainDate.from(n);return Fo(o.calendar,e),o}function Qt(n,e,t){if(Jt(n))return n.getISOFields();let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:d}=n;const h=void 0!==r&&void 0!==o?un(e.id,r,o):void 0;if(void 0===i){if(void 0===h)throw new TypeError("Must specify either a year or an era & eraYear");i=h}else if(void 0!==h&&h!==i)throw new RangeError("year and era/eraYear must match");if(void 0===d)throw new TypeError("Must specify day");const l=u(t);if(void 0!==a){const[n,t]=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");if(s=n,t){if(l===c)throw new RangeError("Month code out of range");d=e.daysInMonth(i,s)}}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");return[i,s,d]=$t(i,s,d,e,l),K(e.epochMilliseconds(i,s,d))}function Vt(n,e){if(Jt(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function Xt(n,e){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function _t(n,e,t,o){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,o))+1}bn(PlainDate),Zn(PlainDate,Yn);var no={hebrew:6,chinese:0,dangi:0},eo=class extends cn{constructor(n){const e=to(n);if(t=n,o=e.resolvedOptions().calendar,dn(t)!==dn(o))throw new RangeError("Invalid calendar: "+n);var t,o;super(n),this.format=e,this.yearCorrection=this.computeFieldsDumb(0).year-1970,this.monthCacheByYear={}}epochMilliseconds(n,e,t){return _(this.queryMonthCache(n)[0][e-1],t-1)}daysInMonth(n,e){const t=this.queryMonthCache(n)[0],o=t[e-1];e>=t.length&&(n++,e=0);return X(o,this.queryMonthCache(n)[0][e])}monthsInYear(n){return this.queryMonthCache(n)[0].length}monthCode(n,e){const t=this.queryLeapMonthByYear(e);return!t||n<t?super.monthCode(n,e):super.monthCode(n-1,e)+(n===t?"L":"")}convertMonthCode(n,e){const t=this.queryLeapMonthByYear(e);let o=/L$/.test(n),r=parseInt(n.substr(1)),i=!1;if(o){const n=no[this.id];if(void 0===n)throw new RangeError("Calendar system doesnt support leap months");if(n){if(r!==n-1)throw new RangeError("Invalid leap-month month code")}else if(r<=1||r>=12)throw new RangeError("Invalid leap-month month code")}return!o||t&&r===t-1||(i=!0,o=!1),(o||t&&r>=t)&&r++,[r,i]}inLeapYear(n){const e=Xt(this,n);return e>Xt(this,n-1)&&e>Xt(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const o=t+100;for(;t<o;t++){const[o,r]=this.convertMonthCode(n,t);if(!r&&o<=this.monthsInYear(t)&&e<=this.daysInMonth(t,o))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}computeFields(n){const e=this.computeFieldsDumb(n),t=this.queryMonthCache(e.year)[2];return{...e,month:t[e.month]}}computeFieldsDumb(n){const e=Un(this.format,n);let t,o,r=parseInt(e.relatedYear||e.year);var i;return e.era&&(i=this.id,void 0!==an[dn(i)])&&(t=Rn(e.era),o=r,r=un(this.id,o,t,!0)),{era:t,eraYear:o,year:r,month:e.month,day:parseInt(e.day)}}queryLeapMonthByYear(n){const e=this.queryMonthCache(n),t=this.queryMonthCache(n-1),o=this.queryMonthCache(n+1);if(e[0].length>t[0].length&&e[0].length>o[0].length){const n=e[1],o=t[1];for(let e=0;e<o.length;e++)if(o[e]!==n[e])return e+1}}queryMonthCache(n){const{monthCacheByYear:e}=this;return e[n]||(e[n]=this.buildMonthCache(n))}buildMonthCache(n){const e=[],t=[],o={};let r=G(this.guessISOYear(n));for(r=_(r,400);;){const o=this.computeFieldsDumb(r);if(o.year<n)break;r=_(r,1-o.day),o.year===n&&(e.unshift(r),t.unshift(o.month)),r=_(r,-1)}for(let n=0;n<t.length;n++)o[t[n]]=n+1;return[e,t,o]}guessISOYear(n){return n-this.yearCorrection}};function to(n){return new le("en-US",{calendar:n,era:"short",year:"numeric",month:"short",day:"numeric",timeZone:"UTC"})}var oo=G(1868,9,8),ro={gregory:fn,japanese:class extends fn{constructor(){super(...arguments),this.format=to("japanese")}computeFields(n){const e=super.computeFields(n);if(n>=oo){const t=Un(this.format,n);e.era=Rn(t.era),e.eraYear=parseInt(t.relatedYear||t.year)}return e}},islamic:class extends eo{guessISOYear(n){return Math.ceil(32*n/33+622)}}},io={iso8601:ln};function so(n){const e=(n=String(n)).toLocaleLowerCase();return io[e]||(io[e]=new(ro[dn(e)]||eo)(n))}var ao=G(1582,10,15),co=G(622,7,18),uo={buddhist:ao,japanese:ao,roc:ao,islamic:co,"islamic-rgsa":co,indian:0},ho={};function lo(n,e){return fo(Number(n/M),e)}function fo(n,e){if(function(n,e){return function(n){let e=ho[n];if(void 0===e){const t=uo[n];if(void 0===t)e=!1;else{let o=so(n);o instanceof eo||(o=new eo(n));const r=t-864e5,i=o.computeFields(r);e=r!==o.epochMilliseconds(i.year,i.month,i.day)}ho[n]=e}return e}(e)&&n<uo[e]}(n,e))throw new RangeError("Invalid timestamp for calendar")}function mo(n,e,t,o){let r=0,i=0,s=0,a=0;switch(o){case 9:r=function(n,e,t){const[,o,r]=$t(e.year,n.month,n.day,t,0),i=Wt(e,n),s=j(e.month,o)||j(e.day,r);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=kt(n,r,t,0);case 8:i=function(n,e,t){let o=0;const r=Wt(e,n);if(r){let{year:i}=n;for(;i!==e.year;)o+=t.monthsInYear(i)*r,i+=r;const[,s,a]=$t(e.year,n.month,n.day,t,0);o+=e.month-s;const c=j(e.day,a);c&&r&&c!==r&&(o-=r)}return o}(n,e,t),n=jt(n,i,t,0)}return a=X(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===o&&(s=Math.trunc(a/7),a%=7),new Duration(r,i,s,a)}function go(n,e,t){const o=7+e-t;return-H(nn(n,1,o)-e,7)+o-1}function yo(n,e,t){const o=go(n,e,t),r=go(n+1,e,t);return(Xt(ln,n)-o+r)/7}var[po,wo]=d(),Calendar2=class extends g{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),wo(this,so(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar2(String(n))}(n.calendar):n;const e=Le(String(n));return new Calendar2(e?e.calendar||"iso8601":n)}get id(){return po(this).id}era(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).era}eraYear(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).eraYear}year(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).year}month(n){const e=Vt(n,!0);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).month}monthCode(n){const e=Kt(n,this);return po(this).monthCode(e.month,e.year)}day(n){const e=Vt(n);return Io(po(this),e.isoYear,e.isoMonth,e.isoDay).day}dayOfWeek(n){const e=Vt(n,!0);return nn(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=Kt(n,this,!0);return _t(po(this),e.year,e.month,e.day)}weekOfYear(n){const e=Vt(n,!0);return function(n,e,t,o,r){const i=go(n,o,r),s=Math.floor((_t(ln,n,e,t)-i-1)/7)+1;if(s<1)return s+yo(n-1,o,r);const a=yo(n,o,r);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return Vt(n,!0),7}daysInMonth(n){const e=Kt(n,this,!0);return po(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=Kt(n,this,!0);return Xt(po(this),e.year)}monthsInYear(n){const e=Kt(n,this,!0);return po(this).monthsInYear(e.year)}inLeapYear(n){return po(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=Qt(n,po(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=Qt({...n,day:1},po(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=po(this);let{era:o,eraYear:r,year:i,monthCode:s,day:a}=n;if(void 0===a)throw new TypeError("required property 'day' missing or undefined");void 0!==o&&void 0!==r&&(i=un(t.id,r,o));let c=i;if(void 0===c){if(void 0===s)throw new TypeError("either year or monthCode required with month");c=t.guessYearForMonthDay(s,a)}const u=Qt({...n,year:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const o=po(this),r=xt(m(PlainDate,n,t),m(Duration,e),o,u(t));return new PlainDate(r.isoYear,r.isoMonth,r.isoDay,this)}dateUntil(n,e,t){const r=po(this),i=m(PlainDate,n),s=m(PlainDate,e),a=R(o(t).largestUnit,6,6,9);return Fo(So(i,s),this),mo(i,s,r,a)}toString(){return this.id}};function vo(){return new Calendar2("iso8601")}function Io(n,e,t,o){const r=G(e,t,o);return fo(r,n.id),n.computeFields(r)}function Mo(n){return void 0===n.calendar?vo():m(Calendar2,n.calendar)}function So(n,e){const{calendar:t}=n;return Fo(t,e.calendar),t}function Do(n,e){const t=n.calendar,o=e.calendar;if("iso8601"===t.id)return o;if("iso8601"===o.id)return t;if(t.id!==o.id)throw new RangeError("Non-ISO calendars incompatible");return t}function Fo(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends v{constructor(n,e,t,o=0,r=0,i=0,s=0,a=0,u=0,d=vo()){const h=No({isoYear:n,isoMonth:e,isoDay:t,isoHour:o,isoMinute:r,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c),l=m(Calendar2,d);kn(h,l.id),super({...h,calendar:l})}static from(n,e){const o=u(e);return Oo(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?To(t(n,wn),e,o,Mo(n)):Be(xe(String(n))))}static compare(n,e){return Yo(m(PlainDateTime,n),m(PlainDateTime,e))}with(n,e){return Oo(To(bo(a(n,wn),this),e,u(e),this.calendar))}withPlainDate(n){const e=m(PlainDate,n);return Oo({...this.getISOFields(),...e.getISOFields(),calendar:Do(this,e)})}withPlainTime(n){return Oo({...this.getISOFields(),...it(n).getISOFields()})}withCalendar(n){return Oo({...this.getISOFields(),calendar:m(Calendar2,n)})}add(n,e){return Zo(this,m(Duration,n),e)}subtract(n,e){return Zo(this,m(Duration,n).negated(),e)}until(n,e){return Eo(this,m(PlainDateTime,n),e)}since(n,e){return Eo(this,m(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);return Co(n,ne(t),t.roundingMode)}(this,n)}equals(n){return 0===Yo(this,m(PlainDateTime,n))}toString(n){const e=Sn(n),t=mn(n),o=Co(this,e.roundingIncrement,e.roundingMode).getISOFields();return ft(o,e)+wt(o.calendar.id,t)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toZonedDateTime(n,e){const t=m(TimeZone,n),o=t.getInstantFor(this,e);return new ZonedDateTime(o.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDate(){return qt(this.getISOFields())}toPlainTime(){return _e(this.getISOFields())}};function Oo(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function To(n,e,t,o){return{...o.dateFromFields(n,e).getISOFields(),...rt(n,t)}}function bo(n,e){return{...Ht(n,e),...et(n,e)}}function No(n,e){return{...zt(n,e),...nt(n,e)}}function Yo(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Zo(n,e,t){const{calendar:o}=n,r=Ct(e),i=Pt(e);return Oo({...J($(o.dateAdd(qt(n.getISOFields()),r,t).getISOFields())+at(n)+at(i)),calendar:o})}function Eo(n,e,t,o){const r=k(t,6,0,0,9);return Vn(se(n,e,r.largestUnit),r,n,e,o)}function Co(n,e,t){const o=Xn(n,e,t);return Oo(ee(n.getISOFields(),o))}function Po(n,e){return j(n.epochNanoseconds,e.epochNanoseconds)}function Uo(n,e){if(Nt(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+at(Pt(e)))}function Bo(n,e,t){const o=k(t,3,0,0,5,!0);return Yt(_n(e.epochNanoseconds-n.epochNanoseconds,o),o.largestUnit)}bn(PlainDateTime,E),Zn(PlainDateTime,Yn);var[Ro,xo]=d(),Instant=class extends y{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&on(),xo(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=xe(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant($(No(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*S)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*M)}static fromEpochMicroseconds(n){return new Instant(n*I)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Po(m(Instant,n),m(Instant,e))}get epochNanoseconds(){return Ro(this)}add(n){return Uo(this,m(Duration,n))}subtract(n){return Uo(this,m(Duration,n).negated())}until(n,e){return Bo(this,m(Instant,n),e)}since(n,e){return Bo(m(Instant,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5,!1,!0),[o,r]=lt(n.epochNanoseconds);return new Instant(o+_n(r,t))}(this,n)}equals(n){return 0===Po(this,m(Instant,n))}toString(n){const e=o(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toLocaleString(n,e){return new le(n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e}).format(this.epochMilliseconds)}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};function ko(n=$o()){return Ho().toZonedDateTimeISO(n)}function jo(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return Ho().toZonedDateTime({calendar:n,timeZone:e??$o()})}function Lo(n=$o()){return ko(n).toPlainDateTime()}function qo(n,e){return jo(n,e).toPlainDateTime()}function Ho(){return new Instant(BigInt(Date.now())*M)}function $o(){return new TimeZone((new le).resolvedOptions().timeZone)}Fn(Instant);var zo={zonedDateTimeISO:ko,zonedDateTime:jo,plainDateTimeISO:Lo,plainDateTime:qo,plainDateISO:function(n=$o()){return Lo(n).toPlainDate()},plainDate:function(n,e){return qo(n,e).toPlainDate()},plainTimeISO:function(n=$o()){return Ho().toZonedDateTimeISO(n).toPlainTime()},instant:Ho,timeZone:$o};!function(){if(!globalThis.Temporal){globalThis.Temporal={PlainYearMonth:PlainYearMonth,PlainMonthDay:PlainMonthDay,PlainDate:PlainDate,PlainTime:PlainTime,PlainDateTime:PlainDateTime,ZonedDateTime:ZonedDateTime,Instant:Instant,Calendar:Calendar2,TimeZone:TimeZone,Duration:Duration,Now:zo},globalThis.Date.prototype.toTemporalInstant=function(){return n=this,Instant.fromEpochMilliseconds(n.valueOf());var n};class n extends le{format(n){return super.format(fe(n))}formatToParts(n){return super.formatToParts(fe(n))}formatRange(n,e){return super.formatRange(me(n),me(e))}formatRangeToParts(n,e){return super.formatRangeToParts(me(n),me(e))}}globalThis.Intl.DateTimeFormat=n}}();
function n(n,e,t){const r=function(n,e,t){return(o,r)=>{if(void 0===o){const e=r??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[o])throw new RangeError(`Invalid ${n}: ${o}`);return e[o]}}(n,e,t);return(e,t)=>{const i=o(e);return r(i[n],t)}}function e(n,e,t,o){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const r=Math.min(Math.max(n,e),t);if(r!==n&&o===c)throw new RangeError("Invalid overflowed value "+n);return r}function t(n,e){const t={};let o=0;for(const r in e)void 0!==n[r]&&(t[r]=e[r](n[r]),o++);if(!o)throw new TypeError("Invalid object, no keys");return t}function o(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var r=/object|function/;function i(n){return null!==n&&r.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,l(e,(n=>({get:n}))))}function l(n,e){const t={};for(const o in n)t[o]=e(n[o],o);return t}function f(n,e){const t={};return n.forEach(((n,o)=>{t[n]=e(n,o)})),t}var m=Symbol();function g(n,e,...t){return e instanceof n?e:n.from(e,...t)}var y=class{toJSON(){return this.toString()}},p=class extends y{valueOf(){throw new Error("Cannot convert object using valueOf")}},[w,v]=d(),M=class extends p{constructor(n){super(),v(this,Object.freeze(n))}getISOFields(){return w(this)}},I=1000n,S=1000000n,b=1000000000n,F=60000000000n,D=3600000000000n,T=86400000000000n,O=[1,1e3,1e6,1e9,6e10,36e11,864e11],N=[9,6,3];function Y(n){return n<=6}function E(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),C=["nanosecond","microsecond","millisecond","second","minute","hour"],P=[...C,"day","week","month","year"],U=P.map((n=>n+"s")),B=f(P,((n,e)=>e)),R=f(U,((n,e)=>e));function k(n,e,t,o){let r;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");r=e}else if(r=B[n]??R[n],void 0===r||r<t||r>o)throw new RangeError("Invalid unit "+n);return r}function x(n,e,t,r,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=o(n),u=c.roundingIncrement??1,d=k(c.smallestUnit,e,t,r);if(!s&&a){if(d<6&&864e11%u*O[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?O[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*O[d]>=O[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function j(n,e,t,r,i,s,a){const c=x(n,t,r,i,!a,s);e=Math.max(e,c.smallestUnit);let u=o(n).largestUnit;"auto"===u&&(u=void 0);const d=k(u,e,r,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function q(n,e){return n<e?-1:n>e?1:0}function L(n){return q(n,0)}function H(n,e,t){const o=BigInt(e),r=n/o*o,i=Number(n-r);return r+BigInt(t(i/e))*o}function $(n,e){return(n%e+e)%e}function z(n){return K(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function A(n){return Math.floor(W(n)/1e3)}function W(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function K(n,e,t,o,r,i,s,a,c){return BigInt(G(n,e,t,o,r,i,s))*S+BigInt(a??0)*I+BigInt(c??0)}function G(n,e,t,o,r,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,l,f=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;f<31;f++){h=u-d*f;const n=Date.UTC(g,c-1,h,o??0,r??0,i??0,s??0);if(!on(n)){l=n+d*f*864e5;break}}return(void 0===l||h<1||h>fn.daysInMonth(a,c))&&rn(),m&&(l=new Date(l).setUTCFullYear(a)),l}function J(n){let e=n/S,t=Number(n-e*S);t<0&&(t+=1e6,e-=1n);const o=Math.floor(t/1e3);return t-=1e3*o,{...Q(Number(e)),isoMicrosecond:o,isoNanosecond:t}}function Q(n){const[e,t]=tn(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function V(n){return tn(1e3*n)[0].getUTCFullYear()}function X(n){return Math.floor(G(n)/1e3)}function _(n,e){return Math.round((e-n)/864e5)}function nn(n,e){return n+864e5*e}function en(n,e,t){const[o,r]=tn(G(n,e,t));return $(o.getUTCDay()+r,7)||7}function tn(n){const e=L(n);let t,o=0;for(;o<31;o++){const r=new Date(n-e*o*864e5);if(!on(r)){t=r;break}}return void 0===t&&rn(),[t,e*o]}function on(n){return isNaN(n.valueOf())}function rn(){throw new RangeError("Date outside of supported range")}function sn(n,e){return String(n).padStart(e,"0")}function an(n){return n<0?"-":"+"}var cn={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{beforeroc:-1,minguo:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},un=class{constructor(n){this.id=n}monthCode(n,e){return"M"+sn(n,2)}convertMonthCode(n,e){const t=/L$/.test(n),o=parseInt(n.substr(1));if(t)throw new RangeError("Calendar system doesnt support leap months");return[o,!1]}};function dn(n,e,t,o){let r=cn[hn(n)]?.[t];if(void 0===r){if(!o)throw new Error("Unkown era "+t);r=0}return(r+e)*(L(r)||1)}function hn(n){return n.split("-")[0]}var ln=class extends un{computeFields(n){const e=Q(n);return{era:void 0,eraYear:void 0,year:e.isoYear,month:e.isoMonth,day:e.isoDay}}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},fn=new ln("iso8601"),mn=class extends ln{computeFields(n){const e=super.computeFields(n),{year:t}=e;return{...e,era:t<1?"bce":"ce",eraYear:t<1?-(t-1):t}}},gn=n("calendarName",{auto:0,never:1,always:2},0),yn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},pn={...yn,day:Number},wn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},vn={...pn,...wn},Mn={...vn,offset:String},In=f(U,(()=>Number)),Sn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function bn(n,t=4){const r=o(n),i=r.smallestUnit,s=r.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=k(i,void 0,0,t),d=O[u],a=N[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Fn=n("timeZoneName",{auto:0,never:1},0);function Dn(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/I},epochMilliseconds(){return Number(this.epochNanoseconds/S)},epochSeconds(){return Number(this.epochNanoseconds/b)}})}var Tn,On={calendar:"calendar"};for(const n of P)On[n]="iso"+((Tn=n).charAt(0).toUpperCase()+Tn.slice(1));function Nn(n,e=[]){h(n,f(e.concat("calendar"),(n=>function(){return this.getISOFields()[On[n]]})))}var Yn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],En=[...Yn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function Zn(n,e){h(n,f(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var Cn="(\\d{2})(:?(\\d{2})(:?(\\d{2})([.,](\\d{1,9}))?)?)?",Pn="([+-])"+Cn,Un="(Z|"+Pn+")?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?",Bn=Hn("([+-]\\d{6}|\\d{4})-?(\\d{2})"+Un),Rn=Hn("(--)?(\\d{2})-?(\\d{2})"+Un),kn=Hn("([+-]\\d{6}|\\d{4})-?(\\d{2})-?(\\d{2})([T ](\\d{2})(:?(\\d{2})(:?(\\d{2})([.,](\\d{1,9}))?)?)?)?"+Un),xn=Hn(Cn+Un),jn=Hn(Pn),qn=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Ln=/\u2212/g;function Hn(n){return new RegExp(`^${n}$`,"i")}function $n(n){const e=Jn(n);if(!e)throw se("dateTime",n);return e}function zn(n){const e=Qn(n);if(!e)throw se("dateTime",n);return e}function An(n){const e=function(n){const e=Bn.exec(ie(n));if(e)return{calendar:(t=e.slice(1))[14],isoYear:oe(t[0]),isoMonth:oe(t[1]),isoDay:1};var t}(n)||Qn(n);if(!e)throw se("yearMonth",n);return e}function Wn(n){const e=function(n){const e=Rn.exec(ie(n));if(e)return{calendar:(t=e.slice(1))[15],isoYear:1972,isoMonth:oe(t[1]),isoDay:oe(t[2])};var t}(n)||Qn(n);if(!e)throw se("monthDay",n);return e}function Kn(n){const e=Vn(n);if(void 0===e)throw se("timeZone",n);return e}function Gn(n){const e=function(n){const e=xn.exec(ie(n));if(e)return _n(e.slice(1))}(n)||Qn(n);if(void 0===e)throw se("time",n);return e}function Jn(n){const e=kn.exec(ie(n));if(e)return function(n){const e=n[11];let t,o=!1;e&&(o="Z"===e.toUpperCase(),t=o?0:ne(n.slice(12)));return{...Xn(n),timeZone:n[21],offset:t,Z:o}}(e.slice(1))}function Qn(n){const e=kn.exec(ie(n));if(e)return Xn(e.slice(1))}function Vn(n){const e=jn.exec(ie(n));if(e)return ne(e.slice(1))}function Xn(n){return{calendar:n[23],isoYear:oe(n[0]),isoMonth:oe(n[1]),isoDay:oe(n[2]),..._n(n.slice(4))}}function _n(n){const e=te(n[4]);return{...pt(vt(BigInt(ee(n[6]||"")),2)),isoHour:te(n[0]),isoMinute:te(n[2]),isoSecond:60===e?59:e}}function ne(n){return("+"===n[0]?1:-1)*function(n){return 36e11*te(n[0])+6e10*te(n[2])+1e9*te(n[4])+ee(n[6]||"")}(n.slice(1))}function ee(n){return parseInt(n.padEnd(9,"0"))}function te(n){return parseInt(n||"0")}function oe(n){return parseInt(n||"1")}function re(n){return void 0===n?void 0:parseInt(n)}function ie(n){return n.replace(Ln,"-")}function se(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}function ae(n,e,t,o){const r=U[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=U[t];s[e]=n[e]}const a={[r]:i},c=t.add(s),u=c.add(a),d=ce(c),h=ce(u),l=ce(o),f=Number(l-d)/Number(h-d)*i;return s[r]+=f,s}function ce(n){const{epochNanoseconds:e}=n;return void 0!==e?e:z(n.getISOFields())}var ue=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0),de=n("offset",{auto:0,never:1},0);function he(n){return{...n,calendar:void 0===n.calendar?Zo():new Calendar(n.calendar)}}function le(n){return{...he(n),timeZone:new TimeZone(n.timeZone)}}var fe=class{constructor(n){this.id=n}},me=class extends fe{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function ge(n,e){const t={},o=n.formatToParts(e);for(const n of o)t[n.type]=n.value;return t}var ye={bc:"bce",ad:"ce"};function pe(n){return n=n.toLowerCase().normalize("NFD").replace(/[^a-z0-9]/g,""),ye[n]||n}var we=Intl.DateTimeFormat;function ve(n){return[].concat(n||[])}var Me={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},Ie=[182,91,273],Se=class extends fe{constructor(n){const e=new we("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=Me[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const o of e){const[e,r,i]=o,s=n-r,a=n-i;if(e>s&&e>a)return[r];if(!(e<=s&&e<=a))return[r,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(V(n))]}getOffset(n){const e=ge(this.format,1e3*n);let t=parseInt(e.year);"bce"===pe(e.era)&&(t=-(t-1));const o=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(o/1e3)-n}getTransition(n,e){const t=V(n);for(let o=0;o<100;o++){const r=t+o*e,i=this.getTransitionsInYear(r),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const o=i[a+t*e];if(q(o[0],n)===e)return o}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(X(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),o=X(n)-1,r=X(n+1)-1;if(e!==t)return[this.searchTransition(o,r,e,t)];const i=this.searchIsland(e,o);return void 0!==i?[this.searchTransition(o,i[0],e,i[1]),this.searchTransition(i[0],r,i[1],t)]:[]}searchTransition(n,e,t,o){for(;e-n>1;){const o=Math.floor(n+(e-n)/2);this.getOffset(o)===t?n=o:e=o}return[e,t,o]}searchIsland(n,e){for(const t of Ie){const o=e+86400*t,r=this.getOffset(o);if(r!==n)return[o,r]}}},be={UTC:new me("UTC",0)};var[Fe,De]=d(),TimeZone=class extends y{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),De(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(be[e])return be[e];const t=Vn(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new me(Dt(t),Math.trunc(t/1e9))}return be[e]=new Se(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=Jn(String(n));if(e){if(e.timeZone){const n=le(e);return We(n,3),n.timeZone}if(e.Z)return new TimeZone("UTC");if(void 0!==e.offset)return new TimeZone(Dt(e.offset))}return new TimeZone(n)}get id(){return Fe(this).id}getOffsetStringFor(n){return Dt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=g(Instant,n);return 1e9*Fe(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=Zo()){const t=g(Instant,n);return ko({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:g(Calendar,e)})}getInstantFor(n,e){const t=ue(e),o=g(PlainDateTime,n).getISOFields(),r=A(o),i=Fe(this).getPossibleOffsets(r);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return Te(r-s,o)}getPossibleInstantsFor(n){const e=g(PlainDateTime,n).getISOFields(),t=A(e);let o=Fe(this).getPossibleOffsets(t);return 2===o.length&&o[0]<o[1]&&(o=[]),o.map((n=>Te(t-n,e)))}getPreviousTransition(n){const e=g(Instant,n),t=Fe(this).getTransition(e.epochSeconds,-1);return t?Te(t[0]):null}getNextTransition(n){const e=g(Instant,n),t=Fe(this).getTransition(e.epochSeconds,1);return t?Te(t[0]):null}toString(){return this.id}};function Te(n,e){return new Instant(BigInt(n)*b+(e?BigInt(e.isoMillisecond)*S+BigInt(e.isoMicrosecond)*I+BigInt(e.isoNanosecond):0n))}function Oe(n,e){const t=z(n);Ne(t),Fo(t,e)}function Ne(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&rn()}function Ye(n,e,t){return(o,r)=>{const i=Be(n,r)?{}:{...n,...e};return{buildKey:Ue(o,r,!1),buildFormat:function(n,e){return new we(o,{calendar:n,timeZone:e||void 0,...i,...r,...t})},buildEpochMilli:Ee}}}function Ee(n){return n.epochMilliseconds}function Ze(n,e,t){return(o,r)=>{const i=Be(n,r)?{}:n;return{buildKey:Ue(o,r,t),buildFormat:function(n,t){return new we(o,{calendar:n,...i,...r,...e,timeZone:t,timeZoneName:void 0})},buildEpochMilli:void 0!==r.timeZone?Ce.bind(null,new TimeZone(r.timeZone)):Pe}}}function Ce(n,e){const t=ko({..._e,...e.getISOFields()});return n.getInstantFor(t).epochMilliseconds}function Pe(n){return W(n.getISOFields())}function Ue(n,e,t){const o=e.calendar??function(n){for(const e of n){const n=e.match(/-u-ca-(.*)$/);if(n)return n[1]}return}(n),r=e.timeZone;return function(n,e){const i=n.calendar?.id,s=n.timeZone?.id;if(e){if(e.calendar?.id!==i)throw new RangeError("Mismatching calendar");if(e.timeZone?.id!==s)throw new RangeError("Mismatching timeZone")}if((t||"iso8601"!==i)&&void 0!==i&&void 0!==o&&o!==i)throw new RangeError("Non-iso calendar mismatch");if(void 0!==s&&void 0!==r&&r!==s)throw new RangeError("Given timeZone must agree");return[o||i||"iso8601",r||s||"UTC"]}}function Be(n,e){for(const t in n)if(void 0!==e[t])return!0;return!1}function Re(n,e){n.prototype.toLocaleString=function(n,t){const o=e(ve(n),t||{});return o.buildFormat(...o.buildKey(this)).format(o.buildEpochMilli(this))},n.prototype[m]=e}function ke(n){return n?.[m]}var xe={day:1},PlainYearMonth=class extends M{constructor(n,e,t=Zo(),o=1){const r=to({isoYear:n,isoMonth:e,isoDay:o},c),i=g(Calendar,t);var s,a;s=r,a=i.id,Fo(z(s),a),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return qe(n.getISOFields());if("object"==typeof n){const o=t(n,yn);return Po(n).yearMonthFromFields(o,e)}const o=An(String(n));return void 0===o.calendar&&(o.isoDay=1),qe(he(o))}static compare(n,e){return He(g(PlainYearMonth,n),g(PlainYearMonth,e))}with(n,e){const t=a(n,yn);return this.calendar.yearMonthFromFields(Le(t,this),e)}add(n,e){return je(this,g(Duration,n),e)}subtract(n,e){return je(this,g(Duration,n).negated(),e)}until(n,e){return io(this.toPlainDate(xe),g(PlainYearMonth,n).toPlainDate(xe),j(e,9,8,8,9))}since(n,e){return io(this.toPlainDate(xe),g(PlainYearMonth,n).toPlainDate(xe),j(e,9,8,8,9),!0)}equals(n){return 0===He(this,g(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=gn(n);return("iso8601"===t?bt(e):St(e))+Tt(t,o)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function je(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function qe(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function Le(n,e){const t={};let o=!1,r=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,o=!0),void 0!==n.year&&(t.year=n.year,o=!0),o||(t.year=e.year),void 0!==n.month&&(t.month=n.month,r=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,r=!0),r||(t.month=e.month),t}function He(n,e){return q(z(n.getISOFields()),z(e.getISOFields()))||q(n.calendar.id,e.calendar.id)}Nn(PlainYearMonth),Zn(PlainYearMonth,Yn),Re(PlainYearMonth,Ze({year:"numeric",month:"numeric"},{weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0));var[$e,ze]=d(),ZonedDateTime=class extends M{constructor(n,e,t=Zo()){const o=g(TimeZone,e),r=g(Calendar,t),i=new Instant(n),s=o.getOffsetNanosecondsFor(i),a=J(n+BigInt(s));Oe(a,r.id),super({...a,calendar:r,timeZone:o,offset:o.getOffsetStringFor(i)}),ze(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const o=Sn(e,3),r=u(e);return Ae(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?Ke(t(n,Mn),e,r,Po(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return g(TimeZone,n.timeZone)}(n)):le($n(String(n))),e,o)}static compare(n,e){return q(g(ZonedDateTime,n).epochNanoseconds,g(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return $e(this).epochNanoseconds}get offsetNanoseconds(){return $e(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,Mn),o={...jo(r=t,i=this),offset:r.offset??i.offset};var r,i;const s=Sn(e,0),c=u(e);return ue(e),Ae(Ke(o,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=g(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:o}=this,r=o.getInstantFor(t);return new ZonedDateTime(r.epochNanoseconds,o,Bo(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return Ge(this,g(Duration,n),e)}subtract(n,e){return Ge(this,g(Duration,n).negated(),e)}until(n,e){return Je(this,g(ZonedDateTime,n),e)}since(n,e){return Je(this,g(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const o=gt(n);return{day:t(Number(o)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,nt(n),t.roundingMode);return ko(st(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return et(n,it(t),t.roundingMode)}(this,n)}equals(n){const e=g(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return Ae({...this.getISOFields(),..._e,offset:void 0},void 0,3)}get hoursInDay(){return nt(this)/36e11}toString(n){const e=bn(n),t=de(n),o=Fn(n),r=gn(n),i=et(this,e.roundingIncrement,e.roundingMode).getISOFields();return It(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,o)+Tt(i.calendar.id,r)}toPlainYearMonth(){return qe(this.getISOFields())}toPlainMonthDay(){return this.calendar.monthDayFromFields(this)}toPlainDateTime(){return ko(this.getISOFields())}toPlainDate(){return _t(this.getISOFields())}toPlainTime(){return at(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Ae(n,e,t){const{calendar:o,timeZone:r}=n,i=We(n,t)??r.getInstantFor(ko(n),e).epochNanoseconds;return new ZonedDateTime(i,r,o)}function We(n,e){const{timeZone:t,offset:o,Z:r}=n;let i;if(void 0!==o&&2!==e&&(i=z(n)-BigInt(o),1!==e&&!r)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(i,t.getPossibleInstantsFor(ko(n)))){if(3===e)throw new RangeError("Mismatching offset/timezone");i=void 0}}return i}function Ke(n,e,t,o,r){return{...xo(n,e,t,o),timeZone:r,offset:n.offset?Kn(n.offset):void 0}}function Ge(n,e,t){const{calendar:o,timeZone:r}=n,i=Ht(e),s=$t(e),a=o.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:r}),c=gt(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,r,o)}function Je(n,e,t,o){const r=j(t,5,0,0,9),{largestUnit:i}=r;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return tt(Qe(n,e,i),r,n,e,o)}function Qe(n,e,t){const o=Uo(n,e);if(!E(t))return Ve(n,e,t);const r=_t(n.getISOFields());let i,s,a,c,u,d=_t(e.getISOFields());do{s=o.dateUntil(r,d,{largestUnit:P[t]}),i=n.add(s),a=Ve(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return Bt(s,a)}function Ve(n,e,t){return jt(Xe(e)-Xe(n),t)}function Xe(n){return n instanceof PlainDateTime?z(n.getISOFields()):n.epochNanoseconds}Nn(ZonedDateTime,C),Zn(ZonedDateTime,En),Dn(ZonedDateTime),Re(ZonedDateTime,Ye({year:"numeric",month:"numeric",day:"numeric",weekday:void 0,hour:"numeric",minute:"2-digit",second:"2-digit"},{timeZoneName:"short"},{}));var _e={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function nt(n){const e={...n.getISOFields(),..._e,offset:void 0},t=Ae(e,void 0,3),o=Ae({...e,...Qt(e,1)},void 0,3);return Number(o.epochNanoseconds-t.epochNanoseconds)}function et(n,e,t){return Ae({...zo(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}function tt(n,e,t,o,r){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!E(i))return jt(rt((Xe(o)-Xe(t))*(r?-1n:1n),e),i);let u=ae(n,s,t,o);const d=U[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),r&&(u=Wt(u)),c!==Math.round&&h();let l=Pt(u);return s>0&&(l=r?Rt(l.negated(),i,t).negated():Rt(l,i,t)),l}function ot(n,e,t){return yt(H(gt(n),e,t))}function rt(n,e){return H(n,it(e),e.roundingMode)}function it(n){return O[n.smallestUnit]*n.roundingIncrement}function st(n,e){return{...Qt(n,e.day),...pt(e)}}var PlainTime=class extends M{constructor(n=0,e=0,t=0,o=0,r=0,i=0){super({...ct({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:o,isoMicrosecond:r,isoNanosecond:i},c),calendar:Zo()})}static from(n,e){const o=u(e);return at(n instanceof PlainTime?n.getISOFields():"object"==typeof n?lt(t(n,wn),o):Gn(String(n)))}static compare(n,e){return mt(g(PlainTime,n),g(PlainTime,e))}with(n,e){return at(lt(ut(a(n,wn),this),u(e)))}add(n){return dt(this,g(Duration,n))}subtract(n){return dt(this,g(Duration,n).negated())}until(n,e){return ht(this,g(PlainTime,n),e)}since(n,e){return ht(g(PlainTime,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5);return at(pt(ot(n,it(t),t.roundingMode)))}(this,n)}equals(n){return 0===mt(this,g(PlainTime,n))}toString(n){const e=bn(n);return Ft(pt(ot(this,e.roundingIncrement,e.roundingMode)),e)}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return g(PlainDate,n).toPlainDateTime(this)}};function at(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function ct({isoHour:n,isoMinute:t,isoSecond:o,isoMillisecond:r,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:o=e(o,0,59,a),isoMillisecond:r=e(r,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function ut(n,e){return l(wn,((t,o)=>n[o]??e[o]))}function dt(n,e){var t,o;return at(pt((t=n,o=$t(e),yt(gt(t)+gt(o)))))}function ht(n,e,t){const o=j(t,5,0,0,5);return jt(rt(gt(e)-gt(n),o),o.largestUnit)}function lt(n,e){return ct(pt(n),e)}function ft(n){return g(PlainTime,n??{hour:0})}function mt(n,e){return q(gt(n),gt(e))}function gt(n){return BigInt(n.hour)*D+BigInt(n.minute)*F+BigInt(n.second)*b+BigInt(n.millisecond)*S+BigInt(n.microsecond)*I+BigInt(n.nanosecond)}function yt(n){const[e,t]=Mt(n);return{...vt(t,5),day:Number(e/T)}}function pt(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function wt(n){return BigInt(n.day)*T+gt(n)}function vt(n,e){const t={};for(let o=e;o>=0;o--){const e=BigInt(O[o]),r=n/e;n-=r*e,t[P[o]]=Number(r)}return t}function Mt(n){const e=J(n);return[K(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*D+BigInt(t.isoMinute)*F+BigInt(t.isoSecond)*b+BigInt(t.isoMillisecond)*S+BigInt(t.isoMicrosecond)*I+BigInt(t.isoNanosecond))];var t}function It(n,e){return St(n)+"T"+Ft(n,e)}function St(n){return bt(n)+"-"+sn(n.isoDay,2)}function bt(n){const{isoYear:e}=n;return(e<1e3||e>9999?an(e)+sn(Math.abs(e),6):sn(e,4))+"-"+sn(n.isoMonth,2)}function Ft(n,e){const t=[sn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(sn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(sn(n.isoSecond,2)+Nt(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function Dt(n){const e=vt(BigInt(Math.abs(n)),5),t=Nt(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return an(n)+sn(e.hour,2)+":"+sn(e.minute,2)+(e.second||t?":"+sn(e.second,2)+t:"")}function Tt(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function Ot(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function Nt(n,e,t,o,r,i){let s=BigInt(t)+BigInt(e)*I+BigInt(n)*S;r&&(s=H(s,void 0===o?O[i]:Math.pow(10,9-o),r));const a=s<0?-s:s,c=a/b;let u=sn(Number(a-c*b),9);return u=void 0===o?u.replace(/0+$/,""):u.substr(0,o),[u?"."+u:"",Number(c)*(s<0?-1:1)]}function Yt(n){const e=function(n){const e=qn.exec(ie(n));if(e){let n,t,o,r;[n,r]=Et(e[8],e[10],5,void 0),[t,r]=Et(e[12],e[14],4,r),[o,r]=Et(e[16],e[18],3,r);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:re(e[2]),months:re(e[3]),weeks:re(e[4]),days:re(e[5]),hours:n,minutes:t,seconds:o});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=vt(BigInt(r||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=Wt(i)),i}}(n);if(void 0===e)throw se("duration",n);return e}function Et(n,e,t,o){if(void 0!==n){if(void 0!==o)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?ee(e)*(O[t]/1e9):void 0]}if(void 0!==o){const n=Math.trunc(o/O[t]);return[n,o-n*O[t]]}return[void 0,void 0]}Nn(PlainTime,C),Re(PlainTime,(function(n,e){return{buildKey:()=>["",""],buildFormat:()=>new we(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}),buildEpochMilli:n=>Number(gt(n)/S)}}));var[Zt,Ct]=d(),Duration=class extends p{constructor(n=0,e=0,t=0,o=0,r=0,i=0,s=0,a=0,c=0,u=0){super(),Ct(this,function(n){const e={};let t=0;for(const o of U){const r=Number(n[o]||0),i=L(n[o]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(r))throw new RangeError("Duration fields must be integers");e[o]=r}return e.sign=t,e}({years:n,months:e,weeks:t,days:o,hours:r,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return Pt("object"==typeof n?t(n,In):Yt(n))}static compare(n,e,t){return function(n,e,t){const o=g(Duration,n),r=g(Duration,e),i=Lt(o),s=Lt(r);if(void 0===t&&i&&s)return q(wt(i),wt(s));const a=zt(t),c=a.add(o),u=a.add(r);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,o(t).relativeTo)}get years(){return Zt(this).years}get months(){return Zt(this).months}get weeks(){return Zt(this).weeks}get days(){return Zt(this).days}get hours(){return Zt(this).hours}get minutes(){return Zt(this).minutes}get seconds(){return Zt(this).seconds}get milliseconds(){return Zt(this).milliseconds}get microseconds(){return Zt(this).microseconds}get nanoseconds(){return Zt(this).nanoseconds}get sign(){return Zt(this).sign}get blank(){return!this.sign}with(n){return Pt({...Zt(this),...a(n,In)})}negated(){return Pt(Wt(Zt(this)))}abs(){return Pt(l(Zt(this),(n=>Math.abs(n))))}add(n,e){return Ut(this,g(Duration,n),o(e).relativeTo)}subtract(n,e){return Ut(this,g(Duration,n).negated(),o(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=xt(n),o=j(e,t,0,0,9,!1,!0),{largestUnit:r,smallestUnit:s}=o,a=Lt(n);if(void 0===e.relativeTo&&a&&Y(r)&&Y(s)){return qt(vt(rt(wt(a),o),r))}const c=At(e.relativeTo),u=kt(n,r,c);return tt(u,o,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const o=Lt(n);if(void 0===t&&o&&Y(e))return Number(wt(o))/O[e];const r=At(t),i=kt(n,e,r,!0);return ae(i,e,r,r.add(i))[U[e]]}(this,k(o(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=bn(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:o,roundingMode:r}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=Nt(n.milliseconds,n.microseconds,n.nanoseconds,o,r,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+Ot([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+Ot([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(Zt(this),e)}toLocaleString(n,e){return this.toString()}};function Pt(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function Ut(n,e,t){const o=Lt(n),r=Lt(e),i=Math.max(xt(n),xt(e));if(void 0===t&&o&&r)return jt(wt(o)+wt(r),i);const s=zt(t),a=s.add(n).add(e);return Qe(s,a,i)}function Bt(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Rt(n,e,t){return t instanceof PlainDate?function(n,e,t){const o=t.add(n);return t.calendar.dateUntil(t,o,{largestUnit:P[e]})}(n,Math.max(6,e),t):kt(n,e,t)}function kt(n,e,t,o){const r=!0!==o&&e>7&&n.weeks;r&&(n=n.with({weeks:0}));const i=t.add(n);let s=Qe(t,i,e);return r&&(s=Bt(s,new Duration(0,0,r))),s}function xt(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function jt(n,e){return qt(vt(n,e))}function qt(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function Lt(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...$t(n)}}function Ht(n){return new Duration(n.years,n.months,n.weeks,n.days)}function $t(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function zt(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=$n(String(n));return void 0!==e.timeZone?Ae(le(e),void 0,0):ko(he(e))}}function At(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:g(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=Jn(String(n));if(e)return void 0!==e.timeZone?Ae(le(e),void 0,3):ko(he(e));throw new RangeError("Invalid value of relativeTo")}function Wt(n){return l(n,(n=>-n||0))}function Kt(n,e,t,o){n=Jt(n=Gt(n,e.years,t,o),e.months,t,o);let r=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=gt($t(n)),t=e/T;return[vt(e-t*T,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return r=nn(r,7*i.weeks+i.days),Q(r)}function Gt({year:n,month:t,day:o},r,i,s){n+=r;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?o:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function Jt({year:n,month:t,day:o},r,i,s){if(r){if(t+=r,r<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}o=e(o,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:o}}function Qt(n,e){return e?{...Q(nn(W(n),e)),calendar:n.calendar}:n}var PlainMonthDay=class extends M{constructor(n,e,t=Zo(),o){super({...to({isoYear:o??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return Xt(n.getISOFields());if("object"==typeof n){const o=Po(n);let r=t(n,Vt);return void 0===r.year&&void 0===n.calendar&&(r={...r,year:1972}),o.monthDayFromFields(r,e)}const o=Wn(String(n));return void 0===o.calendar&&(o.isoYear=1972),Xt(he(o))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,Vt),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=g(PlainMonthDay,n),e.calendar.id===t.calendar.id&&z(e.getISOFields())===z(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=gn(n);return("iso8601"===t?function(n){return sn(n.isoMonth,2)+"-"+sn(n.isoDay,2)}(e):St(e))+Tt(t,o)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};Nn(PlainMonthDay),Zn(PlainMonthDay,["monthCode","day"]),Re(PlainMonthDay,Ze({month:"numeric",day:"numeric"},{weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0));var Vt={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function Xt(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}function _t(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function no(n,e){return{...Le(n,e),day:n.day??e.day}}function eo(n,t,o,r,i){return[n=Number(n),t=e(t,1,r.monthsInYear(n),i),o=e(o,1,r.daysInMonth(n,t),i)]}function to(n,e){const[t,o,r]=eo(n.isoYear,n.isoMonth,n.isoDay,fn,e);return{isoYear:t,isoMonth:o,isoDay:r}}function oo(n,e){return q(z(n.getISOFields()),z(e.getISOFields()))||q(n.calendar.id,e.calendar.id)}function ro(n,e){return q(n.year,e.year)||function(n,e){return q(n.month,e.month)||q(n.day,e.day)}(n,e)}function io(n,e,t,o){return tt(Uo(n,e).dateUntil(n,e,{largestUnit:P[t.largestUnit]}),t,n,e,o)}var PlainDate=class extends M{constructor(n,e,t,o=Zo()){const r=to({isoYear:n,isoMonth:e,isoDay:t},c),i=g(Calendar,o);!function(n,e){const t=z(n);Ne(t+(t<0n?86399999999999n:0n)),Fo(t,e)}(r,i.id),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainDate)return _t(n.getISOFields());if("object"==typeof n){const o=t(n,pn);return Po(n).dateFromFields(o,e)}return _t(he(zn(String(n))))}static compare(n,e){return oo(g(PlainDate,n),g(PlainDate,e))}with(n,e){const t=no(a(n,pn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,g(Duration,n).negated(),e)}until(n,e){return io(this,g(PlainDate,n),j(e,6,6,6,9))}since(n,e){return io(this,g(PlainDate,n),j(e,6,6,6,9),!0)}equals(n){return 0===oo(this,g(PlainDate,n))}toString(n){const e=gn(n),t=this.getISOFields();return St(t)+Tt(t.calendar.id,e)}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return ko({...this.getISOFields(),...ft(n).getISOFields()})}toPlainYearMonth(){return qe(this.getISOFields())}toPlainMonthDay(){return this.calendar.monthDayFromFields(this)}};function so(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function ao(n,e,t){let o;if(n instanceof PlainDate)o=n;else if(so(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");o=_t(n.getISOFields())}else o=PlainDate.from(n);return Ro(o.calendar,e),o}function co(n,e,t){if(so(n))return n.getISOFields();let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:d}=n;const h=void 0!==r&&void 0!==o?dn(e.id,r,o):void 0;if(void 0===i){if(void 0===h)throw new TypeError("Must specify either a year or an era & eraYear");i=h}else if(void 0!==h&&h!==i)throw new RangeError("year and era/eraYear must match");if(void 0===d)throw new TypeError("Must specify day");const l=u(t);if(void 0!==a){const[n,t]=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");if(s=n,t){if(l===c)throw new RangeError("Month code out of range");d=e.daysInMonth(i,s)}}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");return[i,s,d]=eo(i,s,d,e,l),Q(e.epochMilliseconds(i,s,d))}function uo(n,e){if(so(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function ho(n,e){return _(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function lo(n,e,t,o){return _(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,o))+1}Nn(PlainDate),Zn(PlainDate,En),Re(PlainDate,Ze({year:"numeric",month:"numeric",day:"numeric",weekday:void 0},{hour:void 0,minute:void 0,second:void 0}));var fo={hebrew:6,chinese:0,dangi:0},mo=class extends un{constructor(n){const e=go(n);if(t=n,o=e.resolvedOptions().calendar,hn(t)!==hn(o))throw new RangeError("Invalid calendar: "+n);var t,o;super(n),this.format=e,this.yearCorrection=this.computeFieldsDumb(0).year-1970,this.monthCacheByYear={}}epochMilliseconds(n,e,t){return nn(this.queryMonthCache(n)[0][e-1],t-1)}daysInMonth(n,e){const t=this.queryMonthCache(n)[0],o=t[e-1];e>=t.length&&(n++,e=0);return _(o,this.queryMonthCache(n)[0][e])}monthsInYear(n){return this.queryMonthCache(n)[0].length}monthCode(n,e){const t=this.queryLeapMonthByYear(e);return!t||n<t?super.monthCode(n,e):super.monthCode(n-1,e)+(n===t?"L":"")}convertMonthCode(n,e){const t=this.queryLeapMonthByYear(e);let o=/L$/.test(n),r=parseInt(n.substr(1)),i=!1;if(o){const n=fo[this.id];if(void 0===n)throw new RangeError("Calendar system doesnt support leap months");if(n){if(r!==n-1)throw new RangeError("Invalid leap-month month code")}else if(r<=1||r>=12)throw new RangeError("Invalid leap-month month code")}return!o||t&&r===t-1||(i=!0,o=!1),(o||t&&r>=t)&&r++,[r,i]}inLeapYear(n){const e=ho(this,n);return e>ho(this,n-1)&&e>ho(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const o=t+100;for(;t<o;t++){const[o,r]=this.convertMonthCode(n,t);if(!r&&o<=this.monthsInYear(t)&&e<=this.daysInMonth(t,o))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}computeFields(n){const e=this.computeFieldsDumb(n),t=this.queryMonthCache(e.year)[2];return{...e,month:t[e.month]}}computeFieldsDumb(n){const e=ge(this.format,n);let t,o,r=parseInt(e.relatedYear||e.year);var i;return e.era&&(i=this.id,void 0!==cn[hn(i)])&&(t=pe(e.era),o=r,r=dn(this.id,o,t,!0)),{era:t,eraYear:o,year:r,month:e.month,day:parseInt(e.day)}}queryLeapMonthByYear(n){const e=this.queryMonthCache(n),t=this.queryMonthCache(n-1),o=this.queryMonthCache(n+1);if(e[0].length>t[0].length&&e[0].length>o[0].length){const n=e[1],o=t[1];for(let e=0;e<o.length;e++)if(o[e]!==n[e])return e+1}}queryMonthCache(n){const{monthCacheByYear:e}=this;return e[n]||(e[n]=this.buildMonthCache(n))}buildMonthCache(n){const e=[],t=[],o={};let r=G(this.guessISOYear(n));for(r=nn(r,400);;){const o=this.computeFieldsDumb(r);if(o.year<n)break;r=nn(r,1-o.day),o.year===n&&(e.unshift(r),t.unshift(o.month)),r=nn(r,-1)}for(let n=0;n<t.length;n++)o[t[n]]=n+1;return[e,t,o]}guessISOYear(n){return n-this.yearCorrection}};function go(n){return new we("en-US",{calendar:n,era:"short",year:"numeric",month:"short",day:"numeric",timeZone:"UTC"})}var yo=G(1868,9,8),po={gregory:mn,japanese:class extends mn{constructor(){super(...arguments),this.format=go("japanese")}computeFields(n){const e=super.computeFields(n);if(n>=yo){const t=ge(this.format,n);e.era=pe(t.era),e.eraYear=parseInt(t.relatedYear||t.year)}return e}},islamic:class extends mo{guessISOYear(n){return Math.ceil(32*n/33+622)}}},wo={iso8601:fn};function vo(n){const e=(n=String(n)).toLocaleLowerCase();return wo[e]||(wo[e]=new(po[hn(e)]||mo)(n))}var Mo=G(1582,10,15),Io=G(622,7,18),So={buddhist:Mo,japanese:Mo,roc:Mo,islamic:Io,"islamic-rgsa":Io,indian:0},bo={};function Fo(n,e){return Do(Number(n/S),e)}function Do(n,e){if(function(n,e){return function(n){let e=bo[n];if(void 0===e){const t=So[n];if(void 0===t)e=!1;else{let o=vo(n);o instanceof mo||(o=new mo(n));const r=t-864e5,i=o.computeFields(r);e=r!==o.epochMilliseconds(i.year,i.month,i.day)}bo[n]=e}return e}(e)&&n<So[e]}(n,e))throw new RangeError("Invalid timestamp for calendar")}function To(n,e,t,o){let r=0,i=0,s=0,a=0;switch(o){case 9:r=function(n,e,t){const[,o,r]=eo(e.year,n.month,n.day,t,0),i=ro(e,n),s=q(e.month,o)||q(e.day,r);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=Gt(n,r,t,0);case 8:i=function(n,e,t){let o=0;const r=ro(e,n);if(r){let{year:i}=n;for(;i!==e.year;)o+=t.monthsInYear(i)*r,i+=r;const[,s,a]=eo(e.year,n.month,n.day,t,0);o+=e.month-s;const c=q(e.day,a);c&&r&&c!==r&&(o-=r)}return o}(n,e,t),n=Jt(n,i,t,0)}return a=_(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===o&&(s=Math.trunc(a/7),a%=7),new Duration(r,i,s,a)}function Oo(n,e,t){const o=7+e-t;return-$(en(n,1,o)-e,7)+o-1}function No(n,e,t){const o=Oo(n,e,t),r=Oo(n+1,e,t);return(ho(fn,n)-o+r)/7}var[Yo,Eo]=d(),Calendar=class extends y{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),Eo(this,vo(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar(String(n))}(n.calendar):n;const e=Qn(String(n));return new Calendar(e?e.calendar||"iso8601":n)}get id(){return Yo(this).id}era(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).era}eraYear(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).eraYear}year(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).year}month(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).month}monthCode(n){const e=ao(n,this);return Yo(this).monthCode(e.month,e.year)}day(n){const e=uo(n);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).day}dayOfWeek(n){const e=uo(n,!0);return en(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=ao(n,this,!0);return lo(Yo(this),e.year,e.month,e.day)}weekOfYear(n){const e=uo(n,!0);return function(n,e,t,o,r){const i=Oo(n,o,r),s=Math.floor((lo(fn,n,e,t)-i-1)/7)+1;if(s<1)return s+No(n-1,o,r);const a=No(n,o,r);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return uo(n,!0),7}daysInMonth(n){const e=ao(n,this,!0);return Yo(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=ao(n,this,!0);return ho(Yo(this),e.year)}monthsInYear(n){const e=ao(n,this,!0);return Yo(this).monthsInYear(e.year)}inLeapYear(n){return Yo(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=co(n,Yo(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=co({...n,day:1},Yo(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=Yo(this);let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:c}=n;if(void 0===c)throw new TypeError("required property 'day' missing or undefined");if(void 0!==a?i=1972:void 0!==o&&void 0!==r&&(i=dn(t.id,r,o)),void 0===i){if(void 0===a)throw new TypeError("either year or monthCode required with month");i=t.guessYearForMonthDay(a,c)}const u=co({year:i,month:s,monthCode:a,day:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const o=Yo(this),r=Kt(g(PlainDate,n,t),g(Duration,e),o,u(t));return new PlainDate(r.isoYear,r.isoMonth,r.isoDay,this)}dateUntil(n,e,t){const r=Yo(this),i=g(PlainDate,n),s=g(PlainDate,e),a=k(o(t).largestUnit,6,6,9);return Ro(Uo(i,s),this),To(i,s,r,a)}toString(){return this.id}};function Zo(){return new Calendar("iso8601")}function Co(n,e,t,o){const r=G(e,t,o);return Do(r,n.id),n.computeFields(r)}function Po(n){return void 0===n.calendar?Zo():g(Calendar,n.calendar)}function Uo(n,e){const{calendar:t}=n;return Ro(t,e.calendar),t}function Bo(n,e){const t=n.calendar,o=e.calendar;if("iso8601"===t.id)return o;if("iso8601"===o.id)return t;if(t.id!==o.id)throw new RangeError("Non-ISO calendars incompatible");return t}function Ro(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends M{constructor(n,e,t,o=0,r=0,i=0,s=0,a=0,u=0,d=Zo()){const h=qo({isoYear:n,isoMonth:e,isoDay:t,isoHour:o,isoMinute:r,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c),l=g(Calendar,d);Oe(h,l.id),super({...h,calendar:l})}static from(n,e){const o=u(e);return ko(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?xo(t(n,vn),e,o,Po(n)):he(zn(String(n))))}static compare(n,e){return Lo(g(PlainDateTime,n),g(PlainDateTime,e))}with(n,e){return ko(xo(jo(a(n,vn),this),e,u(e),this.calendar))}withPlainDate(n){const e=g(PlainDate,n);return ko({...this.getISOFields(),...e.getISOFields(),calendar:Bo(this,e)})}withPlainTime(n){return ko({...this.getISOFields(),...ft(n).getISOFields()})}withCalendar(n){return ko({...this.getISOFields(),calendar:g(Calendar,n)})}add(n,e){return Ho(this,g(Duration,n),e)}subtract(n,e){return Ho(this,g(Duration,n).negated(),e)}until(n,e){return $o(this,g(PlainDateTime,n),e)}since(n,e){return $o(this,g(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);return zo(n,it(t),t.roundingMode)}(this,n)}equals(n){return 0===Lo(this,g(PlainDateTime,n))}toString(n){const e=bn(n),t=gn(n),o=zo(this,e.roundingIncrement,e.roundingMode).getISOFields();return It(o,e)+Tt(o.calendar.id,t)}toZonedDateTime(n,e){const t=g(TimeZone,n),o=t.getInstantFor(this,e);return new ZonedDateTime(o.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return qe(this.getISOFields())}toPlainMonthDay(){return this.calendar.monthDayFromFields(this)}toPlainDate(){return _t(this.getISOFields())}toPlainTime(){return at(this.getISOFields())}};function ko(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function xo(n,e,t,o){return{...o.dateFromFields(n,e).getISOFields(),...lt(n,t)}}function jo(n,e){return{...no(n,e),...ut(n,e)}}function qo(n,e){return{...to(n,e),...ct(n,e)}}function Lo(n,e){return q(z(n.getISOFields()),z(e.getISOFields()))||q(n.calendar.id,e.calendar.id)}function Ho(n,e,t){const{calendar:o}=n,r=Ht(e),i=$t(e);return ko({...J(z(o.dateAdd(_t(n.getISOFields()),r,t).getISOFields())+gt(n)+gt(i)),calendar:o})}function $o(n,e,t,o){const r=j(t,6,0,0,9);return tt(Qe(n,e,r.largestUnit),r,n,e,o)}function zo(n,e,t){const o=ot(n,e,t);return ko(st(n.getISOFields(),o))}function Ao(n,e){return q(n.epochNanoseconds,e.epochNanoseconds)}function Wo(n,e){if(xt(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+gt($t(e)))}function Ko(n,e,t){const o=j(t,3,0,0,5,!0);return jt(rt(e.epochNanoseconds-n.epochNanoseconds,o),o.largestUnit)}Nn(PlainDateTime,C),Zn(PlainDateTime,En),Re(PlainDateTime,Ze({year:"numeric",month:"numeric",day:"numeric",weekday:void 0,hour:"numeric",minute:"2-digit",second:"2-digit"},{}));var[Go,Jo]=d(),Instant=class extends p{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&rn(),Jo(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=$n(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant(z(qo(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*b)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*S)}static fromEpochMicroseconds(n){return new Instant(n*I)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Ao(g(Instant,n),g(Instant,e))}get epochNanoseconds(){return Go(this)}add(n){return Wo(this,g(Duration,n))}subtract(n){return Wo(this,g(Duration,n).negated())}until(n,e){return Ko(this,g(Instant,n),e)}since(n,e){return Ko(g(Instant,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5,!1,!0),[o,r]=Mt(n.epochNanoseconds);return new Instant(o+rt(r,t))}(this,n)}equals(n){return 0===Ao(this,g(Instant,n))}toString(n){const e=o(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};Dn(Instant),Re(Instant,Ye({year:"numeric",month:"numeric",day:"numeric",weekday:void 0,hour:"numeric",minute:"2-digit",second:"2-digit"},{timeZoneName:void 0},{}));var Qo=Symbol(),Vo=Symbol(),Xo=Symbol(),_o=class extends we{constructor(n,e){const t=ve(n),o=function(n){const e={};for(const t in n){let o=n[t];i(o)&&(o=o.toString()),e[t]=o}return e}(e||{});super(t,o),this[Qo]=t,this[Vo]=o,this[Xo]=new Map}format(n){const e=nr(this,n);return e[0]===this?super.format(n):e[0].format(e[1])}formatToParts(n){return super.formatToParts.call(...nr(this,n))}formatRange(n,e){return super.formatRange.call(...er(this,n,e))}formatRangeToParts(n,e){return super.formatRangeToParts.call(...er(this,n,e))}};function nr(n,e){const t=ke(e);if(t){const o=tr(n,t);return[o.buildFormat(e),o.buildEpochMilli(e)]}return[n,e]}function er(n,e,t){const o=ke(e);if(o!==ke(t))throw new TypeError("Mismatch of types");if(o){const r=tr(n,o);return[r.buildFormat(e,t),r.buildEpochMilli(e),r.buildEpochMilli(t)]}return[n,e,t]}function tr(n,e){const t=n[Xo];let o=t.get(e);return o||(o=function(n){const e={};return{buildFormat:function(t,o){const r=n.buildKey(t,o),i=r.join("|");return e[i]||(e[i]=n.buildFormat(...r))},buildEpochMilli:n.buildEpochMilli}}(e(n[Qo],n[Vo])),t.set(e,o)),o}function or(n=cr()){return ar().toZonedDateTimeISO(n)}function rr(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return ar().toZonedDateTime({calendar:n,timeZone:e??cr()})}function ir(n=cr()){return or(n).toPlainDateTime()}function sr(n,e){return rr(n,e).toPlainDateTime()}function ar(){return new Instant(BigInt(Date.now())*S)}function cr(){return new TimeZone((new we).resolvedOptions().timeZone)}var ur={zonedDateTimeISO:or,zonedDateTime:rr,plainDateTimeISO:ir,plainDateTime:sr,plainDateISO:function(n=cr()){return ir(n).toPlainDate()},plainDate:function(n,e){return sr(n,e).toPlainDate()},plainTimeISO:function(n=cr()){return ar().toZonedDateTimeISO(n).toPlainTime()},instant:ar,timeZone:cr};globalThis.Temporal||(globalThis.Temporal={PlainYearMonth:PlainYearMonth,PlainMonthDay:PlainMonthDay,PlainDate:PlainDate,PlainTime:PlainTime,PlainDateTime:PlainDateTime,ZonedDateTime:ZonedDateTime,Instant:Instant,Calendar:Calendar,TimeZone:TimeZone,Duration:Duration,Now:ur},globalThis.Date.prototype.toTemporalInstant=function(){return n=this,Instant.fromEpochMilliseconds(n.valueOf());var n},globalThis.Intl.DateTimeFormat=_o);
//# sourceMappingURL=global.js.map

@@ -51,28 +51,2 @@ declare abstract class AbstractObj {

declare class Instant extends AbstractNoValueObj {
constructor(epochNanoseconds: bigint);
static from(arg: InstantArg): Instant;
static fromEpochSeconds(epochSeconds: number): Instant;
static fromEpochMilliseconds(epochMilliseconds: number): Instant;
static fromEpochMicroseconds(epochMicroseconds: bigint): Instant;
static fromEpochNanoseconds(epochNanoseconds: bigint): Instant;
static compare(a: InstantArg, b: InstantArg): CompareResult;
get epochNanoseconds(): bigint;
add(durationArg: DurationArg): Instant;
subtract(durationArg: DurationArg): Instant;
until(other: InstantArg, options?: TimeDiffOptions): Duration;
since(other: InstantArg, options?: TimeDiffOptions): Duration;
round(options: TimeRoundingOptions): Instant;
equals(other: InstantArg): boolean;
toString(options?: InstantToStringOptions): string;
toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
toZonedDateTimeISO(timeZoneArg: TimeZoneArg): ZonedDateTime;
toZonedDateTime(options: {
calendar: CalendarArg;
timeZone: TimeZoneArg;
}): ZonedDateTime;
}
interface Instant extends ComputedEpochFields {
}
declare class PlainMonthDay extends AbstractISOObj<DateISOFields> {

@@ -84,3 +58,2 @@ constructor(isoMonth: number, isoDay: number, calendar?: CalendarProtocol, referenceISOYear?: number);

toString(options?: DateToStringOptions): string;
toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
toPlainDate(fields: {

@@ -93,2 +66,4 @@ year: number;

}
interface PlainMonthDay extends ToLocaleStringMethods {
}

@@ -106,3 +81,2 @@ declare class PlainYearMonth extends AbstractISOObj<DateISOFields> {

toString(options?: DateToStringOptions): string;
toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
toPlainDate(fields: {

@@ -115,17 +89,3 @@ day: number;

}
declare class TimeZone extends AbstractObj implements TimeZoneProtocol {
constructor(id: string);
static from(arg: TimeZoneArg): TimeZone;
get id(): string;
getOffsetStringFor(instantArg: InstantArg): string;
getOffsetNanosecondsFor(instantArg: InstantArg): number;
getPlainDateTimeFor(instantArg: InstantArg, calendarArg?: CalendarArg): PlainDateTime;
getInstantFor(dateTimeArg: DateTimeArg, options?: {
disambiguation?: Disambiguation;
}): Instant;
getPossibleInstantsFor(dateTimeArg: DateTimeArg): Instant[];
getPreviousTransition(instantArg: InstantArg): Instant | null;
getNextTransition(instantArg: InstantArg): Instant | null;
toString(): string;
interface PlainYearMonth extends ToLocaleStringMethods {
}

@@ -155,3 +115,2 @@

toString(options?: ZonedDateTimeToStringOptions): string;
toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
toPlainYearMonth(): PlainYearMonth;

@@ -171,3 +130,68 @@ toPlainMonthDay(): PlainMonthDay;

}
interface ZonedDateTime extends ToLocaleStringMethods {
}
declare class Instant extends AbstractNoValueObj {
constructor(epochNanoseconds: bigint);
static from(arg: InstantArg): Instant;
static fromEpochSeconds(epochSeconds: number): Instant;
static fromEpochMilliseconds(epochMilliseconds: number): Instant;
static fromEpochMicroseconds(epochMicroseconds: bigint): Instant;
static fromEpochNanoseconds(epochNanoseconds: bigint): Instant;
static compare(a: InstantArg, b: InstantArg): CompareResult;
get epochNanoseconds(): bigint;
add(durationArg: DurationArg): Instant;
subtract(durationArg: DurationArg): Instant;
until(other: InstantArg, options?: TimeDiffOptions): Duration;
since(other: InstantArg, options?: TimeDiffOptions): Duration;
round(options: TimeRoundingOptions): Instant;
equals(other: InstantArg): boolean;
toString(options?: InstantToStringOptions): string;
toZonedDateTimeISO(timeZoneArg: TimeZoneArg): ZonedDateTime;
toZonedDateTime(options: {
calendar: CalendarArg;
timeZone: TimeZoneArg;
}): ZonedDateTime;
}
interface Instant extends ComputedEpochFields {
}
interface Instant extends ToLocaleStringMethods {
}
declare class TimeZone extends AbstractObj implements TimeZoneProtocol {
constructor(id: string);
static from(arg: TimeZoneArg): TimeZone;
get id(): string;
getOffsetStringFor(instantArg: InstantArg): string;
getOffsetNanosecondsFor(instantArg: InstantArg): number;
getPlainDateTimeFor(instantArg: InstantArg, calendarArg?: CalendarArg): PlainDateTime;
getInstantFor(dateTimeArg: DateTimeArg, options?: {
disambiguation?: Disambiguation;
}): Instant;
getPossibleInstantsFor(dateTimeArg: DateTimeArg): Instant[];
getPreviousTransition(instantArg: InstantArg): Instant | null;
getNextTransition(instantArg: InstantArg): Instant | null;
toString(): string;
}
interface BaseEntity {
calendar?: Calendar;
timeZone?: TimeZone;
}
interface FormatFactory<Entity extends BaseEntity> {
buildKey: KeyFactory<Entity>;
buildFormat: (calendarID: string, timeZoneID: string) => Intl.DateTimeFormat;
buildEpochMilli: (entity: Entity) => number;
}
declare type FormatFactoryFactory<Entity extends BaseEntity> = (locales: string[], options: Intl.DateTimeFormatOptions) => FormatFactory<Entity>;
declare type CachedFormatFactory<Entity extends BaseEntity> = {
buildFormat: (entity: Entity, otherEntity?: Entity) => Intl.DateTimeFormat;
buildEpochMilli: (entity: Entity) => number;
};
declare type KeyFactory<Entity extends BaseEntity> = (entity: Entity, otherEntity?: Entity) => [string, string];
interface ToLocaleStringMethods {
toLocaleString(localesArg?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
}
declare class PlainTime extends AbstractISOObj<TimeISOFields> {

@@ -185,3 +209,2 @@ constructor(isoHour?: number, isoMinute?: number, isoSecond?: number, isoMillisecond?: number, isoMicrosecond?: number, isoNanosecond?: number);

toString(options?: TimeToStringOptions): string;
toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
toZonedDateTime(options: {

@@ -196,2 +219,4 @@ plainDate: DateArg;

}
interface PlainTime extends ToLocaleStringMethods {
}

@@ -232,3 +257,2 @@ interface TimeISOMilli {

toString(options?: DateTimeToStringOptions): string;
toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
toZonedDateTime(timeZoneArg: TimeZoneArg, options?: {

@@ -247,2 +271,4 @@ disambiguation?: Disambiguation;

}
interface PlainDateTime extends ToLocaleStringMethods {
}

@@ -308,3 +334,2 @@ declare type RoundingFunc = (n: number) => number;

toString(options?: DateToStringOptions): string;
toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string;
toZonedDateTime(options: {

@@ -321,2 +346,4 @@ plainTime?: TimeArg;

}
interface PlainDate extends ToLocaleStringMethods {
}

@@ -620,15 +647,3 @@ declare class Calendar extends AbstractObj implements CalendarProtocol {

}
interface DateTimeFormatRangeMethods {
formatRange(startDate: number | Date, endDate: number | Date): string;
formatRangeToParts(startDate: number | Date, endDate: number | Date): DateTimeFormatRangePart[];
}
declare type DateTimeFormatWithRange = Intl.DateTimeFormat & DateTimeFormatRangeMethods;
declare type DateTimeFormatArg = number | Date | Instant | ZonedDateTime | PlainDateTime | PlainDate | PlainYearMonth | PlainMonthDay | PlainTime;
interface DateTimeFormatTemporalMethods {
format(dateArg?: DateTimeFormatArg): string;
formatToParts(dateArg?: DateTimeFormatArg): Intl.DateTimeFormatPart[];
formatRange(startArg: DateTimeFormatArg, endArg: DateTimeFormatArg): string;
formatRangeToParts(startArg: DateTimeFormatArg, endArg: DateTimeFormatArg): DateTimeFormatRangePart[];
}
declare type DateTimeFormatWithTemporal = Intl.DateTimeFormat & DateTimeFormatTemporalMethods;
declare const OrigDateTimeFormat: {

@@ -639,9 +654,17 @@ (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): Intl.DateTimeFormat;

};
declare function normalizeIntlOptionalDateArg(dateArg: DateTimeFormatArg | undefined): undefined | number | Date;
declare function normalizeIntlDateArg(dateArg: DateTimeFormatArg): number | Date;
declare function formatZoned(zdt: ZonedDateTime, locales: LocalesArg | undefined, options: Intl.DateTimeFormatOptions): string;
declare function formatUnzoned<ISOFields extends DateISOFields>(date: {
getISOFields: () => ISOFields;
}, locales: LocalesArg | undefined, options: Intl.DateTimeFormatOptions, strictCalendar?: boolean): string;
declare const origLocalesSymbol: unique symbol;
declare const origOptionsSymbol: unique symbol;
declare const factoryMapSymbol: unique symbol;
declare class ExtendedDateTimeFormat extends OrigDateTimeFormat {
[origLocalesSymbol]: string[];
[origOptionsSymbol]: Intl.DateTimeFormatOptions;
[factoryMapSymbol]: Map<FormatFactoryFactory<any>, CachedFormatFactory<any>>;
constructor(localesArg?: LocalesArg, options?: Intl.DateTimeFormatOptions);
format(dateArg?: DateTimeFormatArg): string;
formatToParts(dateArg?: DateTimeFormatArg): Intl.DateTimeFormatPart[];
formatRange(startArg: DateTimeFormatArg, endArg: DateTimeFormatArg): string;
formatRangeToParts(startArg: DateTimeFormatArg, endArg: DateTimeFormatArg): DateTimeFormatRangePart[];
}
declare function getZonedDateTimeISO(timeZoneArg?: TimeZoneArg): ZonedDateTime;

@@ -668,2 +691,2 @@ declare function getZonedDateTime(calendarArg: CalendarArg, timeZoneArg?: TimeZoneArg): ZonedDateTime;

export { Calendar, CalendarArg, CalendarDisplay, CalendarProtocol, CompareResult, DateArg, DateDiffOptions, DateISOFields, DateLike, DateLikeFields, DateOverrides, DateTemporalMethods, DateTimeArg, DateTimeFormatArg, DateTimeFormatRangeMethods, DateTimeFormatRangePart, DateTimeFormatTemporalMethods, DateTimeFormatWithRange, DateTimeFormatWithTemporal, DateTimeISOFields, DateTimeLike, DateTimeLikeFields, DateTimeOverrides, DateTimeRoundingOptions, DateTimeToStringOptions, DateToStringOptions, DateUnit, DateWithTemporal, DayTimeUnit, DiffOptions, Disambiguation, Duration, DurationArg, DurationLike, DurationRoundingOptions, DurationToStringOptions, DurationToStringUnit, DurationTotalOptions, FractionalSecondDigits, Instant, InstantArg, InstantToStringOptions, LocalesArg, MonthDayArg, MonthDayLike, MonthDayLikeFields, MonthDayOverrides, Now, OffsetDisplay, OffsetHandling, OrigDateTimeFormat, OverflowHandling, OverflowOptions, PlainDate, PlainDateTime, PlainMonthDay, PlainTime, PlainYearMonth, RoundingMode, RoundingOptions, TimeArg, TimeDiffOptions, TimeISOFields, TimeLike, TimeRoundingOptions, TimeToStringOptions, TimeToStringUnit, TimeUnit, TimeZone, TimeZoneArg, TimeZoneDisplay, TimeZoneProtocol, Unit, YearMonthArg, YearMonthDiffOptions, YearMonthLike, YearMonthLikeFields, YearMonthOverrides, YearMonthUnit, ZonedDateTime, ZonedDateTimeArg, ZonedDateTimeISOFields, ZonedDateTimeLike, ZonedDateTimeLikeFields, ZonedDateTimeOptions, ZonedDateTimeOverrides, ZonedDateTimeToStringOptions, dateToTemporalInstant, formatUnzoned, formatZoned, normalizeIntlDateArg, normalizeIntlOptionalDateArg };
export { Calendar, CalendarArg, CalendarDisplay, CalendarProtocol, CompareResult, DateArg, DateDiffOptions, DateISOFields, DateLike, DateLikeFields, DateOverrides, DateTemporalMethods, DateTimeArg, DateTimeFormatArg, DateTimeFormatRangePart, DateTimeISOFields, DateTimeLike, DateTimeLikeFields, DateTimeOverrides, DateTimeRoundingOptions, DateTimeToStringOptions, DateToStringOptions, DateUnit, DateWithTemporal, DayTimeUnit, DiffOptions, Disambiguation, Duration, DurationArg, DurationLike, DurationRoundingOptions, DurationToStringOptions, DurationToStringUnit, DurationTotalOptions, ExtendedDateTimeFormat, FractionalSecondDigits, Instant, InstantArg, InstantToStringOptions, LocalesArg, MonthDayArg, MonthDayLike, MonthDayLikeFields, MonthDayOverrides, Now, OffsetDisplay, OffsetHandling, OverflowHandling, OverflowOptions, PlainDate, PlainDateTime, PlainMonthDay, PlainTime, PlainYearMonth, RoundingMode, RoundingOptions, TimeArg, TimeDiffOptions, TimeISOFields, TimeLike, TimeRoundingOptions, TimeToStringOptions, TimeToStringUnit, TimeUnit, TimeZone, TimeZoneArg, TimeZoneDisplay, TimeZoneProtocol, Unit, YearMonthArg, YearMonthDiffOptions, YearMonthLike, YearMonthLikeFields, YearMonthOverrides, YearMonthUnit, ZonedDateTime, ZonedDateTimeArg, ZonedDateTimeISOFields, ZonedDateTimeLike, ZonedDateTimeLikeFields, ZonedDateTimeOptions, ZonedDateTimeOverrides, ZonedDateTimeToStringOptions, dateToTemporalInstant };

@@ -1,2 +0,2 @@

function n(n,e,t){const r=function(n,e,t){return(o,r)=>{if(void 0===o){const e=r??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[o])throw new RangeError(`Invalid ${n}: ${o}`);return e[o]}}(n,e,t);return(e,t)=>{const i=o(e);return r(i[n],t)}}function e(n,e,t,o){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const r=Math.min(Math.max(n,e),t);if(r!==n&&o===c)throw new RangeError("Invalid overflowed value "+n);return r}function t(n,e){const t={};let o=0;for(const r in e)void 0!==n[r]&&(t[r]=e[r](n[r]),o++);if(!o)throw new TypeError("Invalid object, no keys");return t}function o(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var r=/object|function/;function i(n){return null!==n&&r.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,f(e,(n=>({get:n}))))}function f(n,e){const t={};for(const o in n)t[o]=e(n[o],o);return t}function l(n,e){const t={};return n.forEach(((n,o)=>{t[n]=e(n,o)})),t}function m(n,e,...t){return e instanceof n?e:n.from(e,...t)}var g=class{toJSON(){return this.toString()}},y=class extends g{valueOf(){throw new Error("Cannot convert object using valueOf")}},[w,p]=d(),v=class extends y{constructor(n){super(),p(this,Object.freeze(n))}getISOFields(){return w(this)}},I=1000n,M=1000000n,S=1000000000n,F=60000000000n,O=3600000000000n,D=86400000000000n,b=[1,1e3,1e6,1e9,6e10,36e11,864e11],N=[9,6,3];function T(n){return n<=6}function Y(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),E=["nanosecond","microsecond","millisecond","second","minute","hour"],C=[...E,"day","week","month","year"],U=C.map((n=>n+"s")),B=l(C,((n,e)=>e)),P=l(U,((n,e)=>e));function R(n,e,t,o){let r;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");r=e}else if(r=B[n]??P[n],void 0===r||r<t||r>o)throw new RangeError("Invalid unit "+n);return r}function x(n,e,t,r,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=o(n),u=c.roundingIncrement??1,d=R(c.smallestUnit,e,t,r);if(!s&&a){if(d<6&&864e11%u*b[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?b[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*b[d]>=b[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function k(n,e,t,r,i,s,a){const c=x(n,t,r,i,!a,s);e=Math.max(e,c.smallestUnit);let u=o(n).largestUnit;"auto"===u&&(u=void 0);const d=R(u,e,r,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function j(n,e){return n<e?-1:n>e?1:0}function L(n){return j(n,0)}function q(n,e,t){const o=BigInt(e),r=n/o*o,i=Number(n-r);return r+BigInt(t(i/e))*o}function H(n,e){return(n%e+e)%e}function $(n){return W(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function z(n){return Math.floor(A(n)/1e3)}function A(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function W(n,e,t,o,r,i,s,a,c){return BigInt(G(n,e,t,o,r,i,s))*M+BigInt(a??0)*I+BigInt(c??0)}function G(n,e,t,o,r,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,f,l=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;l<31;l++){h=u-d*l;const n=Date.UTC(g,c-1,h,o??0,r??0,i??0,s??0);if(!tn(n)){f=n+d*l*864e5;break}}return(void 0===f||h<1||h>fn.daysInMonth(a,c))&&on(),m&&(f=new Date(f).setUTCFullYear(a)),f}function J(n){let e=n/M,t=Number(n-e*M);t<0&&(t+=1e6,e-=1n);const o=Math.floor(t/1e3);return t-=1e3*o,{...K(Number(e)),isoMicrosecond:o,isoNanosecond:t}}function K(n){const[e,t]=en(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function Q(n){return en(1e3*n)[0].getUTCFullYear()}function V(n){return Math.floor(G(n)/1e3)}function X(n,e){return Math.round((e-n)/864e5)}function _(n,e){return n+864e5*e}function nn(n,e,t){const[o,r]=en(G(n,e,t));return H(o.getUTCDay()+r,7)||7}function en(n){const e=L(n);let t,o=0;for(;o<31;o++){const r=new Date(n-e*o*864e5);if(!tn(r)){t=r;break}}return void 0===t&&on(),[t,e*o]}function tn(n){return isNaN(n.valueOf())}function on(){throw new RangeError("Date outside of supported range")}function rn(n,e){return String(n).padStart(e,"0")}function sn(n){return n<0?"-":"+"}var an={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{beforeroc:-1,minguo:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},cn=class{constructor(n){this.id=n}monthCode(n,e){return"M"+rn(n,2)}convertMonthCode(n,e){const t=/L$/.test(n),o=parseInt(n.substr(1));if(t)throw new RangeError("Calendar system doesnt support leap months");return[o,!1]}};function un(n,e,t,o){let r=an[dn(n)]?.[t];if(void 0===r){if(!o)throw new Error("Unkown era "+t);r=0}return(r+e)*(L(r)||1)}function dn(n){return n.split("-")[0]}var hn=class extends cn{computeFields(n){const e=K(n);return{era:void 0,eraYear:void 0,year:e.isoYear,month:e.isoMonth,day:e.isoDay}}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},fn=new hn("iso8601"),ln=class extends hn{computeFields(n){const e=super.computeFields(n),{year:t}=e;return{...e,era:t<1?"bce":"ce",eraYear:t<1?-(t-1):t}}},mn=n("calendarName",{auto:0,never:1,always:2},0),gn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},yn={...gn,day:Number},wn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},pn={...yn,...wn},vn={...pn,offset:String},In=l(U,(()=>Number)),Mn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function Sn(n,t=4){const r=o(n),i=r.smallestUnit,s=r.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=R(i,void 0,0,t),d=b[u],a=N[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Fn=n("timeZoneName",{auto:0,never:1},0);function On(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/I},epochMilliseconds(){return Number(this.epochNanoseconds/M)},epochSeconds(){return Number(this.epochNanoseconds/S)}})}var Dn,bn={calendar:"calendar"};for(const n of C)bn[n]="iso"+((Dn=n).charAt(0).toUpperCase()+Dn.slice(1));function Nn(n,e=[]){h(n,l(e.concat("calendar"),(n=>function(){return this.getISOFields()[bn[n]]})))}var Tn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],Yn=[...Tn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function Zn(n,e){h(n,l(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var En=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0);var Cn=class{constructor(n){this.id=n}},Un=class extends Cn{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function Bn(n,e){const t={},o=n.formatToParts(e);for(const n of o)t[n.type]=n.value;return t}var Pn={bc:"bce",ad:"ce"};function Rn(n){return n=n.toLowerCase().normalize("NFD").replace(/[^a-z0-9]/g,""),Pn[n]||n}var xn=n("offset",{auto:0,never:1},0);function kn(n,e){const t=$(n);jn(t),lo(t,e)}function jn(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&on()}var PlainMonthDay=class extends v{constructor(n,e,t=Io(),o){super({...At({isoYear:o??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return qn(n.getISOFields());if("object"==typeof n){const o=So(n);let r=t(n,Ln);return void 0===r.year&&void 0===n.calendar&&(r={...r,year:1972}),o.monthDayFromFields(r,e)}const o=function(n){const e=Ce.exec(Ve(n));if(e)return{...ze(e),calendar:e[6]?new Calendar2(e[6]):Io()}}(r=String(n))||qe(r)||_e("monthDay",r);var r;return void 0===o.calendar&&(o.isoYear=1972),qn(Re(o))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,Ln),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=m(PlainMonthDay,n),e.calendar.id===t.calendar.id&&$(e.getISOFields())===$(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?function(n){return rn(n.isoMonth,2)+"-"+rn(n.isoDay,2)}(e):gt(e))+vt(t,o)}toLocaleString(n,e){return ye(this,n,{month:"numeric",day:"numeric",...e,weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};Nn(PlainMonthDay),Zn(PlainMonthDay,["monthCode","day"]);var Ln={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function qn(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}var Hn={day:1},PlainYearMonth=class extends v{constructor(n,e,t=Io(),o=1){const r=At({isoYear:n,isoMonth:e,isoDay:o},c),i=m(Calendar2,t);var s,a;s=r,a=i.id,lo($(s),a),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return zn(n.getISOFields());if("object"==typeof n){const o=t(n,gn);return So(n).yearMonthFromFields(o,e)}const o=ke(String(n));return void 0===o.calendar&&(o.isoDay=1),zn(Re(o))}static compare(n,e){return Wn(m(PlainYearMonth,n),m(PlainYearMonth,e))}with(n,e){const t=a(n,gn);return this.calendar.yearMonthFromFields(An(t,this),e)}add(n,e){return $n(this,m(Duration,n),e)}subtract(n,e){return $n(this,m(Duration,n).negated(),e)}until(n,e){return Jt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9))}since(n,e){return Jt(this.toPlainDate(Hn),m(PlainYearMonth,n).toPlainDate(Hn),k(e,9,8,8,9),!0)}equals(n){return 0===Wn(this,m(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=mn(n);return("iso8601"===t?yt(e):gt(e))+vt(t,o)}toLocaleString(n,e){return ye(this,n,{year:"numeric",month:"numeric",...e,weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function $n(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function zn(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function An(n,e){const t={};let o=!1,r=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,o=!0),void 0!==n.year&&(t.year=n.year,o=!0),o||(t.year=e.year),void 0!==n.month&&(t.month=n.month,r=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,r=!0),r||(t.month=e.month),t}function Wn(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}Nn(PlainYearMonth),Zn(PlainYearMonth,Tn);var[Gn,Jn]=d(),ZonedDateTime=class extends v{constructor(n,e,t=Io()){const o=m(TimeZone,e),r=m(Calendar2,t),i=new Instant(n),s=o.getOffsetNanosecondsFor(i),a=J(n+BigInt(s));kn(a,r.id),super({...a,calendar:r,timeZone:o,offset:o.getOffsetStringFor(i)}),Jn(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const o=Mn(e,3),r=u(e);return te(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?oe(t(n,vn),e,r,So(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return m(TimeZone,n.timeZone)}(n)):xe(ke(String(n))),e,o)}static compare(n,e){return j(m(ZonedDateTime,n).epochNanoseconds,m(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return Gn(this).epochNanoseconds}get offsetNanoseconds(){return Gn(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,vn),o={...To(r=t,i=this),offset:r.offset??i.offset};var r,i;const s=Mn(e,0),c=u(e);return En(e),te(oe(o,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=m(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:o}=this,r=o.getInstantFor(t);return new ZonedDateTime(r.epochNanoseconds,o,Oo(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return re(this,m(Duration,n),e)}subtract(n,e){return re(this,m(Duration,n).negated(),e)}until(n,e){return ie(this,m(ZonedDateTime,n),e)}since(n,e){return ie(this,m(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const o=ct(n);return{day:t(Number(o)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,de(n),t.roundingMode);return bo(ee(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return he(n,ne(t),t.roundingMode)}(this,n)}equals(n){const e=m(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return te({...this.getISOFields(),...ue,offset:void 0},void 0,3)}get hoursInDay(){return de(this)/36e11}toString(n){const e=Sn(n),t=xn(n),o=Fn(n),r=mn(n),i=he(this,e.roundingIncrement,e.roundingMode).getISOFields();return mt(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,o)+vt(i.calendar.id,r)}toLocaleString(n,e){return ge(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDateTime(){return bo(this.getISOFields())}toPlainDate(){return Ht(this.getISOFields())}toPlainTime(){return nt(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Kn(n,e,t,o){const r=U[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=U[t];s[e]=n[e]}const a={[r]:i},c=t.add(s),u=c.add(a),d=Qn(c),h=Qn(u),f=Qn(o),l=Number(f-d)/Number(h-d)*i;return s[r]+=l,s}function Qn(n){const{epochNanoseconds:e}=n;return void 0!==e?e:$(n.getISOFields())}function Vn(n,e,t,o,r){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!Y(i))return Zt(_n((ce(o)-ce(t))*(r?-1n:1n),e),i);let u=Kn(n,s,t,o);const d=U[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),r&&(u=xt(u)),c!==Math.round&&h();let f=Ot(u);return s>0&&(f=r?Nt(f.negated(),i,t).negated():Nt(f,i,t)),f}function Xn(n,e,t){return ut(q(ct(n),e,t))}function _n(n,e){return q(n,ne(e),e.roundingMode)}function ne(n){return b[n.smallestUnit]*n.roundingIncrement}function ee(n,e){return{...qt(n,e.day),...dt(e)}}function te(n,e,t){const{calendar:o,timeZone:r,offset:i,Z:s}=n;let a;if(void 0!==i&&2!==t&&(a=$(n)-BigInt(i),1!==t&&!s)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(a,r.getPossibleInstantsFor(bo(n)))){if(3===t)throw new RangeError("Mismatching offset/timezone");a=void 0}}return void 0===a&&(a=r.getInstantFor(bo(n),e).epochNanoseconds),new ZonedDateTime(a,r,o)}function oe(n,e,t,o,r){return{...No(n,e,t,o),timeZone:r,offset:n.offset?(i=n.offset,He(i)??_e("timeZone",i)):void 0};var i}function re(n,e,t){const{calendar:o,timeZone:r}=n,i=Ut(e),s=Bt(e),a=o.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:r}),c=ct(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,r,o)}function ie(n,e,t,o){const r=k(t,5,0,0,9),{largestUnit:i}=r;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return Vn(se(n,e,i),r,n,e,o)}function se(n,e,t){const o=Fo(n,e);if(!Y(t))return ae(n,e,t);const r=Ht(n.getISOFields());let i,s,a,c,u,d=Ht(e.getISOFields());do{s=o.dateUntil(r,d,{largestUnit:C[t]}),i=n.add(s),a=ae(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return bt(s,a)}function ae(n,e,t){return Zt(ce(e)-ce(n),t)}function ce(n){return n instanceof PlainDateTime?$(n.getISOFields()):n.epochNanoseconds}Nn(ZonedDateTime,E),Zn(ZonedDateTime,Yn),On(ZonedDateTime);var ue={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function de(n){const e={...n.getISOFields(),...ue,offset:void 0},t=te(e,void 0,3),o=te({...e,...qt(e,1)},void 0,3);return Number(o.epochNanoseconds-t.epochNanoseconds)}function he(n,e,t){return te({...Uo(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}var fe=Intl.DateTimeFormat;function le(n){return void 0===n?n:me(n)}function me(n){return"number"==typeof n||n instanceof Date?n:n instanceof Instant||n instanceof ZonedDateTime?n.epochMilliseconds:A(n.getISOFields())}function ge(n,e,t){const o=n.getISOFields(),r=o.calendar.id,i=o.timeZone.id,{timeZone:s}=t;if(void 0!==s&&s!==i)throw new RangeError("Given timeZone must agree");return we(n.epochMilliseconds,r,e,{timeZone:i,timeZoneName:"short",...t})}function ye(n,e,t,o){const r=n.getISOFields(),i=r.calendar.id;let s,{timeZone:a}=t;if(void 0!==a){const e=new TimeZone(a),t=bo({...ue,...n.getISOFields()});s=e.getInstantFor(t).epochMilliseconds}else s=A(r),a="UTC";return we(s,i,e,{...t,timeZone:a,timeZoneName:void 0},o)}function we(n,e,t,o,r){const i=new fe(t,{calendar:pe(t)?void 0:e,...o});if((r||"iso8601"!==e)&&e!==i.resolvedOptions().calendar)throw new RangeError("Non-iso calendar mismatch");return i.format(n)}function pe(n){const e=[].concat(n||[]);for(const n of e)if(-1!==n.indexOf("-u-ca-"))return!0;return!1}var ve={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},Ie=[182,91,273],Me=class extends Cn{constructor(n){const e=new fe("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=ve[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const o of e){const[e,r,i]=o,s=n-r,a=n-i;if(e>s&&e>a)return[r];if(!(e<=s&&e<=a))return[r,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(Q(n))]}getOffset(n){const e=Bn(this.format,1e3*n);let t=parseInt(e.year);"bce"===Rn(e.era)&&(t=-(t-1));const o=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(o/1e3)-n}getTransition(n,e){const t=Q(n);for(let o=0;o<5;o++){const r=t+o*e,i=this.getTransitionsInYear(r),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const o=i[a+t*e];if(j(o[0],n)===e)return o}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(V(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),o=V(n)-1,r=V(n+1)-1;if(e!==t)return[this.searchTransition(o,r,e,t)];const i=this.searchIsland(e,o);return void 0!==i?[this.searchTransition(o,i[0],e,i[1]),this.searchTransition(i[0],r,i[1],t)]:[]}searchTransition(n,e,t,o){for(;e-n>1;){const o=Math.floor(n+(e-n)/2);this.getOffset(o)===t?n=o:e=o}return[e,t,o]}searchIsland(n,e){for(const t of Ie){const o=e+86400*t,r=this.getOffset(o);if(r!==n)return[o,r]}}},Se={UTC:new Un("UTC",0)};var[Fe,Oe]=d(),TimeZone=class extends g{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),Oe(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(Se[e])return Se[e];const t=He(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new Un(pt(t),Math.trunc(t/1e9))}return Se[e]=new Me(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=qe(String(n));return new TimeZone(e&&(e.timeZone||e.Z&&"UTC"||void 0!==e.offset&&pt(e.offset))||n)}get id(){return Fe(this).id}getOffsetStringFor(n){return pt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=m(Instant,n);return 1e9*Fe(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=Io()){const t=m(Instant,n);return bo({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:m(Calendar2,e)})}getInstantFor(n,e){const t=En(e),o=m(PlainDateTime,n).getISOFields(),r=z(o),i=Fe(this).getPossibleOffsets(r);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return De(r-s,o)}getPossibleInstantsFor(n){const e=m(PlainDateTime,n).getISOFields(),t=z(e);let o=Fe(this).getPossibleOffsets(t);return 2===o.length&&o[0]<o[1]&&(o=[]),o.map((n=>De(t-n,e)))}getPreviousTransition(n){const e=m(Instant,n),t=Fe(this).getTransition(e.epochSeconds,-1);return t?De(t[0]):null}getNextTransition(n){const e=m(Instant,n),t=Fe(this).getTransition(e.epochSeconds,1);return t?De(t[0]):null}toString(){return this.id}};function De(n,e){return new Instant(BigInt(n)*S+(e?BigInt(e.isoMillisecond)*M+BigInt(e.isoMicrosecond)*I+BigInt(e.isoNanosecond):0n))}var be="(\\d{2})?:?(\\d{2})?:?(\\d{2})?([.,](\\d{1,9}))?",Ne=`([+-])${be}`,Te=`(Z|${Ne})?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?`,Ye=Xe(Ne),Ze=Xe(be+Te),Ee=Xe(`([+-]\\d{6}|\\d{4})-?(\\d{2})?-?(\\d{2})?([T ]${be})?`+Te),Ce=Xe("(--)?(\\d{2})-?(\\d{2})?"+Te),Ue=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Be=/Z/i,Pe=/\u2212/g;function Re(n){return{...n,calendar:void 0===n.calendar?Io():new Calendar2(n.calendar)}}function xe(n){return{...Re(n),timeZone:new TimeZone(n.timeZone)}}function ke(n){return qe(n)||_e("dateTime",n)}function je(n){return function(n){const e=Ze.exec(n);if(e&&e[1])return Ae(e.slice(1))}(n)||qe(n)||_e("time",n)}function Le(n){return function(n){const e=Ue.exec(Ve(n));if(e){let n,t,o,r;[n,r]=$e(e[8],e[10],5,void 0),[t,r]=$e(e[12],e[14],4,r),[o,r]=$e(e[16],e[18],3,r);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:Qe(e[2]),months:Qe(e[3]),weeks:Qe(e[4]),days:Qe(e[5]),hours:n,minutes:t,seconds:o});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=ft(BigInt(r||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=xt(i)),i}}(n)||_e("duration",n)}function qe(n){const e=Ee.exec(Ve(n));if(e){const n=Be.test(e[10]);return{...(t=e.slice(1),{isoYear:Ke(t[0]),isoMonth:Ke(t[1]),isoDay:Ke(t[2])}),...Ae(e.slice(5)),Z:n,offset:n?0:We(e.slice(11)),timeZone:e[18],calendar:e[20]}}var t}function He(n){const e=Ye.exec(Ve(n));if(e)return We(e.slice(1))}function $e(n,e,t,o){if(void 0!==n){if(void 0!==o)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?Ge(e)*(b[t]/1e9):void 0]}if(void 0!==o){const n=Math.trunc(o/b[t]);return[n,o-n*b[t]]}return[void 0,void 0]}function ze(n){return{isoYear:1972,isoMonth:Ke(n[2]),isoDay:Ke(n[3])}}function Ae(n){const e=Je(n[2]);return{...dt(ft(BigInt(Ge(n[4]||"")),2)),isoHour:Je(n[0]),isoMinute:Je(n[1]),isoSecond:60===e?59:e}}function We(n){const e=n[0];if(void 0!==e&&n[1])return("+"===e?1:-1)*function(n){return 36e11*Je(n[0])+6e10*Je(n[1])+1e9*Je(n[2])+Ge(n[4]||"")}(n.slice(1))}function Ge(n){return parseInt(n.padEnd(9,"0"))}function Je(n){return parseInt(n||"0")}function Ke(n){return parseInt(n||"1")}function Qe(n){return void 0===n?void 0:parseInt(n)}function Ve(n){return n.replace(Pe,"-")}function Xe(n){return new RegExp(`^${n}$`,"i")}function _e(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}var PlainTime=class extends v{constructor(n=0,e=0,t=0,o=0,r=0,i=0){super({...et({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:o,isoMicrosecond:r,isoNanosecond:i},c),calendar:Io()})}static from(n,e){const o=u(e);return nt(n instanceof PlainTime?n.getISOFields():"object"==typeof n?it(t(n,wn),o):je(String(n)))}static compare(n,e){return at(m(PlainTime,n),m(PlainTime,e))}with(n,e){return nt(it(tt(a(n,wn),this),u(e)))}add(n){return ot(this,m(Duration,n))}subtract(n){return ot(this,m(Duration,n).negated())}until(n,e){return rt(this,m(PlainTime,n),e)}since(n,e){return rt(m(PlainTime,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5);return nt(dt(Xn(n,ne(t),t.roundingMode)))}(this,n)}equals(n){return 0===at(this,m(PlainTime,n))}toString(n){const e=Sn(n);return wt(dt(Xn(this,e.roundingIncrement,e.roundingMode)),e)}toLocaleString(n,e){return new fe(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}).format(Number(ct(this)/M))}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return m(PlainDate,n).toPlainDateTime(this)}};function nt(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function et({isoHour:n,isoMinute:t,isoSecond:o,isoMillisecond:r,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:o=e(o,0,59,a),isoMillisecond:r=e(r,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function tt(n,e){return f(wn,((t,o)=>n[o]??e[o]))}function ot(n,e){var t,o;return nt(dt((t=n,o=Bt(e),ut(ct(t)+ct(o)))))}function rt(n,e,t){const o=k(t,5,0,0,5);return Zt(_n(ct(e)-ct(n),o),o.largestUnit)}function it(n,e){return et(dt(n),e)}function st(n){return m(PlainTime,n??{hour:0})}function at(n,e){return j(ct(n),ct(e))}function ct(n){return BigInt(n.hour)*O+BigInt(n.minute)*F+BigInt(n.second)*S+BigInt(n.millisecond)*M+BigInt(n.microsecond)*I+BigInt(n.nanosecond)}function ut(n){const[e,t]=lt(n);return{...ft(t,5),day:Number(e/D)}}function dt(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function ht(n){return BigInt(n.day)*D+ct(n)}function ft(n,e){const t={};for(let o=e;o>=0;o--){const e=BigInt(b[o]),r=n/e;n-=r*e,t[C[o]]=Number(r)}return t}function lt(n){const e=J(n);return[W(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*O+BigInt(t.isoMinute)*F+BigInt(t.isoSecond)*S+BigInt(t.isoMillisecond)*M+BigInt(t.isoMicrosecond)*I+BigInt(t.isoNanosecond))];var t}function mt(n,e){return gt(n)+"T"+wt(n,e)}function gt(n){return yt(n)+"-"+rn(n.isoDay,2)}function yt(n){const{isoYear:e}=n;return(e<1e3||e>9999?sn(e)+rn(Math.abs(e),6):rn(e,4))+"-"+rn(n.isoMonth,2)}function wt(n,e){const t=[rn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(rn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(rn(n.isoSecond,2)+Mt(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function pt(n){const e=ft(BigInt(Math.abs(n)),5),t=Mt(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return sn(n)+rn(e.hour,2)+":"+rn(e.minute,2)+(e.second||t?":"+rn(e.second,2)+t:"")}function vt(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function It(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function Mt(n,e,t,o,r,i){let s=BigInt(t)+BigInt(e)*I+BigInt(n)*M;r&&(s=q(s,void 0===o?b[i]:Math.pow(10,9-o),r));const a=s<0?-s:s,c=a/S;let u=rn(Number(a-c*S),9);return u=void 0===o?u.replace(/0+$/,""):u.substr(0,o),[u?"."+u:"",Number(c)*(s<0?-1:1)]}Nn(PlainTime,E);var[St,Ft]=d(),Duration=class extends y{constructor(n=0,e=0,t=0,o=0,r=0,i=0,s=0,a=0,c=0,u=0){super(),Ft(this,function(n){const e={};let t=0;for(const o of U){const r=Number(n[o]||0),i=L(n[o]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(r))throw new RangeError("Duration fields must be integers");e[o]=r}return e.sign=t,e}({years:n,months:e,weeks:t,days:o,hours:r,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return Ot("object"==typeof n?t(n,In):Le(n))}static compare(n,e,t){return function(n,e,t){const o=m(Duration,n),r=m(Duration,e),i=Ct(o),s=Ct(r);if(void 0===t&&i&&s)return j(ht(i),ht(s));const a=Pt(t),c=a.add(o),u=a.add(r);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,o(t).relativeTo)}get years(){return St(this).years}get months(){return St(this).months}get weeks(){return St(this).weeks}get days(){return St(this).days}get hours(){return St(this).hours}get minutes(){return St(this).minutes}get seconds(){return St(this).seconds}get milliseconds(){return St(this).milliseconds}get microseconds(){return St(this).microseconds}get nanoseconds(){return St(this).nanoseconds}get sign(){return St(this).sign}get blank(){return!this.sign}with(n){return Ot({...St(this),...a(n,In)})}negated(){return Ot(xt(St(this)))}abs(){return Ot(f(St(this),(n=>Math.abs(n))))}add(n,e){return Dt(this,m(Duration,n),o(e).relativeTo)}subtract(n,e){return Dt(this,m(Duration,n).negated(),o(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=Yt(n),o=k(e,t,0,0,9,!1,!0),{largestUnit:r,smallestUnit:s}=o,a=Ct(n);if(void 0===e.relativeTo&&a&&T(r)&&T(s)){return Et(ft(_n(ht(a),o),r))}const c=Rt(e.relativeTo),u=Tt(n,r,c);return Vn(u,o,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const o=Ct(n);if(void 0===t&&o&&T(e))return Number(ht(o))/b[e];const r=Rt(t),i=Tt(n,e,r,!0);return Kn(i,e,r,r.add(i))[U[e]]}(this,R(o(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=Sn(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:o,roundingMode:r}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=Mt(n.milliseconds,n.microseconds,n.nanoseconds,o,r,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+It([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+It([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(St(this),e)}toLocaleString(n,e){return this.toString()}};function Ot(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function Dt(n,e,t){const o=Ct(n),r=Ct(e),i=Math.max(Yt(n),Yt(e));if(void 0===t&&o&&r)return Zt(ht(o)+ht(r),i);const s=Pt(t),a=s.add(n).add(e);return se(s,a,i)}function bt(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Nt(n,e,t){return t instanceof PlainDate?function(n,e,t){const o=t.add(n);return t.calendar.dateUntil(t,o,{largestUnit:C[e]})}(n,Math.max(6,e),t):Tt(n,e,t)}function Tt(n,e,t,o){const r=!0!==o&&e>7&&n.weeks;r&&(n=n.with({weeks:0}));const i=t.add(n);let s=se(t,i,e);return r&&(s=bt(s,new Duration(0,0,r))),s}function Yt(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function Zt(n,e){return Et(ft(n,e))}function Et(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function Ct(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...Bt(n)}}function Ut(n){return new Duration(n.years,n.months,n.weeks,n.days)}function Bt(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function Pt(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=ke(String(n));return void 0!==e.timeZone?te(xe(e),void 0,0):bo(Re(e))}}function Rt(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:m(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=qe(String(n));if(e)return void 0!==e.timeZone?te(xe(e),void 0,3):bo(Re(e));throw new RangeError("Invalid value of relativeTo")}function xt(n){return f(n,(n=>-n||0))}function kt(n,e,t,o){n=Lt(n=jt(n,e.years,t,o),e.months,t,o);let r=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=ct(Bt(n)),t=e/D;return[ft(e-t*D,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return r=_(r,7*i.weeks+i.days),K(r)}function jt({year:n,month:t,day:o},r,i,s){n+=r;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?o:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function Lt({year:n,month:t,day:o},r,i,s){if(r){if(t+=r,r<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}o=e(o,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:o}}function qt(n,e){return e?{...K(_(A(n),e)),calendar:n.calendar}:n}function Ht(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function $t(n,e){return{...An(n,e),day:n.day??e.day}}function zt(n,t,o,r,i){return[n=Number(n),t=e(t,1,r.monthsInYear(n),i),o=e(o,1,r.daysInMonth(n,t),i)]}function At(n,e){const[t,o,r]=zt(n.isoYear,n.isoMonth,n.isoDay,fn,e);return{isoYear:t,isoMonth:o,isoDay:r}}function Wt(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Gt(n,e){return j(n.year,e.year)||function(n,e){return j(n.month,e.month)||j(n.day,e.day)}(n,e)}function Jt(n,e,t,o){return Vn(Fo(n,e).dateUntil(n,e,{largestUnit:C[t.largestUnit]}),t,n,e,o)}var PlainDate=class extends v{constructor(n,e,t,o=Io()){const r=At({isoYear:n,isoMonth:e,isoDay:t},c),i=m(Calendar2,o);!function(n,e){const t=$(n);jn(t+(t<0n?86399999999999n:0n)),lo(t,e)}(r,i.id),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainDate)return Ht(n.getISOFields());if("object"==typeof n){const o=t(n,yn);return So(n).dateFromFields(o,e)}return Ht(Re(ke(String(n))))}static compare(n,e){return Wt(m(PlainDate,n),m(PlainDate,e))}with(n,e){const t=$t(a(n,yn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,m(Duration,n).negated(),e)}until(n,e){return Jt(this,m(PlainDate,n),k(e,6,6,6,9))}since(n,e){return Jt(this,m(PlainDate,n),k(e,6,6,6,9),!0)}equals(n){return 0===Wt(this,m(PlainDate,n))}toString(n){const e=mn(n),t=this.getISOFields();return gt(t)+vt(t.calendar.id,e)}toLocaleString(n,e){return ye(this,n,{year:"numeric",month:"numeric",day:"numeric",...e,hour:void 0,minute:void 0,second:void 0})}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return bo({...this.getISOFields(),...st(n).getISOFields()})}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}};function Kt(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function Qt(n,e,t){let o;if(n instanceof PlainDate)o=n;else if(Kt(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");o=Ht(n.getISOFields())}else o=PlainDate.from(n);return Do(o.calendar,e),o}function Vt(n,e,t){if(Kt(n))return n.getISOFields();let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:d}=n;const h=void 0!==r&&void 0!==o?un(e.id,r,o):void 0;if(void 0===i){if(void 0===h)throw new TypeError("Must specify either a year or an era & eraYear");i=h}else if(void 0!==h&&h!==i)throw new RangeError("year and era/eraYear must match");if(void 0===d)throw new TypeError("Must specify day");const f=u(t);if(void 0!==a){const[n,t]=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");if(s=n,t){if(f===c)throw new RangeError("Month code out of range");d=e.daysInMonth(i,s)}}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");return[i,s,d]=zt(i,s,d,e,f),K(e.epochMilliseconds(i,s,d))}function Xt(n,e){if(Kt(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function _t(n,e){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function no(n,e,t,o){return X(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,o))+1}Nn(PlainDate),Zn(PlainDate,Yn);var eo={hebrew:6,chinese:0,dangi:0},to=class extends cn{constructor(n){const e=oo(n);if(t=n,o=e.resolvedOptions().calendar,dn(t)!==dn(o))throw new RangeError("Invalid calendar: "+n);var t,o;super(n),this.format=e,this.yearCorrection=this.computeFieldsDumb(0).year-1970,this.monthCacheByYear={}}epochMilliseconds(n,e,t){return _(this.queryMonthCache(n)[0][e-1],t-1)}daysInMonth(n,e){const t=this.queryMonthCache(n)[0],o=t[e-1];e>=t.length&&(n++,e=0);return X(o,this.queryMonthCache(n)[0][e])}monthsInYear(n){return this.queryMonthCache(n)[0].length}monthCode(n,e){const t=this.queryLeapMonthByYear(e);return!t||n<t?super.monthCode(n,e):super.monthCode(n-1,e)+(n===t?"L":"")}convertMonthCode(n,e){const t=this.queryLeapMonthByYear(e);let o=/L$/.test(n),r=parseInt(n.substr(1)),i=!1;if(o){const n=eo[this.id];if(void 0===n)throw new RangeError("Calendar system doesnt support leap months");if(n){if(r!==n-1)throw new RangeError("Invalid leap-month month code")}else if(r<=1||r>=12)throw new RangeError("Invalid leap-month month code")}return!o||t&&r===t-1||(i=!0,o=!1),(o||t&&r>=t)&&r++,[r,i]}inLeapYear(n){const e=_t(this,n);return e>_t(this,n-1)&&e>_t(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const o=t+100;for(;t<o;t++){const[o,r]=this.convertMonthCode(n,t);if(!r&&o<=this.monthsInYear(t)&&e<=this.daysInMonth(t,o))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}computeFields(n){const e=this.computeFieldsDumb(n),t=this.queryMonthCache(e.year)[2];return{...e,month:t[e.month]}}computeFieldsDumb(n){const e=Bn(this.format,n);let t,o,r=parseInt(e.relatedYear||e.year);var i;return e.era&&(i=this.id,void 0!==an[dn(i)])&&(t=Rn(e.era),o=r,r=un(this.id,o,t,!0)),{era:t,eraYear:o,year:r,month:e.month,day:parseInt(e.day)}}queryLeapMonthByYear(n){const e=this.queryMonthCache(n),t=this.queryMonthCache(n-1),o=this.queryMonthCache(n+1);if(e[0].length>t[0].length&&e[0].length>o[0].length){const n=e[1],o=t[1];for(let e=0;e<o.length;e++)if(o[e]!==n[e])return e+1}}queryMonthCache(n){const{monthCacheByYear:e}=this;return e[n]||(e[n]=this.buildMonthCache(n))}buildMonthCache(n){const e=[],t=[],o={};let r=G(this.guessISOYear(n));for(r=_(r,400);;){const o=this.computeFieldsDumb(r);if(o.year<n)break;r=_(r,1-o.day),o.year===n&&(e.unshift(r),t.unshift(o.month)),r=_(r,-1)}for(let n=0;n<t.length;n++)o[t[n]]=n+1;return[e,t,o]}guessISOYear(n){return n-this.yearCorrection}};function oo(n){return new fe("en-US",{calendar:n,era:"short",year:"numeric",month:"short",day:"numeric",timeZone:"UTC"})}var ro=G(1868,9,8),io={gregory:ln,japanese:class extends ln{constructor(){super(...arguments),this.format=oo("japanese")}computeFields(n){const e=super.computeFields(n);if(n>=ro){const t=Bn(this.format,n);e.era=Rn(t.era),e.eraYear=parseInt(t.relatedYear||t.year)}return e}},islamic:class extends to{guessISOYear(n){return Math.ceil(32*n/33+622)}}},so={iso8601:fn};function ao(n){const e=(n=String(n)).toLocaleLowerCase();return so[e]||(so[e]=new(io[dn(e)]||to)(n))}var co=G(1582,10,15),uo=G(622,7,18),ho={buddhist:co,japanese:co,roc:co,islamic:uo,"islamic-rgsa":uo,indian:0},fo={};function lo(n,e){return mo(Number(n/M),e)}function mo(n,e){if(function(n,e){return function(n){let e=fo[n];if(void 0===e){const t=ho[n];if(void 0===t)e=!1;else{let o=ao(n);o instanceof to||(o=new to(n));const r=t-864e5,i=o.computeFields(r);e=r!==o.epochMilliseconds(i.year,i.month,i.day)}fo[n]=e}return e}(e)&&n<ho[e]}(n,e))throw new RangeError("Invalid timestamp for calendar")}function go(n,e,t,o){let r=0,i=0,s=0,a=0;switch(o){case 9:r=function(n,e,t){const[,o,r]=zt(e.year,n.month,n.day,t,0),i=Gt(e,n),s=j(e.month,o)||j(e.day,r);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=jt(n,r,t,0);case 8:i=function(n,e,t){let o=0;const r=Gt(e,n);if(r){let{year:i}=n;for(;i!==e.year;)o+=t.monthsInYear(i)*r,i+=r;const[,s,a]=zt(e.year,n.month,n.day,t,0);o+=e.month-s;const c=j(e.day,a);c&&r&&c!==r&&(o-=r)}return o}(n,e,t),n=Lt(n,i,t,0)}return a=X(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===o&&(s=Math.trunc(a/7),a%=7),new Duration(r,i,s,a)}function yo(n,e,t){const o=7+e-t;return-H(nn(n,1,o)-e,7)+o-1}function wo(n,e,t){const o=yo(n,e,t),r=yo(n+1,e,t);return(_t(fn,n)-o+r)/7}var[po,vo]=d(),Calendar2=class extends g{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),vo(this,ao(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar2(String(n))}(n.calendar):n;const e=qe(String(n));return new Calendar2(e?e.calendar||"iso8601":n)}get id(){return po(this).id}era(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).era}eraYear(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).eraYear}year(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).year}month(n){const e=Xt(n,!0);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).month}monthCode(n){const e=Qt(n,this);return po(this).monthCode(e.month,e.year)}day(n){const e=Xt(n);return Mo(po(this),e.isoYear,e.isoMonth,e.isoDay).day}dayOfWeek(n){const e=Xt(n,!0);return nn(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=Qt(n,this,!0);return no(po(this),e.year,e.month,e.day)}weekOfYear(n){const e=Xt(n,!0);return function(n,e,t,o,r){const i=yo(n,o,r),s=Math.floor((no(fn,n,e,t)-i-1)/7)+1;if(s<1)return s+wo(n-1,o,r);const a=wo(n,o,r);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return Xt(n,!0),7}daysInMonth(n){const e=Qt(n,this,!0);return po(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=Qt(n,this,!0);return _t(po(this),e.year)}monthsInYear(n){const e=Qt(n,this,!0);return po(this).monthsInYear(e.year)}inLeapYear(n){return po(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=Vt(n,po(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=Vt({...n,day:1},po(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=po(this);let{era:o,eraYear:r,year:i,monthCode:s,day:a}=n;if(void 0===a)throw new TypeError("required property 'day' missing or undefined");void 0!==o&&void 0!==r&&(i=un(t.id,r,o));let c=i;if(void 0===c){if(void 0===s)throw new TypeError("either year or monthCode required with month");c=t.guessYearForMonthDay(s,a)}const u=Vt({...n,year:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const o=po(this),r=kt(m(PlainDate,n,t),m(Duration,e),o,u(t));return new PlainDate(r.isoYear,r.isoMonth,r.isoDay,this)}dateUntil(n,e,t){const r=po(this),i=m(PlainDate,n),s=m(PlainDate,e),a=R(o(t).largestUnit,6,6,9);return Do(Fo(i,s),this),go(i,s,r,a)}toString(){return this.id}};function Io(){return new Calendar2("iso8601")}function Mo(n,e,t,o){const r=G(e,t,o);return mo(r,n.id),n.computeFields(r)}function So(n){return void 0===n.calendar?Io():m(Calendar2,n.calendar)}function Fo(n,e){const{calendar:t}=n;return Do(t,e.calendar),t}function Oo(n,e){const t=n.calendar,o=e.calendar;if("iso8601"===t.id)return o;if("iso8601"===o.id)return t;if(t.id!==o.id)throw new RangeError("Non-ISO calendars incompatible");return t}function Do(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends v{constructor(n,e,t,o=0,r=0,i=0,s=0,a=0,u=0,d=Io()){const h=Yo({isoYear:n,isoMonth:e,isoDay:t,isoHour:o,isoMinute:r,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c),f=m(Calendar2,d);kn(h,f.id),super({...h,calendar:f})}static from(n,e){const o=u(e);return bo(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?No(t(n,pn),e,o,So(n)):Re(ke(String(n))))}static compare(n,e){return Zo(m(PlainDateTime,n),m(PlainDateTime,e))}with(n,e){return bo(No(To(a(n,pn),this),e,u(e),this.calendar))}withPlainDate(n){const e=m(PlainDate,n);return bo({...this.getISOFields(),...e.getISOFields(),calendar:Oo(this,e)})}withPlainTime(n){return bo({...this.getISOFields(),...st(n).getISOFields()})}withCalendar(n){return bo({...this.getISOFields(),calendar:m(Calendar2,n)})}add(n,e){return Eo(this,m(Duration,n),e)}subtract(n,e){return Eo(this,m(Duration,n).negated(),e)}until(n,e){return Co(this,m(PlainDateTime,n),e)}since(n,e){return Co(this,m(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);return Uo(n,ne(t),t.roundingMode)}(this,n)}equals(n){return 0===Zo(this,m(PlainDateTime,n))}toString(n){const e=Sn(n),t=mn(n),o=Uo(this,e.roundingIncrement,e.roundingMode).getISOFields();return mt(o,e)+vt(o.calendar.id,t)}toLocaleString(n,e){return ye(this,n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e})}toZonedDateTime(n,e){const t=m(TimeZone,n),o=t.getInstantFor(this,e);return new ZonedDateTime(o.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return zn(this.getISOFields())}toPlainMonthDay(){return qn(this.getISOFields())}toPlainDate(){return Ht(this.getISOFields())}toPlainTime(){return nt(this.getISOFields())}};function bo(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function No(n,e,t,o){return{...o.dateFromFields(n,e).getISOFields(),...it(n,t)}}function To(n,e){return{...$t(n,e),...tt(n,e)}}function Yo(n,e){return{...At(n,e),...et(n,e)}}function Zo(n,e){return j($(n.getISOFields()),$(e.getISOFields()))||j(n.calendar.id,e.calendar.id)}function Eo(n,e,t){const{calendar:o}=n,r=Ut(e),i=Bt(e);return bo({...J($(o.dateAdd(Ht(n.getISOFields()),r,t).getISOFields())+ct(n)+ct(i)),calendar:o})}function Co(n,e,t,o){const r=k(t,6,0,0,9);return Vn(se(n,e,r.largestUnit),r,n,e,o)}function Uo(n,e,t){const o=Xn(n,e,t);return bo(ee(n.getISOFields(),o))}function Bo(n,e){return j(n.epochNanoseconds,e.epochNanoseconds)}function Po(n,e){if(Yt(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+ct(Bt(e)))}function Ro(n,e,t){const o=k(t,3,0,0,5,!0);return Zt(_n(e.epochNanoseconds-n.epochNanoseconds,o),o.largestUnit)}Nn(PlainDateTime,E),Zn(PlainDateTime,Yn);var[xo,ko]=d(),Instant=class extends y{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&on(),ko(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=ke(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant($(Yo(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*S)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*M)}static fromEpochMicroseconds(n){return new Instant(n*I)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Bo(m(Instant,n),m(Instant,e))}get epochNanoseconds(){return xo(this)}add(n){return Po(this,m(Duration,n))}subtract(n){return Po(this,m(Duration,n).negated())}until(n,e){return Ro(this,m(Instant,n),e)}since(n,e){return Ro(m(Instant,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5,!1,!0),[o,r]=lt(n.epochNanoseconds);return new Instant(o+_n(r,t))}(this,n)}equals(n){return 0===Bo(this,m(Instant,n))}toString(n){const e=o(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toLocaleString(n,e){return new fe(n,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",...e}).format(this.epochMilliseconds)}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};function jo(n){return Instant.fromEpochMilliseconds(n.valueOf())}function Lo(n=Ao()){return zo().toZonedDateTimeISO(n)}function qo(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return zo().toZonedDateTime({calendar:n,timeZone:e??Ao()})}function Ho(n=Ao()){return Lo(n).toPlainDateTime()}function $o(n,e){return qo(n,e).toPlainDateTime()}function zo(){return new Instant(BigInt(Date.now())*M)}function Ao(){return new TimeZone((new fe).resolvedOptions().timeZone)}On(Instant);var Wo={zonedDateTimeISO:Lo,zonedDateTime:qo,plainDateTimeISO:Ho,plainDateTime:$o,plainDateISO:function(n=Ao()){return Ho(n).toPlainDate()},plainDate:function(n,e){return $o(n,e).toPlainDate()},plainTimeISO:function(n=Ao()){return zo().toZonedDateTimeISO(n).toPlainTime()},instant:zo,timeZone:Ao};export{Calendar2 as Calendar,Duration,Instant,Wo as Now,fe as OrigDateTimeFormat,PlainDate,PlainDateTime,PlainMonthDay,PlainTime,PlainYearMonth,TimeZone,ZonedDateTime,jo as dateToTemporalInstant,ye as formatUnzoned,ge as formatZoned,me as normalizeIntlDateArg,le as normalizeIntlOptionalDateArg};
function n(n,e,t){const r=function(n,e,t){return(o,r)=>{if(void 0===o){const e=r??t;if(void 0===e)throw new RangeError(`Must specify a ${n}`);return e}if(void 0===e[o])throw new RangeError(`Invalid ${n}: ${o}`);return e[o]}}(n,e,t);return(e,t)=>{const i=o(e);return r(i[n],t)}}function e(n,e,t,o){if(void 0===n)return e;if(!Number.isFinite(n))throw new RangeError("Number must be finite");n=Math.trunc(n);const r=Math.min(Math.max(n,e),t);if(r!==n&&o===c)throw new RangeError("Invalid overflowed value "+n);return r}function t(n,e){const t={};let o=0;for(const r in e)void 0!==n[r]&&(t[r]=e[r](n[r]),o++);if(!o)throw new TypeError("Invalid object, no keys");return t}function o(n){if(void 0===n)return{};if(!i(n))throw TypeError("options must be an object or undefined");return n}var r=/object|function/;function i(n){return null!==n&&r.test(typeof n)}var s=["calendar","timeZone"];function a(n,e){for(const e of s)if(void 0!==n[e])throw new TypeError(`Disallowed field ${e}`);return t(n,e)}var c=1,u=n("overflow",{constrain:0,reject:1},0);function d(){const n=new WeakMap;return[n.get.bind(n),n.set.bind(n)]}function h(n,e){Object.defineProperties(n.prototype,f(e,(n=>({get:n}))))}function f(n,e){const t={};for(const o in n)t[o]=e(n[o],o);return t}function l(n,e){const t={};return n.forEach(((n,o)=>{t[n]=e(n,o)})),t}var m=Symbol();function g(n,e,...t){return e instanceof n?e:n.from(e,...t)}var y=class{toJSON(){return this.toString()}},w=class extends y{valueOf(){throw new Error("Cannot convert object using valueOf")}},[p,v]=d(),M=class extends w{constructor(n){super(),v(this,Object.freeze(n))}getISOFields(){return p(this)}},I=1000n,S=1000000n,b=1000000000n,F=60000000000n,D=3600000000000n,O=86400000000000n,T=[1,1e3,1e6,1e9,6e10,36e11,864e11],N=[9,6,3];function Y(n){return n<=6}function E(n){return n>=6}var Z=n("roundingMode",{halfExpand:Math.round,ceil:Math.ceil,trunc:Math.trunc,floor:Math.floor}),C=["nanosecond","microsecond","millisecond","second","minute","hour"],U=[...C,"day","week","month","year"],P=U.map((n=>n+"s")),B=l(U,((n,e)=>e)),R=l(P,((n,e)=>e));function k(n,e,t,o){let r;if(void 0===n){if(void 0===e)throw new RangeError("Unit is required");r=e}else if(r=B[n]??R[n],void 0===r||r<t||r>o)throw new RangeError("Invalid unit "+n);return r}function x(n,e,t,r,s,a){if(void 0===e&&!i(n))throw new TypeError("Need rounding options");const c=o(n),u=c.roundingIncrement??1,d=k(c.smallestUnit,e,t,r);if(!s&&a){if(d<6&&864e11%u*T[d])throw new RangeError("Increment must evenly divide into 24 hours")}else{if(d<6?T[d+1]%u:!s&&1!==u)throw new RangeError("roundingIncrement does not divide evenly into next highest unit");if(d<6&&u*T[d]>=T[d+1])throw new RangeError("roundingIncrement must be less than next highest unit")}return{smallestUnit:d,roundingMode:Z(n,s?Math.trunc:Math.round),roundingIncrement:u}}function j(n,e,t,r,i,s,a){const c=x(n,t,r,i,!a,s);e=Math.max(e,c.smallestUnit);let u=o(n).largestUnit;"auto"===u&&(u=void 0);const d=k(u,e,r,i);if(c.smallestUnit>d)throw new RangeError("Bad smallestUnit/largestUnit");return{largestUnit:d,...c}}function q(n,e){return n<e?-1:n>e?1:0}function L(n){return q(n,0)}function H(n,e,t){const o=BigInt(e),r=n/o*o,i=Number(n-r);return r+BigInt(t(i/e))*o}function $(n,e){return(n%e+e)%e}function z(n){return K(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function A(n){return Math.floor(W(n)/1e3)}function W(n){return G(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond)}function K(n,e,t,o,r,i,s,a,c){return BigInt(G(n,e,t,o,r,i,s))*S+BigInt(a??0)*I+BigInt(c??0)}function G(n,e,t,o,r,i,s){const a=n??1970,c=e??1,u=t??1,d=L(a);let h,f,l=0;const m=a>=0&&a<1e3,g=m?a+1200:a;for(;l<31;l++){h=u-d*l;const n=Date.UTC(g,c-1,h,o??0,r??0,i??0,s??0);if(!on(n)){f=n+d*l*864e5;break}}return(void 0===f||h<1||h>ln.daysInMonth(a,c))&&rn(),m&&(f=new Date(f).setUTCFullYear(a)),f}function J(n){let e=n/S,t=Number(n-e*S);t<0&&(t+=1e6,e-=1n);const o=Math.floor(t/1e3);return t-=1e3*o,{...Q(Number(e)),isoMicrosecond:o,isoNanosecond:t}}function Q(n){const[e,t]=tn(n);return{isoYear:e.getUTCFullYear(),isoMonth:e.getUTCMonth()+1,isoDay:e.getUTCDate()+t,isoHour:e.getUTCHours(),isoMinute:e.getUTCMinutes(),isoSecond:e.getUTCSeconds(),isoMillisecond:e.getUTCMilliseconds()}}function V(n){return tn(1e3*n)[0].getUTCFullYear()}function X(n){return Math.floor(G(n)/1e3)}function _(n,e){return Math.round((e-n)/864e5)}function nn(n,e){return n+864e5*e}function en(n,e,t){const[o,r]=tn(G(n,e,t));return $(o.getUTCDay()+r,7)||7}function tn(n){const e=L(n);let t,o=0;for(;o<31;o++){const r=new Date(n-e*o*864e5);if(!on(r)){t=r;break}}return void 0===t&&rn(),[t,e*o]}function on(n){return isNaN(n.valueOf())}function rn(){throw new RangeError("Date outside of supported range")}function sn(n,e){return String(n).padStart(e,"0")}function an(n){return n<0?"-":"+"}var cn={gregory:{bce:-1,ce:0},ethioaa:{era0:0},ethiopic:{era0:0,era1:5500},coptic:{era0:-1,era1:0},roc:{beforeroc:-1,minguo:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0},japanese:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018}},un=class{constructor(n){this.id=n}monthCode(n,e){return"M"+sn(n,2)}convertMonthCode(n,e){const t=/L$/.test(n),o=parseInt(n.substr(1));if(t)throw new RangeError("Calendar system doesnt support leap months");return[o,!1]}};function dn(n,e,t,o){let r=cn[hn(n)]?.[t];if(void 0===r){if(!o)throw new Error("Unkown era "+t);r=0}return(r+e)*(L(r)||1)}function hn(n){return n.split("-")[0]}var fn=class extends un{computeFields(n){const e=Q(n);return{era:void 0,eraYear:void 0,year:e.isoYear,month:e.isoMonth,day:e.isoDay}}epochMilliseconds(n,e,t){return G(n,e,t)}daysInMonth(n,e){return 2===e?this.inLeapYear(n)?29:28:4===e||6===e||9===e||11===e?30:31}monthsInYear(){return 12}inLeapYear(n){return n%4==0&&(n%100!=0||n%400==0)}guessYearForMonthDay(){return 1972}normalizeISOYearForMonthDay(){return 1972}},ln=new fn("iso8601"),mn=class extends fn{computeFields(n){const e=super.computeFields(n),{year:t}=e;return{...e,era:t<1?"bce":"ce",eraYear:t<1?-(t-1):t}}},gn=n("calendarName",{auto:0,never:1,always:2},0),yn={era:String,eraYear:Number,year:Number,month:Number,monthCode:String},wn={...yn,day:Number},pn={hour:Number,minute:Number,second:Number,millisecond:Number,microsecond:Number,nanosecond:Number},vn={...wn,...pn},Mn={...vn,offset:String},In=l(P,(()=>Number)),Sn=n("offset",{prefer:0,use:1,ignore:2,reject:3});function bn(n,t=4){const r=o(n),i=r.smallestUnit,s=r.fractionalSecondDigits;let a,u=0,d=1;return void 0!==i?(u=k(i,void 0,0,t),d=T[u],a=N[u]||0):void 0!==s&&"auto"!==s&&(a=e(s,0,9,c),d=Math.pow(10,9-a)),{smallestUnit:u,fractionalSecondDigits:a,roundingMode:Z(n,Math.trunc),roundingIncrement:d}}var Fn=n("timeZoneName",{auto:0,never:1},0);function Dn(n){h(n,{epochMicroseconds(){return this.epochNanoseconds/I},epochMilliseconds(){return Number(this.epochNanoseconds/S)},epochSeconds(){return Number(this.epochNanoseconds/b)}})}var On,Tn={calendar:"calendar"};for(const n of U)Tn[n]="iso"+((On=n).charAt(0).toUpperCase()+On.slice(1));function Nn(n,e=[]){h(n,l(e.concat("calendar"),(n=>function(){return this.getISOFields()[Tn[n]]})))}var Yn=["era","eraYear","year","month","monthCode","daysInMonth","daysInYear","monthsInYear","inLeapYear"],En=[...Yn,"day","dayOfWeek","dayOfYear","weekOfYear","daysInWeek"];function Zn(n,e){h(n,l(e,(n=>function(){const e=this.calendar[n](this);return Object.defineProperty(this,n,{value:e}),e})))}var Cn="(\\d{2})(:?(\\d{2})(:?(\\d{2})([.,](\\d{1,9}))?)?)?",Un="([+-])"+Cn,Pn="(Z|"+Un+")?(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?",Bn=Hn("([+-]\\d{6}|\\d{4})-?(\\d{2})"+Pn),Rn=Hn("(--)?(\\d{2})-?(\\d{2})"+Pn),kn=Hn("([+-]\\d{6}|\\d{4})-?(\\d{2})-?(\\d{2})([T ](\\d{2})(:?(\\d{2})(:?(\\d{2})([.,](\\d{1,9}))?)?)?)?"+Pn),xn=Hn(Cn+Pn),jn=Hn(Un),qn=/^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i,Ln=/\u2212/g;function Hn(n){return new RegExp(`^${n}$`,"i")}function $n(n){const e=Jn(n);if(!e)throw se("dateTime",n);return e}function zn(n){const e=Qn(n);if(!e)throw se("dateTime",n);return e}function An(n){const e=function(n){const e=Bn.exec(ie(n));if(e)return{calendar:(t=e.slice(1))[14],isoYear:oe(t[0]),isoMonth:oe(t[1]),isoDay:1};var t}(n)||Qn(n);if(!e)throw se("yearMonth",n);return e}function Wn(n){const e=function(n){const e=Rn.exec(ie(n));if(e)return{calendar:(t=e.slice(1))[15],isoYear:1972,isoMonth:oe(t[1]),isoDay:oe(t[2])};var t}(n)||Qn(n);if(!e)throw se("monthDay",n);return e}function Kn(n){const e=Vn(n);if(void 0===e)throw se("timeZone",n);return e}function Gn(n){const e=function(n){const e=xn.exec(ie(n));if(e)return _n(e.slice(1))}(n)||Qn(n);if(void 0===e)throw se("time",n);return e}function Jn(n){const e=kn.exec(ie(n));if(e)return function(n){const e=n[11];let t,o=!1;e&&(o="Z"===e.toUpperCase(),t=o?0:ne(n.slice(12)));return{...Xn(n),timeZone:n[21],offset:t,Z:o}}(e.slice(1))}function Qn(n){const e=kn.exec(ie(n));if(e)return Xn(e.slice(1))}function Vn(n){const e=jn.exec(ie(n));if(e)return ne(e.slice(1))}function Xn(n){return{calendar:n[23],isoYear:oe(n[0]),isoMonth:oe(n[1]),isoDay:oe(n[2]),..._n(n.slice(4))}}function _n(n){const e=te(n[4]);return{...wt(vt(BigInt(ee(n[6]||"")),2)),isoHour:te(n[0]),isoMinute:te(n[2]),isoSecond:60===e?59:e}}function ne(n){return("+"===n[0]?1:-1)*function(n){return 36e11*te(n[0])+6e10*te(n[2])+1e9*te(n[4])+ee(n[6]||"")}(n.slice(1))}function ee(n){return parseInt(n.padEnd(9,"0"))}function te(n){return parseInt(n||"0")}function oe(n){return parseInt(n||"1")}function re(n){return void 0===n?void 0:parseInt(n)}function ie(n){return n.replace(Ln,"-")}function se(n,e){throw new RangeError(`Cannot parse ${n} '${e}'`)}function ae(n,e,t,o){const r=P[e],{sign:i}=n,s={};for(let t=9;t>=e;t--){const e=P[t];s[e]=n[e]}const a={[r]:i},c=t.add(s),u=c.add(a),d=ce(c),h=ce(u),f=ce(o),l=Number(f-d)/Number(h-d)*i;return s[r]+=l,s}function ce(n){const{epochNanoseconds:e}=n;return void 0!==e?e:z(n.getISOFields())}var ue=n("disambiguation",{compatible:0,earlier:1,later:2,reject:3},0),de=n("offset",{auto:0,never:1},0);function he(n){return{...n,calendar:void 0===n.calendar?Zo():new Calendar(n.calendar)}}function fe(n){return{...he(n),timeZone:new TimeZone(n.timeZone)}}var le=class{constructor(n){this.id=n}},me=class extends le{constructor(n,e){super(n),this.offsetSecs=e}getPossibleOffsets(){return[this.offsetSecs]}getOffset(){return this.offsetSecs}getTransition(){}};function ge(n,e){const t={},o=n.formatToParts(e);for(const n of o)t[n.type]=n.value;return t}var ye={bc:"bce",ad:"ce"};function we(n){return n=n.toLowerCase().normalize("NFD").replace(/[^a-z0-9]/g,""),ye[n]||n}var pe=Intl.DateTimeFormat;function ve(n){return[].concat(n||[])}var Me={"Pacific/Apia":{2011:[[1301752800,-36e3,-39600],[1316872800,-39600,-36e3],[1325239200,-36e3,50400]]}},Ie=[182,91,273],Se=class extends le{constructor(n){const e=new pe("en-GB",{era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:n});super(e.resolvedOptions().timeZone),this.format=e,this.yearEndOffsets={},this.transitionsInYear=Me[n]||{}}getPossibleOffsets(n){const e=[this.getTransition(n,-1),this.getTransition(n-1,1)].filter(Boolean);let t;for(const o of e){const[e,r,i]=o,s=n-r,a=n-i;if(e>s&&e>a)return[r];if(!(e<=s&&e<=a))return[r,i];t=i}return void 0!==t?[t]:[this.getYearEndOffset(V(n))]}getOffset(n){const e=ge(this.format,1e3*n);let t=parseInt(e.year);"bce"===we(e.era)&&(t=-(t-1));const o=G(t,parseInt(e.month),parseInt(e.day),parseInt(e.hour),parseInt(e.minute),parseInt(e.second));return Math.floor(o/1e3)-n}getTransition(n,e){const t=V(n);for(let o=0;o<100;o++){const r=t+o*e,i=this.getTransitionsInYear(r),s=i.length,a=e<0?s-1:0;for(let t=0;t<s;t++){const o=i[a+t*e];if(q(o[0],n)===e)return o}}}getYearEndOffset(n){const{yearEndOffsets:e}=this;return e[n]||(e[n]=this.getOffset(X(n+1)-1))}getTransitionsInYear(n){const{transitionsInYear:e}=this;return e[n]||(e[n]=this.computeTransitionsInYear(n))}computeTransitionsInYear(n){const e=this.getYearEndOffset(n-1),t=this.getYearEndOffset(n),o=X(n)-1,r=X(n+1)-1;if(e!==t)return[this.searchTransition(o,r,e,t)];const i=this.searchIsland(e,o);return void 0!==i?[this.searchTransition(o,i[0],e,i[1]),this.searchTransition(i[0],r,i[1],t)]:[]}searchTransition(n,e,t,o){for(;e-n>1;){const o=Math.floor(n+(e-n)/2);this.getOffset(o)===t?n=o:e=o}return[e,t,o]}searchIsland(n,e){for(const t of Ie){const o=e+86400*t,r=this.getOffset(o);if(r!==n)return[o,r]}}},be={UTC:new me("UTC",0)};var[Fe,De]=d(),TimeZone=class extends y{constructor(n){if(!n)throw new RangeError("Invalid timezone ID");super(),De(this,function(n){const e=(n=String(n)).toLocaleUpperCase();if(be[e])return be[e];const t=Vn(n);if(void 0!==t){if(Math.abs(t)>864e11)throw new RangeError("Offset out of bounds");return new me(Dt(t),Math.trunc(t/1e9))}return be[e]=new Se(n)}(n))}static from(n){if("object"==typeof n)return function(n){return n.timeZone}(n)?function(n){if("object"==typeof n){if("string"==typeof n.id)return n;throw new RangeError("Invalid timeZone")}return new TimeZone(String(n))}(n.timeZone):n;const e=Jn(String(n));if(e){if(e.timeZone){const n=fe(e);return We(n,3),n.timeZone}if(e.Z)return new TimeZone("UTC");if(void 0!==e.offset)return new TimeZone(Dt(e.offset))}return new TimeZone(n)}get id(){return Fe(this).id}getOffsetStringFor(n){return Dt(this.getOffsetNanosecondsFor(n))}getOffsetNanosecondsFor(n){const e=g(Instant,n);return 1e9*Fe(this).getOffset(e.epochSeconds)}getPlainDateTimeFor(n,e=Zo()){const t=g(Instant,n);return ko({...J(t.epochNanoseconds+BigInt(this.getOffsetNanosecondsFor(t))),calendar:g(Calendar,e)})}getInstantFor(n,e){const t=ue(e),o=g(PlainDateTime,n).getISOFields(),r=A(o),i=Fe(this).getPossibleOffsets(r);let s;if(1===i.length||0===t)s=i[0];else{if(3===t)throw new RangeError("Ambiguous offset");s=Math[1===t?"max":"min"](...i)}return Oe(r-s,o)}getPossibleInstantsFor(n){const e=g(PlainDateTime,n).getISOFields(),t=A(e);let o=Fe(this).getPossibleOffsets(t);return 2===o.length&&o[0]<o[1]&&(o=[]),o.map((n=>Oe(t-n,e)))}getPreviousTransition(n){const e=g(Instant,n),t=Fe(this).getTransition(e.epochSeconds,-1);return t?Oe(t[0]):null}getNextTransition(n){const e=g(Instant,n),t=Fe(this).getTransition(e.epochSeconds,1);return t?Oe(t[0]):null}toString(){return this.id}};function Oe(n,e){return new Instant(BigInt(n)*b+(e?BigInt(e.isoMillisecond)*S+BigInt(e.isoMicrosecond)*I+BigInt(e.isoNanosecond):0n))}function Te(n,e){const t=z(n);Ne(t),Fo(t,e)}function Ne(n){(n<-8640000086399999999999n||n>8640000086399999999999n)&&rn()}function Ye(n,e,t){return(o,r)=>{const i=Be(n,r)?{}:{...n,...e};return{buildKey:Pe(o,r,!1),buildFormat:function(n,e){return new pe(o,{calendar:n,timeZone:e||void 0,...i,...r,...t})},buildEpochMilli:Ee}}}function Ee(n){return n.epochMilliseconds}function Ze(n,e,t){return(o,r)=>{const i=Be(n,r)?{}:n;return{buildKey:Pe(o,r,t),buildFormat:function(n,t){return new pe(o,{calendar:n,...i,...r,...e,timeZone:t,timeZoneName:void 0})},buildEpochMilli:void 0!==r.timeZone?Ce.bind(null,new TimeZone(r.timeZone)):Ue}}}function Ce(n,e){const t=ko({..._e,...e.getISOFields()});return n.getInstantFor(t).epochMilliseconds}function Ue(n){return W(n.getISOFields())}function Pe(n,e,t){const o=e.calendar??function(n){for(const e of n){const n=e.match(/-u-ca-(.*)$/);if(n)return n[1]}return}(n),r=e.timeZone;return function(n,e){const i=n.calendar?.id,s=n.timeZone?.id;if(e){if(e.calendar?.id!==i)throw new RangeError("Mismatching calendar");if(e.timeZone?.id!==s)throw new RangeError("Mismatching timeZone")}if((t||"iso8601"!==i)&&void 0!==i&&void 0!==o&&o!==i)throw new RangeError("Non-iso calendar mismatch");if(void 0!==s&&void 0!==r&&r!==s)throw new RangeError("Given timeZone must agree");return[o||i||"iso8601",r||s||"UTC"]}}function Be(n,e){for(const t in n)if(void 0!==e[t])return!0;return!1}function Re(n,e){n.prototype.toLocaleString=function(n,t){const o=e(ve(n),t||{});return o.buildFormat(...o.buildKey(this)).format(o.buildEpochMilli(this))},n.prototype[m]=e}function ke(n){return n?.[m]}var xe={day:1},PlainYearMonth=class extends M{constructor(n,e,t=Zo(),o=1){const r=to({isoYear:n,isoMonth:e,isoDay:o},c),i=g(Calendar,t);var s,a;s=r,a=i.id,Fo(z(s),a),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainYearMonth)return qe(n.getISOFields());if("object"==typeof n){const o=t(n,yn);return Uo(n).yearMonthFromFields(o,e)}const o=An(String(n));return void 0===o.calendar&&(o.isoDay=1),qe(he(o))}static compare(n,e){return He(g(PlainYearMonth,n),g(PlainYearMonth,e))}with(n,e){const t=a(n,yn);return this.calendar.yearMonthFromFields(Le(t,this),e)}add(n,e){return je(this,g(Duration,n),e)}subtract(n,e){return je(this,g(Duration,n).negated(),e)}until(n,e){return io(this.toPlainDate(xe),g(PlainYearMonth,n).toPlainDate(xe),j(e,9,8,8,9))}since(n,e){return io(this.toPlainDate(xe),g(PlainYearMonth,n).toPlainDate(xe),j(e,9,8,8,9),!0)}equals(n){return 0===He(this,g(PlainYearMonth,n))}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=gn(n);return("iso8601"===t?bt(e):St(e))+Ot(t,o)}toPlainDate(n){return this.calendar.dateFromFields({year:this.year,month:this.month,day:n.day})}};function je(n,e,t){return n.toPlainDate({day:e.sign<0?n.daysInMonth:1}).add(e,t).toPlainYearMonth()}function qe(n){return new PlainYearMonth(n.isoYear,n.isoMonth,n.calendar,n.isoDay)}function Le(n,e){const t={};let o=!1,r=!1;return void 0===n.era&&void 0===n.eraYear||(t.era=n.era,t.eraYear=n.eraYear,o=!0),void 0!==n.year&&(t.year=n.year,o=!0),o||(t.year=e.year),void 0!==n.month&&(t.month=n.month,r=!0),void 0!==n.monthCode&&(t.monthCode=n.monthCode,r=!0),r||(t.month=e.month),t}function He(n,e){return q(z(n.getISOFields()),z(e.getISOFields()))||q(n.calendar.id,e.calendar.id)}Nn(PlainYearMonth),Zn(PlainYearMonth,Yn),Re(PlainYearMonth,Ze({year:"numeric",month:"numeric"},{weekday:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0},!0));var[$e,ze]=d(),ZonedDateTime=class extends M{constructor(n,e,t=Zo()){const o=g(TimeZone,e),r=g(Calendar,t),i=new Instant(n),s=o.getOffsetNanosecondsFor(i),a=J(n+BigInt(s));Te(a,r.id),super({...a,calendar:r,timeZone:o,offset:o.getOffsetStringFor(i)}),ze(this,{epochNanoseconds:n,offsetNanoseconds:s})}static from(n,e){const o=Sn(e,3),r=u(e);return Ae(n instanceof ZonedDateTime?{...n.getISOFields(),offset:n.offsetNanoseconds}:"object"==typeof n?Ke(t(n,Mn),e,r,Uo(n),function(n){if(void 0===n.timeZone)throw new TypeError("Must specify timeZone");return g(TimeZone,n.timeZone)}(n)):fe($n(String(n))),e,o)}static compare(n,e){return q(g(ZonedDateTime,n).epochNanoseconds,g(ZonedDateTime,e).epochNanoseconds)}get timeZone(){return this.getISOFields().timeZone}get epochNanoseconds(){return $e(this).epochNanoseconds}get offsetNanoseconds(){return $e(this).offsetNanoseconds}get offset(){return this.getISOFields().offset}with(n,e){const t=a(n,Mn),o={...jo(r=t,i=this),offset:r.offset??i.offset};var r,i;const s=Sn(e,0),c=u(e);return ue(e),Ae(Ke(o,e,c,this.calendar,this.timeZone),e,s)}withPlainDate(n){const e=g(PlainDate,n),t=e.toPlainDateTime(this),{timeZone:o}=this,r=o.getInstantFor(t);return new ZonedDateTime(r.epochNanoseconds,o,Bo(this,e))}withPlainTime(n){return this.toPlainDate().toZonedDateTime({plainTime:n,timeZone:this.timeZone})}withCalendar(n){return new ZonedDateTime(this.epochNanoseconds,this.timeZone,n)}withTimeZone(n){return new ZonedDateTime(this.epochNanoseconds,n,this.calendar)}add(n,e){return Ge(this,g(Duration,n),e)}subtract(n,e){return Ge(this,g(Duration,n).negated(),e)}until(n,e){return Je(this,g(ZonedDateTime,n),e)}since(n,e){return Je(this,g(ZonedDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);if(6===t.smallestUnit){const e=function(n,e,t){const o=gt(n);return{day:t(Number(o)/e),hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}}(n,nt(n),t.roundingMode);return ko(st(n.getISOFields(),e)).toZonedDateTime(n.timeZone)}return et(n,it(t),t.roundingMode)}(this,n)}equals(n){const e=g(ZonedDateTime,n);return this.epochNanoseconds===e.epochNanoseconds&&this.calendar.id===e.calendar.id&&this.timeZone.id===e.timeZone.id}startOfDay(){return Ae({...this.getISOFields(),..._e,offset:void 0},void 0,3)}get hoursInDay(){return nt(this)/36e11}toString(n){const e=bn(n),t=de(n),o=Fn(n),r=gn(n),i=et(this,e.roundingIncrement,e.roundingMode).getISOFields();return It(i,e)+(0===t?i.offset:"")+function(n,e){if(1!==e)return`[${n}]`;return""}(i.timeZone.id,o)+Ot(i.calendar.id,r)}toPlainYearMonth(){return qe(this.getISOFields())}toPlainMonthDay(){return this.calendar.monthDayFromFields(this)}toPlainDateTime(){return ko(this.getISOFields())}toPlainDate(){return _t(this.getISOFields())}toPlainTime(){return at(this.getISOFields())}toInstant(){return new Instant(this.epochNanoseconds)}};function Ae(n,e,t){const{calendar:o,timeZone:r}=n,i=We(n,t)??r.getInstantFor(ko(n),e).epochNanoseconds;return new ZonedDateTime(i,r,o)}function We(n,e){const{timeZone:t,offset:o,Z:r}=n;let i;if(void 0!==o&&2!==e&&(i=z(n)-BigInt(o),1!==e&&!r)){if(!function(n,e){for(const t of e)if(t.epochNanoseconds===n)return!0;return!1}(i,t.getPossibleInstantsFor(ko(n)))){if(3===e)throw new RangeError("Mismatching offset/timezone");i=void 0}}return i}function Ke(n,e,t,o,r){return{...xo(n,e,t,o),timeZone:r,offset:n.offset?Kn(n.offset):void 0}}function Ge(n,e,t){const{calendar:o,timeZone:r}=n,i=Ht(e),s=$t(e),a=o.dateAdd(n.toPlainDate(),i,t).toZonedDateTime({plainTime:n,timeZone:r}),c=gt(s),u=a.epochNanoseconds+c;return new ZonedDateTime(u,r,o)}function Je(n,e,t,o){const r=j(t,5,0,0,9),{largestUnit:i}=r;if(i>=6&&n.timeZone.id!==e.timeZone.id)throw new Error("Must be same timeZone");return tt(Qe(n,e,i),r,n,e,o)}function Qe(n,e,t){const o=Po(n,e);if(!E(t))return Ve(n,e,t);const r=_t(n.getISOFields());let i,s,a,c,u,d=_t(e.getISOFields());do{s=o.dateUntil(r,d,{largestUnit:U[t]}),i=n.add(s),a=Ve(i,e,5),c=s.sign,u=a.sign}while(c&&u&&c!==u&&(d=d.add({days:u})));return Bt(s,a)}function Ve(n,e,t){return jt(Xe(e)-Xe(n),t)}function Xe(n){return n instanceof PlainDateTime?z(n.getISOFields()):n.epochNanoseconds}Nn(ZonedDateTime,C),Zn(ZonedDateTime,En),Dn(ZonedDateTime),Re(ZonedDateTime,Ye({year:"numeric",month:"numeric",day:"numeric",weekday:void 0,hour:"numeric",minute:"2-digit",second:"2-digit"},{timeZoneName:"short"},{}));var _e={isoHour:0,isoMinute:0,isoSecond:0,isoMillisecond:0,isoMicrosecond:0,isoNanosecond:0};function nt(n){const e={...n.getISOFields(),..._e,offset:void 0},t=Ae(e,void 0,3),o=Ae({...e,...Qt(e,1)},void 0,3);return Number(o.epochNanoseconds-t.epochNanoseconds)}function et(n,e,t){return Ae({...zo(n.toPlainDateTime(),e,t).getISOFields(),timeZone:n.timeZone,offset:n.offsetNanoseconds},void 0,0)}function tt(n,e,t,o,r){const{largestUnit:i,smallestUnit:s,roundingIncrement:a,roundingMode:c}=e;if(!E(i))return jt(rt((Xe(o)-Xe(t))*(r?-1n:1n),e),i);let u=ae(n,s,t,o);const d=P[s];function h(){const n=u[d];var e;u[d]=c(n/(e=a))*e}c===Math.round&&h(),r&&(u=Wt(u)),c!==Math.round&&h();let f=Ut(u);return s>0&&(f=r?Rt(f.negated(),i,t).negated():Rt(f,i,t)),f}function ot(n,e,t){return yt(H(gt(n),e,t))}function rt(n,e){return H(n,it(e),e.roundingMode)}function it(n){return T[n.smallestUnit]*n.roundingIncrement}function st(n,e){return{...Qt(n,e.day),...wt(e)}}var PlainTime=class extends M{constructor(n=0,e=0,t=0,o=0,r=0,i=0){super({...ct({isoHour:n,isoMinute:e,isoSecond:t,isoMillisecond:o,isoMicrosecond:r,isoNanosecond:i},c),calendar:Zo()})}static from(n,e){const o=u(e);return at(n instanceof PlainTime?n.getISOFields():"object"==typeof n?ft(t(n,pn),o):Gn(String(n)))}static compare(n,e){return mt(g(PlainTime,n),g(PlainTime,e))}with(n,e){return at(ft(ut(a(n,pn),this),u(e)))}add(n){return dt(this,g(Duration,n))}subtract(n){return dt(this,g(Duration,n).negated())}until(n,e){return ht(this,g(PlainTime,n),e)}since(n,e){return ht(g(PlainTime,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5);return at(wt(ot(n,it(t),t.roundingMode)))}(this,n)}equals(n){return 0===mt(this,g(PlainTime,n))}toString(n){const e=bn(n);return Ft(wt(ot(this,e.roundingIncrement,e.roundingMode)),e)}toZonedDateTime(n){return this.toPlainDateTime(n.plainDate).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return g(PlainDate,n).toPlainDateTime(this)}};function at(n){return new PlainTime(n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond)}function ct({isoHour:n,isoMinute:t,isoSecond:o,isoMillisecond:r,isoMicrosecond:i,isoNanosecond:s},a){return{isoHour:n=e(n,0,23,a),isoMinute:t=e(t,0,59,a),isoSecond:o=e(o,0,59,a),isoMillisecond:r=e(r,0,999,a),isoMicrosecond:i=e(i,0,999,a),isoNanosecond:s=e(s,0,999,a)}}function ut(n,e){return f(pn,((t,o)=>n[o]??e[o]))}function dt(n,e){var t,o;return at(wt((t=n,o=$t(e),yt(gt(t)+gt(o)))))}function ht(n,e,t){const o=j(t,5,0,0,5);return jt(rt(gt(e)-gt(n),o),o.largestUnit)}function ft(n,e){return ct(wt(n),e)}function lt(n){return g(PlainTime,n??{hour:0})}function mt(n,e){return q(gt(n),gt(e))}function gt(n){return BigInt(n.hour)*D+BigInt(n.minute)*F+BigInt(n.second)*b+BigInt(n.millisecond)*S+BigInt(n.microsecond)*I+BigInt(n.nanosecond)}function yt(n){const[e,t]=Mt(n);return{...vt(t,5),day:Number(e/O)}}function wt(n){return{isoNanosecond:n.nanosecond??0,isoMicrosecond:n.microsecond??0,isoMillisecond:n.millisecond??0,isoSecond:n.second??0,isoMinute:n.minute??0,isoHour:n.hour??0}}function pt(n){return BigInt(n.day)*O+gt(n)}function vt(n,e){const t={};for(let o=e;o>=0;o--){const e=BigInt(T[o]),r=n/e;n-=r*e,t[U[o]]=Number(r)}return t}function Mt(n){const e=J(n);return[K(e.isoYear,e.isoMonth,e.isoDay),(t=e,BigInt(t.isoHour)*D+BigInt(t.isoMinute)*F+BigInt(t.isoSecond)*b+BigInt(t.isoMillisecond)*S+BigInt(t.isoMicrosecond)*I+BigInt(t.isoNanosecond))];var t}function It(n,e){return St(n)+"T"+Ft(n,e)}function St(n){return bt(n)+"-"+sn(n.isoDay,2)}function bt(n){const{isoYear:e}=n;return(e<1e3||e>9999?an(e)+sn(Math.abs(e),6):sn(e,4))+"-"+sn(n.isoMonth,2)}function Ft(n,e){const t=[sn(n.isoHour,2)];return e.smallestUnit<=4&&(t.push(sn(n.isoMinute,2)),e.smallestUnit<=3&&t.push(sn(n.isoSecond,2)+Nt(n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,e.fractionalSecondDigits)[0])),t.join(":")}function Dt(n){const e=vt(BigInt(Math.abs(n)),5),t=Nt(e.millisecond,e.microsecond,e.nanosecond,void 0)[0];return an(n)+sn(e.hour,2)+":"+sn(e.minute,2)+(e.second||t?":"+sn(e.second,2)+t:"")}function Ot(n,e){return n&&(2===e||1!==e&&"iso8601"!==n)?`[u-ca=${n}]`:""}function Tt(n){return n.map((([n,e,t])=>t||n?(n<BigInt(0)?-n:n)+e:"")).join("")}function Nt(n,e,t,o,r,i){let s=BigInt(t)+BigInt(e)*I+BigInt(n)*S;r&&(s=H(s,void 0===o?T[i]:Math.pow(10,9-o),r));const a=s<0?-s:s,c=a/b;let u=sn(Number(a-c*b),9);return u=void 0===o?u.replace(/0+$/,""):u.substr(0,o),[u?"."+u:"",Number(c)*(s<0?-1:1)]}function Yt(n){const e=function(n){const e=qn.exec(ie(n));if(e){let n,t,o,r;[n,r]=Et(e[8],e[10],5,void 0),[t,r]=Et(e[12],e[14],4,r),[o,r]=Et(e[16],e[18],3,r);let i=function(n){const e={};for(const t in n)void 0!==n[t]&&(e[t]=n[t]);return e}({years:re(e[2]),months:re(e[3]),weeks:re(e[4]),days:re(e[5]),hours:n,minutes:t,seconds:o});if(!Object.keys(i).length)throw new RangeError("Duration string must have at least one field");const s=vt(BigInt(r||0),2);return i.milliseconds=s.millisecond,i.microseconds=s.microsecond,i.nanoseconds=s.nanosecond,"-"===e[1]&&(i=Wt(i)),i}}(n);if(void 0===e)throw se("duration",n);return e}function Et(n,e,t,o){if(void 0!==n){if(void 0!==o)throw new RangeError("Partial units must be last unit");return[parseInt(n),void 0!==e?ee(e)*(T[t]/1e9):void 0]}if(void 0!==o){const n=Math.trunc(o/T[t]);return[n,o-n*T[t]]}return[void 0,void 0]}Nn(PlainTime,C),Re(PlainTime,(function(n,e){return{buildKey:()=>["",""],buildFormat:()=>new pe(n,{hour:"numeric",minute:"2-digit",second:"2-digit",...e,timeZone:"UTC",timeZoneName:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0}),buildEpochMilli:n=>Number(gt(n)/S)}}));var[Zt,Ct]=d(),Duration=class extends w{constructor(n=0,e=0,t=0,o=0,r=0,i=0,s=0,a=0,c=0,u=0){super(),Ct(this,function(n){const e={};let t=0;for(const o of P){const r=Number(n[o]||0),i=L(n[o]);if(i){if(t&&t!==i)throw new RangeError("All fields must be same sign");t=i}if(!Number.isInteger(r))throw new RangeError("Duration fields must be integers");e[o]=r}return e.sign=t,e}({years:n,months:e,weeks:t,days:o,hours:r,minutes:i,seconds:s,milliseconds:a,microseconds:c,nanoseconds:u}))}static from(n){return Ut("object"==typeof n?t(n,In):Yt(n))}static compare(n,e,t){return function(n,e,t){const o=g(Duration,n),r=g(Duration,e),i=Lt(o),s=Lt(r);if(void 0===t&&i&&s)return q(pt(i),pt(s));const a=zt(t),c=a.add(o),u=a.add(r);if(a instanceof ZonedDateTime)return ZonedDateTime.compare(c,u);return PlainDateTime.compare(c,u)}(n,e,o(t).relativeTo)}get years(){return Zt(this).years}get months(){return Zt(this).months}get weeks(){return Zt(this).weeks}get days(){return Zt(this).days}get hours(){return Zt(this).hours}get minutes(){return Zt(this).minutes}get seconds(){return Zt(this).seconds}get milliseconds(){return Zt(this).milliseconds}get microseconds(){return Zt(this).microseconds}get nanoseconds(){return Zt(this).nanoseconds}get sign(){return Zt(this).sign}get blank(){return!this.sign}with(n){return Ut({...Zt(this),...a(n,In)})}negated(){return Ut(Wt(Zt(this)))}abs(){return Ut(f(Zt(this),(n=>Math.abs(n))))}add(n,e){return Pt(this,g(Duration,n),o(e).relativeTo)}subtract(n,e){return Pt(this,g(Duration,n).negated(),o(e).relativeTo)}round(n){return function(n,e){if(!i(e))throw new TypeError("Must specify options");if(void 0===e.largestUnit&&void 0===e.smallestUnit)throw new RangeError("Must specify either largestUnit or smallestUnit");const t=xt(n),o=j(e,t,0,0,9,!1,!0),{largestUnit:r,smallestUnit:s}=o,a=Lt(n);if(void 0===e.relativeTo&&a&&Y(r)&&Y(s)){return qt(vt(rt(pt(a),o),r))}const c=At(e.relativeTo),u=kt(n,r,c);return tt(u,o,c,c.add(u))}(this,n)}total(n){return function(n,e,t){const o=Lt(n);if(void 0===t&&o&&Y(e))return Number(pt(o))/T[e];const r=At(t),i=kt(n,e,r,!0);return ae(i,e,r,r.add(i))[P[e]]}(this,k(o(n).unit,void 0,0,9),n.relativeTo)}toString(n){const e=bn(n,3);return function(n,e){const{smallestUnit:t,fractionalSecondDigits:o,roundingMode:r}=e,{sign:i}=n,s=BigInt(n.hours),a=BigInt(n.minutes);let c=BigInt(n.seconds),u="";if(t<=3){const e=Nt(n.milliseconds,n.microseconds,n.nanoseconds,o,r,t);u=e[0],c+=BigInt(e[1])}return(i<0?"-":"")+"P"+Tt([[BigInt(n.years),"Y"],[BigInt(n.months),"M"],[BigInt(n.weeks),"W"],[BigInt(n.days),"D"]])+(s||a||c||u||!i?"T"+Tt([[s,"H"],[a,"M"],[t<=3?c:BigInt(0),u+"S",u||!i]]):"")}(Zt(this),e)}toLocaleString(n,e){return this.toString()}};function Ut(n){return new Duration(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function Pt(n,e,t){const o=Lt(n),r=Lt(e),i=Math.max(xt(n),xt(e));if(void 0===t&&o&&r)return jt(pt(o)+pt(r),i);const s=zt(t),a=s.add(n).add(e);return Qe(s,a,i)}function Bt(n,e){return new Duration(n.years+e.years,n.months+e.months,n.weeks+e.weeks,n.days+e.days,n.hours+e.hours,n.minutes+e.minutes,n.seconds+e.seconds,n.milliseconds+e.milliseconds,n.microseconds+e.microseconds,n.nanoseconds+e.nanoseconds)}function Rt(n,e,t){return t instanceof PlainDate?function(n,e,t){const o=t.add(n);return t.calendar.dateUntil(t,o,{largestUnit:U[e]})}(n,Math.max(6,e),t):kt(n,e,t)}function kt(n,e,t,o){const r=!0!==o&&e>7&&n.weeks;r&&(n=n.with({weeks:0}));const i=t.add(n);let s=Qe(t,i,e);return r&&(s=Bt(s,new Duration(0,0,r))),s}function xt(n){return n.years?9:n.months?8:n.weeks?7:n.days?6:n.hours?5:n.minutes?4:n.seconds?3:n.milliseconds?2:n.microseconds?1:0}function jt(n,e){return qt(vt(n,e))}function qt(n){return new Duration(0,0,0,n.day,n.hour,n.minute,n.second,n.millisecond,n.microsecond,n.nanosecond)}function Lt(n){if(!n.years&&!n.months&&!n.weeks)return{day:n.days,...$t(n)}}function Ht(n){return new Duration(n.years,n.months,n.weeks,n.days)}function $t(n){return{hour:n.hours,minute:n.minutes,second:n.seconds,millisecond:n.milliseconds,microsecond:n.microseconds,nanosecond:n.nanoseconds}}function zt(n){if(void 0===n)throw new RangeError("Need relativeTo");if("object"==typeof n)return void 0!==n.timeZone?ZonedDateTime.from(n):PlainDateTime.from(n);{const e=$n(String(n));return void 0!==e.timeZone?Ae(fe(e),void 0,0):ko(he(e))}}function At(n){if(void 0===n)throw new RangeError("Must specify relativeTo");if(i(n))return n instanceof ZonedDateTime||n instanceof PlainDateTime?n:g(void 0!==n.timeZone?ZonedDateTime:PlainDateTime,n);if("symbol"==typeof n)throw new TypeError("Incorrect relativeTo type");const e=Jn(String(n));if(e)return void 0!==e.timeZone?Ae(fe(e),void 0,3):ko(he(e));throw new RangeError("Invalid value of relativeTo")}function Wt(n){return f(n,(n=>-n||0))}function Kt(n,e,t,o){n=Jt(n=Gt(n,e.years,t,o),e.months,t,o);let r=t.epochMilliseconds(n.year,n.month,n.day);const[,i]=function(n){const e=gt($t(n)),t=e/O;return[vt(e-t*O,5),new Duration(n.years,n.months,n.weeks,n.days+Number(t))]}(e);return r=nn(r,7*i.weeks+i.days),Q(r)}function Gt({year:n,month:t,day:o},r,i,s){n+=r;const a=e(t,1,i.monthsInYear(n),s);let c=t===a?o:1;return c=e(c,1,i.daysInMonth(n,a),s),{year:n,month:a,day:c}}function Jt({year:n,month:t,day:o},r,i,s){if(r){if(t+=r,r<0)for(;t<1;)t+=i.monthsInYear(--n);else{let e;for(;t>(e=i.monthsInYear(n));)t-=e,n++}o=e(o,1,i.daysInMonth(n,t),s)}return{year:n,month:t,day:o}}function Qt(n,e){return e?{...Q(nn(W(n),e)),calendar:n.calendar}:n}var PlainMonthDay=class extends M{constructor(n,e,t=Zo(),o){super({...to({isoYear:o??("iso8601"===t.id?1972:function(n,e){throw new n(e)}(Error,"Must specify referenceYear")),isoMonth:n,isoDay:e},c),calendar:t})}static from(n,e){if(u(e),n instanceof PlainMonthDay)return Xt(n.getISOFields());if("object"==typeof n){const o=Uo(n);let r=t(n,Vt);return void 0===r.year&&void 0===n.calendar&&(r={...r,year:1972}),o.monthDayFromFields(r,e)}const o=Wn(String(n));return void 0===o.calendar&&(o.isoYear=1972),Xt(he(o))}with(n,e){const t=function(n,e){const t={day:n.day??e.day};void 0!==n.monthCode?(t.monthCode=n.monthCode,void 0!==n.month&&(t.month=n.month)):void 0!==n.month?(t.month=n.month,t.year=n.year):t.monthCode=e.monthCode;return t}(a(n,Vt),this);return this.calendar.monthDayFromFields(t,e)}equals(n){return e=this,t=g(PlainMonthDay,n),e.calendar.id===t.calendar.id&&z(e.getISOFields())===z(t.getISOFields());var e,t}toString(n){const e=this.getISOFields(),t=e.calendar.id,o=gn(n);return("iso8601"===t?function(n){return sn(n.isoMonth,2)+"-"+sn(n.isoDay,2)}(e):St(e))+Ot(t,o)}toPlainDate(n,e){return this.calendar.dateFromFields({year:n.year,monthCode:this.monthCode,day:this.day},e)}};Nn(PlainMonthDay),Zn(PlainMonthDay,["monthCode","day"]),Re(PlainMonthDay,Ze({month:"numeric",day:"numeric"},{weekday:void 0,year:void 0,hour:void 0,minute:void 0,second:void 0},!0));var Vt={era:String,eraYear:Number,year:Number,month:Number,monthCode:String,day:Number};function Xt(n){return new PlainMonthDay(n.isoMonth,n.isoDay,n.calendar,n.isoYear)}function _t(n){return new PlainDate(n.isoYear,n.isoMonth,n.isoDay,n.calendar)}function no(n,e){return{...Le(n,e),day:n.day??e.day}}function eo(n,t,o,r,i){return[n=Number(n),t=e(t,1,r.monthsInYear(n),i),o=e(o,1,r.daysInMonth(n,t),i)]}function to(n,e){const[t,o,r]=eo(n.isoYear,n.isoMonth,n.isoDay,ln,e);return{isoYear:t,isoMonth:o,isoDay:r}}function oo(n,e){return q(z(n.getISOFields()),z(e.getISOFields()))||q(n.calendar.id,e.calendar.id)}function ro(n,e){return q(n.year,e.year)||function(n,e){return q(n.month,e.month)||q(n.day,e.day)}(n,e)}function io(n,e,t,o){return tt(Po(n,e).dateUntil(n,e,{largestUnit:U[t.largestUnit]}),t,n,e,o)}var PlainDate=class extends M{constructor(n,e,t,o=Zo()){const r=to({isoYear:n,isoMonth:e,isoDay:t},c),i=g(Calendar,o);!function(n,e){const t=z(n);Ne(t+(t<0n?86399999999999n:0n)),Fo(t,e)}(r,i.id),super({...r,calendar:i})}static from(n,e){if(u(e),n instanceof PlainDate)return _t(n.getISOFields());if("object"==typeof n){const o=t(n,wn);return Uo(n).dateFromFields(o,e)}return _t(he(zn(String(n))))}static compare(n,e){return oo(g(PlainDate,n),g(PlainDate,e))}with(n,e){const t=no(a(n,wn),this);return this.calendar.dateFromFields(t,e)}withCalendar(n){const e=this.getISOFields();return new PlainDate(e.isoYear,e.isoMonth,e.isoDay,n)}add(n,e){return this.calendar.dateAdd(this,n,e)}subtract(n,e){return this.calendar.dateAdd(this,g(Duration,n).negated(),e)}until(n,e){return io(this,g(PlainDate,n),j(e,6,6,6,9))}since(n,e){return io(this,g(PlainDate,n),j(e,6,6,6,9),!0)}equals(n){return 0===oo(this,g(PlainDate,n))}toString(n){const e=gn(n),t=this.getISOFields();return St(t)+Ot(t.calendar.id,e)}toZonedDateTime(n){return this.toPlainDateTime(n.plainTime).toZonedDateTime(n.timeZone)}toPlainDateTime(n){return ko({...this.getISOFields(),...lt(n).getISOFields()})}toPlainYearMonth(){return qe(this.getISOFields())}toPlainMonthDay(){return this.calendar.monthDayFromFields(this)}};function so(n){return n instanceof PlainDate||n instanceof PlainDateTime||n instanceof ZonedDateTime||n instanceof PlainYearMonth||n instanceof PlainMonthDay}function ao(n,e,t){let o;if(n instanceof PlainDate)o=n;else if(so(n)){if(t&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");o=_t(n.getISOFields())}else o=PlainDate.from(n);return Ro(o.calendar,e),o}function co(n,e,t){if(so(n))return n.getISOFields();let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:d}=n;const h=void 0!==r&&void 0!==o?dn(e.id,r,o):void 0;if(void 0===i){if(void 0===h)throw new TypeError("Must specify either a year or an era & eraYear");i=h}else if(void 0!==h&&h!==i)throw new RangeError("year and era/eraYear must match");if(void 0===d)throw new TypeError("Must specify day");const f=u(t);if(void 0!==a){const[n,t]=e.convertMonthCode(a,i);if(void 0!==s&&s!==n)throw new RangeError("Month doesnt match with monthCode");if(s=n,t){if(f===c)throw new RangeError("Month code out of range");d=e.daysInMonth(i,s)}}else if(void 0===s)throw new TypeError("Must specify either a month or monthCode");return[i,s,d]=eo(i,s,d,e,f),Q(e.epochMilliseconds(i,s,d))}function uo(n,e){if(so(n)){if(e&&n instanceof PlainMonthDay)throw new TypeError("PlainMonthDay not allowed");return n.getISOFields()}return PlainDate.from(n).getISOFields()}function ho(n,e){return _(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e+1,1,1))}function fo(n,e,t,o){return _(n.epochMilliseconds(e,1,1),n.epochMilliseconds(e,t,o))+1}Nn(PlainDate),Zn(PlainDate,En),Re(PlainDate,Ze({year:"numeric",month:"numeric",day:"numeric",weekday:void 0},{hour:void 0,minute:void 0,second:void 0}));var lo={hebrew:6,chinese:0,dangi:0},mo=class extends un{constructor(n){const e=go(n);if(t=n,o=e.resolvedOptions().calendar,hn(t)!==hn(o))throw new RangeError("Invalid calendar: "+n);var t,o;super(n),this.format=e,this.yearCorrection=this.computeFieldsDumb(0).year-1970,this.monthCacheByYear={}}epochMilliseconds(n,e,t){return nn(this.queryMonthCache(n)[0][e-1],t-1)}daysInMonth(n,e){const t=this.queryMonthCache(n)[0],o=t[e-1];e>=t.length&&(n++,e=0);return _(o,this.queryMonthCache(n)[0][e])}monthsInYear(n){return this.queryMonthCache(n)[0].length}monthCode(n,e){const t=this.queryLeapMonthByYear(e);return!t||n<t?super.monthCode(n,e):super.monthCode(n-1,e)+(n===t?"L":"")}convertMonthCode(n,e){const t=this.queryLeapMonthByYear(e);let o=/L$/.test(n),r=parseInt(n.substr(1)),i=!1;if(o){const n=lo[this.id];if(void 0===n)throw new RangeError("Calendar system doesnt support leap months");if(n){if(r!==n-1)throw new RangeError("Invalid leap-month month code")}else if(r<=1||r>=12)throw new RangeError("Invalid leap-month month code")}return!o||t&&r===t-1||(i=!0,o=!1),(o||t&&r>=t)&&r++,[r,i]}inLeapYear(n){const e=ho(this,n);return e>ho(this,n-1)&&e>ho(this,n+1)}guessYearForMonthDay(n,e){let t=1970+this.yearCorrection;const o=t+100;for(;t<o;t++){const[o,r]=this.convertMonthCode(n,t);if(!r&&o<=this.monthsInYear(t)&&e<=this.daysInMonth(t,o))return t}throw new Error("Could not guess year")}normalizeISOYearForMonthDay(n){return n}computeFields(n){const e=this.computeFieldsDumb(n),t=this.queryMonthCache(e.year)[2];return{...e,month:t[e.month]}}computeFieldsDumb(n){const e=ge(this.format,n);let t,o,r=parseInt(e.relatedYear||e.year);var i;return e.era&&(i=this.id,void 0!==cn[hn(i)])&&(t=we(e.era),o=r,r=dn(this.id,o,t,!0)),{era:t,eraYear:o,year:r,month:e.month,day:parseInt(e.day)}}queryLeapMonthByYear(n){const e=this.queryMonthCache(n),t=this.queryMonthCache(n-1),o=this.queryMonthCache(n+1);if(e[0].length>t[0].length&&e[0].length>o[0].length){const n=e[1],o=t[1];for(let e=0;e<o.length;e++)if(o[e]!==n[e])return e+1}}queryMonthCache(n){const{monthCacheByYear:e}=this;return e[n]||(e[n]=this.buildMonthCache(n))}buildMonthCache(n){const e=[],t=[],o={};let r=G(this.guessISOYear(n));for(r=nn(r,400);;){const o=this.computeFieldsDumb(r);if(o.year<n)break;r=nn(r,1-o.day),o.year===n&&(e.unshift(r),t.unshift(o.month)),r=nn(r,-1)}for(let n=0;n<t.length;n++)o[t[n]]=n+1;return[e,t,o]}guessISOYear(n){return n-this.yearCorrection}};function go(n){return new pe("en-US",{calendar:n,era:"short",year:"numeric",month:"short",day:"numeric",timeZone:"UTC"})}var yo=G(1868,9,8),wo={gregory:mn,japanese:class extends mn{constructor(){super(...arguments),this.format=go("japanese")}computeFields(n){const e=super.computeFields(n);if(n>=yo){const t=ge(this.format,n);e.era=we(t.era),e.eraYear=parseInt(t.relatedYear||t.year)}return e}},islamic:class extends mo{guessISOYear(n){return Math.ceil(32*n/33+622)}}},po={iso8601:ln};function vo(n){const e=(n=String(n)).toLocaleLowerCase();return po[e]||(po[e]=new(wo[hn(e)]||mo)(n))}var Mo=G(1582,10,15),Io=G(622,7,18),So={buddhist:Mo,japanese:Mo,roc:Mo,islamic:Io,"islamic-rgsa":Io,indian:0},bo={};function Fo(n,e){return Do(Number(n/S),e)}function Do(n,e){if(function(n,e){return function(n){let e=bo[n];if(void 0===e){const t=So[n];if(void 0===t)e=!1;else{let o=vo(n);o instanceof mo||(o=new mo(n));const r=t-864e5,i=o.computeFields(r);e=r!==o.epochMilliseconds(i.year,i.month,i.day)}bo[n]=e}return e}(e)&&n<So[e]}(n,e))throw new RangeError("Invalid timestamp for calendar")}function Oo(n,e,t,o){let r=0,i=0,s=0,a=0;switch(o){case 9:r=function(n,e,t){const[,o,r]=eo(e.year,n.month,n.day,t,0),i=ro(e,n),s=q(e.month,o)||q(e.day,r);return e.year-n.year-(s&&i&&s!==i?i:0)}(n,e,t),n=Gt(n,r,t,0);case 8:i=function(n,e,t){let o=0;const r=ro(e,n);if(r){let{year:i}=n;for(;i!==e.year;)o+=t.monthsInYear(i)*r,i+=r;const[,s,a]=eo(e.year,n.month,n.day,t,0);o+=e.month-s;const c=q(e.day,a);c&&r&&c!==r&&(o-=r)}return o}(n,e,t),n=Jt(n,i,t,0)}return a=_(t.epochMilliseconds(n.year,n.month,n.day),t.epochMilliseconds(e.year,e.month,e.day)),7===o&&(s=Math.trunc(a/7),a%=7),new Duration(r,i,s,a)}function To(n,e,t){const o=7+e-t;return-$(en(n,1,o)-e,7)+o-1}function No(n,e,t){const o=To(n,e,t),r=To(n+1,e,t);return(ho(ln,n)-o+r)/7}var[Yo,Eo]=d(),Calendar=class extends y{constructor(n){super(),"islamicc"===n&&(n="islamic-civil"),Eo(this,vo(n))}static from(n){if("object"==typeof n&&n)return function(n){return n.calendar}(n)?function(n){if("object"==typeof n&&n){if("string"==typeof n.id)return n;throw new RangeError("Invalid calendar")}return new Calendar(String(n))}(n.calendar):n;const e=Qn(String(n));return new Calendar(e?e.calendar||"iso8601":n)}get id(){return Yo(this).id}era(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).era}eraYear(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).eraYear}year(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).year}month(n){const e=uo(n,!0);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).month}monthCode(n){const e=ao(n,this);return Yo(this).monthCode(e.month,e.year)}day(n){const e=uo(n);return Co(Yo(this),e.isoYear,e.isoMonth,e.isoDay).day}dayOfWeek(n){const e=uo(n,!0);return en(e.isoYear,e.isoMonth,e.isoDay)}dayOfYear(n){const e=ao(n,this,!0);return fo(Yo(this),e.year,e.month,e.day)}weekOfYear(n){const e=uo(n,!0);return function(n,e,t,o,r){const i=To(n,o,r),s=Math.floor((fo(ln,n,e,t)-i-1)/7)+1;if(s<1)return s+No(n-1,o,r);const a=No(n,o,r);return s>a?s-a:s}(e.isoYear,e.isoMonth,e.isoDay,1,4)}daysInWeek(n){return uo(n,!0),7}daysInMonth(n){const e=ao(n,this,!0);return Yo(this).daysInMonth(e.year,e.month)}daysInYear(n){const e=ao(n,this,!0);return ho(Yo(this),e.year)}monthsInYear(n){const e=ao(n,this,!0);return Yo(this).monthsInYear(e.year)}inLeapYear(n){return Yo(this).inLeapYear(this.year(n))}dateFromFields(n,e){const t=co(n,Yo(this),e);return new PlainDate(t.isoYear,t.isoMonth,t.isoDay,this)}yearMonthFromFields(n,e){const t=co({...n,day:1},Yo(this),e);return new PlainYearMonth(t.isoYear,t.isoMonth,this,t.isoDay)}monthDayFromFields(n,e){const t=Yo(this);let{era:o,eraYear:r,year:i,month:s,monthCode:a,day:c}=n;if(void 0===c)throw new TypeError("required property 'day' missing or undefined");if(void 0!==a?i=1972:void 0!==o&&void 0!==r&&(i=dn(t.id,r,o)),void 0===i){if(void 0===a)throw new TypeError("either year or monthCode required with month");i=t.guessYearForMonthDay(a,c)}const u=co({year:i,month:s,monthCode:a,day:c},t,e);return new PlainMonthDay(u.isoMonth,u.isoDay,this,t.normalizeISOYearForMonthDay(u.isoYear))}dateAdd(n,e,t){const o=Yo(this),r=Kt(g(PlainDate,n,t),g(Duration,e),o,u(t));return new PlainDate(r.isoYear,r.isoMonth,r.isoDay,this)}dateUntil(n,e,t){const r=Yo(this),i=g(PlainDate,n),s=g(PlainDate,e),a=k(o(t).largestUnit,6,6,9);return Ro(Po(i,s),this),Oo(i,s,r,a)}toString(){return this.id}};function Zo(){return new Calendar("iso8601")}function Co(n,e,t,o){const r=G(e,t,o);return Do(r,n.id),n.computeFields(r)}function Uo(n){return void 0===n.calendar?Zo():g(Calendar,n.calendar)}function Po(n,e){const{calendar:t}=n;return Ro(t,e.calendar),t}function Bo(n,e){const t=n.calendar,o=e.calendar;if("iso8601"===t.id)return o;if("iso8601"===o.id)return t;if(t.id!==o.id)throw new RangeError("Non-ISO calendars incompatible");return t}function Ro(n,e){if(n.id!==e.id)throw new RangeError("Calendars must match")}var PlainDateTime=class extends M{constructor(n,e,t,o=0,r=0,i=0,s=0,a=0,u=0,d=Zo()){const h=qo({isoYear:n,isoMonth:e,isoDay:t,isoHour:o,isoMinute:r,isoSecond:i,isoMillisecond:s,isoMicrosecond:a,isoNanosecond:u},c),f=g(Calendar,d);Te(h,f.id),super({...h,calendar:f})}static from(n,e){const o=u(e);return ko(n instanceof PlainDateTime?n.getISOFields():"object"==typeof n?xo(t(n,vn),e,o,Uo(n)):he(zn(String(n))))}static compare(n,e){return Lo(g(PlainDateTime,n),g(PlainDateTime,e))}with(n,e){return ko(xo(jo(a(n,vn),this),e,u(e),this.calendar))}withPlainDate(n){const e=g(PlainDate,n);return ko({...this.getISOFields(),...e.getISOFields(),calendar:Bo(this,e)})}withPlainTime(n){return ko({...this.getISOFields(),...lt(n).getISOFields()})}withCalendar(n){return ko({...this.getISOFields(),calendar:g(Calendar,n)})}add(n,e){return Ho(this,g(Duration,n),e)}subtract(n,e){return Ho(this,g(Duration,n).negated(),e)}until(n,e){return $o(this,g(PlainDateTime,n),e)}since(n,e){return $o(this,g(PlainDateTime,n),e,!0)}round(n){return function(n,e){const t=x(e,void 0,0,6);return zo(n,it(t),t.roundingMode)}(this,n)}equals(n){return 0===Lo(this,g(PlainDateTime,n))}toString(n){const e=bn(n),t=gn(n),o=zo(this,e.roundingIncrement,e.roundingMode).getISOFields();return It(o,e)+Ot(o.calendar.id,t)}toZonedDateTime(n,e){const t=g(TimeZone,n),o=t.getInstantFor(this,e);return new ZonedDateTime(o.epochNanoseconds,t,this.calendar)}toPlainYearMonth(){return qe(this.getISOFields())}toPlainMonthDay(){return this.calendar.monthDayFromFields(this)}toPlainDate(){return _t(this.getISOFields())}toPlainTime(){return at(this.getISOFields())}};function ko(n){return new PlainDateTime(n.isoYear,n.isoMonth,n.isoDay,n.isoHour,n.isoMinute,n.isoSecond,n.isoMillisecond,n.isoMicrosecond,n.isoNanosecond,n.calendar)}function xo(n,e,t,o){return{...o.dateFromFields(n,e).getISOFields(),...ft(n,t)}}function jo(n,e){return{...no(n,e),...ut(n,e)}}function qo(n,e){return{...to(n,e),...ct(n,e)}}function Lo(n,e){return q(z(n.getISOFields()),z(e.getISOFields()))||q(n.calendar.id,e.calendar.id)}function Ho(n,e,t){const{calendar:o}=n,r=Ht(e),i=$t(e);return ko({...J(z(o.dateAdd(_t(n.getISOFields()),r,t).getISOFields())+gt(n)+gt(i)),calendar:o})}function $o(n,e,t,o){const r=j(t,6,0,0,9);return tt(Qe(n,e,r.largestUnit),r,n,e,o)}function zo(n,e,t){const o=ot(n,e,t);return ko(st(n.getISOFields(),o))}function Ao(n,e){return q(n.epochNanoseconds,e.epochNanoseconds)}function Wo(n,e){if(xt(e)>=6)throw new RangeError("Duration cant have units larger than days");return new Instant(n.epochNanoseconds+gt($t(e)))}function Ko(n,e,t){const o=j(t,3,0,0,5,!0);return jt(rt(e.epochNanoseconds-n.epochNanoseconds,o),o.largestUnit)}Nn(PlainDateTime,C),Zn(PlainDateTime,En),Re(PlainDateTime,Ze({year:"numeric",month:"numeric",day:"numeric",weekday:void 0,hour:"numeric",minute:"2-digit",second:"2-digit"},{}));var[Go,Jo]=d(),Instant=class extends w{constructor(n){var e;super(),n=BigInt(n),((e=n)<-8640000000000000000000n||e>8640000000000000000000n)&&rn(),Jo(this,n)}static from(n){if(n instanceof Instant)return new Instant(n.epochNanoseconds);const e=$n(String(n)),t=e.offset;if(void 0===t)throw new RangeError("Must specify an offset");return new Instant(z(qo(e,c))-BigInt(t))}static fromEpochSeconds(n){return new Instant(BigInt(n)*b)}static fromEpochMilliseconds(n){return new Instant(BigInt(n)*S)}static fromEpochMicroseconds(n){return new Instant(n*I)}static fromEpochNanoseconds(n){return new Instant(n)}static compare(n,e){return Ao(g(Instant,n),g(Instant,e))}get epochNanoseconds(){return Go(this)}add(n){return Wo(this,g(Duration,n))}subtract(n){return Wo(this,g(Duration,n).negated())}until(n,e){return Ko(this,g(Instant,n),e)}since(n,e){return Ko(g(Instant,n),this,e)}round(n){return function(n,e){const t=x(e,void 0,0,5,!1,!0),[o,r]=Mt(n.epochNanoseconds);return new Instant(o+rt(r,t))}(this,n)}equals(n){return 0===Ao(this,g(Instant,n))}toString(n){const e=o(n).timeZone;return this.toZonedDateTimeISO(e??"UTC").toString({...n,offset:void 0===e?"never":"auto",timeZoneName:"never"})+(void 0===e?"Z":"")}toZonedDateTimeISO(n){return new ZonedDateTime(this.epochNanoseconds,n)}toZonedDateTime(n){if(!i(n))throw new TypeError("Must specify options");if(void 0===n.calendar)throw new TypeError("Must specify a calendar");if(void 0===n.timeZone)throw new TypeError("Must specify a timeZone");return new ZonedDateTime(this.epochNanoseconds,n.timeZone,n.calendar)}};function Qo(n){return Instant.fromEpochMilliseconds(n.valueOf())}Dn(Instant),Re(Instant,Ye({year:"numeric",month:"numeric",day:"numeric",weekday:void 0,hour:"numeric",minute:"2-digit",second:"2-digit"},{timeZoneName:void 0},{}));var Vo=Symbol(),Xo=Symbol(),_o=Symbol(),nr=class extends pe{constructor(n,e){const t=ve(n),o=function(n){const e={};for(const t in n){let o=n[t];i(o)&&(o=o.toString()),e[t]=o}return e}(e||{});super(t,o),this[Vo]=t,this[Xo]=o,this[_o]=new Map}format(n){const e=er(this,n);return e[0]===this?super.format(n):e[0].format(e[1])}formatToParts(n){return super.formatToParts.call(...er(this,n))}formatRange(n,e){return super.formatRange.call(...tr(this,n,e))}formatRangeToParts(n,e){return super.formatRangeToParts.call(...tr(this,n,e))}};function er(n,e){const t=ke(e);if(t){const o=or(n,t);return[o.buildFormat(e),o.buildEpochMilli(e)]}return[n,e]}function tr(n,e,t){const o=ke(e);if(o!==ke(t))throw new TypeError("Mismatch of types");if(o){const r=or(n,o);return[r.buildFormat(e,t),r.buildEpochMilli(e),r.buildEpochMilli(t)]}return[n,e,t]}function or(n,e){const t=n[_o];let o=t.get(e);return o||(o=function(n){const e={};return{buildFormat:function(t,o){const r=n.buildKey(t,o),i=r.join("|");return e[i]||(e[i]=n.buildFormat(...r))},buildEpochMilli:n.buildEpochMilli}}(e(n[Vo],n[Xo])),t.set(e,o)),o}function rr(n=ur()){return cr().toZonedDateTimeISO(n)}function ir(n,e){if(void 0===n)throw new RangeError("Must specify calendar");return cr().toZonedDateTime({calendar:n,timeZone:e??ur()})}function sr(n=ur()){return rr(n).toPlainDateTime()}function ar(n,e){return ir(n,e).toPlainDateTime()}function cr(){return new Instant(BigInt(Date.now())*S)}function ur(){return new TimeZone((new pe).resolvedOptions().timeZone)}var dr={zonedDateTimeISO:rr,zonedDateTime:ir,plainDateTimeISO:sr,plainDateTime:ar,plainDateISO:function(n=ur()){return sr(n).toPlainDate()},plainDate:function(n,e){return ar(n,e).toPlainDate()},plainTimeISO:function(n=ur()){return cr().toZonedDateTimeISO(n).toPlainTime()},instant:cr,timeZone:ur};export{Calendar,Duration,nr as ExtendedDateTimeFormat,Instant,dr as Now,PlainDate,PlainDateTime,PlainMonthDay,PlainTime,PlainYearMonth,TimeZone,ZonedDateTime,Qo as dateToTemporalInstant};
//# sourceMappingURL=impl.js.map

@@ -1,2 +0,2 @@

import{Calendar,Duration,Instant,Now as a,OrigDateTimeFormat as t,PlainDate,PlainDateTime,PlainMonthDay,PlainTime,PlainYearMonth,TimeZone,ZonedDateTime,dateToTemporalInstant as r,normalizeIntlDateArg as e,normalizeIntlOptionalDateArg as o}from"./impl.js";function n(){if(!globalThis.Temporal){globalThis.Temporal={PlainYearMonth:PlainYearMonth,PlainMonthDay:PlainMonthDay,PlainDate:PlainDate,PlainTime:PlainTime,PlainDateTime:PlainDateTime,ZonedDateTime:ZonedDateTime,Instant:Instant,Calendar:Calendar,TimeZone:TimeZone,Duration:Duration,Now:a},globalThis.Date.prototype.toTemporalInstant=function(){return r(this)};class n extends t{format(a){return super.format(o(a))}formatToParts(a){return super.formatToParts(o(a))}formatRange(a,t){return super.formatRange(e(a),e(t))}formatRangeToParts(a,t){return super.formatRangeToParts(e(a),e(t))}}globalThis.Intl.DateTimeFormat=n}}export{n as shimTemporal};
import{Calendar,Duration,ExtendedDateTimeFormat as a,Instant,Now as t,PlainDate,PlainDateTime,PlainMonthDay,PlainTime,PlainYearMonth,TimeZone,ZonedDateTime,dateToTemporalInstant as o}from"./impl.js";function n(){globalThis.Temporal||(globalThis.Temporal={PlainYearMonth:PlainYearMonth,PlainMonthDay:PlainMonthDay,PlainDate:PlainDate,PlainTime:PlainTime,PlainDateTime:PlainDateTime,ZonedDateTime:ZonedDateTime,Instant:Instant,Calendar:Calendar,TimeZone:TimeZone,Duration:Duration,Now:t},globalThis.Date.prototype.toTemporalInstant=function(){return o(this)},globalThis.Intl.DateTimeFormat=a)}export{n as shimTemporal};
//# sourceMappingURL=shim.js.map
{
"name": "temporal-polyfill",
"version": "0.0.4",
"version": "0.0.5",
"title": "Temporal Polyfill",
"description": "A spec-compliant Temporal JavaScript polyfill in less than 15kb",
"description": "A spec-compliant Temporal JavaScript polyfill in 15kb",
"author": {

@@ -48,2 +48,3 @@ "name": "Adam Shaw",

"/src",
"!/src/specs",
"/dist",

@@ -50,0 +51,0 @@ "/*.d.ts"

# temporal-polyfill
A spec-compliant<super>*</super> [Temporal] JavaScript polyfill in less than 15kb<super>**</super>.
A spec-compliant<super>*</super> [Temporal] JavaScript polyfill in 15kb<super>**</super>.

@@ -10,5 +10,5 @@ Works in modern browsers<super>***</super>, not Internet Explorer.

[CDN link](https://cdn.jsdelivr.net/npm/temporal-polyfill@0.0.3/dist/global.js)
[CDN link](https://cdn.jsdelivr.net/npm/temporal-polyfill@0.0.5/dist/global.js)
<!-- NOTE: when updating this link, update the codepen too -->
## Installation

@@ -15,0 +15,0 @@

@@ -9,3 +9,3 @@ import { computeDaysInYear } from '../dateUtils/calendar'

} from '../dateUtils/isoMath'
import { OrigDateTimeFormat } from '../native/intl'
import { OrigDateTimeFormat } from '../native/intlUtils'
import {

@@ -12,0 +12,0 @@ CalendarImpl,

import { createWeakMap } from '../utils/obj'
// weird to have this here
// to prevent circular reference
export const formatFactoryFactorySymbol = Symbol()
// Functions

@@ -4,0 +8,0 @@

@@ -28,7 +28,9 @@ import { parseDiffOptions } from '../argParse/diffOptions'

import {
parseDateTimeISO,
refineDateTimeParse,
refineZonedDateTimeParse,
tryParseDateTimeISO,
parseZonedDateTime,
tryParseZonedDateTime,
} from './parse'
import {
refineBaseObj,
refineZonedObj,
} from './parseRefine'
import { roundBalancedDuration, roundNano } from './rounding'

@@ -406,6 +408,6 @@ import { TimeFields, timeFieldsToNano } from './time'

} else {
const isoFields = parseDateTimeISO(String(arg))
const isoFields = parseZonedDateTime(String(arg))
if (isoFields.timeZone !== undefined) {
return createZonedDateTime(
refineZonedDateTimeParse(isoFields),
refineZonedObj(isoFields),
undefined,

@@ -415,3 +417,3 @@ OFFSET_PREFER,

} else {
return createDateTime(refineDateTimeParse(isoFields))
return createDateTime(refineBaseObj(isoFields))
}

@@ -449,8 +451,8 @@ }

const parsed = tryParseDateTimeISO(String(arg))
const parsed = tryParseZonedDateTime(String(arg))
if (parsed) {
if (parsed.timeZone !== undefined) {
return createZonedDateTime(refineZonedDateTimeParse(parsed), undefined, OFFSET_REJECT)
return createZonedDateTime(refineZonedObj(parsed), undefined, OFFSET_REJECT)
} else {
return createDateTime(refineDateTimeParse(parsed))
return createDateTime(refineBaseObj(parsed))
}

@@ -457,0 +459,0 @@ }

@@ -1,18 +0,16 @@

import { Calendar, createDefaultCalendar } from '../public/calendar'
import { TimeZone } from '../public/timeZone'
import { DateISOFields, DateTimeISOFields } from '../public/types'
import { excludeUndefined } from '../utils/obj'
import { DateISOEssentials } from './date'
import { DateTimeISOEssentials } from './dateTime'
import { nanoToDayTimeFields } from './dayTime'
import { DurationFields, negateFields } from './duration'
import { isoEpochLeapYear } from './isoMath'
import {
dateTimeRegExp,
monthDayRegExp,
offsetRegExp,
timeRegExp,
unicodeDashRegExp,
yearMonthRegExp,
} from './parseRegExp'
import { TimeISOEssentials, timeLikeToISO } from './time'
import {
HOUR,
MILLISECOND,
MINUTE,
SECOND,
TimeUnitInt,
nanoIn,
nanoInHour,

@@ -22,6 +20,12 @@ nanoInMinute,

} from './units'
import { ZonedDateTimeISOEssentials } from './zonedDateTime'
export type DateTimeParseResult = DateTimeISOEssentials & {
export interface DateParseResults extends DateISOEssentials {
calendar: string | undefined
}
export interface DateTimeParseResult extends DateTimeISOEssentials {
calendar: string | undefined
}
export interface ZonedDateTimeParseResult extends DateTimeParseResult {
timeZone: string | undefined

@@ -32,102 +36,86 @@ offset: number | undefined

const dateRegExpStr = '([+-]\\d{6}|\\d{4})-?(\\d{2})?-?(\\d{2})?'
const monthDayRegExpStr = '(--)?(\\d{2})-?(\\d{2})?'
const timeRegExpStr = '(\\d{2})?:?(\\d{2})?:?(\\d{2})?([.,](\\d{1,9}))?' // all parts optional
const offsetRegExpStr = `([+-])${timeRegExpStr}` // hour onwards is optional
const endingRegExpStr =
`(Z|${offsetRegExpStr})?` +
'(\\[([^=\\]]+)\\])?(\\[u-ca=([^\\]]+)\\])?'
const offsetRegExp = createRegExp(offsetRegExpStr)
const timeRegExp = createRegExp(
timeRegExpStr +
endingRegExpStr, // values are ignored
)
const dateTimeRegExp = createRegExp(
dateRegExpStr +
`([T ]${timeRegExpStr})?` +
endingRegExpStr,
)
const monthDayRegExp = createRegExp(
monthDayRegExpStr +
endingRegExpStr,
)
const durationRegExp = /^([-+])?P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T((\d+)([.,](\d{1,9}))?H)?((\d+)([.,](\d{1,9}))?M)?((\d+)([.,](\d{1,9}))?S)?)?$/i
const zuluRegExp = /Z/i
const unicodeDashRegExp = /\u2212/g
// hard functions (throw error on failure)
// refines DateTimeParseResult for high-level objects. TODO: rename/relocate?
export function refineDateTimeParse(parsed: DateTimeParseResult): DateTimeISOFields {
return {
...parsed,
calendar: parsed.calendar === undefined
? createDefaultCalendar()
: new Calendar(parsed.calendar),
export function parseZonedDateTime(str: string): ZonedDateTimeParseResult {
const res = tryParseZonedDateTime(str)
if (!res) {
throw createParseError('dateTime', str)
}
return res
}
export function refineZonedDateTimeParse(parsed: DateTimeParseResult): ZonedDateTimeISOEssentials {
return {
...refineDateTimeParse(parsed),
timeZone: new TimeZone(parsed.timeZone!), // will throw error if empty timeZone
export function parseDateTime(str: string): DateTimeParseResult {
const res = tryParseDateTime(str)
if (!res) {
throw createParseError('dateTime', str)
}
return res
}
// hard functions (throw error on failure)
export function parseMonthDayISO(str: string): DateTimeParseResult {
return tryParseMonthDayISO(str) ||
tryParseDateTimeISO(str) || // fallback to parsing a datetime
throwNoParse('monthDay', str)
export function parseYearMonth(str: string): DateParseResults {
const res = tryParseYearMonth(str) || tryParseDateTime(str)
if (!res) {
throw createParseError('yearMonth', str)
}
return res
}
export function parseDateTimeISO(str: string): DateTimeParseResult {
return tryParseDateTimeISO(str) || throwNoParse('dateTime', str)
export function parseMonthDay(str: string): DateParseResults {
const res = tryParseMonthDay(str) || tryParseDateTime(str)
if (!res) {
throw createParseError('monthDay', str)
}
return res
}
export function parseOffsetNano(str: string): number {
return tryParseOffsetNano(str) ?? throwNoParse('timeZone', str)
const res = tryParseOffsetNano(str)
if (res === undefined) {
throw createParseError('timeZone', str) // timeZone?
}
return res
}
export function parseTimeISO(str: string): TimeISOEssentials {
return tryParseTimeISO(str) ||
tryParseDateTimeISO(str) || // fallback to parsing a datetime
throwNoParse('time', str)
export function parseTime(str: string): TimeISOEssentials {
const res = tryParseTime(str) || tryParseDateTime(str)
if (res === undefined) {
throw createParseError('time', str)
}
return res
}
export function parseDurationISO(str: string): DurationFields {
return tryParseDurationISO(str) || throwNoParse('duration', str)
// soft functions (return undefined on failure)
export function tryParseZonedDateTime(str: string): ZonedDateTimeParseResult | undefined {
const m = dateTimeRegExp.exec(normalizeDashes(str))
if (m) {
return parseZonedDateTimeParts(m.slice(1))
}
}
// soft functions (return undefined on failure)
export function tryParseDateTime(str: string): DateTimeParseResult | undefined {
const m = dateTimeRegExp.exec(normalizeDashes(str))
if (m) {
return parseDateTimeParts(m.slice(1))
}
}
export function tryParseDateTimeISO(str: string): DateTimeParseResult | undefined {
const match = dateTimeRegExp.exec(normalizeDashes(str))
if (match) {
const Z = zuluRegExp.test(match[10])
return {
...parseDateParts(match.slice(1)),
...parseTimeParts(match.slice(5)),
Z,
offset: Z ? 0 : parseOffsetParts(match.slice(11)),
timeZone: match[18], // a string. don't parse yet, might be unnecessary
calendar: match[20], // a string. don't parse yet, might be unnecessary
}
function tryParseYearMonth(str: string): DateParseResults | undefined {
const m = yearMonthRegExp.exec(normalizeDashes(str))
if (m) {
return parseYearMonthParts(m.slice(1))
}
}
function tryParseMonthDayISO(str: string): DateISOFields | undefined {
const match = monthDayRegExp.exec(normalizeDashes(str))
if (match) {
return {
...parseMonthDayParts(match),
calendar: match[6] ? new Calendar(match[6]) : createDefaultCalendar(),
}
function tryParseMonthDay(str: string): DateParseResults | undefined {
const m = monthDayRegExp.exec(normalizeDashes(str))
if (m) {
return parseMonthDayParts(m.slice(1))
}
}
function tryParseTimeISO(str: string): TimeISOEssentials | undefined {
const match = timeRegExp.exec(str)
if (match && match[1]) { // has hour at least
return parseTimeParts(match.slice(1))
function tryParseTime(str: string) {
const m = timeRegExp.exec(normalizeDashes(str))
if (m) {
return parseTimeParts(m.slice(1))
}

@@ -137,86 +125,55 @@ }

export function tryParseOffsetNano(str: string): number | undefined {
const match = offsetRegExp.exec(normalizeDashes(str))
if (match) {
return parseOffsetParts(match.slice(1))
const m = offsetRegExp.exec(normalizeDashes(str))
if (m) {
return parseOffsetParts(m.slice(1))
}
}
function tryParseDurationISO(str: string): Partial<DurationFields> | undefined {
const match = durationRegExp.exec(normalizeDashes(str))
if (match) {
let hours: number | undefined
let minutes: number | undefined
let seconds: number | undefined
let leftoverNano: number | undefined
// parsing of string parts
// TODO: don't need toInt1/toInt0 as much because parts are more guaranteed now
// TODO: combine the zoned/unzoned cases. will simplify caller functions?
([hours, leftoverNano] = parseDurationTimeUnit(match[8], match[10], HOUR, undefined));
([minutes, leftoverNano] = parseDurationTimeUnit(match[12], match[14], MINUTE, leftoverNano));
([seconds, leftoverNano] = parseDurationTimeUnit(match[16], match[18], SECOND, leftoverNano))
function parseZonedDateTimeParts(parts: string[]): ZonedDateTimeParseResult {
const zOrOffset = parts[11]
let offset: number | undefined
let Z = false
let fields: Partial<DurationFields> = excludeUndefined({
years: toIntMaybe(match[2]),
months: toIntMaybe(match[3]),
weeks: toIntMaybe(match[4]),
days: toIntMaybe(match[5]),
hours,
minutes,
seconds,
})
if (zOrOffset) {
Z = zOrOffset.toUpperCase() === 'Z'
offset = Z ? 0 : parseOffsetParts(parts.slice(12))
}
if (!Object.keys(fields).length) {
throw new RangeError('Duration string must have at least one field')
}
const small = nanoToDayTimeFields(BigInt(leftoverNano || 0), MILLISECOND)
fields.milliseconds = small.millisecond
fields.microseconds = small.microsecond
fields.nanoseconds = small.nanosecond
if (match[1] === '-') {
fields = negateFields(fields)
}
return fields
return {
...parseDateTimeParts(parts),
timeZone: parts[21],
offset,
Z,
}
}
function parseDurationTimeUnit(
beforeDecimal: string | undefined,
afterDecimal: string | undefined,
unit: TimeUnitInt,
leftoverNano: number | undefined,
): [number | undefined, number | undefined] { // [wholeUnits, leftoverNano]
if (beforeDecimal !== undefined) {
if (leftoverNano !== undefined) {
throw new RangeError('Partial units must be last unit')
}
return [
parseInt(beforeDecimal),
afterDecimal !== undefined
? parseNanoAfterDecimal(afterDecimal) * (nanoIn[unit] / nanoInSecond) // mult by # of secs
: undefined,
]
} else if (leftoverNano !== undefined) {
const wholeUnits = Math.trunc(leftoverNano / nanoIn[unit])
return [wholeUnits, leftoverNano - (wholeUnits * nanoIn[unit])]
} else {
return [undefined, undefined]
function parseDateTimeParts(parts: string[]): DateTimeParseResult {
return {
calendar: parts[23],
isoYear: toInt1(parts[0]),
isoMonth: toInt1(parts[1]),
isoDay: toInt1(parts[2]),
...parseTimeParts(parts.slice(4)),
}
}
// parsing of string parts
function parseDateParts(parts: string[]): DateISOEssentials {
function parseYearMonthParts(parts: string[]): DateParseResults {
return {
isoYear: toInt1(parts[0]), // TODO: default to epoch year?
calendar: parts[14],
isoYear: toInt1(parts[0]),
isoMonth: toInt1(parts[1]),
isoDay: toInt1(parts[2]),
isoDay: 1,
}
}
function parseMonthDayParts(parts: string[]): DateISOEssentials {
function parseMonthDayParts(parts: string[]): DateParseResults {
return {
calendar: parts[15],
isoYear: isoEpochLeapYear,
isoMonth: toInt1(parts[2]),
isoDay: toInt1(parts[3]),
isoMonth: toInt1(parts[1]),
isoDay: toInt1(parts[2]),
}

@@ -226,7 +183,7 @@ }

function parseTimeParts(parts: string[]): TimeISOEssentials {
const isoSecond = toInt0(parts[2])
const isoSecond = toInt0(parts[4])
return {
...timeLikeToISO( // properties like isoMillisecond/isoMicrosecond
nanoToDayTimeFields( // properties like millisecond/microsecond
BigInt(parseNanoAfterDecimal(parts[4] || '')),
BigInt(parseNanoAfterDecimal(parts[6] || '')),
MILLISECOND,

@@ -236,3 +193,3 @@ ),

isoHour: toInt0(parts[0]),
isoMinute: toInt0(parts[1]),
isoMinute: toInt0(parts[2]),
isoSecond: isoSecond === 60 ? 59 : isoSecond, // massage lead-second

@@ -242,23 +199,16 @@ }

function parseOffsetParts(parts: string[]): number | undefined {
const sign = parts[0]
if (
sign !== undefined &&
parts[1] // has hour at least
) {
return (sign === '+' ? 1 : -1) * timePartsToNano(parts.slice(1))
}
function parseOffsetParts(parts: string[]): number {
return (parts[0] === '+' ? 1 : -1) * timePartsToNano(parts.slice(1))
}
// time-field utils
// time parsing as nanoseconds
function timePartsToNano(parts: string[]): number {
return toInt0(parts[0]) * nanoInHour +
toInt0(parts[1]) * nanoInMinute +
toInt0(parts[2]) * nanoInSecond +
parseNanoAfterDecimal(parts[4] || '') // nanoseconds
toInt0(parts[2]) * nanoInMinute +
toInt0(parts[4]) * nanoInSecond +
parseNanoAfterDecimal(parts[6] || '')
}
// assumes 9 digits
function parseNanoAfterDecimal(str: string): number {
export function parseNanoAfterDecimal(str: string): number {
return parseInt(str.padEnd(9, '0'))

@@ -277,16 +227,12 @@ }

function toIntMaybe(input: string | undefined): number | undefined {
export function toIntMaybe(input: string | undefined): number | undefined {
return input === undefined ? undefined : parseInt(input)
}
function normalizeDashes(str: string): string {
export function normalizeDashes(str: string): string {
return str.replace(unicodeDashRegExp, '-')
}
function createRegExp(meat: string): RegExp {
return new RegExp(`^${meat}$`, 'i')
}
function throwNoParse(type: string, str: string): any {
export function createParseError(type: string, str: string): any {
throw new RangeError(`Cannot parse ${type} '${str}'`)
}

@@ -74,6 +74,16 @@ import { getCommonCalendar } from '../argParse/calendar'

): ZonedDateTime {
const { calendar, timeZone, offset, Z } = isoFields
const { calendar, timeZone } = isoFields
const epochNano = computeEpochNanoViaOffset(isoFields, offsetHandling) ??
timeZone.getInstantFor(createDateTime(isoFields), options).epochNanoseconds
return new ZonedDateTime(epochNano, timeZone, calendar)
}
export function computeEpochNanoViaOffset(
isoFields: ZonedDateTimeISOEssentials,
offsetHandling: OffsetHandlingInt,
): bigint | undefined {
const { timeZone, offset, Z } = isoFields
let epochNano: bigint | undefined
// try using the given offset and see what happens...
if (offset !== undefined && offsetHandling !== OFFSET_IGNORE) {

@@ -95,8 +105,3 @@ epochNano = isoFieldsToEpochNano(isoFields) - BigInt(offset)

// calculate from timeZone if necessary
if (epochNano === undefined) {
epochNano = timeZone.getInstantFor(createDateTime(isoFields), options).epochNanoseconds
}
return new ZonedDateTime(epochNano, timeZone, calendar)
return epochNano
}

@@ -103,0 +108,0 @@

@@ -10,3 +10,4 @@ /*

export * from './native/date'
export * from './native/intl' // TODO: don't export everything
export type { DateTimeFormatArg, DateTimeFormatRangePart } from './native/intlUtils'
export { ExtendedDateTimeFormat } from './native/intlExtend'

@@ -13,0 +14,0 @@ export { PlainYearMonth } from './public/plainYearMonth'

@@ -24,5 +24,5 @@ import {

import { diffDateFields } from '../dateUtils/diff'
import { computeISODayOfWeek, isoToEpochMilli } from '../dateUtils/isoMath'
import { computeISODayOfWeek, isoEpochLeapYear, isoToEpochMilli } from '../dateUtils/isoMath'
import { MonthDayFields } from '../dateUtils/monthDay'
import { tryParseDateTimeISO } from '../dateUtils/parse'
import { tryParseDateTime } from '../dateUtils/parse'
import { DAY, DateUnitInt, YEAR } from '../dateUtils/units'

@@ -70,3 +70,3 @@ import { computeWeekOfISOYear } from '../dateUtils/week'

}
const parsed = tryParseDateTimeISO(String(arg))
const parsed = tryParseDateTime(String(arg))
return new Calendar(

@@ -206,3 +206,3 @@ parsed // a date-time string?

const impl = getImpl(this)
let { era, eraYear, year, monthCode, day } = fields as Partial<MonthDayFields>
let { era, eraYear, year, month, monthCode, day } = fields as Partial<MonthDayFields>

@@ -213,10 +213,11 @@ if (day === undefined) {

if (era !== undefined && eraYear !== undefined) {
if (monthCode !== undefined) {
year = isoEpochLeapYear
} else if (era !== undefined && eraYear !== undefined) {
year = convertEraYear(impl.id, eraYear, era)
}
let yearGuaranteed = year
if (yearGuaranteed === undefined) {
if (year === undefined) {
if (monthCode !== undefined) {
yearGuaranteed = impl.guessYearForMonthDay(monthCode, day)
year = impl.guessYearForMonthDay(monthCode, day)
} else {

@@ -228,3 +229,3 @@ throw new TypeError('either year or monthCode required with month')

const isoFields = queryDateISOFields(
{ ...fields, year: yearGuaranteed! }, // a populated year causes era/eraYear to be ignored
{ year, month: month!, monthCode: monthCode!, day }, // HACKs!
impl,

@@ -231,0 +232,0 @@ options,

@@ -16,3 +16,3 @@ import { durationFieldMap } from '../argParse/fieldStr'

import { formatDurationISO } from '../dateUtils/isoFormat'
import { parseDurationISO } from '../dateUtils/parse'
import { parseDuration } from '../dateUtils/parseDuration'
import { computeTotalUnits } from '../dateUtils/totalUnits'

@@ -68,3 +68,3 @@ import { NANOSECOND, SECOND, UnitInt, YEAR } from '../dateUtils/units'

? refineFields(arg, durationFieldMap)
: parseDurationISO(arg),
: parseDuration(arg),
)

@@ -71,0 +71,0 @@ }

@@ -9,5 +9,6 @@ import { OVERFLOW_REJECT } from '../argParse/overflowHandling'

import { ComputedEpochFields, mixinEpochFields } from '../dateUtils/mixins'
import { parseDateTimeISO } from '../dateUtils/parse'
import { parseZonedDateTime } from '../dateUtils/parse'
import { nanoInMicroBI, nanoInMilliBI, nanoInSecondBI } from '../dateUtils/units'
import { OrigDateTimeFormat } from '../native/intl'
import { createZonedFormatFactoryFactory } from '../native/intlFactory'
import { ToLocaleStringMethods, mixinLocaleStringMethods } from '../native/intlMixins'
import { createWeakMap } from '../utils/obj'

@@ -21,3 +22,2 @@ import { Duration } from './duration'

InstantToStringOptions,
LocalesArg,
TimeDiffOptions,

@@ -44,3 +44,3 @@ TimeRoundingOptions,

const fields = parseDateTimeISO(String(arg))
const fields = parseZonedDateTime(String(arg))
const offsetNano = fields.offset

@@ -116,14 +116,2 @@ if (offsetNano === undefined) {

toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string {
return new OrigDateTimeFormat(locales, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: '2-digit',
second: '2-digit',
...options,
}).format(this.epochMilliseconds)
}
toZonedDateTimeISO(timeZoneArg: TimeZoneArg): ZonedDateTime {

@@ -153,2 +141,14 @@ return new ZonedDateTime(this.epochNanoseconds, timeZoneArg)

export interface Instant extends ComputedEpochFields {}
export interface Instant extends ToLocaleStringMethods {}
mixinEpochFields(Instant)
mixinLocaleStringMethods(Instant, createZonedFormatFactoryFactory({
year: 'numeric',
month: 'numeric',
day: 'numeric',
weekday: undefined,
hour: 'numeric',
minute: '2-digit',
second: '2-digit',
}, {
timeZoneName: undefined,
}, {}))
import { nanoInMilliBI } from '../dateUtils/units'
import { OrigDateTimeFormat } from '../native/intl'
import { OrigDateTimeFormat } from '../native/intlUtils'
import { Instant } from './instant'

@@ -4,0 +4,0 @@ import { PlainDate } from './plainDate'

@@ -24,8 +24,9 @@ import { extractCalendar } from '../argParse/calendar'

} from '../dateUtils/mixins'
import { createMonthDay } from '../dateUtils/monthDay'
import { parseDateTimeISO, refineDateTimeParse } from '../dateUtils/parse'
import { parseDateTime } from '../dateUtils/parse'
import { refineBaseObj } from '../dateUtils/parseRefine'
import { ensureLooseTime } from '../dateUtils/time'
import { DAY, DateUnitInt, YEAR } from '../dateUtils/units'
import { createYearMonth } from '../dateUtils/yearMonth'
import { formatUnzoned } from '../native/intl'
import { createPlainFormatFactoryFactory } from '../native/intlFactory'
import { ToLocaleStringMethods, mixinLocaleStringMethods } from '../native/intlMixins'
import { Calendar, createDefaultCalendar } from './calendar'

@@ -47,3 +48,2 @@ import { Duration } from './duration'

DurationArg,
LocalesArg,
OverflowOptions,

@@ -85,3 +85,3 @@ TimeArg,

return createDate(refineDateTimeParse(parseDateTimeISO(String(arg))))
return createDate(refineBaseObj(parseDateTime(String(arg))))
}

@@ -149,14 +149,2 @@

toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string {
return formatUnzoned(this, locales, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
...options,
hour: undefined,
minute: undefined,
second: undefined,
})
}
toZonedDateTime(options: { plainTime?: TimeArg, timeZone: TimeZoneArg }): ZonedDateTime {

@@ -174,3 +162,3 @@ return this.toPlainDateTime(options.plainTime).toZonedDateTime(options.timeZone)

toPlainYearMonth(): PlainYearMonth { return createYearMonth(this.getISOFields()) }
toPlainMonthDay(): PlainMonthDay { return createMonthDay(this.getISOFields()) }
toPlainMonthDay(): PlainMonthDay { return this.calendar.monthDayFromFields(this) }
}

@@ -180,3 +168,14 @@

export interface PlainDate extends DateCalendarFields { calendar: Calendar }
export interface PlainDate extends ToLocaleStringMethods {}
mixinISOFields(PlainDate)
mixinCalendarFields(PlainDate, dateCalendarFields)
mixinLocaleStringMethods(PlainDate, createPlainFormatFactoryFactory({
year: 'numeric',
month: 'numeric',
day: 'numeric',
weekday: undefined,
}, {
hour: undefined,
minute: undefined,
second: undefined,
}))

@@ -29,7 +29,8 @@ import { extractCalendar, getStrangerCalendar } from '../argParse/calendar'

} from '../dateUtils/mixins'
import { createMonthDay } from '../dateUtils/monthDay'
import { parseDateTimeISO, refineDateTimeParse } from '../dateUtils/parse'
import { parseDateTime } from '../dateUtils/parse'
import { refineBaseObj } from '../dateUtils/parseRefine'
import { TimeFields, createTime, ensureLooseTime } from '../dateUtils/time'
import { createYearMonth } from '../dateUtils/yearMonth'
import { formatUnzoned } from '../native/intl'
import { createPlainFormatFactoryFactory } from '../native/intlFactory'
import { ToLocaleStringMethods, mixinLocaleStringMethods } from '../native/intlMixins'
import { Calendar, createDefaultCalendar } from './calendar'

@@ -55,3 +56,2 @@ import { Duration } from './duration'

DurationArg,
LocalesArg,
OverflowOptions,

@@ -110,3 +110,3 @@ TimeArg,

)
: refineDateTimeParse(parseDateTimeISO(String(arg))),
: refineBaseObj(parseDateTime(String(arg))),
)

@@ -195,14 +195,2 @@ }

toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string {
return formatUnzoned(this, locales, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: '2-digit',
second: '2-digit',
...options,
})
}
// workhorse for converting to ZonedDateTime for other objects

@@ -224,3 +212,3 @@ toZonedDateTime(

toPlainYearMonth(): PlainYearMonth { return createYearMonth(this.getISOFields()) }
toPlainMonthDay(): PlainMonthDay { return createMonthDay(this.getISOFields()) }
toPlainMonthDay(): PlainMonthDay { return this.calendar.monthDayFromFields(this) }
toPlainDate(): PlainDate { return createDate(this.getISOFields()) }

@@ -233,3 +221,13 @@ toPlainTime(): PlainTime { return createTime(this.getISOFields()) }

export interface PlainDateTime extends TimeFields {}
export interface PlainDateTime extends ToLocaleStringMethods {}
mixinISOFields(PlainDateTime, timeUnitNames)
mixinCalendarFields(PlainDateTime, dateCalendarFields)
mixinLocaleStringMethods(PlainDateTime, createPlainFormatFactoryFactory({
year: 'numeric',
month: 'numeric',
day: 'numeric',
weekday: undefined,
hour: 'numeric',
minute: '2-digit',
second: '2-digit',
}, {}))

@@ -23,4 +23,8 @@ import { extractCalendar } from '../argParse/calendar'

} from '../dateUtils/monthDay'
import { parseMonthDayISO, refineDateTimeParse } from '../dateUtils/parse'
import { formatUnzoned } from '../native/intl'
import { parseMonthDay } from '../dateUtils/parse'
import { refineBaseObj } from '../dateUtils/parseRefine'
import { createPlainFormatFactoryFactory } from '../native/intlFactory'
import { ToLocaleStringMethods, mixinLocaleStringMethods } from '../native/intlMixins'
import {
} from '../native/intlUtils'
import { throwNew } from '../utils/obj'

@@ -33,3 +37,2 @@ import { Calendar, createDefaultCalendar } from './calendar'

DateToStringOptions,
LocalesArg,
MonthDayArg,

@@ -80,3 +83,3 @@ MonthDayLikeFields,

// a string...
const parsed = parseMonthDayISO(String(arg))
const parsed = parseMonthDay(String(arg))

@@ -88,3 +91,3 @@ // for strings, force ISO year if no calendar specified

return createMonthDay(refineDateTimeParse(parsed))
return createMonthDay(refineBaseObj(parsed))
}

@@ -114,15 +117,2 @@

toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string {
return formatUnzoned(this, locales, {
month: 'numeric',
day: 'numeric',
...options,
weekday: undefined,
year: undefined,
hour: undefined,
minute: undefined,
second: undefined,
}, true) // strictCalendar
}
toPlainDate(fields: { year: number }, options?: OverflowOptions): PlainDate {

@@ -139,3 +129,14 @@ return this.calendar.dateFromFields({

export interface PlainMonthDay extends MonthDayCalendarFields { calendar: Calendar }
export interface PlainMonthDay extends ToLocaleStringMethods {}
mixinISOFields(PlainMonthDay)
mixinCalendarFields(PlainMonthDay, monthDayCalendarFields)
mixinLocaleStringMethods(PlainMonthDay, createPlainFormatFactoryFactory({
month: 'numeric',
day: 'numeric',
}, {
weekday: undefined,
year: undefined,
hour: undefined,
minute: undefined,
second: undefined,
}, true)) // strictCalendar

@@ -9,3 +9,3 @@ import { timeFieldMap } from '../argParse/fieldStr'

import { mixinISOFields } from '../dateUtils/mixins'
import { parseTimeISO } from '../dateUtils/parse'
import { parseTime } from '../dateUtils/parse'
import { roundTime } from '../dateUtils/rounding'

@@ -26,3 +26,5 @@ import {

import { nanoInMilliBI } from '../dateUtils/units'
import { OrigDateTimeFormat } from '../native/intl'
import { FormatFactory } from '../native/intlFactory'
import { ToLocaleStringMethods, mixinLocaleStringMethods } from '../native/intlMixins'
import { OrigDateTimeFormat } from '../native/intlUtils'
import { Calendar, createDefaultCalendar } from './calendar'

@@ -36,3 +38,2 @@ import { Duration } from './duration'

DurationArg,
LocalesArg,
OverflowOptions,

@@ -81,3 +82,3 @@ TimeArg,

? timeFieldsToConstrainedISO(refineFields(arg, timeFieldMap), overflowHandling)
: parseTimeISO(String(arg)),
: parseTime(String(arg)),
)

@@ -132,4 +133,24 @@ }

toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string {
return new OrigDateTimeFormat(locales, {
toZonedDateTime(options: { plainDate: DateArg, timeZone: TimeZoneArg }): ZonedDateTime {
return this.toPlainDateTime(options.plainDate).toZonedDateTime(options.timeZone)
}
toPlainDateTime(dateArg: DateArg): PlainDateTime {
return ensureObj(PlainDate, dateArg).toPlainDateTime(this)
}
}
// mixin
export interface PlainTime extends TimeFields { calendar: Calendar }
export interface PlainTime extends ToLocaleStringMethods {}
mixinISOFields(PlainTime, timeUnitNames)
mixinLocaleStringMethods(PlainTime, createPlainTimeFormatFactory)
function createPlainTimeFormatFactory(
locales: string[],
options: Intl.DateTimeFormatOptions,
): FormatFactory<PlainTime> {
return {
buildKey: () => ['', ''],
buildFormat: () => new OrigDateTimeFormat(locales, {
hour: 'numeric',

@@ -145,18 +166,7 @@ minute: '2-digit',

weekday: undefined,
}).format(
Number(timeFieldsToNano(this) / nanoInMilliBI),
)
}),
buildEpochMilli: (plainTime: PlainTime) => (
Number(timeFieldsToNano(plainTime) / nanoInMilliBI)
),
}
toZonedDateTime(options: { plainDate: DateArg, timeZone: TimeZoneArg }): ZonedDateTime {
return this.toPlainDateTime(options.plainDate).toZonedDateTime(options.timeZone)
}
toPlainDateTime(dateArg: DateArg): PlainDateTime {
return ensureObj(PlainDate, dateArg).toPlainDateTime(this)
}
}
// mixin
export interface PlainTime extends TimeFields { calendar: Calendar }
mixinISOFields(PlainTime, timeUnitNames)

@@ -18,3 +18,4 @@ import { extractCalendar } from '../argParse/calendar'

} from '../dateUtils/mixins'
import { parseDateTimeISO, refineDateTimeParse } from '../dateUtils/parse'
import { parseYearMonth } from '../dateUtils/parse'
import { refineBaseObj } from '../dateUtils/parseRefine'
import { MONTH, YEAR, YearMonthUnitInt } from '../dateUtils/units'

@@ -26,3 +27,4 @@ import {

} from '../dateUtils/yearMonth'
import { formatUnzoned } from '../native/intl'
import { createPlainFormatFactoryFactory } from '../native/intlFactory'
import { ToLocaleStringMethods, mixinLocaleStringMethods } from '../native/intlMixins'
import { Calendar, createDefaultCalendar } from './calendar'

@@ -37,3 +39,2 @@ import { Duration } from './duration'

DurationArg,
LocalesArg,
OverflowOptions,

@@ -84,3 +85,3 @@ YearMonthArg,

// a string...
const parsed = parseDateTimeISO(String(arg))
const parsed = parseYearMonth(String(arg))

@@ -92,3 +93,3 @@ // don't allow day-numbers in ISO strings

return createYearMonth(refineDateTimeParse(parsed))
return createYearMonth(refineBaseObj(parsed))
}

@@ -152,15 +153,2 @@

toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string {
return formatUnzoned(this, locales, {
year: 'numeric',
month: 'numeric',
...options,
weekday: undefined,
day: undefined,
hour: undefined,
minute: undefined,
second: undefined,
}, true) // strictCalendar
}
toPlainDate(fields: { day: number }): PlainDate {

@@ -177,4 +165,15 @@ return this.calendar.dateFromFields({

export interface PlainYearMonth extends YearMonthCalendarFields { calendar: Calendar }
export interface PlainYearMonth extends ToLocaleStringMethods {}
mixinISOFields(PlainYearMonth)
mixinCalendarFields(PlainYearMonth, yearMonthCalendarFields)
mixinLocaleStringMethods(PlainYearMonth, createPlainFormatFactoryFactory({
year: 'numeric',
month: 'numeric',
}, {
weekday: undefined,
day: undefined,
hour: undefined,
minute: undefined,
second: undefined,
}, true)) // strictCalendar

@@ -181,0 +180,0 @@ // utils

@@ -7,2 +7,3 @@ import {

} from '../argParse/disambig'
import { OFFSET_REJECT } from '../argParse/offsetHandling'
import { isTimeZoneArgBag, parseTimeZoneFromBag } from '../argParse/timeZone'

@@ -13,3 +14,4 @@ import { AbstractObj, ensureObj } from '../dateUtils/abstract'

import { epochNanoToISOFields, isoFieldsToEpochSecs } from '../dateUtils/isoMath'
import { tryParseDateTimeISO } from '../dateUtils/parse'
import { tryParseZonedDateTime } from '../dateUtils/parse'
import { refineZonedObj } from '../dateUtils/parseRefine'
import {

@@ -21,2 +23,3 @@ nanoInMicroBI,

} from '../dateUtils/units'
import { computeEpochNanoViaOffset } from '../dateUtils/zonedDateTime'
import { TimeZoneImpl } from '../timeZoneImpl/timeZoneImpl'

@@ -56,10 +59,18 @@ import { queryTimeZoneImpl } from '../timeZoneImpl/timeZoneImplQuery'

}
const dateTimeParse = tryParseDateTimeISO(String(arg))
return new TimeZone(
(dateTimeParse && (
dateTimeParse.timeZone ||
(dateTimeParse.Z && 'UTC') ||
(dateTimeParse.offset !== undefined && formatOffsetISO(dateTimeParse.offset))
)) || arg, // consider arg the literal time zone ID string
)
const parsed = tryParseZonedDateTime(String(arg))
if (parsed) {
if (parsed.timeZone) {
const refined = refineZonedObj(parsed) // TODO: we don't need the calendar
computeEpochNanoViaOffset(refined, OFFSET_REJECT) // throws error if offset/tz inconsistent
return refined.timeZone
} else if (parsed.Z) {
return new TimeZone('UTC')
} else if (parsed.offset !== undefined) {
return new TimeZone(formatOffsetISO(parsed.offset))
}
}
return new TimeZone(arg) // consider arg the literal time zone ID string
}

@@ -66,0 +77,0 @@

@@ -27,4 +27,4 @@ import { extractCalendar, getStrangerCalendar } from '../argParse/calendar'

} from '../dateUtils/mixins'
import { createMonthDay } from '../dateUtils/monthDay'
import { parseDateTimeISO, refineZonedDateTimeParse } from '../dateUtils/parse'
import { parseZonedDateTime } from '../dateUtils/parse'
import { refineZonedObj } from '../dateUtils/parseRefine'
import { TimeFields, createTime } from '../dateUtils/time'

@@ -44,3 +44,4 @@ import { nanoInHour } from '../dateUtils/units'

} from '../dateUtils/zonedDateTime'
import { formatZoned } from '../native/intl'
import { createZonedFormatFactoryFactory } from '../native/intlFactory'
import { ToLocaleStringMethods, mixinLocaleStringMethods } from '../native/intlMixins'
import { compareValues } from '../utils/math'

@@ -64,3 +65,2 @@ import { createWeakMap } from '../utils/obj'

DurationArg,
LocalesArg,
OverflowOptions,

@@ -130,3 +130,3 @@ TimeArg,

)
: refineZonedDateTimeParse(parseDateTimeISO(String(arg))),
: refineZonedObj(parseZonedDateTime(String(arg))),
options,

@@ -267,16 +267,4 @@ offsetHandling,

toLocaleString(locales?: LocalesArg, options?: Intl.DateTimeFormatOptions): string {
return formatZoned(this, locales, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: '2-digit',
second: '2-digit',
...options,
})
}
toPlainYearMonth(): PlainYearMonth { return createYearMonth(this.getISOFields()) }
toPlainMonthDay(): PlainMonthDay { return createMonthDay(this.getISOFields()) }
toPlainMonthDay(): PlainMonthDay { return this.calendar.monthDayFromFields(this) }
toPlainDateTime(): PlainDateTime { return createDateTime(this.getISOFields()) }

@@ -292,4 +280,16 @@ toPlainDate(): PlainDate { return createDate(this.getISOFields()) }

export interface ZonedDateTime extends ComputedEpochFields {}
export interface ZonedDateTime extends ToLocaleStringMethods {}
mixinISOFields(ZonedDateTime, timeUnitNames)
mixinCalendarFields(ZonedDateTime, dateCalendarFields)
mixinEpochFields(ZonedDateTime)
mixinLocaleStringMethods(ZonedDateTime, createZonedFormatFactoryFactory({
year: 'numeric',
month: 'numeric',
day: 'numeric',
weekday: undefined,
hour: 'numeric',
minute: '2-digit',
second: '2-digit',
}, {
timeZoneName: 'short',
}, {}))

@@ -10,8 +10,6 @@ /*

Calendar,
DateTimeFormatArg,
DateTimeFormatRangePart,
Duration,
ExtendedDateTimeFormat,
Instant,
Now,
OrigDateTimeFormat,
PlainDate,

@@ -25,4 +23,2 @@ PlainDateTime,

dateToTemporalInstant,
normalizeIntlDateArg,
normalizeIntlOptionalDateArg,
} from './impl'

@@ -50,31 +46,5 @@

class ExtendedDateTimeFormat extends OrigDateTimeFormat {
// TODO: methods should have defaults that mirror what objects do for toLocaleString
format(dateArg?: DateTimeFormatArg): string {
return super.format(normalizeIntlOptionalDateArg(dateArg))
}
formatToParts(dateArg?: DateTimeFormatArg): Intl.DateTimeFormatPart[] {
return super.formatToParts(normalizeIntlOptionalDateArg(dateArg))
}
formatRange(startArg: DateTimeFormatArg, endArg: DateTimeFormatArg): string {
return super.formatRange(normalizeIntlDateArg(startArg), normalizeIntlDateArg(endArg))
}
formatRangeToParts(
startArg: DateTimeFormatArg,
endArg: DateTimeFormatArg,
): DateTimeFormatRangePart[] {
return super.formatRangeToParts(
normalizeIntlDateArg(startArg),
normalizeIntlDateArg(endArg),
)
}
}
// wasn't possible to patch existing methods. must create subclass
(globalThis.Intl as any).DateTimeFormat = ExtendedDateTimeFormat // HACK
;(globalThis.Intl as any).DateTimeFormat = ExtendedDateTimeFormat
}
}
import { hashIntlFormatParts, normalizeShortEra } from '../dateUtils/intlFormat'
import { epochSecondsToISOYear, isoToEpochMilli, isoYearToEpochSeconds } from '../dateUtils/isoMath'
import { milliInSecond, secondsInDay } from '../dateUtils/units'
import { OrigDateTimeFormat } from '../native/intl'
import { OrigDateTimeFormat } from '../native/intlUtils'
import { compareValues } from '../utils/math'

@@ -9,3 +9,7 @@ import { specialCases } from './specialCases'

const MAX_YEAR_TRAVEL = 5
// Europe/Amsterdam and America/New_York have long gaps
// see timezone.spec.ts
// TODO: this is probably very expensive for timezones WITHOUT transitions
const MAX_YEAR_TRAVEL = 100
const ISLAND_SEARCH_DAYS = [

@@ -12,0 +16,0 @@ 182, // 50% through year

export type ValueOf<T> = T[keyof T]
type GenericHash = Record<string, unknown>
// TODO: just use Symbols instead?
// The `object` type is literally required for WeakMap

@@ -5,0 +7,0 @@ // eslint-disable-next-line @typescript-eslint/ban-types

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc