gemi 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/bin/index.js +77 -5778
- package/dist/broadcasting/index.js +1 -1
- package/dist/chunk-0643qpn8.js +4 -0
- package/dist/{chunk-vc1yv3v5.js.map → chunk-0643qpn8.js.map} +2 -2
- package/dist/chunk-0970v4jx.js +4 -0
- package/dist/chunk-0970v4jx.js.map +10 -0
- package/dist/{chunk-83snmykp.js → chunk-0rvh1r84.js} +2 -2
- package/dist/{chunk-83snmykp.js.map → chunk-0rvh1r84.js.map} +1 -1
- package/dist/chunk-0ykbtpxc.js +4 -0
- package/dist/{chunk-t34vnmky.js.map → chunk-0ykbtpxc.js.map} +1 -1
- package/dist/chunk-259kgv1j.js +18 -0
- package/dist/{chunk-1tpqxqmt.js.map → chunk-259kgv1j.js.map} +11 -29
- package/dist/{chunk-0s3yapam.js → chunk-39ynan33.js} +3 -3
- package/dist/{chunk-0s3yapam.js.map → chunk-39ynan33.js.map} +1 -1
- package/dist/{chunk-7v15p9nn.js → chunk-54v7tmfv.js} +3 -3
- package/dist/{chunk-7v15p9nn.js.map → chunk-54v7tmfv.js.map} +1 -1
- package/dist/chunk-5jvxqe5r.js +4 -0
- package/dist/{chunk-3pfpq2xc.js.map → chunk-5jvxqe5r.js.map} +1 -1
- package/dist/{chunk-ch0p7trm.js → chunk-5kh25wbv.js} +2 -2
- package/dist/{chunk-ch0p7trm.js.map → chunk-5kh25wbv.js.map} +1 -1
- package/dist/chunk-6twxqxj0.js +3 -0
- package/dist/chunk-6twxqxj0.js.map +16 -0
- package/dist/chunk-8pghf7ne.js +3 -0
- package/dist/{chunk-ac7dhq1c.js.map → chunk-8pghf7ne.js.map} +4 -4
- package/dist/chunk-99tdk5x5.js +4 -0
- package/dist/{chunk-sqgv2xyc.js.map → chunk-99tdk5x5.js.map} +2 -2
- package/dist/chunk-b5ke2zpg.js +4 -0
- package/dist/{chunk-9em80ypy.js.map → chunk-b5ke2zpg.js.map} +2 -2
- package/dist/chunk-bxwnddma.js +3 -0
- package/dist/chunk-bxwnddma.js.map +17 -0
- package/dist/{chunk-hnyegpzf.js → chunk-djfe1w23.js} +3 -3
- package/dist/{chunk-hnyegpzf.js.map → chunk-djfe1w23.js.map} +1 -1
- package/dist/chunk-e0yxdcan.js +4 -0
- package/dist/{chunk-k8t4vgx8.js.map → chunk-e0yxdcan.js.map} +2 -2
- package/dist/chunk-ee0c21b5.js +4 -0
- package/dist/{chunk-dfc3y8yn.js.map → chunk-ee0c21b5.js.map} +5 -5
- package/dist/{chunk-rr5j1686.js → chunk-exvtvmb6.js} +2 -2
- package/dist/{chunk-rr5j1686.js.map → chunk-exvtvmb6.js.map} +1 -1
- package/dist/chunk-fskmyztg.js +4 -0
- package/dist/{chunk-vp96f2zv.js.map → chunk-fskmyztg.js.map} +2 -2
- package/dist/{chunk-ewp71f92.js → chunk-g3838fme.js} +2 -2
- package/dist/{chunk-ewp71f92.js.map → chunk-g3838fme.js.map} +1 -1
- package/dist/{chunk-95hz1khz.js → chunk-hydta8h3.js} +2 -2
- package/dist/{chunk-95hz1khz.js.map → chunk-hydta8h3.js.map} +1 -1
- package/dist/{chunk-6y378xez.js → chunk-jwx1ymkq.js} +2 -2
- package/dist/{chunk-6y378xez.js.map → chunk-jwx1ymkq.js.map} +1 -1
- package/dist/chunk-n76mw527.js +11 -0
- package/dist/{chunk-hhbd5qn0.js.map → chunk-n76mw527.js.map} +5 -5
- package/dist/chunk-nwqqr50x.js +4 -0
- package/dist/{chunk-fn89vt9j.js.map → chunk-nwqqr50x.js.map} +6 -6
- package/dist/chunk-setbnv6k.js +7 -0
- package/dist/chunk-setbnv6k.js.map +66 -0
- package/dist/chunk-sywb9k1q.js +4 -0
- package/dist/{chunk-yq60hz8s.js.map → chunk-sywb9k1q.js.map} +6 -6
- package/dist/chunk-zq31anzs.js +8 -0
- package/dist/{chunk-hrf5jh5c.js.map → chunk-zq31anzs.js.map} +2 -2
- package/dist/chunk-zqcc4jxj.js +4 -0
- package/dist/{chunk-77gdtbj7.js.map → chunk-zqcc4jxj.js.map} +2 -2
- package/dist/email/index.js +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +3 -12
- package/dist/services/index.js.map +4 -15
- package/package.json +2 -2
- package/dist/chunk-1tpqxqmt.js +0 -20
- package/dist/chunk-3pfpq2xc.js +0 -4
- package/dist/chunk-45df2pgm.js +0 -5
- package/dist/chunk-45df2pgm.js.map +0 -65
- package/dist/chunk-740bx4ar.js +0 -3
- package/dist/chunk-740bx4ar.js.map +0 -15
- package/dist/chunk-77gdtbj7.js +0 -4
- package/dist/chunk-9em80ypy.js +0 -4
- package/dist/chunk-ac7dhq1c.js +0 -3
- package/dist/chunk-dfc3y8yn.js +0 -4
- package/dist/chunk-fn89vt9j.js +0 -4
- package/dist/chunk-hhbd5qn0.js +0 -11
- package/dist/chunk-hrf5jh5c.js +0 -8
- package/dist/chunk-k8t4vgx8.js +0 -4
- package/dist/chunk-n34j31ss.js +0 -4
- package/dist/chunk-n34j31ss.js.map +0 -16
- package/dist/chunk-sqgv2xyc.js +0 -4
- package/dist/chunk-srsjrh5y.js +0 -4
- package/dist/chunk-srsjrh5y.js.map +0 -10
- package/dist/chunk-t34vnmky.js +0 -4
- package/dist/chunk-vc1yv3v5.js +0 -4
- package/dist/chunk-vp96f2zv.js +0 -4
- package/dist/chunk-yq60hz8s.js +0 -4
package/dist/facades/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{n as Bm,o as Qm,p as zs,q as Rm,r as $o,s as Io,t as ps,u as ci,v as R,x as Gm,y as Ea,z as oa}from"../http/index.js";import{E as ap}from"../chunk-83snmykp.js";import{Rb as Hm}from"../chunk-t34vnmky.js";import{Tb as hi}from"../chunk-ewp71f92.js";import{Vb as sp}from"../chunk-rr5j1686.js";import{AsyncLocalStorage as ip}from"async_hooks";class Is extends hi{i;static _name="BroadcastingServiceContainer";publishCb;context=new ip;constructor(i){super();this.service=i}onPublish(i){this.publishCb=i}publish(...i){let[s,a,t]=i;this.publishCb(s,a,t)}async handleMessage(i,s){let a=JSON.parse(s);if(a.type==="subscribe"){let t=Object.entries(this.service.channels).sort(([r],[l])=>r.length-l.length);for(let[r,l]of t){let o=new URLPattern({pathname:r});if(o.test({pathname:a.topic})){let c=o.exec({pathname:a.topic})?.pathname.groups,d=new l;if(await d.subscribe.call(d,c))i.subscribe(a.topic);break}}}if(a.type==="broadcast")i.publish(a.topic,JSON.stringify({topic:a.topic,data:a.payload}));if(a.type==="unsubscribe")i.unsubscribe(a.topic)}run(i,s){let a=i.get("Cookie"),t=new Map;if(a){let r=a.split(";");for(let l of r){let[o,c]=l.split("=");t.set(o.trim(),c.trim())}}this.context.run({headers:i,cookies:t},s)}}class Ai{static async user(){let i=ci.getStore(),s=Is.use().context.getStore(),a="",t="";if(i?.req)a=i.req.cookies.get("access_token"),t=i.req.headers.get("User-Agent");if(s?.cookies)t=s.headers.get("User-Agent"),a=s.cookies.get("access_token");let r=i?.user;if(!r)r=(await oa.use().getSession(a,t))?.user,i?.setUser(r);if(r)return r;return null}static async guard(i){let s=await Ai.user();if(!s)throw new Ea;try{if(!await i(s))throw new Ea}catch(a){throw new Ea}}static async guardSafe(i){let s=await Ai.user();if(!s)return!1;try{return await i(s)}catch(a){return!1}}}function xi(i,s){return i.replace(/:([^/]+)/g,(a,t)=>{let r=t.endsWith("?"),l=r?t.slice(0,-1):t,o=s[l];if(o===void 0){if(r)return"";throw new Error(`Missing parameter: ${l}`)}return String(o)}).replace(/\/\//g,"/")}class zo extends Io{constructor(i){super("Redirect error");this.name="RedirectError",this.payload={api:{status:200,data:{},directive:{kind:"Redirect",path:i}},view:{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:i}}}}}class Co{static to(i,...s){let[a={}]=s;throw new zo(xi(i,a))}}class et extends zs{middlewares=["cache:private"];routes={"/translations":this.get(async()=>{let i=new R,{scope:s,locale:a}=i.search.toJSON(),t=a??gs.use().detectLocale(i),r=gs.use().getPageTranslations(t,s);return i.ctx().setCookie("i18n-locale",t,{expires:new Date(Date.now()+31536000000)}),{[t]:r}})}}class gs extends hi{i;static _name="I18nServiceContainer";isEnabled=!1;translations=new Map;supportedLocales=[];constructor(i){super();this.service=i;let s=new Map;for(let[t,r]of Object.entries(this.service.dictionary))for(let[l,o]of Object.entries(r))for(let[c,d]of Object.entries(o)){let f=c==="default"?this.service.defaultLocale:c;if(!s.has(`${f}.${t}`))s.set(`${f}.${t}`,new Map);s.get(`${f}.${t}`)?.set(l,d),this.isEnabled=!0}let a=new Set(i.supportedLocales);for(let[t,r]of s.entries()){this.translations.set(t,Object.fromEntries(r.entries()));let[l]=t.split(".");if(!a.has(l))a.add(l)}this.supportedLocales=Array.from(a)}detectLocale(i){let s=this.service.detectLocale(i);if(this.supportedLocales.includes(s))return s;let t=i.cookies.get("i18n-locale")??(i.headers.get("accept-language")||"en-US"),[r]=t.split(","),l=r.length===2?`${r}-${r.toUpperCase()}`:r;if(this.supportedLocales.includes(l))return l;let o=this.service.defaultLocale??this.supportedLocales[0];if(o)return o;return"en-US"}getPageTranslations(i,s){if(!s)return{};let a=this.translations.get(`${i}.view:${s}`)??{},t={[`view:${s}`]:a};for(let[r]of this.translations.entries()){let l=r.split(".")[1];if(!l.startsWith("layout:"))continue;let o=l.split(":")[1];if(s?.startsWith(o))t[l]=this.translations.get(`${i}.${l}`)??{}}return t}}function No(i,s){return i.replace(/{{([^}]+)}}/g,(a,t)=>{let r=s[t];if(r===void 0)throw new Error(`Missing parameter: ${t}`);return r})}class Wo{static scope(i){return i}static translate(i,...s){let a=gs.use(),t=a.detectLocale(ci.getStore().req),r=a.translations.get(`${t}.server`)?.[i];if(!r)return i;return No(r,s[0])}}var Eo=sp(ap(),1);import{Buffer as tp}from"buffer";class ca extends hi{i;static _name="FileStorageServiceContainer";constructor(i){super();this.service=i}}class Jo{static async put(i){return ca.use().service.driver.put(i)}static async metadata(i){let s=tp.from(await i.arrayBuffer());try{return await Eo.default(s).metadata()}catch{return{}}}static async fetch(i){return ca.use().service.driver.fetch(i)}static list(i){return ca.use().service.driver.list(i)}static delete(){}}function Uo(i){return Object.fromEntries(Object.entries(i).filter(([,s])=>{return s!==null&&s!==void 0}))}function di(i,s,a,t,r){return Di(s,sc(i,s),a,t,r)}function Di(i,s,a,t,r,l){let o=rr(s,a,t);if(r&&s!==o)throw new RangeError(Uf(i,s,a,t,l));return o}function sc(i,s){let a=i[s];if(a===void 0)throw new TypeError(zl(s));return a}function G(i){return i!==null&&/object|function/.test(typeof i)}function pi(i,s=Map){let a=new s;return(t,...r)=>{if(a.has(t))return a.get(t);let l=i(t,...r);return a.set(t,l),l}}function ur(i){return ws({name:i},1)}function ws(i,s){return Si((a)=>({value:a,configurable:1,writable:!s}),i)}function ac(i){return Si((s)=>({get:s,configurable:1}),i)}function ea(i){return{[Symbol.toStringTag]:{value:i,configurable:1}}}function _s(i,s){let a={},t=i.length;for(let r of s)a[i[--t]]=r;return a}function Si(i,s,a){let t={};for(let r in s)t[r]=i(s[r],r,a);return t}function Pa(i,s,a){let t={};for(let r=0;r<s.length;r++){let l=s[r];t[l]=i(l,r,a)}return t}function rp(i,s,a){let t={};for(let r=0;r<i.length;r++)t[s[r]]=a[i[r]];return t}function gi(i,s){let a={};for(let t of i)a[t]=s[t];return a}function gr(i,s){let a={};for(let t in s)i.has(t)||(a[t]=s[t]);return a}function hr(i){i={...i};let s=Object.keys(i);for(let a of s)i[a]===void 0&&delete i[a];return i}function tc(i,s){for(let a of s)if(!(a in i))return 0;return 1}function rc(i,s,a){for(let t of i)if(s[t]!==a[t])return 0;return 1}function lc(i,s,a){let t={...a};for(let r=0;r<s;r++)t[i[r]]=0;return t}function O(i,...s){return(...a)=>i(...s,...a)}function _o(i){return i[0].toUpperCase()+i.substring(1)}function wa(i){return i.slice().sort()}function Ga(i,s){return String(s).padStart(i,"0")}function Qi(i,s){return Math.sign(i-s)}function rr(i,s,a){return Math.min(Math.max(i,s),a)}function Ji(i,s){return[Math.floor(i/s),fa(i,s)]}function fa(i,s){return(i%s+s)%s}function qi(i,s){return[it(i,s),Tr(i,s)]}function it(i,s){return Math.trunc(i/s)||0}function Tr(i,s){return i%s||0}function Ja(i){return Math.abs(i%1)===0.5}function oc(i,s,a){let t=0,r=0;for(let c=0;c<=s;c++){let d=i[a[c]],f=ni[c],m=v/f,[p,u]=qi(d,m);t+=u*f,r+=p}let[l,o]=qi(t,v);return[r+l,o]}function st(i,s,a){let t={};for(let r=s;r>=0;r--){let l=ni[r];t[a[r]]=it(i,l),i=Tr(i,l)}return t}function cc(i){return i===y?Nt:[]}function dc(i){return i===y?ja:[]}function fc(i){return i===y?["year","day"]:[]}function mc(i){if(i!==void 0)return I(i)}function pc(i){if(i!==void 0)return vi(i)}function Pr(i){if(i!==void 0)return ba(i)}function vi(i){return hc(ba(i))}function ba(i){return gc(Qp(i))}function wr(i){if(i==null)throw new TypeError("Cannot be null or undefined");return i}function uc(i,s){if(s==null)throw new RangeError(zl(i));return s}function _i(i){if(!G(i))throw new TypeError(Jf);return i}function at(i,s,a=i){if(typeof s!==i)throw new TypeError(va(a,s));return s}function gc(i,s="number"){if(!Number.isInteger(i))throw new RangeError(Op(s,i));return i||0}function hc(i,s="number"){if(i<=0)throw new RangeError(yp(s,i));return i}function br(i){if(typeof i=="symbol")throw new TypeError(Mp);return String(i)}function Ya(i,s){return G(i)?String(i):I(i,s)}function tt(i){if(typeof i=="string")return BigInt(i);if(typeof i!="bigint")throw new TypeError(vp(i));return i}function Tc(i,s="number"){if(typeof i=="bigint")throw new TypeError(Sp(s));if(i=Number(i),!Number.isFinite(i))throw new RangeError(Fp(s,i));return i}function e(i,s){return Math.trunc(Tc(i,s))||0}function Pc(i,s){return gc(Tc(i,s),s)}function Bo(i,s){return hc(e(i,s),s)}function Dr(i,s){let[a,t]=qi(s,v),r=i+a,l=Math.sign(r);return l&&l===-Math.sign(t)&&(r-=l,t+=l*v),[r,t]}function Ns(i,s,a=1){return Dr(i[0]+s[0]*a,i[1]+s[1]*a)}function Ws(i,s){return Dr(i[0],i[1]+s)}function Ti(i,s){return Ns(s,i,-1)}function si(i,s){return Qi(i[0],s[0])||Qi(i[1],s[1])}function wc(i,s,a){return si(i,s)===-1||si(i,a)===1}function rt(i,s=1){let a=BigInt(v/s);return[Number(i/a),Number(i%a)*s]}function Es(i,s=1){let a=v/s,[t,r]=qi(i,a);return[t,r*s]}function bc(i,s=1){let[a,t]=i,r=Math.floor(t/s),l=v/s;return BigInt(a)*BigInt(l)+BigInt(r)}function Pi(i,s=1,a){let[t,r]=i,[l,o]=qi(r,s);return t*(v/s)+(l+(a?o/s:0))}function Or(i,s,a=Ji){let[t,r]=i,[l,o]=a(r,s);return[t*(v/s)+l,o]}function yr(i,s){let a=i.formatToParts(s),t={};for(let r of a)t[r.type]=r.value;return t}function Fr(i){return di(i,"isoYear",Ta,ha,1),i.isoYear===Ta?di(i,"isoMonth",4,12,1):i.isoYear===ha&&di(i,"isoMonth",1,9,1),i}function Vi(i){return Bi({...i,...Fi,isoHour:12}),i}function Bi(i){let s=di(i,"isoYear",Ta,ha,1),a=s===Ta?1:s===ha?-1:0;return a&&wi(ii({...i,isoDay:i.isoDay+a,isoNanosecond:i.isoNanosecond-a})),i}function wi(i){if(!i||wc(i,au,su))throw new RangeError(nt);return i}function ei(i){return oc(i,5,Zi)[1]}function lt(i){let[s,a]=Ji(i,v);return[st(a,5,Zi),s]}function Dc(i){return Oc(i)[0]}function Oc(i){return Or(i,yi)}function ai(i){return Bs(i.isoYear,i.isoMonth,i.isoDay,i.isoHour,i.isoMinute,i.isoSecond,i.isoMillisecond)}function ii(i){let s=ai(i);if(s!==void 0){let[a,t]=qi(s,mi);return[a,t*Ii+(i.isoMicrosecond||0)*Ls+(i.isoNanosecond||0)]}}function Sr(i,s){let[a,t]=lt(ei(i)-s);return wi(ii({...i,isoDay:i.isoDay+t,...a}))}function Xa(...i){return Bs(...i)/Vf}function Bs(...i){let[s,a]=yc(...i),t=s.valueOf();if(!isNaN(t))return t-a*mi}function yc(i,s=1,a=1,t=0,r=0,l=0,o=0){let c=i===Ta?1:i===ha?-1:0,d=new Date;return d.setUTCHours(t,r,l,o),d.setUTCFullYear(i,s-1,a+c),[d,c]}function ss(i,s){let[a,t]=Ws(i,s);t<0&&(t+=v,a-=1);let[r,l]=Ji(t,Ii),[o,c]=Ji(l,Ls);return ot(a*mi+r,o,c)}function ot(i,s=0,a=0){let t=Math.ceil(Math.max(0,Math.abs(i)-iu)/mi)*Math.sign(i),r=new Date(i-t*mi);return _s(Et,[r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate()+t,r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds(),s,a])}function Fc(i){return[i.isoYear,i.isoMonth,i.isoDay]}function Sc(){return Ei}function vr(i,s){switch(s){case 2:return Mr(i)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function vc(i){return Mr(i)?366:365}function Mr(i){return i%4==0&&(i%100!=0||i%400==0)}function Mc(i){let[s,a]=yc(i.isoYear,i.isoMonth,i.isoDay);return fa(s.getUTCDay()-a,7)||7}function Lc({isoYear:i}){return i<1?["bce",1-i]:["ce",i]}function lp(i){let s=ai(i);if(s<ru)return Lc(i);let a=yr(kl(Js),s),{era:t,eraYear:r}=Ed(a,Js);return[t,r]}function ct(i){return bs(i),dt(i,1),i}function bs(i){return jc(i,1),i}function Ro(i){return rc(Hl,i,jc(i))}function jc(i,s){let{isoYear:a}=i,t=di(i,"isoMonth",1,Sc(),s);return{isoYear:a,isoMonth:t,isoDay:di(i,"isoDay",1,vr(a,t),s)}}function dt(i,s){return _s(Zi,[di(i,"isoHour",0,23,s),di(i,"isoMinute",0,59,s),di(i,"isoSecond",0,59,s),di(i,"isoMillisecond",0,999,s),di(i,"isoMicrosecond",0,999,s),di(i,"isoNanosecond",0,999,s)])}function F(i){return i===void 0?0:gm(_i(i))}function Da(i,s=0){i=Mi(i);let a=hm(i),t=hu(i,s);return[gm(i),t,a]}function Lr(i){return hm(Mi(i))}function Zc(i){return i=Mi(i),Xl(i,9,6,1)}function Rs(i,s,a,t=9,r=0,l=4){s=Mi(s);let o=Xl(s,t,r),c=xr(s),d=xa(s,l),f=Za(s,t,r,1);return o==null?o=Math.max(a,f):Ic(o,f),c=$r(c,f,1),i&&(d=((m)=>m<4?(m+2)%4:m)(d)),[o,f,c,d]}function ft(i,s=6,a){let t=xr(i=nr(i,qa)),r=xa(i,7),l=Za(i,s);return l=uc(qa,l),t=$r(t,l,void 0,a),[l,t,r]}function jr(i){return Kl(Mi(i))}function xc(i,s){return Zr(Mi(i),s)}function Zr(i,s=4){let a=nc(i);return[xa(i,4),...$c(Za(i,s),a)]}function $c(i,s){return i!=null?[ni[i],i<4?9-3*i:-1]:[s===void 0?1:10**(9-s),s]}function xr(i){let s=i[ma];return s===void 0?1:e(s,ma)}function $r(i,s,a,t){let r=t?v:ni[s+1];if(r){let l=ni[s];if(r%((i=Di(ma,i,1,r/l-(t?0:1),1))*l))throw new RangeError(va(ma,i))}else i=Di(ma,i,1,a?1e9:1,1);return i}function nc(i){let s=i[tr];if(s!==void 0){if(typeof s!="number"){if(br(s)==="auto")return;throw new RangeError(va(tr,s))}s=Di(tr,Math.floor(s),0,9,1)}return s}function Mi(i){return i===void 0?{}:_i(i)}function nr(i,s){return typeof i=="string"?{[s]:i}:_i(i)}function W(i){if(i!==void 0){if(G(i))return Object.assign(Object.create(null),i);throw new TypeError(Jf)}}function mt(i,s){return i&&Object.assign(Object.create(null),i,{overflow:ou[s]})}function Ir(i,s,a=9,t=0,r){let l=s[i];if(l===void 0)return r?t:void 0;if(l=br(l),l==="auto")return r?t:null;let o=dr[l];if(o===void 0&&(o=qp[l]),o===void 0)throw new RangeError(Rf(i,l,dr));return Di(i,o,t,a,1,La),o}function Ds(i,s,a,t=0){let r=a[i];if(r===void 0)return t;let l=br(r),o=s[l];if(o===void 0)throw new RangeError(Rf(i,l,s));return o}function Ic(i,s){if(s>i)throw new RangeError(Gp)}function Y(i){return{branding:Ut,epochNanoseconds:i}}function Q(i,s,a){return{branding:Yi,calendar:a,timeZone:s,epochNanoseconds:i}}function E(i,s=i.calendar){return{branding:Zs,calendar:s,...gi(fm,i)}}function J(i,s=i.calendar){return{branding:js,calendar:s,...gi(Gl,i)}}function Ts(i,s=i.calendar){return{branding:Vs,calendar:s,...gi(Gl,i)}}function Ka(i,s=i.calendar){return{branding:ks,calendar:s,...gi(Gl,i)}}function Li(i){return{branding:Jt,...gi(dm,i)}}function x(i){return{branding:_t,sign:as(i),...gi(_l,i)}}function zc(i){return Dc(i.epochNanoseconds)}function pt(i){return Or(i.epochNanoseconds,Ii)[0]}function Cc(i){return bc(i.epochNanoseconds,Ls)}function Nc(i){return bc(i.epochNanoseconds)}function Wc(i){return i.epochNanoseconds}function K(i){return typeof i=="string"?i:I(i.id)}function Hs(i,s){return i===s||K(i)===K(s)}function Ec(i,s,a,t,r){let l=Ps(t),[o,c]=((P,b)=>{let w=b((P=nr(P,pr))[pm]),D=gu(P);return D=uc(pr,D),[D,w]})(r,i);if(ua(Math.max(o,l),c))return Ho(t,o);if(!c)throw new RangeError(It);let[d,f,m]=wt(s,a,c),p=al(m),u=bt(m),g=tl(m),h=u(f,d,t),T=g(f,d,h,o);return ua(o,c)?Ho(T,o):((P,b,w,D,N,$,Z)=>{let n=as(P),[X,B]=zr(D,Rl(w,P),w,n,N,$,Z),ra=Cr(b,X,B);return P[S[w]]+ra*n})(T,p(h),o,f,d,p,u)}function Ho(i,s){return Pi(H(i),ni[s],1)}function zr(i,s,a,t,r,l,o){let c=S[a],d={...s,[c]:s[c]+t},f=o(i,r,s),m=o(i,r,d);return[l(f),l(m)]}function Cr(i,s,a){let t=Pi(Ti(s,a));if(!t)throw new RangeError(Ma);return Pi(Ti(s,i))/t}function Jc(i,s){let[a,t,r]=ft(s,5,1);return Y(gt(i.epochNanoseconds,a,t,r,1))}function Uc(i,s,a){let{epochNanoseconds:t,timeZone:r,calendar:l}=s,[o,c,d]=ft(a);if(o===0&&c===1)return s;let f=i(r);if(o===6)t=((m,p,u,g)=>{let h=ti(u,p),[T,P]=m(h),b=u.epochNanoseconds,w=ui(p,T),D=ui(p,P);if(wc(b,w,D))throw new RangeError(Ma);return Ac(Cr(b,w,D),g)?D:w})(Xc,f,s,d);else{let m=f.getOffsetNanosecondsFor(t);t=ys(f,Gc(ss(t,m),o,c,d),m,2,0,1)}return Q(t,r,l)}function _c(i,s){return E(Gc(i,...ft(s)),i.calendar)}function Bc(i,s){let[a,t,r]=ft(s,5);var l;return Li((l=r,Nr(i,Oa(a,t),l)[0]))}function Rc(i,s){let a=i(s.timeZone),t=ti(s,a),[r,l]=Xc(t),o=Pi(Ti(ui(a,r),ui(a,l)),Ct,1);if(o<=0)throw new RangeError(Ma);return o}function Hc(i,s){let{timeZone:a,calendar:t}=s,r=((l,o,c)=>ui(o,l(ti(c,o))))(Kc,i(a),s);return Q(r,a,t)}function Gc(i,s,a,t){return Yc(i,Oa(s,a),t)}function Yc(i,s,a){let[t,r]=Nr(i,s,a);return Bi({...Fs(i,r),...t})}function Nr(i,s,a){return lt(is(ei(i),s,a))}function Aa(i){return is(i,zt,7)}function Oa(i,s){return ni[i]*s}function Xc(i){let s=Kc(i);return[s,Fs(s,1)]}function Kc(i){return ep(6,i)}function op(i,s,a){let t=Math.min(Ps(i),6);return Ys(ht(H(i,t),s,a),t)}function ut(i,s,a,t,r,l,o,c,d,f){if(t===0&&r===1)return i;let m=ua(t,c)?Dt(c)&&t<6&&a>=6?dp:cp:fp,[p,u,g]=m(i,s,a,t,r,l,o,c,d,f);return g&&t!==7&&(p=((h,T,P,b,w,D,N,$)=>{let Z=as(h);for(let n=b+1;n<=P;n++){if(n===7&&P!==7)continue;let X=Rl(n,h);X[S[n]]+=Z;let B=Pi(Ti(N($(w,D,X)),T));if(B&&Math.sign(B)!==Z)break;h=X}return h})(p,u,a,Math.max(6,t),o,c,d,f)),p}function gt(i,s,a,t,r){if(s===6){let l=((o)=>o[0]+o[1]/v)(i);return[is(l,a,t),0]}return ht(i,Oa(s,a),t,r)}function ht(i,s,a,t){let[r,l]=i;t&&l<0&&(l+=v,r-=1);let[o,c]=Ji(is(l,s,a),v);return Dr(r+o,c)}function is(i,s,a){return Ac(i/s,a)*s}function Ac(i,s){return wu[s](i)}function cp(i,s,a,t,r,l){let o=as(i),c=H(i),d=gt(c,t,r,l),f=Ti(c,d),m=Math.sign(d[0]-c[0])===o,p=Ys(d,Math.min(a,6));return[{...i,...p},Ns(s,f),m]}function dp(i,s,a,t,r,l,o,c,d,f){let m=as(i),p=Pi(H(i,5)),u=Oa(t,r),g=is(p,u,l),[h,T]=zr(o,{...i,...Bl},6,m,c,d,f),P=g-Pi(Ti(h,T)),b=0;P&&Math.sign(P)!==m?s=Ws(h,g):(b+=m,g=is(P,u,l),s=Ws(T,g));let w=yt(g);return[{...i,...w,days:i.days+b},s,Boolean(b)]}function fp(i,s,a,t,r,l,o,c,d,f){let m=as(i),p=S[t],u=Rl(t,i);t===7&&(i={...i,weeks:i.weeks+Math.trunc(i.days/7)});let g=it(i[p],r)*r;u[p]=g;let[h,T]=zr(o,u,t,r*m,c,d,f),P=g+Cr(s,h,T)*m*r,b=is(P,r,l),w=Math.sign(b-P)===m;return u[p]=b,[u,w?T:h,w]}function Wr(i,s,a,t){let[r,l,o,c]=((f)=>{let m=Zr(f=Mi(f));return[f.timeZone,...m]})(t),d=r!==void 0;return((f,m,p,u,g,h)=>{p=ht(p,g,u,1);let T=m.getOffsetNanosecondsFor(p);return Hr(ss(p,T),h)+(f?Os(Aa(T)):"Z")})(d,s(d?i(r):xs),a.epochNanoseconds,l,o,c)}function Er(i,s,a){let[t,r,l,o,c,d]=((f)=>{f=Mi(f);let m=Kl(f),p=nc(f),u=Pu(f),g=xa(f,4),h=Za(f,4);return[m,Tu(f),u,g,...$c(h,p)]})(a);return((f,m,p,u,g,h,T,P,b,w)=>{u=ht(u,b,P,1);let D=f(p).getOffsetNanosecondsFor(u);return Hr(ss(u,D),w)+Os(Aa(D),T)+((N,$)=>$!==1?"["+($===2?"!":"")+K(N)+"]":"")(p,h)+Gr(m,g)})(i,s.calendar,s.timeZone,s.epochNanoseconds,t,r,l,o,c,d)}function Jr(i,s){let[a,t,r,l]=((f)=>(f=Mi(f),[Kl(f),...Zr(f)]))(s);return o=i.calendar,c=a,d=l,Hr(Yc(i,r,t),d)+Gr(o,c);var o,c,d}function Ur(i,s){return a=i.calendar,t=i,r=jr(s),Qa(t)+Gr(a,r);var a,t,r}function _r(i,s){return Qc(i.calendar,Vc,i,jr(s))}function Br(i,s){return Qc(i.calendar,mp,i,jr(s))}function Rr(i,s){let[a,t,r]=xc(s);return l=r,kc(Nr(i,t,a)[0],l);var l}function Tt(i,s){let[a,t,r]=xc(s,3);return t>1&&(i={...i,...op(i,t,a)}),((l,o)=>{let{sign:c}=l,d=c===-1?ri(l):l,{hours:f,minutes:m}=d,[p,u]=Or(H(d,3),yi,qi);ld(p);let g=Yr(u,o),h=o>=0||!c||g;return(c<0?"-":"")+"P"+Go({Y:hs(d.years),M:hs(d.months),W:hs(d.weeks),D:hs(d.days)})+(f||m||p||h?"T"+Go({H:hs(f),M:hs(m),S:hs(p,h)+g}):"")})(i,r)}function Qc(i,s,a,t){let r=K(i),l=t>1||t===0&&r!==y;return t===1?r===y?s(a):Qa(a):l?Qa(a)+qc(r,t===2):s(a)}function Go(i){let s=[];for(let a in i){let t=i[a];t&&s.push(t,a)}return s.join("")}function Hr(i,s){return Qa(i)+"T"+kc(i,s)}function Qa(i){return Vc(i)+"-"+Oi(i.isoDay)}function Vc(i){let{isoYear:s}=i;return(s<0||s>9999?ec(s)+Ga(6,Math.abs(s)):Ga(4,s))+"-"+Oi(i.isoMonth)}function mp(i){return Oi(i.isoMonth)+"-"+Oi(i.isoDay)}function kc(i,s){let a=[Oi(i.isoHour),Oi(i.isoMinute)];return s!==-1&&a.push(Oi(i.isoSecond)+((t,r,l,o)=>Yr(t*Ii+r*Ls+l,o))(i.isoMillisecond,i.isoMicrosecond,i.isoNanosecond,s)),a.join(":")}function Os(i,s=0){if(s===1)return"";let[a,t]=Ji(Math.abs(i),Ct),[r,l]=Ji(t,zt),[o,c]=Ji(l,yi);return ec(i)+Oi(a)+":"+Oi(r)+(o||c?":"+Oi(o)+Yr(c):"")}function Gr(i,s){if(s!==1){let a=K(i);if(s>1||s===0&&a!==y)return qc(a,s===2)}return""}function qc(i,s){return"["+(s?"!":"")+"u-ca="+i+"]"}function Yr(i,s){let a=Ga(9,i);return a=s===void 0?a.replace(Ou,""):a.slice(0,s),a?"."+a:""}function ec(i){return i<0?"-":"+"}function hs(i,s){return i||s?i.toLocaleString("fullwide",{useGrouping:0}):""}function pp(i,s){let{epochNanoseconds:a}=i,t=(s.getOffsetNanosecondsFor?s:s(i.timeZone)).getOffsetNanosecondsFor(a),r=ss(a,t);return{calendar:i.calendar,...r,offsetNanoseconds:t}}function id(i,s){let a=ti(s,i);return{calendar:s.calendar,...gi(fm,a),offset:Os(a.offsetNanoseconds),timeZone:s.timeZone}}function ys(i,s,a,t=0,r=0,l,o){if(a!==void 0&&t===1&&(t===1||o))return Sr(s,a);let c=i.getPossibleInstantsFor(s);if(a!==void 0&&t!==3){let d=((f,m,p,u)=>{let g=ii(m);u&&(p=Aa(p));for(let h of f){let T=Pi(Ti(h,g));if(u&&(T=Aa(T)),T===p)return h}})(c,s,a,l);if(d!==void 0)return d;if(t===0)throw new RangeError(Jp)}return o?ii(s):ui(i,s,r,c)}function ui(i,s,a=0,t=i.getPossibleInstantsFor(s)){if(t.length===1)return t[0];if(a===1)throw new RangeError(Up);if(t.length)return t[a===3?1:0];let r=ii(s),l=((c,d)=>{let f=c.getOffsetNanosecondsFor(Ws(d,-v));return Kr(c.getOffsetNanosecondsFor(Ws(d,v))-f)})(i,r),o=l*(a===2?-1:1);return(t=i.getPossibleInstantsFor(ss(r,o)))[a===2?0:t.length-1]}function Xr(i){if(Math.abs(i)>=v)throw new RangeError(Wp);return i}function Kr(i){if(i>v)throw new RangeError(Ep);return i}function Ar(i,s,a){return Y(wi(Ns(s.epochNanoseconds,((t)=>{if(od(t))throw new RangeError(Rp);return H(t,5)})(i?ri(a):a))))}function Qr(i,s,a,t,r,l=Object.create(null)){let o=s(t.timeZone),c=i(t.calendar);return{...t,...il(o,c,t,a?ri(r):r,l)}}function Vr(i,s,a,t,r=Object.create(null)){let{calendar:l}=a;return E(sl(i(l),a,s?ri(t):t,r),l)}function kr(i,s,a,t,r){let{calendar:l}=a;return J(Pt(i(l),a,s?ri(t):t,r),l)}function qr(i,s,a,t,r=Object.create(null)){let l=a.calendar,o=i(l),c=pa(o,a);s&&(t=Ot(t)),t.sign<0&&(c=o.dateAdd(c,{...A,months:1}),c=Fs(c,-1));let d=o.dateAdd(c,t,r);return Ts(pa(o,d),l)}function er(i,s,a){return Li(sd(s,i?ri(a):a)[0])}function il(i,s,a,t,r){let l=H(t,5),o=a.epochNanoseconds;if(od(t)){let c=ti(a,i);o=Ns(ui(i,{...Pt(s,c,{...t,...Bl},r),...gi(Zi,c)}),l)}else o=Ns(o,l),F(r);return{epochNanoseconds:wi(o)}}function sl(i,s,a,t){let[r,l]=sd(s,a);return Bi({...Pt(i,s,{...a,...Bl,days:a.days+l},t),...r})}function Pt(i,s,a,t){if(a.years||a.months||a.weeks)return i.dateAdd(s,a,t);F(t);let r=a.days+H(a,5)[0];return r?Vi(Fs(s,r)):s}function pa(i,s,a=1){return Fs(s,a-i.day(s))}function sd(i,s){let[a,t]=H(s,5),[r,l]=lt(ei(i)+t);return[r,a+l]}function Fs(i,s){return s?{...i,...ot(ai(i)+s*mi)}:i}function wt(i,s,a){let t=i(a.calendar);return Dt(a)?[a,t,s(a.timeZone)]:[{...a,...Fi},t]}function al(i){return i?Wc:ii}function bt(i){return i?O(il,i):sl}function tl(i){return i?O(gp,i):hp}function Dt(i){return i&&i.epochNanoseconds}function ua(i,s){return i<=6-(Dt(s)?1:0)}function rl(i,s,a,t,r,l,o){let c=i(Mi(o).relativeTo),d=Math.max(Ps(r),Ps(l));if(ua(d,c))return x(Gs(((T,P,b,w)=>{let D=Ns(H(T),H(P),w?-1:1);if(!Number.isFinite(D[0]))throw new RangeError(nt);return{...A,...Ys(D,b)}})(r,l,d,t)));if(!c)throw new RangeError(It);t&&(l=ri(l));let[f,m,p]=wt(s,a,c),u=bt(p),g=tl(p),h=u(m,f,r);return x(g(m,f,u(m,h,l),d))}function ad(i,s,a,t,r){let l=Ps(t),[o,c,d,f,m]=((Z,n,X)=>{Z=nr(Z,qa);let B=Xl(Z),ra=X(Z[pm]),la=xr(Z),em=xa(Z,7),us=Za(Z);if(B===void 0&&us===void 0)throw new RangeError(Hp);return us==null&&(us=0),B==null&&(B=Math.max(us,n)),Ic(B,us),la=$r(la,us,1),[B,us,la,em,ra]})(r,l,i),p=Math.max(l,o);if(!Dt(m)&&p<=6)return x(Gs(((Z,n,X,B,ra)=>{let la=gt(H(Z),X,B,ra);return{...A,...Ys(la,n)}})(t,o,c,d,f)));if(!m)throw new RangeError(It);let[u,g,h]=wt(s,a,m),T=al(h),P=bt(h),b=tl(h),w=P(g,u,t),D=b(g,u,w,o),N=t.sign,$=as(D);if(N&&$&&N!==$)throw new RangeError(Ma);return $&&(D=ut(D,T(w),o,c,d,f,g,u,T,P)),x(D)}function td(i){return i.sign===-1?Ot(i):i}function Ot(i){return x(ri(i))}function ri(i){let s={};for(let a of S)s[a]=-1*i[a]||0;return s}function rd(i){return!i.sign}function as(i,s=S){let a=0;for(let t of s){let r=Math.sign(i[t]);if(r){if(a&&a!==r)throw new RangeError(Bp);a=r}}return a}function Gs(i){for(let s of kp)Di(s,i[s],-ko,ko,1);return ld(Pi(H(i),yi)),i}function ld(i){if(!Number.isSafeInteger(i))throw new RangeError(_p)}function H(i,s=6){return oc(i,s,S)}function Ys(i,s=6){let[a,t]=i,r=st(t,s,S);if(r[S[s]]+=a*(v/ni[s]),!Number.isFinite(r[S[s]]))throw new RangeError(nt);return r}function yt(i,s=5){return st(i,s,S)}function od(i){return Boolean(as(i,cm))}function Ps(i){let s=9;for(;s>0&&!i[S[s]];s--);return s}function up(i,s){return[i,s]}function Yo(i){let s=Math.floor(i/Ra)*Ra;return[s,s+Ra]}function cd(i){let s=ts(i=Ya(i));if(!s)throw new RangeError(fi(i));let a;if(s.m)a=0;else{if(!s.offset)throw new RangeError(fi(i));a=Xs(s.offset)}return s.timeZone&&dl(s.timeZone,1),Y(Sr(ct(s),a))}function dd(i){let s=ts(I(i));if(!s)throw new RangeError(fi(i));if(s.timeZone)return wd(s,s.offset?Xs(s.offset):void 0);if(s.m)throw new RangeError(fi(i));return Dd(s)}function fd(i,s){let a=ts(I(i));if(!a||!a.timeZone)throw new RangeError(fi(i));let{offset:t}=a,r=t?Xs(t):void 0,[,l,o]=Da(s);return wd(a,r,l,o)}function Xs(i){let s=dl(i);if(s===void 0)throw new RangeError(fi(i));return s}function md(i){let s=ts(I(i));if(!s||s.m)throw new RangeError(fi(i));return E(bd(s))}function Ft(i){let s=ts(I(i));if(!s||s.m)throw new RangeError(fi(i));return J(s.p?bd(s):Dd(s))}function pd(i,s){let a=ol(I(s));if(a)return ll(a),Ts(Fr(bs(a)));let t=Ft(s);return Ts(pa(i(t.calendar),t))}function ll(i){if(i.calendar!==y)throw new RangeError(Ui(i.calendar))}function ud(i,s){let a=cl(I(s));if(a)return ll(a),Ka(bs(a));let t=Ft(s),{calendar:r}=t,l=i(r),[o,c,d]=l.h(t),[f,m]=l.I(o,c),[p,u]=l.N(f,m,d);return Ka(Vi(l.P(p,u,d)),r)}function gd(i){let s,a=((t)=>{let r=Mu.exec(t);return r?(St(r[10]),Fd(r)):void 0})(I(i));if(!a){if(a=ts(i),!a)throw new RangeError(fi(i));if(!a.p)throw new RangeError(fi(i));if(a.m)throw new RangeError(Ui("Z"));ll(a)}if((s=ol(i))&&Ro(s))throw new RangeError(fi(i));if((s=cl(i))&&Ro(s))throw new RangeError(fi(i));return Li(dt(a,1))}function hd(i){let s=((a)=>{let t=Zu.exec(a);return t?((r)=>{function l(m,p,u){let g=0,h=0;if(u&&([g,d]=Ji(d,ni[u])),m!==void 0){if(c)throw new RangeError(Ui(m));h=((T)=>{let P=parseInt(T);if(!Number.isFinite(P))throw new RangeError(Ui(T));return P})(m),o=1,p&&(d=fl(p)*(ni[u]/yi),c=1)}return g+h}let o=0,c=0,d=0,f={..._s(S,[l(r[2]),l(r[3]),l(r[4]),l(r[5]),l(r[6],r[7],5),l(r[8],r[9],4),l(r[10],r[11],3)]),...st(d,2,S)};if(!o)throw new RangeError(_f(S));return ml(r[1])<0&&(f=ri(f)),f})(t):void 0})(I(i));if(!s)throw new RangeError(fi(i));return x(Gs(s))}function Td(i){let s=ts(i)||ol(i)||cl(i);return s?s.calendar:i}function Pd(i){let s=ts(i);return s&&(s.timeZone||s.m&&xs||s.offset)||i}function wd(i,s,a=0,t=0){let r=vt(i.timeZone),l=Bt(r);return Q(ys(l,ct(i),s,a,t,!l.v,i.m),r,ya(i.calendar))}function bd(i){return Od(Bi(ct(i)))}function Dd(i){return Od(Vi(bs(i)))}function Od(i){return{...i,calendar:ya(i.calendar)}}function ts(i){let s=vu.exec(i);return s?((a)=>{let t=a[10],r=(t||"").toUpperCase()==="Z";return{isoYear:yd(a),isoMonth:parseInt(a[4]),isoDay:parseInt(a[5]),...Fd(a.slice(5)),...St(a[16]),p:Boolean(a[6]),m:r,offset:r?void 0:t}})(s):void 0}function ol(i){let s=Fu.exec(i);return s?((a)=>({isoYear:yd(a),isoMonth:parseInt(a[4]),isoDay:1,...St(a[5])}))(s):void 0}function cl(i){let s=Su.exec(i);return s?((a)=>({isoYear:Us,isoMonth:parseInt(a[1]),isoDay:parseInt(a[2]),...St(a[3])}))(s):void 0}function dl(i,s){let a=Lu.exec(i);return a?((t,r)=>{let l=t[4]||t[5];if(r&&l)throw new RangeError(Ui(l));return Xr((Cs(t[2])*Ct+Cs(t[3])*zt+Cs(t[4])*yi+fl(t[5]||""))*ml(t[1]))})(a,s):void 0}function yd(i){let s=ml(i[1]),a=parseInt(i[2]||i[3]);if(s<0&&!a)throw new RangeError(Ui(-0));return s*a}function Fd(i){let s=Cs(i[3]);return{...lt(fl(i[4]||""))[0],isoHour:Cs(i[1]),isoMinute:Cs(i[2]),isoSecond:s===60?59:s}}function St(i){let s,a,t=[];if(i.replace(ju,(r,l,o)=>{let c=Boolean(l),[d,f]=o.split("=").reverse();if(f){if(f==="u-ca")t.push(d),s||(s=c);else if(c||/[A-Z]/.test(f))throw new RangeError(Ui(r))}else{if(a)throw new RangeError(Ui(r));a=d}return""}),t.length>1&&s)throw new RangeError(Ui(i));return{timeZone:a,calendar:t[0]||y}}function fl(i){return parseInt(i.padEnd(9,"0"))}function Ks(i){return new RegExp(`^${i}\$`,"i")}function ml(i){return i&&i!=="+"?-1:1}function Cs(i){return i===void 0?0:parseInt(i)}function Sd(i){return vt(I(i))}function vt(i){let s=pl(i);return typeof s=="number"?Os(s):s?((a)=>{if($u.test(a))throw new RangeError(Np);return a.toLowerCase().split("/").map((t,r)=>(t.length<=3||/\d/.test(t))&&!/etc|yap/.test(t)?t.toUpperCase():t.replace(/baja|dumont|[a-z]+/g,(l,o)=>l.length<=2&&!r||l==="in"||l==="chat"?l.toUpperCase():l.length>2||!o?_o(l).replace(/island|noronha|murdo|rivadavia|urville/,_o):l)).join("/")})(i):xs}function Xo(i){let s=pl(i);return typeof s=="number"?s:s?s.resolvedOptions().timeZone:xs}function pl(i){let s=dl(i=i.toUpperCase(),1);return s!==void 0?s:i!==xs?xu(i):void 0}function ul(i,s){return si(i.epochNanoseconds,s.epochNanoseconds)}function gl(i,s){return si(i.epochNanoseconds,s.epochNanoseconds)}function vd(i,s,a,t,r,l){let o=i(Mi(l).relativeTo),c=Math.max(Ps(t),Ps(r));if(rc(S,t,r))return 0;if(ua(c,o))return si(H(t),H(r));if(!o)throw new RangeError(It);let[d,f,m]=wt(s,a,o),p=al(m),u=bt(m);return si(p(u(f,d,t)),p(u(f,d,r)))}function hl(i,s){return Ss(i,s)||Mt(i,s)}function Ss(i,s){return Qi(ai(i),ai(s))}function Mt(i,s){return Qi(ei(i),ei(s))}function Md(i,s){return!ul(i,s)}function Ld(i,s){return!gl(i,s)&&!!Lt(i.timeZone,s.timeZone)&&Hs(i.calendar,s.calendar)}function jd(i,s){return!hl(i,s)&&Hs(i.calendar,s.calendar)}function Zd(i,s){return!Ss(i,s)&&Hs(i.calendar,s.calendar)}function xd(i,s){return!Ss(i,s)&&Hs(i.calendar,s.calendar)}function $d(i,s){return!Ss(i,s)&&Hs(i.calendar,s.calendar)}function nd(i,s){return!Mt(i,s)}function Lt(i,s){if(i===s)return 1;let a=K(i),t=K(s);if(a===t)return 1;try{return Xo(a)===Xo(t)}catch(r){}}function Tl(i,s,a,t){let r=Rs(i,W(t),3,5),l=jt(s.epochNanoseconds,a.epochNanoseconds,...r);return x(i?ri(l):l)}function Pl(i,s,a,t,r,l){let o=xt(t.calendar,r.calendar),c=W(l),[d,f,m,p]=Rs(a,c,5),u=t.epochNanoseconds,g=r.epochNanoseconds,h=si(g,u),T;if(h)if(d<6)T=jt(u,g,d,f,m,p);else{let P=s(((w,D)=>{if(!Lt(w,D))throw new RangeError(Xf);return w})(t.timeZone,r.timeZone)),b=i(o);T=zd(b,P,t,r,h,d,c),T=ut(T,g,d,f,m,p,b,t,Wc,O(il,P))}else T=A;return x(a?ri(T):T)}function wl(i,s,a,t,r){let l=xt(a.calendar,t.calendar),o=W(r),[c,d,f,m]=Rs(s,o,6),p=ii(a),u=ii(t),g=si(u,p),h;if(g)if(c<=6)h=jt(p,u,c,d,f,m);else{let T=i(l);h=Cd(T,a,t,g,c,o),h=ut(h,u,c,d,f,m,T,a,ii,sl)}else h=A;return x(s?ri(h):h)}function bl(i,s,a,t,r){let l=xt(a.calendar,t.calendar),o=W(r);return Id(s,()=>i(l),a,t,...Rs(s,o,6,9,6),o)}function Dl(i,s,a,t,r){let l=xt(a.calendar,t.calendar),o=W(r),c=Rs(s,o,9,9,8),d=i(l);return Id(s,()=>d,pa(d,a),pa(d,t),...c,o)}function Id(i,s,a,t,r,l,o,c,d){let f=ii(a),m=ii(t),p;if(si(m,f))if(r===6)p=jt(f,m,r,l,o,c);else{let u=s();p=u.dateUntil(a,t,r,d),l===6&&o===1||(p=ut(p,m,r,l,o,c,u,a,ii,Pt))}else p=A;return x(i?ri(p):p)}function Ol(i,s,a,t){let r=W(t),[l,o,c,d]=Rs(i,r,5,5),f=is(yl(s,a),Oa(o,c),d),m={...A,...yt(f,l)};return x(i?ri(m):m)}function gp(i,s,a,t,r,l){let o=si(t.epochNanoseconds,a.epochNanoseconds);return o?r<6?Nd(a.epochNanoseconds,t.epochNanoseconds,r):zd(s,i,a,t,o,r,l):A}function hp(i,s,a,t,r){let l=ii(s),o=ii(a),c=si(o,l);return c?t<=6?Nd(l,o,t):Cd(i,s,a,c,t,r):A}function zd(i,s,a,t,r,l,o){let[c,d,f]=((u,g,h,T)=>{function P(){return n={...Fs(D,$++*-T),...w},X=ui(u,n),si(N,X)===-T}let b=ti(g,u),w=gi(Zi,b),D=ti(h,u),N=h.epochNanoseconds,$=0,Z=yl(b,D),n,X;if(Math.sign(Z)===-T&&$++,P()&&(T===-1||P()))throw new RangeError(Ma);let B=Pi(Ti(X,N));return[b,n,B]})(s,a,t,r);var m,p;return{...l===6?(m=c,p=d,{...A,days:Wd(m,p)}):i.dateUntil(c,d,l,o),...yt(f)}}function Cd(i,s,a,t,r,l){let[o,c,d]=((f,m,p)=>{let u=m,g=yl(f,m);return Math.sign(g)===-p&&(u=Fs(m,-p),g+=v*p),[f,u,g]})(s,a,t);return{...i.dateUntil(o,c,r,l),...yt(d)}}function jt(i,s,a,t,r,l){return{...A,...Ys(gt(Ti(i,s),t,r,l),a)}}function Nd(i,s,a){return{...A,...Ys(Ti(i,s),a)}}function Wd(i,s){return Zt(ai(i),ai(s))}function Zt(i,s){return Math.trunc((s-i)/mi)}function yl(i,s){return ei(s)-ei(i)}function xt(i,s){if(!Hs(i,s))throw new RangeError(Wl);return i}function Tp(i){function s(r){return((l,o)=>({...Ed(l,o),F:l.month,day:parseInt(l.day)}))(yr(a,r),t)}let a=kl(i),t=Va(i);return{id:i,O:Pp(s),B:wp(s)}}function Pp(i){return pi((s)=>{let a=ai(s);return i(a)},WeakMap)}function wp(i){let s=i(0).year-tu;return pi((a)=>{let t,r=Bs(a-s),l=[],o=[];do r+=400*mi;while((t=i(r)).year<=a);do r+=(1-t.day)*mi,t.year===a&&(l.push(r),o.push(t.F)),r-=mi;while((t=i(r)).year>=a);return{k:l.reverse(),C:Qf(o.reverse())}})}function Ed(i,s){let a,t,r=Jd(i);if(i.era){let l=rm[s];l!==void 0&&(a=s==="islamic"?"ah":i.era.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g,""),a==="bc"||a==="b"?a="bce":a!=="ad"&&a!=="a"||(a="ce"),t=r,r=Hd(t,l[a]||0))}return{era:a,eraYear:t,year:r}}function Jd(i){return parseInt(i.relatedYear||i.year)}function lr(i){let{year:s,F:a,day:t}=this.O(i),{C:r}=this.B(s);return[s,r[a]+1,t]}function ga(i,s=1,a=1){return this.B(i).k[s-1]+(a-1)*mi}function Ua(i){let s=Ao(this,i),a=Ao(this,i-1),t=s.length;if(t>a.length){let r=Gd(this);if(r<0)return-r;for(let l=0;l<t;l++)if(s[l]!==a[l])return l+1}}function _a(i){return Zt(ga.call(this,i),ga.call(this,i+1))}function Ko(i,s){let{k:a}=this.B(i),t=s+1,r=a;return t>a.length&&(t=1,r=this.B(i+1).k),Zt(a[s-1],r[t-1])}function Ba(i){return this.B(i).k.length}function Ao(i,s){return Object.keys(i.B(s).C)}function Ud(i){return ya(I(i))}function ya(i){if((i=i.toLowerCase())!==y&&i!==Wt&&Va(i)!==Va(kl(i).resolvedOptions().calendar))throw new RangeError(Cp(i));return i}function Va(i){return i==="islamicc"&&(i="islamic"),i.split("-")[0]}function _d(i){return this.R(i)[0]}function Bd(i){return this.R(i)[1]}function Fl(i){let[s]=this.h(i);return Zt(this.q(s),ai(i))+1}function Rd(i){let s=Iu.exec(i);if(!s)throw new RangeError(Ip(i));return[parseInt(s[1]),Boolean(s[2])]}function ka(i,s,a){return i+(s||a&&i>=a?1:0)}function or(i,s){return i-(s&&i>=s?1:0)}function Hd(i,s){return(s+i)*(Math.sign(s)||1)||0}function cr(i){return rm[Yd(i)]}function Gd(i){return Ap[Yd(i)]}function Yd(i){return Va(i.id||y)}function Xd(i,s,a,t){let r=rs(a,t,ji,[],im);if(r.timeZone!==void 0){let l=a.dateFromFields(r),o=vs(r),c=i(r.timeZone);return{epochNanoseconds:ys(s(c),{...l,...o},r.offset!==void 0?Xs(r.offset):void 0),timeZone:c}}return{...a.dateFromFields(r),...Fi}}function Kd(i,s,a,t,r,l){let o=rs(a,r,ji,qf,im),c=i(o.timeZone),[d,f,m]=Da(l),p=a.dateFromFields(o,mt(l,d)),u=vs(o,d);return Q(ys(s(c),{...p,...u},o.offset!==void 0?Xs(o.offset):void 0,f,m),c,t)}function Ad(i,s,a){let t=rs(i,s,ji,[],Gi),r=F(a);return E(Bi({...i.dateFromFields(t,mt(a,r)),...vs(t,r)}))}function Sl(i,s,a,t=[]){let r=rs(i,s,ji,t);return i.dateFromFields(r,a)}function vl(i,s,a,t){let r=rs(i,s,Ul,t);return i.yearMonthFromFields(r,a)}function Ml(i,s,a,t,r=[]){let l=rs(i,a,ji,r);return s&&l.month!==void 0&&l.monthCode===void 0&&l.year===void 0&&(l.year=Us),i.monthDayFromFields(l,t)}function Qd(i,s){let a=F(s);return Li(vs($i(i,fr,[],1),a))}function Vd(i){let s=$i(i,_l);return x(Gs({...A,...s}))}function rs(i,s,a,t=[],r=[]){return $i(s,[...i.fields(a),...r].sort(),t)}function $i(i,s,a,t=!a){let r={},l,o=0;for(let c of s){if(c===l)throw new RangeError(Lp(c));if(c==="constructor"||c==="__proto__")throw new RangeError(Cl(c));let d=i[c];if(d!==void 0)o=1,qo[c]&&(d=qo[c](d,c)),r[c]=d;else if(a){if(a.includes(c))throw new TypeError(zl(c));r[c]=tm[c]}l=c}if(t&&!o)throw new TypeError(_f(s));return r}function vs(i,s){return dt(Wu({...tm,...i}),s)}function kd(i,s,a,t,r,l){let o=W(l),{calendar:c,timeZone:d}=a;return Q(((f,m,p,u,g)=>{let h=Fa(f,p,u,ji,ef,kf),[T,P,b]=Da(g,2);return ys(m,{...f.dateFromFields(h,mt(g,T)),...vs(h,T)},Xs(h.offset),P,b)})(i(c),s(d),t,r,o),d,c)}function qd(i,s,a,t,r){let l=W(r);return E(((o,c,d,f)=>{let m=Fa(o,c,d,ji,Gi),p=F(f);return Bi({...o.dateFromFields(m,mt(f,p)),...vs(m,p)})})(i(s.calendar),a,t,l))}function ed(i,s,a,t,r){let l=W(r);return((o,c,d,f)=>{let m=Fa(o,c,d,ji);return o.dateFromFields(m,f)})(i(s.calendar),a,t,l)}function sf(i,s,a,t,r){let l=W(r);return Ts(((o,c,d,f)=>{let m=Fa(o,c,d,Ul);return o.yearMonthFromFields(m,f)})(i(s.calendar),a,t,l))}function af(i,s,a,t,r){let l=W(r);return((o,c,d,f)=>{let m=Fa(o,c,d,ji);return o.monthDayFromFields(m,f)})(i(s.calendar),a,t,l)}function tf(i,s,a){return Li(((t,r,l)=>{let o=F(l);return vs({...gi(fr,t),...$i(r,fr)},o)})(i,s,a))}function rf(i,s){return x((a=i,t=s,Gs({...a,...$i(t,_l)})));var a,t}function Fa(i,s,a,t,r=[],l=[]){let o=[...i.fields(t),...r].sort(),c=$i(s,o,l),d=$i(a,o);return c=i.mergeFields(c,d),$i(c,o,[])}function Ll(i,s){let a=rs(i,s,am);return i.monthDayFromFields(a)}function jl(i,s,a){let t=rs(i,s,sm);return i.yearMonthFromFields(t,a)}function lf(i,s,a,t,r){s=gi(a=i.fields(a),s),t=$i(t,r=i.fields(r),[]);let l=i.mergeFields(s,t);return l=$i(l,[...a,...r].sort(),[]),i.dateFromFields(l)}function ir(i,s){let{era:a,eraYear:t,year:r}=s,l=cr(i);if(a!==void 0||t!==void 0){if(a===void 0||t===void 0)throw new TypeError(Zp);if(!l)throw new RangeError(jp);let o=l[a];if(o===void 0)throw new RangeError($p(a));let c=Hd(t,o);if(r!==void 0&&r!==c)throw new RangeError(xp);r=c}else if(r===void 0)throw new TypeError(np(l));return r}function sr(i,s,a,t){let{month:r,monthCode:l}=s;if(l!==void 0){let o=((c,d,f,m)=>{let p=c.U(f),[u,g]=Rd(d),h=ka(u,g,p);if(g){let T=Gd(c);if(T===void 0)throw new RangeError(da);if(T>0){if(h>T)throw new RangeError(da);if(p===void 0){if(m===1)throw new RangeError(da);h--}}else{if(h!==-T)throw new RangeError(da);if(p===void 0&&m===1)throw new RangeError(da)}}return h})(i,l,a,t);if(r!==void 0&&r!==o)throw new RangeError(Gf);r=o,t=1}else if(r===void 0)throw new TypeError(zp);return Di("month",r,1,i.L(a),t)}function Qo(i,s,a,t,r){return di(s,"day",1,i.j(t,a),r)}function ar(i,s,a,t){let r=0,l=[];for(let o of a)s[o]!==void 0?r=1:l.push(o);if(Object.assign(i,s),r)for(let o of t||l)delete i[o]}function of(i){return Y(wi(rt(tt(i))))}function cf(i,s,a,t,r=y){return Q(wi(rt(tt(a))),s(t),i(r))}function df(i,s,a,t,r=0,l=0,o=0,c=0,d=0,f=0,m=y){return E(Bi(ct(Si(e,_s(Et,[s,a,t,r,l,o,c,d,f])))),i(m))}function ff(i,s,a,t,r=y){return J(Vi(bs(Si(e,{isoYear:s,isoMonth:a,isoDay:t}))),i(r))}function mf(i,s,a,t=y,r=1){let l=e(s),o=e(a),c=i(t);return Ts(Fr(bs({isoYear:l,isoMonth:o,isoDay:e(r)})),c)}function pf(i,s,a,t=y,r=Us){let l=e(s),o=e(a),c=i(t);return Ka(Vi(bs({isoYear:e(r),isoMonth:l,isoDay:o})),c)}function uf(i=0,s=0,a=0,t=0,r=0,l=0){return Li(dt(Si(e,_s(Zi,[i,s,a,t,r,l])),1))}function gf(i=0,s=0,a=0,t=0,r=0,l=0,o=0,c=0,d=0,f=0){return x(Gs(Si(Pc,_s(S,[i,s,a,t,r,l,o,c,d,f]))))}function Zl(i,s,a=y){return Q(i.epochNanoseconds,s,a)}function hf(i){return Y(i.epochNanoseconds)}function xl(i,s){return E(ti(s,i))}function $l(i,s){return J(ti(s,i))}function Tf(i,s,a){return jl(i(s.calendar),a)}function Pf(i,s,a){return Ll(i(s.calendar),a)}function nl(i,s){return Li(ti(s,i))}function wf(i,s,a,t){let r=((l,o,c,d)=>{let f=Lr(d);return ui(l(o),c,f)})(i,a,s,t);return Q(wi(r),a,s.calendar)}function bf(i,s,a){let t=i(s.calendar);return Ts({...s,...jl(t,a)})}function Df(i,s,a){return Ll(i(s.calendar),a)}function Of(i,s,a,t,r){let l=i(r.timeZone),o=r.plainTime,c=o!==void 0?s(o):Fi;return Q(ui(a(l),{...t,...c}),l,t.calendar)}function yf(i,s=Fi){return E(Bi({...i,...s}))}function Ff(i,s,a){return jl(i(s.calendar),a)}function Sf(i,s,a){return Ll(i(s.calendar),a)}function vf(i,s,a,t){return((r,l,o)=>lf(r,l,sm,_i(o),ja))(i(s.calendar),a,t)}function Mf(i,s,a,t){return((r,l,o)=>lf(r,l,am,_i(o),Nt))(i(s.calendar),a,t)}function Lf(i,s,a,t,r){let l=_i(r),o=s(l.plainDate),c=i(l.timeZone);return Q(ui(a(c),{...o,...t}),c,o.calendar)}function jf(i,s){return E(Bi({...i,...s}))}function Zf(i){return Y(wi(Es(i,yi)))}function xf(i){return Y(wi(Es(i,Ii)))}function $f(i){return Y(wi(rt(tt(i),Ls)))}function nf(i){return Y(wi(rt(tt(i))))}function If(i,s,a=Fi){let t=s.timeZone,r=i(t),l={...ti(s,r),...a};return Q(ys(r,l,l.offsetNanoseconds,2),t,s.calendar)}function zf(i,s,a){let t=s.timeZone,r=i(t),l={...ti(s,r),...a},o=Ef(s.calendar,a.calendar);return Q(ys(r,l,l.offsetNanoseconds,2),t,o)}function Cf(i,s=Fi){return E({...i,...s})}function Nf(i,s){return E({...i,...s},Ef(i.calendar,s.calendar))}function $t(i,s){return{...i,calendar:s}}function Wf(i,s){return{...i,timeZone:s}}function Ef(i,s){if(i===s)return i;let a=K(i),t=K(s);if(a===t||a===y)return s;if(t===y)return i;throw new RangeError(Wl)}function bp(i,s){return(a)=>a===y?i:a===Wt||a===Js?Object.assign(Object.create(i),{id:a}):Object.assign(Object.create(s),nu(a))}function Ms(i,s,a){let t=new Set(a);return(r)=>(((l,o)=>{for(let c of o)if(c in l)return 1;return 0})(r=gr(t,r),i)||Object.assign(r,s),a&&(r.timeZone=xs,["full","long"].includes(r.timeStyle)&&(r.timeStyle="medium")),r)}function Ri(i,s=Il){let[a,,,t]=i;return(r,l=qu,...o)=>{let c=s(t&&t(...o),r,l,a),d=c.resolvedOptions();return[c,...Dp(i,d,o)]}}function Il(i,s,a,t){if(a=t(a),i){if(a.timeZone!==void 0)throw new TypeError(Yp);a.timeZone=i}return new ls(s,a)}function Dp(i,s,a){let[,t,r]=i;return a.map((l)=>(l.calendar&&((o,c,d)=>{if((d||o!==y)&&o!==c)throw new RangeError(Wl)})(K(l.calendar),s.calendar,r),t(l,s)))}function As(i){let s=Sa();return ss(s,i.getOffsetNanosecondsFor(s))}function Sa(){return Es(Date.now(),Ii)}function Hi(){return ic||(ic=new ls().resolvedOptions().timeZone)}var Op=(i,s)=>`Non-integer ${i}: ${s}`,yp=(i,s)=>`Non-positive ${i}: ${s}`,Fp=(i,s)=>`Non-finite ${i}: ${s}`,Sp=(i)=>`Cannot convert bigint to ${i}`,vp=(i)=>`Invalid bigint: ${i}`,Mp="Cannot convert Symbol to string",Jf="Invalid object",Uf=(i,s,a,t,r)=>r?Uf(i,r[s],r[a],r[t]):va(i,s)+`; must be between ${a}-${t}`,va=(i,s)=>`Invalid ${i}: ${s}`,zl=(i)=>`Missing ${i}`,Cl=(i)=>`Invalid field ${i}`,Lp=(i)=>`Duplicate field ${i}`,_f=(i)=>"No valid fields: "+i.join(),Bf="Invalid bag",Rf=(i,s,a)=>va(i,s)+"; must be "+Object.keys(a).join(),Hf="Cannot use valueOf",Nl="Invalid calling context",jp="Forbidden era/eraYear",Zp="Mismatching era/eraYear",xp="Mismatching year/eraYear",$p=(i)=>`Invalid era: ${i}`,np=(i)=>"Missing year"+(i?"/era/eraYear":""),Ip=(i)=>`Invalid monthCode: ${i}`,Gf="Mismatching month/monthCode",zp="Missing month/monthCode",Vo="Cannot guess year",da="Invalid leap month",Yf="Invalid protocol",Ma="Invalid protocol results",Wl="Mismatching Calendars",Cp=(i)=>`Invalid Calendar: ${i}`,Xf="Mismatching TimeZones",Np="Forbidden ICU TimeZone",Wp="Out-of-bounds offset",Ep="Out-of-bounds TimeZone gap",Jp="Invalid TimeZone offset",Up="Ambiguous offset",nt="Out-of-bounds date",_p="Out-of-bounds duration",Bp="Cannot mix duration signs",It="Missing relativeTo",Rp="Cannot use large units",Hp="Required smallestUnit or largestUnit",Gp="smallestUnit > largestUnit",fi=(i)=>`Cannot parse: ${i}`,Ui=(i)=>`Invalid substring: ${i}`,Kf=(i)=>`Cannot format ${i}`,Af="Mismatching types for formatting",Yp="Cannot specify TimeZone",Qf=O(Pa,(i,s)=>s),Qs=O(Pa,(i,s,a)=>a),Oi=O(Ga,2),dr={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},La=Object.keys(dr),mi=86400000,Vf=1000,Ls=1000,Ii=1e6,yi=1e9,zt=60000000000,Ct=3600000000000,v=86400000000000,ni=[1,Ls,Ii,yi,zt,Ct,v],Gi=La.slice(0,6),fr=wa(Gi),kf=["offset"],qf=["timeZone"],ef=Gi.concat(kf),im=ef.concat(qf),mr=["era","eraYear"],Xp=mr.concat(["year"]),Nt=["year"],El=["monthCode"],Jl=["month"].concat(El),ja=["day"],Ul=Jl.concat(Nt),sm=El.concat(Nt),ji=ja.concat(Ul),Kp=ja.concat(Jl),am=ja.concat(El),tm=Qs(Gi,0),y="iso8601",Wt="gregory",Js="japanese",rm={[Wt]:{bce:-1,ce:0},[Js]:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018},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}},Ap={chinese:13,dangi:13,hebrew:-6},I=O(at,"string"),lm=O(at,"boolean"),Qp=O(at,"number"),om=O(at,"function"),S=La.map((i)=>i+"s"),_l=wa(S),Vp=S.slice(0,6),cm=S.slice(6),kp=cm.slice(1),qp=Qf(S),A=Qs(S,0),Bl=Qs(Vp,0),Rl=O(lc,S),Zi=["isoNanosecond","isoMicrosecond","isoMillisecond","isoSecond","isoMinute","isoHour"],Hl=["isoDay","isoMonth","isoYear"],Et=Zi.concat(Hl),Gl=wa(Hl),dm=wa(Zi),fm=wa(Et),Fi=Qs(dm,0),ep=O(lc,Et),ls=Intl.DateTimeFormat,mm="en-GB",Yl=1e8,iu=Yl*mi,su=[Yl,0],au=[-Yl,0],ha=275760,Ta=-271821,tu=1970,Us=1972,Ei=12,ru=Bs(1868,9,8),lu=pi(lp,WeakMap),qa="smallestUnit",pr="unit",ma="roundingIncrement",tr="fractionalSecondDigits",pm="relativeTo",um={constrain:0,reject:1},ou=Object.keys(um),cu={compatible:0,reject:1,earlier:2,later:3},du={reject:0,use:1,prefer:2,ignore:3},fu={auto:0,never:1,critical:2,always:3},mu={auto:0,never:1,critical:2},pu={auto:0,never:1},uu={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},Za=O(Ir,qa),Xl=O(Ir,"largestUnit"),gu=O(Ir,pr),gm=O(Ds,"overflow",um),hm=O(Ds,"disambiguation",cu),hu=O(Ds,"offset",du),Kl=O(Ds,"calendarName",fu),Tu=O(Ds,"timeZoneName",mu),Pu=O(Ds,"offset",pu),xa=O(Ds,"roundingMode",uu),Vs="PlainYearMonth",ks="PlainMonthDay",js="PlainDate",Zs="PlainDateTime",Jt="PlainTime",Yi="ZonedDateTime",Ut="Instant",_t="Duration",wu=[Math.floor,(i)=>Ja(i)?Math.floor(i):Math.round(i),Math.ceil,(i)=>Ja(i)?Math.ceil(i):Math.round(i),Math.trunc,(i)=>Ja(i)?Math.trunc(i)||0:Math.round(i),(i)=>i<0?Math.floor(i):Math.ceil(i),(i)=>Math.sign(i)*Math.round(Math.abs(i))||0,(i)=>Ja(i)?(i=Math.trunc(i)||0)+i%2:Math.round(i)],xs="UTC",Ra=5184000,bu=Xa(1847),Du=Xa(new Date().getUTCFullYear()+10),Ou=/0+$/,ti=pi(pp,WeakMap),ko=4294967295,Bt=pi((i)=>{let s=pl(i);return typeof s=="object"?new Pm(s):new Tm(s||0)});class Tm{constructor(i){this.v=i}getOffsetNanosecondsFor(){return this.v}getPossibleInstantsFor(i){return[Sr(i,this.v)]}l(){}}class Pm{constructor(i){this.$=((s)=>{function a(d){let f=rr(d,o,c),[m,p]=Yo(f),u=r(m),g=r(p);return u===g?u:t(l(m,p),u,g,d)}function t(d,f,m,p){let u,g;for(;(p===void 0||(u=p<d[0]?f:p>=d[1]?m:void 0)===void 0)&&(g=d[1]-d[0]);){let h=d[0]+Math.floor(g/2);s(h)===m?d[1]=h:d[0]=h+1}return u}let r=pi(s),l=pi(up),o=bu,c=Du;return{G(d){let f=a(d-86400),m=a(d+86400),p=d-f,u=d-m;if(f===m)return[p];let g=a(p);return g===a(u)?[d-g]:f>m?[p,u]:[]},V:a,l(d,f){let m=rr(d,o,c),[p,u]=Yo(m),g=Ra*f,h=f<0?()=>u>o||(o=m,0):()=>p<c||(c=m,0);for(;h();){let T=r(p),P=r(u);if(T!==P){let b=l(p,u);t(b,T,P);let w=b[0];if((Qi(w,d)||1)===f)return w}p+=g,u+=g}}}})(((s)=>(a)=>{let t=yr(s,a*Vf);return Xa(Jd(t),parseInt(t.month),parseInt(t.day),parseInt(t.hour),parseInt(t.minute),parseInt(t.second))-a})(i))}getOffsetNanosecondsFor(i){return this.$.V(Dc(i))*yi}getPossibleInstantsFor(i){let[s,a]=[Xa((t=i).isoYear,t.isoMonth,t.isoDay,t.isoHour,t.isoMinute,t.isoSecond),t.isoMillisecond*Ii+t.isoMicrosecond*Ls+t.isoNanosecond];var t;return this.$.G(s).map((r)=>wi(Ws(Es(r,yi),a)))}l(i,s){let[a,t]=Oc(i),r=this.$.l(a+(s>0||t?1:0),s);if(r!==void 0)return Es(r,yi)}}var Al="([+\u2212-])",Ha="(?:[.,](\\d{1,9}))?",wm=`(?:(?:${Al}(\\d{6}))|(\\d{4}))-?(\\d{2})`,Ql="(\\d{2})(?::?(\\d{2})(?::?(\\d{2})"+Ha+")?)?",Vl=Al+Ql,yu=wm+"-?(\\d{2})(?:[T ]"+Ql+"(Z|"+Vl+")?)?",bm="\\[(!?)([^\\]]*)\\]",Rt=`((?:${bm}){0,9})`,Fu=Ks(wm+Rt),Su=Ks("(?:--)?(\\d{2})-?(\\d{2})"+Rt),vu=Ks(yu+Rt),Mu=Ks("T?"+Ql+"(?:"+Vl+")?"+Rt),Lu=Ks(Vl),ju=new RegExp(bm,"g"),Zu=Ks(`${Al}?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)${Ha}H)?(?:(\\d+)${Ha}M)?(?:(\\d+)${Ha}S)?)?`),xu=pi((i)=>new ls(mm,{timeZone:i,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),$u=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,nu=pi(Tp),kl=pi((i)=>new ls(mm,{calendar:i,timeZone:xs,era:"short",year:"numeric",month:"short",day:"numeric"})),Iu=/^M(\d{2})(L?)$/,zu={era:Ya,eraYear:e,year:e,month:Bo,monthCode:Ya,day:Bo},Cu=Qs(Gi,e),Nu=Qs(S,Pc),qo=Object.assign({},zu,Cu,Nu,{offset:Ya}),Wu=O(rp,Gi,Zi),eo={dateAdd(i,s,a){let t=F(a),r,{years:l,months:o,weeks:c,days:d}=s;if(d+=H(s,5)[0],l||o)r=((f,m,p,u,g)=>{let[h,T,P]=f.h(m);if(p){let[b,w]=f.I(h,T);h+=p,T=ka(b,w,f.U(h)),T=Di("month",T,1,f.L(h),g)}return u&&([h,T]=f._(h,T,u)),P=Di("day",P,1,f.j(h,T),g),f.q(h,T,P)})(this,i,l,o,t);else{if(!c&&!d)return i;r=ai(i)}return r+=(7*c+d)*mi,Vi(ot(r))},dateUntil(i,s,a){if(a<=7){let d=0,f=Wd({...i,...Fi},{...s,...Fi});return a===7&&([d,f]=qi(f,7)),{...A,weeks:d,days:f}}let t=this.h(i),r=this.h(s),[l,o,c]=((d,f,m,p,u,g,h)=>{let T=u-f,P=g-m,b=h-p;if(T||P){let w=Math.sign(T||P),D=d.j(u,g),N=0;if(Math.sign(b)===-w){let $=D;[u,g]=d._(u,g,-w),T=u-f,P=g-m,D=d.j(u,g),N=w<0?-$:D}if(b=h-Math.min(p,D)+N,T){let[$,Z]=d.I(f,m),[n,X]=d.I(u,g);if(P=n-$||Number(X)-Number(Z),Math.sign(P)===-w){let B=w<0&&-d.L(u);T=(u-=w)-f,P=g-ka($,Z,d.U(u))+(B||d.L(u))}}}return[T,P,b]})(this,...t,...r);return a===8&&(o+=this.J(l,t[0]),l=0),{...A,years:l,months:o,days:c}},dateFromFields(i,s){let a=F(s),t=ir(this,i),r=sr(this,i,t,a),l=Qo(this,i,r,t,a);return J(Vi(this.P(t,r,l)),this.id||y)},yearMonthFromFields(i,s){let a=F(s),t=ir(this,i),r=sr(this,i,t,a);return Ts(Fr(this.P(t,r,1)),this.id||y)},monthDayFromFields(i,s){let a=F(s),t=!this.id,{monthCode:r,year:l,month:o}=i,c,d,f,m,p;if(r!==void 0){[c,d]=Rd(r),p=sc(i,"day");let u=this.N(c,d,p);if(!u)throw new RangeError(Vo);if([f,m]=u,o!==void 0&&o!==m)throw new RangeError(Gf);t&&(m=Di("month",m,1,Ei,1),p=Di("day",p,1,vr(l!==void 0?l:f,m),a))}else{f=l===void 0&&t?Us:ir(this,i),m=sr(this,i,f,a),p=Qo(this,i,m,f,a);let u=this.U(f);d=m===u,c=or(m,u);let g=this.N(c,d,p);if(!g)throw new RangeError(Vo);[f,m]=g}return Ka(Vi(this.P(f,m,p)),this.id||y)},fields(i){return cr(this)&&i.includes("year")?[...i,...mr]:i},mergeFields(i,s){let a=Object.assign(Object.create(null),i);return ar(a,s,Jl),cr(this)&&(ar(a,s,Xp),this.id===Js&&ar(a,s,Kp,mr)),a},inLeapYear(i){let[s]=this.h(i);return this.K(s)},monthsInYear(i){let[s]=this.h(i);return this.L(s)},daysInMonth(i){let[s,a]=this.h(i);return this.j(s,a)},daysInYear(i){let[s]=this.h(i);return this.X(s)},dayOfYear:Fl,era(i){return this.ee(i)[0]},eraYear(i){return this.ee(i)[1]},monthCode(i){let[s,a]=this.h(i),[t,r]=this.I(s,a);return((l,o)=>"M"+Oi(l)+(o?"L":""))(t,r)},dayOfWeek:Mc,daysInWeek(){return 7}},Eu={dayOfYear:Fl,h:Fc,q:Bs},Ju=Object.assign({},Eu,{weekOfYear:_d,yearOfWeek:Bd,R(i){function s(g){return(7-g<t?7:0)-g}function a(g){let h=vc(u+g),T=g||1,P=s(fa(d+h*T,7));return m=(h+(P-f)*T)/7}let t=this.id?1:4,r=Mc(i),l=this.dayOfYear(i),o=fa(r-1,7),c=l-1,d=fa(o-c,7),f=s(d),m,p=Math.floor((c-f)/7)+1,u=i.isoYear;return p?p>a(0)&&(p=1,u++):(p=a(-1),u--),[p,u,m]}}),Uu={dayOfYear:Fl,h:lr,q:ga,weekOfYear:_d,yearOfWeek:Bd,R(){return[]}},qs=bp(Object.assign({},eo,Ju,{h:Fc,ee(i){return this.id===Wt?Lc(i):this.id===Js?lu(i):[]},I:(i,s)=>[s,0],N(i,s){if(!s)return[Us,i]},K:Mr,U(){},L:Sc,J:(i)=>i*Ei,j:vr,X:vc,P:(i,s,a)=>({isoYear:i,isoMonth:s,isoDay:a}),q:Bs,_:(i,s,a)=>(i+=it(a,Ei),(s+=Tr(a,Ei))<1?(i--,s+=Ei):s>Ei&&(i++,s-=Ei),[i,s]),year(i){return i.isoYear},month(i){return i.isoMonth},day:(i)=>i.isoDay}),Object.assign({},eo,Uu,{h:lr,ee(i){let s=this.O(i);return[s.era,s.eraYear]},I(i,s){let a=Ua.call(this,i);return[or(s,a),a===s]},N(i,s,a){let[t,r,l]=lr.call(this,{isoYear:Us,isoMonth:Ei,isoDay:31}),o=Ua.call(this,t),c=r===o;(Qi(i,or(r,o))||Qi(Number(s),Number(c))||Qi(a,l))===1&&t--;for(let d=0;d<100;d++){let f=t-d,m=Ua.call(this,f),p=ka(i,s,m);if(s===(p===m)&&a<=Ko.call(this,f,p))return[f,p]}},K(i){let s=_a.call(this,i);return s>_a.call(this,i-1)&&s>_a.call(this,i+1)},U:Ua,L:Ba,J(i,s){let a=s+i,t=Math.sign(i),r=t<0?-1:0,l=0;for(let o=s;o!==a;o+=t)l+=Ba.call(this,o+r);return l},j:Ko,X:_a,P(i,s,a){return ot(ga.call(this,i,s,a))},q:ga,_(i,s,a){if(a){if(s+=a,!Number.isSafeInteger(s))throw new RangeError(nt);if(a<0)for(;s<1;)s+=Ba.call(this,--i);else{let t;for(;s>(t=Ba.call(this,i));)s-=t,i++}}return[i,s]},year(i){return this.O(i).year},month(i){let{year:s,F:a}=this.O(i),{C:t}=this.B(s);return t[a]+1},day(i){return this.O(i).day}})),ki="numeric",es=["timeZoneName"],Dm={month:ki,day:ki},ql={year:ki,month:ki},el=Object.assign({},ql,{day:ki}),io={hour:ki,minute:ki,second:ki},so=Object.assign({},el,io),_u=Object.assign({},so,{timeZoneName:"short"}),Bu=Object.keys(ql),Ru=Object.keys(Dm),Hu=Object.keys(el),Gu=Object.keys(io),ao=["dateStyle"],Yu=Bu.concat(ao),Xu=Ru.concat(ao),to=Hu.concat(ao,["weekday"]),$a=Gu.concat(["dayPeriod","timeStyle"]),ro=to.concat($a),Ku=ro.concat(es),Au=es.concat($a),Qu=es.concat(to),Vu=es.concat(["day","weekday"],$a),ku=es.concat(["year","weekday"],$a),qu={},lo=[Ms(ro,so),pt],Om=[Ms(Ku,_u),pt,0,(i,s)=>{let a=K(i.timeZone);if(s&&K(s.timeZone)!==a)throw new RangeError(Xf);return a}],oo=[Ms(ro,so,es),ai],co=[Ms(to,el,Au),ai],fo=[Ms($a,io,Qu),(i)=>ei(i)/Ii],mo=[Ms(Yu,ql,Vu),ai,1],po=[Ms(Xu,Dm,ku),ai,1],ic;function Ni(i,s,a,t,r){function l(...d){if(!(this instanceof l))throw new TypeError(Nl);vm(this,s(...d))}function o(d,f){return Object.defineProperties(function(...m){return d.call(this,c(this),...m)},ur(f))}function c(d){let f=q(d);if(!f||f.branding!==i)throw new TypeError(Nl);return f}return Object.defineProperties(l.prototype,{...ac(Si(o,a)),...ws(Si(o,t)),...ea("Temporal."+i)}),Object.defineProperties(l,{...ws(r),...ur(i)}),[l,(d)=>{let f=Object.create(l.prototype);return vm(f,d),f},c]}function jm(i){return i=i.concat("id").sort(),(s)=>{if(!tc(s,i))throw new TypeError(Yf);return s}}function ta(i){if(q(i)||i.calendar!==void 0||i.timeZone!==void 0)throw new TypeError(Bf);return i}function Ht(i,s){let a={};for(let t in i)a[t]=({o:r},l)=>{let o=q(l)||{},{branding:c}=o,d=c===js||s.includes(c)?o:oi(l);return r[t](d)};return a}function ho(i){let s={};for(let a in i)s[a]=(t)=>{let{calendar:r}=t;return(l=r,typeof l=="string"?qs(l):(o=l,Object.assign(Object.create(hg),{i:o})))[a](t);var l,o};return s}function ms(){throw new TypeError(Hf)}function Ia({calendar:i}){return typeof i=="string"?new So(i):i}function ym(i,s){if(s=W(s),G(i)){let t=q(i);if(t&&t.branding===ks)return F(s),t;let r=$m(i);return Ml(Vt(r||y),!r,i,s)}let a=ud(qs,i);return F(s),a}function Zm(i,s,a){return t=s.call(i,li(Y(a))),Xr(ba(t));var t}function Gt(i,s=Cm){let a=Object.keys(s).sort(),t={};for(let r of a)t[r]=O(s[r],i,om(i[r]));return t}function M(i,s){return typeof i=="string"?Bt(i):Gt(i,s)}function _(i){return M(i,go)}function zi(i){if(G(i)){let s=q(i);if(s)switch(s.branding){case Ut:return s;case Yi:return Y(s.epochNanoseconds)}}return cd(i)}function Fm(i,s,a){let t=s.l(zi(a).epochNanoseconds,i);return t?li(Y(t)):null}function j(i){return G(i)?(q(i)||{}).timeZone||Og(i):((s)=>vt(Pd(I(s))))(i)}function os(i,s){if(G(i)){let a=q(i)||{};switch(a.branding){case Jt:return F(s),a;case Zs:return F(s),Li(a);case Yi:return F(s),nl(_,a)}return Qd(i,s)}return F(s),gd(i)}function To(i){return i===void 0?void 0:os(i)}function ia(i,s){if(s=W(s),G(i)){let t=q(i);return t&&t.branding===Vs?(F(s),t):vl(At(za(i)),i,s)}let a=pd(qs,i);return F(s),a}function cs(i,s){if(s=W(s),G(i)){let t=q(i)||{};switch(t.branding){case Zs:return F(s),t;case js:return F(s),E({...t,...Fi});case Yi:return F(s),xl(_,t)}return Ad(Qt(za(i)),i,s)}let a=md(i);return F(s),a}function oi(i,s){if(s=W(s),G(i)){let t=q(i)||{};switch(t.branding){case js:return F(s),t;case Zs:return F(s),J(t);case Yi:return F(s),$l(_,t)}return Sl(Qt(za(i)),i,s)}let a=Ft(i);return F(s),a}function xm(i,s,a){return vi(s.call(i,C(J(a,i))))}function Wi(i){return(s)=>typeof s=="string"?qs(s):((a,t)=>{let r=Object.keys(t).sort(),l={};for(let o of r)l[o]=O(t[o],a,a[o]);return l})(s,i)}function z(i){if(G(i)){let s=q(i);return s&&s.branding===_t?s:Vd(i)}return hd(i)}function na(i){if(i!==void 0){if(G(i)){let s=q(i)||{};switch(s.branding){case Yi:case js:return s;case Zs:return J(s)}let a=za(i);return{...Xd(j,M,Qt(a),i),calendar:a}}return dd(i)}}function za(i){return $m(i)||y}function $m(i){let{calendar:s}=i;if(s!==void 0)return k(s)}function k(i){return G(i)?(q(i)||{}).calendar||Ng(i):((s)=>ya(Td(I(s))))(i)}function sa(i,s){if(s=W(s),G(i)){let a=q(i);if(a&&a.branding===Yi)return Da(s),a;let t=za(i);return Kd(j,M,Qt(t),t,i,s)}return fd(i,s)}function Sm(i){return Si((s)=>(a)=>s(uo(a)),i)}function uo(i){return ti(i,_)}function eu(){let i=ls.prototype,s=Object.getOwnPropertyDescriptors(i),a=Object.getOwnPropertyDescriptors(ls),t=function(r,l={}){if(!(this instanceof t))return new t(r,l);vo.set(this,((o,c={})=>{let d=new ls(o,c),f=d.resolvedOptions(),m=f.locale,p=gi(Object.keys(c),f),u=pi(ag),g=(...h)=>{let T,P=h.map((b,w)=>{let D=q(b),N=(D||{}).branding;if(w&&T&&T!==N)throw new TypeError(Af);return T=N,D});return T?u(T)(m,p,...P):[d,...h]};return g.u=d,g})(r,l))};for(let r in s){let l=s[r],o=r.startsWith("format")&&ig(r);typeof l.value=="function"?l.value=r==="constructor"?t:o||sg(r):o&&(l.get=function(){return o.bind(this)})}return a.prototype.value=Object.create(i,s),Object.defineProperties(t,a),t}function ig(i){return function(...s){let a=vo.get(this),[t,...r]=a(...s);return t[i](...r)}}function sg(i){return function(...s){return vo.get(this).u[i](...s)}}function ag(i){let s=tg[i];if(!s)throw new TypeError(Kf(i));return Ri(s,pi(Il))}var tg={Instant:lo,PlainDateTime:oo,PlainDate:co,PlainTime:fo,PlainYearMonth:mo,PlainMonthDay:po},rg=Ri(lo),lg=Ri(Om),og=Ri(oo),cg=Ri(co),dg=Ri(fo),fg=Ri(mo),mg=Ri(po),Po={era:mc,eraYear:Pr,year:ba,month:vi,daysInMonth:vi,daysInYear:vi,inLeapYear:lm,monthsInYear:vi},Xt={monthCode:I},wo={day:vi},nm={dayOfWeek:vi,dayOfYear:vi,weekOfYear:pc,yearOfWeek:Pr,daysInWeek:vi},Im=Object.assign({},Po,Xt,wo,nm),Yt=new WeakMap,q=Yt.get.bind(Yt),vm=Yt.set.bind(Yt),pg={...Ht(Po,[Vs]),...Ht(nm,[]),...Ht(Xt,[Vs,ks]),...Ht(wo,[ks])},bo=ho(Im),ug=ho({...Po,...Xt}),gg=ho({...Xt,...wo}),Ca={calendarId:(i)=>K(i.calendar)},hg=Si((i,s)=>function(a){let{i:t}=this;return i(t[s](C(J(a,t))))},Im),Tg=Pa((i)=>(s)=>s[i],S.concat("sign")),Do=Pa((i,s)=>(a)=>a[Zi[s]],Gi),zm={epochSeconds:zc,epochMilliseconds:pt,epochMicroseconds:Cc,epochNanoseconds:Nc},Na=O(gr,new Set(["branding"])),[Pg,aa,wg]=Ni(ks,O(pf,k),{...Ca,...gg},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return aa(af(Ig,i,this,ta(s),a))},equals:(i,s)=>$d(i,ym(s)),toPlainDate(i,s){return C(Mf(Wa,i,this,s))},toLocaleString(i,s,a){let[t,r]=mg(s,a,i);return t.format(r)},toString:Br,toJSON:(i)=>Br(i),valueOf:ms},{from:(i,s)=>aa(ym(i,s))}),Cm={getOffsetNanosecondsFor:Zm,getPossibleInstantsFor(i,s,a){let t=[...s.call(i,V(E(a,y)))].map((l)=>Dg(l).epochNanoseconds),r=t.length;return r>1&&(t.sort(si),Kr(Pi(Ti(t[0],t[r-1])))),t}},go={getOffsetNanosecondsFor:Zm},[bg,li,Dg]=Ni(Ut,of,zm,{add:(i,s)=>li(Ar(0,i,z(s))),subtract:(i,s)=>li(Ar(1,i,z(s))),until:(i,s,a)=>L(Tl(0,i,zi(s),a)),since:(i,s,a)=>L(Tl(1,i,zi(s),a)),round:(i,s)=>li(Jc(i,s)),equals:(i,s)=>Md(i,zi(s)),toZonedDateTime(i,s){let a=_i(s);return U(Zl(i,j(a.timeZone),k(a.calendar)))},toZonedDateTimeISO:(i,s)=>U(Zl(i,j(s))),toLocaleString(i,s,a){let[t,r]=rg(s,a,i);return t.format(r)},toString:(i,s)=>Wr(j,_,i,s),toJSON:(i)=>Wr(j,_,i),valueOf:ms},{from:(i)=>li(zi(i)),fromEpochSeconds:(i)=>li(Zf(i)),fromEpochMilliseconds:(i)=>li(xf(i)),fromEpochMicroseconds:(i)=>li($f(i)),fromEpochNanoseconds:(i)=>li(nf(i)),compare:(i,s)=>ul(zi(i),zi(s))}),[Kt,Fh]=Ni("TimeZone",(i)=>{let s=Sd(i);return{branding:"TimeZone",id:s,o:Bt(s)}},{id:(i)=>i.id},{getPossibleInstantsFor:({o:i},s)=>i.getPossibleInstantsFor(cs(s)).map((a)=>li(Y(a))),getOffsetNanosecondsFor:({o:i},s)=>i.getOffsetNanosecondsFor(zi(s).epochNanoseconds),getOffsetStringFor(i,s){let a=zi(s).epochNanoseconds,t=Gt(this,go).getOffsetNanosecondsFor(a);return Os(t)},getPlainDateTimeFor(i,s,a=y){let t=zi(s).epochNanoseconds,r=Gt(this,go).getOffsetNanosecondsFor(t);return V(E(ss(t,r),k(a)))},getInstantFor(i,s,a){let t=cs(s),r=Lr(a),l=Gt(this);return li(Y(ui(l,t,r)))},getNextTransition:({o:i},s)=>Fm(1,i,s),getPreviousTransition:({o:i},s)=>Fm(-1,i,s),equals(i,s){return!!Lt(this,j(s))},toString:(i)=>i.id,toJSON:(i)=>i.id},{from(i){let s=j(i);return typeof s=="string"?new Kt(s):s}}),Og=jm(Object.keys(Cm)),[yg,ds]=Ni(Jt,uf,Do,{getISOFields:Na,with(i,s,a){return ds(tf(this,ta(s),a))},add:(i,s)=>ds(er(0,i,z(s))),subtract:(i,s)=>ds(er(1,i,z(s))),until:(i,s,a)=>L(Ol(0,i,os(s),a)),since:(i,s,a)=>L(Ol(1,i,os(s),a)),round:(i,s)=>ds(Bc(i,s)),equals:(i,s)=>nd(i,os(s)),toZonedDateTime:(i,s)=>U(Lf(j,oi,M,i,s)),toPlainDateTime:(i,s)=>V(jf(i,oi(s))),toLocaleString(i,s,a){let[t,r]=dg(s,a,i);return t.format(r)},toString:Rr,toJSON:(i)=>Rr(i),valueOf:ms},{from:(i,s)=>ds(os(i,s)),compare:(i,s)=>Mt(os(i),os(s))}),[Fg,fs,Sg]=Ni(Vs,O(mf,k),{...Ca,...ug},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return fs(sf(ng,i,this,ta(s),a))},add:(i,s,a)=>fs(qr(Mm,0,i,z(s),a)),subtract:(i,s,a)=>fs(qr(Mm,1,i,z(s),a)),until:(i,s,a)=>L(Dl(Lm,0,i,ia(s),a)),since:(i,s,a)=>L(Dl(Lm,1,i,ia(s),a)),equals:(i,s)=>xd(i,ia(s)),toPlainDate(i,s){return C(vf(Wa,i,this,s))},toLocaleString(i,s,a){let[t,r]=fg(s,a,i);return t.format(r)},toString:_r,toJSON:(i)=>_r(i),valueOf:ms},{from:(i,s)=>fs(ia(i,s)),compare:(i,s)=>Ss(ia(i),ia(s))}),[vg,V]=Ni(Zs,O(df,k),{...Ca,...bo,...Do},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return V(qd(Wa,i,this,ta(s),a))},withCalendar:(i,s)=>V($t(i,k(s))),withPlainDate:(i,s)=>V(Nf(i,oi(s))),withPlainTime:(i,s)=>V(Cf(i,To(s))),add:(i,s,a)=>V(Vr($s,0,i,z(s),a)),subtract:(i,s,a)=>V(Vr($s,1,i,z(s),a)),until:(i,s,a)=>L(wl(Ci,0,i,cs(s),a)),since:(i,s,a)=>L(wl(Ci,1,i,cs(s),a)),round:(i,s)=>V(_c(i,s)),equals:(i,s)=>jd(i,cs(s)),toZonedDateTime:(i,s,a)=>U(wf(M,i,j(s),a)),toPlainDate:(i)=>C(J(i)),toPlainTime:(i)=>ds(Li(i)),toPlainYearMonth(i){return fs(bf(At,i,this))},toPlainMonthDay(i){return aa(Df(Vt,i,this))},toLocaleString(i,s,a){let[t,r]=og(s,a,i);return t.format(r)},toString:Jr,toJSON:(i)=>Jr(i),valueOf:ms},{from:(i,s)=>V(cs(i,s)),compare:(i,s)=>hl(cs(i),cs(s))}),[Mg,C,Nm]=Ni(js,O(ff,k),{...Ca,...bo},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return C(ed(Wa,i,this,ta(s),a))},withCalendar:(i,s)=>C($t(i,k(s))),add:(i,s,a)=>C(kr($s,0,i,z(s),a)),subtract:(i,s,a)=>C(kr($s,1,i,z(s),a)),until:(i,s,a)=>L(bl(Ci,0,i,oi(s),a)),since:(i,s,a)=>L(bl(Ci,1,i,oi(s),a)),equals:(i,s)=>Zd(i,oi(s)),toZonedDateTime(i,s){let a=!G(s)||s instanceof Kt?{timeZone:s}:s;return U(Of(j,os,M,i,a))},toPlainDateTime:(i,s)=>V(yf(i,To(s))),toPlainYearMonth(i){return fs(Ff(At,i,this))},toPlainMonthDay(i){return aa(Sf(Vt,i,this))},toLocaleString(i,s,a){let[t,r]=cg(s,a,i);return t.format(r)},toString:Ur,toJSON:(i)=>Ur(i),valueOf:ms},{from:(i,s)=>C(oi(i,s)),compare:(i,s)=>Ss(oi(i),oi(s))}),Oo={fields(i,s,a){return[...s.call(i,a)]}},Wm=Object.assign({dateFromFields(i,s,a,t){return Nm(s.call(i,Object.assign(Object.create(null),a),t))}},Oo),Em=Object.assign({yearMonthFromFields(i,s,a,t){return Sg(s.call(i,Object.assign(Object.create(null),a),t))}},Oo),Jm=Object.assign({monthDayFromFields(i,s,a,t){return wg(s.call(i,Object.assign(Object.create(null),a),t))}},Oo),yo={mergeFields(i,s,a,t){return _i(s.call(i,Object.assign(Object.create(null),a),Object.assign(Object.create(null),t)))}},Lg=Object.assign({},Wm,yo),jg=Object.assign({},Em,yo),Zg=Object.assign({},Jm,yo),Fo={dateAdd(i,s,a,t,r){return Nm(s.call(i,C(J(a,i)),L(x(t)),r))}},Um=Object.assign({},Fo,{dateUntil(i,s,a,t,r,l){return Cg(s.call(i,C(J(a,i)),C(J(t,i)),Object.assign(Object.create(null),l,{largestUnit:La[r]})))}}),xg=Object.assign({},Fo,{day:xm}),$g=Object.assign({},Um,{day:xm}),At=Wi(Em),Qt=Wi(Wm),Vt=Wi(Jm),ng=Wi(jg),Wa=Wi(Lg),Ig=Wi(Zg),$s=Wi(Fo),Ci=Wi(Um),Mm=Wi(xg),Lm=Wi($g),[zg,L,Cg]=Ni(_t,gf,{...Tg,blank:rd},{with:(i,s)=>L(rf(i,s)),negated:(i)=>L(Ot(i)),abs:(i)=>L(td(i)),add:(i,s,a)=>L(rl(na,Ci,M,0,i,z(s),a)),subtract:(i,s,a)=>L(rl(na,Ci,M,1,i,z(s),a)),round:(i,s)=>L(ad(na,Ci,M,i,s)),total:(i,s)=>Ec(na,Ci,M,i,s),toLocaleString(i,s,a){return Intl.DurationFormat?new Intl.DurationFormat(s,a).format(this):Tt(i)},toString:Tt,toJSON:(i)=>Tt(i),valueOf:ms},{from:(i)=>L(z(i)),compare:(i,s,a)=>vd(na,$s,M,z(i),z(s),a)}),_m={toString:(i)=>i.id,toJSON:(i)=>i.id,...pg,dateAdd:({id:i,o:s},a,t,r)=>C(J(s.dateAdd(oi(a),z(t),r),i)),dateUntil:({o:i},s,a,t)=>L(x(i.dateUntil(oi(s),oi(a),Zc(t)))),dateFromFields:({id:i,o:s},a,t)=>C(Sl(s,a,t,fc(i))),yearMonthFromFields:({id:i,o:s},a,t)=>fs(vl(s,a,t,cc(i))),monthDayFromFields:({id:i,o:s},a,t)=>aa(Ml(s,0,a,t,dc(i))),fields({o:i},s){let a=new Set(ji),t=[];for(let r of s){if(I(r),!a.has(r))throw new RangeError(Cl(r));a.delete(r),t.push(r)}return i.fields(t)},mergeFields:({o:i},s,a)=>i.mergeFields(hr(wr(s)),hr(wr(a)))},[So]=Ni("Calendar",(i)=>{let s=Ud(i);return{branding:"Calendar",id:s,o:qs(s)}},{id:(i)=>i.id},_m,{from(i){let s=k(i);return typeof s=="string"?new So(s):s}}),Ng=jm(Object.keys(_m).slice(4)),[Wg,U]=Ni(Yi,O(cf,k,j),{...zm,...Ca,...Sm(bo),...Sm(Do),offset:(i)=>Os(uo(i).offsetNanoseconds),offsetNanoseconds:(i)=>uo(i).offsetNanoseconds,timeZoneId:(i)=>K(i.timeZone),hoursInDay:(i)=>Rc(M,i)},{getISOFields:(i)=>id(_,i),getCalendar:Ia,getTimeZone:({timeZone:i})=>typeof i=="string"?new Kt(i):i,with(i,s,a){return U(kd(Wa,M,i,this,ta(s),a))},withCalendar:(i,s)=>U($t(i,k(s))),withTimeZone:(i,s)=>U(Wf(i,j(s))),withPlainDate:(i,s)=>U(zf(M,i,oi(s))),withPlainTime:(i,s)=>U(If(M,i,To(s))),add:(i,s,a)=>U(Qr($s,M,0,i,z(s),a)),subtract:(i,s,a)=>U(Qr($s,M,1,i,z(s),a)),until:(i,s,a)=>L(x(Pl(Ci,M,0,i,sa(s),a))),since:(i,s,a)=>L(x(Pl(Ci,M,1,i,sa(s),a))),round:(i,s)=>U(Uc(M,i,s)),startOfDay:(i)=>U(Hc(M,i)),equals:(i,s)=>Ld(i,sa(s)),toInstant:(i)=>li(hf(i)),toPlainDateTime:(i)=>V(xl(_,i)),toPlainDate:(i)=>C($l(_,i)),toPlainTime:(i)=>ds(nl(_,i)),toPlainYearMonth(i){return fs(Tf(At,i,this))},toPlainMonthDay(i){return aa(Pf(Vt,i,this))},toLocaleString(i,s,a={}){let[t,r]=lg(s,a,i);return t.format(r)},toString:(i,s)=>Er(_,i,s),toJSON:(i)=>Er(_,i),valueOf:ms},{from:(i,s)=>U(sa(i,s)),compare:(i,s)=>gl(sa(i),sa(s))}),Eg=Object.defineProperties({},{...ea("Temporal.Now"),...ws({timeZoneId:()=>Hi(),instant:()=>li(Y(Sa())),zonedDateTime:(i,s=Hi())=>U(Q(Sa(),j(s),k(i))),zonedDateTimeISO:(i=Hi())=>U(Q(Sa(),j(i),y)),plainDateTime:(i,s=Hi())=>V(E(As(_(j(s))),k(i))),plainDateTimeISO:(i=Hi())=>V(E(As(_(j(i))),y)),plainDate:(i,s=Hi())=>C(J(As(_(j(s))),k(i))),plainDateISO:(i=Hi())=>C(J(As(_(j(i))),y)),plainTimeISO:(i=Hi())=>ds(Li(As(_(j(i)))))})}),Xi=Object.defineProperties({},{...ea("Temporal"),...ws({PlainYearMonth:Fg,PlainMonthDay:Pg,PlainDate:Mg,PlainTime:yg,PlainDateTime:vg,ZonedDateTime:Wg,Instant:bg,Calendar:So,TimeZone:Kt,Duration:zg,Now:Eg})}),Jg=eu(),vo=new WeakMap,Ug=Object.defineProperties(Object.create(Intl),ws({DateTimeFormat:Jg}));class ns extends Error{constructor(){super("Adapter not found");this.name="AdapterNotFound"}}class Mo{createSession(){throw new ns}deleteSession(){throw new ns}findSession(){throw new ns}findUserByEmailAddress(){throw new ns}updateSession(){throw new ns}createUser(){throw new ns}}class Ym extends R{schema={email:{required:"Email is required",string:"Invalid email",email:"Invalid email"},password:{required:"Password is required"}}}class Xm extends R{schema={name:{string:"Invalid name",required:"Name is required","min:2":"Name must be at least 3 characters"},email:{string:"Invalid email",required:"Email is required",email:"Invalid email"},password:{required:"Password is required","min:8":"Password must be at least 8 characters"}}}class Km extends R{schema={email:{required:"Email is required",email:"Invalid email"}}}class Am extends R{schema={password:{required:"Password is required",password:"Invalid password"}}}class Ki extends Bm{provider=oa.use().provider;async me(){let i=await Ai.user();if(!i)throw new Gm;return i}async verifyEmail(i=new R){let s=await i.input(),a=await this.provider.adapter.findUserByVerificationToken(s.get("token"));if(!a)return{email:null};if(await this.provider.adapter.verifyUser(a.id),a)return{email:a.email};return{email:null}}async signIn(i=new Ym){let s=await i.input.call(i),{email:a,password:t}=s.toJSON(),r=await this.provider.adapter.findUserByEmailAddress(a,this.provider.verifyEmail);if(!r)throw new ps({invalid_credentials:["Invalid credentials"]});if(!await this.provider.verifyPassword(t,r.password))throw new ps({invalid_credentials:["Invalid credentials"]});let o=i.headers.get("User-Agent"),c=new Bun.CryptoHasher("sha256");c.update(`${r.email}${o}`);let d=c.digest("hex"),f=await this.provider.adapter.findSession({token:d,userAgent:i.headers.get("User-Agent")});if(!f)f=await this.provider.adapter.createSession({token:d,userId:r.id,userAgent:i.headers.get("User-Agent"),expiresAt:new Date(Xi.Now.instant().add({hours:this.provider.sessionExpiresInHours}).toString()),absoluteExpiresAt:new Date(Xi.Now.instant().add({hours:this.provider.sessionAbsoluteExpiresInHours}).toString())});else f=await this.provider.adapter.updateSession({token:d,expiresAt:new Date(Xi.Now.instant().add({hours:this.provider.sessionExpiresInHours}).toString())});return i.ctx().setCookie("access_token",f.token,{expires:f.expiresAt}),await this.provider.onSignIn(r),r}async signUp(i=new Xm){let s=await i.input(),{email:a,password:t,name:r,invitationId:l}=s.toJSON();if(await this.provider.adapter.findUserByEmailAddress(a,!1))throw new ps({email:["Email address already exists"]});let c=await this.provider.hashPassword(t),d=gs.use().detectLocale(i),f;if(l){if(f=await this.provider.adapter.findInvitation(l,a),f)await this.provider.adapter.deleteInvitationById(l)}let m,p;if(f)m=await this.provider.adapter.createUser({email:a,name:r,password:c,emailVerifiedAt:new Date,locale:d}),await this.provider.adapter.createAccount({organizationId:f.organizationId,userId:m.id,organizationRole:f.role});else p=await this.provider.generateEmailVerificationToken(a),m=await this.provider.adapter.createUser({email:a,name:r,password:c,verificationToken:p,locale:d});return await this.provider.onSignUp(m,p),m}async signOut(i=new R){let s=i.cookies.get("access_token"),a=await Ai.user();return await this.provider.adapter.deleteSession({token:s}),i.ctx().setCookie("access_token","",{expires:new Date(0)}),await this.provider.onSignOut(a),{}}async forgotPassword(i=new Km){let s=await i.input(),{email:a}=s.toJSON(),t=await this.provider.adapter.findUserByEmailAddress(a,this.provider.verifyEmail);if(!t)return{};let r=await this.provider.generateForgotPasswordToken(t);return await this.provider.adapter.createPasswordResetToken({user:t,token:r}),await this.provider.onForgotPassword(t,r),{}}async resetPassword(i=new Am){let s=await i.input(),{password:a,token:t}=s.toJSON(),r=await this.provider.adapter.findPasswordResetToken({token:t});if(!r)throw new ps({token:["Invalid token"]});if(Xi.Instant.from(r.createdAt.toISOString()).add({hours:24}).until(Xi.Now.instant()).sign>=0)throw new ps({token:["Token expired"]});await this.provider.adapter.deletePasswordResetToken({token:t});let o=await this.provider.adapter.findUserByEmailAddress(r.user.email,this.provider.verifyEmail);if(!o)throw new ps({email:["User not found"]});let c=await this.provider.hashPassword(a);return await this.provider.adapter.updateUserPassword({id:o.id,password:c}),await this.provider.adapter.deleteAllUserSessions(o.id),await this.provider.onResetPassword(o),{}}async changePassword(i=new R){let s=await Ai.user(),a=await i.input(),{oldPassword:t,newPassword:r}=a.toJSON(),{password:l}=await this.provider.adapter.findUserByEmailAddress(s.email,this.provider.verifyEmail);if(!await this.provider.verifyPassword(t,l))throw new ps({oldPassword:["Incorrect password"]});let c=await this.provider.hashPassword(r);return await this.provider.adapter.updateUserPassword({id:s.id,password:c}),await this.provider.adapter.deleteAllUserSessions(s.id),{}}}class Lo extends zs{middlewares=["cache:private"];routes={"/sign-in":this.post(Ki,"signIn"),"/sign-up":this.post(Ki,"signUp"),"/sign-out":this.post(Ki,"signOut"),"/forgot-password":this.post(Ki,"forgotPassword"),"/reset-password":this.post(Ki,"resetPassword"),"/change-password":this.post(Ki,"changePassword"),"/verify-email":this.post(Ki,"verifyEmail"),"/me":this.get(Ki,"me").middleware(["auth"])}}class _g extends Rm{middlewares=["cache:public"];routes={"/sign-in":this.view("auth/SignIn"),"/sign-up":this.view("auth/SignUp"),"/reset-password":this.view("auth/ResetPassword"),"/forgot-password":this.view("auth/ForgotPassword")}}class Bg extends Hm{basePath="/auth";verifyEmail=!0;sessionExpiresInHours=24;sessionAbsoluteExpiresInHours=672;adapter=new Mo;boot(){}async verifyPassword(i,s){return await Bun.password.verify(i,s)}async hashPassword(i){return await Bun.password.hash(i)}async generateForgotPasswordToken(i){let s=new Bun.CryptoHasher("sha256");return s.update(`${i.email}${Date.now()}`),s.digest("hex")}generateEmailVerificationToken(i){if(!this.verifyEmail)return"";let s=new Bun.CryptoHasher("sha256");return s.update(`${i}${Date.now()}`),s.digest("hex")}extendSession(i){return{}}onSignUp(i,s){}onSignIn(i){}onSignOut(i){}onForgotPassword(i,s){}onResetPassword(i){}}import{mkdir as Rg,exists as Hg,readdir as Gg}from"fs/promises";class bi extends hi{i;static _name="LoggingServiceContainer";writer;isReady=!1;logsDirPath=`${process.env.ROOT_DIR}/storage/logs`;flushTimeout;fileSize=0;writerSize=0;isCreatingFile=!1;currentLogFilePath;constructor(i){super();this.service=i;this.boot().then(()=>{this.isReady=!0})}async boot(){if(!process.env.ROOT_DIR)return;if(!await Hg(this.logsDirPath))await Rg(this.logsDirPath);this.newLogFile()}async newLogFile(){if(this.isCreatingFile=!0,this.currentLogFilePath){this.writer.flush(),this.writer.end(),this.writer=null;let a=new File([await Bun.file(this.currentLogFilePath).arrayBuffer()],this.currentLogFilePath.split("/").pop(),{type:"text/plain"});this.service.onLogFileClosed(a),this.fileSize=0,this.writerSize=0}let s=(await Gg(this.logsDirPath)).sort().reverse()[0];if(s){let a=Bun.file(`${this.logsDirPath}/${s}`);if(a.size<this.service.maxFileSize)this.currentLogFilePath=`${this.logsDirPath}/${s}`,this.writer=a.writer(),this.writer.write(await a.text()),this.writer.write("\n"),this.writer.flush(),this.fileSize=a.size}if(!this.writer){let a=`${new Date(Date.now()).toISOString()}.log`.replaceAll(":","-");this.currentLogFilePath=`${this.logsDirPath}/${a}`;let t=Bun.file(`${this.logsDirPath}/${a}`);this.writer=t.writer(),this.fileSize=0,this.writerSize=0}this.isCreatingFile=!1}async log(i,s,a={}){if(!this.isReady)await new Promise((c)=>{let d=setInterval(()=>{if(this.isReady)c({}),clearInterval(d)},100)});let t=ci.getStore(),r={};if(t)r={url:t.req.rawRequest.url,method:t.req.rawRequest.method,headers:t.req.rawRequest.headers,body:t.req.rawRequest.body};let l={timestamp:new Date(Date.now()).toISOString(),env:"production",level:i,message:s,metadata:{...r,...a}},o="";try{o=JSON.stringify(l)}catch(c){throw new Error("Metadata must be a valid JSON object")}this.writerSize+=o.length,this.fileSize+=o.length,this.writer.write(o),this.writer.write("\n"),kt.channel("/logs/live",{}).publish(JSON.stringify(l)),this.service.onLogCreated(l),this.tryFlush()}async tryFlush(){if(this.fileSize>this.service.maxFileSize){if(!this.isCreatingFile)await this.newLogFile()}if(this.writerSize>this.service.maxFileSize/2)await this.writer.flush(),this.writerSize=0,await this.newLogFile();else clearTimeout(this.flushTimeout),this.flushTimeout=setTimeout(async()=>{await this.writer.flush(),this.writerSize=0},100)}}class jo extends zs{middlewares=["cache:private,0"];routes={"/live":this.get(async()=>{let i=Bun.file(bi.use().currentLogFilePath);return new Response(await i.text(),{headers:{"Content-Type":"text/plain"}})})}}function Yg(i){let s=new Map;for(let a of i)if(typeof a==="string"){let[t,r=""]=a.split(":");if(t.startsWith("-")){if(s.has(t.replace("-","")))s.delete(t.replace("-",""))}else s.set(t,r.split(",").filter(Boolean))}else s.set(a,[]);return s}class Zo extends hi{i;static _name="MiddlewareServiceContainer";constructor(i){super();this.service=i}runMiddleware(i){let s=new R;return Array.from(Yg(i).entries()).map(([a,t])=>{if(typeof a==="string"){let r=this.service.aliases[a];if(r){let l=new r(s);return()=>l.run.call(l,...t)}}else{if(Qm(a)){let r=new a(s);return r.run.bind(r)}return a}}).filter(Boolean).reduce((a,t)=>{return async()=>{return{...await a(),...await t()}}},()=>Promise.resolve({}))()}}function Vm(i){return i.replace(/-([a-z])/g,(s)=>s[1].toUpperCase())}function Xg(i){if("__brand"in i)return i.__brand==="ApiRouter";return!1}function xo(i,s=""){let a={};for(let[t,r]of Object.entries(i))if("run"in r){let l=r;if(!a[t])a[t]={};let{method:o,middlewares:c}=l,d=l.run.bind(l);a[t][o]={exec:d,middleware:c}}else if(typeof r==="function"){let l={},o=[];if(Xg(r)){let d=new r;l=d.routes,o=[d.middleware,...d.middlewares]}else{let[d]=(t==="/"?s:t).split("/").reverse();if(d==="")throw new Error(`"${t}" is not valid for a resource route`);if(d.includes(":"))throw new Error(`Last segment of a resource route has to be static. See "${t}"`);l=r(`${Vm(d)}Id`)}let c=xo(l,t);for(let[d,f]of Object.entries(c)){let m=d==="/"?"":d,p=t==="/"?"":t,u=`${p}${m}`===""?"/":`${p}${m}`;if(!a[u])a[u]={};for(let[g,h]of Object.entries(f))a[u][g]={exec:h.exec,middleware:[...o,...h.middleware]}}}else for(let l of Object.values(r)){if(!a[t])a[t]={};let{method:o,middlewares:c}=l,d=l.run.bind(l);a[t][o]={exec:d,middleware:c}}return Object.fromEntries(Object.entries(a).sort(([t],[r])=>{let l=t.split("/").length+t.split(":").length,o=r.split("/").length+r.split(":").length;return l-o}))}class no extends hi{i;static _name="ApiRouterServiceContainer";flatRoutes={};constructor(i){super();this.service=i;this.flatRoutes=xo({"/":this.service.rootRouter.bind(this.service),"/auth":Lo,"/__gemi__/services/i18n":et,"/__gemi__/services/logs":jo})}getRouteHandlerAndParams(i){let a=new URL(i.url).pathname.replace("/api",""),t={},r;for(let[l]of Object.entries(this.flatRoutes))try{let o=new URLPattern({pathname:l});if(o.test({pathname:a})){r=l,t=o.exec({pathname:a})?.pathname.groups;break}}catch(o){console.error(o)}return{params:t,path:r}}async runRouteMiddleware(i,s){let t=this.flatRoutes[i][s.rawRequest.method].middleware;try{await Zo.use().runMiddleware(t)}catch(r){if(r.kind===$o){if(s.rawRequest.url.includes("/api")){let{status:l=400,data:o,headers:c}=r.payload.api;return new Response(JSON.stringify(o),{status:l,headers:{"Content-Type":"application/json",...c}})}}else throw this.service.onRequestFail(s,r),console.error(r),r}}async getRouteData(i){let s=this.flatRoutes[i],a=ci.getStore(),t=s[a.req.rawRequest.method].exec??(()=>Promise.resolve({})),r={};try{r=await t()}catch(l){if(l.kind===$o){let{status:o=400,data:c,headers:d}=l.payload.api;return new Response(JSON.stringify(c),{status:o,headers:{"Content-Type":"application/json",...d}})}else throw this.service.onRequestFail(a.req,l),console.error(l),l}return r}async handleApiRequest(i){let{params:s,path:a}=this.getRouteHandlerAndParams(i),t=this.flatRoutes[a];if(!t||!t[i.method])return new Response(JSON.stringify({error:{message:"Not found"}}),{status:404});let r=new R(i,s,"api",a);if(!i.url.includes("/__gemi__"))this.service.onRequestStart(r);return await ci.run(r,async()=>{let l=ci.getStore();l.setRequest(r);let o=await this.runRouteMiddleware(a,r);if(o instanceof Response)return o;let c=await this.getRouteData(a);if(c instanceof Response)return c;let d=l.headers;if(d.append("Content-Type","application/json"),l.cookies.forEach((f)=>d.append("Set-Cookie",f.toString())),l.destroy(),!i.url.includes("/__gemi__"))this.service.onRequestEnd(r);return new Response(JSON.stringify(c),{headers:d})})}}class qt{static prepare(i,...s){let a={params:{},search:{}},[t={}]=s,{search:r,params:l}={...a,...t},o=ci.getStore();if(o.req.kind==="api")throw new Error("Query.prefetch() cannot be called from an API request");let c=o.req.rawRequest,d=new URL(c.url),f=new URLSearchParams(Uo(r));f.delete("json"),f.sort();let m=[`${xi(i,l)}`,f.toString()].filter((P)=>P.length>0).join("?"),p=`${d.origin}/${m}`,u=new Request(p,{headers:c.headers}),g=new R(u,l),h=(P)=>{o.prefetchedResources.set(xi(i,l),{[f.toString()]:P})},T=()=>{return ci.run(g,async()=>{let P=await no.use().getRouteData(i);return h(P),P})};return{instant:T,prefetch:()=>{o.prefetchPromiseQueue.add(T)}}}static instant(i,...s){return qt.prepare(i,...s).instant()}static prefetch(i,...s){return qt.prepare(i,...s).prefetch()}}class kt{static channel(i,s){let a=Is.use().service.channels[i];if(!a)return console.error(`Channel ${i} not found`),{publish:()=>{}};let t=new a;return{publish:(r,l=!1)=>{let o=xi(i,s);Is.use().publish(o,JSON.stringify({topic:o,data:t.publish(r)}),l)}}}}class km{static absolute(i,...s){return`${process.env.HOST_NAME}${xi(String(i),s[0]??{})}`}static relative(i,...s){return xi(String(i),s[0]??{})}}class qm{static debug(i,s){bi.use().log("debug",i,s)}static info(i,s){bi.use().log("info",i,s)}static notice(i,s){bi.use().log("notice",i,s)}static warning(i,s){bi.use().log("warning",i,s)}static error(i,s){bi.use().log("error",i,s)}static critical(i,s){bi.use().log("critical",i,s)}static alert(i,s){bi.use().log("alert",i,s)}static emergency(i,s){bi.use().log("emergency",i,s)}}export{km as Url,Co as Redirect,qt as Query,qm as Log,Wo as I18n,Jo as FileStorage,kt as Broadcast,Ai as Auth};export{Is as f,gs as g,ca as h,bi as i,qm as j,Bg as k,Zo as l,no as m};
|
|
2
|
+
import{n as Bm,o as Qm,p as zs,q as Rm,r as $o,s as Io,t as ps,u as ci,v as R,x as Gm,y as Ea,z as oa}from"../http/index.js";import{E as ap}from"../chunk-0rvh1r84.js";import{Pb as Hm}from"../chunk-0ykbtpxc.js";import{Rb as hi}from"../chunk-g3838fme.js";import{Tb as sp}from"../chunk-exvtvmb6.js";import{AsyncLocalStorage as ip}from"async_hooks";class Is extends hi{i;static _name="BroadcastingServiceContainer";publishCb;context=new ip;constructor(i){super();this.service=i}onPublish(i){this.publishCb=i}publish(...i){let[s,a,t]=i;this.publishCb(s,a,t)}async handleMessage(i,s){let a=JSON.parse(s);if(a.type==="subscribe"){let t=Object.entries(this.service.channels).sort(([r],[l])=>r.length-l.length);for(let[r,l]of t){let o=new URLPattern({pathname:r});if(o.test({pathname:a.topic})){let c=o.exec({pathname:a.topic})?.pathname.groups,d=new l;if(await d.subscribe.call(d,c))i.subscribe(a.topic);break}}}if(a.type==="broadcast")i.publish(a.topic,JSON.stringify({topic:a.topic,data:a.payload}));if(a.type==="unsubscribe")i.unsubscribe(a.topic)}run(i,s){let a=i.get("Cookie"),t=new Map;if(a){let r=a.split(";");for(let l of r){let[o,c]=l.split("=");t.set(o.trim(),c.trim())}}this.context.run({headers:i,cookies:t},s)}}class Ai{static async user(){let i=ci.getStore(),s=Is.use().context.getStore(),a="",t="";if(i?.req)a=i.req.cookies.get("access_token"),t=i.req.headers.get("User-Agent");if(s?.cookies)t=s.headers.get("User-Agent"),a=s.cookies.get("access_token");let r=i?.user;if(!r)r=(await oa.use().getSession(a,t))?.user,i?.setUser(r);if(r)return r;return null}static async guard(i){let s=await Ai.user();if(!s)throw new Ea;try{if(!await i(s))throw new Ea}catch(a){throw new Ea}}static async guardSafe(i){let s=await Ai.user();if(!s)return!1;try{return await i(s)}catch(a){return!1}}}function xi(i,s){return i.replace(/:([^/]+)/g,(a,t)=>{let r=t.endsWith("?"),l=r?t.slice(0,-1):t,o=s[l];if(o===void 0){if(r)return"";throw new Error(`Missing parameter: ${l}`)}return String(o)}).replace(/\/\//g,"/")}class zo extends Io{constructor(i){super("Redirect error");this.name="RedirectError",this.payload={api:{status:200,data:{},directive:{kind:"Redirect",path:i}},view:{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:i}}}}}class Co{static to(i,...s){let[a={}]=s;throw new zo(xi(i,a))}}class et extends zs{middlewares=["cache:private"];routes={"/translations":this.get(async()=>{let i=new R,{scope:s,locale:a}=i.search.toJSON(),t=a??gs.use().detectLocale(i),r=gs.use().getPageTranslations(t,s);return i.ctx().setCookie("i18n-locale",t,{expires:new Date(Date.now()+31536000000)}),{[t]:r}})}}class gs extends hi{i;static _name="I18nServiceContainer";isEnabled=!1;translations=new Map;supportedLocales=[];constructor(i){super();this.service=i;let s=new Map;for(let[t,r]of Object.entries(this.service.dictionary))for(let[l,o]of Object.entries(r))for(let[c,d]of Object.entries(o)){let f=c==="default"?this.service.defaultLocale:c;if(!s.has(`${f}.${t}`))s.set(`${f}.${t}`,new Map);s.get(`${f}.${t}`)?.set(l,d),this.isEnabled=!0}let a=new Set(i.supportedLocales);for(let[t,r]of s.entries()){this.translations.set(t,Object.fromEntries(r.entries()));let[l]=t.split(".");if(!a.has(l))a.add(l)}this.supportedLocales=Array.from(a)}detectLocale(i){let s=this.service.detectLocale(i);if(this.supportedLocales.includes(s))return s;let t=i.cookies.get("i18n-locale")??(i.headers.get("accept-language")||"en-US"),[r]=t.split(","),l=r.length===2?`${r}-${r.toUpperCase()}`:r;if(this.supportedLocales.includes(l))return l;let o=this.service.defaultLocale??this.supportedLocales[0];if(o)return o;return"en-US"}getPageTranslations(i,s){if(!s)return{};let a=this.translations.get(`${i}.view:${s}`)??{},t={[`view:${s}`]:a};for(let[r]of this.translations.entries()){let l=r.split(".")[1];if(!l.startsWith("layout:"))continue;let o=l.split(":")[1];if(s?.startsWith(o))t[l]=this.translations.get(`${i}.${l}`)??{}}return t}}function No(i,s){return i.replace(/{{([^}]+)}}/g,(a,t)=>{let r=s[t];if(r===void 0)throw new Error(`Missing parameter: ${t}`);return r})}class Wo{static scope(i){return i}static translate(i,...s){let a=gs.use(),t=a.detectLocale(ci.getStore().req),r=a.translations.get(`${t}.server`)?.[i];if(!r)return i;return No(r,s[0])}}var Eo=sp(ap(),1);import{Buffer as tp}from"buffer";class ca extends hi{i;static _name="FileStorageServiceContainer";constructor(i){super();this.service=i}}class Jo{static async put(i){return ca.use().service.driver.put(i)}static async metadata(i){let s=tp.from(await i.arrayBuffer());try{return await Eo.default(s).metadata()}catch{return{}}}static async fetch(i){return ca.use().service.driver.fetch(i)}static list(i){return ca.use().service.driver.list(i)}static delete(){}}function Uo(i){return Object.fromEntries(Object.entries(i).filter(([,s])=>{return s!==null&&s!==void 0}))}function di(i,s,a,t,r){return Di(s,sc(i,s),a,t,r)}function Di(i,s,a,t,r,l){let o=rr(s,a,t);if(r&&s!==o)throw new RangeError(Uf(i,s,a,t,l));return o}function sc(i,s){let a=i[s];if(a===void 0)throw new TypeError(zl(s));return a}function G(i){return i!==null&&/object|function/.test(typeof i)}function pi(i,s=Map){let a=new s;return(t,...r)=>{if(a.has(t))return a.get(t);let l=i(t,...r);return a.set(t,l),l}}function ur(i){return ws({name:i},1)}function ws(i,s){return Si((a)=>({value:a,configurable:1,writable:!s}),i)}function ac(i){return Si((s)=>({get:s,configurable:1}),i)}function ea(i){return{[Symbol.toStringTag]:{value:i,configurable:1}}}function _s(i,s){let a={},t=i.length;for(let r of s)a[i[--t]]=r;return a}function Si(i,s,a){let t={};for(let r in s)t[r]=i(s[r],r,a);return t}function Pa(i,s,a){let t={};for(let r=0;r<s.length;r++){let l=s[r];t[l]=i(l,r,a)}return t}function rp(i,s,a){let t={};for(let r=0;r<i.length;r++)t[s[r]]=a[i[r]];return t}function gi(i,s){let a={};for(let t of i)a[t]=s[t];return a}function gr(i,s){let a={};for(let t in s)i.has(t)||(a[t]=s[t]);return a}function hr(i){i={...i};let s=Object.keys(i);for(let a of s)i[a]===void 0&&delete i[a];return i}function tc(i,s){for(let a of s)if(!(a in i))return 0;return 1}function rc(i,s,a){for(let t of i)if(s[t]!==a[t])return 0;return 1}function lc(i,s,a){let t={...a};for(let r=0;r<s;r++)t[i[r]]=0;return t}function O(i,...s){return(...a)=>i(...s,...a)}function _o(i){return i[0].toUpperCase()+i.substring(1)}function wa(i){return i.slice().sort()}function Ga(i,s){return String(s).padStart(i,"0")}function Qi(i,s){return Math.sign(i-s)}function rr(i,s,a){return Math.min(Math.max(i,s),a)}function Ji(i,s){return[Math.floor(i/s),fa(i,s)]}function fa(i,s){return(i%s+s)%s}function qi(i,s){return[it(i,s),Tr(i,s)]}function it(i,s){return Math.trunc(i/s)||0}function Tr(i,s){return i%s||0}function Ja(i){return Math.abs(i%1)===0.5}function oc(i,s,a){let t=0,r=0;for(let c=0;c<=s;c++){let d=i[a[c]],f=ni[c],m=v/f,[p,u]=qi(d,m);t+=u*f,r+=p}let[l,o]=qi(t,v);return[r+l,o]}function st(i,s,a){let t={};for(let r=s;r>=0;r--){let l=ni[r];t[a[r]]=it(i,l),i=Tr(i,l)}return t}function cc(i){return i===y?Nt:[]}function dc(i){return i===y?ja:[]}function fc(i){return i===y?["year","day"]:[]}function mc(i){if(i!==void 0)return I(i)}function pc(i){if(i!==void 0)return vi(i)}function Pr(i){if(i!==void 0)return ba(i)}function vi(i){return hc(ba(i))}function ba(i){return gc(Qp(i))}function wr(i){if(i==null)throw new TypeError("Cannot be null or undefined");return i}function uc(i,s){if(s==null)throw new RangeError(zl(i));return s}function _i(i){if(!G(i))throw new TypeError(Jf);return i}function at(i,s,a=i){if(typeof s!==i)throw new TypeError(va(a,s));return s}function gc(i,s="number"){if(!Number.isInteger(i))throw new RangeError(Op(s,i));return i||0}function hc(i,s="number"){if(i<=0)throw new RangeError(yp(s,i));return i}function br(i){if(typeof i=="symbol")throw new TypeError(Mp);return String(i)}function Ya(i,s){return G(i)?String(i):I(i,s)}function tt(i){if(typeof i=="string")return BigInt(i);if(typeof i!="bigint")throw new TypeError(vp(i));return i}function Tc(i,s="number"){if(typeof i=="bigint")throw new TypeError(Sp(s));if(i=Number(i),!Number.isFinite(i))throw new RangeError(Fp(s,i));return i}function e(i,s){return Math.trunc(Tc(i,s))||0}function Pc(i,s){return gc(Tc(i,s),s)}function Bo(i,s){return hc(e(i,s),s)}function Dr(i,s){let[a,t]=qi(s,v),r=i+a,l=Math.sign(r);return l&&l===-Math.sign(t)&&(r-=l,t+=l*v),[r,t]}function Ns(i,s,a=1){return Dr(i[0]+s[0]*a,i[1]+s[1]*a)}function Ws(i,s){return Dr(i[0],i[1]+s)}function Ti(i,s){return Ns(s,i,-1)}function si(i,s){return Qi(i[0],s[0])||Qi(i[1],s[1])}function wc(i,s,a){return si(i,s)===-1||si(i,a)===1}function rt(i,s=1){let a=BigInt(v/s);return[Number(i/a),Number(i%a)*s]}function Es(i,s=1){let a=v/s,[t,r]=qi(i,a);return[t,r*s]}function bc(i,s=1){let[a,t]=i,r=Math.floor(t/s),l=v/s;return BigInt(a)*BigInt(l)+BigInt(r)}function Pi(i,s=1,a){let[t,r]=i,[l,o]=qi(r,s);return t*(v/s)+(l+(a?o/s:0))}function Or(i,s,a=Ji){let[t,r]=i,[l,o]=a(r,s);return[t*(v/s)+l,o]}function yr(i,s){let a=i.formatToParts(s),t={};for(let r of a)t[r.type]=r.value;return t}function Fr(i){return di(i,"isoYear",Ta,ha,1),i.isoYear===Ta?di(i,"isoMonth",4,12,1):i.isoYear===ha&&di(i,"isoMonth",1,9,1),i}function Vi(i){return Bi({...i,...Fi,isoHour:12}),i}function Bi(i){let s=di(i,"isoYear",Ta,ha,1),a=s===Ta?1:s===ha?-1:0;return a&&wi(ii({...i,isoDay:i.isoDay+a,isoNanosecond:i.isoNanosecond-a})),i}function wi(i){if(!i||wc(i,au,su))throw new RangeError(nt);return i}function ei(i){return oc(i,5,Zi)[1]}function lt(i){let[s,a]=Ji(i,v);return[st(a,5,Zi),s]}function Dc(i){return Oc(i)[0]}function Oc(i){return Or(i,yi)}function ai(i){return Bs(i.isoYear,i.isoMonth,i.isoDay,i.isoHour,i.isoMinute,i.isoSecond,i.isoMillisecond)}function ii(i){let s=ai(i);if(s!==void 0){let[a,t]=qi(s,mi);return[a,t*Ii+(i.isoMicrosecond||0)*Ls+(i.isoNanosecond||0)]}}function Sr(i,s){let[a,t]=lt(ei(i)-s);return wi(ii({...i,isoDay:i.isoDay+t,...a}))}function Xa(...i){return Bs(...i)/Vf}function Bs(...i){let[s,a]=yc(...i),t=s.valueOf();if(!isNaN(t))return t-a*mi}function yc(i,s=1,a=1,t=0,r=0,l=0,o=0){let c=i===Ta?1:i===ha?-1:0,d=new Date;return d.setUTCHours(t,r,l,o),d.setUTCFullYear(i,s-1,a+c),[d,c]}function ss(i,s){let[a,t]=Ws(i,s);t<0&&(t+=v,a-=1);let[r,l]=Ji(t,Ii),[o,c]=Ji(l,Ls);return ot(a*mi+r,o,c)}function ot(i,s=0,a=0){let t=Math.ceil(Math.max(0,Math.abs(i)-iu)/mi)*Math.sign(i),r=new Date(i-t*mi);return _s(Et,[r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate()+t,r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds(),s,a])}function Fc(i){return[i.isoYear,i.isoMonth,i.isoDay]}function Sc(){return Ei}function vr(i,s){switch(s){case 2:return Mr(i)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function vc(i){return Mr(i)?366:365}function Mr(i){return i%4==0&&(i%100!=0||i%400==0)}function Mc(i){let[s,a]=yc(i.isoYear,i.isoMonth,i.isoDay);return fa(s.getUTCDay()-a,7)||7}function Lc({isoYear:i}){return i<1?["bce",1-i]:["ce",i]}function lp(i){let s=ai(i);if(s<ru)return Lc(i);let a=yr(kl(Js),s),{era:t,eraYear:r}=Ed(a,Js);return[t,r]}function ct(i){return bs(i),dt(i,1),i}function bs(i){return jc(i,1),i}function Ro(i){return rc(Hl,i,jc(i))}function jc(i,s){let{isoYear:a}=i,t=di(i,"isoMonth",1,Sc(),s);return{isoYear:a,isoMonth:t,isoDay:di(i,"isoDay",1,vr(a,t),s)}}function dt(i,s){return _s(Zi,[di(i,"isoHour",0,23,s),di(i,"isoMinute",0,59,s),di(i,"isoSecond",0,59,s),di(i,"isoMillisecond",0,999,s),di(i,"isoMicrosecond",0,999,s),di(i,"isoNanosecond",0,999,s)])}function F(i){return i===void 0?0:gm(_i(i))}function Da(i,s=0){i=Mi(i);let a=hm(i),t=hu(i,s);return[gm(i),t,a]}function Lr(i){return hm(Mi(i))}function Zc(i){return i=Mi(i),Xl(i,9,6,1)}function Rs(i,s,a,t=9,r=0,l=4){s=Mi(s);let o=Xl(s,t,r),c=xr(s),d=xa(s,l),f=Za(s,t,r,1);return o==null?o=Math.max(a,f):Ic(o,f),c=$r(c,f,1),i&&(d=((m)=>m<4?(m+2)%4:m)(d)),[o,f,c,d]}function ft(i,s=6,a){let t=xr(i=nr(i,qa)),r=xa(i,7),l=Za(i,s);return l=uc(qa,l),t=$r(t,l,void 0,a),[l,t,r]}function jr(i){return Kl(Mi(i))}function xc(i,s){return Zr(Mi(i),s)}function Zr(i,s=4){let a=nc(i);return[xa(i,4),...$c(Za(i,s),a)]}function $c(i,s){return i!=null?[ni[i],i<4?9-3*i:-1]:[s===void 0?1:10**(9-s),s]}function xr(i){let s=i[ma];return s===void 0?1:e(s,ma)}function $r(i,s,a,t){let r=t?v:ni[s+1];if(r){let l=ni[s];if(r%((i=Di(ma,i,1,r/l-(t?0:1),1))*l))throw new RangeError(va(ma,i))}else i=Di(ma,i,1,a?1e9:1,1);return i}function nc(i){let s=i[tr];if(s!==void 0){if(typeof s!="number"){if(br(s)==="auto")return;throw new RangeError(va(tr,s))}s=Di(tr,Math.floor(s),0,9,1)}return s}function Mi(i){return i===void 0?{}:_i(i)}function nr(i,s){return typeof i=="string"?{[s]:i}:_i(i)}function W(i){if(i!==void 0){if(G(i))return Object.assign(Object.create(null),i);throw new TypeError(Jf)}}function mt(i,s){return i&&Object.assign(Object.create(null),i,{overflow:ou[s]})}function Ir(i,s,a=9,t=0,r){let l=s[i];if(l===void 0)return r?t:void 0;if(l=br(l),l==="auto")return r?t:null;let o=dr[l];if(o===void 0&&(o=qp[l]),o===void 0)throw new RangeError(Rf(i,l,dr));return Di(i,o,t,a,1,La),o}function Ds(i,s,a,t=0){let r=a[i];if(r===void 0)return t;let l=br(r),o=s[l];if(o===void 0)throw new RangeError(Rf(i,l,s));return o}function Ic(i,s){if(s>i)throw new RangeError(Gp)}function Y(i){return{branding:Ut,epochNanoseconds:i}}function Q(i,s,a){return{branding:Yi,calendar:a,timeZone:s,epochNanoseconds:i}}function E(i,s=i.calendar){return{branding:Zs,calendar:s,...gi(fm,i)}}function J(i,s=i.calendar){return{branding:js,calendar:s,...gi(Gl,i)}}function Ts(i,s=i.calendar){return{branding:Vs,calendar:s,...gi(Gl,i)}}function Ka(i,s=i.calendar){return{branding:ks,calendar:s,...gi(Gl,i)}}function Li(i){return{branding:Jt,...gi(dm,i)}}function x(i){return{branding:_t,sign:as(i),...gi(_l,i)}}function zc(i){return Dc(i.epochNanoseconds)}function pt(i){return Or(i.epochNanoseconds,Ii)[0]}function Cc(i){return bc(i.epochNanoseconds,Ls)}function Nc(i){return bc(i.epochNanoseconds)}function Wc(i){return i.epochNanoseconds}function K(i){return typeof i=="string"?i:I(i.id)}function Hs(i,s){return i===s||K(i)===K(s)}function Ec(i,s,a,t,r){let l=Ps(t),[o,c]=((P,b)=>{let w=b((P=nr(P,pr))[pm]),D=gu(P);return D=uc(pr,D),[D,w]})(r,i);if(ua(Math.max(o,l),c))return Ho(t,o);if(!c)throw new RangeError(It);let[d,f,m]=wt(s,a,c),p=al(m),u=bt(m),g=tl(m),h=u(f,d,t),T=g(f,d,h,o);return ua(o,c)?Ho(T,o):((P,b,w,D,N,$,Z)=>{let n=as(P),[X,B]=zr(D,Rl(w,P),w,n,N,$,Z),ra=Cr(b,X,B);return P[S[w]]+ra*n})(T,p(h),o,f,d,p,u)}function Ho(i,s){return Pi(H(i),ni[s],1)}function zr(i,s,a,t,r,l,o){let c=S[a],d={...s,[c]:s[c]+t},f=o(i,r,s),m=o(i,r,d);return[l(f),l(m)]}function Cr(i,s,a){let t=Pi(Ti(s,a));if(!t)throw new RangeError(Ma);return Pi(Ti(s,i))/t}function Jc(i,s){let[a,t,r]=ft(s,5,1);return Y(gt(i.epochNanoseconds,a,t,r,1))}function Uc(i,s,a){let{epochNanoseconds:t,timeZone:r,calendar:l}=s,[o,c,d]=ft(a);if(o===0&&c===1)return s;let f=i(r);if(o===6)t=((m,p,u,g)=>{let h=ti(u,p),[T,P]=m(h),b=u.epochNanoseconds,w=ui(p,T),D=ui(p,P);if(wc(b,w,D))throw new RangeError(Ma);return Ac(Cr(b,w,D),g)?D:w})(Xc,f,s,d);else{let m=f.getOffsetNanosecondsFor(t);t=ys(f,Gc(ss(t,m),o,c,d),m,2,0,1)}return Q(t,r,l)}function _c(i,s){return E(Gc(i,...ft(s)),i.calendar)}function Bc(i,s){let[a,t,r]=ft(s,5);var l;return Li((l=r,Nr(i,Oa(a,t),l)[0]))}function Rc(i,s){let a=i(s.timeZone),t=ti(s,a),[r,l]=Xc(t),o=Pi(Ti(ui(a,r),ui(a,l)),Ct,1);if(o<=0)throw new RangeError(Ma);return o}function Hc(i,s){let{timeZone:a,calendar:t}=s,r=((l,o,c)=>ui(o,l(ti(c,o))))(Kc,i(a),s);return Q(r,a,t)}function Gc(i,s,a,t){return Yc(i,Oa(s,a),t)}function Yc(i,s,a){let[t,r]=Nr(i,s,a);return Bi({...Fs(i,r),...t})}function Nr(i,s,a){return lt(is(ei(i),s,a))}function Aa(i){return is(i,zt,7)}function Oa(i,s){return ni[i]*s}function Xc(i){let s=Kc(i);return[s,Fs(s,1)]}function Kc(i){return ep(6,i)}function op(i,s,a){let t=Math.min(Ps(i),6);return Ys(ht(H(i,t),s,a),t)}function ut(i,s,a,t,r,l,o,c,d,f){if(t===0&&r===1)return i;let m=ua(t,c)?Dt(c)&&t<6&&a>=6?dp:cp:fp,[p,u,g]=m(i,s,a,t,r,l,o,c,d,f);return g&&t!==7&&(p=((h,T,P,b,w,D,N,$)=>{let Z=as(h);for(let n=b+1;n<=P;n++){if(n===7&&P!==7)continue;let X=Rl(n,h);X[S[n]]+=Z;let B=Pi(Ti(N($(w,D,X)),T));if(B&&Math.sign(B)!==Z)break;h=X}return h})(p,u,a,Math.max(6,t),o,c,d,f)),p}function gt(i,s,a,t,r){if(s===6){let l=((o)=>o[0]+o[1]/v)(i);return[is(l,a,t),0]}return ht(i,Oa(s,a),t,r)}function ht(i,s,a,t){let[r,l]=i;t&&l<0&&(l+=v,r-=1);let[o,c]=Ji(is(l,s,a),v);return Dr(r+o,c)}function is(i,s,a){return Ac(i/s,a)*s}function Ac(i,s){return wu[s](i)}function cp(i,s,a,t,r,l){let o=as(i),c=H(i),d=gt(c,t,r,l),f=Ti(c,d),m=Math.sign(d[0]-c[0])===o,p=Ys(d,Math.min(a,6));return[{...i,...p},Ns(s,f),m]}function dp(i,s,a,t,r,l,o,c,d,f){let m=as(i),p=Pi(H(i,5)),u=Oa(t,r),g=is(p,u,l),[h,T]=zr(o,{...i,...Bl},6,m,c,d,f),P=g-Pi(Ti(h,T)),b=0;P&&Math.sign(P)!==m?s=Ws(h,g):(b+=m,g=is(P,u,l),s=Ws(T,g));let w=yt(g);return[{...i,...w,days:i.days+b},s,Boolean(b)]}function fp(i,s,a,t,r,l,o,c,d,f){let m=as(i),p=S[t],u=Rl(t,i);t===7&&(i={...i,weeks:i.weeks+Math.trunc(i.days/7)});let g=it(i[p],r)*r;u[p]=g;let[h,T]=zr(o,u,t,r*m,c,d,f),P=g+Cr(s,h,T)*m*r,b=is(P,r,l),w=Math.sign(b-P)===m;return u[p]=b,[u,w?T:h,w]}function Wr(i,s,a,t){let[r,l,o,c]=((f)=>{let m=Zr(f=Mi(f));return[f.timeZone,...m]})(t),d=r!==void 0;return((f,m,p,u,g,h)=>{p=ht(p,g,u,1);let T=m.getOffsetNanosecondsFor(p);return Hr(ss(p,T),h)+(f?Os(Aa(T)):"Z")})(d,s(d?i(r):xs),a.epochNanoseconds,l,o,c)}function Er(i,s,a){let[t,r,l,o,c,d]=((f)=>{f=Mi(f);let m=Kl(f),p=nc(f),u=Pu(f),g=xa(f,4),h=Za(f,4);return[m,Tu(f),u,g,...$c(h,p)]})(a);return((f,m,p,u,g,h,T,P,b,w)=>{u=ht(u,b,P,1);let D=f(p).getOffsetNanosecondsFor(u);return Hr(ss(u,D),w)+Os(Aa(D),T)+((N,$)=>$!==1?"["+($===2?"!":"")+K(N)+"]":"")(p,h)+Gr(m,g)})(i,s.calendar,s.timeZone,s.epochNanoseconds,t,r,l,o,c,d)}function Jr(i,s){let[a,t,r,l]=((f)=>(f=Mi(f),[Kl(f),...Zr(f)]))(s);return o=i.calendar,c=a,d=l,Hr(Yc(i,r,t),d)+Gr(o,c);var o,c,d}function Ur(i,s){return a=i.calendar,t=i,r=jr(s),Qa(t)+Gr(a,r);var a,t,r}function _r(i,s){return Qc(i.calendar,Vc,i,jr(s))}function Br(i,s){return Qc(i.calendar,mp,i,jr(s))}function Rr(i,s){let[a,t,r]=xc(s);return l=r,kc(Nr(i,t,a)[0],l);var l}function Tt(i,s){let[a,t,r]=xc(s,3);return t>1&&(i={...i,...op(i,t,a)}),((l,o)=>{let{sign:c}=l,d=c===-1?ri(l):l,{hours:f,minutes:m}=d,[p,u]=Or(H(d,3),yi,qi);ld(p);let g=Yr(u,o),h=o>=0||!c||g;return(c<0?"-":"")+"P"+Go({Y:hs(d.years),M:hs(d.months),W:hs(d.weeks),D:hs(d.days)})+(f||m||p||h?"T"+Go({H:hs(f),M:hs(m),S:hs(p,h)+g}):"")})(i,r)}function Qc(i,s,a,t){let r=K(i),l=t>1||t===0&&r!==y;return t===1?r===y?s(a):Qa(a):l?Qa(a)+qc(r,t===2):s(a)}function Go(i){let s=[];for(let a in i){let t=i[a];t&&s.push(t,a)}return s.join("")}function Hr(i,s){return Qa(i)+"T"+kc(i,s)}function Qa(i){return Vc(i)+"-"+Oi(i.isoDay)}function Vc(i){let{isoYear:s}=i;return(s<0||s>9999?ec(s)+Ga(6,Math.abs(s)):Ga(4,s))+"-"+Oi(i.isoMonth)}function mp(i){return Oi(i.isoMonth)+"-"+Oi(i.isoDay)}function kc(i,s){let a=[Oi(i.isoHour),Oi(i.isoMinute)];return s!==-1&&a.push(Oi(i.isoSecond)+((t,r,l,o)=>Yr(t*Ii+r*Ls+l,o))(i.isoMillisecond,i.isoMicrosecond,i.isoNanosecond,s)),a.join(":")}function Os(i,s=0){if(s===1)return"";let[a,t]=Ji(Math.abs(i),Ct),[r,l]=Ji(t,zt),[o,c]=Ji(l,yi);return ec(i)+Oi(a)+":"+Oi(r)+(o||c?":"+Oi(o)+Yr(c):"")}function Gr(i,s){if(s!==1){let a=K(i);if(s>1||s===0&&a!==y)return qc(a,s===2)}return""}function qc(i,s){return"["+(s?"!":"")+"u-ca="+i+"]"}function Yr(i,s){let a=Ga(9,i);return a=s===void 0?a.replace(Ou,""):a.slice(0,s),a?"."+a:""}function ec(i){return i<0?"-":"+"}function hs(i,s){return i||s?i.toLocaleString("fullwide",{useGrouping:0}):""}function pp(i,s){let{epochNanoseconds:a}=i,t=(s.getOffsetNanosecondsFor?s:s(i.timeZone)).getOffsetNanosecondsFor(a),r=ss(a,t);return{calendar:i.calendar,...r,offsetNanoseconds:t}}function id(i,s){let a=ti(s,i);return{calendar:s.calendar,...gi(fm,a),offset:Os(a.offsetNanoseconds),timeZone:s.timeZone}}function ys(i,s,a,t=0,r=0,l,o){if(a!==void 0&&t===1&&(t===1||o))return Sr(s,a);let c=i.getPossibleInstantsFor(s);if(a!==void 0&&t!==3){let d=((f,m,p,u)=>{let g=ii(m);u&&(p=Aa(p));for(let h of f){let T=Pi(Ti(h,g));if(u&&(T=Aa(T)),T===p)return h}})(c,s,a,l);if(d!==void 0)return d;if(t===0)throw new RangeError(Jp)}return o?ii(s):ui(i,s,r,c)}function ui(i,s,a=0,t=i.getPossibleInstantsFor(s)){if(t.length===1)return t[0];if(a===1)throw new RangeError(Up);if(t.length)return t[a===3?1:0];let r=ii(s),l=((c,d)=>{let f=c.getOffsetNanosecondsFor(Ws(d,-v));return Kr(c.getOffsetNanosecondsFor(Ws(d,v))-f)})(i,r),o=l*(a===2?-1:1);return(t=i.getPossibleInstantsFor(ss(r,o)))[a===2?0:t.length-1]}function Xr(i){if(Math.abs(i)>=v)throw new RangeError(Wp);return i}function Kr(i){if(i>v)throw new RangeError(Ep);return i}function Ar(i,s,a){return Y(wi(Ns(s.epochNanoseconds,((t)=>{if(od(t))throw new RangeError(Rp);return H(t,5)})(i?ri(a):a))))}function Qr(i,s,a,t,r,l=Object.create(null)){let o=s(t.timeZone),c=i(t.calendar);return{...t,...il(o,c,t,a?ri(r):r,l)}}function Vr(i,s,a,t,r=Object.create(null)){let{calendar:l}=a;return E(sl(i(l),a,s?ri(t):t,r),l)}function kr(i,s,a,t,r){let{calendar:l}=a;return J(Pt(i(l),a,s?ri(t):t,r),l)}function qr(i,s,a,t,r=Object.create(null)){let l=a.calendar,o=i(l),c=pa(o,a);s&&(t=Ot(t)),t.sign<0&&(c=o.dateAdd(c,{...A,months:1}),c=Fs(c,-1));let d=o.dateAdd(c,t,r);return Ts(pa(o,d),l)}function er(i,s,a){return Li(sd(s,i?ri(a):a)[0])}function il(i,s,a,t,r){let l=H(t,5),o=a.epochNanoseconds;if(od(t)){let c=ti(a,i);o=Ns(ui(i,{...Pt(s,c,{...t,...Bl},r),...gi(Zi,c)}),l)}else o=Ns(o,l),F(r);return{epochNanoseconds:wi(o)}}function sl(i,s,a,t){let[r,l]=sd(s,a);return Bi({...Pt(i,s,{...a,...Bl,days:a.days+l},t),...r})}function Pt(i,s,a,t){if(a.years||a.months||a.weeks)return i.dateAdd(s,a,t);F(t);let r=a.days+H(a,5)[0];return r?Vi(Fs(s,r)):s}function pa(i,s,a=1){return Fs(s,a-i.day(s))}function sd(i,s){let[a,t]=H(s,5),[r,l]=lt(ei(i)+t);return[r,a+l]}function Fs(i,s){return s?{...i,...ot(ai(i)+s*mi)}:i}function wt(i,s,a){let t=i(a.calendar);return Dt(a)?[a,t,s(a.timeZone)]:[{...a,...Fi},t]}function al(i){return i?Wc:ii}function bt(i){return i?O(il,i):sl}function tl(i){return i?O(gp,i):hp}function Dt(i){return i&&i.epochNanoseconds}function ua(i,s){return i<=6-(Dt(s)?1:0)}function rl(i,s,a,t,r,l,o){let c=i(Mi(o).relativeTo),d=Math.max(Ps(r),Ps(l));if(ua(d,c))return x(Gs(((T,P,b,w)=>{let D=Ns(H(T),H(P),w?-1:1);if(!Number.isFinite(D[0]))throw new RangeError(nt);return{...A,...Ys(D,b)}})(r,l,d,t)));if(!c)throw new RangeError(It);t&&(l=ri(l));let[f,m,p]=wt(s,a,c),u=bt(p),g=tl(p),h=u(m,f,r);return x(g(m,f,u(m,h,l),d))}function ad(i,s,a,t,r){let l=Ps(t),[o,c,d,f,m]=((Z,n,X)=>{Z=nr(Z,qa);let B=Xl(Z),ra=X(Z[pm]),la=xr(Z),em=xa(Z,7),us=Za(Z);if(B===void 0&&us===void 0)throw new RangeError(Hp);return us==null&&(us=0),B==null&&(B=Math.max(us,n)),Ic(B,us),la=$r(la,us,1),[B,us,la,em,ra]})(r,l,i),p=Math.max(l,o);if(!Dt(m)&&p<=6)return x(Gs(((Z,n,X,B,ra)=>{let la=gt(H(Z),X,B,ra);return{...A,...Ys(la,n)}})(t,o,c,d,f)));if(!m)throw new RangeError(It);let[u,g,h]=wt(s,a,m),T=al(h),P=bt(h),b=tl(h),w=P(g,u,t),D=b(g,u,w,o),N=t.sign,$=as(D);if(N&&$&&N!==$)throw new RangeError(Ma);return $&&(D=ut(D,T(w),o,c,d,f,g,u,T,P)),x(D)}function td(i){return i.sign===-1?Ot(i):i}function Ot(i){return x(ri(i))}function ri(i){let s={};for(let a of S)s[a]=-1*i[a]||0;return s}function rd(i){return!i.sign}function as(i,s=S){let a=0;for(let t of s){let r=Math.sign(i[t]);if(r){if(a&&a!==r)throw new RangeError(Bp);a=r}}return a}function Gs(i){for(let s of kp)Di(s,i[s],-ko,ko,1);return ld(Pi(H(i),yi)),i}function ld(i){if(!Number.isSafeInteger(i))throw new RangeError(_p)}function H(i,s=6){return oc(i,s,S)}function Ys(i,s=6){let[a,t]=i,r=st(t,s,S);if(r[S[s]]+=a*(v/ni[s]),!Number.isFinite(r[S[s]]))throw new RangeError(nt);return r}function yt(i,s=5){return st(i,s,S)}function od(i){return Boolean(as(i,cm))}function Ps(i){let s=9;for(;s>0&&!i[S[s]];s--);return s}function up(i,s){return[i,s]}function Yo(i){let s=Math.floor(i/Ra)*Ra;return[s,s+Ra]}function cd(i){let s=ts(i=Ya(i));if(!s)throw new RangeError(fi(i));let a;if(s.m)a=0;else{if(!s.offset)throw new RangeError(fi(i));a=Xs(s.offset)}return s.timeZone&&dl(s.timeZone,1),Y(Sr(ct(s),a))}function dd(i){let s=ts(I(i));if(!s)throw new RangeError(fi(i));if(s.timeZone)return wd(s,s.offset?Xs(s.offset):void 0);if(s.m)throw new RangeError(fi(i));return Dd(s)}function fd(i,s){let a=ts(I(i));if(!a||!a.timeZone)throw new RangeError(fi(i));let{offset:t}=a,r=t?Xs(t):void 0,[,l,o]=Da(s);return wd(a,r,l,o)}function Xs(i){let s=dl(i);if(s===void 0)throw new RangeError(fi(i));return s}function md(i){let s=ts(I(i));if(!s||s.m)throw new RangeError(fi(i));return E(bd(s))}function Ft(i){let s=ts(I(i));if(!s||s.m)throw new RangeError(fi(i));return J(s.p?bd(s):Dd(s))}function pd(i,s){let a=ol(I(s));if(a)return ll(a),Ts(Fr(bs(a)));let t=Ft(s);return Ts(pa(i(t.calendar),t))}function ll(i){if(i.calendar!==y)throw new RangeError(Ui(i.calendar))}function ud(i,s){let a=cl(I(s));if(a)return ll(a),Ka(bs(a));let t=Ft(s),{calendar:r}=t,l=i(r),[o,c,d]=l.h(t),[f,m]=l.I(o,c),[p,u]=l.N(f,m,d);return Ka(Vi(l.P(p,u,d)),r)}function gd(i){let s,a=((t)=>{let r=Mu.exec(t);return r?(St(r[10]),Fd(r)):void 0})(I(i));if(!a){if(a=ts(i),!a)throw new RangeError(fi(i));if(!a.p)throw new RangeError(fi(i));if(a.m)throw new RangeError(Ui("Z"));ll(a)}if((s=ol(i))&&Ro(s))throw new RangeError(fi(i));if((s=cl(i))&&Ro(s))throw new RangeError(fi(i));return Li(dt(a,1))}function hd(i){let s=((a)=>{let t=Zu.exec(a);return t?((r)=>{function l(m,p,u){let g=0,h=0;if(u&&([g,d]=Ji(d,ni[u])),m!==void 0){if(c)throw new RangeError(Ui(m));h=((T)=>{let P=parseInt(T);if(!Number.isFinite(P))throw new RangeError(Ui(T));return P})(m),o=1,p&&(d=fl(p)*(ni[u]/yi),c=1)}return g+h}let o=0,c=0,d=0,f={..._s(S,[l(r[2]),l(r[3]),l(r[4]),l(r[5]),l(r[6],r[7],5),l(r[8],r[9],4),l(r[10],r[11],3)]),...st(d,2,S)};if(!o)throw new RangeError(_f(S));return ml(r[1])<0&&(f=ri(f)),f})(t):void 0})(I(i));if(!s)throw new RangeError(fi(i));return x(Gs(s))}function Td(i){let s=ts(i)||ol(i)||cl(i);return s?s.calendar:i}function Pd(i){let s=ts(i);return s&&(s.timeZone||s.m&&xs||s.offset)||i}function wd(i,s,a=0,t=0){let r=vt(i.timeZone),l=Bt(r);return Q(ys(l,ct(i),s,a,t,!l.v,i.m),r,ya(i.calendar))}function bd(i){return Od(Bi(ct(i)))}function Dd(i){return Od(Vi(bs(i)))}function Od(i){return{...i,calendar:ya(i.calendar)}}function ts(i){let s=vu.exec(i);return s?((a)=>{let t=a[10],r=(t||"").toUpperCase()==="Z";return{isoYear:yd(a),isoMonth:parseInt(a[4]),isoDay:parseInt(a[5]),...Fd(a.slice(5)),...St(a[16]),p:Boolean(a[6]),m:r,offset:r?void 0:t}})(s):void 0}function ol(i){let s=Fu.exec(i);return s?((a)=>({isoYear:yd(a),isoMonth:parseInt(a[4]),isoDay:1,...St(a[5])}))(s):void 0}function cl(i){let s=Su.exec(i);return s?((a)=>({isoYear:Us,isoMonth:parseInt(a[1]),isoDay:parseInt(a[2]),...St(a[3])}))(s):void 0}function dl(i,s){let a=Lu.exec(i);return a?((t,r)=>{let l=t[4]||t[5];if(r&&l)throw new RangeError(Ui(l));return Xr((Cs(t[2])*Ct+Cs(t[3])*zt+Cs(t[4])*yi+fl(t[5]||""))*ml(t[1]))})(a,s):void 0}function yd(i){let s=ml(i[1]),a=parseInt(i[2]||i[3]);if(s<0&&!a)throw new RangeError(Ui(-0));return s*a}function Fd(i){let s=Cs(i[3]);return{...lt(fl(i[4]||""))[0],isoHour:Cs(i[1]),isoMinute:Cs(i[2]),isoSecond:s===60?59:s}}function St(i){let s,a,t=[];if(i.replace(ju,(r,l,o)=>{let c=Boolean(l),[d,f]=o.split("=").reverse();if(f){if(f==="u-ca")t.push(d),s||(s=c);else if(c||/[A-Z]/.test(f))throw new RangeError(Ui(r))}else{if(a)throw new RangeError(Ui(r));a=d}return""}),t.length>1&&s)throw new RangeError(Ui(i));return{timeZone:a,calendar:t[0]||y}}function fl(i){return parseInt(i.padEnd(9,"0"))}function Ks(i){return new RegExp(`^${i}\$`,"i")}function ml(i){return i&&i!=="+"?-1:1}function Cs(i){return i===void 0?0:parseInt(i)}function Sd(i){return vt(I(i))}function vt(i){let s=pl(i);return typeof s=="number"?Os(s):s?((a)=>{if($u.test(a))throw new RangeError(Np);return a.toLowerCase().split("/").map((t,r)=>(t.length<=3||/\d/.test(t))&&!/etc|yap/.test(t)?t.toUpperCase():t.replace(/baja|dumont|[a-z]+/g,(l,o)=>l.length<=2&&!r||l==="in"||l==="chat"?l.toUpperCase():l.length>2||!o?_o(l).replace(/island|noronha|murdo|rivadavia|urville/,_o):l)).join("/")})(i):xs}function Xo(i){let s=pl(i);return typeof s=="number"?s:s?s.resolvedOptions().timeZone:xs}function pl(i){let s=dl(i=i.toUpperCase(),1);return s!==void 0?s:i!==xs?xu(i):void 0}function ul(i,s){return si(i.epochNanoseconds,s.epochNanoseconds)}function gl(i,s){return si(i.epochNanoseconds,s.epochNanoseconds)}function vd(i,s,a,t,r,l){let o=i(Mi(l).relativeTo),c=Math.max(Ps(t),Ps(r));if(rc(S,t,r))return 0;if(ua(c,o))return si(H(t),H(r));if(!o)throw new RangeError(It);let[d,f,m]=wt(s,a,o),p=al(m),u=bt(m);return si(p(u(f,d,t)),p(u(f,d,r)))}function hl(i,s){return Ss(i,s)||Mt(i,s)}function Ss(i,s){return Qi(ai(i),ai(s))}function Mt(i,s){return Qi(ei(i),ei(s))}function Md(i,s){return!ul(i,s)}function Ld(i,s){return!gl(i,s)&&!!Lt(i.timeZone,s.timeZone)&&Hs(i.calendar,s.calendar)}function jd(i,s){return!hl(i,s)&&Hs(i.calendar,s.calendar)}function Zd(i,s){return!Ss(i,s)&&Hs(i.calendar,s.calendar)}function xd(i,s){return!Ss(i,s)&&Hs(i.calendar,s.calendar)}function $d(i,s){return!Ss(i,s)&&Hs(i.calendar,s.calendar)}function nd(i,s){return!Mt(i,s)}function Lt(i,s){if(i===s)return 1;let a=K(i),t=K(s);if(a===t)return 1;try{return Xo(a)===Xo(t)}catch(r){}}function Tl(i,s,a,t){let r=Rs(i,W(t),3,5),l=jt(s.epochNanoseconds,a.epochNanoseconds,...r);return x(i?ri(l):l)}function Pl(i,s,a,t,r,l){let o=xt(t.calendar,r.calendar),c=W(l),[d,f,m,p]=Rs(a,c,5),u=t.epochNanoseconds,g=r.epochNanoseconds,h=si(g,u),T;if(h)if(d<6)T=jt(u,g,d,f,m,p);else{let P=s(((w,D)=>{if(!Lt(w,D))throw new RangeError(Xf);return w})(t.timeZone,r.timeZone)),b=i(o);T=zd(b,P,t,r,h,d,c),T=ut(T,g,d,f,m,p,b,t,Wc,O(il,P))}else T=A;return x(a?ri(T):T)}function wl(i,s,a,t,r){let l=xt(a.calendar,t.calendar),o=W(r),[c,d,f,m]=Rs(s,o,6),p=ii(a),u=ii(t),g=si(u,p),h;if(g)if(c<=6)h=jt(p,u,c,d,f,m);else{let T=i(l);h=Cd(T,a,t,g,c,o),h=ut(h,u,c,d,f,m,T,a,ii,sl)}else h=A;return x(s?ri(h):h)}function bl(i,s,a,t,r){let l=xt(a.calendar,t.calendar),o=W(r);return Id(s,()=>i(l),a,t,...Rs(s,o,6,9,6),o)}function Dl(i,s,a,t,r){let l=xt(a.calendar,t.calendar),o=W(r),c=Rs(s,o,9,9,8),d=i(l);return Id(s,()=>d,pa(d,a),pa(d,t),...c,o)}function Id(i,s,a,t,r,l,o,c,d){let f=ii(a),m=ii(t),p;if(si(m,f))if(r===6)p=jt(f,m,r,l,o,c);else{let u=s();p=u.dateUntil(a,t,r,d),l===6&&o===1||(p=ut(p,m,r,l,o,c,u,a,ii,Pt))}else p=A;return x(i?ri(p):p)}function Ol(i,s,a,t){let r=W(t),[l,o,c,d]=Rs(i,r,5,5),f=is(yl(s,a),Oa(o,c),d),m={...A,...yt(f,l)};return x(i?ri(m):m)}function gp(i,s,a,t,r,l){let o=si(t.epochNanoseconds,a.epochNanoseconds);return o?r<6?Nd(a.epochNanoseconds,t.epochNanoseconds,r):zd(s,i,a,t,o,r,l):A}function hp(i,s,a,t,r){let l=ii(s),o=ii(a),c=si(o,l);return c?t<=6?Nd(l,o,t):Cd(i,s,a,c,t,r):A}function zd(i,s,a,t,r,l,o){let[c,d,f]=((u,g,h,T)=>{function P(){return n={...Fs(D,$++*-T),...w},X=ui(u,n),si(N,X)===-T}let b=ti(g,u),w=gi(Zi,b),D=ti(h,u),N=h.epochNanoseconds,$=0,Z=yl(b,D),n,X;if(Math.sign(Z)===-T&&$++,P()&&(T===-1||P()))throw new RangeError(Ma);let B=Pi(Ti(X,N));return[b,n,B]})(s,a,t,r);var m,p;return{...l===6?(m=c,p=d,{...A,days:Wd(m,p)}):i.dateUntil(c,d,l,o),...yt(f)}}function Cd(i,s,a,t,r,l){let[o,c,d]=((f,m,p)=>{let u=m,g=yl(f,m);return Math.sign(g)===-p&&(u=Fs(m,-p),g+=v*p),[f,u,g]})(s,a,t);return{...i.dateUntil(o,c,r,l),...yt(d)}}function jt(i,s,a,t,r,l){return{...A,...Ys(gt(Ti(i,s),t,r,l),a)}}function Nd(i,s,a){return{...A,...Ys(Ti(i,s),a)}}function Wd(i,s){return Zt(ai(i),ai(s))}function Zt(i,s){return Math.trunc((s-i)/mi)}function yl(i,s){return ei(s)-ei(i)}function xt(i,s){if(!Hs(i,s))throw new RangeError(Wl);return i}function Tp(i){function s(r){return((l,o)=>({...Ed(l,o),F:l.month,day:parseInt(l.day)}))(yr(a,r),t)}let a=kl(i),t=Va(i);return{id:i,O:Pp(s),B:wp(s)}}function Pp(i){return pi((s)=>{let a=ai(s);return i(a)},WeakMap)}function wp(i){let s=i(0).year-tu;return pi((a)=>{let t,r=Bs(a-s),l=[],o=[];do r+=400*mi;while((t=i(r)).year<=a);do r+=(1-t.day)*mi,t.year===a&&(l.push(r),o.push(t.F)),r-=mi;while((t=i(r)).year>=a);return{k:l.reverse(),C:Qf(o.reverse())}})}function Ed(i,s){let a,t,r=Jd(i);if(i.era){let l=rm[s];l!==void 0&&(a=s==="islamic"?"ah":i.era.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g,""),a==="bc"||a==="b"?a="bce":a!=="ad"&&a!=="a"||(a="ce"),t=r,r=Hd(t,l[a]||0))}return{era:a,eraYear:t,year:r}}function Jd(i){return parseInt(i.relatedYear||i.year)}function lr(i){let{year:s,F:a,day:t}=this.O(i),{C:r}=this.B(s);return[s,r[a]+1,t]}function ga(i,s=1,a=1){return this.B(i).k[s-1]+(a-1)*mi}function Ua(i){let s=Ao(this,i),a=Ao(this,i-1),t=s.length;if(t>a.length){let r=Gd(this);if(r<0)return-r;for(let l=0;l<t;l++)if(s[l]!==a[l])return l+1}}function _a(i){return Zt(ga.call(this,i),ga.call(this,i+1))}function Ko(i,s){let{k:a}=this.B(i),t=s+1,r=a;return t>a.length&&(t=1,r=this.B(i+1).k),Zt(a[s-1],r[t-1])}function Ba(i){return this.B(i).k.length}function Ao(i,s){return Object.keys(i.B(s).C)}function Ud(i){return ya(I(i))}function ya(i){if((i=i.toLowerCase())!==y&&i!==Wt&&Va(i)!==Va(kl(i).resolvedOptions().calendar))throw new RangeError(Cp(i));return i}function Va(i){return i==="islamicc"&&(i="islamic"),i.split("-")[0]}function _d(i){return this.R(i)[0]}function Bd(i){return this.R(i)[1]}function Fl(i){let[s]=this.h(i);return Zt(this.q(s),ai(i))+1}function Rd(i){let s=Iu.exec(i);if(!s)throw new RangeError(Ip(i));return[parseInt(s[1]),Boolean(s[2])]}function ka(i,s,a){return i+(s||a&&i>=a?1:0)}function or(i,s){return i-(s&&i>=s?1:0)}function Hd(i,s){return(s+i)*(Math.sign(s)||1)||0}function cr(i){return rm[Yd(i)]}function Gd(i){return Ap[Yd(i)]}function Yd(i){return Va(i.id||y)}function Xd(i,s,a,t){let r=rs(a,t,ji,[],im);if(r.timeZone!==void 0){let l=a.dateFromFields(r),o=vs(r),c=i(r.timeZone);return{epochNanoseconds:ys(s(c),{...l,...o},r.offset!==void 0?Xs(r.offset):void 0),timeZone:c}}return{...a.dateFromFields(r),...Fi}}function Kd(i,s,a,t,r,l){let o=rs(a,r,ji,qf,im),c=i(o.timeZone),[d,f,m]=Da(l),p=a.dateFromFields(o,mt(l,d)),u=vs(o,d);return Q(ys(s(c),{...p,...u},o.offset!==void 0?Xs(o.offset):void 0,f,m),c,t)}function Ad(i,s,a){let t=rs(i,s,ji,[],Gi),r=F(a);return E(Bi({...i.dateFromFields(t,mt(a,r)),...vs(t,r)}))}function Sl(i,s,a,t=[]){let r=rs(i,s,ji,t);return i.dateFromFields(r,a)}function vl(i,s,a,t){let r=rs(i,s,Ul,t);return i.yearMonthFromFields(r,a)}function Ml(i,s,a,t,r=[]){let l=rs(i,a,ji,r);return s&&l.month!==void 0&&l.monthCode===void 0&&l.year===void 0&&(l.year=Us),i.monthDayFromFields(l,t)}function Qd(i,s){let a=F(s);return Li(vs($i(i,fr,[],1),a))}function Vd(i){let s=$i(i,_l);return x(Gs({...A,...s}))}function rs(i,s,a,t=[],r=[]){return $i(s,[...i.fields(a),...r].sort(),t)}function $i(i,s,a,t=!a){let r={},l,o=0;for(let c of s){if(c===l)throw new RangeError(Lp(c));if(c==="constructor"||c==="__proto__")throw new RangeError(Cl(c));let d=i[c];if(d!==void 0)o=1,qo[c]&&(d=qo[c](d,c)),r[c]=d;else if(a){if(a.includes(c))throw new TypeError(zl(c));r[c]=tm[c]}l=c}if(t&&!o)throw new TypeError(_f(s));return r}function vs(i,s){return dt(Wu({...tm,...i}),s)}function kd(i,s,a,t,r,l){let o=W(l),{calendar:c,timeZone:d}=a;return Q(((f,m,p,u,g)=>{let h=Fa(f,p,u,ji,ef,kf),[T,P,b]=Da(g,2);return ys(m,{...f.dateFromFields(h,mt(g,T)),...vs(h,T)},Xs(h.offset),P,b)})(i(c),s(d),t,r,o),d,c)}function qd(i,s,a,t,r){let l=W(r);return E(((o,c,d,f)=>{let m=Fa(o,c,d,ji,Gi),p=F(f);return Bi({...o.dateFromFields(m,mt(f,p)),...vs(m,p)})})(i(s.calendar),a,t,l))}function ed(i,s,a,t,r){let l=W(r);return((o,c,d,f)=>{let m=Fa(o,c,d,ji);return o.dateFromFields(m,f)})(i(s.calendar),a,t,l)}function sf(i,s,a,t,r){let l=W(r);return Ts(((o,c,d,f)=>{let m=Fa(o,c,d,Ul);return o.yearMonthFromFields(m,f)})(i(s.calendar),a,t,l))}function af(i,s,a,t,r){let l=W(r);return((o,c,d,f)=>{let m=Fa(o,c,d,ji);return o.monthDayFromFields(m,f)})(i(s.calendar),a,t,l)}function tf(i,s,a){return Li(((t,r,l)=>{let o=F(l);return vs({...gi(fr,t),...$i(r,fr)},o)})(i,s,a))}function rf(i,s){return x((a=i,t=s,Gs({...a,...$i(t,_l)})));var a,t}function Fa(i,s,a,t,r=[],l=[]){let o=[...i.fields(t),...r].sort(),c=$i(s,o,l),d=$i(a,o);return c=i.mergeFields(c,d),$i(c,o,[])}function Ll(i,s){let a=rs(i,s,am);return i.monthDayFromFields(a)}function jl(i,s,a){let t=rs(i,s,sm);return i.yearMonthFromFields(t,a)}function lf(i,s,a,t,r){s=gi(a=i.fields(a),s),t=$i(t,r=i.fields(r),[]);let l=i.mergeFields(s,t);return l=$i(l,[...a,...r].sort(),[]),i.dateFromFields(l)}function ir(i,s){let{era:a,eraYear:t,year:r}=s,l=cr(i);if(a!==void 0||t!==void 0){if(a===void 0||t===void 0)throw new TypeError(Zp);if(!l)throw new RangeError(jp);let o=l[a];if(o===void 0)throw new RangeError($p(a));let c=Hd(t,o);if(r!==void 0&&r!==c)throw new RangeError(xp);r=c}else if(r===void 0)throw new TypeError(np(l));return r}function sr(i,s,a,t){let{month:r,monthCode:l}=s;if(l!==void 0){let o=((c,d,f,m)=>{let p=c.U(f),[u,g]=Rd(d),h=ka(u,g,p);if(g){let T=Gd(c);if(T===void 0)throw new RangeError(da);if(T>0){if(h>T)throw new RangeError(da);if(p===void 0){if(m===1)throw new RangeError(da);h--}}else{if(h!==-T)throw new RangeError(da);if(p===void 0&&m===1)throw new RangeError(da)}}return h})(i,l,a,t);if(r!==void 0&&r!==o)throw new RangeError(Gf);r=o,t=1}else if(r===void 0)throw new TypeError(zp);return Di("month",r,1,i.L(a),t)}function Qo(i,s,a,t,r){return di(s,"day",1,i.j(t,a),r)}function ar(i,s,a,t){let r=0,l=[];for(let o of a)s[o]!==void 0?r=1:l.push(o);if(Object.assign(i,s),r)for(let o of t||l)delete i[o]}function of(i){return Y(wi(rt(tt(i))))}function cf(i,s,a,t,r=y){return Q(wi(rt(tt(a))),s(t),i(r))}function df(i,s,a,t,r=0,l=0,o=0,c=0,d=0,f=0,m=y){return E(Bi(ct(Si(e,_s(Et,[s,a,t,r,l,o,c,d,f])))),i(m))}function ff(i,s,a,t,r=y){return J(Vi(bs(Si(e,{isoYear:s,isoMonth:a,isoDay:t}))),i(r))}function mf(i,s,a,t=y,r=1){let l=e(s),o=e(a),c=i(t);return Ts(Fr(bs({isoYear:l,isoMonth:o,isoDay:e(r)})),c)}function pf(i,s,a,t=y,r=Us){let l=e(s),o=e(a),c=i(t);return Ka(Vi(bs({isoYear:e(r),isoMonth:l,isoDay:o})),c)}function uf(i=0,s=0,a=0,t=0,r=0,l=0){return Li(dt(Si(e,_s(Zi,[i,s,a,t,r,l])),1))}function gf(i=0,s=0,a=0,t=0,r=0,l=0,o=0,c=0,d=0,f=0){return x(Gs(Si(Pc,_s(S,[i,s,a,t,r,l,o,c,d,f]))))}function Zl(i,s,a=y){return Q(i.epochNanoseconds,s,a)}function hf(i){return Y(i.epochNanoseconds)}function xl(i,s){return E(ti(s,i))}function $l(i,s){return J(ti(s,i))}function Tf(i,s,a){return jl(i(s.calendar),a)}function Pf(i,s,a){return Ll(i(s.calendar),a)}function nl(i,s){return Li(ti(s,i))}function wf(i,s,a,t){let r=((l,o,c,d)=>{let f=Lr(d);return ui(l(o),c,f)})(i,a,s,t);return Q(wi(r),a,s.calendar)}function bf(i,s,a){let t=i(s.calendar);return Ts({...s,...jl(t,a)})}function Df(i,s,a){return Ll(i(s.calendar),a)}function Of(i,s,a,t,r){let l=i(r.timeZone),o=r.plainTime,c=o!==void 0?s(o):Fi;return Q(ui(a(l),{...t,...c}),l,t.calendar)}function yf(i,s=Fi){return E(Bi({...i,...s}))}function Ff(i,s,a){return jl(i(s.calendar),a)}function Sf(i,s,a){return Ll(i(s.calendar),a)}function vf(i,s,a,t){return((r,l,o)=>lf(r,l,sm,_i(o),ja))(i(s.calendar),a,t)}function Mf(i,s,a,t){return((r,l,o)=>lf(r,l,am,_i(o),Nt))(i(s.calendar),a,t)}function Lf(i,s,a,t,r){let l=_i(r),o=s(l.plainDate),c=i(l.timeZone);return Q(ui(a(c),{...o,...t}),c,o.calendar)}function jf(i,s){return E(Bi({...i,...s}))}function Zf(i){return Y(wi(Es(i,yi)))}function xf(i){return Y(wi(Es(i,Ii)))}function $f(i){return Y(wi(rt(tt(i),Ls)))}function nf(i){return Y(wi(rt(tt(i))))}function If(i,s,a=Fi){let t=s.timeZone,r=i(t),l={...ti(s,r),...a};return Q(ys(r,l,l.offsetNanoseconds,2),t,s.calendar)}function zf(i,s,a){let t=s.timeZone,r=i(t),l={...ti(s,r),...a},o=Ef(s.calendar,a.calendar);return Q(ys(r,l,l.offsetNanoseconds,2),t,o)}function Cf(i,s=Fi){return E({...i,...s})}function Nf(i,s){return E({...i,...s},Ef(i.calendar,s.calendar))}function $t(i,s){return{...i,calendar:s}}function Wf(i,s){return{...i,timeZone:s}}function Ef(i,s){if(i===s)return i;let a=K(i),t=K(s);if(a===t||a===y)return s;if(t===y)return i;throw new RangeError(Wl)}function bp(i,s){return(a)=>a===y?i:a===Wt||a===Js?Object.assign(Object.create(i),{id:a}):Object.assign(Object.create(s),nu(a))}function Ms(i,s,a){let t=new Set(a);return(r)=>(((l,o)=>{for(let c of o)if(c in l)return 1;return 0})(r=gr(t,r),i)||Object.assign(r,s),a&&(r.timeZone=xs,["full","long"].includes(r.timeStyle)&&(r.timeStyle="medium")),r)}function Ri(i,s=Il){let[a,,,t]=i;return(r,l=qu,...o)=>{let c=s(t&&t(...o),r,l,a),d=c.resolvedOptions();return[c,...Dp(i,d,o)]}}function Il(i,s,a,t){if(a=t(a),i){if(a.timeZone!==void 0)throw new TypeError(Yp);a.timeZone=i}return new ls(s,a)}function Dp(i,s,a){let[,t,r]=i;return a.map((l)=>(l.calendar&&((o,c,d)=>{if((d||o!==y)&&o!==c)throw new RangeError(Wl)})(K(l.calendar),s.calendar,r),t(l,s)))}function As(i){let s=Sa();return ss(s,i.getOffsetNanosecondsFor(s))}function Sa(){return Es(Date.now(),Ii)}function Hi(){return ic||(ic=new ls().resolvedOptions().timeZone)}var Op=(i,s)=>`Non-integer ${i}: ${s}`,yp=(i,s)=>`Non-positive ${i}: ${s}`,Fp=(i,s)=>`Non-finite ${i}: ${s}`,Sp=(i)=>`Cannot convert bigint to ${i}`,vp=(i)=>`Invalid bigint: ${i}`,Mp="Cannot convert Symbol to string",Jf="Invalid object",Uf=(i,s,a,t,r)=>r?Uf(i,r[s],r[a],r[t]):va(i,s)+`; must be between ${a}-${t}`,va=(i,s)=>`Invalid ${i}: ${s}`,zl=(i)=>`Missing ${i}`,Cl=(i)=>`Invalid field ${i}`,Lp=(i)=>`Duplicate field ${i}`,_f=(i)=>"No valid fields: "+i.join(),Bf="Invalid bag",Rf=(i,s,a)=>va(i,s)+"; must be "+Object.keys(a).join(),Hf="Cannot use valueOf",Nl="Invalid calling context",jp="Forbidden era/eraYear",Zp="Mismatching era/eraYear",xp="Mismatching year/eraYear",$p=(i)=>`Invalid era: ${i}`,np=(i)=>"Missing year"+(i?"/era/eraYear":""),Ip=(i)=>`Invalid monthCode: ${i}`,Gf="Mismatching month/monthCode",zp="Missing month/monthCode",Vo="Cannot guess year",da="Invalid leap month",Yf="Invalid protocol",Ma="Invalid protocol results",Wl="Mismatching Calendars",Cp=(i)=>`Invalid Calendar: ${i}`,Xf="Mismatching TimeZones",Np="Forbidden ICU TimeZone",Wp="Out-of-bounds offset",Ep="Out-of-bounds TimeZone gap",Jp="Invalid TimeZone offset",Up="Ambiguous offset",nt="Out-of-bounds date",_p="Out-of-bounds duration",Bp="Cannot mix duration signs",It="Missing relativeTo",Rp="Cannot use large units",Hp="Required smallestUnit or largestUnit",Gp="smallestUnit > largestUnit",fi=(i)=>`Cannot parse: ${i}`,Ui=(i)=>`Invalid substring: ${i}`,Kf=(i)=>`Cannot format ${i}`,Af="Mismatching types for formatting",Yp="Cannot specify TimeZone",Qf=O(Pa,(i,s)=>s),Qs=O(Pa,(i,s,a)=>a),Oi=O(Ga,2),dr={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},La=Object.keys(dr),mi=86400000,Vf=1000,Ls=1000,Ii=1e6,yi=1e9,zt=60000000000,Ct=3600000000000,v=86400000000000,ni=[1,Ls,Ii,yi,zt,Ct,v],Gi=La.slice(0,6),fr=wa(Gi),kf=["offset"],qf=["timeZone"],ef=Gi.concat(kf),im=ef.concat(qf),mr=["era","eraYear"],Xp=mr.concat(["year"]),Nt=["year"],El=["monthCode"],Jl=["month"].concat(El),ja=["day"],Ul=Jl.concat(Nt),sm=El.concat(Nt),ji=ja.concat(Ul),Kp=ja.concat(Jl),am=ja.concat(El),tm=Qs(Gi,0),y="iso8601",Wt="gregory",Js="japanese",rm={[Wt]:{bce:-1,ce:0},[Js]:{bce:-1,ce:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018},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}},Ap={chinese:13,dangi:13,hebrew:-6},I=O(at,"string"),lm=O(at,"boolean"),Qp=O(at,"number"),om=O(at,"function"),S=La.map((i)=>i+"s"),_l=wa(S),Vp=S.slice(0,6),cm=S.slice(6),kp=cm.slice(1),qp=Qf(S),A=Qs(S,0),Bl=Qs(Vp,0),Rl=O(lc,S),Zi=["isoNanosecond","isoMicrosecond","isoMillisecond","isoSecond","isoMinute","isoHour"],Hl=["isoDay","isoMonth","isoYear"],Et=Zi.concat(Hl),Gl=wa(Hl),dm=wa(Zi),fm=wa(Et),Fi=Qs(dm,0),ep=O(lc,Et),ls=Intl.DateTimeFormat,mm="en-GB",Yl=1e8,iu=Yl*mi,su=[Yl,0],au=[-Yl,0],ha=275760,Ta=-271821,tu=1970,Us=1972,Ei=12,ru=Bs(1868,9,8),lu=pi(lp,WeakMap),qa="smallestUnit",pr="unit",ma="roundingIncrement",tr="fractionalSecondDigits",pm="relativeTo",um={constrain:0,reject:1},ou=Object.keys(um),cu={compatible:0,reject:1,earlier:2,later:3},du={reject:0,use:1,prefer:2,ignore:3},fu={auto:0,never:1,critical:2,always:3},mu={auto:0,never:1,critical:2},pu={auto:0,never:1},uu={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},Za=O(Ir,qa),Xl=O(Ir,"largestUnit"),gu=O(Ir,pr),gm=O(Ds,"overflow",um),hm=O(Ds,"disambiguation",cu),hu=O(Ds,"offset",du),Kl=O(Ds,"calendarName",fu),Tu=O(Ds,"timeZoneName",mu),Pu=O(Ds,"offset",pu),xa=O(Ds,"roundingMode",uu),Vs="PlainYearMonth",ks="PlainMonthDay",js="PlainDate",Zs="PlainDateTime",Jt="PlainTime",Yi="ZonedDateTime",Ut="Instant",_t="Duration",wu=[Math.floor,(i)=>Ja(i)?Math.floor(i):Math.round(i),Math.ceil,(i)=>Ja(i)?Math.ceil(i):Math.round(i),Math.trunc,(i)=>Ja(i)?Math.trunc(i)||0:Math.round(i),(i)=>i<0?Math.floor(i):Math.ceil(i),(i)=>Math.sign(i)*Math.round(Math.abs(i))||0,(i)=>Ja(i)?(i=Math.trunc(i)||0)+i%2:Math.round(i)],xs="UTC",Ra=5184000,bu=Xa(1847),Du=Xa(new Date().getUTCFullYear()+10),Ou=/0+$/,ti=pi(pp,WeakMap),ko=4294967295,Bt=pi((i)=>{let s=pl(i);return typeof s=="object"?new Pm(s):new Tm(s||0)});class Tm{constructor(i){this.v=i}getOffsetNanosecondsFor(){return this.v}getPossibleInstantsFor(i){return[Sr(i,this.v)]}l(){}}class Pm{constructor(i){this.$=((s)=>{function a(d){let f=rr(d,o,c),[m,p]=Yo(f),u=r(m),g=r(p);return u===g?u:t(l(m,p),u,g,d)}function t(d,f,m,p){let u,g;for(;(p===void 0||(u=p<d[0]?f:p>=d[1]?m:void 0)===void 0)&&(g=d[1]-d[0]);){let h=d[0]+Math.floor(g/2);s(h)===m?d[1]=h:d[0]=h+1}return u}let r=pi(s),l=pi(up),o=bu,c=Du;return{G(d){let f=a(d-86400),m=a(d+86400),p=d-f,u=d-m;if(f===m)return[p];let g=a(p);return g===a(u)?[d-g]:f>m?[p,u]:[]},V:a,l(d,f){let m=rr(d,o,c),[p,u]=Yo(m),g=Ra*f,h=f<0?()=>u>o||(o=m,0):()=>p<c||(c=m,0);for(;h();){let T=r(p),P=r(u);if(T!==P){let b=l(p,u);t(b,T,P);let w=b[0];if((Qi(w,d)||1)===f)return w}p+=g,u+=g}}}})(((s)=>(a)=>{let t=yr(s,a*Vf);return Xa(Jd(t),parseInt(t.month),parseInt(t.day),parseInt(t.hour),parseInt(t.minute),parseInt(t.second))-a})(i))}getOffsetNanosecondsFor(i){return this.$.V(Dc(i))*yi}getPossibleInstantsFor(i){let[s,a]=[Xa((t=i).isoYear,t.isoMonth,t.isoDay,t.isoHour,t.isoMinute,t.isoSecond),t.isoMillisecond*Ii+t.isoMicrosecond*Ls+t.isoNanosecond];var t;return this.$.G(s).map((r)=>wi(Ws(Es(r,yi),a)))}l(i,s){let[a,t]=Oc(i),r=this.$.l(a+(s>0||t?1:0),s);if(r!==void 0)return Es(r,yi)}}var Al="([+\u2212-])",Ha="(?:[.,](\\d{1,9}))?",wm=`(?:(?:${Al}(\\d{6}))|(\\d{4}))-?(\\d{2})`,Ql="(\\d{2})(?::?(\\d{2})(?::?(\\d{2})"+Ha+")?)?",Vl=Al+Ql,yu=wm+"-?(\\d{2})(?:[T ]"+Ql+"(Z|"+Vl+")?)?",bm="\\[(!?)([^\\]]*)\\]",Rt=`((?:${bm}){0,9})`,Fu=Ks(wm+Rt),Su=Ks("(?:--)?(\\d{2})-?(\\d{2})"+Rt),vu=Ks(yu+Rt),Mu=Ks("T?"+Ql+"(?:"+Vl+")?"+Rt),Lu=Ks(Vl),ju=new RegExp(bm,"g"),Zu=Ks(`${Al}?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)${Ha}H)?(?:(\\d+)${Ha}M)?(?:(\\d+)${Ha}S)?)?`),xu=pi((i)=>new ls(mm,{timeZone:i,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),$u=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,nu=pi(Tp),kl=pi((i)=>new ls(mm,{calendar:i,timeZone:xs,era:"short",year:"numeric",month:"short",day:"numeric"})),Iu=/^M(\d{2})(L?)$/,zu={era:Ya,eraYear:e,year:e,month:Bo,monthCode:Ya,day:Bo},Cu=Qs(Gi,e),Nu=Qs(S,Pc),qo=Object.assign({},zu,Cu,Nu,{offset:Ya}),Wu=O(rp,Gi,Zi),eo={dateAdd(i,s,a){let t=F(a),r,{years:l,months:o,weeks:c,days:d}=s;if(d+=H(s,5)[0],l||o)r=((f,m,p,u,g)=>{let[h,T,P]=f.h(m);if(p){let[b,w]=f.I(h,T);h+=p,T=ka(b,w,f.U(h)),T=Di("month",T,1,f.L(h),g)}return u&&([h,T]=f._(h,T,u)),P=Di("day",P,1,f.j(h,T),g),f.q(h,T,P)})(this,i,l,o,t);else{if(!c&&!d)return i;r=ai(i)}return r+=(7*c+d)*mi,Vi(ot(r))},dateUntil(i,s,a){if(a<=7){let d=0,f=Wd({...i,...Fi},{...s,...Fi});return a===7&&([d,f]=qi(f,7)),{...A,weeks:d,days:f}}let t=this.h(i),r=this.h(s),[l,o,c]=((d,f,m,p,u,g,h)=>{let T=u-f,P=g-m,b=h-p;if(T||P){let w=Math.sign(T||P),D=d.j(u,g),N=0;if(Math.sign(b)===-w){let $=D;[u,g]=d._(u,g,-w),T=u-f,P=g-m,D=d.j(u,g),N=w<0?-$:D}if(b=h-Math.min(p,D)+N,T){let[$,Z]=d.I(f,m),[n,X]=d.I(u,g);if(P=n-$||Number(X)-Number(Z),Math.sign(P)===-w){let B=w<0&&-d.L(u);T=(u-=w)-f,P=g-ka($,Z,d.U(u))+(B||d.L(u))}}}return[T,P,b]})(this,...t,...r);return a===8&&(o+=this.J(l,t[0]),l=0),{...A,years:l,months:o,days:c}},dateFromFields(i,s){let a=F(s),t=ir(this,i),r=sr(this,i,t,a),l=Qo(this,i,r,t,a);return J(Vi(this.P(t,r,l)),this.id||y)},yearMonthFromFields(i,s){let a=F(s),t=ir(this,i),r=sr(this,i,t,a);return Ts(Fr(this.P(t,r,1)),this.id||y)},monthDayFromFields(i,s){let a=F(s),t=!this.id,{monthCode:r,year:l,month:o}=i,c,d,f,m,p;if(r!==void 0){[c,d]=Rd(r),p=sc(i,"day");let u=this.N(c,d,p);if(!u)throw new RangeError(Vo);if([f,m]=u,o!==void 0&&o!==m)throw new RangeError(Gf);t&&(m=Di("month",m,1,Ei,1),p=Di("day",p,1,vr(l!==void 0?l:f,m),a))}else{f=l===void 0&&t?Us:ir(this,i),m=sr(this,i,f,a),p=Qo(this,i,m,f,a);let u=this.U(f);d=m===u,c=or(m,u);let g=this.N(c,d,p);if(!g)throw new RangeError(Vo);[f,m]=g}return Ka(Vi(this.P(f,m,p)),this.id||y)},fields(i){return cr(this)&&i.includes("year")?[...i,...mr]:i},mergeFields(i,s){let a=Object.assign(Object.create(null),i);return ar(a,s,Jl),cr(this)&&(ar(a,s,Xp),this.id===Js&&ar(a,s,Kp,mr)),a},inLeapYear(i){let[s]=this.h(i);return this.K(s)},monthsInYear(i){let[s]=this.h(i);return this.L(s)},daysInMonth(i){let[s,a]=this.h(i);return this.j(s,a)},daysInYear(i){let[s]=this.h(i);return this.X(s)},dayOfYear:Fl,era(i){return this.ee(i)[0]},eraYear(i){return this.ee(i)[1]},monthCode(i){let[s,a]=this.h(i),[t,r]=this.I(s,a);return((l,o)=>"M"+Oi(l)+(o?"L":""))(t,r)},dayOfWeek:Mc,daysInWeek(){return 7}},Eu={dayOfYear:Fl,h:Fc,q:Bs},Ju=Object.assign({},Eu,{weekOfYear:_d,yearOfWeek:Bd,R(i){function s(g){return(7-g<t?7:0)-g}function a(g){let h=vc(u+g),T=g||1,P=s(fa(d+h*T,7));return m=(h+(P-f)*T)/7}let t=this.id?1:4,r=Mc(i),l=this.dayOfYear(i),o=fa(r-1,7),c=l-1,d=fa(o-c,7),f=s(d),m,p=Math.floor((c-f)/7)+1,u=i.isoYear;return p?p>a(0)&&(p=1,u++):(p=a(-1),u--),[p,u,m]}}),Uu={dayOfYear:Fl,h:lr,q:ga,weekOfYear:_d,yearOfWeek:Bd,R(){return[]}},qs=bp(Object.assign({},eo,Ju,{h:Fc,ee(i){return this.id===Wt?Lc(i):this.id===Js?lu(i):[]},I:(i,s)=>[s,0],N(i,s){if(!s)return[Us,i]},K:Mr,U(){},L:Sc,J:(i)=>i*Ei,j:vr,X:vc,P:(i,s,a)=>({isoYear:i,isoMonth:s,isoDay:a}),q:Bs,_:(i,s,a)=>(i+=it(a,Ei),(s+=Tr(a,Ei))<1?(i--,s+=Ei):s>Ei&&(i++,s-=Ei),[i,s]),year(i){return i.isoYear},month(i){return i.isoMonth},day:(i)=>i.isoDay}),Object.assign({},eo,Uu,{h:lr,ee(i){let s=this.O(i);return[s.era,s.eraYear]},I(i,s){let a=Ua.call(this,i);return[or(s,a),a===s]},N(i,s,a){let[t,r,l]=lr.call(this,{isoYear:Us,isoMonth:Ei,isoDay:31}),o=Ua.call(this,t),c=r===o;(Qi(i,or(r,o))||Qi(Number(s),Number(c))||Qi(a,l))===1&&t--;for(let d=0;d<100;d++){let f=t-d,m=Ua.call(this,f),p=ka(i,s,m);if(s===(p===m)&&a<=Ko.call(this,f,p))return[f,p]}},K(i){let s=_a.call(this,i);return s>_a.call(this,i-1)&&s>_a.call(this,i+1)},U:Ua,L:Ba,J(i,s){let a=s+i,t=Math.sign(i),r=t<0?-1:0,l=0;for(let o=s;o!==a;o+=t)l+=Ba.call(this,o+r);return l},j:Ko,X:_a,P(i,s,a){return ot(ga.call(this,i,s,a))},q:ga,_(i,s,a){if(a){if(s+=a,!Number.isSafeInteger(s))throw new RangeError(nt);if(a<0)for(;s<1;)s+=Ba.call(this,--i);else{let t;for(;s>(t=Ba.call(this,i));)s-=t,i++}}return[i,s]},year(i){return this.O(i).year},month(i){let{year:s,F:a}=this.O(i),{C:t}=this.B(s);return t[a]+1},day(i){return this.O(i).day}})),ki="numeric",es=["timeZoneName"],Dm={month:ki,day:ki},ql={year:ki,month:ki},el=Object.assign({},ql,{day:ki}),io={hour:ki,minute:ki,second:ki},so=Object.assign({},el,io),_u=Object.assign({},so,{timeZoneName:"short"}),Bu=Object.keys(ql),Ru=Object.keys(Dm),Hu=Object.keys(el),Gu=Object.keys(io),ao=["dateStyle"],Yu=Bu.concat(ao),Xu=Ru.concat(ao),to=Hu.concat(ao,["weekday"]),$a=Gu.concat(["dayPeriod","timeStyle"]),ro=to.concat($a),Ku=ro.concat(es),Au=es.concat($a),Qu=es.concat(to),Vu=es.concat(["day","weekday"],$a),ku=es.concat(["year","weekday"],$a),qu={},lo=[Ms(ro,so),pt],Om=[Ms(Ku,_u),pt,0,(i,s)=>{let a=K(i.timeZone);if(s&&K(s.timeZone)!==a)throw new RangeError(Xf);return a}],oo=[Ms(ro,so,es),ai],co=[Ms(to,el,Au),ai],fo=[Ms($a,io,Qu),(i)=>ei(i)/Ii],mo=[Ms(Yu,ql,Vu),ai,1],po=[Ms(Xu,Dm,ku),ai,1],ic;function Ni(i,s,a,t,r){function l(...d){if(!(this instanceof l))throw new TypeError(Nl);vm(this,s(...d))}function o(d,f){return Object.defineProperties(function(...m){return d.call(this,c(this),...m)},ur(f))}function c(d){let f=q(d);if(!f||f.branding!==i)throw new TypeError(Nl);return f}return Object.defineProperties(l.prototype,{...ac(Si(o,a)),...ws(Si(o,t)),...ea("Temporal."+i)}),Object.defineProperties(l,{...ws(r),...ur(i)}),[l,(d)=>{let f=Object.create(l.prototype);return vm(f,d),f},c]}function jm(i){return i=i.concat("id").sort(),(s)=>{if(!tc(s,i))throw new TypeError(Yf);return s}}function ta(i){if(q(i)||i.calendar!==void 0||i.timeZone!==void 0)throw new TypeError(Bf);return i}function Ht(i,s){let a={};for(let t in i)a[t]=({o:r},l)=>{let o=q(l)||{},{branding:c}=o,d=c===js||s.includes(c)?o:oi(l);return r[t](d)};return a}function ho(i){let s={};for(let a in i)s[a]=(t)=>{let{calendar:r}=t;return(l=r,typeof l=="string"?qs(l):(o=l,Object.assign(Object.create(hg),{i:o})))[a](t);var l,o};return s}function ms(){throw new TypeError(Hf)}function Ia({calendar:i}){return typeof i=="string"?new So(i):i}function ym(i,s){if(s=W(s),G(i)){let t=q(i);if(t&&t.branding===ks)return F(s),t;let r=$m(i);return Ml(Vt(r||y),!r,i,s)}let a=ud(qs,i);return F(s),a}function Zm(i,s,a){return t=s.call(i,li(Y(a))),Xr(ba(t));var t}function Gt(i,s=Cm){let a=Object.keys(s).sort(),t={};for(let r of a)t[r]=O(s[r],i,om(i[r]));return t}function M(i,s){return typeof i=="string"?Bt(i):Gt(i,s)}function _(i){return M(i,go)}function zi(i){if(G(i)){let s=q(i);if(s)switch(s.branding){case Ut:return s;case Yi:return Y(s.epochNanoseconds)}}return cd(i)}function Fm(i,s,a){let t=s.l(zi(a).epochNanoseconds,i);return t?li(Y(t)):null}function j(i){return G(i)?(q(i)||{}).timeZone||Og(i):((s)=>vt(Pd(I(s))))(i)}function os(i,s){if(G(i)){let a=q(i)||{};switch(a.branding){case Jt:return F(s),a;case Zs:return F(s),Li(a);case Yi:return F(s),nl(_,a)}return Qd(i,s)}return F(s),gd(i)}function To(i){return i===void 0?void 0:os(i)}function ia(i,s){if(s=W(s),G(i)){let t=q(i);return t&&t.branding===Vs?(F(s),t):vl(At(za(i)),i,s)}let a=pd(qs,i);return F(s),a}function cs(i,s){if(s=W(s),G(i)){let t=q(i)||{};switch(t.branding){case Zs:return F(s),t;case js:return F(s),E({...t,...Fi});case Yi:return F(s),xl(_,t)}return Ad(Qt(za(i)),i,s)}let a=md(i);return F(s),a}function oi(i,s){if(s=W(s),G(i)){let t=q(i)||{};switch(t.branding){case js:return F(s),t;case Zs:return F(s),J(t);case Yi:return F(s),$l(_,t)}return Sl(Qt(za(i)),i,s)}let a=Ft(i);return F(s),a}function xm(i,s,a){return vi(s.call(i,C(J(a,i))))}function Wi(i){return(s)=>typeof s=="string"?qs(s):((a,t)=>{let r=Object.keys(t).sort(),l={};for(let o of r)l[o]=O(t[o],a,a[o]);return l})(s,i)}function z(i){if(G(i)){let s=q(i);return s&&s.branding===_t?s:Vd(i)}return hd(i)}function na(i){if(i!==void 0){if(G(i)){let s=q(i)||{};switch(s.branding){case Yi:case js:return s;case Zs:return J(s)}let a=za(i);return{...Xd(j,M,Qt(a),i),calendar:a}}return dd(i)}}function za(i){return $m(i)||y}function $m(i){let{calendar:s}=i;if(s!==void 0)return k(s)}function k(i){return G(i)?(q(i)||{}).calendar||Ng(i):((s)=>ya(Td(I(s))))(i)}function sa(i,s){if(s=W(s),G(i)){let a=q(i);if(a&&a.branding===Yi)return Da(s),a;let t=za(i);return Kd(j,M,Qt(t),t,i,s)}return fd(i,s)}function Sm(i){return Si((s)=>(a)=>s(uo(a)),i)}function uo(i){return ti(i,_)}function eu(){let i=ls.prototype,s=Object.getOwnPropertyDescriptors(i),a=Object.getOwnPropertyDescriptors(ls),t=function(r,l={}){if(!(this instanceof t))return new t(r,l);vo.set(this,((o,c={})=>{let d=new ls(o,c),f=d.resolvedOptions(),m=f.locale,p=gi(Object.keys(c),f),u=pi(ag),g=(...h)=>{let T,P=h.map((b,w)=>{let D=q(b),N=(D||{}).branding;if(w&&T&&T!==N)throw new TypeError(Af);return T=N,D});return T?u(T)(m,p,...P):[d,...h]};return g.u=d,g})(r,l))};for(let r in s){let l=s[r],o=r.startsWith("format")&&ig(r);typeof l.value=="function"?l.value=r==="constructor"?t:o||sg(r):o&&(l.get=function(){return o.bind(this)})}return a.prototype.value=Object.create(i,s),Object.defineProperties(t,a),t}function ig(i){return function(...s){let a=vo.get(this),[t,...r]=a(...s);return t[i](...r)}}function sg(i){return function(...s){return vo.get(this).u[i](...s)}}function ag(i){let s=tg[i];if(!s)throw new TypeError(Kf(i));return Ri(s,pi(Il))}var tg={Instant:lo,PlainDateTime:oo,PlainDate:co,PlainTime:fo,PlainYearMonth:mo,PlainMonthDay:po},rg=Ri(lo),lg=Ri(Om),og=Ri(oo),cg=Ri(co),dg=Ri(fo),fg=Ri(mo),mg=Ri(po),Po={era:mc,eraYear:Pr,year:ba,month:vi,daysInMonth:vi,daysInYear:vi,inLeapYear:lm,monthsInYear:vi},Xt={monthCode:I},wo={day:vi},nm={dayOfWeek:vi,dayOfYear:vi,weekOfYear:pc,yearOfWeek:Pr,daysInWeek:vi},Im=Object.assign({},Po,Xt,wo,nm),Yt=new WeakMap,q=Yt.get.bind(Yt),vm=Yt.set.bind(Yt),pg={...Ht(Po,[Vs]),...Ht(nm,[]),...Ht(Xt,[Vs,ks]),...Ht(wo,[ks])},bo=ho(Im),ug=ho({...Po,...Xt}),gg=ho({...Xt,...wo}),Ca={calendarId:(i)=>K(i.calendar)},hg=Si((i,s)=>function(a){let{i:t}=this;return i(t[s](C(J(a,t))))},Im),Tg=Pa((i)=>(s)=>s[i],S.concat("sign")),Do=Pa((i,s)=>(a)=>a[Zi[s]],Gi),zm={epochSeconds:zc,epochMilliseconds:pt,epochMicroseconds:Cc,epochNanoseconds:Nc},Na=O(gr,new Set(["branding"])),[Pg,aa,wg]=Ni(ks,O(pf,k),{...Ca,...gg},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return aa(af(Ig,i,this,ta(s),a))},equals:(i,s)=>$d(i,ym(s)),toPlainDate(i,s){return C(Mf(Wa,i,this,s))},toLocaleString(i,s,a){let[t,r]=mg(s,a,i);return t.format(r)},toString:Br,toJSON:(i)=>Br(i),valueOf:ms},{from:(i,s)=>aa(ym(i,s))}),Cm={getOffsetNanosecondsFor:Zm,getPossibleInstantsFor(i,s,a){let t=[...s.call(i,V(E(a,y)))].map((l)=>Dg(l).epochNanoseconds),r=t.length;return r>1&&(t.sort(si),Kr(Pi(Ti(t[0],t[r-1])))),t}},go={getOffsetNanosecondsFor:Zm},[bg,li,Dg]=Ni(Ut,of,zm,{add:(i,s)=>li(Ar(0,i,z(s))),subtract:(i,s)=>li(Ar(1,i,z(s))),until:(i,s,a)=>L(Tl(0,i,zi(s),a)),since:(i,s,a)=>L(Tl(1,i,zi(s),a)),round:(i,s)=>li(Jc(i,s)),equals:(i,s)=>Md(i,zi(s)),toZonedDateTime(i,s){let a=_i(s);return U(Zl(i,j(a.timeZone),k(a.calendar)))},toZonedDateTimeISO:(i,s)=>U(Zl(i,j(s))),toLocaleString(i,s,a){let[t,r]=rg(s,a,i);return t.format(r)},toString:(i,s)=>Wr(j,_,i,s),toJSON:(i)=>Wr(j,_,i),valueOf:ms},{from:(i)=>li(zi(i)),fromEpochSeconds:(i)=>li(Zf(i)),fromEpochMilliseconds:(i)=>li(xf(i)),fromEpochMicroseconds:(i)=>li($f(i)),fromEpochNanoseconds:(i)=>li(nf(i)),compare:(i,s)=>ul(zi(i),zi(s))}),[Kt,Fh]=Ni("TimeZone",(i)=>{let s=Sd(i);return{branding:"TimeZone",id:s,o:Bt(s)}},{id:(i)=>i.id},{getPossibleInstantsFor:({o:i},s)=>i.getPossibleInstantsFor(cs(s)).map((a)=>li(Y(a))),getOffsetNanosecondsFor:({o:i},s)=>i.getOffsetNanosecondsFor(zi(s).epochNanoseconds),getOffsetStringFor(i,s){let a=zi(s).epochNanoseconds,t=Gt(this,go).getOffsetNanosecondsFor(a);return Os(t)},getPlainDateTimeFor(i,s,a=y){let t=zi(s).epochNanoseconds,r=Gt(this,go).getOffsetNanosecondsFor(t);return V(E(ss(t,r),k(a)))},getInstantFor(i,s,a){let t=cs(s),r=Lr(a),l=Gt(this);return li(Y(ui(l,t,r)))},getNextTransition:({o:i},s)=>Fm(1,i,s),getPreviousTransition:({o:i},s)=>Fm(-1,i,s),equals(i,s){return!!Lt(this,j(s))},toString:(i)=>i.id,toJSON:(i)=>i.id},{from(i){let s=j(i);return typeof s=="string"?new Kt(s):s}}),Og=jm(Object.keys(Cm)),[yg,ds]=Ni(Jt,uf,Do,{getISOFields:Na,with(i,s,a){return ds(tf(this,ta(s),a))},add:(i,s)=>ds(er(0,i,z(s))),subtract:(i,s)=>ds(er(1,i,z(s))),until:(i,s,a)=>L(Ol(0,i,os(s),a)),since:(i,s,a)=>L(Ol(1,i,os(s),a)),round:(i,s)=>ds(Bc(i,s)),equals:(i,s)=>nd(i,os(s)),toZonedDateTime:(i,s)=>U(Lf(j,oi,M,i,s)),toPlainDateTime:(i,s)=>V(jf(i,oi(s))),toLocaleString(i,s,a){let[t,r]=dg(s,a,i);return t.format(r)},toString:Rr,toJSON:(i)=>Rr(i),valueOf:ms},{from:(i,s)=>ds(os(i,s)),compare:(i,s)=>Mt(os(i),os(s))}),[Fg,fs,Sg]=Ni(Vs,O(mf,k),{...Ca,...ug},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return fs(sf(ng,i,this,ta(s),a))},add:(i,s,a)=>fs(qr(Mm,0,i,z(s),a)),subtract:(i,s,a)=>fs(qr(Mm,1,i,z(s),a)),until:(i,s,a)=>L(Dl(Lm,0,i,ia(s),a)),since:(i,s,a)=>L(Dl(Lm,1,i,ia(s),a)),equals:(i,s)=>xd(i,ia(s)),toPlainDate(i,s){return C(vf(Wa,i,this,s))},toLocaleString(i,s,a){let[t,r]=fg(s,a,i);return t.format(r)},toString:_r,toJSON:(i)=>_r(i),valueOf:ms},{from:(i,s)=>fs(ia(i,s)),compare:(i,s)=>Ss(ia(i),ia(s))}),[vg,V]=Ni(Zs,O(df,k),{...Ca,...bo,...Do},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return V(qd(Wa,i,this,ta(s),a))},withCalendar:(i,s)=>V($t(i,k(s))),withPlainDate:(i,s)=>V(Nf(i,oi(s))),withPlainTime:(i,s)=>V(Cf(i,To(s))),add:(i,s,a)=>V(Vr($s,0,i,z(s),a)),subtract:(i,s,a)=>V(Vr($s,1,i,z(s),a)),until:(i,s,a)=>L(wl(Ci,0,i,cs(s),a)),since:(i,s,a)=>L(wl(Ci,1,i,cs(s),a)),round:(i,s)=>V(_c(i,s)),equals:(i,s)=>jd(i,cs(s)),toZonedDateTime:(i,s,a)=>U(wf(M,i,j(s),a)),toPlainDate:(i)=>C(J(i)),toPlainTime:(i)=>ds(Li(i)),toPlainYearMonth(i){return fs(bf(At,i,this))},toPlainMonthDay(i){return aa(Df(Vt,i,this))},toLocaleString(i,s,a){let[t,r]=og(s,a,i);return t.format(r)},toString:Jr,toJSON:(i)=>Jr(i),valueOf:ms},{from:(i,s)=>V(cs(i,s)),compare:(i,s)=>hl(cs(i),cs(s))}),[Mg,C,Nm]=Ni(js,O(ff,k),{...Ca,...bo},{getISOFields:Na,getCalendar:Ia,with(i,s,a){return C(ed(Wa,i,this,ta(s),a))},withCalendar:(i,s)=>C($t(i,k(s))),add:(i,s,a)=>C(kr($s,0,i,z(s),a)),subtract:(i,s,a)=>C(kr($s,1,i,z(s),a)),until:(i,s,a)=>L(bl(Ci,0,i,oi(s),a)),since:(i,s,a)=>L(bl(Ci,1,i,oi(s),a)),equals:(i,s)=>Zd(i,oi(s)),toZonedDateTime(i,s){let a=!G(s)||s instanceof Kt?{timeZone:s}:s;return U(Of(j,os,M,i,a))},toPlainDateTime:(i,s)=>V(yf(i,To(s))),toPlainYearMonth(i){return fs(Ff(At,i,this))},toPlainMonthDay(i){return aa(Sf(Vt,i,this))},toLocaleString(i,s,a){let[t,r]=cg(s,a,i);return t.format(r)},toString:Ur,toJSON:(i)=>Ur(i),valueOf:ms},{from:(i,s)=>C(oi(i,s)),compare:(i,s)=>Ss(oi(i),oi(s))}),Oo={fields(i,s,a){return[...s.call(i,a)]}},Wm=Object.assign({dateFromFields(i,s,a,t){return Nm(s.call(i,Object.assign(Object.create(null),a),t))}},Oo),Em=Object.assign({yearMonthFromFields(i,s,a,t){return Sg(s.call(i,Object.assign(Object.create(null),a),t))}},Oo),Jm=Object.assign({monthDayFromFields(i,s,a,t){return wg(s.call(i,Object.assign(Object.create(null),a),t))}},Oo),yo={mergeFields(i,s,a,t){return _i(s.call(i,Object.assign(Object.create(null),a),Object.assign(Object.create(null),t)))}},Lg=Object.assign({},Wm,yo),jg=Object.assign({},Em,yo),Zg=Object.assign({},Jm,yo),Fo={dateAdd(i,s,a,t,r){return Nm(s.call(i,C(J(a,i)),L(x(t)),r))}},Um=Object.assign({},Fo,{dateUntil(i,s,a,t,r,l){return Cg(s.call(i,C(J(a,i)),C(J(t,i)),Object.assign(Object.create(null),l,{largestUnit:La[r]})))}}),xg=Object.assign({},Fo,{day:xm}),$g=Object.assign({},Um,{day:xm}),At=Wi(Em),Qt=Wi(Wm),Vt=Wi(Jm),ng=Wi(jg),Wa=Wi(Lg),Ig=Wi(Zg),$s=Wi(Fo),Ci=Wi(Um),Mm=Wi(xg),Lm=Wi($g),[zg,L,Cg]=Ni(_t,gf,{...Tg,blank:rd},{with:(i,s)=>L(rf(i,s)),negated:(i)=>L(Ot(i)),abs:(i)=>L(td(i)),add:(i,s,a)=>L(rl(na,Ci,M,0,i,z(s),a)),subtract:(i,s,a)=>L(rl(na,Ci,M,1,i,z(s),a)),round:(i,s)=>L(ad(na,Ci,M,i,s)),total:(i,s)=>Ec(na,Ci,M,i,s),toLocaleString(i,s,a){return Intl.DurationFormat?new Intl.DurationFormat(s,a).format(this):Tt(i)},toString:Tt,toJSON:(i)=>Tt(i),valueOf:ms},{from:(i)=>L(z(i)),compare:(i,s,a)=>vd(na,$s,M,z(i),z(s),a)}),_m={toString:(i)=>i.id,toJSON:(i)=>i.id,...pg,dateAdd:({id:i,o:s},a,t,r)=>C(J(s.dateAdd(oi(a),z(t),r),i)),dateUntil:({o:i},s,a,t)=>L(x(i.dateUntil(oi(s),oi(a),Zc(t)))),dateFromFields:({id:i,o:s},a,t)=>C(Sl(s,a,t,fc(i))),yearMonthFromFields:({id:i,o:s},a,t)=>fs(vl(s,a,t,cc(i))),monthDayFromFields:({id:i,o:s},a,t)=>aa(Ml(s,0,a,t,dc(i))),fields({o:i},s){let a=new Set(ji),t=[];for(let r of s){if(I(r),!a.has(r))throw new RangeError(Cl(r));a.delete(r),t.push(r)}return i.fields(t)},mergeFields:({o:i},s,a)=>i.mergeFields(hr(wr(s)),hr(wr(a)))},[So]=Ni("Calendar",(i)=>{let s=Ud(i);return{branding:"Calendar",id:s,o:qs(s)}},{id:(i)=>i.id},_m,{from(i){let s=k(i);return typeof s=="string"?new So(s):s}}),Ng=jm(Object.keys(_m).slice(4)),[Wg,U]=Ni(Yi,O(cf,k,j),{...zm,...Ca,...Sm(bo),...Sm(Do),offset:(i)=>Os(uo(i).offsetNanoseconds),offsetNanoseconds:(i)=>uo(i).offsetNanoseconds,timeZoneId:(i)=>K(i.timeZone),hoursInDay:(i)=>Rc(M,i)},{getISOFields:(i)=>id(_,i),getCalendar:Ia,getTimeZone:({timeZone:i})=>typeof i=="string"?new Kt(i):i,with(i,s,a){return U(kd(Wa,M,i,this,ta(s),a))},withCalendar:(i,s)=>U($t(i,k(s))),withTimeZone:(i,s)=>U(Wf(i,j(s))),withPlainDate:(i,s)=>U(zf(M,i,oi(s))),withPlainTime:(i,s)=>U(If(M,i,To(s))),add:(i,s,a)=>U(Qr($s,M,0,i,z(s),a)),subtract:(i,s,a)=>U(Qr($s,M,1,i,z(s),a)),until:(i,s,a)=>L(x(Pl(Ci,M,0,i,sa(s),a))),since:(i,s,a)=>L(x(Pl(Ci,M,1,i,sa(s),a))),round:(i,s)=>U(Uc(M,i,s)),startOfDay:(i)=>U(Hc(M,i)),equals:(i,s)=>Ld(i,sa(s)),toInstant:(i)=>li(hf(i)),toPlainDateTime:(i)=>V(xl(_,i)),toPlainDate:(i)=>C($l(_,i)),toPlainTime:(i)=>ds(nl(_,i)),toPlainYearMonth(i){return fs(Tf(At,i,this))},toPlainMonthDay(i){return aa(Pf(Vt,i,this))},toLocaleString(i,s,a={}){let[t,r]=lg(s,a,i);return t.format(r)},toString:(i,s)=>Er(_,i,s),toJSON:(i)=>Er(_,i),valueOf:ms},{from:(i,s)=>U(sa(i,s)),compare:(i,s)=>gl(sa(i),sa(s))}),Eg=Object.defineProperties({},{...ea("Temporal.Now"),...ws({timeZoneId:()=>Hi(),instant:()=>li(Y(Sa())),zonedDateTime:(i,s=Hi())=>U(Q(Sa(),j(s),k(i))),zonedDateTimeISO:(i=Hi())=>U(Q(Sa(),j(i),y)),plainDateTime:(i,s=Hi())=>V(E(As(_(j(s))),k(i))),plainDateTimeISO:(i=Hi())=>V(E(As(_(j(i))),y)),plainDate:(i,s=Hi())=>C(J(As(_(j(s))),k(i))),plainDateISO:(i=Hi())=>C(J(As(_(j(i))),y)),plainTimeISO:(i=Hi())=>ds(Li(As(_(j(i)))))})}),Xi=Object.defineProperties({},{...ea("Temporal"),...ws({PlainYearMonth:Fg,PlainMonthDay:Pg,PlainDate:Mg,PlainTime:yg,PlainDateTime:vg,ZonedDateTime:Wg,Instant:bg,Calendar:So,TimeZone:Kt,Duration:zg,Now:Eg})}),Jg=eu(),vo=new WeakMap,Ug=Object.defineProperties(Object.create(Intl),ws({DateTimeFormat:Jg}));class ns extends Error{constructor(){super("Adapter not found");this.name="AdapterNotFound"}}class Mo{createSession(){throw new ns}deleteSession(){throw new ns}findSession(){throw new ns}findUserByEmailAddress(){throw new ns}updateSession(){throw new ns}createUser(){throw new ns}}class Ym extends R{schema={email:{required:"Email is required",string:"Invalid email",email:"Invalid email"},password:{required:"Password is required"}}}class Xm extends R{schema={name:{string:"Invalid name",required:"Name is required","min:2":"Name must be at least 3 characters"},email:{string:"Invalid email",required:"Email is required",email:"Invalid email"},password:{required:"Password is required","min:8":"Password must be at least 8 characters"}}}class Km extends R{schema={email:{required:"Email is required",email:"Invalid email"}}}class Am extends R{schema={password:{required:"Password is required",password:"Invalid password"}}}class Ki extends Bm{provider=oa.use().provider;async me(){let i=await Ai.user();if(!i)throw new Gm;return i}async verifyEmail(i=new R){let s=await i.input(),a=await this.provider.adapter.findUserByVerificationToken(s.get("token"));if(!a)return{email:null};if(await this.provider.adapter.verifyUser(a.id),a)return{email:a.email};return{email:null}}async signIn(i=new Ym){let s=await i.input.call(i),{email:a,password:t}=s.toJSON(),r=await this.provider.adapter.findUserByEmailAddress(a,this.provider.verifyEmail);if(!r)throw new ps({invalid_credentials:["Invalid credentials"]});if(!await this.provider.verifyPassword(t,r.password))throw new ps({invalid_credentials:["Invalid credentials"]});let o=i.headers.get("User-Agent"),c=new Bun.CryptoHasher("sha256");c.update(`${r.email}${o}`);let d=c.digest("hex"),f=await this.provider.adapter.findSession({token:d,userAgent:i.headers.get("User-Agent")});if(!f)f=await this.provider.adapter.createSession({token:d,userId:r.id,userAgent:i.headers.get("User-Agent"),expiresAt:new Date(Xi.Now.instant().add({hours:this.provider.sessionExpiresInHours}).toString()),absoluteExpiresAt:new Date(Xi.Now.instant().add({hours:this.provider.sessionAbsoluteExpiresInHours}).toString())});else f=await this.provider.adapter.updateSession({token:d,expiresAt:new Date(Xi.Now.instant().add({hours:this.provider.sessionExpiresInHours}).toString())});return i.ctx().setCookie("access_token",f.token,{expires:f.expiresAt}),await this.provider.onSignIn(r),r}async signUp(i=new Xm){let s=await i.input(),{email:a,password:t,name:r,invitationId:l}=s.toJSON();if(await this.provider.adapter.findUserByEmailAddress(a,!1))throw new ps({email:["Email address already exists"]});let c=await this.provider.hashPassword(t),d=gs.use().detectLocale(i),f;if(l){if(f=await this.provider.adapter.findInvitation(l,a),f)await this.provider.adapter.deleteInvitationById(l)}let m,p;if(f)m=await this.provider.adapter.createUser({email:a,name:r,password:c,emailVerifiedAt:new Date,locale:d}),await this.provider.adapter.createAccount({organizationId:f.organizationId,userId:m.id,organizationRole:f.role});else p=await this.provider.generateEmailVerificationToken(a),m=await this.provider.adapter.createUser({email:a,name:r,password:c,verificationToken:p,locale:d});return await this.provider.onSignUp(m,p),m}async signOut(i=new R){let s=i.cookies.get("access_token"),a=await Ai.user();return await this.provider.adapter.deleteSession({token:s}),i.ctx().setCookie("access_token","",{expires:new Date(0)}),await this.provider.onSignOut(a),{}}async forgotPassword(i=new Km){let s=await i.input(),{email:a}=s.toJSON(),t=await this.provider.adapter.findUserByEmailAddress(a,this.provider.verifyEmail);if(!t)return{};let r=await this.provider.generateForgotPasswordToken(t);return await this.provider.adapter.createPasswordResetToken({user:t,token:r}),await this.provider.onForgotPassword(t,r),{}}async resetPassword(i=new Am){let s=await i.input(),{password:a,token:t}=s.toJSON(),r=await this.provider.adapter.findPasswordResetToken({token:t});if(!r)throw new ps({token:["Invalid token"]});if(Xi.Instant.from(r.createdAt.toISOString()).add({hours:24}).until(Xi.Now.instant()).sign>=0)throw new ps({token:["Token expired"]});await this.provider.adapter.deletePasswordResetToken({token:t});let o=await this.provider.adapter.findUserByEmailAddress(r.user.email,this.provider.verifyEmail);if(!o)throw new ps({email:["User not found"]});let c=await this.provider.hashPassword(a);return await this.provider.adapter.updateUserPassword({id:o.id,password:c}),await this.provider.adapter.deleteAllUserSessions(o.id),await this.provider.onResetPassword(o),{}}async changePassword(i=new R){let s=await Ai.user(),a=await i.input(),{oldPassword:t,newPassword:r}=a.toJSON(),{password:l}=await this.provider.adapter.findUserByEmailAddress(s.email,this.provider.verifyEmail);if(!await this.provider.verifyPassword(t,l))throw new ps({oldPassword:["Incorrect password"]});let c=await this.provider.hashPassword(r);return await this.provider.adapter.updateUserPassword({id:s.id,password:c}),await this.provider.adapter.deleteAllUserSessions(s.id),{}}}class Lo extends zs{middlewares=["cache:private"];routes={"/sign-in":this.post(Ki,"signIn"),"/sign-up":this.post(Ki,"signUp"),"/sign-out":this.post(Ki,"signOut"),"/forgot-password":this.post(Ki,"forgotPassword"),"/reset-password":this.post(Ki,"resetPassword"),"/change-password":this.post(Ki,"changePassword"),"/verify-email":this.post(Ki,"verifyEmail"),"/me":this.get(Ki,"me").middleware(["auth"])}}class _g extends Rm{middlewares=["cache:public"];routes={"/sign-in":this.view("auth/SignIn"),"/sign-up":this.view("auth/SignUp"),"/reset-password":this.view("auth/ResetPassword"),"/forgot-password":this.view("auth/ForgotPassword")}}class Bg extends Hm{basePath="/auth";verifyEmail=!0;sessionExpiresInHours=24;sessionAbsoluteExpiresInHours=672;adapter=new Mo;boot(){}async verifyPassword(i,s){return await Bun.password.verify(i,s)}async hashPassword(i){return await Bun.password.hash(i)}async generateForgotPasswordToken(i){let s=new Bun.CryptoHasher("sha256");return s.update(`${i.email}${Date.now()}`),s.digest("hex")}generateEmailVerificationToken(i){if(!this.verifyEmail)return"";let s=new Bun.CryptoHasher("sha256");return s.update(`${i}${Date.now()}`),s.digest("hex")}extendSession(i){return{}}onSignUp(i,s){}onSignIn(i){}onSignOut(i){}onForgotPassword(i,s){}onResetPassword(i){}}import{mkdir as Rg,exists as Hg,readdir as Gg}from"fs/promises";class bi extends hi{i;static _name="LoggingServiceContainer";writer;isReady=!1;logsDirPath=`${process.env.ROOT_DIR}/storage/logs`;flushTimeout;fileSize=0;writerSize=0;isCreatingFile=!1;currentLogFilePath;constructor(i){super();this.service=i;this.boot().then(()=>{this.isReady=!0})}async boot(){if(!process.env.ROOT_DIR)return;if(!await Hg(this.logsDirPath))await Rg(this.logsDirPath);this.newLogFile()}async newLogFile(){if(this.isCreatingFile=!0,this.currentLogFilePath){this.writer.flush(),this.writer.end(),this.writer=null;let a=new File([await Bun.file(this.currentLogFilePath).arrayBuffer()],this.currentLogFilePath.split("/").pop(),{type:"text/plain"});this.service.onLogFileClosed(a),this.fileSize=0,this.writerSize=0}let s=(await Gg(this.logsDirPath)).sort().reverse()[0];if(s){let a=Bun.file(`${this.logsDirPath}/${s}`);if(a.size<this.service.maxFileSize)this.currentLogFilePath=`${this.logsDirPath}/${s}`,this.writer=a.writer(),this.writer.write(await a.text()),this.writer.write("\n"),this.writer.flush(),this.fileSize=a.size}if(!this.writer){let a=`${new Date(Date.now()).toISOString()}.log`.replaceAll(":","-");this.currentLogFilePath=`${this.logsDirPath}/${a}`;let t=Bun.file(`${this.logsDirPath}/${a}`);this.writer=t.writer(),this.fileSize=0,this.writerSize=0}this.isCreatingFile=!1}async log(i,s,a={}){if(!this.isReady)await new Promise((c)=>{let d=setInterval(()=>{if(this.isReady)c({}),clearInterval(d)},100)});let t=ci.getStore(),r={};if(t)r={url:t.req.rawRequest.url,method:t.req.rawRequest.method,headers:t.req.rawRequest.headers,body:t.req.rawRequest.body};let l={timestamp:new Date(Date.now()).toISOString(),env:"production",level:i,message:s,metadata:{...r,...a}},o="";try{o=JSON.stringify(l)}catch(c){throw new Error("Metadata must be a valid JSON object")}this.writerSize+=o.length,this.fileSize+=o.length,this.writer.write(o),this.writer.write("\n"),kt.channel("/logs/live",{}).publish(JSON.stringify(l)),this.service.onLogCreated(l),this.tryFlush()}async tryFlush(){if(this.fileSize>this.service.maxFileSize){if(!this.isCreatingFile)await this.newLogFile()}if(this.writerSize>this.service.maxFileSize/2)await this.writer.flush(),this.writerSize=0,await this.newLogFile();else clearTimeout(this.flushTimeout),this.flushTimeout=setTimeout(async()=>{await this.writer.flush(),this.writerSize=0},100)}}class jo extends zs{middlewares=["cache:private,0"];routes={"/live":this.get(async()=>{let i=Bun.file(bi.use().currentLogFilePath);return new Response(await i.text(),{headers:{"Content-Type":"text/plain"}})})}}function Yg(i){let s=new Map;for(let a of i)if(typeof a==="string"){let[t,r=""]=a.split(":");if(t.startsWith("-")){if(s.has(t.replace("-","")))s.delete(t.replace("-",""))}else s.set(t,r.split(",").filter(Boolean))}else s.set(a,[]);return s}class Zo extends hi{i;static _name="MiddlewareServiceContainer";constructor(i){super();this.service=i}runMiddleware(i){let s=new R;return Array.from(Yg(i).entries()).map(([a,t])=>{if(typeof a==="string"){let r=this.service.aliases[a];if(r){let l=new r(s);return()=>l.run.call(l,...t)}}else{if(Qm(a)){let r=new a(s);return r.run.bind(r)}return a}}).filter(Boolean).reduce((a,t)=>{return async()=>{return{...await a(),...await t()}}},()=>Promise.resolve({}))()}}function Vm(i){return i.replace(/-([a-z])/g,(s)=>s[1].toUpperCase())}function Xg(i){if("__brand"in i)return i.__brand==="ApiRouter";return!1}function xo(i,s=""){let a={};for(let[t,r]of Object.entries(i))if("run"in r){let l=r;if(!a[t])a[t]={};let{method:o,middlewares:c}=l,d=l.run.bind(l);a[t][o]={exec:d,middleware:c}}else if(typeof r==="function"){let l={},o=[];if(Xg(r)){let d=new r;l=d.routes,o=[d.middleware,...d.middlewares]}else{let[d]=(t==="/"?s:t).split("/").reverse();if(d==="")throw new Error(`"${t}" is not valid for a resource route`);if(d.includes(":"))throw new Error(`Last segment of a resource route has to be static. See "${t}"`);l=r(`${Vm(d)}Id`)}let c=xo(l,t);for(let[d,f]of Object.entries(c)){let m=d==="/"?"":d,p=t==="/"?"":t,u=`${p}${m}`===""?"/":`${p}${m}`;if(!a[u])a[u]={};for(let[g,h]of Object.entries(f))a[u][g]={exec:h.exec,middleware:[...o,...h.middleware]}}}else for(let l of Object.values(r)){if(!a[t])a[t]={};let{method:o,middlewares:c}=l,d=l.run.bind(l);a[t][o]={exec:d,middleware:c}}return Object.fromEntries(Object.entries(a).sort(([t],[r])=>{let l=t.split("/").length+t.split(":").length,o=r.split("/").length+r.split(":").length;return l-o}))}class no extends hi{i;static _name="ApiRouterServiceContainer";flatRoutes={};constructor(i){super();this.service=i;this.flatRoutes=xo({"/":this.service.rootRouter.bind(this.service),"/auth":Lo,"/__gemi__/services/i18n":et,"/__gemi__/services/logs":jo})}getRouteHandlerAndParams(i){let a=new URL(i.url).pathname.replace("/api",""),t={},r;for(let[l]of Object.entries(this.flatRoutes))try{let o=new URLPattern({pathname:l});if(o.test({pathname:a})){r=l,t=o.exec({pathname:a})?.pathname.groups;break}}catch(o){console.error(o)}return{params:t,path:r}}async runRouteMiddleware(i,s){let t=this.flatRoutes[i][s.rawRequest.method].middleware;try{await Zo.use().runMiddleware(t)}catch(r){if(r.kind===$o){if(s.rawRequest.url.includes("/api")){let{status:l=400,data:o,headers:c}=r.payload.api;return new Response(JSON.stringify(o),{status:l,headers:{"Content-Type":"application/json",...c}})}}else throw this.service.onRequestFail(s,r),console.error(r),r}}async getRouteData(i){let s=this.flatRoutes[i],a=ci.getStore(),t=s[a.req.rawRequest.method].exec??(()=>Promise.resolve({})),r={};try{r=await t()}catch(l){if(l.kind===$o){let{status:o=400,data:c,headers:d}=l.payload.api;return new Response(JSON.stringify(c),{status:o,headers:{"Content-Type":"application/json",...d}})}else throw this.service.onRequestFail(a.req,l),console.error(l),l}return r}async handleApiRequest(i){let{params:s,path:a}=this.getRouteHandlerAndParams(i),t=this.flatRoutes[a];if(!t||!t[i.method])return new Response(JSON.stringify({error:{message:"Not found"}}),{status:404});let r=new R(i,s,"api",a);if(!i.url.includes("/__gemi__"))this.service.onRequestStart(r);return await ci.run(r,async()=>{let l=ci.getStore();l.setRequest(r);let o=await this.runRouteMiddleware(a,r);if(o instanceof Response)return o;let c=await this.getRouteData(a);if(c instanceof Response)return c;let d=l.headers;if(d.append("Content-Type","application/json"),l.cookies.forEach((f)=>d.append("Set-Cookie",f.toString())),l.destroy(),!i.url.includes("/__gemi__"))this.service.onRequestEnd(r);return new Response(JSON.stringify(c),{headers:d})})}}class qt{static prepare(i,...s){let a={params:{},search:{}},[t={}]=s,{search:r,params:l}={...a,...t},o=ci.getStore();if(o.req.kind==="api")throw new Error("Query.prefetch() cannot be called from an API request");let c=o.req.rawRequest,d=new URL(c.url),f=new URLSearchParams(Uo(r));f.delete("json"),f.sort();let m=[`${xi(i,l)}`,f.toString()].filter((P)=>P.length>0).join("?"),p=`${d.origin}/${m}`,u=new Request(p,{headers:c.headers}),g=new R(u,l),h=(P)=>{o.prefetchedResources.set(xi(i,l),{[f.toString()]:P})},T=()=>{return ci.run(g,async()=>{let P=await no.use().getRouteData(i);return h(P),P})};return{instant:T,prefetch:()=>{o.prefetchPromiseQueue.add(T)}}}static instant(i,...s){return qt.prepare(i,...s).instant()}static prefetch(i,...s){return qt.prepare(i,...s).prefetch()}}class kt{static channel(i,s){let a=Is.use().service.channels[i];if(!a)return console.error(`Channel ${i} not found`),{publish:()=>{}};let t=new a;return{publish:(r,l=!1)=>{let o=xi(i,s);Is.use().publish(o,JSON.stringify({topic:o,data:t.publish(r)}),l)}}}}class km{static absolute(i,...s){return`${process.env.HOST_NAME}${xi(String(i),s[0]??{})}`}static relative(i,...s){return xi(String(i),s[0]??{})}}class qm{static debug(i,s){bi.use().log("debug",i,s)}static info(i,s){bi.use().log("info",i,s)}static notice(i,s){bi.use().log("notice",i,s)}static warning(i,s){bi.use().log("warning",i,s)}static error(i,s){bi.use().log("error",i,s)}static critical(i,s){bi.use().log("critical",i,s)}static alert(i,s){bi.use().log("alert",i,s)}static emergency(i,s){bi.use().log("emergency",i,s)}}export{km as Url,Co as Redirect,qt as Query,qm as Log,Wo as I18n,Jo as FileStorage,kt as Broadcast,Ai as Auth};export{Is as f,gs as g,ca as h,bi as i,qm as j,Bg as k,Zo as l,no as m};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=D0A28AE70A04633D64756E2164756E21
|