
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Zuplo, Inc. All rights reserved.
 *
 *  This software and associated documentation files (the "Software") is intended to be used
 *  only by Zuplo customers solely to develop and test applications that will be deployed
 *  to Zuplo hosted services. You and others in your organization may use these files on your
 *  Development Devices solely for the above stated purpose.
 *
 *  Outside of uses stated above, no license is granted for any other purpose including
 *  without limitation the rights to use, copy, modify, merge, publish, distribute,
 *  sublicense, host, and/or sell copies of the Software.
 *
 *  The software may include third party components with separate legal notices or governed by
 *  other agreements, as described in licenses either embedded in or accompanying the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 *  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 *  PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
 *  FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
 *  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 *  DEALINGS IN THE SOFTWARE.
 *--------------------------------------------------------------------------------------------*/

var he=Object.defineProperty;var o=(r,e)=>he(r,"name",{value:e,configurable:!0});import{scheduler as Ae}from"node:timers/promises";Object.defineProperty(globalThis,"scheduler",{value:Ae,writable:!1,enumerable:!0,configurable:!1});function $(r){let e=0;for(let i of r)e+=i.length;let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o($,"concat");var L=new TextEncoder,Z=new TextDecoder,xe=42,Ce=124,ye=40,Re=33,Ee=35,be=36,we=44,Pe=45,_e=58,Se=37,Oe=95,Te=62,ve=126,ke=43,Le=61,U=L.encode(`\r
`),Ne=L.encode("*"),De=L.encode("$");function V(r){let e=[Ne,L.encode(r.length.toString()),U];for(let t of r){let n=t instanceof Uint8Array?t:L.encode(t.toString());e.push(De,L.encode(n.byteLength.toString()),U,n,U)}return $(e)}o(V,"createRequest");async function*Ue(r){let e=new Uint8Array;for await(let t of r){e=$([e,t]);let n;for(;(n=e.indexOf(U[0]))!==-1&&e[n+1]===U[1];)yield e.subarray(0,n),e=e.subarray(n+2)}}o(Ue,"readLines");function D(r,e,t=!1){return Array.fromAsync({length:e},()=>H(r,t))}o(D,"readNReplies");function y(r){return Z.decode(r.slice(1))}o(y,"parseLine");function He(r){let e=[];for(let t=0;t<r.length;t+=2)e.push(r.slice(t,t+2));return e}o(He,"chunk");async function H(r,e=!1){let{value:t}=await r.next();switch(t[0]){case xe:case Te:{let n=Number(y(t));return n===-1?null:await D(r,n)}case Ce:{let n=Number(y(t))*2;return await D(r,n),H(r,e)}case ye:return BigInt(y(t));case Re:{let{value:n}=await r.next();return Promise.reject(Z.decode(n))}case Ee:return y(t)==="t";case be:case Le:return y(t)==="-1"?null:H(r,e);case we:case _e:switch(y(t)){case"inf":return 1/0;case"-inf":return-1/0;default:return Number(y(t))}case Pe:return Promise.reject(y(t));case Se:{let n=Number(y(t))*2,i=await D(r,n);return Object.fromEntries(He(i))}case Oe:return null;case ve:return new Set(await D(r,Number(y(t)),e));case ke:return y(t);default:return e?t:Z.decode(t)}}o(H,"readReply");var W=class{static{o(this,"RedisClient")}#t;#r;#e=Promise.resolve();constructor(e){this.#t=e.writable.getWriter(),this.#r=Ue(e.readable)}#o(e){return this.#e=this.#e.then(e),this.#e}sendCommand(e,t=!1){return this.#o(()=>(this.#t.write(V(e)),H(this.#r,t)))}writeCommand(e){return this.#o(()=>this.#t.write(V(e)))}async*readReplies(e=!1){for(;;)yield H(this.#r,e)}pipelineCommands(e,t=!1){return this.#o(()=>{let n=$(e.map(V));return this.#t.write(n),D(this.#r,e.length,t)})}};var Ie=/^\s*(?:export\s+)?(?<key>[^\s=#]+?)\s*=[\ \t]*('\r?\n?(?<notInterpolated>(.|\r\n|\n)*?)\r?\n?'|"\r?\n?(?<interpolated>(.|\r\n|\n)*?)\r?\n?"|(?<unquoted>[^\r\n#]*)) *#*.*$/gm,Fe=/^[a-zA-Z_][a-zA-Z0-9_]*$/,ne=/(\${(?<inBrackets>.+?)(\:-(?<inBracketsDefault>.+))?}|(?<!\\)\$(?<notInBrackets>\w+)(\:-(?<notInBracketsDefault>.+))?)/g;function Ge(r){let e={"\\n":`
`,"\\r":"\r","\\t":"	"};return r.replace(/\\([nrt])/g,t=>e[t]??"")}o(Ge,"expandCharacters");function X(r,e){return ne.test(r)?X(r.replace(ne,function(...t){let{inBrackets:n,inBracketsDefault:i,notInBrackets:a,notInBracketsDefault:c}=t[t.length-1],l=n||a,f=i||c,s=e[l];return s===void 0&&(s=Deno.env.get(l)),s===void 0?X(f,e):s}),e):r}o(X,"expand");function ie(r){let e={},t,n=[];for(;(t=Ie.exec(r))!==null;){let{key:a,interpolated:c,notInterpolated:l,unquoted:f}=t?.groups;if(!Fe.test(a)){console.warn(`Ignored the key "${a}" as it is not a valid identifier: The key need to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.`);continue}f&&n.push(a),e[a]=typeof l=="string"?l:typeof c=="string"?Ge(c):f.trim()}let i={...e};return n.forEach(a=>{e[a]=X(e[a],i)}),e}o(ie,"parse");async function K(r={}){let{envPath:e=".env",export:t=!1}=r,n=e?await $e(e):{};if(t)for(let[i,a]of Object.entries(n))Deno.env.get(i)===void 0&&Deno.env.set(i,a);return n}o(K,"load");async function $e(r){try{return ie(await Deno.readTextFile(r))}catch(e){if(e instanceof Deno.errors.NotFound)return{};throw e}}o($e,"parseFile");var d=globalThis.Deno?.build.os==="windows"||globalThis.navigator?.platform?.startsWith("Win")||globalThis.process?.platform?.startsWith("win")||!1;function m(r){if(typeof r!="string")throw new TypeError(`Path must be a string, received "${JSON.stringify(r)}"`)}o(m,"assertPath");function R(r){return r===47}o(R,"isPosixPathSeparator");function u(r){return r===47||r===92}o(u,"isPathSeparator");function _(r){return r>=97&&r<=122||r>=65&&r<=90}o(_,"isWindowsDeviceRoot");function j(r){if(m(r),r.length===0)return"."}o(j,"assertArg");function N(r,e,t,n){let i="",a=0,c=-1,l=0,f;for(let s=0;s<=r.length;++s){if(s<r.length)f=r.charCodeAt(s);else{if(n(f))break;f=47}if(n(f)){if(!(c===s-1||l===1))if(c!==s-1&&l===2){if(i.length<2||a!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){let p=i.lastIndexOf(t);p===-1?(i="",a=0):(i=i.slice(0,p),a=i.length-1-i.lastIndexOf(t)),c=s,l=0;continue}else if(i.length===2||i.length===1){i="",a=0,c=s,l=0;continue}}e&&(i.length>0?i+=`${t}..`:i="..",a=2)}else i.length>0?i+=t+r.slice(c+1,s):i=r.slice(c+1,s),a=s-c-1;c=s,l=0}else f===46&&l!==-1?++l:l=-1}return i}o(N,"normalizeString");function M(r){j(r);let e=R(r.charCodeAt(0)),t=R(r.charCodeAt(r.length-1));return r=N(r,!e,"/",R),r.length===0&&!e&&(r="."),r.length>0&&t&&(r+="/"),e?`/${r}`:r}o(M,"normalize");function Y(...r){if(r.length===0)return".";r.forEach(t=>m(t));let e=r.filter(t=>t.length>0).join("/");return e===""?".":M(e)}o(Y,"join");function z(r){j(r);let e=r.length,t=0,n,i=!1,a=r.charCodeAt(0);if(e>1)if(u(a))if(i=!0,u(r.charCodeAt(1))){let l=2,f=l;for(;l<e&&!u(r.charCodeAt(l));++l);if(l<e&&l!==f){let s=r.slice(f,l);for(f=l;l<e&&u(r.charCodeAt(l));++l);if(l<e&&l!==f){for(f=l;l<e&&!u(r.charCodeAt(l));++l);if(l===e)return`\\\\${s}\\${r.slice(f)}\\`;l!==f&&(n=`\\\\${s}\\${r.slice(f,l)}`,t=l)}}}else t=1;else _(a)&&r.charCodeAt(1)===58&&(n=r.slice(0,2),t=2,e>2&&u(r.charCodeAt(2))&&(i=!0,t=3));else if(u(a))return"\\";let c;return t<e?c=N(r.slice(t),!i,"\\",u):c="",c.length===0&&!i&&(c="."),c.length>0&&u(r.charCodeAt(e-1))&&(c+="\\"),n===void 0?i?c.length>0?`\\${c}`:"\\":c:i?c.length>0?`${n}\\${c}`:`${n}\\`:n+c}o(z,"normalize");function Q(...r){if(r.forEach(a=>m(a)),r=r.filter(a=>a.length>0),r.length===0)return".";let e=!0,t=0,n=r[0];if(u(n.charCodeAt(0))){++t;let a=n.length;a>1&&u(n.charCodeAt(1))&&(++t,a>2&&(u(n.charCodeAt(2))?++t:e=!1))}let i=r.join("\\");if(e){for(;t<i.length&&u(i.charCodeAt(t));++t);t>=2&&(i=`\\${i.slice(t)}`)}return z(i)}o(Q,"join");function S(...r){return d?Q(...r):Y(...r)}o(S,"join");function st(r){if(r.length>=255)throw new TypeError("Alphabet too long");let e=new Uint8Array(256);for(let s=0;s<e.length;s++)e[s]=255;for(let s=0;s<r.length;s++){let p=r.charAt(s),g=p.charCodeAt(0);if(e[g]!==255)throw new TypeError(p+" is ambiguous");e[g]=s}let t=r.length,n=r.charAt(0),i=Math.log(t)/Math.log(256),a=Math.log(256)/Math.log(t);function c(s){if(s instanceof Uint8Array||(ArrayBuffer.isView(s)?s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):Array.isArray(s)&&(s=Uint8Array.from(s))),!(s instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(s.length===0)return"";let p=0,g=0,A=0,E=s.length;for(;A!==E&&s[A]===0;)A++,p++;let b=(E-A)*a+1>>>0,x=new Uint8Array(b);for(;A!==E;){let P=s[A],C=0;for(let O=b-1;(P!==0||C<g)&&O!==-1;O--,C++)P+=256*x[O]>>>0,x[O]=P%t>>>0,P=P/t>>>0;if(P!==0)throw new Error("Non-zero carry");g=C,A++}let w=b-g;for(;w!==b&&x[w]===0;)w++;let F=n.repeat(p);for(;w<b;++w)F+=r.charAt(x[w]);return F}o(c,"encode");function l(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;let p=0,g=0,A=0;for(;s[p]===n;)g++,p++;let E=(s.length-p)*i+1>>>0,b=new Uint8Array(E);for(;p<s.length;){let P=s.charCodeAt(p);if(P>255)return;let C=e[P];if(C===255)return;let O=0;for(let G=E-1;(C!==0||O<A)&&G!==-1;G--,O++)C+=t*b[G]>>>0,b[G]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");A=O,p++}let x=E-A;for(;x!==E&&b[x]===0;)x++;let w=new Uint8Array(g+(E-x)),F=g;for(;x!==E;)w[F++]=b[x++];return w}o(l,"decodeUnsafe");function f(s){let p=l(s);if(p)return p;throw new Error("Non-base"+t+" character")}return o(f,"decode"),{encode:c,decodeUnsafe:l,decode:f}}o(st,"base");var ae=st;var at="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",le=ae(at);var ee=class{static{o(this,"ZenoLogger")}prefix="[ZENO]:";logLevel;constructor(e="info"){this.logLevel=e}debug(...e){(this.shouldLog("debug")||Deno.env.get("ZENO_DEBUG"))&&console.debug(this.prefix,"[DEBUG]",...e)}info(...e){this.shouldLog("info")&&console.info(this.prefix,"[INFO]",...e)}warn(...e){this.shouldLog("warn")&&console.warn(this.prefix,"[WARN]",...e)}error(...e){this.shouldLog("error")&&console.error(this.prefix,"[ERROR]",...e)}shouldLog(e){let t=["debug","info","warn","error"],n=t.indexOf(this.logLevel);return t.indexOf(e)>=n}setLogLevel(e){this.logLevel=e}},h=new ee;async function ce(r){let e={};for(let[t,n]of Object.entries(Deno.env.toObject()))n!==void 0&&(e[t]=n);try{let t=S(r,".env.zuplo"),n=await K({envPath:t,export:!0});for(let[i,a]of Object.entries(n))if(e[i]=a,i==="ZUPLO_SYSTEM_CONFIGURATIONS")try{let c=new TextDecoder().decode(le.decode(a)),l=JSON.parse(c);for(let[f,s]of Object.entries(l))e[f]=String(s)}catch(c){h.error("Failed to parse ZUPLO_SYSTEM_CONFIGURATIONS from .env.zuplo:",c)}}catch(t){h.error("Error loading .env.zuplo:",t)}try{let t=S(r,".env"),n=await K({envPath:t,export:!0});for(let[i,a]of Object.entries(n))e[i]=a}catch(t){console.error("Error loading .env:",t)}for(let[t,n]of Object.entries(e))n===void 0&&delete e[t];return e}o(ce,"loadEnvironment");function fe(r){return r?["true","1","yes","y"].includes(r.toLowerCase()):!1}o(fe,"parseEnvBool");var te=class{static{o(this,"CacheStorage")}#t;constructor(){this.#t=new Map}async open(e){let t=this.#t.get(e);return t||(t=new re,this.#t.set(e,t)),t}async has(e){return this.#t.has(e)}async delete(e){throw new Error("caches.delete is not supported")}};async function lt(){let r=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME");if(r===void 0)throw new Error("ZUPLO_CACHE_REDIS_HOSTNAME is not set");let e=parseInt(Deno.env.get("ZUPLO_CACHE_REDIS_PORT")||"6379"),t=await Deno.connect({hostname:r,port:e});return new W(t)}o(lt,"getRedisClient");function ct(r){let e={};return r&&r.split(",").forEach(n=>{let[i,a]=n.trim().split("=");e[i.toLowerCase()]=a?a.trim():!0}),e}o(ct,"parseHeaderValue");function ft(r){let e={};for(let[t,n]of r.entries())e[t]=n;return e}o(ft,"objectifyHeaders");async function pt(r){let e=await r.arrayBuffer(),t=new Uint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return btoa(n)}o(pt,"serializeResponseBody");function ut(r){let e=atob(r),t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n}o(ut,"deserializeResponseBody");var re=class{static{o(this,"Cache")}#t;#r;#e;constructor(e="default",t={}){this.#t=e;let n=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME")&&Deno.env.get("ZUPLO_CACHE_REDIS_PORT");this.#r=!n||!fe(Deno.env.get("USE_ZENO_ZONE_CACHE")),this.#e=t.getRedisClient||lt}#o(e){return`${this.#t}:${e.url}`}async match(e,t){if(this.#r)return;let n=this.#o(e),i=await this.#e();await i.sendCommand(["HELLO",3]);let a=await i.sendCommand(["TTL",n]);if(a!==-2){if(a<2)return;{let c=await i.sendCommand(["HGETALL",n]),l=c.status,f=c.status,s=new Headers(JSON.parse(c.headers));return new Response(ut(c.body),{status:l,statusText:f,headers:s})}}}async put(e,t){if(this.#r)return;let n=1*60*60,i=ct(t.headers.get("cache-control")),a=parseInt(i["s-maxage"]),c=parseInt(i["max-age"]),l=i["no-store"],f=i["no-cache"],s=a||c||0;if(s===0&&!l&&!f&&(s=n,t.headers.append("cache-control",`s-maxage=${n}`)),s>0){let p=this.#o(e),g=await this.#e();await g.sendCommand(["HELLO",3]),await g.sendCommand(["HSET",p,"maxage",s,"status",t.status,"statusText",t.statusText,"headers",JSON.stringify(ft(t.headers)),"body",await pt(t)]),await g.sendCommand(["EXPIRE",p,s])}}async delete(e){if(this.#r)return;let t=this.#o(e);if(await(await this.#e()).sendCommand(["DEL",t])!==1)throw new Error("Failed to delete cache entry")}},dt=new te;Object.defineProperty(globalThis,"caches",{value:dt,writable:!1,enumerable:!0,configurable:!1});var J=class{static{o(this,"WorkerServer")}#t;#r;#e=o(()=>({waitUntil:o(e=>{e.catch(t=>{console.error("Error in waitUntil:",t)})},"waitUntil")}),"#createContext");constructor(e){this.#r=e}async start(){let{port:e,workerModule:t,env:n}=this.#r;this.#t=Deno.serve({port:e,onListen:o(()=>{h.debug(`Server running at http://localhost:${e}`)},"onListen")},async i=>{try{return await t.default.fetch(i,n,this.#e())}catch(a){return h.error("Error handling request:",a),new Response("Internal Server Error",{status:500})}}),await this.#t.finished}async stop(){await this.#t?.shutdown()}};import{pathToFileURL as mt}from"node:url";var pe=S("dist","worker.js");function gt(){if(Deno.build.standalone)return S("..",pe);let r=Deno.cwd();return S(r,pe)}o(gt,"getDefaultWorkerPath");var ht=gt();function At(r){return typeof r=="object"&&r!==null&&"default"in r&&typeof r.default=="object"&&"fetch"in r.default&&typeof r.default.fetch=="function"}o(At,"isWorkerModule");async function ue(r=ht){let e;if(Deno.build.standalone?(h.debug("Loading worker module from: ",r),e=await import(r)):(h.debug("Loading dev worker module from: ",r),e=await import(mt(r).href)),!At(e))throw new Error("Invalid worker module");return e}o(ue,"importWorkerModule");function de(){console.log("Enabling fetch host override.");let r=globalThis.fetch,e=Deno.createHttpClient({allowHost:!0,http2:!1});return globalThis.fetch=async(t,n={})=>await r(t,{...n,client:e}),e}o(de,"setFetchHostOverride");function me(r){if(new.target)throw new TypeError("Cannot create an instance: parse is not a constructor");return new oe(r).parse()}o(me,"parse");var oe=class{static{o(this,"JsoncParser")}#t=new Set(` 	\r
`);#r=new Set([..."[]{}:,/",...this.#t]);#e;#o;#i;constructor(e){this.#e=`${e}`,this.#o=this.#e.length,this.#i=this.#l()}parse(){let e=this.#n(),t=this.#s(e),{done:n,value:i}=this.#i.next();if(!n)throw new SyntaxError(k(i));return t}#n(){let{done:e,value:t}=this.#i.next();if(e)throw new SyntaxError("Cannot parse JSONC: unexpected end of JSONC input");return t}*#l(){for(let e=0;e<this.#o;e++)if(!this.#t.has(this.#e[e])){if(this.#e[e]==="/"&&this.#e[e+1]==="*"){e+=2;let t=!1;for(;e<this.#o;e++)if(this.#e[e]==="*"&&this.#e[e+1]==="/"){t=!0;break}if(!t)throw new SyntaxError("Cannot parse JSONC: unexpected end of JSONC input");e++;continue}if(this.#e[e]==="/"&&this.#e[e+1]==="/"){for(e+=2;e<this.#o&&!(this.#e[e]===`
`||this.#e[e]==="\r");e++);continue}switch(this.#e[e]){case"{":yield{type:"BeginObject",position:e};break;case"}":yield{type:"EndObject",position:e};break;case"[":yield{type:"BeginArray",position:e};break;case"]":yield{type:"EndArray",position:e};break;case":":yield{type:"NameSeparator",position:e};break;case",":yield{type:"ValueSeparator",position:e};break;case'"':{let t=e,n=!1;for(e++;e<this.#o&&!(this.#e[e]==='"'&&!n);e++)n=this.#e[e]==="\\"&&!n;yield{type:"String",sourceText:this.#e.substring(t,e+1),position:t};break}default:{let t=e;for(;e<this.#o&&!this.#r.has(this.#e[e]);e++);e--,yield{type:"NullOrTrueOrFalseOrNumber",sourceText:this.#e.substring(t,e+1),position:t}}}}}#s(e){switch(e.type){case"BeginObject":return this.#c();case"BeginArray":return this.#f();case"NullOrTrueOrFalseOrNumber":return this.#p(e);case"String":return this.#a(e);default:throw new SyntaxError(k(e))}}#c(){let e={};for(;;){let t=this.#n();if(t.type==="EndObject")return e;if(t.type!=="String")throw new SyntaxError(k(t));let n=this.#a(t),i=this.#n();if(i.type!=="NameSeparator")throw new SyntaxError(k(i));let a=this.#n();Object.defineProperty(e,n,{value:this.#s(a),writable:!0,enumerable:!0,configurable:!0});let c=this.#n();if(c.type==="EndObject")return e;if(c.type!=="ValueSeparator")throw new SyntaxError(k(c))}}#f(){let e=[];for(;;){let t=this.#n();if(t.type==="EndArray")return e;e.push(this.#s(t));let n=this.#n();if(n.type==="EndArray")return e;if(n.type!=="ValueSeparator")throw new SyntaxError(k(n))}}#a(e){let t;try{t=JSON.parse(e.sourceText)}catch{throw new SyntaxError(k(e))}if(typeof t!="string")throw new TypeError(`Parsed value is not a string: ${t}`);return t}#p(e){if(e.sourceText==="null")return null;if(e.sourceText==="true")return!0;if(e.sourceText==="false")return!1;let t;try{t=JSON.parse(e.sourceText)}catch{throw new SyntaxError(k(e))}if(typeof t!="number")throw new TypeError(`Parsed value is not a number: ${t}`);return t}};function k({type:r,sourceText:e,position:t}){let n="";switch(r){case"BeginObject":n="{";break;case"EndObject":n="}";break;case"BeginArray":n="[";break;case"EndArray":n="]";break;case"NameSeparator":n=":";break;case"ValueSeparator":n=",";break;case"NullOrTrueOrFalseOrNumber":case"String":n=30<e.length?`${e.slice(0,30)}...`:e;break}return`Cannot parse JSONC: unexpected token "${n}" in JSONC at position ${t}`}o(k,"buildErrorMessage");var xt="zuplo.jsonc";function ge(r){let e=S(r,xt),t=Deno.readTextFileSync(e),n=me(t);if(n!==null&&typeof n=="object"&&"managedDedicatedFlags"in n)return n.managedDedicatedFlags}o(ge,"getManagedDedicatedSettings");async function Ct(){let r;h.debug("Starting Zeno server...");try{let e=await ue(),t=await ce(Deno.cwd());ge(Deno.cwd())?.allowFetchHostHeaderOverride&&(r=de()),await new J({port:9e3,workerModule:e,env:t}).start()}catch(e){h.error("Failed to start server:",e)}finally{r&&r.close()}}o(Ct,"main");import.meta.main&&await Ct();export{Ct as main};
