UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 19.3 kB
import{t as e}from"./chunk-BHKSVoKr.js";var t=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{CITY_HEADER_NAME:()=>u,COUNTRY_HEADER_NAME:()=>d,EMOJI_FLAG_UNICODE_STARTING_POSITION:()=>v,IP_HEADER_NAME:()=>f,LATITUDE_HEADER_NAME:()=>p,LONGITUDE_HEADER_NAME:()=>m,POSTAL_CODE_HEADER_NAME:()=>g,REGION_HEADER_NAME:()=>h,REQUEST_ID_HEADER_NAME:()=>_,geolocation:()=>w,ipAddress:()=>S}),t.exports=c(l);let u=`x-vercel-ip-city`,d=`x-vercel-ip-country`,f=`x-real-ip`,p=`x-vercel-ip-latitude`,m=`x-vercel-ip-longitude`,h=`x-vercel-ip-country-region`,g=`x-vercel-ip-postal-code`,_=`x-vercel-id`,v=127397;function y(e,t){return e.get(t)??void 0}function b(e,t){let n=y(e.headers,t);return n?decodeURIComponent(n):void 0}function x(e){let t=RegExp(`^[A-Z]{2}$`).test(e);if(!(!e||!t))return String.fromCodePoint(...e.split(``).map(e=>v+e.charCodeAt(0)))}function S(e){return y(`headers`in e?e.headers:e,f)}function C(e){return e?e.split(`:`)[0]:`dev1`}function w(e){return{city:b(e,u),country:y(e.headers,d),flag:x(y(e.headers,d)),countryRegion:y(e.headers,h),region:C(y(e.headers,_)),latitude:y(e.headers,p),longitude:y(e.headers,m),postalCode:y(e.headers,g)}}0&&(t.exports={CITY_HEADER_NAME:u,COUNTRY_HEADER_NAME:d,EMOJI_FLAG_UNICODE_STARTING_POSITION:v,IP_HEADER_NAME:f,LATITUDE_HEADER_NAME:p,LONGITUDE_HEADER_NAME:m,POSTAL_CODE_HEADER_NAME:g,REGION_HEADER_NAME:h,REQUEST_ID_HEADER_NAME:_,geolocation:w,ipAddress:S})})),n=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getEnv:()=>u}),t.exports=c(l);let u=(e=process.env)=>({VERCEL:d(e,`VERCEL`),CI:d(e,`CI`),VERCEL_ENV:d(e,`VERCEL_ENV`),VERCEL_URL:d(e,`VERCEL_URL`),VERCEL_BRANCH_URL:d(e,`VERCEL_BRANCH_URL`),VERCEL_PROJECT_PRODUCTION_URL:d(e,`VERCEL_PROJECT_PRODUCTION_URL`),VERCEL_REGION:d(e,`VERCEL_REGION`),VERCEL_DEPLOYMENT_ID:d(e,`VERCEL_DEPLOYMENT_ID`),VERCEL_SKEW_PROTECTION_ENABLED:d(e,`VERCEL_SKEW_PROTECTION_ENABLED`),VERCEL_AUTOMATION_BYPASS_SECRET:d(e,`VERCEL_AUTOMATION_BYPASS_SECRET`),VERCEL_GIT_PROVIDER:d(e,`VERCEL_GIT_PROVIDER`),VERCEL_GIT_REPO_SLUG:d(e,`VERCEL_GIT_REPO_SLUG`),VERCEL_GIT_REPO_OWNER:d(e,`VERCEL_GIT_REPO_OWNER`),VERCEL_GIT_REPO_ID:d(e,`VERCEL_GIT_REPO_ID`),VERCEL_GIT_COMMIT_REF:d(e,`VERCEL_GIT_COMMIT_REF`),VERCEL_GIT_COMMIT_SHA:d(e,`VERCEL_GIT_COMMIT_SHA`),VERCEL_GIT_COMMIT_MESSAGE:d(e,`VERCEL_GIT_COMMIT_MESSAGE`),VERCEL_GIT_COMMIT_AUTHOR_LOGIN:d(e,`VERCEL_GIT_COMMIT_AUTHOR_LOGIN`),VERCEL_GIT_COMMIT_AUTHOR_NAME:d(e,`VERCEL_GIT_COMMIT_AUTHOR_NAME`),VERCEL_GIT_PREVIOUS_SHA:d(e,`VERCEL_GIT_PREVIOUS_SHA`),VERCEL_GIT_PULL_REQUEST_ID:d(e,`VERCEL_GIT_PULL_REQUEST_ID`)}),d=(e,t)=>{let n=e[t];return n===``?void 0:n};0&&(t.exports={getEnv:u})})),r=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),i=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{waitUntil:()=>f}),t.exports=l(u);var d=r();let f=e=>{if(typeof e!=`object`||!e||typeof e.then!=`function`)throw TypeError(`waitUntil can only be called with a Promise, got ${typeof e}`);return(0,d.getContext)().waitUntil?.(e)};0&&(t.exports={waitUntil:f})})),a=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{next:()=>f,rewrite:()=>d}),t.exports=c(l);function u(e,t){if(e?.request?.headers){if(!(e.request.headers instanceof Headers))throw Error(`request.headers must be an instance of Headers`);let n=[];for(let[r,i]of e.request.headers)t.set(`x-middleware-request-`+r,i),n.push(r);t.set(`x-middleware-override-headers`,n.join(`,`))}}function d(e,t){let n=new Headers(t?.headers??{});return n.set(`x-middleware-rewrite`,String(e)),u(t,n),new Response(null,{...t,headers:n})}function f(e){let t=new Headers(e?.headers??{});return t.set(`x-middleware-next`,`1`),u(e,t),new Response(null,{...e,headers:t})}0&&(t.exports={next:f,rewrite:d})})),o=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{InMemoryCache:()=>u}),t.exports=c(l);var u=class{constructor(){this.cache={}}async get(e){let t=this.cache[e];return t?t.ttl&&t.lastModified+t.ttl*1e3<Date.now()?(await this.delete(e),null):JSON.parse(t.value):null}async set(e,t,n){let r=JSON.stringify(t??null);this.cache[e]={value:r,lastModified:Date.now(),ttl:n?.ttl,tags:new Set(n?.tags||[])}}async delete(e){delete this.cache[e]}async expireTag(e){let t=Array.isArray(e)?e:[e];for(let e in this.cache)if(Object.prototype.hasOwnProperty.call(this.cache,e)){let n=this.cache[e];t.some(e=>n.tags.has(e))&&delete this.cache[e]}}};0&&(t.exports={InMemoryCache:u})})),s=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},l=e=>s(n({},`__esModule`,{value:!0}),e),u={};o(u,{BuildCache:()=>f}),t.exports=l(u);var d=c(),f=class{constructor({endpoint:e,headers:t,onError:n,timeout:r=500}){this.get=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{let r=await fetch(`${this.endpoint}${e}`,{headers:this.headers,method:`GET`,signal:t.signal});if(r.status===404)return clearTimeout(n),null;if(r.status===200){if(r.headers.get(d.HEADERS_VERCEL_CACHE_STATE)!==d.PkgCacheState.Fresh)return r.body?.cancel?.(),clearTimeout(n),null;let e=await r.json();return clearTimeout(n),e}else throw clearTimeout(n),Error(`Failed to get cache: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e);return null}},this.set=async(e,t,n)=>{let r=new AbortController,i=setTimeout(()=>r.abort(),this.timeout);try{let a={};n?.ttl&&(a[d.HEADERS_VERCEL_REVALIDATE]=n.ttl.toString()),n?.tags&&n.tags.length>0&&(a[d.HEADERS_VERCEL_CACHE_TAGS]=n.tags.join(`,`)),n?.name&&(a[d.HEADERS_VERCEL_CACHE_ITEM_NAME]=n.name);let o=await fetch(`${this.endpoint}${e}`,{method:`POST`,headers:{...this.headers,...a},body:JSON.stringify(t),signal:r.signal});if(clearTimeout(i),o.status!==200)throw Error(`Failed to set cache: ${o.status} ${o.statusText}`)}catch(e){if(clearTimeout(i),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.delete=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{let r=await fetch(`${this.endpoint}${e}`,{method:`DELETE`,headers:this.headers,signal:t.signal});if(clearTimeout(n),r.status!==200)throw Error(`Failed to delete cache: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.expireTag=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{Array.isArray(e)&&(e=e.join(`,`));let r=await fetch(`${this.endpoint}revalidate?tags=${e}`,{method:`POST`,headers:this.headers,signal:t.signal});if(clearTimeout(n),r.status!==200)throw Error(`Failed to revalidate tag: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.endpoint=e,this.headers=t,this.onError=n,this.timeout=r}};0&&(t.exports={BuildCache:f})})),c=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},u=(e,t,r,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of a(t))!c.call(e,s)&&s!==r&&n(e,s,{get:()=>t[s],enumerable:!(o=i(t,s))||o.enumerable});return e},d=e=>u(n({},`__esModule`,{value:!0}),e),f={};l(f,{HEADERS_VERCEL_CACHE_ITEM_NAME:()=>O,HEADERS_VERCEL_CACHE_STATE:()=>T,HEADERS_VERCEL_CACHE_TAGS:()=>D,HEADERS_VERCEL_REVALIDATE:()=>E,PkgCacheState:()=>w,getCache:()=>y}),t.exports=d(f);var p=r(),m=o(),h=s();let g=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)},_=null,v=null,y=e=>x(()=>{let e;return e=(0,p.getContext)().cache?(0,p.getContext)().cache:C(process.env.SUSPENSE_CACHE_DEBUG===`true`),e},b(e));function b(e){let t=e?.keyHashFunction||g;return n=>{if(!e?.namespace)return t(n);let r=e.namespaceSeparator||`$`;return`${e.namespace}${r}${t(n)}`}}function x(e,t){return{get:n=>e().get(t(n)),set:(n,r,i)=>e().set(t(n),r,{...i,name:i?.name??n}),delete:n=>e().delete(t(n)),expireTag:t=>e().expireTag(t)}}let S=!1;function C(e){if(_||=new m.InMemoryCache,process.env.RUNTIME_CACHE_DISABLE_BUILD_CACHE===`true`)return e&&console.log(`Using InMemoryCache as build cache is disabled`),_;let{RUNTIME_CACHE_ENDPOINT:t,RUNTIME_CACHE_HEADERS:n}=process.env;if(e&&console.log(`Runtime cache environment variables:`,{RUNTIME_CACHE_ENDPOINT:t,RUNTIME_CACHE_HEADERS:n}),!t||!n)return S||=(console.warn(`Runtime Cache unavailable in this environment. Falling back to in-memory cache.`),!0),_;if(!v){let e={};try{e=JSON.parse(n)}catch(e){return console.error(`Failed to parse RUNTIME_CACHE_HEADERS:`,e),_}let r=500;if(process.env.RUNTIME_CACHE_TIMEOUT){let e=parseInt(process.env.RUNTIME_CACHE_TIMEOUT,10);!isNaN(e)&&e>0?r=e:console.warn(`Invalid RUNTIME_CACHE_TIMEOUT value: "${process.env.RUNTIME_CACHE_TIMEOUT}". Using default: ${r}ms`)}v=new h.BuildCache({endpoint:t,headers:e,onError:e=>console.error(e),timeout:r})}return v}var w=(e=>(e.Fresh=`fresh`,e.Stale=`stale`,e.Expired=`expired`,e.NotFound=`notFound`,e.Error=`error`,e))(w||{});let T=`x-vercel-cache-state`,E=`x-vercel-revalidate`,D=`x-vercel-cache-tags`,O=`x-vercel-cache-item-name`;0&&(t.exports={HEADERS_VERCEL_CACHE_ITEM_NAME:O,HEADERS_VERCEL_CACHE_STATE:T,HEADERS_VERCEL_CACHE_TAGS:D,HEADERS_VERCEL_REVALIDATE:E,PkgCacheState:w,getCache:y})})),l=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{attachDatabasePool:()=>v,experimental_attachDatabasePool:()=>y}),t.exports=l(u);var d=r();let f=!!process.env.DEBUG;function p(e){if(`options`in e&&e.options){if(`idleTimeoutMillis`in e.options)return typeof e.options.idleTimeoutMillis==`number`?e.options.idleTimeoutMillis:1e4;if(`maxIdleTimeMS`in e.options)return typeof e.options.maxIdleTimeMS==`number`?e.options.maxIdleTimeMS:0;if(`status`in e)return 5e3;if(`connect`in e&&`execute`in e)return 3e4}if(`config`in e&&e.config){if(`connectionConfig`in e.config&&e.config.connectionConfig)return e.config.connectionConfig.idleTimeout||6e4;if(`idleTimeout`in e.config)return typeof e.config.idleTimeout==`number`?e.config.idleTimeout:6e4}return`poolTimeout`in e?typeof e.poolTimeout==`number`?e.poolTimeout:6e4:`idleTimeout`in e?typeof e.idleTimeout==`number`?e.idleTimeout:0:1e4}let m=null,h=()=>{},g=Date.now();function _(e){if(!process.env.VERCEL_URL||!process.env.VERCEL_REGION)return;m&&(clearTimeout(m),h());let t=new Promise(e=>{h=e}),n=Math.min(p(e)+100,Math.max(100,899e3-(Date.now()-g)));m=setTimeout(()=>{h?.(),f&&console.log(`Database pool idle timeout reached. Releasing connections.`)},n);let r=(0,d.getContext)();r?.waitUntil?r.waitUntil(t):console.warn(`Pool release event triggered outside of request scope.`)}function v(e){if(m&&(h?.(),clearTimeout(m)),`on`in e&&e.on&&`options`in e&&`idleTimeoutMillis`in e.options){e.on(`release`,()=>{f&&console.log(`Client released from pool`),_(e)});return}else if(`on`in e&&e.on&&`config`in e&&e.config&&`connectionConfig`in e.config){e.on(`release`,()=>{f&&console.log(`MySQL client released from pool`),_(e)});return}else if(`on`in e&&e.on&&`config`in e&&e.config&&`idleTimeout`in e.config){e.on(`release`,()=>{f&&console.log(`MySQL2/MariaDB client released from pool`),_(e)});return}if(`on`in e&&e.on&&`options`in e&&e.options&&`maxIdleTimeMS`in e.options){e.on(`connectionCheckedOut`,()=>{f&&console.log(`MongoDB connection checked out`),_(e)});return}if(`on`in e&&e.on&&`options`in e&&e.options&&`socket`in e.options){e.on(`end`,()=>{f&&console.log(`Redis connection ended`),_(e)});return}throw Error(`Unsupported database pool type`)}let y=v;0&&(t.exports={attachDatabasePool:v,experimental_attachDatabasePool:y})})),u=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{dangerouslyDeleteBySrcImage:()=>h,dangerouslyDeleteByTag:()=>p,invalidateBySrcImage:()=>m,invalidateByTag:()=>f}),t.exports=l(u);var d=r();let f=e=>{let t=(0,d.getContext)().purge;return t?t.invalidateByTag(e):Promise.resolve()},p=(e,t)=>{let n=(0,d.getContext)().purge;return n?n.dangerouslyDeleteByTag(e,t):Promise.resolve()},m=e=>{let t=(0,d.getContext)().purge;return t?t.invalidateBySrcImage(e):Promise.resolve()},h=(e,t)=>{let n=(0,d.getContext)().purge;return n?n.dangerouslyDeleteBySrcImage(e,t):Promise.resolve()};0&&(t.exports={dangerouslyDeleteBySrcImage:h,dangerouslyDeleteByTag:p,invalidateBySrcImage:m,invalidateByTag:f})})),d=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{addCacheTag:()=>f}),t.exports=l(u);var d=r();let f=e=>{let t=(0,d.getContext)().addCacheTag;return t?t(e):Promise.resolve()};0&&(t.exports={addCacheTag:f})})),f=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{experimental_upgradeWebSocket:()=>p}),t.exports=l(u);var d=r();async function f(){try{return(await import(`./wrapper-CQmdlFyy.js`)).WebSocketServer}catch{throw Error(`The "ws" package is required for experimental_upgradeWebSocket(). Install it with: npm install ws`)}}async function p(e){let t=(0,d.getContext)();if(typeof t.upgradeWebSocket!=`function`)throw Error(`experimental_upgradeWebSocket is not available in the current runtime environment. This feature requires a Vercel runtime that supports WebSocket upgrades.`);let n=await f(),{req:r,socket:i,head:a}=t.upgradeWebSocket(),o=new n({noServer:!0}),s=await new Promise((e,t)=>{let n=()=>{i.removeListener(`error`,l),i.removeListener(`close`,u)},s=e=>{if(n(),e instanceof Error){t(e);return}let r=Error(`WebSocket upgrade failed`);r.cause=e,t(r)},c=t=>{n(),e(t)},l=e=>s(e),u=()=>s(Error(`socket closed before the WebSocket upgrade completed`));i.once(`error`,l),i.once(`close`,u);try{o.handleUpgrade(r,i,a,c)}catch(e){s(e)}});try{await e(s)}catch(e){throw s.close(1011,`WebSocket handler failed`),e}return new Response(null,{status:204})}0&&(t.exports={experimental_upgradeWebSocket:p})})),p=e(((e,r)=>{var o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,m=Object.prototype.hasOwnProperty,h=(e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})},g=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of p(t))!m.call(e,i)&&i!==n&&o(e,i,{get:()=>t[i],enumerable:!(r=s(t,i))||r.enumerable});return e},_=e=>g(o({},`__esModule`,{value:!0}),e),v={};h(v,{addCacheTag:()=>E.addCacheTag,attachDatabasePool:()=>w.attachDatabasePool,dangerouslyDeleteBySrcImage:()=>T.dangerouslyDeleteBySrcImage,dangerouslyDeleteByTag:()=>T.dangerouslyDeleteByTag,experimental_attachDatabasePool:()=>w.experimental_attachDatabasePool,experimental_upgradeWebSocket:()=>D.experimental_upgradeWebSocket,geolocation:()=>y.geolocation,getCache:()=>C.getCache,getEnv:()=>b.getEnv,invalidateBySrcImage:()=>T.invalidateBySrcImage,invalidateByTag:()=>T.invalidateByTag,ipAddress:()=>y.ipAddress,next:()=>S.next,rewrite:()=>S.rewrite,waitUntil:()=>x.waitUntil}),r.exports=_(v);var y=t(),b=n(),x=i(),S=a(),C=c(),w=l(),T=u(),E=d(),D=f();0&&(r.exports={addCacheTag,attachDatabasePool,dangerouslyDeleteBySrcImage,dangerouslyDeleteByTag,experimental_attachDatabasePool,experimental_upgradeWebSocket,geolocation,getCache,getEnv,invalidateBySrcImage,invalidateByTag,ipAddress,next,rewrite,waitUntil})}));export default p();export{};