@easbot/utils 0.2.41 → 0.2.42

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/index.cjs CHANGED
@@ -1,82 +1,82 @@
1
- 'use strict';var chunkJL3GR4P7_cjs=require('./chunks/chunk-JL3GR4P7.cjs'),chunkPYCQUF3V_cjs=require('./chunks/chunk-PYCQUF3V.cjs'),chunkWWPI6PC4_cjs=require('./chunks/chunk-WWPI6PC4.cjs'),chunkAHO55TRS_cjs=require('./chunks/chunk-AHO55TRS.cjs'),chunkYC4AEMOP_cjs=require('./chunks/chunk-YC4AEMOP.cjs'),chunkVRQQ33YH_cjs=require('./chunks/chunk-VRQQ33YH.cjs'),oe=require('fs/promises'),_e=require('zod'),crypto$1=require('crypto'),me=require('path'),Le=require('fs'),child_process=require('child_process'),module$1=require('module'),hono=require('hono'),nodeServer=require('@hono/node-server'),nodeWs=require('@hono/node-ws'),streaming=require('hono/streaming'),cors=require('hono/cors'),logger=require('hono/logger'),compress=require('hono/compress'),secureHeaders=require('hono/secure-headers'),timeout=require('hono/timeout'),httpException=require('hono/http-exception'),validator=require('hono/validator'),zodValidator=require('@hono/zod-validator'),minimatch=require('minimatch'),promises=require('timers/promises'),dotenv=require('dotenv'),url=require('url'),Kr=require('markdown-it'),_n=require('yaml'),undici=require('undici'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var oe__default=/*#__PURE__*/_interopDefault(oe);var _e__default=/*#__PURE__*/_interopDefault(_e);var me__default=/*#__PURE__*/_interopDefault(me);var Le__default=/*#__PURE__*/_interopDefault(Le);var Kr__default=/*#__PURE__*/_interopDefault(Kr);var _n__default=/*#__PURE__*/_interopDefault(_n);chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Gn(e,t){for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(r!==void 0&&t(r,n,e))return r}}chunkVRQQ33YH_cjs.j();exports.Binary=void 0;(n=>{function e(r,o,s){let a=0,i=r.length-1;for(;a<=i;){let c=Math.floor((a+i)/2),p=r[c];if(p===void 0)break;let l=s(p);if(l===o)return {found:true,index:c};l<o?a=c+1:i=c-1;}return {found:false,index:a}}n.search=e;function t(r,o,s){let a=s(o),i=0,c=r.length;for(;i<c;){let p=Math.floor((i+c)/2),l=r[p];if(l===void 0)break;s(l)<a?i=p+1:c=p;}return r.splice(i,0,o),r}n.insert=t;})(exports.Binary||(exports.Binary={}));chunkVRQQ33YH_cjs.j();exports.Encode=void 0;(s=>{function e(a){let i=new TextEncoder().encode(a),c=Array.from(i,p=>String.fromCharCode(p)).join("");return btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s.base64Encode=e;function t(a){let i=atob(a.replace(/-/g,"+").replace(/_/g,"/")),c=Uint8Array.from(i,p=>p.charCodeAt(0));return new TextDecoder().decode(c)}s.base64Decode=t;async function n(a,i="SHA-256"){let p=new TextEncoder().encode(a),l=await crypto.subtle.digest(i,p);return Array.from(new Uint8Array(l)).map(k=>k.toString(16).padStart(2,"0")).join("")}s.hash=n;function r(a){if(!a)return;let i=2166136261;for(let c=0;c<a.length;c++)i^=a.charCodeAt(c),i=Math.imul(i,16777619);return (i>>>0).toString(36)}s.checksum=r;function o(a,i=5e5){if(!a)return;if(a.length<=i)return r(a);let c=4096,l=[0,Math.floor(a.length*.25),Math.floor(a.length*.5),Math.floor(a.length*.75),a.length-c].map(d=>{let g=Math.max(0,Math.min(a.length-c,d-Math.floor(c/2)));return r(a.slice(g,g+c))??""}).join(":");return `${a.length}:${l}`}s.sampledChecksum=o;})(exports.Encode||(exports.Encode={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();exports.Identifier=void 0;(d=>{let e={event:"evt",session:"ses",message:"msg",permission:"per",question:"que",user:"usr",part:"prt",pty:"pty",tool:"tool",workspace:"wrk",command:"cmd",task:"task",heartbeat:"hb",subagent:"sub",hook:"hok",compaction:"cmp",context:"ctx"};function t(g){return _e__default.default.string().startsWith(e[g])}d.schema=t;let n=26,r=0,o=0;function s(g,k){return i(g,false,k)}d.ascending=s;function a(g,k){return i(g,true,k)}d.descending=a;function i(g,k,E){if(!E)return p(g,k);if(!E.startsWith(e[g]))throw new Error(`ID ${E} does not start with ${e[g]}`);return E}function c(g){let k="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",E="",D=crypto$1.randomBytes(g);for(let U=0;U<g;U++){let W=D[U];W!==void 0&&(E+=k[W%62]);}return E}function p(g,k,E){let D=E??Date.now();D!==r&&(r=D,o=0),o++;let U=BigInt(D)*BigInt(4096)+BigInt(o);U=k?~U:U;let W=Buffer.alloc(6);for(let N=0;N<6;N++)W[N]=Number(U>>BigInt(40-8*N)&BigInt(255));return e[g]+"_"+W.toString("hex")+c(n-12)}d.create=p;function l(g){let k=g.split("_")[0];if(!k)return 0;let E=g.slice(k.length+1,k.length+13),D=BigInt("0x"+E);return Number(D/BigInt(4096))}d.timestamp=l;})(exports.Identifier||(exports.Identifier={}));exports.TruncateContent=void 0;(s=>{s.DEFAULT_MAX_CHARS=4e3,s.DIRECTION="head";function n(a,i,c){return c?`[Content truncated. Source: ${c}
1
+ 'use strict';var chunkJL3GR4P7_cjs=require('./chunks/chunk-JL3GR4P7.cjs'),chunkPYCQUF3V_cjs=require('./chunks/chunk-PYCQUF3V.cjs'),chunkWWPI6PC4_cjs=require('./chunks/chunk-WWPI6PC4.cjs'),chunkAHO55TRS_cjs=require('./chunks/chunk-AHO55TRS.cjs'),chunkYC4AEMOP_cjs=require('./chunks/chunk-YC4AEMOP.cjs'),chunkVRQQ33YH_cjs=require('./chunks/chunk-VRQQ33YH.cjs'),oe=require('fs/promises'),Be=require('zod'),crypto$1=require('crypto'),fe=require('path'),Le=require('fs'),child_process=require('child_process'),module$1=require('module'),hono=require('hono'),nodeServer=require('@hono/node-server'),nodeWs=require('@hono/node-ws'),streaming=require('hono/streaming'),cors=require('hono/cors'),logger=require('hono/logger'),compress=require('hono/compress'),secureHeaders=require('hono/secure-headers'),timeout=require('hono/timeout'),httpException=require('hono/http-exception'),validator=require('hono/validator'),zodValidator=require('@hono/zod-validator'),minimatch=require('minimatch'),promises=require('timers/promises'),dotenv=require('dotenv'),url=require('url'),Zr=require('markdown-it'),jn=require('yaml'),undici=require('undici'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var oe__default=/*#__PURE__*/_interopDefault(oe);var Be__default=/*#__PURE__*/_interopDefault(Be);var fe__default=/*#__PURE__*/_interopDefault(fe);var Le__default=/*#__PURE__*/_interopDefault(Le);var Zr__default=/*#__PURE__*/_interopDefault(Zr);var jn__default=/*#__PURE__*/_interopDefault(jn);chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Jn(e,t){for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(r!==void 0&&t(r,n,e))return r}}chunkVRQQ33YH_cjs.j();exports.Binary=void 0;(n=>{function e(r,o,s){let a=0,i=r.length-1;for(;a<=i;){let c=Math.floor((a+i)/2),p=r[c];if(p===void 0)break;let l=s(p);if(l===o)return {found:true,index:c};l<o?a=c+1:i=c-1;}return {found:false,index:a}}n.search=e;function t(r,o,s){let a=s(o),i=0,c=r.length;for(;i<c;){let p=Math.floor((i+c)/2),l=r[p];if(l===void 0)break;s(l)<a?i=p+1:c=p;}return r.splice(i,0,o),r}n.insert=t;})(exports.Binary||(exports.Binary={}));chunkVRQQ33YH_cjs.j();exports.Encode=void 0;(s=>{function e(a){let i=new TextEncoder().encode(a),c=Array.from(i,p=>String.fromCharCode(p)).join("");return btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s.base64Encode=e;function t(a){let i=atob(a.replace(/-/g,"+").replace(/_/g,"/")),c=Uint8Array.from(i,p=>p.charCodeAt(0));return new TextDecoder().decode(c)}s.base64Decode=t;async function n(a,i="SHA-256"){let p=new TextEncoder().encode(a),l=await crypto.subtle.digest(i,p);return Array.from(new Uint8Array(l)).map(v=>v.toString(16).padStart(2,"0")).join("")}s.hash=n;function r(a){if(!a)return;let i=2166136261;for(let c=0;c<a.length;c++)i^=a.charCodeAt(c),i=Math.imul(i,16777619);return (i>>>0).toString(36)}s.checksum=r;function o(a,i=5e5){if(!a)return;if(a.length<=i)return r(a);let c=4096,l=[0,Math.floor(a.length*.25),Math.floor(a.length*.5),Math.floor(a.length*.75),a.length-c].map(f=>{let h=Math.max(0,Math.min(a.length-c,f-Math.floor(c/2)));return r(a.slice(h,h+c))??""}).join(":");return `${a.length}:${l}`}s.sampledChecksum=o;})(exports.Encode||(exports.Encode={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();exports.Identifier=void 0;(f=>{let e={event:"evt",session:"ses",message:"msg",permission:"per",question:"que",user:"usr",part:"prt",pty:"pty",tool:"tool",workspace:"wrk",command:"cmd",task:"task",heartbeat:"hb",agent:"ag",subagent:"sub",hook:"hok",compaction:"cmp",context:"ctx"};function t(h){return Be__default.default.string().startsWith(e[h])}f.schema=t;let n=26,r=0,o=0;function s(h,v){return i(h,false,v)}f.ascending=s;function a(h,v){return i(h,true,v)}f.descending=a;function i(h,v,E){if(!E)return p(h,v);if(!E.startsWith(e[h]))throw new Error(`ID ${E} does not start with ${e[h]}`);return E}function c(h){let v="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",E="",N=crypto$1.randomBytes(h);for(let W=0;W<h;W++){let H=N[W];H!==void 0&&(E+=v[H%62]);}return E}function p(h,v,E){let N=E??Date.now();N!==r&&(r=N,o=0),o++;let W=BigInt(N)*BigInt(4096)+BigInt(o);W=v?~W:W;let H=Buffer.alloc(6);for(let U=0;U<6;U++)H[U]=Number(W>>BigInt(40-8*U)&BigInt(255));return e[h]+"_"+H.toString("hex")+c(n-12)}f.create=p;function l(h){let v=h.split("_")[0];if(!v)return 0;let E=h.slice(v.length+1,v.length+13),N=BigInt("0x"+E);return Number(N/BigInt(4096))}f.timestamp=l;})(exports.Identifier||(exports.Identifier={}));exports.TruncateContent=void 0;(s=>{s.DEFAULT_MAX_CHARS=4e3,s.DIRECTION="head";function n(a,i,c){return c?`[Content truncated. Source: ${c}
2
2
  Full ${i} saved to: ${a}
3
3
  Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${i} saved to: ${a}
4
- Use Read tool with offset/limit parameters to view specific sections.]`}async function r(a,i={}){let c=i.maxChars??4e3,p=i.direction??s.DIRECTION,l=i.label??"content",d=i.sourcePath,g=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),k=i.dir??g;if(a.length<=c)return {content:a,truncated:false};let E=exports.Identifier.ascending("context"),D=chunkJL3GR4P7_cjs.c.join(k,E);await oe__default.default.mkdir(k,{recursive:true}).catch(()=>{}),await oe__default.default.writeFile(D,a,"utf-8");let U=a.length-c,W;p==="head"?W=a.slice(0,c):W=a.slice(-c);let N=n(D,l,d),ie=`${U} characters truncated`;return {content:p==="head"?`${W}
4
+ Use Read tool with offset/limit parameters to view specific sections.]`}async function r(a,i={}){let c=i.maxChars??4e3,p=i.direction??s.DIRECTION,l=i.label??"content",f=i.sourcePath,h=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),v=i.dir??h;if(a.length<=c)return {content:a,truncated:false};let E=exports.Identifier.ascending("context"),N=chunkJL3GR4P7_cjs.c.join(v,E);await oe__default.default.mkdir(v,{recursive:true}).catch(()=>{}),await oe__default.default.writeFile(N,a,"utf-8");let W=a.length-c,H;p==="head"?H=a.slice(0,c):H=a.slice(-c);let U=n(N,l,f),G=`${W} characters truncated`;return {content:p==="head"?`${H}
5
5
 
6
- ...${ie}...
6
+ ...${G}...
7
7
 
8
- ${N}`:`...${ie}...
8
+ ${U}`:`...${G}...
9
9
 
10
- ${N}
10
+ ${U}
11
11
 
12
- ${W}`,truncated:true,outputPath:D,originalLength:a.length,removedLength:U,label:l}}s.truncate=r;function o(a){return a.truncated?n(a.outputPath,a.label):""}s.formatHint=o;})(exports.TruncateContent||(exports.TruncateContent={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function rt(e,t=true){let n=typeof e=="number"?new Date(e):e,r=n.getTimezoneOffset(),o=Math.floor(Math.abs(r)/60),s=Math.abs(r)%60,i=`${r<=0?"+":"-"}${String(o).padStart(2,"0")}:${String(s).padStart(2,"0")}`,c=n.getFullYear(),p=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0"),d=String(n.getHours()).padStart(2,"0"),g=String(n.getMinutes()).padStart(2,"0"),k=String(n.getSeconds()).padStart(2,"0"),E=`${c}-${p}-${l}T${d}:${g}:${k}`;if(t){let D=String(n.getMilliseconds()).padStart(3,"0");E+=`.${D}`;}return E+=i,E}function ot(e){return rt(e,false)}function qt(){return Date.now()}function Zn(e=true){return rt(qt(),e)}function Xn(e){return e.includes("+")||e.includes("-")?new Date(e):new Date(e)}function Qn(e){let t=typeof e=="number"?new Date(e):e,n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return `${n}-${r}-${o}T${s}:${a}:${i}`}function er(e=new Date){let t=e.getTimezoneOffset(),n=Math.floor(Math.abs(t)/60),r=Math.abs(t)%60;return `${t<=0?"+":"-"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}exports.SessionTitle=void 0;(i=>{let e="New session - ",t="Child session - ";i.parentTitlePrefix=e,i.childTitlePrefix=t;function o(c=false){return (c?t:e)+ot(new Date)}i.createDefault=o;function s(c){return new RegExp(`^(${e}|${t})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(c)}i.isDefault=s;function a(c){let p=c.match(/^(.+) \(fork #(\d+)\)$/);if(p){let l=p[1]??"",d=parseInt(p[2]??"0",10);return `${l} (fork #${d+1})`}return `${c} (fork #1)`}i.getForked=a;})(exports.SessionTitle||(exports.SessionTitle={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Yt(e){let t,n=false,r=()=>(n||(t=e(),n=true),t);return r.reset=()=>{n=false,t=void 0;},r}var Ae=Yt;function Vt(e){let t,n=()=>(t||(t=e()),t);return n.reset=()=>{t=void 0;},n}var tr=Vt;exports.Lazy=void 0;(n=>(n.lazy=Yt,n.lazyAsync=Vt))(exports.Lazy||(exports.Lazy={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();var ne=chunkWWPI6PC4_cjs.a.create({service:"server"});function se(e={}){let t=e.port??3e3,n=e.hostname??"0.0.0.0",r=new hono.Hono({strict:true,getPath:a=>{try{return new URL(a.url).pathname}catch{return a.url}}});if(e.onError?r.onError(e.onError):r.onError((a,i)=>(ne.error("Server error",{error:a.message,stack:a.stack}),a instanceof httpException.HTTPException?a.getResponse():i.json({error:"Internal Server Error",message:a.message},500))),e.onNotFound?r.notFound(e.onNotFound):r.notFound(a=>a.json({error:"Not Found",path:a.req.path},404)),!e.websockets&&e.cors&&r.use(cors.cors(typeof e.cors=="boolean"?{origin:"*"}:e.cors)),r.use(logger.logger((a,...i)=>ne.info(a,i))),!e.websockets&&e.secureHeaders&&r.use(secureHeaders.secureHeaders()),!e.websockets&&e.compression&&r.use(compress.compress({encoding:"gzip"})),!e.websockets&&e.timeout&&r.use(timeout.timeout(e.timeout)),e.middlewares)for(let a of e.middlewares)a.path?r.use(a.path,a.handler):r.use(a.handler);if(e.routes)for(let a of e.routes){let i=a.middlewares||[],c=a.method.toUpperCase();a.validation?r.on(c,a.path,zodValidator.zValidator("json",a.validation),...i,a.handler):r.on(c,a.path,...i,a.handler);}e.rpc&&r.post("/rpc/:method",async a=>{let i=a.req.param("method"),c=e.rpc?.[i];if(!c)return a.json({error:"RPC method not found"},404);try{let p=await a.req.json(),l=await c(p,a);return a.json({result:l})}catch(p){return ne.error("RPC error",{method:i,error:p.message}),a.json({error:"RPC execution failed",message:p.message},500)}}),e.fetch&&r.all("*",async a=>await e.fetch(a.req.raw));let o=null,s={url:new URL(`http://${n}:${t}`),port:t,hostname:n,hono:r,async stop(a=false){return o?new Promise((i,c)=>{a&&o.closeAllConnections?.(),o.close(p=>{p?(ne.error("Error closing server",{error:p.message}),c(p)):(o=null,ne.info(`Server on port ${t} stopped`),i());}),setTimeout(()=>{ne.warn(`Server shutdown timeout on port ${t}`),o=null,i();},5e3);}):Promise.resolve()},get raw(){return o||void 0}};return ne.debug("createServer: calling serve()",{port:t,hostname:n}),o=nodeServer.serve({fetch:r.fetch,port:t,hostname:n}),ne.debug("createServer: serve() returned, server created"),ne.info(`Server running on http://${n}:${t}`),s}function it(e){return se({rpc:e,port:3e3})}function sr(e,t=3e3,n="0.0.0.0"){return se({fetch:e,port:t,hostname:n})}function at(e,t={}){return se({...t,routes:e})}function ct(e,t={}){return se({...t,websockets:e})}function lt(e,t={}){let n=Object.entries(e).map(([r,o])=>({method:"get",path:`/stream/${r}`,handler:s=>streaming.streamSSE(s,async a=>{for await(let i of o(s))await a.writeSSE(i);})}));return se({...t,routes:n,streaming:true})}chunkVRQQ33YH_cjs.j();var ae=chunkWWPI6PC4_cjs.a.create({service:"build-api"});async function an(){try{return {available:!0,version:(await import('./chunks/main-RIJAJS2R.cjs')).version||"unknown"}}catch(e){return ae.warn("esbuild not available",{error:e.message}),{available:false}}}async function Be(){let e=await an();if(!e.available)throw new Error("esbuild is required but not installed. Please install it using: pnpm add -D esbuild");e.version&&e.version<"0.17.0"&&ae.warn(`esbuild version ${e.version} may have limited features. Consider upgrading to 0.17+`);}function lr(e){if(e!==void 0)return typeof e=="boolean"?{target:void 0}:typeof e=="string"?{target:e}:e}function cn(e){let t=lr(e.compile);t&&ae.warn("compile option is no longer supported (Bun runtime removed). The option will be ignored.");let n={entryPoints:e.entrypoints,outdir:e.outdir,bundle:e.bundle??true,conditions:e.conditions,external:e.external,format:e.format??"esm",platform:e.platform??(e.target==="browser"?"browser":"node"),minify:e.minify??false,treeShaking:true,splitting:e.splitting,sourcemap:ur(e.sourcemap),sourcesContent:true,define:e.define,inject:e.inject,legalComments:"eof",loader:e.loader,entryNames:e.entryNames,chunkNames:e.chunkNames,assetNames:e.assetNames,publicPath:e.publicPath,tsconfig:e.tsconfig,charset:"utf8",color:true,logLevel:"info",logLimit:50,plugins:e.plugins??[],metafile:true,write:e.write??true};return t?.outfile&&!e.outdir&&(n.outfile=t.outfile,delete n.outdir),e.target&&(n.target=dr(e.target)),e.minify===true&&(n.minifyWhitespace=true,n.minifyIdentifiers=true,n.minifySyntax=true),fr(n)}function ur(e){return !e||e==="none"?false:e}function dr(e){let t={browser:"es2020",node:"node16",bun:"esnext"};return e?t[e]||e:"esnext"}function fr(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function $e(e){if(e!==void 0)return e.replace(/\\/g,"/")}function nn(e,t,n){let r=[];if(e.outputFiles)for(let s of e.outputFiles)r.push({path:$e(s.path)||s.path,size:s.contents?.length||0});if(e.metafile?.outputs)for(let[s,a]of Object.entries(e.metafile.outputs)){let i=a;r.some(c=>c.path===s||c.path===$e(s))||r.push({path:$e(s)||s,size:i.bytes||0});}let o=[];if(e.errors?.length>0)for(let s of e.errors)o.push({level:"error",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});if(e.warnings?.length>0)for(let s of e.warnings)o.push({level:"warning",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});return {outputs:r,success:e.errors?.length===0,logs:o,metafile:e.metafile}}async function dt(e){ae.info("Build started",{entrypoints:e.entrypoints,target:e.target,format:e.format,compile:typeof e.compile}),await Be();let t=await import('./chunks/main-RIJAJS2R.cjs'),n=Date.now();try{let r=cn(e);ae.debug("esbuild options",r);let o=await t.build(r),s=Date.now();return ae.info("Build completed",{duration:s-n,outputs:(o?.outputFiles?.length??0)>0||Object.keys(o.metafile?.outputs||{}).length>0}),nn(o,n,s)}catch(r){let o=Date.now(),s=r.message;return ae.error("Build failed",{error:s,duration:o-n}),r&&typeof r=="object"&&"errors"in r?nn(r):{outputs:[],success:false,logs:[{level:"error",message:s}],metafile:void 0}}}var yr={build:dt},ln=yr;chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function re(e){let t=[],n="",r=0;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r++;for(;r<e.length;){let o=e[r];if(o===" "||o===" "){for(n.length>0&&(t.push(n),n="");r<e.length&&(e[r]===" "||e[r]===" ");)r++;continue}if(o==='"'){for(r++;r<e.length;){let s=e[r];if(s==="\\"&&r+1<e.length){let a=e[r+1];if(a==='"'||a==="\\"||a==="$"||a==="`"){n+=a,r+=2;continue}}if(s==='"'){r++;break}n+=s,r++;}continue}if(o==="'"){for(r++;r<e.length;){let s=e[r];if(s==="'"){r++;break}n+=s,r++;}continue}n+=o,r++;}return n.length>0&&t.push(n),t}function un(e){return /[|&;<>()$`!#]/.test(e)}function dn(e){let t=re(e);if(t.length===0)return {command:"",args:[]};let n={command:t[0],args:t.slice(1)};if(n.args.length>0){let r=n.args[n.args.length-1];try{let o=JSON.parse(r);typeof o=="object"&&o!==null&&!Array.isArray(o)&&(n.options=o,n.args=n.args.slice(0,-1));}catch{}}return n}function ft(e,t=process.platform==="win32"?"windows":"unix"){return t==="windows"?e.includes(" ")||e.includes("&")||e.includes("|")||e.includes("<>")||e.includes("^")||e.includes('"')||e.includes("%")?`"${e.replace(/%/g,"%%").replace(/"/g,'^"')}"`:e:e.includes(" ")||e.includes("'")||e.includes('"')||e.includes("$")||e.includes("`")||e.includes("\\")||e.includes("!")||e.includes("#")||e.includes("&")||e.includes("*")||e.includes("?")||e.includes("|")||e.includes("<")||e.includes(">")||e.includes("(")||e.includes(")")||e.includes(";")?`'${e.replace(/'/g,"'\\''")}'`:e}var xr=new Set(["&&","||","|",";","&",">","<",">>","<<","2>","2>>","1>","1>>","2>&1","2>&2","1>&1","1>&2",">&","<&",">&1","<&1",">&2","<&2"]);function fn(e,t=process.platform==="win32"?"windows":"unix"){return xr.has(e)?e:ft(e,t)}function pn(){return process.platform==="win32"?"windows":"unix"}function fe(e,t,n=process.platform==="win32"?"windows":"unix"){let r=t.map(o=>fn(o,n));return [e,...r].join(" ")}function mn(e){if(e==null)return "";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>mn(t)).join(" ");if(e&&typeof e=="object"){if("raw"in e)return String(e.raw);if("toString"in e&&typeof e.toString=="function")return e.toString();if(e instanceof ReadableStream)throw new Error("ReadableStream expressions are not yet supported")}return String(e)}function wr(e,t,n){return {stdout:e,stderr:t,exitCode:n,text(r="utf-8"){return e.toString(r)},json(){let r=e.toString("utf-8");return JSON.parse(r)},arrayBuffer(){let r=e.buffer;if(r instanceof ArrayBuffer)return r.slice(e.byteOffset,e.byteOffset+e.byteLength);let o=new ArrayBuffer(e.byteLength),s=new Uint8Array(o),a=new Uint8Array(r,e.byteOffset,e.byteLength);return s.set(a),o},bytes(){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},blob(){let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return new Blob([r])}}}function pe(e,t={}){let n=re(e);if(n.length===0)throw new Error("Empty shell command");let r=async()=>{let s=await exports.PKG.run(n,{cwd:t.cwd,env:t.env}),a=wr(Buffer.from(s.stdout,"utf-8"),Buffer.from(s.stderr,"utf-8"),s.code);if(s.code!==0&&!t.nothrow)throw Object.assign(new Error(`Command failed with exit code ${s.code}: ${e}
13
- ${s.stderr}`),{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode});return a},o=r();return Object.defineProperty(o,"stdin",{get(){throw new Error("stdin is not yet supported in EasbotShell. Use PKG.spawn for interactive commands.")},enumerable:true}),o.cwd=function(s){return pe(e,{...t,cwd:s})},o.env=function(s){return pe(e,{...t,env:s})},o.quiet=function(){return pe(e,{...t,quiet:true})},o.lines=async function*(){let i=(await r()).text().split(/\r?\n/);for(let c of i)c.trim()&&(yield c);},o.text=async function(s="utf-8"){return (await r()).text(s)},o.json=async function(){return (await r()).json()},o.arrayBuffer=async function(){return (await r()).arrayBuffer()},o.blob=async function(){return (await r()).blob()},o.nothrow=function(){return pe(e,{...t,nothrow:true})},o.throws=function(s){return pe(e,{...t,nothrow:!s})},o}var Se=class{constructor(t={}){chunkVRQQ33YH_cjs.c(this,"options");this.options=t;}call(t,...n){let r="";for(let o=0;o<t.length;o++)r+=t[o],o<n.length&&n[o]!==void 0&&(r+=mn(n[o]));return pe(r,this.options)}braces(t){let n=t.match(/^(.*?)\{([^}]+)\}(.*)$/);if(!n)return [t];let[,r="",o="",s=""]=n,a=o.split(",").map(c=>c.trim()),i=[];for(let c of a){let p=`${r}${c}${s}`;p.includes("{")?i.push(...this.braces(p)):i.push(p);}return i}escape(t){return process.platform==="win32"?t.replace(/([&|<>^"%])/g,"^$1"):t.replace(/(["\s'$`\\!*?#&;()<>|])/g,"\\$1")}env(t){return ce({...this.options,env:t})}cwd(t){return ce({...this.options,cwd:t})}nothrow(){return ce({...this.options,nothrow:true})}throws(t){return ce({...this.options,nothrow:!t})}};function ce(e={}){let t=new Se(e);return new Proxy(t,{apply(n,r,o){return t.call(o[0],...o.slice(1))}})}var gn=ce();function hn(e){return e.replace(/\\/g,"/")}function bn(e){return crypto$1.createHash("md5").update(e).digest("hex").slice(0,8)}var X=new Map;exports.PKG=void 0;(A=>{let e=chunkWWPI6PC4_cjs.a.create({service:"pkg"});async function t(w){let m=w?[w]:["npm","pnpm","bun"];for(let f of m){let u=await A.which(f);if(u)return {name:f,path:u}}}A.packageManager=t;async function n(w,m){if(!w)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?f+me__default.default.delimiter+u:f,x=bn(y),h=`${w}:${x}`;if(X.has(h))return X.get(h);let P=process.platform==="win32"?"where":"which";try{let{spawn:T}=await import('child_process');return new Promise(M=>{let I=T(P,[w],{env:{...process.env,PATH:y},stdio:["pipe","pipe","ignore"],windowsHide:!0}),H="",B="";I.stdout?.on("data",z=>{H+=z.toString();}),I.stderr?.on("data",z=>{B+=z.toString();}),I.on("close",z=>{if(z===0&&H.trim()){let F=H.trim().split(`
14
- `),$=F.length>0?F[0]?.trim():null;if($){X.set(h,$),M($);return}}X.set(h,null),M(null);}),setTimeout(()=>{I.kill(),X.set(h,null),M(null);},5e3);})}catch{return X.set(h,null),null}}A.which=n;function r(w,m){if(!w)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?f+me__default.default.delimiter+u:f,x=bn(y),h=`${w}:${x}`;if(X.has(h))return X.get(h);let P=process.platform==="win32"?"where":"which";try{let T=child_process.execSync(`${P} ${w}`,{encoding:"utf-8",stdio:["pipe","pipe","ignore"],env:{...process.env,PATH:y},timeout:5e3,windowsHide:!0});if(T.trim()){let M=T.trim().split(`
15
- `),I=M.length>0?M[0]?.trim():null;if(I)return X.set(h,I),I}}catch{}return X.set(h,null),null}A.whichSync=r;function o(){X.clear();}A.clearWhichCache=o;let s=module$1.createRequire(chunkVRQQ33YH_cjs.i);async function a(w,m,f){try{let u=[];if(f?.extraPaths)for(let y of f.extraPaths){let x=me__default.default.join(y,"node_modules");u.push(x);}return m&&u.push(m),u.length>0?s.resolve(w,{paths:u}):s.resolve(w)}catch(u){throw new Error(`Cannot resolve module "${w}"${m?` from "${m}"`:""}: ${u instanceof Error?u.message:String(u)}`)}}A.resolve=a;function i(w){return {get name(){return me__default.default.basename(w)},async exists(){try{return await oe__default.default.access(w),!0}catch{return false}},async getSize(){try{return (await oe__default.default.stat(w)).size}catch{return}},async text(){return await oe__default.default.readFile(w,"utf-8")},textSync(){return Le__default.default.readFileSync(w,"utf-8")},jsonSync(){let m=Le__default.default.readFileSync(w,"utf-8");return JSON.parse(m)},async bytes(){e.debug("[PKG.file.bytes] reading file:",{filePath:w});let m=await oe__default.default.readFile(w);return e.debug("[PKG.file.bytes] read succeeded, size:",{size:m.length}),new Uint8Array(m.buffer,m.byteOffset,m.byteLength)},async arrayBuffer(){let m=await oe__default.default.readFile(w);return m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength)},get type(){let m=me__default.default.extname(w).toLowerCase();return {".txt":"text/plain",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".json":"application/json",".xml":"application/xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".pdf":"application/pdf",".zip":"application/zip",".wav":"audio/wav",".mp3":"audio/mpeg",".mp4":"video/mp4",".webm":"video/webm"}[m]||"application/octet-stream"},async write(m){let f;if(m instanceof Response){let u=await m.arrayBuffer();f=new Uint8Array(u);}else f=m;await oe__default.default.writeFile(w,f);},async json(){let m=await oe__default.default.readFile(w,"utf-8");return JSON.parse(m)},async stat(){return await oe__default.default.stat(w)}}}A.file=i;async function c(w,m,f){let u;if(m instanceof Response){let y=await m.arrayBuffer();u=new Uint8Array(y);}else u=m;await oe__default.default.writeFile(w,u,f?{mode:f.mode}:void 0);}A.write=c;function p(w,m,f){Le__default.default.writeFileSync(w,m,f?{mode:f.mode}:void 0);}A.writeSync=p;function l(w,m="utf-8"){return Le__default.default.readFileSync(w,m)}A.readSync=l;function d(w,m){let f,u;if(typeof w=="object"&&"cmd"in w){let T=w;f=T.cmd,u={cwd:T.cwd,env:T.env,stdout:T.stdout,stderr:T.stderr,stdin:T.stdin,signal:T.signal,windowsHide:T.windowsHide,shell:T.shell};}else f=Array.isArray(w)?w:[w],u=m||{};if(!f||f.length===0||!f[0])throw new Error("Spawn command cannot be empty");let y=[u.stdin==="inherit"?"inherit":u.stdin==="null"?"ignore":"pipe",u.stdout==="inherit"?"inherit":u.stdout==="null"?"ignore":"pipe",u.stderr==="inherit"?"inherit":u.stderr==="null"?"ignore":"pipe"],x={cwd:u.cwd,env:u.env?{...process.env,...u.env}:process.env,stdio:y,timeout:u.timeout};u.shell!==void 0&&(x.shell=u.shell),process.platform==="win32"&&(x.windowsHide=u.windowsHide??true);let h=child_process.spawn(f[0],f.slice(1),x),S;if(u.signal){S=()=>{h.kill();},u.signal.addEventListener("abort",S,{once:true});let T=()=>{S&&(u.signal?.removeEventListener("abort",S),S=void 0);};h.on("close",T),h.on("error",T);}let P=new Promise((T,M)=>{let I=false,H=()=>{I||(I=true,h.removeAllListeners());};if(h.on("close",B=>{H(),T(B??0);}),h.on("error",B=>{H(),M(B);}),u.timeout!==false){let B=u.timeout||3e5;setTimeout(()=>{if(!I){e.debug(`Process timeout after ${B}ms, killing process`,{cmd:f.join(" ")}),H();try{h.kill("SIGKILL");}catch{}M(new Error(`Process timeout after ${B}ms: ${f.join(" ")}`));}},B);}});return {stdout:h.stdout,stderr:h.stderr,stdin:h.stdin,pid:h.pid,exited:P,exitCode:h.exitCode,kill:T=>h.kill(T)}}A.spawn=d;async function g(w,m){let f=m?.stdin??"null",u=m?.stdout??"pipe",y=m?.stderr??"pipe",x=d(w,{cwd:m?.cwd,env:m?.env,stdin:f,stdout:u,stderr:y,windowsHide:m?.windowsHide,shell:m?.shell}),h=[],S=[];u==="pipe"&&x.stdout?.on("data",T=>{h.push(T);}),y==="pipe"&&x.stderr?.on("data",T=>{S.push(T);});let P=m?.timeout&&m.timeout>0?setTimeout(()=>{try{x.kill("SIGKILL");}catch{}x.stdout?.destroy(),x.stderr?.destroy(),x.stdin?.end();},m.timeout):void 0;try{let T=await x.exited;return clearTimeout(P),u==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),f==="pipe"&&x.stdin?.end(),{code:T,stdout:Buffer.concat(h).toString("utf-8"),stderr:Buffer.concat(S).toString("utf-8")}}catch(T){return clearTimeout(P),u==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),f==="pipe"&&x.stdin?.end(),{code:-1,stdout:Buffer.concat(h).toString("utf-8"),stderr:Buffer.concat(S).toString("utf-8")||(T instanceof Error?T.message:String(T))}}}A.run=g;async function k(w,m={},f={}){let u=d(w,{cwd:m.cwd,env:m.env,stdout:"pipe",stderr:"pipe",stdin:"null"}),y="",x="";u.stdout?.on("data",S=>{let P=S.toString("utf-8");y+=P,f.onStdout?.(P);}),u.stderr?.on("data",S=>{let P=S.toString("utf-8");x+=P,f.onStderr?.(P);});let h=m.timeout&&m.timeout>0?setTimeout(()=>{try{u.kill("SIGKILL");}catch{}u.stdout?.destroy(),u.stderr?.destroy();},m.timeout):void 0;try{let S=await u.exited;return clearTimeout(h),f.onExit?.(S),{code:S,stdout:y,stderr:x}}catch(S){clearTimeout(h);let P=S instanceof Error?S.message:String(S);return {code:-1,stdout:y,stderr:x||P}}}A.runWithStream=k;async function E(w){if(typeof w.pipeThrough=="function")try{let y=new TextDecoderStream("utf-8"),h=w.pipeThrough(y).getReader(),S="";try{for(;;){let{done:P,value:T}=await h.read();if(P)break;S+=T;}return S}finally{h.releaseLock();}}catch{}let m=w.getReader(),f=new TextDecoder("utf-8"),u=[];try{for(;;){let{done:y,value:x}=await m.read();if(y)break;u.push(f.decode(x,{stream:!0}));}return u.push(f.decode()),u.join("")}finally{m.releaseLock();}}A.readableStreamToText=E;async function D(w){let m=[];return new Promise((f,u)=>{w.on("data",y=>{typeof y=="string"?m.push(Buffer.from(y)):m.push(y);}),w.on("end",()=>{try{let x=Buffer.concat(m).toString("utf-8");f(x);}catch(y){u(y);}}),w.on("error",y=>{u(y);});})}A.nodeReadableStreamToText=D;function U(w,m=0){let P=new TextEncoder().encode(w),T=P.length,M,I=0;if(T>=16){let F=T-16,$=m+2654435761+2246822519|0,Q=m+2246822519|0,J=m+0|0,Z=m-2654435761|0;for(;I<=F;)$=H($,z(P,I)),I+=4,Q=H(Q,z(P,I)),I+=4,J=H(J,z(P,I)),I+=4,Z=H(Z,z(P,I)),I+=4;M=B($,1)+B(Q,7)+B(J,12)+B(Z,18)|0;}else M=m+374761393|0;for(M=M+T|0;I+4<=T;)M=M+z(P,I)*3266489917|0,M=B(M,17)*668265263|0,I+=4;for(;I<T;)M=M+P[I]*374761393|0,M=B(M,11)*2654435761|0,I++;return M^=M>>>15,M=M*2246822519|0,M^=M>>>13,M=M*3266489917|0,M^=M>>>16,M>>>0;function H(F,$){return F=F+$*2246822519|0,F=B(F,13),F=F*2654435761|0,F}function B(F,$){return F<<$|F>>>32-$|0}function z(F,$){return (F[$]|F[$+1]<<8|F[$+2]<<16|F[$+3]<<24)>>>0}}A.xxHash32=U;function W(w){let m=0;for(let f of w){let u=f.codePointAt(0)||f.charCodeAt(0);u<127?m+=1:u>=4352&&u<=4447||u>=9001&&u<=9002||u>=11904&&u<=42191&&u!==12351||u>=44032&&u<=55203||u>=63744&&u<=64255||u>=65040&&u<=65049||u>=65072&&u<=65135||u>=65280&&u<=65376||u>=65504&&u<=65510?m+=2:m+=1;}return m}A.stringWidth=W;class N{constructor(m){chunkVRQQ33YH_cjs.c(this,"pattern");this.pattern=m;}async*scan(m){let f=chunkAHO55TRS_cjs.b.stream(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for await(let u of f)yield hn(u);}*scanSync(m){let f=chunkAHO55TRS_cjs.a(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for(let u of f)yield hn(u);}match(m){return minimatch.minimatch(m,this.pattern)}}A.Glob=N,A.stdin=process.stdin,A.stdout=process.stdout,A.stderr=process.stderr,A.sleep=w=>new Promise(m=>setTimeout(m,w)),A.color=(w,m)=>({black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",blink:"\x1B[5m",inverse:"\x1B[7m",hidden:"\x1B[8m",strikethrough:"\x1B[9m",reset:"\x1B[0m"})[w.toLowerCase()]||null,A.hash={xxHash32:A.xxHash32},A.build=ln.build,A.server=se,A.nodeWebSocket=nodeWs.createNodeWebSocket,A.restServer=at,A.rpcServer=it,A.streamingServer=lt,A.webSocketServer=ct;})(exports.PKG||(exports.PKG={}));var Pr=exports.PKG.readableStreamToText;exports.PKG.nodeReadableStreamToText;exports.PKG.which;var Mr=exports.PKG.whichSync;exports.PKG.spawn;exports.PKG.run;var xn=200,wn={bash:{login:true,posix:true},dash:{login:true,posix:true},fish:{deny:true,login:true},ksh:{login:true,posix:true},nu:{deny:true},powershell:{ps:true},pwsh:{ps:true},sh:{login:true,posix:true},zsh:{login:true,posix:true}};exports.Shell=void 0;(m=>{let e=chunkWWPI6PC4_cjs.a.create({service:"shell"});async function t(f,u){let y=f.pid;if(!(!y||u?.exited?.())){if(process.platform==="win32"){await new Promise(x=>{let h=child_process.spawn("taskkill",["/pid",String(y),"/f","/t"],{stdio:"ignore",windowsHide:true});h.once("exit",()=>x()),h.once("error",()=>x());});return}try{process.kill(-y,"SIGTERM"),await promises.setTimeout(xn),u?.exited?.()||process.kill(-y,"SIGKILL");}catch{f.kill("SIGTERM"),await promises.setTimeout(xn),u?.exited?.()||f.kill("SIGKILL");}}}m.killTree=t;function n(f){if(process.platform!=="win32"||!f.includes("/")&&!f.includes("\\")&&!f.includes(":"))return f;let u=chunkJL3GR4P7_cjs.c.normalize(f);return E(u)==="bash"&&g()||u}function r(f){return wn[E(f)]}function o(f){return r(f)?.deny!==true}function s(f){return chunkJL3GR4P7_cjs.c.isAbsolute(f)}function a(f){let u=n(f);if(s(u))return chunkJL3GR4P7_cjs.c.stat(u)?.isFile()?u:void 0;let y=exports.PKG.whichSync(u);return y?chunkJL3GR4P7_cjs.c.normalize(y):void 0}function i(){return Array.from(new Set([exports.PKG.whichSync("pwsh"),exports.PKG.whichSync("powershell"),g(),process.env.COMSPEC||"cmd.exe"].filter(f=>!!f).map(n)))}async function c(){let f=await chunkJL3GR4P7_cjs.c.readText("/etc/shells").catch(()=>"");return f?Array.from(new Set(f.split(`
16
- `).filter(u=>u.trim()&&!u.startsWith("#")))):["/bin/bash","/bin/zsh","/bin/sh"]}function p(f,u){if(f&&(!u?.acceptable||o(f))){let y=a(f);if(y)return y}return process.platform==="win32"?i()[0]:k()}m.defaultPreferred=Ae(()=>p(process.env.SHELL)),m.defaultAcceptable=Ae(()=>p(process.env.SHELL,{acceptable:true}));function g(){if(process.platform!=="win32")return;if(process.env.EASBOT_GIT_BASH_PATH)return chunkJL3GR4P7_cjs.c.normalize(process.env.EASBOT_GIT_BASH_PATH);let f=exports.PKG.whichSync("git");if(!f)return;let u=chunkJL3GR4P7_cjs.c.normalize(me__default.default.join(f,"..","..","bin","bash.exe"));if((chunkJL3GR4P7_cjs.c.stat(u)?.size??0)>0)return u}m.gitbash=g;function k(){if(process.platform==="win32"){let u=g();return u||"/bin/sh"}if(process.platform==="darwin")return "/bin/zsh";let f=exports.PKG.whichSync("bash");return f?chunkJL3GR4P7_cjs.c.normalize(f):"/bin/sh"}function E(f){return me__default.default.posix.basename(chunkJL3GR4P7_cjs.c.toUnixPath(f)).toLowerCase()}m.name=E;function D(f){return r(f)?.login===true}m.login=D;function U(f){return r(f)?.posix===true}m.posix=U;function W(f){return r(f)?.ps===true}m.ps=W;function N(f){let u=n(f),y=E(u);return {path:u,name:y,acceptable:o(y)}}function ie(f,u,y){let x=E(f),h=re(u),S=fe(h[0]??u,h.slice(1));return x==="nu"||x==="fish"?["-c",S]:x==="zsh"?["-l","-c",`
12
+ ${H}`,truncated:true,outputPath:N,originalLength:a.length,removedLength:W,label:l}}s.truncate=r;function o(a){return a.truncated?n(a.outputPath,a.label):""}s.formatHint=o;})(exports.TruncateContent||(exports.TruncateContent={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function rt(e,t=true){let n=typeof e=="number"?new Date(e):e,r=n.getTimezoneOffset(),o=Math.floor(Math.abs(r)/60),s=Math.abs(r)%60,i=`${r<=0?"+":"-"}${String(o).padStart(2,"0")}:${String(s).padStart(2,"0")}`,c=n.getFullYear(),p=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0"),f=String(n.getHours()).padStart(2,"0"),h=String(n.getMinutes()).padStart(2,"0"),v=String(n.getSeconds()).padStart(2,"0"),E=`${c}-${p}-${l}T${f}:${h}:${v}`;if(t){let N=String(n.getMilliseconds()).padStart(3,"0");E+=`.${N}`;}return E+=i,E}function ot(e){return rt(e,false)}function Yt(){return Date.now()}function Xn(e=true){return rt(Yt(),e)}function Qn(e){return e.includes("+")||e.includes("-")?new Date(e):new Date(e)}function er(e){let t=typeof e=="number"?new Date(e):e,n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return `${n}-${r}-${o}T${s}:${a}:${i}`}function tr(e=new Date){let t=e.getTimezoneOffset(),n=Math.floor(Math.abs(t)/60),r=Math.abs(t)%60;return `${t<=0?"+":"-"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}exports.SessionTitle=void 0;(i=>{let e="New session - ",t="Child session - ";i.parentTitlePrefix=e,i.childTitlePrefix=t;function o(c=false){return (c?t:e)+ot(new Date)}i.createDefault=o;function s(c){return new RegExp(`^(${e}|${t})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(c)}i.isDefault=s;function a(c){let p=c.match(/^(.+) \(fork #(\d+)\)$/);if(p){let l=p[1]??"",f=parseInt(p[2]??"0",10);return `${l} (fork #${f+1})`}return `${c} (fork #1)`}i.getForked=a;})(exports.SessionTitle||(exports.SessionTitle={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Vt(e){let t,n=false,r=()=>(n||(t=e(),n=true),t);return r.reset=()=>{n=false,t=void 0;},r}var Fe=Vt;function Gt(e){let t,n=()=>(t||(t=e()),t);return n.reset=()=>{t=void 0;},n}var nr=Gt;exports.Lazy=void 0;(n=>(n.lazy=Vt,n.lazyAsync=Gt))(exports.Lazy||(exports.Lazy={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();var ne=chunkWWPI6PC4_cjs.a.create({service:"server"});function se(e={}){let t=e.port??3e3,n=e.hostname??"0.0.0.0",r=new hono.Hono({strict:true,getPath:a=>{try{return new URL(a.url).pathname}catch{return a.url}}});if(e.onError?r.onError(e.onError):r.onError((a,i)=>(ne.error("Server error",{error:a.message,stack:a.stack}),a instanceof httpException.HTTPException?a.getResponse():i.json({error:"Internal Server Error",message:a.message},500))),e.onNotFound?r.notFound(e.onNotFound):r.notFound(a=>a.json({error:"Not Found",path:a.req.path},404)),!e.websockets&&e.cors&&r.use(cors.cors(typeof e.cors=="boolean"?{origin:"*"}:e.cors)),r.use(logger.logger((a,...i)=>ne.info(a,i))),!e.websockets&&e.secureHeaders&&r.use(secureHeaders.secureHeaders()),!e.websockets&&e.compression&&r.use(compress.compress({encoding:"gzip"})),!e.websockets&&e.timeout&&r.use(timeout.timeout(e.timeout)),e.middlewares)for(let a of e.middlewares)a.path?r.use(a.path,a.handler):r.use(a.handler);if(e.routes)for(let a of e.routes){let i=a.middlewares||[],c=a.method.toUpperCase();a.validation?r.on(c,a.path,zodValidator.zValidator("json",a.validation),...i,a.handler):r.on(c,a.path,...i,a.handler);}e.rpc&&r.post("/rpc/:method",async a=>{let i=a.req.param("method"),c=e.rpc?.[i];if(!c)return a.json({error:"RPC method not found"},404);try{let p=await a.req.json(),l=await c(p,a);return a.json({result:l})}catch(p){return ne.error("RPC error",{method:i,error:p.message}),a.json({error:"RPC execution failed",message:p.message},500)}}),e.fetch&&r.all("*",async a=>await e.fetch(a.req.raw));let o=null,s={url:new URL(`http://${n}:${t}`),port:t,hostname:n,hono:r,async stop(a=false){return o?new Promise((i,c)=>{a&&o.closeAllConnections?.(),o.close(p=>{p?(ne.error("Error closing server",{error:p.message}),c(p)):(o=null,ne.info(`Server on port ${t} stopped`),i());}),setTimeout(()=>{ne.warn(`Server shutdown timeout on port ${t}`),o=null,i();},5e3);}):Promise.resolve()},get raw(){return o||void 0}};return ne.debug("createServer: calling serve()",{port:t,hostname:n}),o=nodeServer.serve({fetch:r.fetch,port:t,hostname:n}),ne.debug("createServer: serve() returned, server created"),ne.info(`Server running on http://${n}:${t}`),s}function it(e){return se({rpc:e,port:3e3})}function ir(e,t=3e3,n="0.0.0.0"){return se({fetch:e,port:t,hostname:n})}function at(e,t={}){return se({...t,routes:e})}function ct(e,t={}){return se({...t,websockets:e})}function lt(e,t={}){let n=Object.entries(e).map(([r,o])=>({method:"get",path:`/stream/${r}`,handler:s=>streaming.streamSSE(s,async a=>{for await(let i of o(s))await a.writeSSE(i);})}));return se({...t,routes:n,streaming:true})}chunkVRQQ33YH_cjs.j();var ie=chunkWWPI6PC4_cjs.a.create({service:"build-api"});async function cn(){try{return {available:!0,version:(await import('./chunks/main-RIJAJS2R.cjs')).version||"unknown"}}catch(e){return ie.warn("esbuild not available",{error:e.message}),{available:false}}}async function Ae(){let e=await cn();if(!e.available)throw new Error("esbuild is required but not installed. Please install it using: pnpm add -D esbuild");e.version&&e.version<"0.17.0"&&ie.warn(`esbuild version ${e.version} may have limited features. Consider upgrading to 0.17+`);}function ur(e){if(e!==void 0)return typeof e=="boolean"?{target:void 0}:typeof e=="string"?{target:e}:e}function ln(e){let t=ur(e.compile);t&&ie.warn("compile option is no longer supported (Bun runtime removed). The option will be ignored.");let n={entryPoints:e.entrypoints,outdir:e.outdir,bundle:e.bundle??true,conditions:e.conditions,external:e.external,format:e.format??"esm",platform:e.platform??(e.target==="browser"?"browser":"node"),minify:e.minify??false,treeShaking:true,splitting:e.splitting,sourcemap:dr(e.sourcemap),sourcesContent:true,define:e.define,inject:e.inject,legalComments:"eof",loader:e.loader,entryNames:e.entryNames,chunkNames:e.chunkNames,assetNames:e.assetNames,publicPath:e.publicPath,tsconfig:e.tsconfig,charset:"utf8",color:true,logLevel:"info",logLimit:50,plugins:e.plugins??[],metafile:true,write:e.write??true};return t?.outfile&&!e.outdir&&(n.outfile=t.outfile,delete n.outdir),e.target&&(n.target=fr(e.target)),e.minify===true&&(n.minifyWhitespace=true,n.minifyIdentifiers=true,n.minifySyntax=true),pr(n)}function dr(e){return !e||e==="none"?false:e}function fr(e){let t={browser:"es2020",node:"node16",bun:"esnext"};return e?t[e]||e:"esnext"}function pr(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function $e(e){if(e!==void 0)return e.replace(/\\/g,"/")}function rn(e,t,n){let r=[];if(e.outputFiles)for(let s of e.outputFiles)r.push({path:$e(s.path)||s.path,size:s.contents?.length||0});if(e.metafile?.outputs)for(let[s,a]of Object.entries(e.metafile.outputs)){let i=a;r.some(c=>c.path===s||c.path===$e(s))||r.push({path:$e(s)||s,size:i.bytes||0});}let o=[];if(e.errors?.length>0)for(let s of e.errors)o.push({level:"error",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});if(e.warnings?.length>0)for(let s of e.warnings)o.push({level:"warning",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});return {outputs:r,success:e.errors?.length===0,logs:o,metafile:e.metafile}}async function dt(e){ie.info("Build started",{entrypoints:e.entrypoints,target:e.target,format:e.format,compile:typeof e.compile}),await Ae();let t=await import('./chunks/main-RIJAJS2R.cjs'),n=Date.now();try{let r=ln(e);ie.debug("esbuild options",r);let o=await t.build(r),s=Date.now();return ie.info("Build completed",{duration:s-n,outputs:(o?.outputFiles?.length??0)>0||Object.keys(o.metafile?.outputs||{}).length>0}),rn(o,n,s)}catch(r){let o=Date.now(),s=r.message;return ie.error("Build failed",{error:s,duration:o-n}),r&&typeof r=="object"&&"errors"in r?rn(r):{outputs:[],success:false,logs:[{level:"error",message:s}],metafile:void 0}}}var xr={build:dt},un=xr;chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function re(e){let t=[],n="",r=0;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r++;for(;r<e.length;){let o=e[r];if(o===" "||o===" "){for(n.length>0&&(t.push(n),n="");r<e.length&&(e[r]===" "||e[r]===" ");)r++;continue}if(o==='"'){for(r++;r<e.length;){let s=e[r];if(s==="\\"&&r+1<e.length){let a=e[r+1];if(a==='"'||a==="\\"||a==="$"||a==="`"){n+=a,r+=2;continue}}if(s==='"'){r++;break}n+=s,r++;}continue}if(o==="'"){for(r++;r<e.length;){let s=e[r];if(s==="'"){r++;break}n+=s,r++;}continue}n+=o,r++;}return n.length>0&&t.push(n),t}function dn(e){return /[|&;<>()$`!#]/.test(e)}function fn(e){let t=re(e);if(t.length===0)return {command:"",args:[]};let n={command:t[0],args:t.slice(1)};if(n.args.length>0){let r=n.args[n.args.length-1];try{let o=JSON.parse(r);typeof o=="object"&&o!==null&&!Array.isArray(o)&&(n.options=o,n.args=n.args.slice(0,-1));}catch{}}return n}function ft(e,t=process.platform==="win32"?"windows":"unix"){return t==="windows"?e.includes(" ")||e.includes("&")||e.includes("|")||e.includes("<>")||e.includes("^")||e.includes('"')||e.includes("%")?`"${e.replace(/%/g,"%%").replace(/"/g,'^"')}"`:e:e.includes(" ")||e.includes("'")||e.includes('"')||e.includes("$")||e.includes("`")||e.includes("\\")||e.includes("!")||e.includes("#")||e.includes("&")||e.includes("*")||e.includes("?")||e.includes("|")||e.includes("<")||e.includes(">")||e.includes("(")||e.includes(")")||e.includes(";")?`'${e.replace(/'/g,"'\\''")}'`:e}var wr=new Set(["&&","||","|",";","&",">","<",">>","<<","2>","2>>","1>","1>>","2>&1","2>&2","1>&1","1>&2",">&","<&",">&1","<&1",">&2","<&2"]);function pn(e,t=process.platform==="win32"?"windows":"unix"){return wr.has(e)?e:ft(e,t)}function mn(){return process.platform==="win32"?"windows":"unix"}function ue(e,t,n=process.platform==="win32"?"windows":"unix"){let r=t.map(o=>pn(o,n));return [e,...r].join(" ")}function gn(e){if(e==null)return "";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>gn(t)).join(" ");if(e&&typeof e=="object"){if("raw"in e)return String(e.raw);if("toString"in e&&typeof e.toString=="function")return e.toString();if(e instanceof ReadableStream)throw new Error("ReadableStream expressions are not yet supported")}return String(e)}function Sr(e,t,n){return {stdout:e,stderr:t,exitCode:n,text(r="utf-8"){return e.toString(r)},json(){let r=e.toString("utf-8");return JSON.parse(r)},arrayBuffer(){let r=e.buffer;if(r instanceof ArrayBuffer)return r.slice(e.byteOffset,e.byteOffset+e.byteLength);let o=new ArrayBuffer(e.byteLength),s=new Uint8Array(o),a=new Uint8Array(r,e.byteOffset,e.byteLength);return s.set(a),o},bytes(){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},blob(){let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return new Blob([r])}}}function de(e,t={}){let n=re(e);if(n.length===0)throw new Error("Empty shell command");let r=async()=>{let s=await exports.PKG.run(n,{cwd:t.cwd,env:t.env}),a=Sr(Buffer.from(s.stdout,"utf-8"),Buffer.from(s.stderr,"utf-8"),s.code);if(s.code!==0&&!t.nothrow)throw Object.assign(new Error(`Command failed with exit code ${s.code}: ${e}
13
+ ${s.stderr}`),{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode});return a},o=r();return Object.defineProperty(o,"stdin",{get(){throw new Error("stdin is not yet supported in EasbotShell. Use PKG.spawn for interactive commands.")},enumerable:true}),o.cwd=function(s){return de(e,{...t,cwd:s})},o.env=function(s){return de(e,{...t,env:s})},o.quiet=function(){return de(e,{...t,quiet:true})},o.lines=async function*(){let i=(await r()).text().split(/\r?\n/);for(let c of i)c.trim()&&(yield c);},o.text=async function(s="utf-8"){return (await r()).text(s)},o.json=async function(){return (await r()).json()},o.arrayBuffer=async function(){return (await r()).arrayBuffer()},o.blob=async function(){return (await r()).blob()},o.nothrow=function(){return de(e,{...t,nothrow:true})},o.throws=function(s){return de(e,{...t,nothrow:!s})},o}var we=class{constructor(t={}){chunkVRQQ33YH_cjs.c(this,"options");this.options=t;}call(t,...n){let r="";for(let o=0;o<t.length;o++)r+=t[o],o<n.length&&n[o]!==void 0&&(r+=gn(n[o]));return de(r,this.options)}braces(t){let n=t.match(/^(.*?)\{([^}]+)\}(.*)$/);if(!n)return [t];let[,r="",o="",s=""]=n,a=o.split(",").map(c=>c.trim()),i=[];for(let c of a){let p=`${r}${c}${s}`;p.includes("{")?i.push(...this.braces(p)):i.push(p);}return i}escape(t){return process.platform==="win32"?t.replace(/([&|<>^"%])/g,"^$1"):t.replace(/(["\s'$`\\!*?#&;()<>|])/g,"\\$1")}env(t){return ae({...this.options,env:t})}cwd(t){return ae({...this.options,cwd:t})}nothrow(){return ae({...this.options,nothrow:true})}throws(t){return ae({...this.options,nothrow:!t})}};function ae(e={}){let t=new we(e);return new Proxy(t,{apply(n,r,o){return t.call(o[0],...o.slice(1))}})}var hn=ae();function bn(e){return e.replace(/\\/g,"/")}function yn(e){return crypto$1.createHash("md5").update(e).digest("hex").slice(0,8)}var X=new Map;exports.PKG=void 0;(_=>{let e=chunkWWPI6PC4_cjs.a.create({service:"pkg"});async function t(S){let m=S?[S]:["npm","pnpm","bun"];for(let d of m){let u=await _.which(d);if(u)return {name:d,path:u}}}_.packageManager=t;async function n(S,m){if(!S)return process.execPath;let d=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?d+fe__default.default.delimiter+u:d,x=yn(y),g=`${S}:${x}`;if(X.has(g))return X.get(g);let R=process.platform==="win32"?"where":"which";try{let{spawn:T}=await import('child_process');return new Promise(k=>{let I=T(R,[S],{env:{...process.env,PATH:y},stdio:["pipe","pipe","ignore"],windowsHide:!0}),z="",L="";I.stdout?.on("data",D=>{z+=D.toString();}),I.stderr?.on("data",D=>{L+=D.toString();}),I.on("close",D=>{if(D===0&&z.trim()){let F=z.trim().split(`
14
+ `),$=F.length>0?F[0]?.trim():null;if($){X.set(g,$),k($);return}}X.set(g,null),k(null);}),setTimeout(()=>{I.kill(),X.set(g,null),k(null);},5e3);})}catch{return X.set(g,null),null}}_.which=n;function r(S,m){if(!S)return process.execPath;let d=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?d+fe__default.default.delimiter+u:d,x=yn(y),g=`${S}:${x}`;if(X.has(g))return X.get(g);let R=process.platform==="win32"?"where":"which";try{let T=child_process.execSync(`${R} ${S}`,{encoding:"utf-8",stdio:["pipe","pipe","ignore"],env:{...process.env,PATH:y},timeout:5e3,windowsHide:!0});if(T.trim()){let k=T.trim().split(`
15
+ `),I=k.length>0?k[0]?.trim():null;if(I)return X.set(g,I),I}}catch{}return X.set(g,null),null}_.whichSync=r;function o(){X.clear();}_.clearWhichCache=o;let s=module$1.createRequire(chunkVRQQ33YH_cjs.i);async function a(S,m,d){try{let u=[];if(d?.extraPaths)for(let y of d.extraPaths){let x=fe__default.default.join(y,"node_modules");u.push(x);}return m&&u.push(m),u.length>0?s.resolve(S,{paths:u}):s.resolve(S)}catch(u){throw new Error(`Cannot resolve module "${S}"${m?` from "${m}"`:""}: ${u instanceof Error?u.message:String(u)}`)}}_.resolve=a;function i(S){return {get name(){return fe__default.default.basename(S)},async exists(){try{return await oe__default.default.access(S),!0}catch{return false}},async getSize(){try{return (await oe__default.default.stat(S)).size}catch{return}},async text(){return await oe__default.default.readFile(S,"utf-8")},textSync(){return Le__default.default.readFileSync(S,"utf-8")},jsonSync(){let m=Le__default.default.readFileSync(S,"utf-8");return JSON.parse(m)},async bytes(){e.debug("[PKG.file.bytes] reading file:",{filePath:S});let m=await oe__default.default.readFile(S);return e.debug("[PKG.file.bytes] read succeeded, size:",{size:m.length}),new Uint8Array(m.buffer,m.byteOffset,m.byteLength)},async arrayBuffer(){let m=await oe__default.default.readFile(S);return m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength)},get type(){let m=fe__default.default.extname(S).toLowerCase();return {".txt":"text/plain",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".json":"application/json",".xml":"application/xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".pdf":"application/pdf",".zip":"application/zip",".wav":"audio/wav",".mp3":"audio/mpeg",".mp4":"video/mp4",".webm":"video/webm"}[m]||"application/octet-stream"},async write(m){let d;if(m instanceof Response){let u=await m.arrayBuffer();d=new Uint8Array(u);}else d=m;await oe__default.default.writeFile(S,d);},async json(){let m=await oe__default.default.readFile(S,"utf-8");return JSON.parse(m)},async stat(){return await oe__default.default.stat(S)}}}_.file=i;async function c(S,m,d){let u;if(m instanceof Response){let y=await m.arrayBuffer();u=new Uint8Array(y);}else u=m;await oe__default.default.writeFile(S,u,d?{mode:d.mode}:void 0);}_.write=c;function p(S,m,d){Le__default.default.writeFileSync(S,m,d?{mode:d.mode}:void 0);}_.writeSync=p;function l(S,m="utf-8"){return Le__default.default.readFileSync(S,m)}_.readSync=l;function f(S,m){let d,u;if(typeof S=="object"&&"cmd"in S){let T=S;d=T.cmd,u={cwd:T.cwd,env:T.env,stdout:T.stdout,stderr:T.stderr,stdin:T.stdin,signal:T.signal,windowsHide:T.windowsHide,shell:T.shell};}else d=Array.isArray(S)?S:[S],u=m||{};if(!d||d.length===0||!d[0])throw new Error("Spawn command cannot be empty");let y=[u.stdin==="inherit"?"inherit":u.stdin==="null"?"ignore":"pipe",u.stdout==="inherit"?"inherit":u.stdout==="null"?"ignore":"pipe",u.stderr==="inherit"?"inherit":u.stderr==="null"?"ignore":"pipe"],x={cwd:u.cwd,env:u.env?{...process.env,...u.env}:process.env,stdio:y,timeout:u.timeout};u.shell!==void 0&&(x.shell=u.shell),process.platform==="win32"&&(x.windowsHide=u.windowsHide??true);let g=child_process.spawn(d[0],d.slice(1),x),w;if(u.signal){w=()=>{g.kill();},u.signal.addEventListener("abort",w,{once:true});let T=()=>{w&&(u.signal?.removeEventListener("abort",w),w=void 0);};g.on("close",T),g.on("error",T);}let R=new Promise((T,k)=>{let I=false,z=()=>{I||(I=true,g.removeAllListeners());};if(g.on("close",L=>{z(),T(L??0);}),g.on("error",L=>{z(),k(L);}),u.timeout!==false){let L=u.timeout||3e5;setTimeout(()=>{if(!I){e.debug(`Process timeout after ${L}ms, killing process`,{cmd:d.join(" ")}),z();try{g.kill("SIGKILL");}catch{}k(new Error(`Process timeout after ${L}ms: ${d.join(" ")}`));}},L);}});return {stdout:g.stdout,stderr:g.stderr,stdin:g.stdin,pid:g.pid,exited:R,exitCode:g.exitCode,kill:T=>g.kill(T)}}_.spawn=f;async function h(S,m){let d=m?.stdin??"null",u=m?.stdout??"pipe",y=m?.stderr??"pipe",x=f(S,{cwd:m?.cwd,env:m?.env,stdin:d,stdout:u,stderr:y,windowsHide:m?.windowsHide,shell:m?.shell}),g=[],w=[];u==="pipe"&&x.stdout?.on("data",T=>{g.push(T);}),y==="pipe"&&x.stderr?.on("data",T=>{w.push(T);});let R=m?.timeout&&m.timeout>0?setTimeout(()=>{try{x.kill("SIGKILL");}catch{}x.stdout?.destroy(),x.stderr?.destroy(),x.stdin?.end();},m.timeout):void 0;try{let T=await x.exited;return clearTimeout(R),u==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),d==="pipe"&&x.stdin?.end(),{code:T,stdout:Buffer.concat(g).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")}}catch(T){return clearTimeout(R),u==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),d==="pipe"&&x.stdin?.end(),{code:-1,stdout:Buffer.concat(g).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")||(T instanceof Error?T.message:String(T))}}}_.run=h;async function v(S,m={},d={}){let u=f(S,{cwd:m.cwd,env:m.env,stdout:"pipe",stderr:"pipe",stdin:"null"}),y="",x="";u.stdout?.on("data",w=>{let R=w.toString("utf-8");y+=R,d.onStdout?.(R);}),u.stderr?.on("data",w=>{let R=w.toString("utf-8");x+=R,d.onStderr?.(R);});let g=m.timeout&&m.timeout>0?setTimeout(()=>{try{u.kill("SIGKILL");}catch{}u.stdout?.destroy(),u.stderr?.destroy();},m.timeout):void 0;try{let w=await u.exited;return clearTimeout(g),d.onExit?.(w),{code:w,stdout:y,stderr:x}}catch(w){clearTimeout(g);let R=w instanceof Error?w.message:String(w);return {code:-1,stdout:y,stderr:x||R}}}_.runWithStream=v;async function E(S){if(typeof S.pipeThrough=="function")try{let y=new TextDecoderStream("utf-8"),g=S.pipeThrough(y).getReader(),w="";try{for(;;){let{done:R,value:T}=await g.read();if(R)break;w+=T;}return w}finally{g.releaseLock();}}catch{}let m=S.getReader(),d=new TextDecoder("utf-8"),u=[];try{for(;;){let{done:y,value:x}=await m.read();if(y)break;u.push(d.decode(x,{stream:!0}));}return u.push(d.decode()),u.join("")}finally{m.releaseLock();}}_.readableStreamToText=E;async function N(S){let m=[];return new Promise((d,u)=>{S.on("data",y=>{typeof y=="string"?m.push(Buffer.from(y)):m.push(y);}),S.on("end",()=>{try{let x=Buffer.concat(m).toString("utf-8");d(x);}catch(y){u(y);}}),S.on("error",y=>{u(y);});})}_.nodeReadableStreamToText=N;function W(S,m=0){let R=new TextEncoder().encode(S),T=R.length,k,I=0;if(T>=16){let F=T-16,$=m+2654435761+2246822519|0,Q=m+2246822519|0,J=m+0|0,Z=m-2654435761|0;for(;I<=F;)$=z($,D(R,I)),I+=4,Q=z(Q,D(R,I)),I+=4,J=z(J,D(R,I)),I+=4,Z=z(Z,D(R,I)),I+=4;k=L($,1)+L(Q,7)+L(J,12)+L(Z,18)|0;}else k=m+374761393|0;for(k=k+T|0;I+4<=T;)k=k+D(R,I)*3266489917|0,k=L(k,17)*668265263|0,I+=4;for(;I<T;)k=k+R[I]*374761393|0,k=L(k,11)*2654435761|0,I++;return k^=k>>>15,k=k*2246822519|0,k^=k>>>13,k=k*3266489917|0,k^=k>>>16,k>>>0;function z(F,$){return F=F+$*2246822519|0,F=L(F,13),F=F*2654435761|0,F}function L(F,$){return F<<$|F>>>32-$|0}function D(F,$){return (F[$]|F[$+1]<<8|F[$+2]<<16|F[$+3]<<24)>>>0}}_.xxHash32=W;function H(S){let m=0;for(let d of S){let u=d.codePointAt(0)||d.charCodeAt(0);u<127?m+=1:u>=4352&&u<=4447||u>=9001&&u<=9002||u>=11904&&u<=42191&&u!==12351||u>=44032&&u<=55203||u>=63744&&u<=64255||u>=65040&&u<=65049||u>=65072&&u<=65135||u>=65280&&u<=65376||u>=65504&&u<=65510?m+=2:m+=1;}return m}_.stringWidth=H;class U{constructor(m){chunkVRQQ33YH_cjs.c(this,"pattern");this.pattern=m;}async*scan(m){let d=chunkAHO55TRS_cjs.b.stream(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for await(let u of d)yield bn(u);}*scanSync(m){let d=chunkAHO55TRS_cjs.a(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for(let u of d)yield bn(u);}match(m){return minimatch.minimatch(m,this.pattern)}}_.Glob=U,_.stdin=process.stdin,_.stdout=process.stdout,_.stderr=process.stderr,_.sleep=S=>new Promise(m=>setTimeout(m,S)),_.color=(S,m)=>({black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",blink:"\x1B[5m",inverse:"\x1B[7m",hidden:"\x1B[8m",strikethrough:"\x1B[9m",reset:"\x1B[0m"})[S.toLowerCase()]||null,_.hash={xxHash32:_.xxHash32},_.build=un.build,_.server=se,_.nodeWebSocket=nodeWs.createNodeWebSocket,_.restServer=at,_.rpcServer=it,_.streamingServer=lt,_.webSocketServer=ct;})(exports.PKG||(exports.PKG={}));var Mr=exports.PKG.readableStreamToText;exports.PKG.nodeReadableStreamToText;exports.PKG.which;var Er=exports.PKG.whichSync;exports.PKG.spawn;exports.PKG.run;var wn=200,Sn={bash:{login:true,posix:true},dash:{login:true,posix:true},fish:{deny:true,login:true},ksh:{login:true,posix:true},nu:{deny:true},powershell:{ps:true},pwsh:{ps:true},sh:{login:true,posix:true},zsh:{login:true,posix:true}};exports.Shell=void 0;(m=>{let e=chunkWWPI6PC4_cjs.a.create({service:"shell"});async function t(d,u){let y=d.pid;if(!(!y||u?.exited?.())){if(process.platform==="win32"){await new Promise(x=>{let g=child_process.spawn("taskkill",["/pid",String(y),"/f","/t"],{stdio:"ignore",windowsHide:true});g.once("exit",()=>x()),g.once("error",()=>x());});return}try{process.kill(-y,"SIGTERM"),await promises.setTimeout(wn),u?.exited?.()||process.kill(-y,"SIGKILL");}catch{d.kill("SIGTERM"),await promises.setTimeout(wn),u?.exited?.()||d.kill("SIGKILL");}}}m.killTree=t;function n(d){if(process.platform!=="win32"||!d.includes("/")&&!d.includes("\\")&&!d.includes(":"))return d;let u=chunkJL3GR4P7_cjs.c.normalize(d);return E(u)==="bash"&&h()||u}function r(d){return Sn[E(d)]}function o(d){return r(d)?.deny!==true}function s(d){return chunkJL3GR4P7_cjs.c.isAbsolute(d)}function a(d){let u=n(d);if(s(u))return chunkJL3GR4P7_cjs.c.stat(u)?.isFile()?u:void 0;let y=exports.PKG.whichSync(u);return y?chunkJL3GR4P7_cjs.c.normalize(y):void 0}function i(){return Array.from(new Set([exports.PKG.whichSync("pwsh"),exports.PKG.whichSync("powershell"),h(),process.env.COMSPEC||"cmd.exe"].filter(d=>!!d).map(n)))}async function c(){let d=await chunkJL3GR4P7_cjs.c.readText("/etc/shells").catch(()=>"");return d?Array.from(new Set(d.split(`
16
+ `).filter(u=>u.trim()&&!u.startsWith("#")))):["/bin/bash","/bin/zsh","/bin/sh"]}function p(d,u){if(d&&(!u?.acceptable||o(d))){let y=a(d);if(y)return y}return process.platform==="win32"?i()[0]:v()}m.defaultPreferred=Fe(()=>p(process.env.SHELL)),m.defaultAcceptable=Fe(()=>p(process.env.SHELL,{acceptable:true}));function h(){if(process.platform!=="win32")return;if(process.env.EASBOT_GIT_BASH_PATH)return chunkJL3GR4P7_cjs.c.normalize(process.env.EASBOT_GIT_BASH_PATH);let d=exports.PKG.whichSync("git");if(!d)return;let u=chunkJL3GR4P7_cjs.c.normalize(fe__default.default.join(d,"..","..","bin","bash.exe"));if((chunkJL3GR4P7_cjs.c.stat(u)?.size??0)>0)return u}m.gitbash=h;function v(){if(process.platform==="win32"){let u=h();return u||"/bin/sh"}if(process.platform==="darwin")return "/bin/zsh";let d=exports.PKG.whichSync("bash");return d?chunkJL3GR4P7_cjs.c.normalize(d):"/bin/sh"}function E(d){return fe__default.default.posix.basename(chunkJL3GR4P7_cjs.c.toUnixPath(d)).toLowerCase()}m.name=E;function N(d){return r(d)?.login===true}m.login=N;function W(d){return r(d)?.posix===true}m.posix=W;function H(d){return r(d)?.ps===true}m.ps=H;function U(d){let u=n(d),y=E(u);return {path:u,name:y,acceptable:o(y)}}function G(d,u,y){let x=E(d),g=re(u),w=ue(g[0]??u,g.slice(1));return x==="nu"||x==="fish"?["-c",w]:x==="zsh"?["-l","-c",`
17
17
  [[ -f ~/.zshenv ]] && source ~/.zshenv >/dev/null 2>&1 || true
18
18
  [[ -f "\${ZDOTDIR:-$HOME}/.zshrc" ]] && source "\${ZDOTDIR:-$HOME}/.zshrc" >/dev/null 2>&1 || true
19
19
  cd -- "$1"
20
- ${S}
20
+ ${w}
21
21
  `,"easbot",y]:x==="bash"?["-l","-c",`${process.platform==="win32"?`cmd /c chcp 65001 >nul 2>&1 || true
22
22
  `:""}shopt -s expand_aliases
23
23
  [[ -f ~/.bashrc ]] && source ~/.bashrc >/dev/null 2>&1 || true
24
24
  cd -- "$1"
25
- ${S}
26
- `,"easbot",y]:/^cmd(\.exe)?$/i.test(x)?["/c",`chcp 65001 >nul 2>&1 && ${S}`]:W(x)?["-NoProfile","-Command",`[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ${S}`]:["-c",S]}m.args=ie;function Oe(f){return f?p(f):(0, m.defaultPreferred)()}m.preferred=Oe;function Ke(f){return f?p(f,{acceptable:true}):(0, m.defaultAcceptable)()}m.acceptable=Ke;function Nt(){m.defaultPreferred.reset(),m.defaultAcceptable.reset();}m.reset=Nt;async function Dt(){return (process.platform==="win32"?i():await c()).filter(u=>a(u)).map(N)}m.list=Dt;function Ie(f){return wn[E(f)]}m.metaInfo=Ie;function O(f){return /[|&;<>()$`!#]/.test(f)}m.needsShell=O;function C(){return process.platform==="win32"?i():["/bin/bash","/bin/zsh","/bin/sh"]}m.platformShells=C;function _(f){return f?!!a(f):false}m.isValid=_;async function V(f){let u=a(f);if(!u)return;let y=E(u);if(!/^cmd(\.exe)?$/i.test(y))try{let x;W(y)?x=["-NoProfile","-Command","$PSVersionTable.PSVersion.ToString()"]:x=["--version"],e.debug(`\u83B7\u53D6 Shell \u7248\u672C: ${u}`,{shell:u,args:x});let h=await exports.PKG.run([u,...x]);if(h.code===0){let S=h.stdout.trim().split(`
27
- `)[0];return e.debug(`Shell \u7248\u672C\u83B7\u53D6\u6210\u529F: ${S}`),S}e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5931\u8D25\uFF0C\u9000\u51FA\u7801: ${h.code}`,{stderr:h.stderr});}catch(x){e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5F02\u5E38: ${x}`);}}m.version=V;class q extends Error{constructor(y,x,h,S){super(y);chunkVRQQ33YH_cjs.c(this,"message",y);chunkVRQQ33YH_cjs.c(this,"pkg",x);chunkVRQQ33YH_cjs.c(this,"version",h);chunkVRQQ33YH_cjs.c(this,"originalError",S);this.name="InstallFailedError";}}m.InstallFailedError=q;async function ue(f,u="latest",y){let{Lock:x}=await import('./chunks/lock-LMCPTUNU.cjs'),{Filesystem:h}=await import('./chunks/filesystem-ALW6PJKX.cjs'),{PackageRegistry:S}=await import('./chunks/registry-LIPZA2EC.cjs');y=y??process.env.EASBOT_CACHE_PATH??me__default.default.join(".easbot","cache");let P=await x.write("pkg-install");try{let T=me__default.default.posix.join(y,"node_modules",f),M=me__default.default.posix.join(y,"package.json"),H=(await h.readJson(M).catch(async()=>{let K={dependencies:{}};return await h.writeJson(M,K),K})).dependencies??{},B=await h.exists(T),z=H[f],F=!1;if(!B||!z)F=!0;else {if(u!=="latest"&&z===u)return T;if(u==="latest"){if(!await S.isOutdated(f,z,y))return T;e.info("Cached version is outdated, proceeding with install",{pkg:f,cachedVersion:z}),F=!0;}}if(!F)return T;let $=m.acceptable(process.platform==="win32"?"cmd":void 0)??k(),Q=`${f}@${u}`;e.info("installing package",{pkg:f,version:u,cache:y,shell:$});let J=await exports.PKG.packageManager();if(!J)throw new q("No package manager found (npm, pnpm, bun)",f,u,"No package manager available");let Z=J.name,Ze=Z==="pnpm"?"add":"install",Xe=`${J.name} ${Ze} --save-exact ${Q}`;e.info(`Using ${Z} to install package`,{pkg:f,version:u,shell:$,pmPath:J.path});try{let K=await m.run($,Xe,{cwd:y,timeout:6e5,windowsHide:!0});if(K.code!==0)throw new Error(`Package manager exited with code ${K.code}: ${K.stderr}`);e.info(`Successfully installed ${f}@${u} with ${Z}`);}catch(K){let zt=K instanceof Error?K:new Error(String(K));if(!await h.exists(T))throw new q(`Failed to install ${f}@${u}`,f,u,zt.message);e.warn("Package install failed but module exists, continuing",{error:zt.message});}let Qe=u;u==="latest"&&(Qe=(await h.readJson(me__default.default.join(T,"package.json")).catch(()=>({})))?.version??"unknown");let Fe=await h.readJson(M);return Fe.dependencies=Fe.dependencies??{},Fe.dependencies[f]=Qe,await h.writeJson(M,Fe),e.info("Package installation completed",{pkg:f,version:Qe,path:T}),T}finally{P[Symbol.dispose]();}}m.install=ue;async function G(f,u,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),S=m.args(x,u,h);e.debug(`run shell process: ${x} ${S.join(" ")}`,{command:u,cwd:h});let{windowsHide:P,env:T,...M}=y??{},I={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...T};process.platform==="win32"&&(I.CHCP="65001");let{stdin:H,stdout:B,stderr:z,timeout:F,signal:$,...Q}=M??{},J={...Q,cwd:h,env:I,windowsHide:process.platform==="win32"?P??true:void 0,shell:Q.shell,timeout:F},Z=E(x),Ze=/^cmd(\.exe)?$/i.test(Z),Xe=process.platform==="win32"&&Ze?"cmd":x;return exports.PKG.run([Xe,...S],J)}m.run=G;function A(f,u,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),S=m.args(x,u,h);e.debug(`Spawn shell process: ${x} ${S.join(" ")}`,{command:u,cwd:h});let{stdin:P,stdout:T,stderr:M,timeout:I,signal:H,windowsHide:B,env:z,...F}=y??{},$={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...z};process.platform==="win32"&&($.CHCP="65001");let Q=E(x),J=/^cmd(\.exe)?$/i.test(Q),Z={...F,cwd:h,env:$,windowsHide:process.platform==="win32"?B??true:void 0,shell:F.shell,timeout:I};return exports.PKG.spawn([J?"cmd":x,...S],Z)}m.spawn=A;function w(f,...u){let y=f.reduce((h,S,P)=>h+S+(u[P]??""),""),x=(h={})=>({quiet:()=>x({...h,quiet:true}),nothrow:()=>x({...h,nothrow:true}),cwd:S=>x({...h,cwd:S}),env:S=>x({...h,env:S}),stdin:S=>x({...h,stdin:S}),stdout:S=>x({...h,stdout:S}),stderr:S=>x({...h,stderr:S}),text:async()=>{let S=re(y.trim());if(S.length===0)throw new Error("Empty command");let P=S[0]??"",T=E(P),M=/^cmd(\.exe)?$/i.test(T),I=process.platform==="win32"&&M?"cmd":Ie(P)?P:void 0,H=fe(P,S.slice(1)),B=await m.run(I,H,{cwd:h.cwd,env:h.env,stdin:h.stdin,stdout:h.stdout,stderr:h.stderr,timeout:h.timeout,windowsHide:process.platform==="win32"?h.windowsHide??true:void 0,shell:h.shell});if(B.code!==0&&!h.nothrow)throw new Error(`Command failed with exit code ${B.code}: ${y}
28
- ${B.stderr}`);return B.stdout},lines:async()=>(await x(h).text()).split(`
29
- `).filter(P=>P.trim()),then:(S,P)=>{let T=re(y.trim()),M=T[0]??"",I=E(M),H=/^cmd(\.exe)?$/i.test(I),B=process.platform==="win32"&&H?"cmd":Ie(M)?M:void 0,z=fe(M,T.slice(1));return m.run(B,z,{cwd:h.cwd,env:h.env,stdin:h.stdin,stdout:h.stdout,stderr:h.stderr,timeout:h.timeout,windowsHide:process.platform==="win32"?h.windowsHide??true:void 0,shell:h.shell}).then(F=>{if(F.code!==0&&!h.nothrow){let $=new Error(`Command failed with exit code ${F.code}: ${y}
30
- ${F.stderr}`);if(P){P($);return}throw $}return S({exitCode:F.code,stdout:new TextEncoder().encode(F.stdout),stderr:new TextEncoder().encode(F.stderr),text:()=>F.stdout,lines:()=>F.stdout.split(`
31
- `).filter($=>$.trim())})},P)}});return x()}m.$=w;})(exports.Shell||(exports.Shell={}));var Cr=exports.Shell.$;chunkVRQQ33YH_cjs.j();var Te=class Te extends Error{static create(t,n){var s;let r=_e__default.default.object({name:_e__default.default.literal(t),data:n}).meta({ref:t}),o=(s=class extends Te{constructor(i,c){super(t,c);chunkVRQQ33YH_cjs.c(this,"data",i);chunkVRQQ33YH_cjs.c(this,"name",t);this.name=t;}static isInstance(i){return typeof i=="object"&&"name"in i&&i.name===t}schema(){return r}toObject(){return {name:t,data:this.data}}},chunkVRQQ33YH_cjs.c(s,"Schema",r),s);return Object.defineProperty(o,"name",{value:t}),o}};chunkVRQQ33YH_cjs.c(Te,"Unknown",Te.create("UnknownError",_e__default.default.object({message:_e__default.default.string()})));var pt=Te;chunkVRQQ33YH_cjs.j();exports.Ignore=void 0;(t=>{function e(n){return new gt(n)}t.create=e;})(exports.Ignore||(exports.Ignore={}));var gt=class{constructor(t){chunkVRQQ33YH_cjs.c(this,"rules",[]);chunkVRQQ33YH_cjs.c(this,"ignorecase");chunkVRQQ33YH_cjs.c(this,"debug");this.ignorecase=t?.ignorecase??false,this.debug=t?.debug??false;}add(t){let n=typeof t=="string"?t.split(`
32
- `):t;for(let r=0;r<n.length;r++){let o=n[r];this.parseRule(o,r+1);}return this}parseRule(t,n){let r=t;if(r.length===0||r.startsWith("#"))return;let s=r.startsWith("!");if(s&&(r=r.slice(1)),r=r.trimEnd(),r.length===0)return;if(r.startsWith("\\#")){r=r.slice(1);return}if(r.startsWith("#"))return;let i=r.endsWith("/");if(i&&(r=r.slice(0,-1)),r.length===0)return;let c=this.patternToRegex(r);c&&this.rules.push({pattern:r,regex:c,negative:s,isDirectory:i,original:t,lineNumber:n});}ignores(t,n){let r=this.normalizePath(t),o=n??t.endsWith("/"),s=this.checkIgnore(r,o);return this.debug&&console.log(`Ignore.ignores("${t}", isDirectory=${o}) => ${s}`),s}checkIgnore(t,n){let r=false;for(let o of this.rules)o.isDirectory&&!n||o.regex.test(t)&&(o.negative?r=false:r=true);return r}filter(t){return t.filter(n=>!this.ignores(n))}createFilter(){return t=>!this.ignores(t)}patternToRegex(t){let n=[],r=0,o=t.length;for(;r<o;){let p=t[r];if(p==="\\")if(r+1<o){let l=t[r+1];n.push(this.escapeRegexChar(l)),r+=2;continue}else {n.push("\\\\"),r++;continue}if(p==="*")if(r+1<o&&t[r+1]==="*")if(r+2<o&&t[r+2]==="/")if(r===0||t[r-1]==="/")if(r+3>=o){n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else if(r===0||t[r-1]==="/")if(r+2>=o){n.push(".*"),r+=2;continue}else {n.push("(?:/.*)*"),r+=2;continue}else {n.push(".*"),r+=2;continue}else {n.push("[^/]*"),r++;continue}if(p==="?"){n.push("[^/]"),r++;continue}if(p==="["){let l=this.findMatchingBracket(t,r);if(l!==-1){let d=t.slice(r,l+1);(d.startsWith("[!")||d.startsWith("[^"))&&(d="[^"+d.slice(2)),this.ignorecase&&(d=d.toLowerCase()),n.push(d),r=l+1;continue}}if(p==="/"){n.push("/"),r++;continue}if(".+$^{}|()".includes(p)){n.push("\\"+p),r++;continue}if(this.ignorecase&&p>="A"&&p<="Z"){n.push("["+p.toLowerCase()+p+"]"),r++;continue}n.push(p),r++;}let s=n.join(""),a=s.startsWith("/"),i=s.endsWith("/")&&!s.endsWith("\\/");a||(s="(?:.*/)?"+s),i&&(s=s.slice(0,-1)),!i&&!s.endsWith("(?:/.*)*")&&(s="(?:"+s+")(?:/.*)?");let c=this.ignorecase?"i":"";try{return new RegExp("^"+s+"$",c)}catch(p){return this.debug&&console.error(`Failed to create regex for pattern "${t}":`,p),null}}escapeRegexChar(t){return "\\[]{}().+^$|".includes(t)?"\\"+t:t}findMatchingBracket(t,n){let r=n+1,o=t.length;for((r>=o||t[r]==="!"||t[r]==="^")&&r++;r<o;){let s=t[r];if(s==="\\"&&r+1<o){r+=2;continue}if(s==="]")return r;if(r+2<o&&t[r+1]==="-"&&t[r+2]!=="]"){r+=3;continue}r++;}return -1}normalizePath(t){let n=t.replace(/\\/g,"/");if(n==="/")return "";for(;n.startsWith("./");)n=n.slice(2);return n}};chunkVRQQ33YH_cjs.j();function Sn(e,t){let n=r=>{let o;try{o=e.parse(r);}catch(s){throw console.trace("schema validation failure stack trace:"),s instanceof _e.z.ZodError&&console.error("schema validation issues:",JSON.stringify(s.issues,null,2)),s}return t(o)};return n.force=r=>t(r),n.schema=e,n}var Ir=Sn;exports.Fn=void 0;(t=>t.fn=Sn)(exports.Fn||(exports.Fn={}));chunkVRQQ33YH_cjs.j();function Br(){let n=me__default.default.join(process.cwd(),".env");Le.existsSync(n)&&dotenv.config({path:n,override:true,debug:false,encoding:"utf-8",quiet:true});}chunkVRQQ33YH_cjs.j();async function Lr(e,t){if(process.env.EASBOT_CLIENT==="acp")try{let s=process.platform==="win32"?"cmd":void 0,a=exports.Shell.spawn(s,`git ${e.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:t.cwd,env:t.env?{...process.env,...t.env}:process.env}),[i,c,p]=await Promise.all([a.exited,new Response(a.stdout).arrayBuffer(),new Response(a.stderr).arrayBuffer()]),l=Buffer.from(c),d=Buffer.from(p);return {exitCode:i,text:()=>l.toString(),stdout:l,stderr:d}}catch(s){let a=Buffer.from(s instanceof Error?s.message:String(s));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:a}}let n=t.env?{...process.env,...t.env}:void 0,r=exports.Shell.$`git ${e.join(" ")}`.quiet().nothrow().cwd(t.cwd);n&&(r=r.env(n));let o=await r;return {exitCode:o.exitCode,text:()=>o.text(),stdout:o.stdout,stderr:o.stderr}}chunkVRQQ33YH_cjs.j();function Tn(e){return e?me.dirname(url.fileURLToPath(e)):typeof __dirname<"u"?__dirname:process.cwd()}function kn(e,t,n=3){function r(o,s){if(s>n||!Le.existsSync(o))return null;try{let a=Le.readdirSync(o);for(let i of a){let c=me.join(o,i);try{let p=Le.statSync(c);if(p.isFile()&&c.endsWith(t))return c;if(p.isDirectory()&&s<n){let l=r(c,s+1);if(l)return l}}catch{}}}catch{}return null}return r(e,0)}function vn(e,t){let n=me.join(e,t);if(Le.existsSync(n))return n;let r=t.split("/").pop()||t,o=e;for(let s=0;s<5;s++){let a=me.join(o,"assets","txt");if(Le.existsSync(a)){let p=kn(a,r,5);if(p)return p}let i=me.join(o,"dist","assets","txt");if(Le.existsSync(i)){let p=kn(i,r,5);if(p)return p}let c=me.join(o,"..");if(c===o)break;o=c;}return n}function zr(e,t){return exports.Lazy.lazy(()=>{try{let n=Tn(t),r=vn(n,e);return exports.PKG.file(r).textSync()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}function Hr(e,t){return exports.Lazy.lazy(async()=>{try{let n=Tn(t),r=vn(n,e);return await exports.PKG.file(r).text()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}chunkVRQQ33YH_cjs.j();function Wr(e){return e()}chunkVRQQ33YH_cjs.j();function Ur(e){if(!e||typeof e!="string")return {provider:"",model:""};let t=e.indexOf("/");return t===-1?{provider:"",model:e}:{provider:e.substring(0,t),model:e.substring(t+1)}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function bt(e,t,n,r=()=>true){let o=-1,s=-1,a=0;for(let i=t;i<n;i++){if(!r(i))continue;let c=e[i];if(c){if(c==="("){a+=1;continue}if(c===")"&&a>0){a-=1;continue}a===0&&(c===`
33
- `?o=i:/\s/.test(c)&&(s=i));}}return {lastNewline:o,lastWhitespace:s}}function qr(e,t){if(!e)return [];if(t<=0)return [e];if(e.length<=t)return [e]}function ge(e,t,n){try{let r=_e.z.string().parse(e),o=_e.z.number().int().parse(t),s=qr(r,o);if(s)return s;let a=yt(r,o,i=>{let{lastNewline:c,lastWhitespace:p}=bt(i,0,i.length);return c>0?c:p});return n?.minLength&&n.minLength>0&&(a=Pn(a,n.minLength)),a}catch(r){return console.warn("Invalid input for chunkText:",r),typeof e=="string"&&e.length>0?[e]:[]}}function Pn(e,t){if(e.length<=1||t<=0)return e;let n=[],r=e[0]??"";for(let o=1;o<e.length;o++){let s=e[o]??"";r.length<t?r=r+`
25
+ ${w}
26
+ `,"easbot",y]:/^cmd(\.exe)?$/i.test(x)?["/c",`chcp 65001 >nul 2>&1 && ${w}`]:H(x)?["-NoProfile","-Command",`[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ${w}`]:["-c",w]}m.args=G;function Ce(d){return d?p(d):(0, m.defaultPreferred)()}m.preferred=Ce;function Je(d){return d?p(d,{acceptable:true}):(0, m.defaultAcceptable)()}m.acceptable=Je;function Ke(){m.defaultPreferred.reset(),m.defaultAcceptable.reset();}m.reset=Ke;async function Dt(){return (process.platform==="win32"?i():await c()).filter(u=>a(u)).map(U)}m.list=Dt;function Ie(d){return Sn[E(d)]}m.metaInfo=Ie;function zt(d){return /[|&;<>()$`!#]/.test(d)}m.needsShell=zt;function O(){return process.platform==="win32"?i():["/bin/bash","/bin/zsh","/bin/sh"]}m.platformShells=O;function C(d){return d?!!a(d):false}m.isValid=C;async function A(d){let u=a(d);if(!u)return;let y=E(u);if(!/^cmd(\.exe)?$/i.test(y))try{let x;H(y)?x=["-NoProfile","-Command","$PSVersionTable.PSVersion.ToString()"]:x=["--version"],e.debug(`\u83B7\u53D6 Shell \u7248\u672C: ${u}`,{shell:u,args:x});let g=await exports.PKG.run([u,...x]);if(g.code===0){let w=g.stdout.trim().split(`
27
+ `)[0];return e.debug(`Shell \u7248\u672C\u83B7\u53D6\u6210\u529F: ${w}`),w}e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5931\u8D25\uFF0C\u9000\u51FA\u7801: ${g.code}`,{stderr:g.stderr});}catch(x){e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5F02\u5E38: ${x}`);}}m.version=A;class q extends Error{constructor(y,x,g,w){super(y);chunkVRQQ33YH_cjs.c(this,"message",y);chunkVRQQ33YH_cjs.c(this,"pkg",x);chunkVRQQ33YH_cjs.c(this,"version",g);chunkVRQQ33YH_cjs.c(this,"originalError",w);this.name="InstallFailedError";}}m.InstallFailedError=q;async function V(d,u="latest",y){let{Lock:x}=await import('./chunks/lock-LMCPTUNU.cjs'),{Filesystem:g}=await import('./chunks/filesystem-ALW6PJKX.cjs'),{PackageRegistry:w}=await import('./chunks/registry-LIPZA2EC.cjs');y=y??process.env.EASBOT_CACHE_PATH??fe__default.default.join(".easbot","cache");let R=await x.write("pkg-install");try{let T=fe__default.default.posix.join(y,"node_modules",d),k=fe__default.default.posix.join(y,"package.json"),z=(await g.readJson(k).catch(async()=>{let K={dependencies:{}};return await g.writeJson(k,K),K})).dependencies??{},L=await g.exists(T),D=z[d],F=!1;if(!L||!D)F=!0;else {if(u!=="latest"&&D===u)return T;if(u==="latest"){if(!await w.isOutdated(d,D,y))return T;e.info("Cached version is outdated, proceeding with install",{pkg:d,cachedVersion:D}),F=!0;}}if(!F)return T;let $=m.acceptable(process.platform==="win32"?"cmd":void 0)??v(),Q=`${d}@${u}`;e.info("installing package",{pkg:d,version:u,cache:y,shell:$});let J=await exports.PKG.packageManager();if(!J)throw new q("No package manager found (npm, pnpm, bun)",d,u,"No package manager available");let Z=J.name,Ze=Z==="pnpm"?"add":"install",Xe=`${J.name} ${Ze} --save-exact ${Q}`;e.info(`Using ${Z} to install package`,{pkg:d,version:u,shell:$,pmPath:J.path});try{let K=await m.run($,Xe,{cwd:y,timeout:6e5,windowsHide:!0});if(K.code!==0)throw new Error(`Package manager exited with code ${K.code}: ${K.stderr}`);e.info(`Successfully installed ${d}@${u} with ${Z}`);}catch(K){let Ht=K instanceof Error?K:new Error(String(K));if(!await g.exists(T))throw new q(`Failed to install ${d}@${u}`,d,u,Ht.message);e.warn("Package install failed but module exists, continuing",{error:Ht.message});}let Qe=u;u==="latest"&&(Qe=(await g.readJson(fe__default.default.join(T,"package.json")).catch(()=>({})))?.version??"unknown");let Oe=await g.readJson(k);return Oe.dependencies=Oe.dependencies??{},Oe.dependencies[d]=Qe,await g.writeJson(k,Oe),e.info("Package installation completed",{pkg:d,version:Qe,path:T}),T}finally{R[Symbol.dispose]();}}m.install=V;async function ye(d,u,y){let x=d?m.acceptable(d)??v():m.acceptable()??v(),g=y?.cwd??process.cwd(),w=m.args(x,u,g);e.debug(`run shell process: ${x} ${w.join(" ")}`,{command:u,cwd:g});let{windowsHide:R,env:T,...k}=y??{},I={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...T};process.platform==="win32"&&(I.CHCP="65001");let{stdin:z,stdout:L,stderr:D,timeout:F,signal:$,...Q}=k??{},J={...Q,cwd:g,env:I,windowsHide:process.platform==="win32"?R??true:void 0,shell:Q.shell,timeout:F},Z=E(x),Ze=/^cmd(\.exe)?$/i.test(Z),Xe=process.platform==="win32"&&Ze?"cmd":x;return exports.PKG.run([Xe,...w],J)}m.run=ye;function _(d,u,y){let x=d?m.acceptable(d)??v():m.acceptable()??v(),g=y?.cwd??process.cwd(),w=m.args(x,u,g);e.debug(`Spawn shell process: ${x} ${w.join(" ")}`,{command:u,cwd:g});let{stdin:R,stdout:T,stderr:k,timeout:I,signal:z,windowsHide:L,env:D,...F}=y??{},$={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...D};process.platform==="win32"&&($.CHCP="65001");let Q=E(x),J=/^cmd(\.exe)?$/i.test(Q),Z={...F,cwd:g,env:$,windowsHide:process.platform==="win32"?L??true:void 0,shell:F.shell,timeout:I};return exports.PKG.spawn([J?"cmd":x,...w],Z)}m.spawn=_;function S(d,...u){let y=d.reduce((g,w,R)=>g+w+(u[R]??""),""),x=(g={})=>({quiet:()=>x({...g,quiet:true}),nothrow:()=>x({...g,nothrow:true}),cwd:w=>x({...g,cwd:w}),env:w=>x({...g,env:w}),stdin:w=>x({...g,stdin:w}),stdout:w=>x({...g,stdout:w}),stderr:w=>x({...g,stderr:w}),text:async()=>{let w=re(y.trim());if(w.length===0)throw new Error("Empty command");let R=w[0]??"",T=E(R),k=/^cmd(\.exe)?$/i.test(T),I=process.platform==="win32"&&k?"cmd":Ie(R)?R:void 0,z=ue(R,w.slice(1)),L=await m.run(I,z,{cwd:g.cwd,env:g.env,stdin:g.stdin,stdout:g.stdout,stderr:g.stderr,timeout:g.timeout,windowsHide:process.platform==="win32"?g.windowsHide??true:void 0,shell:g.shell});if(L.code!==0&&!g.nothrow)throw new Error(`Command failed with exit code ${L.code}: ${y}
28
+ ${L.stderr}`);return L.stdout},lines:async()=>(await x(g).text()).split(`
29
+ `).filter(R=>R.trim()),then:(w,R)=>{let T=re(y.trim()),k=T[0]??"",I=E(k),z=/^cmd(\.exe)?$/i.test(I),L=process.platform==="win32"&&z?"cmd":Ie(k)?k:void 0,D=ue(k,T.slice(1));return m.run(L,D,{cwd:g.cwd,env:g.env,stdin:g.stdin,stdout:g.stdout,stderr:g.stderr,timeout:g.timeout,windowsHide:process.platform==="win32"?g.windowsHide??true:void 0,shell:g.shell}).then(F=>{if(F.code!==0&&!g.nothrow){let $=new Error(`Command failed with exit code ${F.code}: ${y}
30
+ ${F.stderr}`);if(R){R($);return}throw $}return w({exitCode:F.code,stdout:new TextEncoder().encode(F.stdout),stderr:new TextEncoder().encode(F.stderr),text:()=>F.stdout,lines:()=>F.stdout.split(`
31
+ `).filter($=>$.trim())})},R)}});return x()}m.$=S;})(exports.Shell||(exports.Shell={}));var Ir=exports.Shell.$;chunkVRQQ33YH_cjs.j();var ke=class ke extends Error{static create(t,n){var s;let r=Be__default.default.object({name:Be__default.default.literal(t),data:n}).meta({ref:t}),o=(s=class extends ke{constructor(i,c){super(t,c);chunkVRQQ33YH_cjs.c(this,"data",i);chunkVRQQ33YH_cjs.c(this,"name",t);this.name=t;}static isInstance(i){return typeof i=="object"&&"name"in i&&i.name===t}schema(){return r}toObject(){return {name:t,data:this.data}}},chunkVRQQ33YH_cjs.c(s,"Schema",r),s);return Object.defineProperty(o,"name",{value:t}),o}};chunkVRQQ33YH_cjs.c(ke,"Unknown",ke.create("UnknownError",Be__default.default.object({message:Be__default.default.string()})));var pt=ke;chunkVRQQ33YH_cjs.j();exports.Ignore=void 0;(t=>{function e(n){return new gt(n)}t.create=e;})(exports.Ignore||(exports.Ignore={}));var gt=class{constructor(t){chunkVRQQ33YH_cjs.c(this,"rules",[]);chunkVRQQ33YH_cjs.c(this,"ignorecase");chunkVRQQ33YH_cjs.c(this,"debug");this.ignorecase=t?.ignorecase??false,this.debug=t?.debug??false;}add(t){let n=typeof t=="string"?t.split(`
32
+ `):t;for(let r=0;r<n.length;r++){let o=n[r];this.parseRule(o,r+1);}return this}parseRule(t,n){let r=t;if(r.length===0||r.startsWith("#"))return;let s=r.startsWith("!");if(s&&(r=r.slice(1)),r=r.trimEnd(),r.length===0)return;if(r.startsWith("\\#")){r=r.slice(1);return}if(r.startsWith("#"))return;let i=r.endsWith("/");if(i&&(r=r.slice(0,-1)),r.length===0)return;let c=this.patternToRegex(r);c&&this.rules.push({pattern:r,regex:c,negative:s,isDirectory:i,original:t,lineNumber:n});}ignores(t,n){let r=this.normalizePath(t),o=n??t.endsWith("/"),s=this.checkIgnore(r,o);return this.debug&&console.log(`Ignore.ignores("${t}", isDirectory=${o}) => ${s}`),s}checkIgnore(t,n){let r=false;for(let o of this.rules)o.isDirectory&&!n||o.regex.test(t)&&(o.negative?r=false:r=true);return r}filter(t){return t.filter(n=>!this.ignores(n))}createFilter(){return t=>!this.ignores(t)}patternToRegex(t){let n=[],r=0,o=t.length;for(;r<o;){let p=t[r];if(p==="\\")if(r+1<o){let l=t[r+1];n.push(this.escapeRegexChar(l)),r+=2;continue}else {n.push("\\\\"),r++;continue}if(p==="*")if(r+1<o&&t[r+1]==="*")if(r+2<o&&t[r+2]==="/")if(r===0||t[r-1]==="/")if(r+3>=o){n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else if(r===0||t[r-1]==="/")if(r+2>=o){n.push(".*"),r+=2;continue}else {n.push("(?:/.*)*"),r+=2;continue}else {n.push(".*"),r+=2;continue}else {n.push("[^/]*"),r++;continue}if(p==="?"){n.push("[^/]"),r++;continue}if(p==="["){let l=this.findMatchingBracket(t,r);if(l!==-1){let f=t.slice(r,l+1);(f.startsWith("[!")||f.startsWith("[^"))&&(f="[^"+f.slice(2)),this.ignorecase&&(f=f.toLowerCase()),n.push(f),r=l+1;continue}}if(p==="/"){n.push("/"),r++;continue}if(".+$^{}|()".includes(p)){n.push("\\"+p),r++;continue}if(this.ignorecase&&p>="A"&&p<="Z"){n.push("["+p.toLowerCase()+p+"]"),r++;continue}n.push(p),r++;}let s=n.join(""),a=s.startsWith("/"),i=s.endsWith("/")&&!s.endsWith("\\/");a||(s="(?:.*/)?"+s),i&&(s=s.slice(0,-1)),!i&&!s.endsWith("(?:/.*)*")&&(s="(?:"+s+")(?:/.*)?");let c=this.ignorecase?"i":"";try{return new RegExp("^"+s+"$",c)}catch(p){return this.debug&&console.error(`Failed to create regex for pattern "${t}":`,p),null}}escapeRegexChar(t){return "\\[]{}().+^$|".includes(t)?"\\"+t:t}findMatchingBracket(t,n){let r=n+1,o=t.length;for((r>=o||t[r]==="!"||t[r]==="^")&&r++;r<o;){let s=t[r];if(s==="\\"&&r+1<o){r+=2;continue}if(s==="]")return r;if(r+2<o&&t[r+1]==="-"&&t[r+2]!=="]"){r+=3;continue}r++;}return -1}normalizePath(t){let n=t.replace(/\\/g,"/");if(n==="/")return "";for(;n.startsWith("./");)n=n.slice(2);return n}};chunkVRQQ33YH_cjs.j();function kn(e,t){let n=r=>{let o;try{o=e.parse(r);}catch(s){throw console.trace("schema validation failure stack trace:"),s instanceof Be.z.ZodError&&console.error("schema validation issues:",JSON.stringify(s.issues,null,2)),s}return t(o)};return n.force=r=>t(r),n.schema=e,n}var Fr=kn;exports.Fn=void 0;(t=>t.fn=kn)(exports.Fn||(exports.Fn={}));chunkVRQQ33YH_cjs.j();function Br(){let n=fe__default.default.join(process.cwd(),".env");Le.existsSync(n)&&dotenv.config({path:n,override:true,debug:false,encoding:"utf-8",quiet:true});}chunkVRQQ33YH_cjs.j();async function _r(e,t){if(process.env.EASBOT_CLIENT==="acp")try{let s=process.platform==="win32"?"cmd":void 0,a=exports.Shell.spawn(s,`git ${e.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:t.cwd,env:t.env?{...process.env,...t.env}:process.env}),[i,c,p]=await Promise.all([a.exited,new Response(a.stdout).arrayBuffer(),new Response(a.stderr).arrayBuffer()]),l=Buffer.from(c),f=Buffer.from(p);return {exitCode:i,text:()=>l.toString(),stdout:l,stderr:f}}catch(s){let a=Buffer.from(s instanceof Error?s.message:String(s));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:a}}let n=t.env?{...process.env,...t.env}:void 0,r=exports.Shell.$`git ${e.join(" ")}`.quiet().nothrow().cwd(t.cwd);n&&(r=r.env(n));let o=await r;return {exitCode:o.exitCode,text:()=>o.text(),stdout:o.stdout,stderr:o.stderr}}chunkVRQQ33YH_cjs.j();function vn(e){return e?fe.dirname(url.fileURLToPath(e)):typeof __dirname<"u"?__dirname:process.cwd()}function Tn(e,t,n=3){function r(o,s){if(s>n||!Le.existsSync(o))return null;try{let a=Le.readdirSync(o);for(let i of a){let c=fe.join(o,i);try{let p=Le.statSync(c);if(p.isFile()&&c.endsWith(t))return c;if(p.isDirectory()&&s<n){let l=r(c,s+1);if(l)return l}}catch{}}}catch{}return null}return r(e,0)}function Rn(e,t){let n=fe.join(e,t);if(Le.existsSync(n))return n;let r=t.split("/").pop()||t,o=e;for(let s=0;s<5;s++){let a=fe.join(o,"assets","txt");if(Le.existsSync(a)){let p=Tn(a,r,5);if(p)return p}let i=fe.join(o,"dist","assets","txt");if(Le.existsSync(i)){let p=Tn(i,r,5);if(p)return p}let c=fe.join(o,"..");if(c===o)break;o=c;}return n}function Hr(e,t){return exports.Lazy.lazy(()=>{try{let n=vn(t),r=Rn(n,e);return exports.PKG.file(r).textSync()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}function Wr(e,t){return exports.Lazy.lazy(async()=>{try{let n=vn(t),r=Rn(n,e);return await exports.PKG.file(r).text()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}chunkVRQQ33YH_cjs.j();function Ur(e){return e()}chunkVRQQ33YH_cjs.j();function qr(e){if(!e||typeof e!="string")return {provider:"",model:""};let t=e.indexOf("/");return t===-1?{provider:"",model:e}:{provider:e.substring(0,t),model:e.substring(t+1)}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function bt(e,t,n,r=()=>true){let o=-1,s=-1,a=0;for(let i=t;i<n;i++){if(!r(i))continue;let c=e[i];if(c){if(c==="("){a+=1;continue}if(c===")"&&a>0){a-=1;continue}a===0&&(c===`
33
+ `?o=i:/\s/.test(c)&&(s=i));}}return {lastNewline:o,lastWhitespace:s}}function Yr(e,t){if(!e)return [];if(t<=0)return [e];if(e.length<=t)return [e]}function pe(e,t,n){try{let r=Be.z.string().parse(e),o=Be.z.number().int().parse(t),s=Yr(r,o);if(s)return s;let a=yt(r,o,i=>{let{lastNewline:c,lastWhitespace:p}=bt(i,0,i.length);return c>0?c:p});return n?.minLength&&n.minLength>0&&(a=Mn(a,n.minLength)),a}catch(r){return console.warn("Invalid input for chunkText:",r),typeof e=="string"&&e.length>0?[e]:[]}}function Mn(e,t){if(e.length<=1||t<=0)return e;let n=[],r=e[0]??"";for(let o=1;o<e.length;o++){let s=e[o]??"";r.length<t?r=r+`
34
34
 
35
35
  `+s:(n.push(r),r=s);}if(r.length>0)if(r.length<t&&n.length>0){let o=n.pop();n.push(o+`
36
36
 
37
- `+r);}else n.push(r);return n}function yt(e,t,n){if(!e)return [];if(t<=0||e.length<=t)return [e];let r=[],o=e;for(;o.length>t;){let s=o.slice(0,t),a=n(s),i=Number.isFinite(a)&&a>0&&a<=t?a:t,p=o.slice(0,i).trimEnd();p.length>0&&r.push(p);let l=i<o.length&&o[i]!==void 0&&/\s/.test(o[i]),d=Math.min(o.length,i+(l?1:0));o=o.slice(d).trimStart();}return o.length>0&&r.push(o),r}chunkVRQQ33YH_cjs.j();var xt=_e.z.enum(["bold","italic","strikethrough","code","code_block","spoiler","blockquote"]),Mn=_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),style:xt}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),En=_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),href:_e.z.string().min(1)}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),Re=_e.z.object({text:_e.z.string(),styles:_e.z.array(Mn),links:_e.z.array(En)}).strict(),Pe=_e.z.enum(["off","bullets","code"]),Ne=_e.z.object({linkify:_e.z.boolean().default(true),enableSpoilers:_e.z.boolean().default(false),headingStyle:_e.z.enum(["none","bold"]).default("none"),blockquotePrefix:_e.z.string().default(""),autolink:_e.z.boolean().default(true),tableMode:Pe.default("off")}).partial().default({}),Cn=_e.z.object({open:_e.z.string(),close:_e.z.string()}).strict(),wt=_e.z.object({styleMarkers:_e.z.record(xt,Cn).optional(),escapeText:_e.z.any().optional(),buildLink:_e.z.any().optional()}).strict();_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),open:_e.z.string(),close:_e.z.string()}).strict();var St=_e.z.object({indentSize:_e.z.number().int().min(1).default(2),listMarker:_e.z.enum(["\u2022","-","*"]).default("\u2022"),codeBlockMarker:_e.z.enum(["```","~~~"]).default("```"),preserveFrontmatter:_e.z.boolean().default(true)}).strict(),kt=_e.z.record(_e.z.string(),_e.z.string()),De=_e.z.object({open:_e.z.boolean(),ticks:_e.z.number().int().min(0)}).strict();_e.z.object({inlineState:De,isInside:_e.z.any()}).strict();_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),openLine:_e.z.string(),marker:_e.z.string(),indent:_e.z.string()}).strict();_e.z.object({tables:Pe.optional()}).strict();function Zr(e){let t=new Kr__default.default({html:false,linkify:e.linkify??true,breaks:false,typographer:false});return t.enable("strikethrough"),e.tableMode&&e.tableMode!=="off"?t.enable("table"):t.disable("table"),e.autolink===false&&t.disable("autolink"),t}function On(e,t){if(e.attrGet)return e.attrGet(t);if(e.attrs){for(let[n,r]of e.attrs)if(n===t)return r}return null}function Tt(e,t){return {...e,type:"text",content:t,children:void 0}}function Xr(e){for(let t of e)t.children&&t.children.length>0&&(t.children=Qr(t.children));}function Qr(e){let t=0;for(let a of e){if(a.type!=="text")continue;let i=a.content??"",c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1)break;t+=1,c=p+2;}}if(t<2)return e;let n=t-t%2,r=[],o={spoilerOpen:false},s=0;for(let a of e){if(a.type!=="text"){r.push(a);continue}let i=a.content??"";if(!i.includes("||")){r.push(a);continue}let c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1){c<i.length&&r.push(Tt(a,i.slice(c)));break}if(s>=n){r.push(Tt(a,i.slice(c)));break}p>c&&r.push(Tt(a,i.slice(c,p))),s+=1,o.spoilerOpen=!o.spoilerOpen,r.push({type:o.spoilerOpen?"spoiler_open":"spoiler_close"}),c=p+2;}}return r}function eo(){return {text:"",styles:[],openStyles:[],links:[],linkStack:[]}}function le(e){return e.table?.currentCell??e}function ze(e,t){if(!t)return;let n=le(e);n.text+=t;}function he(e,t){let n=le(e);n.openStyles.push({style:t,start:n.text.length});}function be(e,t){let n=le(e);for(let r=n.openStyles.length-1;r>=0;r-=1){let o=n.openStyles[r];if(o?.style===t){let s=o.start;n.openStyles.splice(r,1);let a=n.text.length;a>s&&n.styles.push({start:s,end:a,style:t});return}}}function In(e){e.env.listStack.length>0||e.table||(e.text+=`
37
+ `+r);}else n.push(r);return n}function yt(e,t,n){if(!e)return [];if(t<=0||e.length<=t)return [e];let r=[],o=e;for(;o.length>t;){let s=o.slice(0,t),a=n(s),i=Number.isFinite(a)&&a>0&&a<=t?a:t,p=o.slice(0,i).trimEnd();p.length>0&&r.push(p);let l=i<o.length&&o[i]!==void 0&&/\s/.test(o[i]),f=Math.min(o.length,i+(l?1:0));o=o.slice(f).trimStart();}return o.length>0&&r.push(o),r}chunkVRQQ33YH_cjs.j();var xt=Be.z.enum(["bold","italic","strikethrough","code","code_block","spoiler","blockquote"]),En=Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),style:xt}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),Cn=Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),href:Be.z.string().min(1)}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),ve=Be.z.object({text:Be.z.string(),styles:Be.z.array(En),links:Be.z.array(Cn)}).strict(),Re=Be.z.enum(["off","bullets","code"]),je=Be.z.object({linkify:Be.z.boolean().default(true),enableSpoilers:Be.z.boolean().default(false),headingStyle:Be.z.enum(["none","bold"]).default("none"),blockquotePrefix:Be.z.string().default(""),autolink:Be.z.boolean().default(true),tableMode:Re.default("off")}).partial().default({}),In=Be.z.object({open:Be.z.string(),close:Be.z.string()}).strict(),wt=Be.z.object({styleMarkers:Be.z.record(xt,In).optional(),escapeText:Be.z.any().optional(),buildLink:Be.z.any().optional()}).strict();Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),open:Be.z.string(),close:Be.z.string()}).strict();var St=Be.z.object({indentSize:Be.z.number().int().min(1).default(2),listMarker:Be.z.enum(["\u2022","-","*"]).default("\u2022"),codeBlockMarker:Be.z.enum(["```","~~~"]).default("```"),preserveFrontmatter:Be.z.boolean().default(true)}).strict(),kt=Be.z.record(Be.z.string(),Be.z.string()),Ne=Be.z.object({open:Be.z.boolean(),ticks:Be.z.number().int().min(0)}).strict();Be.z.object({inlineState:Ne,isInside:Be.z.any()}).strict();Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),openLine:Be.z.string(),marker:Be.z.string(),indent:Be.z.string()}).strict();Be.z.object({tables:Re.optional()}).strict();function Xr(e){let t=new Zr__default.default({html:false,linkify:e.linkify??true,breaks:false,typographer:false});return t.enable("strikethrough"),e.tableMode&&e.tableMode!=="off"?t.enable("table"):t.disable("table"),e.autolink===false&&t.disable("autolink"),t}function On(e,t){if(e.attrGet)return e.attrGet(t);if(e.attrs){for(let[n,r]of e.attrs)if(n===t)return r}return null}function Tt(e,t){return {...e,type:"text",content:t,children:void 0}}function Qr(e){for(let t of e)t.children&&t.children.length>0&&(t.children=eo(t.children));}function eo(e){let t=0;for(let a of e){if(a.type!=="text")continue;let i=a.content??"",c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1)break;t+=1,c=p+2;}}if(t<2)return e;let n=t-t%2,r=[],o={spoilerOpen:false},s=0;for(let a of e){if(a.type!=="text"){r.push(a);continue}let i=a.content??"";if(!i.includes("||")){r.push(a);continue}let c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1){c<i.length&&r.push(Tt(a,i.slice(c)));break}if(s>=n){r.push(Tt(a,i.slice(c)));break}p>c&&r.push(Tt(a,i.slice(c,p))),s+=1,o.spoilerOpen=!o.spoilerOpen,r.push({type:o.spoilerOpen?"spoiler_open":"spoiler_close"}),c=p+2;}}return r}function to(){return {text:"",styles:[],openStyles:[],links:[],linkStack:[]}}function ce(e){return e.table?.currentCell??e}function De(e,t){if(!t)return;let n=ce(e);n.text+=t;}function me(e,t){let n=ce(e);n.openStyles.push({style:t,start:n.text.length});}function ge(e,t){let n=ce(e);for(let r=n.openStyles.length-1;r>=0;r-=1){let o=n.openStyles[r];if(o?.style===t){let s=o.start;n.openStyles.splice(r,1);let a=n.text.length;a>s&&n.styles.push({start:s,end:a,style:t});return}}}function Fn(e){e.env.listStack.length>0||e.table||(e.text+=`
38
38
 
39
- `);}function to(e){let t=e.env.listStack,n=t[t.length-1];if(!n)return;n.index+=1;let r=" ".repeat(Math.max(0,t.length-1)),o=n.type==="ordered"?`${n.index}. `:"\u2022 ";e.text+=`${r}${o}`;}function no(e,t){if(!t)return;let n=le(e),r=n.text.length;n.text+=t,n.styles.push({start:r,end:r+t.length,style:"code"});}function ro(e,t){let n=t??"",r=le(e),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function oo(e){let t=le(e),n=t.linkStack.pop();if(!n?.href)return;let r=n.href.trim();if(!r)return;let o=n.labelStart,s=t.text.length;if(s<=o){t.links.push({start:o,end:s,href:r});return}t.links.push({start:o,end:s,href:r});}function so(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function io(e){return An(e),{text:e.text,styles:e.styles,links:e.links}}function He(e){let t=e.text,n=0,r=t.length;for(;n<r&&/\s/.test(t[n]??"");)n+=1;for(;r>n&&/\s/.test(t[r-1]??"");)r-=1;if(n===0&&r===t.length)return e;let o=t.slice(n,r),s=o.length,a=[];for(let c of e.styles){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&a.push({start:p,end:l,style:c.style});}let i=[];for(let c of e.links){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&i.push({start:p,end:l,href:c.href});}return {text:o,styles:a,links:i}}function vt(e,t){if(!t.text)return;let n=e.text.length;e.text+=t.text;for(let r of t.styles)e.styles.push({start:n+r.start,end:n+r.end,style:r.style});for(let r of t.links)e.links.push({start:n+r.start,end:n+r.end,href:r.href});}function ao(e,t){t.text&&(e.text+=t.text);}function Fn(e,t){let{header:n,value:r,columnIndex:o,includeColumnFallback:s}=t;r?.text&&(e.text+="\u2022 ",n?.text?(vt(e,n),e.text+=": "):s&&(e.text+=`Column ${o}: `),vt(e,r),e.text+=`
40
- `);}function co(e){if(!e.table)return;let t=e.table.headers.map(He),n=e.table.rows.map(o=>o.map(He));if(t.length===0&&n.length===0)return;if(t.length>1&&n.length>0)for(let o of n){if(o.length===0)continue;let s=o[0];if(s?.text){let a=e.text.length;vt(e,s);let i=e.text.length;i>a&&e.styles.push({start:a,end:i,style:"bold"}),e.text+=`
41
- `;}for(let a=1;a<o.length;a++)Fn(e,{header:t[a],value:o[a],columnIndex:a,includeColumnFallback:true});e.text+=`
42
- `;}else for(let o of n){for(let s=0;s<o.length;s++)Fn(e,{header:t[s],value:o[s],columnIndex:s,includeColumnFallback:false});e.text+=`
43
- `;}}function lo(e){if(!e.table)return;let t=e.table.headers.map(He),n=e.table.rows.map(l=>l.map(He)),r=Math.max(t.length,...n.map(l=>l.length));if(r===0)return;let o=Array.from({length:r},()=>0),s=l=>{for(let d=0;d<r;d+=1){let k=l[d]?.text.length??0;(o[d]??0)<k&&(o[d]=k);}};s(t);for(let l of n)s(l);let a=e.text.length,i=l=>{e.text+="|";for(let d=0;d<r;d+=1){e.text+=" ";let g=l[d];g&&ao(e,g);let k=g?.text.length??0,D=(o[d]??0)-k;D>0&&(e.text+=" ".repeat(D)),e.text+=" |";}e.text+=`
44
- `;},c=()=>{e.text+="|";for(let l=0;l<r;l+=1){let d=o[l]??0,g=Math.max(3,d);e.text+=` ${"-".repeat(g)} |`;}e.text+=`
45
- `;};i(t),c();for(let l of n)i(l);let p=e.text.length;p>a&&e.styles.push({start:a,end:p,style:"code_block"});}function Rt(e,t){for(let n of e)switch(n.type){case "inline":n.children&&Rt(n.children,t);break;case "text":ze(t,n.content??"");break;case "em_open":he(t,"italic");break;case "em_close":be(t,"italic");break;case "strong_open":he(t,"bold");break;case "strong_close":be(t,"bold");break;case "s_open":he(t,"strikethrough");break;case "s_close":be(t,"strikethrough");break;case "code_inline":no(t,n.content??"");break;case "spoiler_open":t.enableSpoilers&&he(t,"spoiler");break;case "spoiler_close":t.enableSpoilers&&be(t,"spoiler");break;case "link_open":{let r=On(n,"href")??"",o=le(t);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":oo(t);break;case "image":ze(t,n.content??"");break;case "softbreak":case "hardbreak":ze(t,`
46
- `);break;case "paragraph_close":In(t);break;case "heading_open":t.headingStyle==="bold"&&he(t,"bold");break;case "heading_close":t.headingStyle==="bold"&&be(t,"bold"),In(t);break;case "blockquote_open":t.blockquotePrefix&&(t.text+=t.blockquotePrefix),he(t,"blockquote");break;case "blockquote_close":be(t,"blockquote");break;case "bullet_list_open":t.env.listStack.length>0&&(t.text+=`
39
+ `);}function no(e){let t=e.env.listStack,n=t[t.length-1];if(!n)return;n.index+=1;let r=" ".repeat(Math.max(0,t.length-1)),o=n.type==="ordered"?`${n.index}. `:"\u2022 ";e.text+=`${r}${o}`;}function ro(e,t){if(!t)return;let n=ce(e),r=n.text.length;n.text+=t,n.styles.push({start:r,end:r+t.length,style:"code"});}function oo(e,t){let n=t??"",r=ce(e),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function so(e){let t=ce(e),n=t.linkStack.pop();if(!n?.href)return;let r=n.href.trim();if(!r)return;let o=n.labelStart,s=t.text.length;if(s<=o){t.links.push({start:o,end:s,href:r});return}t.links.push({start:o,end:s,href:r});}function io(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function ao(e){return An(e),{text:e.text,styles:e.styles,links:e.links}}function ze(e){let t=e.text,n=0,r=t.length;for(;n<r&&/\s/.test(t[n]??"");)n+=1;for(;r>n&&/\s/.test(t[r-1]??"");)r-=1;if(n===0&&r===t.length)return e;let o=t.slice(n,r),s=o.length,a=[];for(let c of e.styles){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&a.push({start:p,end:l,style:c.style});}let i=[];for(let c of e.links){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&i.push({start:p,end:l,href:c.href});}return {text:o,styles:a,links:i}}function vt(e,t){if(!t.text)return;let n=e.text.length;e.text+=t.text;for(let r of t.styles)e.styles.push({start:n+r.start,end:n+r.end,style:r.style});for(let r of t.links)e.links.push({start:n+r.start,end:n+r.end,href:r.href});}function co(e,t){t.text&&(e.text+=t.text);}function $n(e,t){let{header:n,value:r,columnIndex:o,includeColumnFallback:s}=t;r?.text&&(e.text+="\u2022 ",n?.text?(vt(e,n),e.text+=": "):s&&(e.text+=`Column ${o}: `),vt(e,r),e.text+=`
40
+ `);}function lo(e){if(!e.table)return;let t=e.table.headers.map(ze),n=e.table.rows.map(o=>o.map(ze));if(t.length===0&&n.length===0)return;if(t.length>1&&n.length>0)for(let o of n){if(o.length===0)continue;let s=o[0];if(s?.text){let a=e.text.length;vt(e,s);let i=e.text.length;i>a&&e.styles.push({start:a,end:i,style:"bold"}),e.text+=`
41
+ `;}for(let a=1;a<o.length;a++)$n(e,{header:t[a],value:o[a],columnIndex:a,includeColumnFallback:true});e.text+=`
42
+ `;}else for(let o of n){for(let s=0;s<o.length;s++)$n(e,{header:t[s],value:o[s],columnIndex:s,includeColumnFallback:false});e.text+=`
43
+ `;}}function uo(e){if(!e.table)return;let t=e.table.headers.map(ze),n=e.table.rows.map(l=>l.map(ze)),r=Math.max(t.length,...n.map(l=>l.length));if(r===0)return;let o=Array.from({length:r},()=>0),s=l=>{for(let f=0;f<r;f+=1){let v=l[f]?.text.length??0;(o[f]??0)<v&&(o[f]=v);}};s(t);for(let l of n)s(l);let a=e.text.length,i=l=>{e.text+="|";for(let f=0;f<r;f+=1){e.text+=" ";let h=l[f];h&&co(e,h);let v=h?.text.length??0,N=(o[f]??0)-v;N>0&&(e.text+=" ".repeat(N)),e.text+=" |";}e.text+=`
44
+ `;},c=()=>{e.text+="|";for(let l=0;l<r;l+=1){let f=o[l]??0,h=Math.max(3,f);e.text+=` ${"-".repeat(h)} |`;}e.text+=`
45
+ `;};i(t),c();for(let l of n)i(l);let p=e.text.length;p>a&&e.styles.push({start:a,end:p,style:"code_block"});}function Rt(e,t){for(let n of e)switch(n.type){case "inline":n.children&&Rt(n.children,t);break;case "text":De(t,n.content??"");break;case "em_open":me(t,"italic");break;case "em_close":ge(t,"italic");break;case "strong_open":me(t,"bold");break;case "strong_close":ge(t,"bold");break;case "s_open":me(t,"strikethrough");break;case "s_close":ge(t,"strikethrough");break;case "code_inline":ro(t,n.content??"");break;case "spoiler_open":t.enableSpoilers&&me(t,"spoiler");break;case "spoiler_close":t.enableSpoilers&&ge(t,"spoiler");break;case "link_open":{let r=On(n,"href")??"",o=ce(t);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":so(t);break;case "image":De(t,n.content??"");break;case "softbreak":case "hardbreak":De(t,`
46
+ `);break;case "paragraph_close":Fn(t);break;case "heading_open":t.headingStyle==="bold"&&me(t,"bold");break;case "heading_close":t.headingStyle==="bold"&&ge(t,"bold"),Fn(t);break;case "blockquote_open":t.blockquotePrefix&&(t.text+=t.blockquotePrefix),me(t,"blockquote");break;case "blockquote_close":ge(t,"blockquote");break;case "bullet_list_open":t.env.listStack.length>0&&(t.text+=`
47
47
  `),t.env.listStack.push({type:"bullet",index:0});break;case "bullet_list_close":t.env.listStack.pop(),t.env.listStack.length===0&&(t.text+=`
48
48
  `);break;case "ordered_list_open":{t.env.listStack.length>0&&(t.text+=`
49
49
  `);let r=Number(On(n,"start")??"1");t.env.listStack.push({type:"ordered",index:r-1});break}case "ordered_list_close":t.env.listStack.pop(),t.env.listStack.length===0&&(t.text+=`
50
- `);break;case "list_item_open":to(t);break;case "list_item_close":t.text.endsWith(`
50
+ `);break;case "list_item_open":no(t);break;case "list_item_close":t.text.endsWith(`
51
51
  `)||(t.text+=`
52
- `);break;case "code_block":case "fence":ro(t,n.content??"");break;case "html_block":case "html_inline":ze(t,n.content??"");break;case "table_open":t.tableMode!=="off"&&(t.table=so(),t.hasTables=true);break;case "table_close":t.table&&(t.tableMode==="bullets"?co(t):t.tableMode==="code"&&lo(t)),t.table=null;break;case "thead_open":t.table&&(t.table.inHeader=true);break;case "thead_close":t.table&&(t.table.inHeader=false);break;case "tbody_open":case "tbody_close":break;case "tr_open":t.table&&(t.table.currentRow=[]);break;case "tr_close":t.table&&(t.table.inHeader?t.table.headers=t.table.currentRow:t.table.rows.push(t.table.currentRow),t.table.currentRow=[]);break;case "th_open":case "td_open":t.table&&(t.table.currentCell=eo());break;case "th_close":case "td_close":t.table?.currentCell&&(t.table.currentRow.push(io(t.table.currentCell)),t.table.currentCell=null);break;case "hr":t.text+=`\u2500\u2500\u2500
52
+ `);break;case "code_block":case "fence":oo(t,n.content??"");break;case "html_block":case "html_inline":De(t,n.content??"");break;case "table_open":t.tableMode!=="off"&&(t.table=io(),t.hasTables=true);break;case "table_close":t.table&&(t.tableMode==="bullets"?lo(t):t.tableMode==="code"&&uo(t)),t.table=null;break;case "thead_open":t.table&&(t.table.inHeader=true);break;case "thead_close":t.table&&(t.table.inHeader=false);break;case "tbody_open":case "tbody_close":break;case "tr_open":t.table&&(t.table.currentRow=[]);break;case "tr_close":t.table&&(t.table.inHeader?t.table.headers=t.table.currentRow:t.table.rows.push(t.table.currentRow),t.table.currentRow=[]);break;case "th_open":case "td_open":t.table&&(t.table.currentCell=to());break;case "th_close":case "td_close":t.table?.currentCell&&(t.table.currentRow.push(ao(t.table.currentCell)),t.table.currentCell=null);break;case "hr":t.text+=`\u2500\u2500\u2500
53
53
 
54
- `;break;default:n.children&&Rt(n.children,t);break}}function An(e){for(let t=e.openStyles.length-1;t>=0;t-=1){let n=e.openStyles[t];if(!n)continue;let r=e.text.length;r>n.start&&e.styles.push({start:n.start,end:r,style:n.style});}e.openStyles=[];}function uo(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,style:r.style});}return n}function fo(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,href:r.href});}return n}function $n(e){let t=[...e].toSorted((r,o)=>r.start!==o.start?r.start-o.start:r.end!==o.end?r.end-o.end:r.style.localeCompare(o.style)),n=[];for(let r of t){let o=n[n.length-1];if(o&&o.style===r.style&&(r.start<o.end||r.start===o.end&&r.style!=="blockquote")){o.end=Math.max(o.end,r.end);continue}n.push({...r});}return n}function Bn(e,t,n){let r=Math.max(e.start,t),o=Math.min(e.end,n);return o<=r?null:{start:r,end:o}}function po(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,style:o.style});}return $n(r)}function mo(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,href:o.href});}return r}function ye(e,t){try{let n=typeof e=="string"?e:"",r=Ne.parse(t??{});return Me(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function Me(e,t){try{let n=typeof e=="string"?e:"",r=Ne.parse(t),o={listStack:[]},a=Zr(r).parse(n||"",o);r.enableSpoilers&&Xr(a);let i=r.tableMode??"off",c={text:"",styles:[],openStyles:[],links:[],linkStack:[],env:o,headingStyle:r.headingStyle??"none",blockquotePrefix:r.blockquotePrefix??"",enableSpoilers:r.enableSpoilers??!1,tableMode:i,table:null,hasTables:!1};Rt(a,c),An(c);let l=c.text.trimEnd().length,d=0;for(let E of c.styles)E.style==="code_block"&&E.end>d&&(d=E.end);let g=Math.max(l,d);return {ir:{text:g===c.text.length?c.text:c.text.slice(0,g),styles:$n(uo(c.styles,g)),links:fo(c.links,g)},hasTables:c.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function Ln(e,t){try{let n=Re.parse(e),r=typeof t=="number"&&t>0?t:0;if(!n.text)return [];if(r<=0||n.text.length<=r)return [n];let o=ge(n.text,r),s=[],a=0;return o.forEach((i,c)=>{if(!i)return;if(c>0)for(;a<n.text.length&&/\s/.test(n.text[a]??"");)a+=1;let p=a,l=Math.min(n.text.length,p+i.length);s.push({text:i,styles:po(n.styles,p,l),links:mo(n.links,p,l)}),a=l;}),s}catch(n){return console.error("Chunk IR error:",n),[]}}chunkVRQQ33YH_cjs.j();var go={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Ee(e,t){try{let n=Re.parse(e),r=wt.parse(t??{});if(!n.text)return "";let o=r.styleMarkers??go,s=r.escapeText??(d=>d),a=r.buildLink,i=[];for(let d=0;d<n.styles.length;d++){let g=n.styles[d];g&&(i.push({position:g.start,type:"open",style:g.style,spanIndex:d}),i.push({position:g.end,type:"close",style:g.style,spanIndex:d}));}for(let d=0;d<n.links.length;d++){let g=n.links[d];g&&(i.push({position:g.start,type:"link_open",spanIndex:d,href:g.href}),i.push({position:g.end,type:"link_close",spanIndex:d,href:g.href}));}i.sort((d,g)=>{if(d.position!==g.position)return d.position-g.position;let k=(N,ie)=>N==="link_open"?0:N==="open"?1:N==="close"?2:N==="link_close"?3:4,E=d.type==="close"||d.type==="link_close",D=g.type==="close"||g.type==="link_close",U=k(d.type,E),W=k(g.type,D);return U!==W?U-W:d.type==="open"&&g.type==="open"?d.spanIndex-g.spanIndex:d.type==="close"&&g.type==="close"?g.spanIndex-d.spanIndex:d.spanIndex-g.spanIndex});let c="",p=0,l=[];for(let d of i){if(d.position>p){let g=n.text.slice(p,d.position);c+=s?s(g):g;}if(d.type==="open"||d.type==="close"){let g=o[d.style];if(g)if(d.type==="open")c+=g.open,l.push(d);else {c+=g.close,d.style==="code_block"&&d.position<n.text.length&&(c+=`
55
- `);let k=l.findIndex(E=>E.spanIndex===d.spanIndex&&E.type==="open");k!==-1&&l.splice(k,1);}}else if(d.type==="link_open")c+="[",l.push(d);else if(d.type==="link_close"){c+="]("+d.href+")";let g=l.findIndex(k=>k.spanIndex===d.spanIndex&&k.type==="link_open");g!==-1&&l.splice(g,1);}p=d.position;}if(p<n.text.length){let d=n.text.slice(p);c+=s?s(d):d;}return c}catch(n){return console.error("Markdown render error:",n),""}}function xe(e,t){return Ee(e,t)}chunkVRQQ33YH_cjs.j();function ho(e){let t=e.replace(/\r\n/g,`
54
+ `;break;default:n.children&&Rt(n.children,t);break}}function An(e){for(let t=e.openStyles.length-1;t>=0;t-=1){let n=e.openStyles[t];if(!n)continue;let r=e.text.length;r>n.start&&e.styles.push({start:n.start,end:r,style:n.style});}e.openStyles=[];}function fo(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,style:r.style});}return n}function po(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,href:r.href});}return n}function Ln(e){let t=[...e].toSorted((r,o)=>r.start!==o.start?r.start-o.start:r.end!==o.end?r.end-o.end:r.style.localeCompare(o.style)),n=[];for(let r of t){let o=n[n.length-1];if(o&&o.style===r.style&&(r.start<o.end||r.start===o.end&&r.style!=="blockquote")){o.end=Math.max(o.end,r.end);continue}n.push({...r});}return n}function Bn(e,t,n){let r=Math.max(e.start,t),o=Math.min(e.end,n);return o<=r?null:{start:r,end:o}}function mo(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,style:o.style});}return Ln(r)}function go(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,href:o.href});}return r}function he(e,t){try{let n=typeof e=="string"?e:"",r=je.parse(t??{});return Pe(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function Pe(e,t){try{let n=typeof e=="string"?e:"",r=je.parse(t),o={listStack:[]},a=Xr(r).parse(n||"",o);r.enableSpoilers&&Qr(a);let i=r.tableMode??"off",c={text:"",styles:[],openStyles:[],links:[],linkStack:[],env:o,headingStyle:r.headingStyle??"none",blockquotePrefix:r.blockquotePrefix??"",enableSpoilers:r.enableSpoilers??!1,tableMode:i,table:null,hasTables:!1};Rt(a,c),An(c);let l=c.text.trimEnd().length,f=0;for(let E of c.styles)E.style==="code_block"&&E.end>f&&(f=E.end);let h=Math.max(l,f);return {ir:{text:h===c.text.length?c.text:c.text.slice(0,h),styles:Ln(fo(c.styles,h)),links:po(c.links,h)},hasTables:c.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function _n(e,t){try{let n=ve.parse(e),r=typeof t=="number"&&t>0?t:0;if(!n.text)return [];if(r<=0||n.text.length<=r)return [n];let o=pe(n.text,r),s=[],a=0;return o.forEach((i,c)=>{if(!i)return;if(c>0)for(;a<n.text.length&&/\s/.test(n.text[a]??"");)a+=1;let p=a,l=Math.min(n.text.length,p+i.length);s.push({text:i,styles:mo(n.styles,p,l),links:go(n.links,p,l)}),a=l;}),s}catch(n){return console.error("Chunk IR error:",n),[]}}chunkVRQQ33YH_cjs.j();var ho={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Me(e,t){try{let n=ve.parse(e),r=wt.parse(t??{});if(!n.text)return "";let o=r.styleMarkers??ho,s=r.escapeText??(f=>f),a=r.buildLink,i=[];for(let f=0;f<n.styles.length;f++){let h=n.styles[f];h&&(i.push({position:h.start,type:"open",style:h.style,spanIndex:f}),i.push({position:h.end,type:"close",style:h.style,spanIndex:f}));}for(let f=0;f<n.links.length;f++){let h=n.links[f];h&&(i.push({position:h.start,type:"link_open",spanIndex:f,href:h.href}),i.push({position:h.end,type:"link_close",spanIndex:f,href:h.href}));}i.sort((f,h)=>{if(f.position!==h.position)return f.position-h.position;let v=(U,G)=>U==="link_open"?0:U==="open"?1:U==="close"?2:U==="link_close"?3:4,E=f.type==="close"||f.type==="link_close",N=h.type==="close"||h.type==="link_close",W=v(f.type,E),H=v(h.type,N);return W!==H?W-H:f.type==="open"&&h.type==="open"?f.spanIndex-h.spanIndex:f.type==="close"&&h.type==="close"?h.spanIndex-f.spanIndex:f.spanIndex-h.spanIndex});let c="",p=0,l=[];for(let f of i){if(f.position>p){let h=n.text.slice(p,f.position);c+=s?s(h):h;}if(f.type==="open"||f.type==="close"){let h=o[f.style];if(h)if(f.type==="open")c+=h.open,l.push(f);else {c+=h.close,f.style==="code_block"&&f.position<n.text.length&&(c+=`
55
+ `);let v=l.findIndex(E=>E.spanIndex===f.spanIndex&&E.type==="open");v!==-1&&l.splice(v,1);}}else if(f.type==="link_open")c+="[",l.push(f);else if(f.type==="link_close"){c+="]("+f.href+")";let h=l.findIndex(v=>v.spanIndex===f.spanIndex&&v.type==="link_open");h!==-1&&l.splice(h,1);}p=f.position;}if(p<n.text.length){let f=n.text.slice(p);c+=s?s(f):f;}return c}catch(n){return console.error("Markdown render error:",n),""}}function be(e,t){return Me(e,t)}chunkVRQQ33YH_cjs.j();function bo(e){let t=e.replace(/\r\n/g,`
56
56
  `).replace(/\r/g,`
57
57
  `);if(!t.startsWith("---"))return {frontmatter:"",content:e};let n=t.indexOf(`
58
- ---`,3);if(n===-1)return {frontmatter:"",content:e};let r=t.slice(0,n+4),o=t.slice(n+4).trimStart();return {frontmatter:r,content:o}}function We(e,t){try{let n=typeof e=="string"?e:"",r=St.parse(t??{});if(!n)return "";let{frontmatter:o,content:s}=ho(n),a=ye(s,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),i=xe(a);return i=i.replace(/\n{3,}/g,`
58
+ ---`,3);if(n===-1)return {frontmatter:"",content:e};let r=t.slice(0,n+4),o=t.slice(n+4).trimStart();return {frontmatter:r,content:o}}function He(e,t){try{let n=typeof e=="string"?e:"",r=St.parse(t??{});if(!n)return "";let{frontmatter:o,content:s}=bo(n),a=he(s,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),i=be(a);return i=i.replace(/\n{3,}/g,`
59
59
 
60
60
  `),i=i.trimEnd()+`
61
61
  `,r.preserveFrontmatter&&o&&(i=o+`
62
- `+i),i}catch(n){return console.error("Markdown format error:",n),e}}chunkVRQQ33YH_cjs.j();function bo(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function yo(e){if(e!=null){if(typeof e=="string")return {value:e.trim(),kind:"scalar"};if(typeof e=="number"||typeof e=="boolean")return {value:String(e),kind:"scalar"};if(typeof e=="object")try{return {value:JSON.stringify(e),kind:"structured"}}catch{return}}}function xo(e){try{let t=_n__default.default.parse(e,{schema:"core"});if(!t||typeof t!="object"||Array.isArray(t))return null;let n={};for(let[r,o]of Object.entries(t)){let s=r.trim();if(!s)continue;let a=yo(o);a&&(n[s]=a);}return n}catch{return null}}function wo(e,t){let n=[],r=t+1;for(;r<e.length;){let s=e[r];if(!s){r+=1;continue}if(s.length>0&&!s.startsWith(" ")&&!s.startsWith(" "))break;n.push(s),r+=1;}return {value:n.join(`
63
- `).trim(),linesConsumed:r-t}}function So(e){let t={},n=e.split(`
64
- `),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let s=o.match(/^([\w-]+):\s*(.*)$/);if(!s?.[1]||!s[2]){r+=1;continue}let a=s[1],i=s[2].trim();if(!a){r+=1;continue}if(!i&&r+1<n.length){let p=n[r+1];if(p&&(p.startsWith(" ")||p.startsWith(" "))){let{value:l,linesConsumed:d}=wo(n,r);l&&(t[a]={value:l,kind:"multiline",rawInline:i}),r+=d;continue}}let c=bo(i);c&&(t[a]={value:c,kind:"inline",rawInline:i}),r+=1;}return t}function ko(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.value;return t}function To(e){return /^[|>][+-]?(\d+)?[+-]?$/.test(e)}function vo(e){let{lineEntry:t,yamlValue:n}=e;return n.kind!=="structured"||t.kind!=="inline"||To(t.rawInline)?false:t.value.includes(":")}function Ro(e){let t=e.replace(/\r\n/g,`
62
+ `+i),i}catch(n){return console.error("Markdown format error:",n),e}}chunkVRQQ33YH_cjs.j();function yo(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function xo(e){if(e!=null){if(typeof e=="string")return {value:e.trim(),kind:"scalar"};if(typeof e=="number"||typeof e=="boolean")return {value:String(e),kind:"scalar"};if(typeof e=="object")try{return {value:JSON.stringify(e),kind:"structured"}}catch{return}}}function wo(e){try{let t=jn__default.default.parse(e,{schema:"core"});if(!t||typeof t!="object"||Array.isArray(t))return null;let n={};for(let[r,o]of Object.entries(t)){let s=r.trim();if(!s)continue;let a=xo(o);a&&(n[s]=a);}return n}catch{return null}}function So(e,t){let n=[],r=t+1;for(;r<e.length;){let s=e[r];if(!s){r+=1;continue}if(s.length>0&&!s.startsWith(" ")&&!s.startsWith(" "))break;n.push(s),r+=1;}return {value:n.join(`
63
+ `).trim(),linesConsumed:r-t}}function ko(e){let t={},n=e.split(`
64
+ `),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let s=o.match(/^([\w-]+):\s*(.*)$/);if(!s?.[1]||!s[2]){r+=1;continue}let a=s[1],i=s[2].trim();if(!a){r+=1;continue}if(!i&&r+1<n.length){let p=n[r+1];if(p&&(p.startsWith(" ")||p.startsWith(" "))){let{value:l,linesConsumed:f}=So(n,r);l&&(t[a]={value:l,kind:"multiline",rawInline:i}),r+=f;continue}}let c=yo(i);c&&(t[a]={value:c,kind:"inline",rawInline:i}),r+=1;}return t}function To(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.value;return t}function vo(e){return /^[|>][+-]?(\d+)?[+-]?$/.test(e)}function Ro(e){let{lineEntry:t,yamlValue:n}=e;return n.kind!=="structured"||t.kind!=="inline"||vo(t.rawInline)?false:t.value.includes(":")}function Po(e){let t=e.replace(/\r\n/g,`
65
65
  `).replace(/\r/g,`
66
66
  `);if(!t.startsWith("---"))return;let n=t.indexOf(`
67
- ---`,3);if(n!==-1)return t.slice(4,n)}function Ce(e){try{if(typeof e!="string")return {};let t=Ro(e);if(!t)return {};let n=So(t),r=xo(t);if(r===null)return ko(n);let o={};for(let[s,a]of Object.entries(r)){o[s]=a.value;let i=n[s];i&&vo({lineEntry:i,yamlValue:a})&&(o[s]=i.value);}for(let[s,a]of Object.entries(n))s in o||(o[s]=a.value);return o}catch(t){return console.warn("Failed to parse frontmatter:",t),{}}}function Ue(e){try{let t=kt.parse(e);if(Object.keys(t).length===0)return "";let n={};for(let[o,s]of Object.entries(t))try{let a=JSON.parse(s);n[o]=a;}catch{n[o]=s;}return `---
68
- ${_n__default.default.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
69
- ---`}catch(t){return console.warn("Failed to serialize frontmatter:",t),""}}function qe(e){try{if(typeof e!="string")return {frontmatter:{},content:""};let t=e.replace(/\r\n/g,`
67
+ ---`,3);if(n!==-1)return t.slice(4,n)}function Ee(e){try{if(typeof e!="string")return {};let t=Po(e);if(!t)return {};let n=ko(t),r=wo(t);if(r===null)return To(n);let o={};for(let[s,a]of Object.entries(r)){o[s]=a.value;let i=n[s];i&&Ro({lineEntry:i,yamlValue:a})&&(o[s]=i.value);}for(let[s,a]of Object.entries(n))s in o||(o[s]=a.value);return o}catch(t){return console.warn("Failed to parse frontmatter:",t),{}}}function We(e){try{let t=kt.parse(e);if(Object.keys(t).length===0)return "";let n={};for(let[o,s]of Object.entries(t))try{let a=JSON.parse(s);n[o]=a;}catch{n[o]=s;}return `---
68
+ ${jn__default.default.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
69
+ ---`}catch(t){return console.warn("Failed to serialize frontmatter:",t),""}}function Ue(e){try{if(typeof e!="string")return {frontmatter:{},content:""};let t=e.replace(/\r\n/g,`
70
70
  `).replace(/\r/g,`
71
71
  `);if(!t.startsWith("---"))return {frontmatter:{},content:e};let n=t.indexOf(`
72
- ---`,3);if(n===-1)return {frontmatter:{},content:e};let r=t.slice(4,n),o=t.slice(n+4).trimStart();return {frontmatter:Ce(e),content:o}}catch(t){return console.warn("Failed to extract frontmatter:",t),{frontmatter:{},content:e}}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Ye(e){try{let t=_e.z.string().parse(e),n=[],r,o=0;for(;o<=t.length;){let s=t.indexOf(`
73
- `,o),a=s===-1?t.length:s,i=t.slice(o,a),c=i.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(c){let p=c[1],l=c[2];if(!p||!l){o=a+1;continue}let d=l[0];if(!d){o=a+1;continue}let g=l.length;if(!r)r={start:o,markerChar:d,markerLen:g,openLine:i,marker:l,indent:p};else if(r.markerChar===d&&g>=r.markerLen){let k=a;n.push({start:r.start,end:k,openLine:r.openLine,marker:r.marker,indent:r.indent}),r=void 0;}}if(s===-1)break;o=s+1;}return r&&n.push({start:r.start,end:t.length,openLine:r.openLine,marker:r.marker,indent:r.indent}),n}catch(t){return console.warn("Invalid input for parseFenceSpans:",t),[]}}function Pt(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),s=e[o];if(!s)break;if(t<=s.start){r=o-1;continue}if(t>=s.end){n=o+1;continue}return s}}function jn(e,t){return !Pt(e,t)}function Ve(){return {open:false,ticks:0}}function Ge(e,t){try{let n=_e.z.string().parse(e),r=t?De.parse(t):Ve(),o=Ye(n),s={open:r.open,ticks:r.ticks},{spans:a,state:i}=Eo(n,o,s);return {inlineState:i,isInside:c=>Oo(c,o)||Io(c,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Ve(),isInside:()=>false}}}function Eo(e,t,n){let r=[],o=n.open,s=n.ticks,a=o?0:-1,i=0;for(;i<e.length;){let c=Co(t,i);if(c){i=c.end;continue}if(e[i]!=="`"){i+=1;continue}let p=i,l=0;for(;i<e.length&&e[i]==="`";)l+=1,i+=1;if(!o){o=true,s=l,a=p;continue}l===s&&(r.push([a,i]),o=false,s=0,a=-1);}return o&&r.push([a,e.length]),{spans:r,state:{open:o,ticks:s}}}function Co(e,t){return e.find(n=>t>=n.start&&t<n.end)}function Oo(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Io(e,t){return t.some(([n,r])=>e>=n&&e<r)}chunkVRQQ33YH_cjs.j();var Ao={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Je(e,t){try{let n=_e.z.string().parse(e),r=Pe.parse(t);if(!n||r==="off")return n;let{ir:o,hasTables:s}=Me(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return s?Ee(o,{styleMarkers:Ao,escapeText:a=>a,buildLink:(a,i)=>{let c=a.href.trim();return !c||!i.slice(a.start,a.end)?null:{start:a.start,end:a.end,open:"[",close:`](${c})`}}}):n}catch(n){return console.warn("Invalid input for convertMarkdownTables:",n),typeof e=="string"?e:""}}exports.Markdown=void 0;(p=>{function e(l,d){try{return ye(l,d)}catch(g){return console.warn("Markdown.parse error:",g),{text:"",styles:[],links:[]}}}p.parse=e;function t(l,d){try{return xe(l,d)}catch(g){return console.warn("Markdown.render error:",g),""}}p.render=t;function n(l,d){try{return We(l,d)}catch(g){return console.warn("Markdown.format error:",g),typeof l=="string"?l:""}}p.format=n;function r(l){try{return Ce(l)}catch(d){return console.warn("Markdown.parseFrontmatter error:",d),{}}}p.parseFrontmatter=r;function o(l){try{return Ue(l)}catch(d){return console.warn("Markdown.serializeFrontmatter error:",d),""}}p.serializeFrontmatter=o;function s(l){try{return qe(l)}catch(d){return console.warn("Markdown.extractFrontmatter error:",d),{frontmatter:{},content:typeof l=="string"?l:""}}}p.extractFrontmatter=s;function a(l,d,g){try{return ge(l,d,g)}catch(k){return console.warn("Markdown.chunk error:",k),typeof l=="string"&&l.length>0?[l]:[]}}p.chunk=a;function i(l,d){try{return Ge(l,d)}catch(g){return console.warn("Markdown.buildCodeIndex error:",g),{inlineState:{open:false,ticks:0},isInside:()=>false}}}p.buildCodeIndex=i;function c(l,d){try{return Je(l,d)}catch(g){return console.warn("Markdown.convertTables error:",g),typeof l=="string"?l:""}}p.convertTables=c;})(exports.Markdown||(exports.Markdown={}));chunkVRQQ33YH_cjs.j();function Nn(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function $o(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function Bo(e){if(!e)return "";let t=e.split(".");return t[t.length-1]}function Lo(e,t=20){let n=Nn(e);if(n.length<=t)return n;let r=n.lastIndexOf("."),o=r<=0?"":n.slice(r),s=t-o.length-1;return s<=0?n.slice(0,t-1)+"\u2026":n.slice(0,s)+"\u2026"+o}function _o(e,t=20){if(e.length<=t)return e;let n=t-1,r=Math.ceil(n/2),o=Math.floor(n/2);return e.slice(0,r)+"\u2026"+e.slice(-o)}chunkVRQQ33YH_cjs.j();var jo=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function No(e){if(!e)return false;let t=String(e instanceof Error?e.message:e).toLowerCase();return jo.some(n=>t.includes(n))}async function Do(e,t={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:s=1e4,retryIf:a=No}=t,i;for(let c=0;c<n;c++)try{return await e()}catch(p){if(i=p,c===n-1||!a(p))throw p;let l=Math.min(r*o**c,s);await new Promise(d=>setTimeout(d,l));}throw i}chunkVRQQ33YH_cjs.j();exports.Fetch=void 0;(Ie=>{let e=chunkWWPI6PC4_cjs.a.create({service:"fetch"}),t=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],n=false,r=null;function o(){return t.some(O=>{let C=process.env[O];return typeof C=="string"&&C.trim().length>0})}Ie.hasProxyConfigured=o;function s(){let O=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||O}Ie.getProxyUrl=s;function a(O={}){let C=O.httpProxy||O.httpsProxy||s();if(!C){e.warn("[Fetch] \u672A\u914D\u7F6E\u4EE3\u7406\uFF0C\u73AF\u5883\u53D8\u91CF HTTP_PROXY/HTTPS_PROXY \u672A\u8BBE\u7F6E");return}let _=new undici.ProxyAgent({uri:C,connectTimeout:O.connectTimeout||1e4,keepAliveTimeout:O.keepAliveTimeout||3e4});r=undici.getGlobalDispatcher(),undici.setGlobalDispatcher(_),n=true,console.log(`[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u542F\u7528: ${C}`);}Ie.enableProxy=a;function i(){!n||!r||(undici.setGlobalDispatcher(r),n=false,r=null,console.log("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}Ie.disableProxy=i;function c(){return n}Ie.isProxyEnabled=c;async function p(O,C){let _=C?.timeout||3e4,V=C?.responseType||"json",{timeout:q,responseType:ue,...G}=C||{},A=null,w=null;try{G.signal||(A=new AbortController,w=setTimeout(()=>A.abort(),_));let m=await fetch(O,{...G,signal:G.signal||A.signal});w&&clearTimeout(w);let f;switch(V){case "arrayBuffer":f=await m.arrayBuffer();break;case "blob":f=await m.blob();break;case "buffer":{let u=await m.arrayBuffer();f=Buffer.from(u);break}case "text":f=await m.text();break;default:{let u=await m.text();try{f=JSON.parse(u);}catch{f=u;}break}}return {ok:m.ok,status:m.status,statusText:m.statusText,headers:m.headers,data:f,url:m.url}}catch(m){throw w&&clearTimeout(w),m}}async function l(O,C){let _=C?.retries||0,V=C?.retryDelay||1e3,{retries:q,retryDelay:ue,responseType:G,...A}=C||{},w;for(let m=0;m<=_;m++)try{return await p(O,{...A,responseType:C?.responseType})}catch(f){if(w=f,m<_){let u=V*2**m;await new Promise(y=>setTimeout(y,u));}}throw w}async function d(O,C){return l(O,{method:"GET",...C})}Ie.get=d;async function g(O,C,_){return l(O,{method:"POST",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.post=g;async function k(O,C,_){return l(O,{method:"PUT",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.put=k;async function E(O,C,_){return l(O,{method:"DELETE",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.del=E;async function D(O,C,_){return l(O,{method:"PATCH",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.patch=D;async function U(O,C){return l(O,C)}Ie.request=U;function W(O={}){return o()?(a(O),true):false}Ie.autoProxy=W;function N(O){return new TextEncoder().encode(O)}function ie(O){return chunkJL3GR4P7_cjs.c.mimeType(O)}function Oe(O){return O.startsWith("file://")}async function Ke(O){let C=url.fileURLToPath(O);return await exports.PKG.file(C).bytes()}async function Nt(O,C,_){let V=`----FetchFormBoundary${Date.now()}`,q=[];for(let u of C){let y=u.filename,x=`Content-Disposition: form-data; name="${u.name}"${y?`; filename="${y}"`:""}`;y&&(x+=`\r
74
- Content-Type: ${ie(y)}`),x+=`\r
72
+ ---`,3);if(n===-1)return {frontmatter:{},content:e};let r=t.slice(4,n),o=t.slice(n+4).trimStart();return {frontmatter:Ee(e),content:o}}catch(t){return console.warn("Failed to extract frontmatter:",t),{frontmatter:{},content:e}}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function qe(e){try{let t=Be.z.string().parse(e),n=[],r,o=0;for(;o<=t.length;){let s=t.indexOf(`
73
+ `,o),a=s===-1?t.length:s,i=t.slice(o,a),c=i.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(c){let p=c[1],l=c[2];if(!p||!l){o=a+1;continue}let f=l[0];if(!f){o=a+1;continue}let h=l.length;if(!r)r={start:o,markerChar:f,markerLen:h,openLine:i,marker:l,indent:p};else if(r.markerChar===f&&h>=r.markerLen){let v=a;n.push({start:r.start,end:v,openLine:r.openLine,marker:r.marker,indent:r.indent}),r=void 0;}}if(s===-1)break;o=s+1;}return r&&n.push({start:r.start,end:t.length,openLine:r.openLine,marker:r.marker,indent:r.indent}),n}catch(t){return console.warn("Invalid input for parseFenceSpans:",t),[]}}function Pt(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),s=e[o];if(!s)break;if(t<=s.start){r=o-1;continue}if(t>=s.end){n=o+1;continue}return s}}function Nn(e,t){return !Pt(e,t)}function Ye(){return {open:false,ticks:0}}function Ve(e,t){try{let n=Be.z.string().parse(e),r=t?Ne.parse(t):Ye(),o=qe(n),s={open:r.open,ticks:r.ticks},{spans:a,state:i}=Co(n,o,s);return {inlineState:i,isInside:c=>Oo(c,o)||Fo(c,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Ye(),isInside:()=>false}}}function Co(e,t,n){let r=[],o=n.open,s=n.ticks,a=o?0:-1,i=0;for(;i<e.length;){let c=Io(t,i);if(c){i=c.end;continue}if(e[i]!=="`"){i+=1;continue}let p=i,l=0;for(;i<e.length&&e[i]==="`";)l+=1,i+=1;if(!o){o=true,s=l,a=p;continue}l===s&&(r.push([a,i]),o=false,s=0,a=-1);}return o&&r.push([a,e.length]),{spans:r,state:{open:o,ticks:s}}}function Io(e,t){return e.find(n=>t>=n.start&&t<n.end)}function Oo(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Fo(e,t){return t.some(([n,r])=>e>=n&&e<r)}chunkVRQQ33YH_cjs.j();var Ao={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Ge(e,t){try{let n=Be.z.string().parse(e),r=Re.parse(t);if(!n||r==="off")return n;let{ir:o,hasTables:s}=Pe(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return s?Me(o,{styleMarkers:Ao,escapeText:a=>a,buildLink:(a,i)=>{let c=a.href.trim();return !c||!i.slice(a.start,a.end)?null:{start:a.start,end:a.end,open:"[",close:`](${c})`}}}):n}catch(n){return console.warn("Invalid input for convertMarkdownTables:",n),typeof e=="string"?e:""}}exports.Markdown=void 0;(p=>{function e(l,f){try{return he(l,f)}catch(h){return console.warn("Markdown.parse error:",h),{text:"",styles:[],links:[]}}}p.parse=e;function t(l,f){try{return be(l,f)}catch(h){return console.warn("Markdown.render error:",h),""}}p.render=t;function n(l,f){try{return He(l,f)}catch(h){return console.warn("Markdown.format error:",h),typeof l=="string"?l:""}}p.format=n;function r(l){try{return Ee(l)}catch(f){return console.warn("Markdown.parseFrontmatter error:",f),{}}}p.parseFrontmatter=r;function o(l){try{return We(l)}catch(f){return console.warn("Markdown.serializeFrontmatter error:",f),""}}p.serializeFrontmatter=o;function s(l){try{return Ue(l)}catch(f){return console.warn("Markdown.extractFrontmatter error:",f),{frontmatter:{},content:typeof l=="string"?l:""}}}p.extractFrontmatter=s;function a(l,f,h){try{return pe(l,f,h)}catch(v){return console.warn("Markdown.chunk error:",v),typeof l=="string"&&l.length>0?[l]:[]}}p.chunk=a;function i(l,f){try{return Ve(l,f)}catch(h){return console.warn("Markdown.buildCodeIndex error:",h),{inlineState:{open:false,ticks:0},isInside:()=>false}}}p.buildCodeIndex=i;function c(l,f){try{return Ge(l,f)}catch(h){return console.warn("Markdown.convertTables error:",h),typeof l=="string"?l:""}}p.convertTables=c;})(exports.Markdown||(exports.Markdown={}));chunkVRQQ33YH_cjs.j();function Dn(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function Lo(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function Bo(e){if(!e)return "";let t=e.split(".");return t[t.length-1]}function _o(e,t=20){let n=Dn(e);if(n.length<=t)return n;let r=n.lastIndexOf("."),o=r<=0?"":n.slice(r),s=t-o.length-1;return s<=0?n.slice(0,t-1)+"\u2026":n.slice(0,s)+"\u2026"+o}function jo(e,t=20){if(e.length<=t)return e;let n=t-1,r=Math.ceil(n/2),o=Math.floor(n/2);return e.slice(0,r)+"\u2026"+e.slice(-o)}chunkVRQQ33YH_cjs.j();var No=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function Do(e){if(!e)return false;let t=String(e instanceof Error?e.message:e).toLowerCase();return No.some(n=>t.includes(n))}async function Et(e,t={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:s=1e4,retryIf:a=Do}=t,i;for(let c=0;c<n;c++)try{return await e()}catch(p){if(i=p,c===n-1||!a(p))throw p;let l=Math.min(r*o**c,s);await new Promise(f=>setTimeout(f,l));}throw i}chunkVRQQ33YH_cjs.j();exports.Fetch=void 0;(zt=>{let e=chunkWWPI6PC4_cjs.a.create({service:"fetch"}),t=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],n=false,r=null;function o(){return t.some(O=>{let C=process.env[O];return typeof C=="string"&&C.trim().length>0})}zt.hasProxyConfigured=o;function s(){let O=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||O}zt.getProxyUrl=s;function a(O={}){let C=O.httpProxy||O.httpsProxy||s();if(!C){e.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let A=new undici.ProxyAgent({uri:C,connectTimeout:O.connectTimeout||1e4,keepAliveTimeout:O.keepAliveTimeout||3e4});r=undici.getGlobalDispatcher(),undici.setGlobalDispatcher(A),n=true,e.info(`[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u542F\u7528: ${C}`);}zt.enableProxy=a;function i(){!n||!r||(undici.setGlobalDispatcher(r),n=false,r=null,e.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}zt.disableProxy=i;function c(){return n}zt.isProxyEnabled=c;async function p(O,C){let A=C?.timeout||3e4,q=C?.responseType||"json",{timeout:V,responseType:ye,..._}=C||{},S=null,m=null;try{_.signal||(S=new AbortController,m=setTimeout(()=>S.abort(),A));let d=await fetch(O,{..._,signal:_.signal||S.signal});m&&clearTimeout(m);let u;switch(q){case "arrayBuffer":u=await d.arrayBuffer();break;case "blob":u=await d.blob();break;case "buffer":{let y=await d.arrayBuffer();u=Buffer.from(y);break}case "text":u=await d.text();break;default:{let y=await d.text();try{u=JSON.parse(y);}catch{u=y;}break}}return {ok:d.ok,status:d.status,statusText:d.statusText,headers:d.headers,data:u,url:d.url}}catch(d){throw m&&clearTimeout(m),d}}async function l(O,C){let A=C?.retries??0,q=C?.retryDelay??1e3,{retries:V,retryDelay:ye,responseType:_,...S}=C||{};return Et(()=>p(O,{...S,responseType:C?.responseType}),{attempts:A+1,delay:q,maxDelay:q*2**(A+1)})}async function f(O,C){return l(O,{method:"GET",...C})}zt.get=f;async function h(O,C,A){return l(O,{method:"POST",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.post=h;async function v(O,C,A){return l(O,{method:"PUT",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.put=v;async function E(O,C,A){return l(O,{method:"DELETE",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.del=E;async function N(O,C,A){return l(O,{method:"PATCH",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.patch=N;async function W(O,C){return l(O,C)}zt.request=W;function H(O={}){return o()?(a(O),true):false}zt.autoProxy=H;let U=5*1024*1024;function G(O){return new TextEncoder().encode(O)}function Ce(O){return chunkJL3GR4P7_cjs.c.mimeType(O)}function Je(O){return O.startsWith("file://")}async function Ke(O){let C=url.fileURLToPath(O);return await exports.PKG.file(C).bytes()}async function Dt(O,C,A){let q=`----FetchFormBoundary${Date.now()}`,V=[],_=C.some(g=>g.filename||g.value instanceof Uint8Array||Buffer.isBuffer(g.value))&&!A?.timeout?3e5:A?.timeout;for(let g of C){let w=g.maxSize??U,R=g.filename,T=`Content-Disposition: form-data; name="${g.name}"${R?`; filename="${R}"`:""}`;R&&(T+=`\r
74
+ Content-Type: ${Ce(R)}`),T+=`\r
75
75
  \r
76
- `,q.push(N(x));let h=u.value;if(typeof h=="string")if(Oe(h)){let S=await Ke(h);y||(y=h.split("/").pop()||"file"),q.push(S);}else q.push(N(h));else Buffer.isBuffer(h)?q.push(new Uint8Array(h.buffer,h.byteOffset,h.byteLength)):h instanceof Uint8Array&&q.push(h);}let ue=N(`\r
77
- --${V}--`),G=N(`\r
78
- --${V}\r
79
- `),A=[];A.push(N(`--${V}\r
80
- `));for(let u=0;u<q.length;u++)A.push(q[u]),u%2===1&&u<q.length-1&&(A.push(G),A.push(N(`--${V}\r
81
- `)));A.push(ue);let w=A.reduce((u,y)=>u+y.length,0),m=new Uint8Array(w),f=0;for(let u of A)m.set(u,f),f+=u.length;return l(O,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${V}`,..._?.headers},body:m,..._})}Ie.postForm=Nt;function Dt(O,C,_){let V=new AbortController,q=V.signal;return (async()=>{try{let G={Accept:"text/event-stream",..._?.headers||{}},A=await fetch(O,{..._,headers:G,signal:q});if(!A.ok)throw new Error(`SSE connection failed: ${A.status}`);let w=A.body?.getReader();if(!w)throw new Error("SSE stream not available");let m=new TextDecoder("utf-8"),f="";for(;!q.aborted;){let{done:u,value:y}=await w.read();if(u)break;let x=m.decode(y,{stream:!0});f+=x;let h=f.split(`
82
- `);f=h.pop()??"";for(let S of h)if(S.startsWith("data: ")){let P=S.slice(6);if(P==="[DONE]"){C.onComplete?.();return}C.onMessage?.(P);}}C.onComplete?.();}catch(G){G.name!=="AbortError"&&C.onError?.(G);}})(),()=>{V.abort();}}Ie.sse=Dt;})(exports.Fetch||(exports.Fetch={}));chunkVRQQ33YH_cjs.j();exports.Slug=void 0;(r=>{let e=["brave","calm","clever","cosmic","crisp","curious","eager","gentle","glowing","happy","hidden","jolly","kind","lucky","mighty","misty","neon","nimble","playful","proud","quick","quiet","shiny","silent","stellar","sunny","swift","tidy","witty"],t=["cabin","cactus","canyon","circuit","comet","eagle","engine","falcon","forest","garden","harbor","island","knight","lagoon","meadow","moon","mountain","nebula","orchid","otter","panda","pixel","planet","river","rocket","sailor","squid","star","tiger","wizard","wolf"];function n(){return [e[Math.floor(Math.random()*e.length)],t[Math.floor(Math.random()*t.length)]].join("-")}r.create=n;})(exports.Slug||(exports.Slug={}));chunkVRQQ33YH_cjs.j();function zn(e){let t=new AbortController,n=setTimeout(t.abort.bind(t),e);return {controller:t,signal:t.signal,clearTimeout:()=>globalThis.clearTimeout(n)}}function Uo(e,...t){let n=zn(e);return {signal:AbortSignal.any([n.signal,...t]),clearTimeout:n.clearTimeout}}chunkVRQQ33YH_cjs.j();exports.Archive=void 0;(t=>{async function e(n,r){if(process.platform==="win32"){let o=me__default.default.resolve(n),s=me__default.default.resolve(r),a=`Expand-Archive -Path '${o}' -DestinationPath '${s}' -Force`,i=await exports.Shell.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${a}"`);if(i.code!==0)throw new Error(`PowerShell exited with code ${i.code}: ${i.stderr}`)}else {let o=`unzip -o -q ${n} -d ${r}`,s=await exports.Shell.run(void 0,o);if(s.code!==0)throw new Error(`unzip exited with code ${s.code}: ${s.stderr}`)}}t.extractZip=e;})(exports.Archive||(exports.Archive={}));chunkVRQQ33YH_cjs.j();exports.Color=void 0;(r=>{function e(o){return o?/^#[0-9a-fA-F]{6}$/.test(o):false}r.isValidHex=e;function t(o){let s=parseInt(o.slice(1,3),16),a=parseInt(o.slice(3,5),16),i=parseInt(o.slice(5,7),16);return {r:s,g:a,b:i}}r.hexToRgb=t;function n(o){if(!e(o))return;let{r:s,g:a,b:i}=t(o);return `\x1B[38;2;${s};${a};${i}m\x1B[1m`}r.hexToAnsiBold=n;})(exports.Color||(exports.Color={}));chunkVRQQ33YH_cjs.j();exports.Context=void 0;(n=>{class e extends Error{constructor(s){super(`No context found for ${s}`);chunkVRQQ33YH_cjs.c(this,"name",s);}}n.NotFound=e;function t(r){let o=new async_hooks.AsyncLocalStorage;return {use(){let s=o.getStore();if(!s)throw new e(r);return s},provide(s,a){return o.run(s,a)}}}n.create=t;})(exports.Context||(exports.Context={}));chunkVRQQ33YH_cjs.j();function Yo(e){return {[Symbol.dispose](){e();},[Symbol.asyncDispose](){return Promise.resolve(e())}}}chunkVRQQ33YH_cjs.j();exports.EventLoop=void 0;(t=>{async function e(){return new Promise(n=>{let r=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?n():setImmediate(r);};r();})}t.wait=e;})(exports.EventLoop||(exports.EventLoop={}));chunkVRQQ33YH_cjs.j();function Vo(e){if(e<=0)return "";if(e<60)return `${e}s`;if(e<3600){let n=Math.floor(e/60),r=e%60;return r>0?`${n}m ${r}s`:`${n}m`}if(e<86400){let n=Math.floor(e/3600),r=Math.floor(e%3600/60);return r>0?`${n}h ${r}m`:`${n}h`}if(e<604800){let n=Math.floor(e/86400);return n===1?"~1 day":`~${n} days`}let t=Math.floor(e/604800);return t===1?"~1 week":`~${t} weeks`}chunkVRQQ33YH_cjs.j();exports.Keybind=void 0;(a=>{function e(i,c){if(i===c)return true;if(typeof i!="object"||typeof c!="object"||i===null||c===null)return false;let p=Object.keys(i),l=Object.keys(c);if(p.length!==l.length)return false;for(let d of p)if(!l.includes(d)||!e(i[d],c[d]))return false;return true}function t(i){return {...i,super:i.super??false}}function n(i,c){return i?e(t(i),t(c)):false}a.match=n;function r(i,c=false){return {name:i.name,ctrl:i.ctrl,meta:i.meta,shift:i.shift,super:i.super??false,leader:c}}a.fromParsedKey=r;function o(i){if(!i)return "";let c=[];i.ctrl&&c.push("ctrl"),i.meta&&c.push("alt"),i.super&&c.push("super"),i.shift&&c.push("shift"),i.name&&(i.name==="delete"?c.push("del"):c.push(i.name));let p=c.join("+");return i.leader&&(p=p?`<leader> ${p}`:"<leader>"),p}a.keyToString=o;function s(i){return i==="none"?[]:i.split(",").map(c=>{let l=c.replace(/<leader>/g,"leader+").toLowerCase().split("+"),d={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let g of l)switch(g){case "ctrl":d.ctrl=true;break;case "alt":case "meta":case "option":d.meta=true;break;case "super":d.super=true;break;case "shift":d.shift=true;break;case "leader":d.leader=true;break;case "esc":d.name="escape";break;default:d.name=g;break}return d})}a.parse=s;})(exports.Keybind||(exports.Keybind={}));chunkVRQQ33YH_cjs.j();exports.Locale=void 0;(p=>{function e(l){return l.replace(/\b\w/g,d=>d.toUpperCase())}p.titlecase=e;function t(l){return new Date(l).toLocaleTimeString(void 0,{timeStyle:"short"})}p.time=t;function n(l){let d=new Date(l),g=t(l),k=d.toLocaleDateString();return `${g} \xB7 ${k}`}p.datetime=n;function r(l){let d=new Date(l),g=new Date;return d.getFullYear()===g.getFullYear()&&d.getMonth()===g.getMonth()&&d.getDate()===g.getDate()?t(l):n(l)}p.todayTimeOrDateTime=r;function o(l){return l>=1e6?(l/1e6).toFixed(1)+"M":l>=1e3?(l/1e3).toFixed(1)+"K":l.toString()}p.number=o;function s(l){if(l<1e3)return `${l}ms`;if(l<6e4)return `${(l/1e3).toFixed(1)}s`;if(l<36e5){let k=Math.floor(l/6e4),E=Math.floor(l%6e4/1e3);return `${k}m ${E}s`}if(l<864e5){let k=Math.floor(l/36e5),E=Math.floor(l%36e5/6e4);return `${k}h ${E}m`}let d=Math.floor(l/36e5);return `${Math.floor(l%36e5/864e5)}d ${d}h`}p.duration=s;function a(l,d){return l.length<=d?l:l.slice(0,d-1)+"\u2026"}p.truncate=a;function i(l,d=35){if(l.length<=d)return l;let g="\u2026",k=Math.ceil((d-g.length)/2),E=Math.floor((d-g.length)/2);return l.slice(0,k)+g+l.slice(-E)}p.truncateMiddle=i;function c(l,d,g){return (l===1?d:g).replace("{}",l.toString())}p.pluralize=c;})(exports.Locale||(exports.Locale={}));chunkVRQQ33YH_cjs.j();var Go=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Jo(){return Go.some(e=>process.env[e])}function Ko(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function Zo(){let e=process.env.HTTP_PROXY||process.env.http_proxy,t=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:e,https:t,enabled:!!(e||t)}}chunkVRQQ33YH_cjs.j();var Lt=class{constructor(){chunkVRQQ33YH_cjs.c(this,"queue",[]);chunkVRQQ33YH_cjs.c(this,"resolvers",[]);}push(t){let n=this.resolvers.shift();n?n(t):this.queue.push(t);}async next(){return this.queue.length>0?this.queue.shift():new Promise(t=>this.resolvers.push(t))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Xo(e,t,n){let r=[...t];await Promise.all(Array.from({length:e},async()=>{for(;;){let o=r.pop();if(o===void 0)return;await n(o);}}));}chunkVRQQ33YH_cjs.j();function Qo(){let e,t=new Promise(n=>e=n);return {trigger(){return e()},wait(){return t}}}chunkVRQQ33YH_cjs.j();function es(e,t){let n;return Promise.race([e.then(r=>(clearTimeout(n),r)),new Promise((r,o)=>{n=setTimeout(()=>{o(new Error(`Operation timed out after ${t}ms`));},t);})])}chunkVRQQ33YH_cjs.j();exports.Token=void 0;(a=>{let n=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function r(i){if(!i)return 0;let c=String(i),p=(c.match(n)||[]).length,l=c.length-p,d=Math.round(p/1.5),g=Math.round(l/4);return Math.max(0,d+g)}a.estimate=r;function o(i){if(i==null)return 0;try{let c=typeof i=="string"?i:JSON.stringify(i);return r(c)}catch{return 0}}a.estimateObject=o;function s(i){if(i.total!==void 0&&i.total>0)return i.total;let c=i.input??0,p=i.output??0,l=i.cache?.read??0,d=i.cache?.write??0;return c+p+l+d}a.total=s;})(exports.Token||(exports.Token={}));chunkVRQQ33YH_cjs.j();function ns(e){let t={};for(let[n,r]of Object.entries(e.required().shape))t[n]=r.nullable();return _e__default.default.object(t)}chunkVRQQ33YH_cjs.j();exports.Wildcard=void 0;(s=>{function e(a,i){let c=i.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return c.endsWith(" .*")&&(c=c.slice(0,-3)+"( .*)?"),new RegExp("^"+c+"$","s").test(a)}s.match=e;function t(a){return a.sort((i,c)=>{let p=i[0].length-c[0].length;return p!==0?p:i[0].localeCompare(c[0])})}function n(a,i){let c=Object.entries(i),p=t(c),l;for(let[d,g]of p)e(a,d)&&(l=g);return l}s.all=n;function r(a,i){let c=Object.entries(i),p=t(c),l;for(let[d,g]of p){let k=d.split(/\s+/);e(a.head,k[0])&&(k.length===1||o(a.tail,k.slice(1)))&&(l=g);}return l}s.allStructured=r;function o(a,i){if(i.length===0)return true;if(a.length<i.length)return false;for(let c=0;c<i.length;c++)if(!e(a[c],i[c]))return false;return true}})(exports.Wildcard||(exports.Wildcard={}));async function gl(e){let{Log:t}=await import('./chunks/log-OJU7I2TN.cjs'),n=false;await t.init({logDir:e.logDir??process.env.EASBOT_LOG_PATH??process.cwd(),print:e.print??false,dev:e.dev??n,level:e.level??("INFO")});}Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.c}});Object.defineProperty(exports,"Glob",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.a}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.b}});Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.b}});Object.defineProperty(exports,"Semver",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.a}});Object.defineProperty(exports,"Lock",{enumerable:true,get:function(){return chunkYC4AEMOP_cjs.a}});Object.defineProperty(exports,"Hono",{enumerable:true,get:function(){return hono.Hono}});Object.defineProperty(exports,"createNodeWebSocket",{enumerable:true,get:function(){return nodeWs.createNodeWebSocket}});Object.defineProperty(exports,"cors",{enumerable:true,get:function(){return cors.cors}});Object.defineProperty(exports,"logger",{enumerable:true,get:function(){return logger.logger}});Object.defineProperty(exports,"compress",{enumerable:true,get:function(){return compress.compress}});Object.defineProperty(exports,"secureHeaders",{enumerable:true,get:function(){return secureHeaders.secureHeaders}});Object.defineProperty(exports,"timeout",{enumerable:true,get:function(){return timeout.timeout}});Object.defineProperty(exports,"HTTPException",{enumerable:true,get:function(){return httpException.HTTPException}});Object.defineProperty(exports,"validator",{enumerable:true,get:function(){return validator.validator}});Object.defineProperty(exports,"zValidator",{enumerable:true,get:function(){return zodValidator.zValidator}});exports.$=Cr;exports.AsyncQueue=Lt;exports.NamedError=pt;exports.PkgShell=Se;exports.abortAfter=zn;exports.abortAfterAny=Uo;exports.buildCodeSpanIndex=Ge;exports.chunkMarkdownIR=Ln;exports.chunkText=ge;exports.chunkTextByBreakResolver=yt;exports.convertMarkdownTables=Je;exports.createInlineCodeState=Ve;exports.createPkgShell=ce;exports.createRESTServer=at;exports.createRPCServer=it;exports.createServer=se;exports.createStreamingServer=lt;exports.createWebSocketServer=ct;exports.defer=Yo;exports.detectPlatform=pn;exports.escapeCommandArg=ft;exports.escapeCommandArgSafe=fn;exports.extractFrontmatter=qe;exports.findFenceSpanAt=Pt;exports.findLast=Gn;exports.fn=Ir;exports.formatDuration=Vo;exports.formatLocalISO=rt;exports.formatLocalISOCompact=ot;exports.formatLogTime=Qn;exports.formatMarkdown=We;exports.getDirectory=$o;exports.getFileExtension=Bo;exports.getFilename=Nn;exports.getFilenameTruncated=Lo;exports.getProxyConfig=Zo;exports.getProxyUrl=Ko;exports.getTimezoneOffset=er;exports.git=Lr;exports.iife=Wr;exports.initLog=gl;exports.isSafeFenceBreak=jn;exports.joinCommandArgs=fe;exports.lazy=Ae;exports.lazyAsync=tr;exports.loadEnv=Br;exports.loadTextFile=zr;exports.loadTextFileAsync=Hr;exports.markdownToIR=ye;exports.markdownToIRWithMeta=Me;exports.needsShellExecution=un;exports.now=qt;exports.nowLocalISO=Zn;exports.parseCommand=re;exports.parseCommandWithOptions=dn;exports.parseFenceSpans=Ye;exports.parseFrontmatterBlock=Ce;exports.parseLocalISO=Xn;exports.parseModelId=Ur;exports.proxied=Jo;exports.readableStreamToText=Pr;exports.renderMarkdown=xe;exports.renderMarkdownWithMarkers=Ee;exports.retry=Do;exports.scanParenAwareBreakpoints=bt;exports.serializeFrontmatter=Ue;exports.shell=gn;exports.signal=Qo;exports.startServer=sr;exports.truncateMiddle=_o;exports.updateSchema=ns;exports.whichSync=Mr;exports.withTimeout=es;exports.work=Xo;
76
+ `,V.push(G(T));let k=g.value;if(typeof k=="string")if(Je(k)){let I=await Ke(k);if(R||(R=k.split("/").pop()||"file"),I.byteLength>w)throw new Error(`File size ${I.byteLength} exceeds limit ${w} bytes: ${R}`);V.push(I);}else V.push(G(k));else if(Buffer.isBuffer(k)){if(k.byteLength>w)throw new Error(`Buffer size ${k.byteLength} exceeds limit ${w} bytes: ${g.name}`);V.push(new Uint8Array(k.buffer,k.byteOffset,k.byteLength));}else if(k instanceof Uint8Array){if(k.byteLength>w)throw new Error(`File size ${k.byteLength} exceeds limit ${w} bytes: ${g.name}`);V.push(k);}}let S=G(`\r
77
+ --${q}--`),m=G(`\r
78
+ --${q}\r
79
+ `),d=[];d.push(G(`--${q}\r
80
+ `));for(let g=0;g<V.length;g++)d.push(V[g]),g%2===1&&g<V.length-1&&(d.push(m),d.push(G(`--${q}\r
81
+ `)));d.push(S);let u=d.reduce((g,w)=>g+w.length,0),y=new Uint8Array(u),x=0;for(let g of d)y.set(g,x),x+=g.length;return l(O,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${q}`,...A?.headers},body:y,timeout:_,...A})}zt.postForm=Dt;function Ie(O,C,A){let q=new AbortController,V=q.signal;return (async()=>{try{let _={Accept:"text/event-stream",...A?.headers||{}},S=await fetch(O,{...A,headers:_,signal:V});if(!S.ok)throw new Error(`SSE connection failed: ${S.status}`);let m=S.body?.getReader();if(!m)throw new Error("SSE stream not available");let d=new TextDecoder("utf-8"),u="";for(;!V.aborted;){let{done:y,value:x}=await m.read();if(y)break;let g=d.decode(x,{stream:!0});u+=g;let w=u.split(`
82
+ `);u=w.pop()??"";for(let R of w)if(R.startsWith("data: ")){let T=R.slice(6);if(T==="[DONE]"){C.onComplete?.();return}C.onMessage?.(T);}}C.onComplete?.();}catch(_){_.name!=="AbortError"&&C.onError?.(_);}})(),()=>{q.abort();}}zt.sse=Ie;})(exports.Fetch||(exports.Fetch={}));chunkVRQQ33YH_cjs.j();exports.Slug=void 0;(r=>{let e=["brave","calm","clever","cosmic","crisp","curious","eager","gentle","glowing","happy","hidden","jolly","kind","lucky","mighty","misty","neon","nimble","playful","proud","quick","quiet","shiny","silent","stellar","sunny","swift","tidy","witty"],t=["cabin","cactus","canyon","circuit","comet","eagle","engine","falcon","forest","garden","harbor","island","knight","lagoon","meadow","moon","mountain","nebula","orchid","otter","panda","pixel","planet","river","rocket","sailor","squid","star","tiger","wizard","wolf"];function n(){return [e[Math.floor(Math.random()*e.length)],t[Math.floor(Math.random()*t.length)]].join("-")}r.create=n;})(exports.Slug||(exports.Slug={}));chunkVRQQ33YH_cjs.j();function Hn(e){let t=new AbortController,n=setTimeout(t.abort.bind(t),e);return {controller:t,signal:t.signal,clearTimeout:()=>globalThis.clearTimeout(n)}}function Uo(e,...t){let n=Hn(e);return {signal:AbortSignal.any([n.signal,...t]),clearTimeout:n.clearTimeout}}chunkVRQQ33YH_cjs.j();exports.Archive=void 0;(t=>{async function e(n,r){if(process.platform==="win32"){let o=fe__default.default.resolve(n),s=fe__default.default.resolve(r),a=`Expand-Archive -Path '${o}' -DestinationPath '${s}' -Force`,i=await exports.Shell.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${a}"`);if(i.code!==0)throw new Error(`PowerShell exited with code ${i.code}: ${i.stderr}`)}else {let o=`unzip -o -q ${n} -d ${r}`,s=await exports.Shell.run(void 0,o);if(s.code!==0)throw new Error(`unzip exited with code ${s.code}: ${s.stderr}`)}}t.extractZip=e;})(exports.Archive||(exports.Archive={}));chunkVRQQ33YH_cjs.j();exports.Color=void 0;(r=>{function e(o){return o?/^#[0-9a-fA-F]{6}$/.test(o):false}r.isValidHex=e;function t(o){let s=parseInt(o.slice(1,3),16),a=parseInt(o.slice(3,5),16),i=parseInt(o.slice(5,7),16);return {r:s,g:a,b:i}}r.hexToRgb=t;function n(o){if(!e(o))return;let{r:s,g:a,b:i}=t(o);return `\x1B[38;2;${s};${a};${i}m\x1B[1m`}r.hexToAnsiBold=n;})(exports.Color||(exports.Color={}));chunkVRQQ33YH_cjs.j();exports.Context=void 0;(n=>{class e extends Error{constructor(s){super(`No context found for ${s}`);chunkVRQQ33YH_cjs.c(this,"name",s);}}n.NotFound=e;function t(r){let o=new async_hooks.AsyncLocalStorage;return {use(){let s=o.getStore();if(!s)throw new e(r);return s},provide(s,a){return o.run(s,a)}}}n.create=t;})(exports.Context||(exports.Context={}));chunkVRQQ33YH_cjs.j();function Yo(e){return {[Symbol.dispose](){e();},[Symbol.asyncDispose](){return Promise.resolve(e())}}}chunkVRQQ33YH_cjs.j();exports.EventLoop=void 0;(t=>{async function e(){return new Promise(n=>{let r=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?n():setImmediate(r);};r();})}t.wait=e;})(exports.EventLoop||(exports.EventLoop={}));chunkVRQQ33YH_cjs.j();function Vo(e){if(e<=0)return "";if(e<60)return `${e}s`;if(e<3600){let n=Math.floor(e/60),r=e%60;return r>0?`${n}m ${r}s`:`${n}m`}if(e<86400){let n=Math.floor(e/3600),r=Math.floor(e%3600/60);return r>0?`${n}h ${r}m`:`${n}h`}if(e<604800){let n=Math.floor(e/86400);return n===1?"~1 day":`~${n} days`}let t=Math.floor(e/604800);return t===1?"~1 week":`~${t} weeks`}chunkVRQQ33YH_cjs.j();exports.Keybind=void 0;(a=>{function e(i,c){if(i===c)return true;if(typeof i!="object"||typeof c!="object"||i===null||c===null)return false;let p=Object.keys(i),l=Object.keys(c);if(p.length!==l.length)return false;for(let f of p)if(!l.includes(f)||!e(i[f],c[f]))return false;return true}function t(i){return {...i,super:i.super??false}}function n(i,c){return i?e(t(i),t(c)):false}a.match=n;function r(i,c=false){return {name:i.name,ctrl:i.ctrl,meta:i.meta,shift:i.shift,super:i.super??false,leader:c}}a.fromParsedKey=r;function o(i){if(!i)return "";let c=[];i.ctrl&&c.push("ctrl"),i.meta&&c.push("alt"),i.super&&c.push("super"),i.shift&&c.push("shift"),i.name&&(i.name==="delete"?c.push("del"):c.push(i.name));let p=c.join("+");return i.leader&&(p=p?`<leader> ${p}`:"<leader>"),p}a.keyToString=o;function s(i){return i==="none"?[]:i.split(",").map(c=>{let l=c.replace(/<leader>/g,"leader+").toLowerCase().split("+"),f={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let h of l)switch(h){case "ctrl":f.ctrl=true;break;case "alt":case "meta":case "option":f.meta=true;break;case "super":f.super=true;break;case "shift":f.shift=true;break;case "leader":f.leader=true;break;case "esc":f.name="escape";break;default:f.name=h;break}return f})}a.parse=s;})(exports.Keybind||(exports.Keybind={}));chunkVRQQ33YH_cjs.j();exports.Locale=void 0;(p=>{function e(l){return l.replace(/\b\w/g,f=>f.toUpperCase())}p.titlecase=e;function t(l){return new Date(l).toLocaleTimeString(void 0,{timeStyle:"short"})}p.time=t;function n(l){let f=new Date(l),h=t(l),v=f.toLocaleDateString();return `${h} \xB7 ${v}`}p.datetime=n;function r(l){let f=new Date(l),h=new Date;return f.getFullYear()===h.getFullYear()&&f.getMonth()===h.getMonth()&&f.getDate()===h.getDate()?t(l):n(l)}p.todayTimeOrDateTime=r;function o(l){return l>=1e6?(l/1e6).toFixed(1)+"M":l>=1e3?(l/1e3).toFixed(1)+"K":l.toString()}p.number=o;function s(l){if(l<1e3)return `${l}ms`;if(l<6e4)return `${(l/1e3).toFixed(1)}s`;if(l<36e5){let v=Math.floor(l/6e4),E=Math.floor(l%6e4/1e3);return `${v}m ${E}s`}if(l<864e5){let v=Math.floor(l/36e5),E=Math.floor(l%36e5/6e4);return `${v}h ${E}m`}let f=Math.floor(l/36e5);return `${Math.floor(l%36e5/864e5)}d ${f}h`}p.duration=s;function a(l,f){return l.length<=f?l:l.slice(0,f-1)+"\u2026"}p.truncate=a;function i(l,f=35){if(l.length<=f)return l;let h="\u2026",v=Math.ceil((f-h.length)/2),E=Math.floor((f-h.length)/2);return l.slice(0,v)+h+l.slice(-E)}p.truncateMiddle=i;function c(l,f,h){return (l===1?f:h).replace("{}",l.toString())}p.pluralize=c;})(exports.Locale||(exports.Locale={}));chunkVRQQ33YH_cjs.j();var Go=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Jo(){return Go.some(e=>process.env[e])}function Ko(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function Zo(){let e=process.env.HTTP_PROXY||process.env.http_proxy,t=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:e,https:t,enabled:!!(e||t)}}chunkVRQQ33YH_cjs.j();var _t=class{constructor(){chunkVRQQ33YH_cjs.c(this,"queue",[]);chunkVRQQ33YH_cjs.c(this,"resolvers",[]);}push(t){let n=this.resolvers.shift();n?n(t):this.queue.push(t);}async next(){return this.queue.length>0?this.queue.shift():new Promise(t=>this.resolvers.push(t))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Xo(e,t,n){let r=[...t];await Promise.all(Array.from({length:e},async()=>{for(;;){let o=r.pop();if(o===void 0)return;await n(o);}}));}chunkVRQQ33YH_cjs.j();function Qo(){let e,t=new Promise(n=>e=n);return {trigger(){return e()},wait(){return t}}}chunkVRQQ33YH_cjs.j();function es(e,t){let n;return Promise.race([e.then(r=>(clearTimeout(n),r)),new Promise((r,o)=>{n=setTimeout(()=>{o(new Error(`Operation timed out after ${t}ms`));},t);})])}chunkVRQQ33YH_cjs.j();exports.Token=void 0;(a=>{let n=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function r(i){if(!i)return 0;let c=String(i),p=(c.match(n)||[]).length,l=c.length-p,f=Math.round(p/1.5),h=Math.round(l/4);return Math.max(0,f+h)}a.estimate=r;function o(i){if(i==null)return 0;try{let c=typeof i=="string"?i:JSON.stringify(i);return r(c)}catch{return 0}}a.estimateObject=o;function s(i){if(i.total!==void 0&&i.total>0)return i.total;let c=i.input??0,p=i.output??0,l=i.cache?.read??0,f=i.cache?.write??0;return c+p+l+f}a.total=s;})(exports.Token||(exports.Token={}));chunkVRQQ33YH_cjs.j();function ns(e){let t={};for(let[n,r]of Object.entries(e.required().shape))t[n]=r.nullable();return Be__default.default.object(t)}chunkVRQQ33YH_cjs.j();exports.Wildcard=void 0;(s=>{function e(a,i){let c=i.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return c.endsWith(" .*")&&(c=c.slice(0,-3)+"( .*)?"),new RegExp("^"+c+"$","s").test(a)}s.match=e;function t(a){return a.sort((i,c)=>{let p=i[0].length-c[0].length;return p!==0?p:i[0].localeCompare(c[0])})}function n(a,i){let c=Object.entries(i),p=t(c),l;for(let[f,h]of p)e(a,f)&&(l=h);return l}s.all=n;function r(a,i){let c=Object.entries(i),p=t(c),l;for(let[f,h]of p){let v=f.split(/\s+/);e(a.head,v[0])&&(v.length===1||o(a.tail,v.slice(1)))&&(l=h);}return l}s.allStructured=r;function o(a,i){if(i.length===0)return true;if(a.length<i.length)return false;for(let c=0;c<i.length;c++)if(!e(a[c],i[c]))return false;return true}})(exports.Wildcard||(exports.Wildcard={}));async function hl(e){let{Log:t}=await import('./chunks/log-OJU7I2TN.cjs'),n=false;await t.init({logDir:e.logDir??process.env.EASBOT_LOG_PATH??process.cwd(),print:e.print??false,dev:e.dev??n,level:e.level??("INFO")});}Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.c}});Object.defineProperty(exports,"Glob",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.a}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.b}});Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.b}});Object.defineProperty(exports,"Semver",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.a}});Object.defineProperty(exports,"Lock",{enumerable:true,get:function(){return chunkYC4AEMOP_cjs.a}});Object.defineProperty(exports,"Hono",{enumerable:true,get:function(){return hono.Hono}});Object.defineProperty(exports,"createNodeWebSocket",{enumerable:true,get:function(){return nodeWs.createNodeWebSocket}});Object.defineProperty(exports,"cors",{enumerable:true,get:function(){return cors.cors}});Object.defineProperty(exports,"logger",{enumerable:true,get:function(){return logger.logger}});Object.defineProperty(exports,"compress",{enumerable:true,get:function(){return compress.compress}});Object.defineProperty(exports,"secureHeaders",{enumerable:true,get:function(){return secureHeaders.secureHeaders}});Object.defineProperty(exports,"timeout",{enumerable:true,get:function(){return timeout.timeout}});Object.defineProperty(exports,"HTTPException",{enumerable:true,get:function(){return httpException.HTTPException}});Object.defineProperty(exports,"validator",{enumerable:true,get:function(){return validator.validator}});Object.defineProperty(exports,"zValidator",{enumerable:true,get:function(){return zodValidator.zValidator}});exports.$=Ir;exports.AsyncQueue=_t;exports.NamedError=pt;exports.PkgShell=we;exports.abortAfter=Hn;exports.abortAfterAny=Uo;exports.buildCodeSpanIndex=Ve;exports.chunkMarkdownIR=_n;exports.chunkText=pe;exports.chunkTextByBreakResolver=yt;exports.convertMarkdownTables=Ge;exports.createInlineCodeState=Ye;exports.createPkgShell=ae;exports.createRESTServer=at;exports.createRPCServer=it;exports.createServer=se;exports.createStreamingServer=lt;exports.createWebSocketServer=ct;exports.defer=Yo;exports.detectPlatform=mn;exports.escapeCommandArg=ft;exports.escapeCommandArgSafe=pn;exports.extractFrontmatter=Ue;exports.findFenceSpanAt=Pt;exports.findLast=Jn;exports.fn=Fr;exports.formatDuration=Vo;exports.formatLocalISO=rt;exports.formatLocalISOCompact=ot;exports.formatLogTime=er;exports.formatMarkdown=He;exports.getDirectory=Lo;exports.getFileExtension=Bo;exports.getFilename=Dn;exports.getFilenameTruncated=_o;exports.getProxyConfig=Zo;exports.getProxyUrl=Ko;exports.getTimezoneOffset=tr;exports.git=_r;exports.iife=Ur;exports.initLog=hl;exports.isSafeFenceBreak=Nn;exports.joinCommandArgs=ue;exports.lazy=Fe;exports.lazyAsync=nr;exports.loadEnv=Br;exports.loadTextFile=Hr;exports.loadTextFileAsync=Wr;exports.markdownToIR=he;exports.markdownToIRWithMeta=Pe;exports.needsShellExecution=dn;exports.now=Yt;exports.nowLocalISO=Xn;exports.parseCommand=re;exports.parseCommandWithOptions=fn;exports.parseFenceSpans=qe;exports.parseFrontmatterBlock=Ee;exports.parseLocalISO=Qn;exports.parseModelId=qr;exports.proxied=Jo;exports.readableStreamToText=Mr;exports.renderMarkdown=be;exports.renderMarkdownWithMarkers=Me;exports.retry=Et;exports.scanParenAwareBreakpoints=bt;exports.serializeFrontmatter=We;exports.shell=hn;exports.signal=Qo;exports.startServer=ir;exports.truncateMiddle=jo;exports.updateSchema=ns;exports.whichSync=Er;exports.withTimeout=es;exports.work=Xo;