gemi 0.58.0 → 0.59.0
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/ai/Agent.d.ts +33 -0
- package/dist/ai/Agent.d.ts.map +1 -0
- package/dist/ai/AgentController.d.ts +8 -0
- package/dist/ai/AgentController.d.ts.map +1 -0
- package/dist/ai/useChat.d.ts +12 -0
- package/dist/ai/useChat.d.ts.map +1 -0
- package/dist/app/index.js +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-szss069z.js → chunk-06j6rsew.js} +2 -2
- package/dist/{chunk-szss069z.js.map → chunk-06j6rsew.js.map} +1 -1
- package/dist/{chunk-yjzs247s.js → chunk-0fm6jh9b.js} +2 -2
- package/dist/{chunk-yjzs247s.js.map → chunk-0fm6jh9b.js.map} +1 -1
- package/dist/chunk-23h0dmx2.js +5 -0
- package/dist/{chunk-87qab82w.js.map → chunk-23h0dmx2.js.map} +3 -3
- package/dist/{chunk-m3xy5xyf.js → chunk-2cwcfwg3.js} +2 -2
- package/dist/{chunk-m3xy5xyf.js.map → chunk-2cwcfwg3.js.map} +1 -1
- package/dist/{chunk-xzk827r3.js → chunk-2khdxyjb.js} +2 -2
- package/dist/{chunk-xzk827r3.js.map → chunk-2khdxyjb.js.map} +1 -1
- package/dist/{chunk-sy7jbdeb.js → chunk-3296fwss.js} +2 -2
- package/dist/{chunk-sy7jbdeb.js.map → chunk-3296fwss.js.map} +1 -1
- package/dist/{chunk-xdv1b8mr.js → chunk-3gvjn3q4.js} +2 -2
- package/dist/{chunk-xdv1b8mr.js.map → chunk-3gvjn3q4.js.map} +1 -1
- package/dist/{chunk-jhkjz9jr.js → chunk-4dan69s4.js} +2 -2
- package/dist/{chunk-3zxwscmf.js.map → chunk-4dan69s4.js.map} +1 -1
- package/dist/{chunk-hxf1re93.js → chunk-4mcyyh1v.js} +2 -2
- package/dist/{chunk-hxf1re93.js.map → chunk-4mcyyh1v.js.map} +1 -1
- package/dist/{chunk-w62m5f0n.js → chunk-5gdv4n4a.js} +3 -3
- package/dist/{chunk-w62m5f0n.js.map → chunk-5gdv4n4a.js.map} +1 -1
- package/dist/{chunk-j0c6ytkj.js → chunk-8kj3zrm9.js} +3 -3
- package/dist/{chunk-j0c6ytkj.js.map → chunk-8kj3zrm9.js.map} +1 -1
- package/dist/{chunk-0a2xgcj3.js → chunk-98a3k7bp.js} +2 -2
- package/dist/{chunk-0a2xgcj3.js.map → chunk-98a3k7bp.js.map} +1 -1
- package/dist/{chunk-5athahgr.js → chunk-9gsdcjt7.js} +2 -2
- package/dist/{chunk-5athahgr.js.map → chunk-9gsdcjt7.js.map} +1 -1
- package/dist/{chunk-pmhd6zfc.js → chunk-b0t4zp6b.js} +2 -2
- package/dist/{chunk-pmhd6zfc.js.map → chunk-b0t4zp6b.js.map} +1 -1
- package/dist/{chunk-3xadx444.js → chunk-bn1v4sfs.js} +2 -2
- package/dist/{chunk-3xadx444.js.map → chunk-bn1v4sfs.js.map} +1 -1
- package/dist/{chunk-9m2tbf3n.js → chunk-c40n5r4v.js} +2 -2
- package/dist/{chunk-9m2tbf3n.js.map → chunk-c40n5r4v.js.map} +1 -1
- package/dist/{chunk-a2sgjpvq.js → chunk-cejf873g.js} +2 -2
- package/dist/{chunk-a2sgjpvq.js.map → chunk-cejf873g.js.map} +1 -1
- package/dist/{chunk-tss5svjr.js → chunk-cw9y6k15.js} +2 -2
- package/dist/{chunk-tss5svjr.js.map → chunk-cw9y6k15.js.map} +1 -1
- package/dist/{chunk-5n2rvfh3.js → chunk-cyrxdj6a.js} +2 -2
- package/dist/{chunk-5n2rvfh3.js.map → chunk-cyrxdj6a.js.map} +1 -1
- package/dist/chunk-dgasxgsm.js +19 -0
- package/dist/{chunk-hwa5sqw5.js.map → chunk-dgasxgsm.js.map} +6 -6
- package/dist/{chunk-3g5bjvdf.js → chunk-f6dd4gd8.js} +2 -2
- package/dist/{chunk-3g5bjvdf.js.map → chunk-f6dd4gd8.js.map} +1 -1
- package/dist/{chunk-qgxr0g36.js → chunk-fb4cy6sq.js} +2 -2
- package/dist/{chunk-qgxr0g36.js.map → chunk-fb4cy6sq.js.map} +1 -1
- package/dist/{chunk-7ef5n8k2.js → chunk-fbvvqf9b.js} +2 -2
- package/dist/{chunk-7ef5n8k2.js.map → chunk-fbvvqf9b.js.map} +1 -1
- package/dist/{chunk-zbxgbr12.js → chunk-fxy42w6n.js} +2 -2
- package/dist/{chunk-zbxgbr12.js.map → chunk-fxy42w6n.js.map} +1 -1
- package/dist/{chunk-xey9cbap.js → chunk-get4mkx8.js} +2 -2
- package/dist/{chunk-xey9cbap.js.map → chunk-get4mkx8.js.map} +1 -1
- package/dist/chunk-gfma8e03.js +55 -0
- package/dist/chunk-gfma8e03.js.map +11 -0
- package/dist/{chunk-3zxwscmf.js → chunk-gwchvzdp.js} +2 -2
- package/dist/{chunk-jhkjz9jr.js.map → chunk-gwchvzdp.js.map} +1 -1
- package/dist/{chunk-k0fvsyeh.js → chunk-hsfjt13m.js} +1 -1
- package/dist/{chunk-yf7vz71n.js → chunk-hwhw98hc.js} +1 -1
- package/dist/{chunk-fjm4y8bn.js → chunk-hxb1eg2z.js} +2 -2
- package/dist/{chunk-fjm4y8bn.js.map → chunk-hxb1eg2z.js.map} +1 -1
- package/dist/{chunk-7b0x860b.js → chunk-j06g4sqc.js} +2 -2
- package/dist/{chunk-7b0x860b.js.map → chunk-j06g4sqc.js.map} +1 -1
- package/dist/{chunk-dgsgjg53.js → chunk-j23cengk.js} +2 -2
- package/dist/{chunk-dgsgjg53.js.map → chunk-j23cengk.js.map} +1 -1
- package/dist/{chunk-8gew8b9a.js → chunk-n412aa9s.js} +3 -3
- package/dist/{chunk-8gew8b9a.js.map → chunk-n412aa9s.js.map} +1 -1
- package/dist/{chunk-437085pe.js → chunk-p3qd0gqa.js} +2 -2
- package/dist/{chunk-437085pe.js.map → chunk-p3qd0gqa.js.map} +1 -1
- package/dist/{chunk-gw6agevz.js → chunk-pkjq9833.js} +3 -3
- package/dist/{chunk-gw6agevz.js.map → chunk-pkjq9833.js.map} +1 -1
- package/dist/{chunk-7j6wbv12.js → chunk-q0y0j3ne.js} +2 -2
- package/dist/{chunk-7j6wbv12.js.map → chunk-q0y0j3ne.js.map} +1 -1
- package/dist/chunk-q6qghsy7.js +5 -0
- package/dist/{chunk-b35e128b.js.map → chunk-q6qghsy7.js.map} +1 -1
- package/dist/{chunk-wbrj0gya.js → chunk-qva4841r.js} +2 -2
- package/dist/{chunk-wbrj0gya.js.map → chunk-qva4841r.js.map} +1 -1
- package/dist/{chunk-86jebsm4.js → chunk-rkbv3df7.js} +3 -3
- package/dist/{chunk-86jebsm4.js.map → chunk-rkbv3df7.js.map} +1 -1
- package/dist/{chunk-keehyx51.js → chunk-rpjsmr41.js} +2 -2
- package/dist/{chunk-keehyx51.js.map → chunk-rpjsmr41.js.map} +1 -1
- package/dist/{chunk-mwpdp09e.js → chunk-spbgpndn.js} +2 -2
- package/dist/{chunk-mwpdp09e.js.map → chunk-spbgpndn.js.map} +1 -1
- package/dist/{chunk-yy0eb9wn.js → chunk-stq96kya.js} +2 -2
- package/dist/{chunk-yy0eb9wn.js.map → chunk-stq96kya.js.map} +1 -1
- package/dist/{chunk-d125j8t0.js → chunk-tds3xq6b.js} +3 -3
- package/dist/{chunk-d125j8t0.js.map → chunk-tds3xq6b.js.map} +1 -1
- package/dist/{chunk-3337e5g0.js → chunk-tey1xayb.js} +2 -2
- package/dist/{chunk-3337e5g0.js.map → chunk-tey1xayb.js.map} +1 -1
- package/dist/{chunk-3aa287k7.js → chunk-txhcx69q.js} +2 -2
- package/dist/{chunk-3aa287k7.js.map → chunk-txhcx69q.js.map} +1 -1
- package/dist/{chunk-w7rf99w6.js → chunk-vj9538yn.js} +2 -2
- package/dist/{chunk-w7rf99w6.js.map → chunk-vj9538yn.js.map} +1 -1
- package/dist/{chunk-yed5whgs.js → chunk-wcv6qtpq.js} +3 -3
- package/dist/{chunk-yed5whgs.js.map → chunk-wcv6qtpq.js.map} +1 -1
- package/dist/{chunk-vr90r27j.js → chunk-wzvs3sym.js} +2 -2
- package/dist/{chunk-vr90r27j.js.map → chunk-wzvs3sym.js.map} +1 -1
- package/dist/{chunk-cyaz97p5.js → chunk-x6y1z4cq.js} +2 -2
- package/dist/{chunk-cyaz97p5.js.map → chunk-x6y1z4cq.js.map} +1 -1
- package/dist/{chunk-6235kb30.js → chunk-xecj8025.js} +3 -3
- package/dist/{chunk-6235kb30.js.map → chunk-xecj8025.js.map} +1 -1
- package/dist/{chunk-eejmhtnc.js → chunk-y64j80v9.js} +2 -2
- package/dist/{chunk-eejmhtnc.js.map → chunk-y64j80v9.js.map} +1 -1
- package/dist/{chunk-zh2egcyb.js → chunk-ygfwtgvm.js} +2 -2
- package/dist/{chunk-zh2egcyb.js.map → chunk-ygfwtgvm.js.map} +1 -1
- package/dist/{chunk-4yt5x8s2.js → chunk-ys904esh.js} +2 -2
- package/dist/{chunk-4yt5x8s2.js.map → chunk-ys904esh.js.map} +1 -1
- package/dist/{chunk-y6a8r2bn.js → chunk-z1e55w67.js} +3 -3
- package/dist/{chunk-y6a8r2bn.js.map → chunk-z1e55w67.js.map} +1 -1
- package/dist/{chunk-qb5mv6pj.js → chunk-z2tcxwyr.js} +3 -3
- package/dist/{chunk-qb5mv6pj.js.map → chunk-z2tcxwyr.js.map} +1 -1
- package/dist/{chunk-hppagzz4.js → chunk-zhbrkpb3.js} +4 -4
- package/dist/{chunk-hppagzz4.js.map → chunk-zhbrkpb3.js.map} +1 -1
- package/dist/{chunk-grdahng8.js → chunk-zqsfanvk.js} +2 -2
- package/dist/{chunk-grdahng8.js.map → chunk-zqsfanvk.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-li1J_igh.js → ThemeProvider-ByU4BQdL.js} +68 -2
- package/dist/chunks/{ThemeProvider-li1J_igh.js.map → ThemeProvider-ByU4BQdL.js.map} +1 -1
- package/dist/client/ComponentContext.d.ts +46 -0
- package/dist/client/ComponentContext.d.ts.map +1 -1
- package/dist/client/index.js +9 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/init.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/Features.d.ts +67 -1
- package/dist/facades/Features.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +2 -2
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/Server.d.ts.map +1 -1
- package/dist/server/httpDev.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +3 -3
- package/dist/services/events/Event.d.ts +6 -0
- package/dist/services/events/Event.d.ts.map +1 -1
- package/dist/services/features/FeatureFlagStore.d.ts +56 -0
- package/dist/services/features/FeatureFlagStore.d.ts.map +1 -1
- package/dist/services/features/FeatureManager.d.ts +35 -1
- package/dist/services/features/FeatureManager.d.ts.map +1 -1
- package/dist/services/features/types.d.ts +62 -0
- package/dist/services/features/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +8 -8
- package/dist/services/index.js.map +3 -3
- package/dist/services/logging/LogManager.d.ts +10 -1
- package/dist/services/logging/LogManager.d.ts.map +1 -1
- package/dist/services/logging/LogServiceProvider.d.ts +10 -0
- package/dist/services/logging/LogServiceProvider.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-87qab82w.js +0 -5
- package/dist/chunk-b35e128b.js +0 -5
- package/dist/chunk-hwa5sqw5.js +0 -19
- package/dist/chunk-mkfpnymy.js +0 -55
- package/dist/chunk-mkfpnymy.js.map +0 -11
- /package/dist/{chunk-k0fvsyeh.js.map → chunk-hsfjt13m.js.map} +0 -0
- /package/dist/{chunk-yf7vz71n.js.map → chunk-hwhw98hc.js.map} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oc as r$,Pc as R1,Qc as a$,Rc as e$,Yc as $f,bd as zf}from"./chunk-rkbv3df7.js";import{Jd as ff,md as h1}from"./chunk-z1e55w67.js";import{Od as y$,Td as d$}from"./chunk-q0y0j3ne.js";import{Ae as F,Ee as s$,Ud as u1,Wd as $$,Yd as q1,be as A0,de as c,ee as T,ie as s1,je as H0,ke as y1,le as X0,me as c1,ne as y,oe as R,qe as q$,re as t0,we as T0}from"./chunk-4mcyyh1v.js";import{Le as F$,Me as b1,Ne as K}from"./chunk-z2tcxwyr.js";import{tf as b}from"./chunk-x6y1z4cq.js";import{uf as V0,xf as L}from"./chunk-tds3xq6b.js";import{Df as O1}from"./chunk-hxb1eg2z.js";import{If as n0}from"./chunk-4dan69s4.js";class _{static getFacadeAccessor(){throw Error(`Facade [${this.name}] does not implement getFacadeAccessor().`)}static getFacadeRoot(){return L(this.getFacadeAccessor())}}import{AsyncLocalStorage as Gf}from"async_hooks";class d0{config;static token="broadcast";publishCb;context=new Gf;constructor($){this.config=$}get channels(){return this.config.channels}onPublish($){this.publishCb=$}publish(...$){let[f,i,z]=$;this.publishCb(f,i,z)}async handleMessage($,f){let i=JSON.parse(f);if(i.type==="subscribe"){let z=Object.entries(this.channels).sort(([U],[Y])=>U.length-Y.length);for(let[U,Y]of z){let W=new URLPattern({pathname:U});if(W.test({pathname:i.topic})){let O=W.exec({pathname:i.topic})?.pathname.groups,Z=new Y;if(await Z.subscribe.call(Z,O))$.subscribe(i.topic);break}}}if(i.type==="broadcast")$.publish(i.topic,JSON.stringify({topic:i.topic,data:i.payload}));if(i.type==="unsubscribe")$.unsubscribe(i.topic)}run($,f){let i=$.get("Cookie"),z=new Map;if(i){let U=i.split(";");for(let Y of U){let[W,O]=Y.split("=");z.set(W.trim(),O.trim())}}this.context.run({headers:$,cookies:z},f)}}class M0 extends _{static getFacadeAccessor(){return d0}static channel($,f){let i=this.getFacadeRoot(),z=i.channels[$];if(!z)return console.error(`Channel ${$} not found`),{publish:()=>{}};let U=new z;return{publish:(Y,W=!1)=>{let O=R($,f);i.publish(O,JSON.stringify({topic:O,data:U.publish(Y)}),W)}}}}class o extends _{static getFacadeAccessor(){return F}static async user(){let $=K.getStore(),f=M0.getFacadeRoot().context.getStore(),i="",z="";if($?.req)i=$.req.cookies.get("access_token"),z=$.req.headers.get("User-Agent");if(f?.cookies)z=f.headers.get("User-Agent"),i=f.cookies.get("access_token");let U=$?.user;if(!U)U=(await this.getFacadeRoot().getSession(i,z))?.user,$?.setUser(U);if(U)return U;throw new c1}static async guard($){let f=await o.user();if(!f)throw new H0;try{if(!await $(f))throw new H0}catch(i){throw new H0}}static async guardSafe($){let f=await o.user();if(!f)return!1;try{return await $(f)}catch(i){return!1}}static async authenticate($){return await this.getFacadeRoot().authenticate($)}static async createMagicLink($){return await this.getFacadeRoot().createMagicLinkToken($)}}class Z0 extends _{static getFacadeAccessor(){return b}static getSupportedLocales(){return this.getFacadeRoot().supportedLocales}static getDefaultLocale(){return this.getFacadeRoot().defaultLocale}static locale(){let $=this.getFacadeRoot(),f=K.getStore();if(f)return f.locale??$.detectLocale(f.req);return $.defaultLocale}static setLocale($=Z0.locale()){let f=this.getFacadeRoot(),i=$;if(!f.supportedLocales.includes($))i=f.defaultLocale;let z=K.getStore();return z.setCookie("i18n-locale",i,{expires:new Date(Date.now()+31536000000),secure:!1,httpOnly:!1}),z.setLocale(i),i}}import{Buffer as jf}from"buffer";async function J0($){try{return(await import("sharp")).default}catch(f){throw Error(`${$} requires the 'sharp' package. Install it with \`bun add sharp\`.`,{cause:f})}}class l0{async read($){let f=typeof $==="string"?{name:$}:$,i=await this.fetch({name:f.name,bucket:f.bucket});if(!i.ok)throw new X0(f.name);let z=i.headers.get("Content-Type")??"application/octet-stream",U=i.headers.get("ETag")??void 0,Y=i.headers.get("Last-Modified"),W=Y?new Date(Y):void 0;if(f.range){let J=await i.blob();return{body:J,start:0,end:J.size-1,total:J.size,partial:!1,type:z,etag:U,lastModified:W,name:f.name}}let O=Number(i.headers.get("Content-Length")),Z=Number.isFinite(O)?O:0;return{body:i.body,start:0,end:Z-1,total:Z,partial:!1,type:z,etag:U,lastModified:W,name:f.name}}async size($){let f=typeof $==="string"?$:$.name,i=typeof $==="string"?void 0:$.bucket,z=await this.fetch({name:f,bucket:i});if(!z.ok)throw new X0(f);let U=Number(z.headers.get("Content-Length"));if(Number.isFinite(U))return await z.body?.cancel(),U;return(await z.blob()).size}}import{readdir as Lf}from"fs/promises";class u0 extends l0{folderPath;constructor($=`${process.env.ROOT_DIR}/storage`){super();this.folderPath=$}async put($){let f,i;if($ instanceof Blob)f=$,i=`${Bun.randomUUIDv7()}.${$.type.split("/")[1].split(";")[0]}`;else f=$.body,i=$.name;let z=f instanceof Buffer?f:f instanceof Blob||f instanceof File?Buffer.from(await f.arrayBuffer()):"",U=`${this.folderPath}/${i}`;return await Bun.write(U,z),i}async fetch($){let f=process.env.BUCKET_NAME,i;if(typeof $==="string")i=$;else f=$.bucket??f,i=$.name;if(!i)throw Error("Object name has to be specified");let z=`${this.folderPath}/${i}`,U=Bun.file(z),Y=Bun.file(z).stream(),W=new Date(U.lastModified).toUTCString();return new Response(Y,{headers:{"Content-Type":U.type,"Content-Length":String(U.size),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":W}})}async read($){let f=typeof $==="string"?{name:$}:$,{name:i,range:z=null}=f;if(!i)throw Error("Object name has to be specified");let U=Bun.file(`${this.folderPath}/${i}`);if(!await U.exists())throw new X0(i);let Y=U.size,W=z?q1(z,Y):null;if(z&&!W)throw new y1(Y);let O=W?.start??0,Z=W?W.end:Y-1;return{body:W?U.slice(O,Z+1):U,start:O,end:Z,total:Y,partial:Boolean(W),type:U.type||"application/octet-stream",lastModified:new Date(U.lastModified),name:i}}async size($){let f=typeof $==="string"?$:$.name,i=Bun.file(`${this.folderPath}/${f}`);if(!await i.exists())throw new X0(f);return i.size}async list(){return await Lf(this.folderPath)}}function Si($){return $}function d1(){return{driver:new u0}}class s0{static token="filesystem";driver;constructor($={}){this.driver=$.driver??d1().driver}}class n1 extends _{static getFacadeAccessor(){return s0}static async put($){return this.getFacadeRoot().driver.put($)}static async metadata($){let f=jf.from(await $.arrayBuffer()),i=await J0("Storage.metadata()");try{return await i(f).metadata()}catch{return{}}}static async fetch($){return this.getFacadeRoot().driver.fetch($)}static async read($,f={}){let i=typeof $==="string"?{name:$}:{...$},z="range"in f?f.range??null:i.range!==void 0?i.range:K.getStore()?.rangeRequest??null;return this.getFacadeRoot().driver.read({...i,range:z})}static list($){return this.getFacadeRoot().driver.list($)}static delete(){}}function l1($){return Object.fromEntries(Object.entries($).filter(([,f])=>{return f!==null&&f!==void 0}))}var Kf=50;class C0{fetcher;entries=new Map;settleListener=null;failListener=null;shellAt=null;settledBacklog=[];shipped=new Set;requestStartedAt=performance.now();renderStartedAt=null;discoveryHintsMuted=!1;constructor($){this.fetcher=$}elapsed(){return Math.round(performance.now()-this.requestStartedAt)}keyFor($,f){return[$,f].filter((i)=>i.length>0).join("?")}markRenderStart(){if(this.renderStartedAt===null)this.renderStartedAt=performance.now()}markShell(){if(this.shellAt===null)this.shellAt=this.elapsed()}summarize($){let f=this.elapsed();return{shellAt:this.shellAt??f,settledAt:f,aborted:$,queries:Array.from(this.entries.values(),(i)=>({path:i.path,variantKey:i.variantKey,startedAt:i.startedAt,settledAt:i.settledAt,status:i.status,source:i.source}))}}onQueryFail($){this.failListener=$}muteDiscoveryHints(){this.discoveryHintsMuted=!0}maybeLogLateDiscovery($){if(!$.lateBy||this.discoveryHintsMuted)return;if($.status!=="resolved")return;if(Bun.env.NODE_ENV==="production")return;let f="";try{let U=JSON.stringify($.data)?.length??0;f=U>=1024?`${(U/1024).toFixed(1)} kB`:`${U} B`}catch{f="an unserializable payload"}let i=($.settledAt??0)-$.startedAt,z=$.variantKey?`, { search: ${JSON.stringify(Object.fromEntries(new URLSearchParams($.variantKey)))} }`:"";console.warn(`[gemi] useQuery("${$.patternPath}") was discovered ${$.lateBy}ms into the `+`server render \u2014 under a suspended segment, so its fetch (${i}ms, resolved ${f}) could not overlap the others. It still streamed. If the query belongs on this route, \`Query.prefetch("${$.patternPath}"${z})\` in the view `+"handler starts it at request time \u2014 but note prefetched data is also re-fetched and "+`streamed into every client-side navigation payload for the route, even when the client already holds it, so weigh that bandwidth against the ${f}. If the data is only needed conditionally (a closed popover, a hidden tab), \`{ lazy: true }\` + \`trigger()\` avoids running it here at all. \`Query.noPrefetch()\` in the handler marks the omission intentional and silences this hint for the route.`)}read($,f){return this.entries.get(this.keyFor($,f))}ensure($,f={},i="render"){let z=f.params??{},U=new URLSearchParams(l1(f.search??{}));U.delete("json"),U.sort();let Y=R($,z),W=U.toString(),O=this.keyFor(Y,W),Z=this.entries.get(O);if(Z)return Z;let J;if(i==="render"&&this.renderStartedAt!==null){let j=Math.round(performance.now()-this.renderStartedAt);if(j>Kf)J=j}let C,B=new Promise((j)=>{C=j}),X={path:Y,patternPath:$,variantKey:W,lateBy:J,status:"pending",promise:B,source:i,startedAt:this.elapsed()};return this.entries.set(O,X),this.fetcher($,z,U).then((j)=>{X.status="resolved",X.data=j},(j)=>{X.status="rejected",X.error=j}).then(()=>{if(X.settledAt=this.elapsed(),this.maybeLogLateDiscovery(X),X.status==="rejected"&&this.failListener)this.failListener(X);if(this.settleListener)this.settleListener(X);else this.settledBacklog.push(X);C()}),X}async allSettled(){let $=0;while($!==this.entries.size)$=this.entries.size,await Promise.all(Array.from(this.entries.values(),(f)=>f.promise))}snapshotResolved(){let $={};for(let[f,i]of this.entries){if(i.status!=="resolved")continue;this.shipped.add(f),$[i.path]??={},$[i.path][i.variantKey]=i.data}return $}onSettle($){this.settleListener=(i)=>{if(this.shipped.has(this.keyFor(i.path,i.variantKey)))return;$(i)};let f=this.settledBacklog;this.settledBacklog=[];for(let i of f)this.settleListener(i)}}class w0 extends Error{path;variantKey;status;body;constructor($,f,i,z){super(typeof z?.message==="string"?z.message:`Request to /api${$} failed with status ${i}`);this.path=$;this.variantKey=f;this.status=i;this.body=z;this.name="QueryError"}}class o0 extends T{schema={email:{required:"Email is required",string:"Invalid email",email:"Invalid email"},password:{required:"Password is required"}}}class o1 extends T{schema={email:{required:"Email is required",email:"Invalid email"}}}class t1 extends T{schema={password:{required:"Password is required",password:"Invalid password"}}}class S extends u1{async me(){let $=await o.user();if(!$)throw new s1;return $}async verifyEmail($=new T){let f=await $.input(),{userProvider:i}=L(F),z=await i.findUserByVerificationToken(f.get("token"));if(!z)return{email:null};return await i.verifyUser(z.email),{email:z.email}}async signInWithMagicLink($=new T){let f=L(F),{userProvider:i}=f,z=$.search.get("token"),U=decodeURIComponent($.search.get("email")).toLowerCase().trim(),Y=null;try{Y=await i.findUserMagicLinkToken({email:U,token:z})}catch(Z){return console.log(Z),{error:JSON.stringify(Z)}}if(!Y)return{error:"Invalid token"};await i.verifyUser(U),await i.deleteMagicLinkToken(U);let W=await f.createOrUpdateSession({email:U}),O=new URL($.rawRequest.url);return $.ctx().setCookie("access_token",W.token,{expires:W.expiresAt,secure:!O.origin.includes("localhost"),httpOnly:!0}),await f.config.onSignIn(W,$.search.toJSON()),{session:W}}async signInWithPinV2($=new T){let f=L(F),{userProvider:i}=f,z=await $.input(),{email:U,pin:Y}=z.toJSON(),W=U.toLowerCase().trim();if(!await i.findUserMagicLinkToken({email:W,pin:Y}))throw new c({pin:["Invalid pin"]});await i.deleteMagicLinkToken(W),await i.verifyUser(W);let Z=await f.createOrUpdateSessionV2({email:W}),J=new URL($.rawRequest.url);return $.ctx().setCookie("access_token",Z.token,{expires:Z.expiresAt,secure:!J.origin.includes("localhost"),httpOnly:!0}),await f.config.onSignIn(Z,$.search.toJSON()),Z}async signInWithPin($=new T){let f=L(F),{userProvider:i}=f,z=await $.input(),{email:U,pin:Y}=z.toJSON(),W=U.toLowerCase().trim();if(!await i.findUserMagicLinkToken({email:W,pin:Y}))throw new c({pin:["Invalid pin"]});await i.deleteMagicLinkToken(W),await i.verifyUser(W);let Z=await f.createOrUpdateSession({email:W}),J=new URL($.rawRequest.url);return $.ctx().setCookie("access_token",Z.token,{expires:Z.expiresAt,secure:!J.origin.includes("localhost"),httpOnly:!0}),await f.config.onSignIn(Z,$.search.toJSON()),{session:Z}}async signInV2($=new o0){let f=new URL($.rawRequest.url),i=await $.input(),{email:z,password:U}=i.toJSON(),Y=z.toLowerCase().trim(),W=L(F),O=await W.userProvider.findUserByEmailAddress(Y,W.config.verifyEmail);if(!O)throw new c({invalid_credentials:["Invalid credentials"]});if(!await W.config.verifyPassword(U,O.password))throw new c({invalid_credentials:["Invalid credentials"]});let J=await W.createOrUpdateSessionV2({email:O.email,id:O.id});$.ctx().setCookie("access_token",J.token,{expires:J.expiresAt,secure:!f.origin.includes("localhost"),httpOnly:!0}),await W.config.onSignIn(O,$.search.toJSON());let{password:C,...B}=O;return B}async signIn($=new o0){let f=await $.input(),{email:i,password:z}=f.toJSON(),U=i.toLowerCase().trim(),Y=L(F),W=await Y.userProvider.findUserByEmailAddress(U,Y.config.verifyEmail);if(!W)throw new c({invalid_credentials:["Invalid credentials"]});if(!await Y.config.verifyPassword(z,W.password))throw new c({invalid_credentials:["Invalid credentials"]});let Z=await Y.createOrUpdateSession({email:W.email,id:W.id}),J=new URL($.rawRequest.url);$.ctx().setCookie("access_token",Z.token,{expires:Z.expiresAt,secure:!J.origin.includes("localhost"),httpOnly:!0}),await Y.config.onSignIn(W,$.search.toJSON());let{password:C,...B}=W;return B}async signUp(){let $=L(F),{userProvider:f,config:i}=$,z=new i.signUpRequest,U=await z.input(),{email:Y,password:W,name:O,invitationId:Z}=U.toJSON(),J=Y.toLowerCase().trim();if(await f.findUserByEmailAddress(J,!1))throw new c({email:["Email address already exists"]});let B=await i.hashPassword(W),X=L(b).detectLocale(z),j;if(Z)j=await f.findInvitation(Z,J);let G,N="";if(j)G=await f.transaction(async()=>{await f.deleteInvitationById(Z);let D=await f.createUser({email:J,name:O,password:B,emailVerifiedAt:new Date,locale:X});return await f.createAccount({organizationId:j.organizationId,userId:D.id,organizationRole:j.role}),await i.onUserCreated(D),D});else N=await i.generateEmailVerificationToken(J),G=await f.transaction(async()=>{let D=await f.createUser({email:J,name:O,password:B,verificationToken:N,locale:X});return await i.onUserCreated(D),D});return await i.onSignUp(G,N,z.search.toJSON()),G}async signOut($=new T){let f=$.cookies.get("access_token"),i=await o.user(),{userProvider:z,config:U}=L(F);await z.deleteSession({token:f});let Y=new URL($.rawRequest.url);return $.ctx().setCookie("access_token","",{expires:new Date(0),secure:!Y.origin.includes("localhost"),httpOnly:!0}),await U.onSignOut(i),{}}async forgotPassword($=new o1){let i=(await $.input()).get("email").toLowerCase().trim(),{userProvider:z,config:U}=L(F),Y=await z.findUserByEmailAddress(i,U.verifyEmail);if(!Y)return{};let W=await U.generateForgotPasswordToken(Y);return await z.createPasswordResetToken({user:Y,token:W}),await U.onForgotPassword(Y,W),{}}async resetPassword($=new t1){let{userProvider:f,config:i}=L(F),z=await $.input(),{password:U,token:Y}=z.toJSON(),W=await f.findPasswordResetToken({token:Y});if(!W)throw new c({token:["Invalid token"]});if(T0.Instant.from(W.createdAt.toISOString()).add({hours:24}).until(T0.Now.instant()).sign>=0)throw new c({token:["Token expired"]});await f.deletePasswordResetToken({token:Y});let Z=await f.findUserByEmailAddress(W.user.email,i.verifyEmail);if(!Z)throw new c({email:["User not found"]});let J=await i.hashPassword(U);return await f.updateUserPassword({id:Z.id,password:J}),await f.deleteAllUserSessions(Z.id),await i.onResetPassword(Z),{}}async changePassword($=new T){let{userProvider:f,config:i}=L(F),z=await o.user(),U=await $.input(),{oldPassword:Y,newPassword:W}=U.toJSON(),{password:O}=await f.findUserByEmailAddress(z.email,i.verifyEmail);if(!await i.verifyPassword(Y,O))throw new c({oldPassword:["Incorrect password"]});let J=await i.hashPassword(W);return await f.updateUserPassword({id:z.id,password:J}),await f.deleteAllUserSessions(z.id),{}}async oauthRedirect($=new T){let{provider:f}=$.params,i=L(F).config.oauthProviders[f];if(!i)throw Error(`Invalid provider: ${f}`);return{destination:await i.getRedirectUrl($)}}async oauthCallback($=new T){let{provider:f}=$.params,i=L(F),{userProvider:z,config:U}=i,Y=U.oauthProviders[f],{email:W,name:O}=await Y.onCallback($);if(!W)return console.error("Authentication error: No email returned from OAuth provider callback"),{session:null};let Z=await z.findUserByEmailAddress(W,!1),J=L(b).detectLocale($),C="signin";if(!Z)C="signup",Z=await z.transaction(async()=>{let j=await z.createUser({email:W,name:O,locale:J,emailVerifiedAt:new Date});return await z.createSocialAccount({provider:f,userId:j.id,email:W,username:O,providerId:"",expiresAt:new Date,accessToken:"",refreshToken:""}),await U.onUserCreated(j),j});let B=await i.createOrUpdateSessionV2({email:Z.email,id:Z.id}),X=new URL($.rawRequest.url);if($.ctx().setCookie("access_token",B.token,{secure:!X.origin.includes("localhost"),httpOnly:!0,expires:B.expiresAt}),C==="signup")await U.onSignUp(Z,"",$.search.toJSON());else await U.onSignIn(Z,$.search.toJSON());return{session:B}}async createMagicLinkToken($=new T){let i=(await $.input()).get("email").toLowerCase().trim(),z=L(F),{user:U,pin:Y,token:W}=await z.createMagicLinkToken(i);if(U)return await z.config.onMagicLinkCreated(U,{email:i,pin:Y,token:W}),{email:i};return{email:null}}}class r1 extends t0{middlewares=["cache:private"];routes={"/:provider":this.view("_Redirect",[S,"oauthRedirect"]),"/:provider/callback":this.view("auth/OauthCallback",[S,"oauthCallback"])}}class r0 extends t0{middlewares=["cache:private"];routes={"/sign-in/magic-link":this.view("auth/MagicLinkSignIn",[S,"signInWithMagicLink"]),"/oauth":r1}}class a0 extends y{middlewares=["cache:private"];routes={"/sign-in":this.post(S,"signIn"),"/sign-in-v2":this.post(S,"signInV2"),"/sign-up":this.post(S,"signUp"),"/sign-out":this.post(S,"signOut"),"/forgot-password":this.post(S,"forgotPassword"),"/reset-password":this.post(S,"resetPassword"),"/change-password":this.post(S,"changePassword"),"/verify-email":this.post(S,"verifyEmail"),"/me":this.get(S,"me").middleware(["auth"]),"/magic-link":this.post(S,"createMagicLinkToken"),"/sign-in-with-pin":this.post(S,"signInWithPin"),"/sign-in-with-pin-v2":this.post(S,"signInWithPinV2")}}class e0 extends y{middlewares=["cache:private,0,no-store"];routes={"/set-locale/:locale":this.get(async()=>{let f=new T().params.locale;return await L(b).onLocaleChange(f),{locale:f}}),"/translations/:locale/:scope*":this.get(async()=>{let $=new T,f=`/${$.params.scope??""}`,i=$.params.locale,z=L(b),U=i??z.detectLocale($),Y=z.getPageTranslations(U,f);return $.ctx().setCookie("i18n-locale",U,{expires:new Date(Date.now()+31536000000)}),{[U]:Y}})}}class $1{}class f1 extends $1{async resize($,f){let{height:i,width:z,quality:U,fit:Y}=f;return await(await J0("The Sharp image optimization driver"))($).resize(z>0?z:void 0,i>0?i:void 0,{fit:Y}).webp({quality:U>0?U:80,force:!0}).toBuffer()}}function j3($){return $}function a1(){return{driver:new f1}}class i1 extends y{routes={"/resize":this.file(async()=>{let $=new T,f=new URL($.rawRequest.url),i=f.searchParams.get("url"),z=Number(f.searchParams.get("w")),U=Number(f.searchParams.get("h")),Y=f.searchParams.get("fit")??"cover",W=Number(f.searchParams.get("q"));if(!i)return new Response(JSON.stringify({error:"url query parameter is required"}),{headers:{"Content-Type":"application/json"},status:404});let Z=`${i.startsWith("http")?"":`http://localhost:${process.env.PORT||5173}`}${i}`,J=await fetch(Z);if(!J.ok)return new Response(JSON.stringify({error:"Image not found",info:Z}),{headers:{"Content-Type":"application/json"},status:404});let C=Buffer.from(await J.arrayBuffer()),B=await L(e1).resize(C,{height:U,width:z,fit:Y,quality:W});J.headers.delete("Content-Type"),J.headers.delete("Content-Length");let X=new Headers(J.headers);return X.set("Content-Type","image/webp"),X.set("Content-Length",`${B.byteLength}`),new Response(new Uint8Array(B),{headers:X})})}}class e1{static token="image";driver;constructor($={}){this.driver=$.driver??a1().driver}resize($,f){return this.driver.resize($,f)}}import{mkdir as z1,readdir as Vf,access as wf}from"fs/promises";async function U1($){try{return await wf($),!0}catch{return!1}}class N0{config;static token="log";writer;isReady=!1;flushTimeout;fileSize=0;writerSize=0;isCreatingFile=!1;bootPromise=null;currentLogFilePath;get logsDirPath(){return`${O1()}/storage/logs`}constructor($){this.config=$}boot(){if(!this.bootPromise)this.bootPromise=this.createStorage().catch(($)=>{console.error("Log storage unavailable, file logging disabled",$)}).then(()=>{this.isReady=!0});return this.bootPromise}async createStorage(){let $=`${O1()}/storage`;if(!await U1($))await z1($);if(!await U1(this.logsDirPath))await z1(this.logsDirPath);await this.newLogFile()}async newLogFile(){if(!await U1(this.logsDirPath))await z1(this.logsDirPath);if(this.isCreatingFile=!0,this.currentLogFilePath){this.writer.flush(),this.writer.end(),this.writer=null;let i=new File([await Bun.file(this.currentLogFilePath).arrayBuffer()],this.currentLogFilePath.split("/").pop(),{type:"text/plain"});this.config.onLogFileClosed(i),this.fileSize=0,this.writerSize=0}let f=(await Vf(this.logsDirPath)).sort().reverse()[0];if(f){let i=Bun.file(`${this.logsDirPath}/${f}`);if(i.size<this.config.maxFileSize)this.currentLogFilePath=`${this.logsDirPath}/${f}`,this.writer=i.writer(),this.writer.write(await i.text()),this.writer.write(`
|
|
3
|
+
`),this.writer.flush(),this.fileSize=i.size}if(!this.writer){let i=`${new Date(Date.now()).toISOString()}.log`.replaceAll(":","-");this.currentLogFilePath=`${this.logsDirPath}/${i}`;let z=Bun.file(`${this.logsDirPath}/${i}`);this.writer=z.writer(),this.fileSize=0,this.writerSize=0}this.isCreatingFile=!1}async log($,f,i={}){if(!this.isReady)await this.boot();let z=K.getStore(),U={};if(z)U={url:z.req.rawRequest.url,method:z.req.rawRequest.method,headers:z.req.rawRequest.headers,body:z.req.rawRequest.body};let Y={timestamp:new Date(Date.now()).toISOString(),env:Bun.env.NODE_ENV,level:$,message:f,metadata:{...U,...i}},W="";try{W=JSON.stringify(Y)}catch(O){console.log("Error parsing log object",O)}try{let O=this.config.onLogCreated(Y);if(O instanceof Promise)O.catch((Z)=>console.error("Error in onLogCreated",Z))}catch(O){console.error("Error in onLogCreated",O)}if(!this.writer)return;this.writerSize+=W.length,this.fileSize+=W.length;try{this.writer.write(W),this.writer.write(`
|
|
4
|
+
`),this.tryFlush()}catch(O){console.error("Error writing log",O)}}async tryFlush(){if(this.fileSize>this.config.maxFileSize){if(!this.isCreatingFile)await this.newLogFile()}if(this.writerSize>this.config.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 W1 extends y{middlewares=["cache:private,0"];routes={"/live":this.get(async()=>{let $=Bun.file(L(N0).currentLogFilePath);return new Response(await $.text(),{headers:{"Content-Type":"text/plain"}})})}}function Tf($){let f=new Map;for(let i of $)if(typeof i==="string"){let[z,U=""]=i.split(":");if(z.startsWith("-")){if(f.has(z.replace("-","")))f.delete(z.replace("-",""))}else f.set(z,U.split(",").filter(Boolean))}else f.set(i,[]);return f}class Q0{config;static token="middleware";constructor($){this.config=$}get aliases(){return this.config.aliases}runMiddleware($){let f=new T;return Array.from(Tf($).entries()).map(([i,z])=>{if(typeof i==="string"){let U=this.aliases[i];if(U){let Y=new U(f);return()=>Y.run.call(Y,...z)}}else{if($$(i)){let U=new i(f);return U.run.bind(U)}return i}}).filter(Boolean).reduce((i,z)=>{return async()=>{return{...await i(),...await z()}}},()=>Promise.resolve({}))()}}function b3($){return $}function f$(){return{onRequestStart:()=>{},onRequestEnd:()=>{},onRequestFail:()=>{}}}function i$(){return{partialRendering:!0,onRequestStart:()=>{},onRequestEnd:()=>{},onRequestFail:()=>{},onStreamComplete:()=>{}}}function Nf($){return"run"in $}function Qf($){return Object.hasOwn($,"get")||Object.hasOwn($,"post")||Object.hasOwn($,"put")||Object.hasOwn($,"delete")}function Af($){return Object.hasOwn($,"first")&&Object.hasOwn($,"second")}function Ef($){if("__brand"in $)return $.__brand==="ApiRouter";return!1}function xf($){if("__internal_brand"in $)return $.__internal_brand==="ProxyHandler";return!1}function Df($){if("__internal_brand"in $)return $.__internal_brand==="StreamHandler";return!1}function Y1($,f="",i=[]){let z={};function U(Y,W,O,Z){let J=Y==="/"?"":Y,C=f==="/"?"":f,B=(`${C}${J}`===""?"/":`${C}${J}`).replaceAll("//","/");if(!z[B])z[B]={};z[B][W.toUpperCase()]={exec:O,middleware:[...i,...Z]},z[B].OPTIONS={exec:()=>{let j=new T().ctx().headers;return new Response(null,{headers:j,status:204})},middleware:[]}}for(let[Y,W]of Object.entries($)){if(xf(W)){let O=W;for(let Z of["GET","POST","PUT","DELETE"])U(Y,Z,O.run.bind(O),[]);continue}if(Nf(W)){let O=W,Z=O.method,J=O.middlewares,C=O.run.bind(O);if(U(Y,Z,C,J),Df(W))U(Y,"HEAD",C,J)}if(Qf(W))for(let[O,Z]of Object.entries(W)){let J=Z.middlewares,C=Z.run.bind(Z);U(Y,O,C,J)}if(Ef(W)){let O=new W,Z=Y1(O.routes,`${f}${Y}`,O.middlewares);for(let[J,C]of Object.entries(Z))z[J.replaceAll("//","/")]=C}if(Af(W)){let{first:O,second:Z}=W;for(let[J,C]of Object.entries(O)){let B=C.middlewares,X=C.run.bind(C),[j,...G]=Y.split("/").reverse();if(!j.startsWith(":"))throw Error("Resource route must end with a dynamic segment");U(G.reverse().join("/"),J,X,B)}for(let[J,C]of Object.entries(Z)){let B=C.middlewares,X=C.run.bind(C);U(Y,J,X,B)}}}return Object.fromEntries(Object.entries(z).sort(([Y],[W])=>{let O=Y.split("/").length+Y.split(":").length,Z=W.split("/").length+W.split(":").length;return O-Z}))}function F0($){return $.replace(/\([^)]*\)/g,"").replace(/\/\//g,"/")}function Z1($,f){if($==="/")return f;if(f==="/")return $;return`${$}${f}`}function J1($){let f=F0($);return f.length>1?f.replace(/\/$/,""):f}function z$($,f){return f.map((i)=>({...i,path:J1(Z1($,i.path))}))}function S0($){let f={};for(let[i,z]of Object.entries($))if("run"in z){let U=z;if("children"in U){let Y=new U.children,W=S0(Y.routes);for(let[O,{exec:Z,middleware:J,segments:C,features:B}]of Object.entries(W)){let X=Z1(i,O),j=(G)=>U.run.call(U,G,i);f[F0(X)]={exec:[j,...Z],middleware:[...U.middlewares,...J],features:[...U.featureGates,...B],viewPath:U.viewPath,segments:[{path:J1(i),viewPath:U.viewPath,...U.alwaysRuns?{alwaysRun:!0}:{}},...z$(i,C)]}}}else{let Y=(W)=>U.run.call(U,W,i);f[F0(i)]={exec:[Y],middleware:U.middlewares,features:U.featureGates,viewPath:U.viewPath,segments:[{path:J1(i),viewPath:U.viewPath}]}}}else{let U=new z,Y=S0(U.routes);for(let[W,{exec:O,middleware:Z,viewPath:J,segments:C,features:B}]of Object.entries(Y)){let X=Z1(i,W);f[F0(X)]={exec:O,middleware:[...U.middlewares,...Z],features:[...U.featureGates,...B],viewPath:J,segments:z$(i,C)}}}return Object.fromEntries(Object.entries(f).sort(([i],[z])=>{let U=i.split("/").length+i.split(":").length,Y=z.split("/").length+z.split(":").length;return U-Y}))}var gf=Object.defineProperty,I=($,f)=>gf($,"name",{value:f,configurable:!0}),G0=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor($,f,i,z,U,Y){this.type=$,this.name=f,this.prefix=i,this.value=z,this.suffix=U,this.modifier=Y}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};I(G0,"Part");var _f=/[$_\p{ID_Start}]/u,Mf=/[$_\u200C\u200D\p{ID_Continue}]/u,C1=".*";function U$($,f){return(f?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test($)}I(U$,"isASCII");function G1($,f=!1){let i=[],z=0;for(;z<$.length;){let U=$[z],Y=I(function(W){if(!f)throw TypeError(W);i.push({type:"INVALID_CHAR",index:z,value:$[z++]})},"ErrorOrInvalid");if(U==="*"){i.push({type:"ASTERISK",index:z,value:$[z++]});continue}if(U==="+"||U==="?"){i.push({type:"OTHER_MODIFIER",index:z,value:$[z++]});continue}if(U==="\\"){i.push({type:"ESCAPED_CHAR",index:z++,value:$[z++]});continue}if(U==="{"){i.push({type:"OPEN",index:z,value:$[z++]});continue}if(U==="}"){i.push({type:"CLOSE",index:z,value:$[z++]});continue}if(U===":"){let W="",O=z+1;for(;O<$.length;){let Z=$.substr(O,1);if(O===z+1&&_f.test(Z)||O!==z+1&&Mf.test(Z)){W+=$[O++];continue}break}if(!W){Y(`Missing parameter name at ${z}`);continue}i.push({type:"NAME",index:z,value:W}),z=O;continue}if(U==="("){let W=1,O="",Z=z+1,J=!1;if($[Z]==="?"){Y(`Pattern cannot start with "?" at ${Z}`);continue}for(;Z<$.length;){if(!U$($[Z],!1)){Y(`Invalid character '${$[Z]}' at ${Z}.`),J=!0;break}if($[Z]==="\\"){O+=$[Z++]+$[Z++];continue}if($[Z]===")"){if(W--,W===0){Z++;break}}else if($[Z]==="("&&(W++,$[Z+1]!=="?")){Y(`Capturing groups are not allowed at ${Z}`),J=!0;break}O+=$[Z++]}if(J)continue;if(W){Y(`Unbalanced pattern at ${z}`);continue}if(!O){Y(`Missing pattern at ${z}`);continue}i.push({type:"REGEX",index:z,value:O}),z=Z;continue}i.push({type:"CHAR",index:z,value:$[z++]})}return i.push({type:"END",index:z,value:""}),i}I(G1,"lexer");function L1($,f={}){let i=G1($);f.delimiter??="/#?",f.prefixes??="./";let z=`[^${h(f.delimiter)}]+?`,U=[],Y=0,W=0,O="",Z=new Set,J=I((x)=>{if(W<i.length&&i[W].type===x)return i[W++].value},"tryConsume"),C=I(()=>J("OTHER_MODIFIER")??J("ASTERISK"),"tryConsumeModifier"),B=I((x)=>{let V=J(x);if(V!==void 0)return V;let{type:w,index:g}=i[W];throw TypeError(`Unexpected ${w} at ${g}, expected ${x}`)},"mustConsume"),X=I(()=>{let x="",V;for(;V=J("CHAR")??J("ESCAPED_CHAR");)x+=V;return x},"consumeText"),j=I((x)=>x,"DefaultEncodePart"),G=f.encodePart||j,N="",D=I((x)=>{N+=x},"appendToPendingFixedValue"),H=I(()=>{N.length&&(U.push(new G0(3,"","",G(N),"",3)),N="")},"maybeAddPartFromPendingFixedValue"),q=I((x,V,w,g,k)=>{let M=3;switch(k){case"?":M=1;break;case"*":M=0;break;case"+":M=2;break}if(!V&&!w&&M===3){D(x);return}if(H(),!V&&!w){if(!x)return;U.push(new G0(3,"","",G(x),"",M));return}let E;w?w==="*"?E=C1:E=w:E=z;let Q=2;E===z?(Q=1,E=""):E===C1&&(Q=0,E="");let v;if(V?v=V:w&&(v=Y++),Z.has(v))throw TypeError(`Duplicate name '${v}'.`);Z.add(v),U.push(new G0(Q,v,G(x),E,G(g),M))},"addPart");for(;W<i.length;){let x=J("CHAR"),V=J("NAME"),w=J("REGEX");if(!V&&!w&&(w=J("ASTERISK")),V||w){let k=x??"";f.prefixes.indexOf(k)===-1&&(D(k),k=""),H();let M=C();q(k,V,w,"",M);continue}let g=x??J("ESCAPED_CHAR");if(g){D(g);continue}if(J("OPEN")){let k=X(),M=J("NAME"),E=J("REGEX");!M&&!E&&(E=J("ASTERISK"));let Q=X();B("CLOSE");let v=C();q(k,M,E,Q,v);continue}H(),B("END")}return U}I(L1,"parse");function h($){return $.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}I(h,"escapeString");function B1($){return $&&$.ignoreCase?"ui":"u"}I(B1,"flags");function O$($,f,i){return j1(L1($,i),f,i)}I(O$,"stringToRegexp");function $0($){switch($){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}I($0,"modifierToString");function j1($,f,i={}){i.delimiter??="/#?",i.prefixes??="./",i.sensitive??=!1,i.strict??=!1,i.end??=!0,i.start??=!0,i.endsWith="";let z=i.start?"^":"";for(let O of $){if(O.type===3){O.modifier===3?z+=h(O.value):z+=`(?:${h(O.value)})${$0(O.modifier)}`;continue}f&&f.push(O.name);let Z=`[^${h(i.delimiter)}]+?`,J=O.value;if(O.type===1?J=Z:O.type===0&&(J=C1),!O.prefix.length&&!O.suffix.length){O.modifier===3||O.modifier===1?z+=`(${J})${$0(O.modifier)}`:z+=`((?:${J})${$0(O.modifier)})`;continue}if(O.modifier===3||O.modifier===1){z+=`(?:${h(O.prefix)}(${J})${h(O.suffix)})`,z+=$0(O.modifier);continue}z+=`(?:${h(O.prefix)}`,z+=`((?:${J})(?:`,z+=h(O.suffix),z+=h(O.prefix),z+=`(?:${J}))*)${h(O.suffix)})`,O.modifier===0&&(z+="?")}let U=`[${h(i.endsWith)}]|$`,Y=`[${h(i.delimiter)}]`;if(i.end)return i.strict||(z+=`${Y}?`),i.endsWith.length?z+=`(?=${U})`:z+="$",new RegExp(z,B1(i));i.strict||(z+=`(?:${Y}(?=${U}))?`);let W=!1;if($.length){let O=$[$.length-1];O.type===3&&O.modifier===3&&(W=i.delimiter.indexOf(O)>-1)}return W||(z+=`(?=${Y}|${U})`),new RegExp(z,B1(i))}I(j1,"partsToRegexp");var r={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Hf={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Ff={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function W$($,f){return $.length?$[0]==="/"?!0:!f||$.length<2?!1:($[0]=="\\"||$[0]=="{")&&$[1]=="/":!1}I(W$,"isAbsolutePathname");function K1($,f){return $.startsWith(f)?$.substring(f.length,$.length):$}I(K1,"maybeStripPrefix");function Y$($,f){return $.endsWith(f)?$.substr(0,$.length-f.length):$}I(Y$,"maybeStripSuffix");function V1($){return!$||$.length<2?!1:$[0]==="["||($[0]==="\\"||$[0]==="{")&&$[1]==="["}I(V1,"treatAsIPv6Hostname");var Z$=["ftp","file","http","https","ws","wss"];function w1($){if(!$)return!0;for(let f of Z$)if($.test(f))return!0;return!1}I(w1,"isSpecialScheme");function J$($,f){if($=K1($,"#"),f||$==="")return $;let i=new URL("https://example.com");return i.hash=$,i.hash?i.hash.substring(1,i.hash.length):""}I(J$,"canonicalizeHash");function X$($,f){if($=K1($,"?"),f||$==="")return $;let i=new URL("https://example.com");return i.search=$,i.search?i.search.substring(1,i.search.length):""}I(X$,"canonicalizeSearch");function C$($,f){return f||$===""?$:V1($)?Q1($):N1($)}I(C$,"canonicalizeHostname");function B$($,f){if(f||$==="")return $;let i=new URL("https://example.com");return i.password=$,i.password}I(B$,"canonicalizePassword");function I$($,f){if(f||$==="")return $;let i=new URL("https://example.com");return i.username=$,i.username}I(I$,"canonicalizeUsername");function G$($,f,i){if(i||$==="")return $;if(f&&!Z$.includes(f))return new URL(`${f}:${$}`).pathname;let z=$[0]=="/";return $=new URL(z?$:"/-"+$,"https://example.com").pathname,z||($=$.substring(2,$.length)),$}I(G$,"canonicalizePathname");function L$($,f,i){return T1(f)===$&&($=""),i||$===""?$:A1($)}I(L$,"canonicalizePort");function j$($,f){return $=Y$($,":"),f||$===""?$:v0($)}I(j$,"canonicalizeProtocol");function T1($){switch($){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}I(T1,"defaultPortForProtocol");function v0($){if($==="")return $;if(/^[-+.A-Za-z0-9]*$/.test($))return $.toLowerCase();throw TypeError(`Invalid protocol '${$}'.`)}I(v0,"protocolEncodeCallback");function K$($){if($==="")return $;let f=new URL("https://example.com");return f.username=$,f.username}I(K$,"usernameEncodeCallback");function V$($){if($==="")return $;let f=new URL("https://example.com");return f.password=$,f.password}I(V$,"passwordEncodeCallback");function N1($){if($==="")return $;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test($))throw TypeError(`Invalid hostname '${$}'`);let f=new URL("https://example.com");return f.hostname=$,f.hostname}I(N1,"hostnameEncodeCallback");function Q1($){if($==="")return $;if(/[^0-9a-fA-F[\]:]/g.test($))throw TypeError(`Invalid IPv6 hostname '${$}'`);return $.toLowerCase()}I(Q1,"ipv6HostnameEncodeCallback");function A1($){if($===""||/^[0-9]*$/.test($)&&parseInt($)<=65535)return $;throw TypeError(`Invalid port '${$}'.`)}I(A1,"portEncodeCallback");function w$($){if($==="")return $;let f=new URL("https://example.com");return f.pathname=$[0]!=="/"?"/-"+$:$,$[0]!=="/"?f.pathname.substring(2,f.pathname.length):f.pathname}I(w$,"standardURLPathnameEncodeCallback");function T$($){return $===""?$:new URL(`data:${$}`).pathname}I(T$,"pathURLPathnameEncodeCallback");function N$($){if($==="")return $;let f=new URL("https://example.com");return f.search=$,f.search.substring(1,f.search.length)}I(N$,"searchEncodeCallback");function Q$($){if($==="")return $;let f=new URL("https://example.com");return f.hash=$,f.hash.substring(1,f.hash.length)}I(Q$,"hashEncodeCallback");var A$=class{#O;#z=[];#f={};#$=0;#U=1;#J=0;#Y=0;#I=0;#G=0;#L=!1;constructor($){this.#O=$}get result(){return this.#f}parse(){for(this.#z=G1(this.#O,!0);this.#$<this.#z.length;this.#$+=this.#U){if(this.#U=1,this.#z[this.#$].type==="END"){if(this.#Y===0){this.#w(),this.#X()?this.#i(9,1):this.#C()?this.#i(8,1):this.#i(7,0);continue}else if(this.#Y===2){this.#B(5);continue}this.#i(10,0);break}if(this.#I>0)if(this.#D())this.#I-=1;else continue;if(this.#x()){this.#I+=1;continue}switch(this.#Y){case 0:this.#T()&&this.#B(1);break;case 1:if(this.#T()){this.#M();let $=7,f=1;this.#Q()?($=2,f=3):this.#L&&($=2),this.#i($,f)}break;case 2:this.#K()?this.#B(3):(this.#V()||this.#C()||this.#X())&&this.#B(5);break;case 3:this.#A()?this.#i(4,1):this.#K()&&this.#i(5,1);break;case 4:this.#K()&&this.#i(5,1);break;case 5:this.#g()?this.#G+=1:this.#_()&&(this.#G-=1),this.#E()&&!this.#G?this.#i(6,1):this.#V()?this.#i(7,0):this.#C()?this.#i(8,1):this.#X()&&this.#i(9,1);break;case 6:this.#V()?this.#i(7,0):this.#C()?this.#i(8,1):this.#X()&&this.#i(9,1);break;case 7:this.#C()?this.#i(8,1):this.#X()&&this.#i(9,1);break;case 8:this.#X()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#f.hostname!==void 0&&this.#f.port===void 0&&(this.#f.port="")}#i($,f){switch(this.#Y){case 0:break;case 1:this.#f.protocol=this.#Z();break;case 2:break;case 3:this.#f.username=this.#Z();break;case 4:this.#f.password=this.#Z();break;case 5:this.#f.hostname=this.#Z();break;case 6:this.#f.port=this.#Z();break;case 7:this.#f.pathname=this.#Z();break;case 8:this.#f.search=this.#Z();break;case 9:this.#f.hash=this.#Z();break;case 10:break}this.#Y!==0&&$!==10&&([1,2,3,4].includes(this.#Y)&&[6,7,8,9].includes($)&&(this.#f.hostname??=""),[1,2,3,4,5,6].includes(this.#Y)&&[8,9].includes($)&&(this.#f.pathname??=this.#L?"/":""),[1,2,3,4,5,6,7].includes(this.#Y)&&$===9&&(this.#f.search??="")),this.#N($,f)}#N($,f){this.#Y=$,this.#J=this.#$+f,this.#$+=f,this.#U=0}#w(){this.#$=this.#J,this.#U=0}#B($){this.#w(),this.#Y=$}#j($){return $<0&&($=this.#z.length-$),$<this.#z.length?this.#z[$]:this.#z[this.#z.length-1]}#W($,f){let i=this.#j($);return i.value===f&&(i.type==="CHAR"||i.type==="ESCAPED_CHAR"||i.type==="INVALID_CHAR")}#T(){return this.#W(this.#$,":")}#Q(){return this.#W(this.#$+1,"/")&&this.#W(this.#$+2,"/")}#K(){return this.#W(this.#$,"@")}#A(){return this.#W(this.#$,":")}#E(){return this.#W(this.#$,":")}#V(){return this.#W(this.#$,"/")}#C(){if(this.#W(this.#$,"?"))return!0;if(this.#z[this.#$].value!=="?")return!1;let $=this.#j(this.#$-1);return $.type!=="NAME"&&$.type!=="REGEX"&&$.type!=="CLOSE"&&$.type!=="ASTERISK"}#X(){return this.#W(this.#$,"#")}#x(){return this.#z[this.#$].type=="OPEN"}#D(){return this.#z[this.#$].type=="CLOSE"}#g(){return this.#W(this.#$,"[")}#_(){return this.#W(this.#$,"]")}#Z(){let $=this.#z[this.#$],f=this.#j(this.#J).index;return this.#O.substring(f,$.index)}#M(){let $={};Object.assign($,r),$.encodePart=v0;let f=O$(this.#Z(),void 0,$);this.#L=w1(f)}};I(A$,"Parser");var X1=["protocol","username","password","hostname","port","pathname","search","hash"],t="*";function I1($,f){if(typeof $!="string")throw TypeError("parameter 1 is not of type 'string'.");let i=new URL($,f);return{protocol:i.protocol.substring(0,i.protocol.length-1),username:i.username,password:i.password,hostname:i.hostname,port:i.port,pathname:i.pathname,search:i.search!==""?i.search.substring(1,i.search.length):void 0,hash:i.hash!==""?i.hash.substring(1,i.hash.length):void 0}}I(I1,"extractValues");function d($,f){return f?I0($):$}I(d,"processBaseURLString");function B0($,f,i){let z;if(typeof f.baseURL=="string")try{z=new URL(f.baseURL),f.protocol===void 0&&($.protocol=d(z.protocol.substring(0,z.protocol.length-1),i)),!i&&f.protocol===void 0&&f.hostname===void 0&&f.port===void 0&&f.username===void 0&&($.username=d(z.username,i)),!i&&f.protocol===void 0&&f.hostname===void 0&&f.port===void 0&&f.username===void 0&&f.password===void 0&&($.password=d(z.password,i)),f.protocol===void 0&&f.hostname===void 0&&($.hostname=d(z.hostname,i)),f.protocol===void 0&&f.hostname===void 0&&f.port===void 0&&($.port=d(z.port,i)),f.protocol===void 0&&f.hostname===void 0&&f.port===void 0&&f.pathname===void 0&&($.pathname=d(z.pathname,i)),f.protocol===void 0&&f.hostname===void 0&&f.port===void 0&&f.pathname===void 0&&f.search===void 0&&($.search=d(z.search.substring(1,z.search.length),i)),f.protocol===void 0&&f.hostname===void 0&&f.port===void 0&&f.pathname===void 0&&f.search===void 0&&f.hash===void 0&&($.hash=d(z.hash.substring(1,z.hash.length),i))}catch{throw TypeError(`invalid baseURL '${f.baseURL}'.`)}if(typeof f.protocol=="string"&&($.protocol=j$(f.protocol,i)),typeof f.username=="string"&&($.username=I$(f.username,i)),typeof f.password=="string"&&($.password=B$(f.password,i)),typeof f.hostname=="string"&&($.hostname=C$(f.hostname,i)),typeof f.port=="string"&&($.port=L$(f.port,$.protocol,i)),typeof f.pathname=="string"){if($.pathname=f.pathname,z&&!W$($.pathname,i)){let U=z.pathname.lastIndexOf("/");U>=0&&($.pathname=d(z.pathname.substring(0,U+1),i)+$.pathname)}$.pathname=G$($.pathname,$.protocol,i)}return typeof f.search=="string"&&($.search=X$(f.search,i)),typeof f.hash=="string"&&($.hash=J$(f.hash,i)),$}I(B0,"applyInit");function I0($){return $.replace(/([+*?:{}()\\])/g,"\\$1")}I(I0,"escapePatternString");function E$($){return $.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}I(E$,"escapeRegexpString");function x$($,f){f.delimiter??="/#?",f.prefixes??="./",f.sensitive??=!1,f.strict??=!1,f.end??=!0,f.start??=!0,f.endsWith="";let i=".*",z=`[^${E$(f.delimiter)}]+?`,U=/[$_\u200C\u200D\p{ID_Continue}]/u,Y="";for(let W=0;W<$.length;++W){let O=$[W];if(O.type===3){if(O.modifier===3){Y+=I0(O.value);continue}Y+=`{${I0(O.value)}}${$0(O.modifier)}`;continue}let Z=O.hasCustomName(),J=!!O.suffix.length||!!O.prefix.length&&(O.prefix.length!==1||!f.prefixes.includes(O.prefix)),C=W>0?$[W-1]:null,B=W<$.length-1?$[W+1]:null;if(!J&&Z&&O.type===1&&O.modifier===3&&B&&!B.prefix.length&&!B.suffix.length)if(B.type===3){let X=B.value.length>0?B.value[0]:"";J=U.test(X)}else J=!B.hasCustomName();if(!J&&!O.prefix.length&&C&&C.type===3){let X=C.value[C.value.length-1];J=f.prefixes.includes(X)}J&&(Y+="{"),Y+=I0(O.prefix),Z&&(Y+=`:${O.name}`),O.type===2?Y+=`(${O.value})`:O.type===1?Z||(Y+=`(${z})`):O.type===0&&(!Z&&(!C||C.type===3||C.modifier!==3||J||O.prefix!=="")?Y+="*":Y+=`(${i})`),O.type===1&&Z&&O.suffix.length&&U.test(O.suffix[0])&&(Y+="\\"),Y+=I0(O.suffix),J&&(Y+="}"),O.modifier!==3&&(Y+=$0(O.modifier))}return Y}I(x$,"partsToPattern");var E1=class{#O;#z={};#f={};#$={};#U={};#J=!1;constructor($={},f,i){try{let z;if(typeof f=="string"?z=f:i=f,typeof $=="string"){let O=new A$($);if(O.parse(),$=O.result,z===void 0&&typeof $.protocol!="string")throw TypeError("A base URL must be provided for a relative constructor string.");$.baseURL=z}else{if(!$||typeof $!="object")throw TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(z)throw TypeError("parameter 1 is not of type 'string'.")}typeof i>"u"&&(i={ignoreCase:!1});let U={ignoreCase:i.ignoreCase===!0},Y={pathname:t,protocol:t,username:t,password:t,hostname:t,port:t,search:t,hash:t};this.#O=B0(Y,$,!0),T1(this.#O.protocol)===this.#O.port&&(this.#O.port="");let W;for(W of X1){if(!(W in this.#O))continue;let O={},Z=this.#O[W];switch(this.#f[W]=[],W){case"protocol":Object.assign(O,r),O.encodePart=v0;break;case"username":Object.assign(O,r),O.encodePart=K$;break;case"password":Object.assign(O,r),O.encodePart=V$;break;case"hostname":Object.assign(O,Hf),V1(Z)?O.encodePart=Q1:O.encodePart=N1;break;case"port":Object.assign(O,r),O.encodePart=A1;break;case"pathname":w1(this.#z.protocol)?(Object.assign(O,Ff,U),O.encodePart=w$):(Object.assign(O,r,U),O.encodePart=T$);break;case"search":Object.assign(O,r,U),O.encodePart=N$;break;case"hash":Object.assign(O,r,U),O.encodePart=Q$;break}try{this.#U[W]=L1(Z,O),this.#z[W]=j1(this.#U[W],this.#f[W],O),this.#$[W]=x$(this.#U[W],O),this.#J=this.#J||this.#U[W].some((J)=>J.type===2)}catch{throw TypeError(`invalid ${W} pattern '${this.#O[W]}'.`)}}}catch(z){throw TypeError(`Failed to construct 'URLPattern': ${z.message}`)}}get[Symbol.toStringTag](){return"URLPattern"}test($={},f){let i={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof $!="string"&&f)throw TypeError("parameter 1 is not of type 'string'.");if(typeof $>"u")return!1;try{typeof $=="object"?i=B0(i,$,!1):i=B0(i,I1($,f),!1)}catch{return!1}let z;for(z of X1)if(!this.#z[z].exec(i[z]))return!1;return!0}exec($={},f){let i={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof $!="string"&&f)throw TypeError("parameter 1 is not of type 'string'.");if(typeof $>"u")return;try{typeof $=="object"?i=B0(i,$,!1):i=B0(i,I1($,f),!1)}catch{return null}let z={};f?z.inputs=[$,f]:z.inputs=[$];let U;for(U of X1){let Y=this.#z[U].exec(i[U]);if(!Y)return null;let W={};for(let[O,Z]of this.#f[U].entries())if(typeof Z=="string"||typeof Z=="number"){let J=Y[O+1];W[Z]=J}z[U]={input:i[U]??"",groups:W}}return z}static compareComponent($,f,i){let z=I((O,Z)=>{for(let J of["type","modifier","prefix","value","suffix"]){if(O[J]<Z[J])return-1;if(O[J]===Z[J])continue;return 1}return 0},"comparePart"),U=new G0(3,"","","","",3),Y=new G0(0,"","","","",3),W=I((O,Z)=>{let J=0;for(;J<Math.min(O.length,Z.length);++J){let C=z(O[J],Z[J]);if(C)return C}return O.length===Z.length?0:z(O[J]??U,Z[J]??U)},"comparePartList");return!f.#$[$]&&!i.#$[$]?0:f.#$[$]&&!i.#$[$]?W(f.#U[$],[Y]):!f.#$[$]&&i.#$[$]?W([Y],i.#U[$]):W(f.#U[$],i.#U[$])}get protocol(){return this.#$.protocol}get username(){return this.#$.username}get password(){return this.#$.password}get hostname(){return this.#$.hostname}get port(){return this.#$.port}get pathname(){return this.#$.pathname}get search(){return this.#$.search}get hash(){return this.#$.hash}get hasRegExpGroups(){return this.#J}};I(E1,"URLPattern");function b0($,f){for(let[i,z]of Object.entries($)){let U=new E1({pathname:i});if(U.test({pathname:f}))return{routePath:i,params:U.exec({pathname:f})?.pathname.groups??{},route:z}}return null}var f0={startIndex:0,carriedViews:[]};function D$($,f){let i=R($.path,f);return i.includes("*")?null:i}function Sf($,f){if(!$)return f0;if($.search!==f.search)return f0;let i=Math.min($.segments.length,f.segments.length-1),z=0;while(z<i){let U=$.segments[z],Y=f.segments[z];if(Y.alwaysRun)break;if(U.viewPath!==Y.viewPath)break;let W=D$(U,$.params),O=D$(Y,f.params);if(W===null||O===null||W!==O)break;z++}if(z===0)return f0;return{startIndex:z,carriedViews:f.segments.slice(0,z).map(({viewPath:U})=>U)}}function vf($,f){let[,i,...z]=$.split("/");if(!f.includes(i))return $;let U=`/${z.join("/")}`;return U==="/"?"/":U.replace(/\/$/,"")}function g$($){let{flatViewRoutes:f,supportedLocales:i,from:z,origin:U,to:Y}=$;if(!z)return f0;let W;try{W=new URL(z,U)}catch{return f0}if(W.origin!==U)return f0;let O=b0(f,vf(W.pathname,i));if(!O)return f0;return Sf({segments:O.route.segments,params:O.params,search:W.search},Y)}var x1="x-gemi-from";import{createElement as K0,Fragment as rf}from"react";function bf($){return $.replace(/\([^)]*\)/g,"").replace(/\/\//g,"/")}function k0($){let f={};for(let[i,z]of Object.entries($))if("run"in z){let U=z.viewPath;if("children"in z){f[i]=[U];let Y=new z.children,W=k0(Y.routes);for(let[O,Z]of Object.entries(W)){let J=i==="/"?O:`${i}${O}`,C=O==="/"&&i!=="/"?i:J;f[C]=[U,...Z]}if(f[i].length===1)delete f[i]}else f[i]=[U]}else{let U=new z,Y=k0(U.routes);for(let[W,O]of Object.entries(Y)){let Z=i==="/"?W:`${i}${W}`,J=W==="/"&&i!=="/"?i:Z;f[J]=O}}return Object.fromEntries(Object.entries(f).map(([i,z])=>[bf(i),z]))}function P0($){let f=[];for(let[i,z]of Object.entries($))if("run"in z){let U=z.viewPath;if(U==="__")continue;if(U==="REDIRECT")continue;if(U==="FILE")continue;if("children"in z){let Y=new z.children,W=P0(Y.routes);f.push([U,W])}else f.push([U,[]])}else{let U=new z,Y=P0(U.routes);f.push(...Y)}return f}function D1($){let f=[];for(let[i,z]of $)f.push(i,...D1(z).flat());return Array.from(new Set(f))}class L0 extends _{static getFacadeAccessor(){return N0}static debug($,f){this.getFacadeRoot().log("debug",$,f)}static info($,f){this.getFacadeRoot().log("info",$,f)}static notice($,f){this.getFacadeRoot().log("notice",$,f)}static warning($,f){this.getFacadeRoot().log("warning",$,f)}static error($,f){this.getFacadeRoot().log("error",$,f)}static critical($,f){this.getFacadeRoot().log("critical",$,f)}static alert($,f){this.getFacadeRoot().log("alert",$,f)}static emergency($,f){this.getFacadeRoot().log("emergency",$,f)}}class g1{id;static token="kernel.id";constructor($=crypto.randomUUID()){this.id=$}}var kf=new Set(["script","style","textarea","title","xmp","iframe","noembed","noframes","noscript"]),Pf=new Set(["svg","math"]);function _$($){return $===32||$===9||$===10||$===12||$===13}function M$($){return $>=65&&$<=90||$>=97&&$<=122}function R0($){return $>=65&&$<=90?$+32:$}function H$(){let $="data",f="",i=!1,z="",U=0,Y=0,W=!1,O=0,Z=0,J=()=>$==="data"&&O===0&&Z===0,C=()=>{if(!i&&kf.has(f)){$="rawText",z=`</${f}`,U=0,f="";return}if($="data",f==="template")if(i)O=Math.max(0,O-1);else O+=1;else if(Pf.has(f)){if(i)Z=Math.max(0,Z-1);else if(!W)Z+=1}f=""},B=(X)=>{switch($){case"data":if(X===60)$="tagOpen";return;case"tagOpen":if(X===33)$="bang",Y=0;else if(X===47)$="endTagOpen";else if(M$(X))$="tagName",i=!1,W=!1,f=String.fromCharCode(R0(X));else if(X===63)$="bogus";else if(X===60)$="tagOpen";else $="data";return;case"endTagOpen":if(M$(X))$="tagName",i=!0,W=!1,f=String.fromCharCode(R0(X));else if(X===62)$="data";else $="bogus";return;case"tagName":if(_$(X)||X===47)$="inTag",W=X===47;else if(X===62)C();else f+=String.fromCharCode(R0(X));return;case"inTag":if(X===62){C();return}if(W=X===47,X===34)$="attrDouble";else if(X===39)$="attrSingle";return;case"attrDouble":if(X===34)$="inTag";W=!1;return;case"attrSingle":if(X===39)$="inTag";W=!1;return;case"bang":if(X===45){if(Y+=1,Y===2)$="comment",Y=0}else if(X===62)$="data";else $="bogus";return;case"bogus":if(X===62)$="data";return;case"comment":if(X===45)Y=Y<2?Y+1:2;else if(X===62&&Y>=2)$="data",Y=0;else Y=0;return;case"rawText":{if(U<z.length){if(R0(X)===z.charCodeAt(U))U+=1;else U=X===60?1:0;return}if(X===62)$="data",f="";else if(_$(X)||X===47)$="inTag",f="";else U=X===60?1:0;return}}};return{scanToInsertionPoint(X){for(let j=0;j<X.length;j++){if(J())return j;B(X[j])}return X.length},write(X){for(let j=0;j<X.length;j++)B(X[j])},isSafe:J}}function i0($){let f=JSON.stringify($);if(f===void 0)return"undefined";return f.replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Rf($){return`<script>(self.__GEMI_STREAM__=self.__GEMI_STREAM__||[]).push(${i0([$.path,$.variantKey,$.data])})</script>`}function hf($){return`<script>(self.__GEMI_DICT__=self.__GEMI_DICT__||[]).push(${i0([$.id,$.locale,$.strings])})</script>`}function _1($,f,i={},z){let U=new TextEncoder,Y=[],W=!1,O=!1,Z=()=>{if(O)return;O=!0,i.onClose?.()};f.onSettle((G)=>{if(G.status!=="resolved")return;Y.push(Rf(G))}),z?.onUse((G)=>{Y.push(hf(G))});let J=$.getReader(),C=H$(),B=(G,N)=>{G.enqueue(N),i.onChunk?.(N)},X=(G)=>{while(Y.length>0){let N=U.encode(Y.shift());C.write(N),B(G,N)}},j=(G,N)=>{if(Y.length===0){C.write(N),B(G,N);return}let D=C.scanToInsertionPoint(N);if(D>0)B(G,N.subarray(0,D));if(C.isSafe())X(G);let H=N.subarray(D);if(H.length>0)C.write(H),B(G,H)};return new ReadableStream({async pull(G){let N;try{N=await J.read()}catch(q){throw Z(),q}let{done:D,value:H}=N;if(D){X(G),G.close(),Z();return}if(!W){if(W=!0,C.write(H),B(G,H),i.onShell?.(),C.isSafe())X(G);return}j(G,H)},cancel(G){return Z(),J.cancel(G)}})}var mf=/bot|crawler|spider|crawling|slurp|bingpreview|mediapartners|headless|lighthouse|prerender|facebookexternalhit|whatsapp|telegram|discord|twitterbot|linkedinbot/i;function h0($){if(!$)return!1;return mf.test($)}async function S$($,f=()=>{}){let i=K.getStore(),z=i?.req??null,U=null;if(z?.rawRequest?.url)try{U=new URL(z.rawRequest.url).pathname}catch{U=null}return{user:i?.user??null,attributes:await pf($,f),request:{path:U,routePath:z?.routePath??null,locale:i?.locale??null},anonymousId:F$(),isBot:h0(z?.rawRequest?.headers?.get("user-agent")??null),now:new Date}}function v$($){return{user:$.user??null,attributes:$.attributes??{},request:{path:null,routePath:null,locale:null},anonymousId:$.subjectId??null,isBot:!1,now:new Date}}async function pf($,f){if(!$.context)return{};try{let i=K.getStore();return await $.context(i?.req??null)??{}}catch(i){return f(`The \`context\` hook in app/config/features.ts threw; evaluating with no attributes. ${i instanceof Error?i.message:String(i)}`),{}}}function b$($,f){return`${$}:${f}`}function M1($){let f=new Bun.CryptoHasher("sha1").update($).digest("hex"),i=Number.parseInt(f.slice(0,8),16);return Math.floor(i/4294967296*1e4)}function k$($,f){if(f>=100)return!0;if(f<=0)return!1;return $<Math.round(f*100)}function P$($,f,i,z){if(z.unavailable)return{value:!1,reason:"unavailable"};if(z.active!==!0)return{value:!1,reason:"inactive"};if(f.when){let Y;try{Y=f.when(i)}catch(W){return z.warn?.(`The \`when\` for feature "${$}" threw; treating it as off. ${W instanceof Error?W.message:String(W)}`),{value:!1,reason:"error"}}if(typeof Y==="boolean")return{value:Y,reason:"attributed"}}if(f.rollout===void 0)return{value:!0,reason:"on"};if(i.isBot)return{value:!1,reason:"bot"};let U=qf($,f,i,z.buckets);return k$(U,f.rollout)?{value:!0,reason:"rollout"}:{value:!1,reason:"excluded"}}function cf($){let f=$.user?.publicId??$.user?.id;if(f!==void 0&&f!==null)return String(f);return $.anonymousId??""}function qf($,f,i,z){let U=b$(f.salt??$,cf(i));if(!z)return M1(U);let Y=z.get(U);if(Y!==void 0)return Y;let W=M1(U);return z.set(U,W),W}class R$ extends Error{cause;kind="FeatureReloadFailed";constructor($){super(`Could not reload feature switches after a write, so the cached switches may still predate it: ${$ instanceof Error?$.message:String($)}`);this.cause=$}}class H1{source;declared;ttlMs;warn;snapshot=null;inflight=null;lastFailureLoggedAt=0;generation=0;lastError=null;retryAfter=0;constructor($,f,i,z=()=>{}){this.source=$;this.declared=f;this.ttlMs=i;this.warn=z}async get(){let $=this.snapshot;if($&&Date.now()-$.loadedAt<this.ttlMs)return $;if($){if(Date.now()>=this.retryAfter)this.refresh().catch(()=>{});return $}return await this.refresh()}refresh(){return this.inflight??=this.load().finally(()=>{this.inflight=null}),this.inflight}async invalidate(){await this.inflight?.catch(()=>{});let $=this.generation,f=await this.refresh();if(this.generation===$)throw new R$(this.lastError);return f}peek(){return this.snapshot}async load(){try{let $=await this.source.load();return this.snapshot={active:this.readSwitches($),loadedAt:Date.now(),unavailable:!1},this.generation++,this.lastError=null,this.retryAfter=0,this.snapshot}catch($){return this.handleFailure($)}}readSwitches($){let f=new Map;for(let i of $??[]){let z=typeof i?.key==="string"?i.key:null;if(!z){this.warn("Ignoring a feature row with no `key`.");continue}if(!(z in this.declared)){this.warn(`Feature row "${z}" is not declared in app/features, so it is ignored. Delete the row, or declare the feature.`);continue}f.set(z,i.active===!0)}return f}handleFailure($){let f=$ instanceof Error?$.message:String($),i=Date.now();if(this.lastError=$,this.retryAfter=i+this.ttlMs,i-this.lastFailureLoggedAt>=this.ttlMs)this.lastFailureLoggedAt=i,this.warn(`Could not load feature switches: ${f}`);if(this.snapshot)return this.snapshot;return this.snapshot={active:new Map,loadedAt:i,unavailable:!0},this.snapshot}}class h${manager;ctx;constructor($,f){this.manager=$;this.ctx=f}async enabled($){return(await this.explain($)).value}async explain($){return await this.manager.evaluateIn($,this.ctx,new Map)}async all(){return await this.manager.evaluateAllIn(this.ctx,new Map,{clientOnly:!1})}}class j0{config;log;static token="features";store;declared;warnedAboutSize=!1;constructor($,f=()=>{}){this.config=$;this.log=f;this.declared=$.features??{},this.store=new H1($.source,this.declared,Math.max(0,$.ttl)*1000,this.log)}declarations(){return this.declared}async list(){let{active:$,unavailable:f}=await this.switches();return{unavailable:f,features:Object.entries(this.declared).map(([i,z])=>({key:i,describe:z.describe,rollout:z.rollout,targeted:z.when!==void 0,serverOnly:z.serverOnly,salt:z.salt,active:$.get(i)}))}}async refresh(){if(!this.config.enabled)return;if(Object.keys(this.declared).length===0)return;await this.store.refresh()}async invalidate(){try{if(this.config.enabled&&Object.keys(this.declared).length>0)await this.store.invalidate()}finally{K.getStore()?.featureEvaluations?.clear()}}async enabled($){return(await this.explain($)).value}async explain($){let f=await this.requestContext();return await this.evaluateIn($,f,this.requestBuckets())}async all(){let $=await this.requestContext();return await this.evaluateAllIn($,this.requestBuckets(),{clientOnly:!1})}async forClient(){if(!this.config.enabled)return{};let $=await this.requestContext(),f=await this.evaluateAllIn($,this.requestBuckets(),{clientOnly:!0});return this.warnIfOversized(Object.keys(f).length),f}for($){return new h$(this,v$($))}async evaluateIn($,f,i){let z=this.memoFor(f),U=z?.get($);if(U)return U;let Y=this.declared[$];if(!Y)return{value:!1,reason:"undeclared"};let{active:W,unavailable:O}=await this.switchFor($),Z=P$($,Y,f,{active:W,unavailable:O,buckets:i,warn:this.log});return z?.set($,Z),this.notify($,Z,f),Z}async evaluateAllIn($,f,i){let z={};for(let[U,Y]of Object.entries(this.declared)){if(i.clientOnly&&Y.serverOnly)continue;z[U]=(await this.evaluateIn(U,$,f)).value}return z}async switches(){if(!this.config.enabled)return{active:new Map,unavailable:!1};if(Object.keys(this.declared).length===0)return{active:new Map,unavailable:!1};let $=await this.store.get();return{active:$.active,unavailable:$.unavailable}}async switchFor($){if(!this.config.enabled)return{active:!1,unavailable:!1};let f=await this.store.get();return{active:f.active.get($),unavailable:f.unavailable}}async requestContext(){let $=K.getStore();if($?.featureContext)return $.featureContext;let f=await S$(this.config,this.log);if($)$.featureContext=f;return f}memoFor($){let f=K.getStore();if(!f||f.featureContext!==$)return null;return f.featureEvaluations??=new Map,f.featureEvaluations}requestBuckets(){let $=K.getStore();if(!$)return new Map;return $.featureBuckets??=new Map,$.featureBuckets}notify($,f,i){if(!this.config.onEvaluate)return;try{this.config.onEvaluate($,f,i)}catch(z){this.log(`The \`onEvaluate\` hook in app/config/features.ts threw for "${$}". ${z instanceof Error?z.message:String(z)}`)}}warnIfOversized($){if(this.warnedAboutSize||$<=this.config.maxClientFlags)return;this.warnedAboutSize=!0,this.log(`${$} client-visible features are embedded in every document. Mark the ones only the server reads with \`serverOnly: true\` to keep them out of the payload.`)}}var yf=new Set(["script","style","template","title"]),df=/\shidden([\s=/]|$)/i,nf=/"[^"]*"|'[^']*'/g;function lf($){let f=0,i=0,z=0,U=0;while(U<$.length){let Y=$.indexOf("<",U),W=Y===-1?$.length:Y;if(W>U){let B=$.slice(U,W).replace(/\s+/g,"").length;if(z>0)i+=B;else f+=B}if(Y===-1)break;if($.startsWith("<!--",Y)){let B=$.indexOf("-->",Y+4);U=B===-1?$.length:B+3;continue}let O=$.indexOf(">",Y);if(O===-1)break;let Z=$.slice(Y+1,O);U=O+1;let J=/^\/?([a-zA-Z][a-zA-Z0-9-]*)/.exec(Z)?.[1]?.toLowerCase();if(!J)continue;let C=Z.startsWith("/");if(!C&&yf.has(J)&&!Z.endsWith("/")){let B=$.indexOf(`</${J}`,U);U=B===-1?$.length:B;continue}if(J!=="div")continue;if(C){if(z>0)z-=1}else if(z>0)z+=1;else if(df.test(Z.replace(nf,'""')))z=1}return{shellChars:f,deferredChars:i}}var uf=1000,sf=64;function of($){return $>=1000?`${($/1000).toFixed(1)} kB`:`${$} chars`}function tf($,f){if(f.deferredChars<uf)return null;if(f.shellChars>=sf)return null;return`[gemi] GET ${$} streams ${of(f.deferredChars)} of its `+`content behind reveal scripts \u2014 a no-JS visitor sees ~${f.shellChars} chars. If this is a public/content route, add "no-stream" to its middleware.`}function m$($=console.warn){let f=new Set;return{shouldObserve(i){return!f.has(i)},report(i,z){if(f.has(i))return;let U=tf(i,z);if(!U)return;f.add(i),$(U)}}}function p$(){let $=new TextDecoder,f="";return{onChunk(i){f+=$.decode(i,{stream:!0})},measure(){return f+=$.decode(),lf(f)}}}function c$($,f,i=1e4,z){let U=new TextEncoder,Y=()=>{};return new ReadableStream({start(W){let O=!1,Z=(C)=>{if(O)return;O=!0,clearTimeout(J);try{W.close()}catch{}z?.({aborted:C})};Y=Z,W.enqueue(U.encode(`${JSON.stringify($)}
|
|
5
|
+
`)),f.onSettle((C)=>{if(O||C.status!=="resolved")return;W.enqueue(U.encode(`${JSON.stringify([C.path,C.variantKey,C.data])}
|
|
6
|
+
`))});let J=setTimeout(()=>Z(!0),i);f.allSettled().then(()=>Z(!1),()=>Z(!1))},cancel(){Y(!1)}})}var af=async()=>(await import("./chunk-wcv6qtpq.js")).default,F1,S1=async(...$)=>{return F1??=import("react-dom/server.browser").catch((f)=>{throw F1=void 0,f}),(await F1).renderToReadableStream(...$)},ef=1e4,$i=`
|
|
7
|
+
!function(){try{var d=document.documentElement,c=d.classList;
|
|
8
|
+
c.remove('light','dark');
|
|
9
|
+
var e=localStorage.getItem('theme');
|
|
10
|
+
if('system'===e||(!e&&'system'===defaultTheme)){
|
|
11
|
+
var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);
|
|
12
|
+
if(m.media!==t||m.matches){d.style.colorScheme='dark';c.add('dark')}
|
|
13
|
+
else{d.style.colorScheme='light';c.add('light')}
|
|
14
|
+
}else if(e){
|
|
15
|
+
c.add(e||'')
|
|
16
|
+
}}catch(e){}}()
|
|
17
|
+
`;async function fi($,f,i){let z=`${i==="italic"?"italic,":""}wght@${i==="italic"?"1,":""}${f}`,W=(await(await fetch(`https://fonts.googleapis.com/css2?family=${$}:${z}&display=swap`,{headers:{"User-Agent":"Mozilla/5.0 Firefox/1.0"}})).text()).match(/url\(([^)]+)\)/)?.[1];return await fetch(W).then((O)=>O.arrayBuffer())}var v1="/assets";function ii($){let f=$.filter((i)=>i===v1||i.startsWith(`${v1}/`));if(f.length>0){let i=f.length>1;throw Error(`View route path${i?"s":""} ${f.map((z)=>`"${z}"`).join(", ")} use${i?"":"s"} the reserved "${v1}" prefix. The client build output is served from there before the router runs, so the route would never match. Mount it somewhere else.`)}}class k1{static token="router.view";flatViewRoutes={};routeManifest={};clientRouteManifest={};componentTree=[];flatComponentTree=[];root=null;shellReporter=m$();preloadCache=new WeakMap;hooks;partialRendering;constructor($){let f=i$();this.partialRendering=$.partialRendering??f.partialRendering,this.hooks={onRequestStart:$.onRequestStart??f.onRequestStart,onRequestEnd:$.onRequestEnd??f.onRequestEnd,onRequestFail:$.onRequestFail??f.onRequestFail,onStreamComplete:$.onStreamComplete??f.onStreamComplete};let i={"/":$.rootRouter,"/auth":r0};this.flatViewRoutes=S0(i),ii(Object.keys(this.flatViewRoutes)),this.routeManifest=k0(i),this.clientRouteManifest=Object.fromEntries(Object.entries(this.routeManifest).filter(([,z])=>z.at(-1)!=="FILE")),this.componentTree=P0(i),this.flatComponentTree=D1(this.componentTree),this.root=$.root}async passesFeatureGates($){let f=L(j0);for(let i of $)if(!await f.enabled(i))return!1;return!0}async onRequestEnd($){return b1(),await this.hooks.onRequestEnd($)}completeStream($,f){let i=(z)=>{L0.error(z?.message??'Error in "onStreamComplete" event handler',{err:JSON.stringify(z)})};try{Promise.resolve(this.hooks.onStreamComplete($,f)).catch(i)}catch(z){i(z)}}modulePreloadLinks($){let{clientEntry:f,modulePreloadManifest:i,views:z,routeKey:U}=$,Y=()=>{let Z=new Set(f?.preload??[]);for(let J of z)for(let C of i?.[J]??[])Z.add(C);return[...Z].map((J)=>K0("link",{key:`modulepreload:${J}`,rel:"modulepreload",href:J}))};if(!i)return Y();let W=this.preloadCache.get(i);if(!W||W.clientEntry!==f)W={clientEntry:f,byRoute:new Map},this.preloadCache.set(i,W);let O=W.byRoute.get(U);if(!O)O=Y(),W.byRoute.set(U,O);return O}async render($){let{req:f,runInRequestScope:i,csrfTokenHMAC:z,currentPathName:U,headers:Y,i18n:W,params:O,pathname:Z,serverQueries:J,userAgent:C,noStream:B,url:X,user:j,viewData:G,breadcrumbs:N,urlLocaleSegment:D,meta:H,isOgRequest:q,appId:x,features:V}=$,w=Z.replace(`/${D}`,""),g={kind:"view",data:{meta:H,pageData:{[w]:G},__csrf:z.toString("base64"),prefetchedData:{},i18n:W,auth:{user:j},routeManifest:this.clientRouteManifest,breadcrumbs:N,router:{urlLocaleSegment:D,pathname:U,params:O,currentPath:Z,searchParams:X.search,is404:!U?!0:!1},appId:x,features:V,componentTree:[["404",[]],...this.componentTree]},head:{}},k=this.root,M=this.routeManifest[U];return async(E)=>{let{bootstrapModules:Q=[],loaders:v,getStyles:a,viewImportMap:l,cssManifest:z0,ogMap:e,viewModules:P,clientEntry:U0,modulePreloadManifest:D0}=E,u=U0?[]:Q,O0=(p)=>[p,`window.loaders=${v}`,...U0?[`import(${JSON.stringify(U0.module)}).catch(function(e){setTimeout(function(){throw e})})`]:[]].join(";");if(q){let p=null,W0=null;for(let Y0 of M??[])if(typeof e[Y0]==="function")W0=Y0,p=e[Y0];if(!p)return new Response("Not found",{status:404});let Of=Object.values(g.data.pageData)[0];try{await S1(K0(p,Of[W0]),{onError:()=>{}})}catch(Y0){let{fonts:Wf,...Yf}=Y0.satoriOptions,Zf=await Promise.all(Wf.map((_0)=>{return fi(_0.name,_0.weight,_0.style).then((If)=>({..._0,data:If}))})),p1=new Headers(Y);p1.set("Content-Type","image/png");let[Jf,Xf]=await Promise.all([af(),J0("Rendering an OG image")]),Cf=await Jf(Y0.jsx,{...Yf,fonts:Zf}),Bf=await Xf(Buffer.from(Cf)).png({compressionLevel:0,effort:10}).toBuffer();return new Response(new Uint8Array(Bf),{headers:p1})}return new Response("data")}g.data.cssManifest=z0,g.data.modulePreloadManifest=D0??{};let g0=this.modulePreloadLinks({clientEntry:U0,modulePreloadManifest:D0,views:M??["404"],routeKey:U??"404"}),q0=await a(M);g.data.prefetchedData=J.snapshotResolved(),J.markRenderStart();let A=new AbortController,m=setTimeout(()=>A.abort(),ef),s=h0(C)||B,y0=Bun.env.NODE_ENV!=="production"&&!s&&U&&this.shellReporter.shouldObserve(U)?p$():null,m1=d$();try{let p=await S1(K0(rf,{children:[...g0,...q0,K0("script",{key:"theme-script",dangerouslySetInnerHTML:{__html:$i}}),K0(k,{data:g.data,viewImportMap:l,viewModules:P,serverQueries:J,dictionarySink:m1,key:"root"})]}),{bootstrapScriptContent:O0(`window.__GEMI_DATA__ = ${i0(g.data)}`),bootstrapModules:u,signal:A.signal,...s?{progressiveChunkSize:Number.MAX_SAFE_INTEGER}:{},onError(W0){if(Bun.env.NODE_ENV!=="production")console.error(W0)}});if(p.allReady.catch(()=>{}).finally(()=>clearTimeout(m)),s)await p.allReady.catch(()=>{});return new Response(_1(p,J,{onShell:s?void 0:()=>J.markShell(),onChunk:y0?.onChunk,onClose:()=>i(()=>{if(this.completeStream(f,J.summarize(A.signal.aborted)),y0)this.shellReporter.report(U,y0.measure())})},m1),{status:!U?404:200,headers:Y})}catch(p){clearTimeout(m);let W0=await S1(K0("div"),{bootstrapScriptContent:O0(`window.error= ${i0(p.message)}; window.stack_trace=${i0(p.stack)};window.__GEMI_DATA__ = ${i0(g.data)}`),bootstrapModules:Bun.env.NODE_ENV==="development"?["/render-error.js",...u]:u});return new Response(_1(W0,J,{onClose:()=>i(()=>this.completeStream(f,J.summarize(A.signal.aborted)))}),{status:!U?404:200,headers:Y})}}}async handleViewRequest($){let f=new URL($.url),i=f.pathname.endsWith(".json"),z=f.pathname.endsWith(".og"),U=f.pathname.replace(".json","").replace(".og",""),[,Y,...W]=U.split("/"),O=`/${W.join("/")}`,Z=null,J=null,C=L(b);if(!C.supportedLocales.includes(Y))O=U;else Z=Y,J=Y;if(C.isLocaleAware&&!z){let V=L(b).detectLocale(new T($,{},"view",O));if(J===null&&V!==C.defaultLocale){let w=f.pathname==="/"?"":f.pathname;return new Response("",{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:`/${V}${w}${f.search}`}})}}O=O.replace("//","/");let X=[],j=[],G=null,N={},D=null,H=!1,q=[];try{let V=b0(this.flatViewRoutes,O);if(V){if(G=V.routePath,N=V.params,X=V.route.exec,j=V.route.middleware,q=V.route.features,H=j.includes("no-stream"),i&&this.partialRendering){let w=$.headers.get(x1),g=g$({flatViewRoutes:this.flatViewRoutes,supportedLocales:L(b).supportedLocales,from:w,origin:f.origin,to:{segments:V.route.segments,params:N,search:f.search}});if(g.startIndex>0)X=X.slice(g.startIndex),D={from:w,carriedViews:g.carriedViews}}}}catch(V){throw V}let x=new T($,N,"view",G);return this.hooks.onRequestStart(x),await K.run(x,async()=>{let V=null,w=K.getStore(),g=V0.getStore(),k=(Q)=>V0.run(g,()=>K.runWith(w,Q));w.serverQueries=new C0(E0($));let M=new Set;if(w.serverQueries.onQueryFail((Q)=>{M.add(Q.error);try{k(()=>Promise.resolve(this.hooks.onRequestFail(E,Q.error)).catch(()=>{}))}catch{}}),J){let Q=J.replaceAll("/","");Z0.setLocale(Q)}else Z0.setLocale();let E=w.req;b1();try{if(await L(Q0).runMiddleware(j),q.length>0&&!await this.passesFeatureGates(q))G=null,X=[],E.routePath="";let Q=L(b),v=Q.isEnabled,a=Q.isLocaleAware,l={};if(a){let A=null;if(J)A=J.replaceAll("/",""),w.setLocale(A);else A=Q.detectLocale(new T($,E.params)),w.setLocale(A);let m=v?Q.getPageTranslations(A,E.routePath):{};l={supportedLocales:Q.supportedLocales,currentLocale:A,dictionary:{[A]:m},defaultLocale:Q.defaultLocale}}await y$(l.currentLocale??"");let z0=await Promise.all(X.map((A)=>A(E))),e=w.cookies,P=w.headers;V={data:z0,cookies:e,headers:P,user:w.user,prefetchedData:w.serverQueries.snapshotResolved(),currentPathName:G,params:E.params,urlLocaleSegment:Z,meta:w.renderMeta(),appId:L(g1).id,features:await L(j0).forClient()};let{params:U0,user:D0}=V,u={},O0={};for(let A of z0??[]){let[m,s]=Object.entries(A)?.[0]??[];if(!m||!s)continue;O0[`${m}:${G}`]=s.breadcrumb,u[m]=s}let g0=u.FILE;if(g0){for(let A of e)P.append("Set-Cookie",A.toString());try{await this.onRequestEnd(E)}catch(A){L0.error(A?.message??'Error in "onRequestEnd" event handler',{err:JSON.stringify(A)})}return await q$(g0,P)}if(i){P.set("Content-Type","application/x-ndjson; charset=utf-8"),P.append("Vary",x1),e.forEach((m)=>P.append("Set-Cookie",m.toString())),await this.hooks.onRequestEnd(E);let A={meta:D&&!w.metadata.touched?null:V.meta,data:{[O]:u},breadcrumbs:O0,prefetchedData:w.serverQueries.snapshotResolved(),i18n:l,features:V.features,is404:!G,appId:V.appId,partial:D};return new Response(c$(A,w.serverQueries,void 0,({aborted:m})=>k(()=>this.completeStream(E,w.serverQueries.summarize(m)))),{headers:P})}if(P.set("Content-Type","text/html; charset=utf-8"),!H)P.append("Vary","User-Agent");for(let A of e)P.append("Set-Cookie",A.toString());let q0=Bun.CSRF.generate(process.env.SECRET);P.append("Set-Cookie",`csrf_token=${q0}; HttpOnly; Secure; SameSite=Strict; Expires=${new Date(Date.now()+86400000).toUTCString()}`);try{await this.onRequestEnd(E)}catch(A){L0.error(A?.message??'Error in "onRequestEnd" event handler',{err:JSON.stringify(A)})}return await this.render({req:E,runInRequestScope:k,csrfTokenHMAC:Buffer.from(""),currentPathName:G,headers:P,i18n:l,params:U0,pathname:f.pathname,serverQueries:w.serverQueries,userAgent:$.headers.get("user-agent"),noStream:H,url:f,user:D0,viewData:u,breadcrumbs:O0,urlLocaleSegment:Z,meta:V.meta,appId:V.appId,features:V.features,isOgRequest:z})}catch(Q){if(Q.kind===A0)if(i){let{status:v=400,data:a,directive:l,headers:z0}=Q.payload.api;return new Response(JSON.stringify({data:a,directive:l}),{headers:z0,status:v})}else{let{status:v=400,error:a}=Q.payload.view;return new Response(a?.message,{...Q.payload.view,status:v})}if(!M.has(Q))this.hooks.onRequestFail(E,Q);throw Q}})}}class n$ extends y{routes={"/api-routes":this.get(()=>{let $=L(m0).flatRoutes,f=[];for(let[i,z]of Object.entries($))for(let[U,Y]of Object.entries(z)){let{exec:W,middleware:O}=Y;f.push({path:i,method:U,middleware:O})}return f}),"/view-routes":this.get(()=>{let $=L(k1).flatViewRoutes,f=[];for(let[i,{middleware:z,viewPath:U}]of Object.entries($))f.push({path:i,method:"GET",viewPath:U,middleware:z});return f})}}class m0{static token="router.api";flatRoutes={};onRequestStart;onRequestEnd;onRequestFail;constructor($){let f=f$();this.onRequestStart=$.onRequestStart??f.onRequestStart,this.onRequestEnd=$.onRequestEnd??f.onRequestEnd,this.onRequestFail=$.onRequestFail??f.onRequestFail,this.flatRoutes=Y1({"/":$.rootRouter,"/auth":a0,"/__gemi__/services/i18n":e0,"/__gemi__/services/logs":W1,"/__gemi__/services/image":i1,"/__gemi__/debug":n$})}getRouteHandlerAndParams($){let i=new URL($.url).pathname.replace("/api",""),z={},U;for(let[Y]of Object.entries(this.flatRoutes))try{let W=new URLPattern({pathname:Y});if(W.test({pathname:i})){U=Y,z=W.exec({pathname:i})?.pathname.groups;break}}catch(W){console.error(W)}return{params:z,path:U}}async runRouteMiddleware($,f){let z=this.flatRoutes[$][f.rawRequest.method].middleware;try{await L(Q0).runMiddleware(z)}catch(U){if(U.kind===A0){if(f.rawRequest.url.includes("/api")){let{status:Y=400,data:W,headers:O}=U.payload.api;return new Response(JSON.stringify(W),{status:Y,headers:{"Content-Type":"application/json",...O}})}}else throw this.onRequestFail(f,U),console.error(U),U}}async getRouteData($){let f=this.flatRoutes[$],i=K.getStore(),z=f[i.req.rawRequest.method].exec??(()=>Promise.resolve({})),U={};try{U=await z()}catch(Y){if(Y.kind===A0){let{status:W=400,data:O,headers:Z}=Y.payload.api;return new Response(JSON.stringify(O),{status:W,headers:{"Content-Type":"application/json",...Z}})}throw this.onRequestFail(i.req,Y),console.error(Y),Y}return U}mergeContextIntoResponse($,f,i){let z=[];f?.forEach((W,O)=>z.push([O,W]));let U=[...typeof f?.getSetCookie==="function"?f.getSetCookie():[],...Array.from(i??[])];if(z.length===0&&U.length===0)return $;let Y=(W)=>{for(let[O,Z]of z){if(O.toLowerCase()==="set-cookie")continue;if(!W.has(O))W.set(O,Z)}for(let O of U)W.append("Set-Cookie",O)};try{return Y($.headers),$}catch{let W=new Headers($.headers);return Y(W),new Response($.body,{status:$.status,statusText:$.statusText,headers:W})}}async handleApiRequest($){let{params:f,path:i}=this.getRouteHandlerAndParams($),z=this.flatRoutes[i];if(!z||!z[$.method])return new Response(JSON.stringify({error:{message:"Not found"}}),{status:404});let U=new T($,f,"api",i);if(!$.url.includes("/__gemi__"))this.onRequestStart(U);return await K.run(U,async()=>{let Y=K.getStore(),W=L(b);if(W.isEnabled){let B=W.detectLocale(U);Y.setLocale(B)}Y.setRequest(U);let O=await this.runRouteMiddleware(i,U);if(O instanceof Response)return O;let Z=await this.getRouteData(i),J=Y.headers,C=Y.cookies;if(Z instanceof Response){let B=this.mergeContextIntoResponse(Z,J,C);if(!$.url.includes("/__gemi__"))this.onRequestEnd(U);return Y.destroy(),B}if(J.set("Content-Type","application/json"),C.forEach((B)=>J.append("Set-Cookie",B.toString())),!$.url.includes("/__gemi__"))this.onRequestEnd(U);return Y.destroy(),new Response(JSON.stringify(Z),{headers:J})})}}function E0($){let f=V0.getStore();return(i,z,U)=>{let Y=new URL($.url).origin,W=[R(i,z),U.toString()].filter((J)=>J.length>0).join("?"),O=new Request(`${Y}/${W}`,{headers:$.headers}),Z=new T(O,z);return V0.run(f,()=>K.run(Z,async()=>{try{let J=await L(m0).getRouteData(i);if(J instanceof Response){let C=await J.json().catch(()=>null);if(!J.ok)throw new w0(R(i,z),U.toString(),J.status,C);return C}return J}catch(J){if(J instanceof w0)throw J;let C=new w0(R(i,z),U.toString(),500,{message:J instanceof Error?J.message:String(J)});throw C.cause=J,C}}))}}class p0{static ensure($,f={}){let i=K.getStore();if(i.req.kind==="api")throw Error("Query.prefetch() cannot be called from an API request");return i.serverQueries??=new C0(E0(i.req.rawRequest)),i.serverQueries.ensure($,f,"prefetch")}static async instant($,...f){let i=p0.ensure($,f[0]);if(await i.promise,i.status==="rejected")throw i.error;return i.data}static prefetch($,...f){p0.ensure($,f[0])}static noPrefetch(){let $=K.getStore();if($.req.kind==="api")throw Error("Query.noPrefetch() cannot be called from an API request");$.serverQueries??=new C0(E0($.req.rawRequest)),$.serverQueries.muteDiscoveryHints()}}class l${static absolute($,...f){return`${process.env.HOST_NAME}${R(String($),f[0]??{})}`}static relative($,...f){return R(String($),f[0]??{})}}class u${name="Meta";static description($){K.getStore().metadata.description($)}static title($){K.getStore().metadata.title($)}static openGraph($){K.getStore().metadata.openGraph($)}}var zi={set($,f,i){K.getStore().setCookie($,f,i)},setIfAbsent($,f,i){if(K.getStore().req.cookies.has($))return!1;return K.getStore().setCookie($,f,i),!0},delete($){K.getStore().deleteCookie($)}};class P1{config;static token="redis";instance=null;constructor($={}){this.config=$}get client(){return this.instance??=new(Ui())(this.config.url,this.config.options)}set client($){this.instance=$}}function Ui(){let $=globalThis.Bun?.RedisClient;if(typeof $!=="function")throw Error("Redis requires Bun's built-in Redis client, which this runtime does not provide. Run the app under Bun, or bind your own client for the 'redis' token.");return $}class n extends _{static getFacadeAccessor(){return P1}static get client(){return this.getFacadeRoot().client}static get($){return n.client.get($)}static set($,f){return n.client.set($,f)}static del(...$){return n.client.del(...$)}static exists($){return n.client.exists($)}static incr($){return n.client.incr($)}static expire($,f){return n.client.expire($,f)}static ttl($){return n.client.ttl($)}}class o$ extends _{static getFacadeAccessor(){return s$}static consume($,f={}){return this.getFacadeRoot().consume($,f)}}class t$ extends _{static getFacadeAccessor(){return j0}static enabled($){return this.getFacadeRoot().enabled($)}static all(){return this.getFacadeRoot().forClient()}static explain($){return this.getFacadeRoot().explain($)}static for($){return this.getFacadeRoot().for($)}static list(){return this.getFacadeRoot().list()}static refresh(){return this.getFacadeRoot().refresh()}static invalidate(){return this.getFacadeRoot().invalidate()}}class c0{bound;constructor($){this.bound=$}get name(){return this.bound??R1()}get sql(){return this.connection().sql}get dialect(){return this.connection().dialect}async query($){return await this.run($,"query")}async execute($){let f=await this.run($,"execute");return Number(f?.count??0)}async transaction($){let f=this.name,i=this.connection(f);return $f(i.sql,(z)=>a$(f,()=>$(z)),{slowTransactionThreshold:i.config.slowTransactionThreshold,connection:f})}run($,f){let i=this.connection(),{text:z,values:U}=zf($,ff(i.dialect),f);return(this.handle()??i.sql).unsafe(z,U)}handle(){let $=r$();if($===void 0)return;return R1()===this.name?$:void 0}connection($=this.name){return e$($),L(h1).connection($)}}var x0=new c0;class Uf extends _{static getFacadeAccessor(){return h1}static connection($){return new c0($)}static get sql(){return x0.sql}static get dialect(){return x0.dialect}static query($){return x0.query($)}static execute($){return x0.execute($)}static transaction($){return x0.transaction($)}static close(){return this.getFacadeRoot().close()}}export{_ as Vb,d0 as Wb,M0 as Xb,o as Yb,Z0 as Zb,l0 as _b,u0 as $b,Si as ac,d1 as bc,s0 as cc,n1 as dc,$1 as ec,f1 as fc,j3 as gc,a1 as hc,e1 as ic,N0 as jc,Q0 as kc,b3 as lc,f$ as mc,i$ as nc,E1 as oc,L0 as pc,g1 as qc,b$ as rc,M1 as sc,k$ as tc,P$ as uc,cf as vc,R$ as wc,H1 as xc,h$ as yc,j0 as zc,v1 as Ac,k1 as Bc,m0 as Cc,p0 as Dc,l$ as Ec,u$ as Fc,zi as Gc,P1 as Hc,n as Ic,o$ as Jc,t$ as Kc,c0 as Lc,Uf as Mc};
|
|
18
|
+
|
|
19
|
+
//# debugId=9D65AD60960AC20664756E2164756E21
|