You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
68 KiB
2 lines
68 KiB
4 weeks ago
|
class P extends Error{}class qn extends P{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Hn extends P{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Yn extends P{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class K extends P{}class $t extends P{constructor(e){super(`Invalid unit ${e}`)}}class N extends P{}class Z extends P{constructor(){super("Zone is an abstract class")}}const c="numeric",W="short",M="long",De={year:c,month:c,day:c},Zt={year:c,month:W,day:c},Pn={year:c,month:W,day:c,weekday:W},At={year:c,month:M,day:c},Ut={year:c,month:M,day:c,weekday:M},zt={hour:c,minute:c},Rt={hour:c,minute:c,second:c},qt={hour:c,minute:c,second:c,timeZoneName:W},Ht={hour:c,minute:c,second:c,timeZoneName:M},Yt={hour:c,minute:c,hourCycle:"h23"},Pt={hour:c,minute:c,second:c,hourCycle:"h23"},Gt={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:W},Jt={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:M},_t={year:c,month:c,day:c,hour:c,minute:c},Bt={year:c,month:c,day:c,hour:c,minute:c,second:c},jt={year:c,month:W,day:c,hour:c,minute:c},Qt={year:c,month:W,day:c,hour:c,minute:c,second:c},Gn={year:c,month:W,day:c,weekday:W,hour:c,minute:c},Kt={year:c,month:M,day:c,hour:c,minute:c,timeZoneName:W},Xt={year:c,month:M,day:c,hour:c,minute:c,second:c,timeZoneName:W},en={year:c,month:M,day:c,weekday:M,hour:c,minute:c,timeZoneName:M},tn={year:c,month:M,day:c,weekday:M,hour:c,minute:c,second:c,timeZoneName:M};class me{get type(){throw new Z}get name(){throw new Z}get ianaName(){return this.name}get isUniversal(){throw new Z}offsetName(e,t){throw new Z}formatOffset(e,t){throw new Z}offset(e){throw new Z}equals(e){throw new Z}get isValid(){throw new Z}}let Ze=null;class Ve extends me{static get instance(){return Ze===null&&(Ze=new Ve),Ze}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return fn(e,t,r)}formatOffset(e,t){return de(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let Ne={};function Jn(n){return Ne[n]||(Ne[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Ne[n]}const _n={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Bn(n,e){const t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,a,o,u,l,f]=r;return[a,s,i,o,u,l,f]}function jn(n,e){const t=n.formatToParts(e),r=[];for(let s=0;s<t.length;s++){const{type:i,value:a}=t[s],o=_n[i];i==="era"?r[o]=a:d(o)||(r[o]=parseInt(a,10))}return r}let ke={};class $ extends me{static create(e){return ke[e]||(ke[e]=new $(e)),ke[e]}static resetCache(){ke={},Ne={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=$.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return fn(e,t,r,this.name)}formatOffset(e,t){return de(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const r=Jn(this.name);let[s,i,a,o,u,l,f]=r.formatToParts?jn(r,t):Bn(r,t);o==="BC"&&(s=-Math.abs(s)+1);const O=We({year:s,month:i,day:a,hour:u===24?0:u,minute:l,second:f,millisecond:0});let m=+t;const v=m%1e3;return m-=v>=0?v:1e3+v,(O-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ot={};function Qn(n,e={}){const t=JSON.stringify([n,e]);let r=ot[t];return r||(r=new Intl.ListFormat(n,e),ot[t]=r),r}let Pe={};function Ge(n,e={}){const t=JSON.stringify([n,e]);let r=Pe[t];return r||(r=new Intl.DateTimeFormat(n,e),Pe[t]=r),r}let Je={};function Kn(n,e={}){const t=JSON.stringify([n,e]);let r=Je[t];return r||(r=new Intl.NumberFormat(n,e),Je[t]=r),r}let _e={};function Xn(n,e={}){const{base:t,...r}=e,s=JSON.stri
|