@easbot/utils 0.2.43 → 0.2.45
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 +34 -34
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.mjs +34 -34
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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'),
|
|
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'),je=require('zod'),crypto$1=require('crypto'),he=require('path'),Ne=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'),to=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 je__default=/*#__PURE__*/_interopDefault(je);var he__default=/*#__PURE__*/_interopDefault(he);var Ne__default=/*#__PURE__*/_interopDefault(Ne);var to__default=/*#__PURE__*/_interopDefault(to);var jn__default=/*#__PURE__*/_interopDefault(jn);chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Zn(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(u=>{let g=Math.max(0,Math.min(a.length-c,u-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;(u=>{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(g){return je__default.default.string().startsWith(e[g])}u.schema=t;let n=26,r=0,o=0;function s(g,k){return i(g,false,k)}u.ascending=s;function a(g,k){return i(g,true,k)}u.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="",H=crypto$1.randomBytes(g);for(let U=0;U<g;U++){let q=H[U];q!==void 0&&(E+=k[q%62]);}return E}function p(g,k,E){let H=E??Date.now();H!==r&&(r=H,o=0),o++;let U=BigInt(H)*BigInt(4096)+BigInt(o);U=k?~U:U;let q=Buffer.alloc(6);for(let Y=0;Y<6;Y++)q[Y]=Number(U>>BigInt(40-8*Y)&BigInt(255));return e[g]+"_"+q.toString("hex")+c(n-12)}u.create=p;function l(g){let k=g.split("_")[0];if(!k)return 0;let E=g.slice(k.length+1,k.length+13),H=BigInt("0x"+E);return Number(H/BigInt(4096))}u.timestamp=l;})(exports.Identifier||(exports.Identifier={}));exports.TruncateContent=void 0;(p=>{p.DEFAULT_MAX_CHARS=4e3,p.DIRECTION="head",p.DIR=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),p.GLOB=chunkJL3GR4P7_cjs.c.join(p.DIR,"*");let o=10080*60*1e3;function s(l,u,g){return g?`[Content truncated. Source: ${g}
|
|
2
2
|
Full ${u} saved to: ${l}
|
|
3
3
|
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${u} saved to: ${l}
|
|
4
4
|
Use Read tool with offset/limit parameters to view specific sections.]`}async function a(l,u={}){let g=u.maxChars??4e3,k=u.direction??p.DIRECTION,E=u.label??"content",H=u.sourcePath,U=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),q=u.dir??U;if(l.length<=g)return {content:l,truncated:false};let Y=exports.Identifier.ascending("context"),G=chunkJL3GR4P7_cjs.c.join(q,Y);await oe__default.default.mkdir(q,{recursive:true}).catch(()=>{}),await oe__default.default.writeFile(G,l,"utf-8");let de=l.length-g,se;k==="head"?se=l.slice(0,g):se=l.slice(-g);let fe=s(G,E,H),ke=`${de} characters truncated`;return {content:k==="head"?`${se}
|
|
@@ -9,10 +9,10 @@ ${fe}`:`...${ke}...
|
|
|
9
9
|
|
|
10
10
|
${fe}
|
|
11
11
|
|
|
12
|
-
${se}`,truncated:true,outputPath:G,originalLength:l.length,removedLength:de,label:E}}p.truncate=a;function i(l){return l.truncated?s(l.outputPath,l.label):""}p.formatHint=i;async function c(){let l=exports.Identifier.timestamp(exports.Identifier.create("context",false,Date.now()-o)),g=(await oe__default.default.readdir(p.DIR).catch(()=>[])).filter(k=>k.startsWith("context_"));for(let k of g)exports.Identifier.timestamp(k)>=l||await oe__default.default.unlink(chunkJL3GR4P7_cjs.c.join(p.DIR,k)).catch(()=>{});}p.cleanup=c;})(exports.TruncateContent||(exports.TruncateContent={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function st(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"),u=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${u}:${g}:${k}`;if(t){let H=String(n.getMilliseconds()).padStart(3,"0");E+=`.${H}`;}return E+=i,E}function it(e){return st(e,false)}function Yt(){return Date.now()}function Xn(e=true){return st(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)+it(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]??"",u=parseInt(p[2]??"0",10);return `${l} (fork #${u+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 Be=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 ae(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 ct(e){return ae({rpc:e,port:3e3})}function ir(e,t=3e3,n="0.0.0.0"){return ae({fetch:e,port:t,hostname:n})}function lt(e,t={}){return ae({...t,routes:e})}function ut(e,t={}){return ae({...t,websockets:e})}function dt(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 ae({...t,routes:n,streaming:true})}chunkVRQQ33YH_cjs.j();var ce=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 ce.warn("esbuild not available",{error:e.message}),{available:false}}}async function je(){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"&&ce.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&&ce.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 pt(e){ce.info("Build started",{entrypoints:e.entrypoints,target:e.target,format:e.format,compile:typeof e.compile}),await je();let t=await import('./chunks/main-RIJAJS2R.cjs'),n=Date.now();try{let r=ln(e);ce.debug("esbuild options",r);let o=await t.build(r),s=Date.now();return ce.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 ce.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:pt},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 mt(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:mt(e,t)}function mn(){return process.platform==="win32"?"windows":"unix"}function me(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 ge(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 ge(e,{...t,cwd:s})},o.env=function(s){return ge(e,{...t,env:s})},o.quiet=function(){return ge(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 ge(e,{...t,nothrow:true})},o.throws=function(s){return ge(e,{...t,nothrow:!s})},o}var Re=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+=
|
|
14
|
-
`),A=F.length>0?F[0]?.trim():null;if(A){X.set(h,A),T(A);return}}X.set(h,null),T(null);}),setTimeout(()=>{
|
|
15
|
-
`),O=T.length>0?T[0]?.trim():null;if(O)return X.set(h,O),O}}catch{}return X.set(h,null),null}_.whichSync=r;function o(){X.clear();}_.clearWhichCache=o;let s=module$1.createRequire(chunkVRQQ33YH_cjs.i);async function a(S,m,f){try{let d=[];if(f?.extraPaths)for(let y of f.extraPaths){let x=he__default.default.join(y,"node_modules");d.push(x);}return m&&d.push(m),d.length>0?s.resolve(S,{paths:d}):s.resolve(S)}catch(d){throw new Error(`Cannot resolve module "${S}"${m?` from "${m}"`:""}: ${d instanceof Error?d.message:String(d)}`)}}_.resolve=a;function i(S){return {get name(){return he__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 De__default.default.readFileSync(S,"utf-8")},jsonSync(){let m=De__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=he__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 f;if(m instanceof Response){let d=await m.arrayBuffer();f=new Uint8Array(d);}else f=m;await oe__default.default.writeFile(S,f);},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,f){let d;if(m instanceof Response){let y=await m.arrayBuffer();d=new Uint8Array(y);}else d=m;await oe__default.default.writeFile(S,d,f?{mode:f.mode}:void 0);}_.write=c;function p(S,m,f){De__default.default.writeFileSync(S,m,f?{mode:f.mode}:void 0);}_.writeSync=p;function l(S,m="utf-8"){return De__default.default.readFileSync(S,m)}_.readSync=l;function u(S,m){let f,d;if(typeof S=="object"&&"cmd"in S){let v=S;f=v.cmd,d={cwd:v.cwd,env:v.env,stdout:v.stdout,stderr:v.stderr,stdin:v.stdin,signal:v.signal,windowsHide:v.windowsHide,shell:v.shell};}else f=Array.isArray(S)?S:[S],d=m||{};if(!f||f.length===0||!f[0])throw new Error("Spawn command cannot be empty");let y=[d.stdin==="inherit"?"inherit":d.stdin==="null"?"ignore":"pipe",d.stdout==="inherit"?"inherit":d.stdout==="null"?"ignore":"pipe",d.stderr==="inherit"?"inherit":d.stderr==="null"?"ignore":"pipe"],x={cwd:d.cwd,env:d.env?{...process.env,...d.env}:process.env,stdio:y,timeout:d.timeout};d.shell!==void 0&&(x.shell=d.shell),process.platform==="win32"&&(x.windowsHide=d.windowsHide??true);let h=child_process.spawn(f[0],f.slice(1),x),w;if(d.signal){w=()=>{h.kill();},d.signal.addEventListener("abort",w,{once:true});let v=()=>{w&&(d.signal?.removeEventListener("abort",w),w=void 0);};h.on("close",v),h.on("error",v);}let R=new Promise((v,T)=>{let O=false,N=()=>{O||(O=true,h.removeAllListeners());};if(h.on("close",L=>{N(),v(L??0);}),h.on("error",L=>{N(),T(L);}),d.timeout!==false){let L=d.timeout||3e5;setTimeout(()=>{if(!O){e.debug(`Process timeout after ${L}ms, killing process`,{cmd:f.join(" ")}),N();try{h.kill("SIGKILL");}catch{}T(new Error(`Process timeout after ${L}ms: ${f.join(" ")}`));}},L);}});return {stdout:h.stdout,stderr:h.stderr,stdin:h.stdin,pid:h.pid,exited:R,exitCode:h.exitCode,kill:v=>h.kill(v)}}_.spawn=u;async function g(S,m){let f=m?.stdin??"null",d=m?.stdout??"pipe",y=m?.stderr??"pipe",x=u(S,{cwd:m?.cwd,env:m?.env,stdin:f,stdout:d,stderr:y,windowsHide:m?.windowsHide,shell:m?.shell}),h=[],w=[];d==="pipe"&&x.stdout?.on("data",v=>{h.push(v);}),y==="pipe"&&x.stderr?.on("data",v=>{w.push(v);});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 v=await x.exited;return clearTimeout(R),d==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),f==="pipe"&&x.stdin?.end(),{code:v,stdout:Buffer.concat(h).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")}}catch(v){return clearTimeout(R),d==="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(w).toString("utf-8")||(v instanceof Error?v.message:String(v))}}}_.run=g;async function k(S,m={},f={}){let d=u(S,{cwd:m.cwd,env:m.env,stdout:"pipe",stderr:"pipe",stdin:"null"}),y="",x="";d.stdout?.on("data",w=>{let R=w.toString("utf-8");y+=R,f.onStdout?.(R);}),d.stderr?.on("data",w=>{let R=w.toString("utf-8");x+=R,f.onStderr?.(R);});let h=m.timeout&&m.timeout>0?setTimeout(()=>{try{d.kill("SIGKILL");}catch{}d.stdout?.destroy(),d.stderr?.destroy();},m.timeout):void 0;try{let w=await d.exited;return clearTimeout(h),f.onExit?.(w),{code:w,stdout:y,stderr:x}}catch(w){clearTimeout(h);let R=w instanceof Error?w.message:String(w);return {code:-1,stdout:y,stderr:x||R}}}_.runWithStream=k;async function E(S){if(typeof S.pipeThrough=="function")try{let y=new TextDecoderStream("utf-8"),h=S.pipeThrough(y).getReader(),w="";try{for(;;){let{done:R,value:v}=await h.read();if(R)break;w+=v;}return w}finally{h.releaseLock();}}catch{}let m=S.getReader(),f=new TextDecoder("utf-8"),d=[];try{for(;;){let{done:y,value:x}=await m.read();if(y)break;d.push(f.decode(x,{stream:!0}));}return d.push(f.decode()),d.join("")}finally{m.releaseLock();}}_.readableStreamToText=E;async function H(S){let m=[];return new Promise((f,d)=>{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");f(x);}catch(y){d(y);}}),S.on("error",y=>{d(y);});})}_.nodeReadableStreamToText=H;function U(S,m=0){let R=new TextEncoder().encode(S),v=R.length,T,O=0;if(v>=16){let F=v-16,A=m+2654435761+2246822519|0,Q=m+2246822519|0,J=m+0|0,Z=m-2654435761|0;for(;O<=F;)A=N(A,D(R,O)),O+=4,Q=N(Q,D(R,O)),O+=4,J=N(J,D(R,O)),O+=4,Z=N(Z,D(R,O)),O+=4;T=L(A,1)+L(Q,7)+L(J,12)+L(Z,18)|0;}else T=m+374761393|0;for(T=T+v|0;O+4<=v;)T=T+D(R,O)*3266489917|0,T=L(T,17)*668265263|0,O+=4;for(;O<v;)T=T+R[O]*374761393|0,T=L(T,11)*2654435761|0,O++;return T^=T>>>15,T=T*2246822519|0,T^=T>>>13,T=T*3266489917|0,T^=T>>>16,T>>>0;function N(F,A){return F=F+A*2246822519|0,F=L(F,13),F=F*2654435761|0,F}function L(F,A){return F<<A|F>>>32-A|0}function D(F,A){return (F[A]|F[A+1]<<8|F[A+2]<<16|F[A+3]<<24)>>>0}}_.xxHash32=U;function q(S){let m=0;for(let f of S){let d=f.codePointAt(0)||f.charCodeAt(0);d<127?m+=1:d>=4352&&d<=4447||d>=9001&&d<=9002||d>=11904&&d<=42191&&d!==12351||d>=44032&&d<=55203||d>=63744&&d<=64255||d>=65040&&d<=65049||d>=65072&&d<=65135||d>=65280&&d<=65376||d>=65504&&d<=65510?m+=2:m+=1;}return m}_.stringWidth=q;class Y{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 d of f)yield bn(d);}*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 d of f)yield bn(d);}match(m){return minimatch.minimatch(m,this.pattern)}}_.Glob=Y,_.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=ae,_.nodeWebSocket=nodeWs.createNodeWebSocket,_.restServer=lt,_.rpcServer=ct,_.streamingServer=dt,_.webSocketServer=ut;})(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(f,d){let y=f.pid;if(!(!y||d?.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(wn),d?.exited?.()||process.kill(-y,"SIGKILL");}catch{f.kill("SIGTERM"),await promises.setTimeout(wn),d?.exited?.()||f.kill("SIGKILL");}}}m.killTree=t;function n(f){if(process.platform!=="win32"||!f.includes("/")&&!f.includes("\\")&&!f.includes(":"))return f;let d=chunkJL3GR4P7_cjs.c.normalize(f);return E(d)==="bash"&&g()||d}function r(f){return Sn[E(f)]}function o(f){return r(f)?.deny!==true}function s(f){return chunkJL3GR4P7_cjs.c.isAbsolute(f)}function a(f){let d=n(f);if(s(d))return chunkJL3GR4P7_cjs.c.stat(d)?.isFile()?d:void 0;let y=exports.PKG.whichSync(d);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(`
|
|
12
|
+
${se}`,truncated:true,outputPath:G,originalLength:l.length,removedLength:de,label:E}}p.truncate=a;function i(l){return l.truncated?s(l.outputPath,l.label):""}p.formatHint=i;async function c(){let l=exports.Identifier.timestamp(exports.Identifier.create("context",false,Date.now()-o)),g=(await oe__default.default.readdir(p.DIR).catch(()=>[])).filter(k=>k.startsWith("context_"));for(let k of g)exports.Identifier.timestamp(k)>=l||await oe__default.default.unlink(chunkJL3GR4P7_cjs.c.join(p.DIR,k)).catch(()=>{});}p.cleanup=c;})(exports.TruncateContent||(exports.TruncateContent={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function it(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"),u=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${u}:${g}:${k}`;if(t){let H=String(n.getMilliseconds()).padStart(3,"0");E+=`.${H}`;}return E+=i,E}function at(e){return it(e,false)}function Gt(){return Date.now()}function er(e=true){return it(Gt(),e)}function tr(e){return e.includes("+")||e.includes("-")?new Date(e):new Date(e)}function nr(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 rr(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")}`}function st(e,t){let n=ct(t),o=new Intl.DateTimeFormat("en-US",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false,weekday:"short"}).formatToParts(e),s={};for(let p of o)p.type!=="literal"&&(s[p.type]=p.value);let a={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6},i=Number.parseInt(s.hour??"0",10),c=i===24?0:i;return {year:Number.parseInt(s.year??"1970",10),month:Number.parseInt(s.month??"1",10),day:Number.parseInt(s.day??"1",10),hour:c,minute:Number.parseInt(s.minute??"0",10),second:Number.parseInt(s.second??"0",10),weekday:a[s.weekday??"Sun"]??0,timestamp:e.getTime()}}function or(e){if(!e||e.trim()==="")return true;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return false}}function ct(e){if(!e)return;let t=e.trim();return t===""?void 0:t}function sr(e,t,n){let r=ct(n);if(!r){let l=new Date(e.getTime());return l.setSeconds(0,0),l.setMinutes(l.getMinutes()+t),l}let o=st(e,r),s=new Date(Date.UTC(o.year,o.month-1,o.day,o.hour,o.minute,0)),a=new Date(s.getTime()+t*6e4),i=st(a,r),p=new Date(Date.UTC(i.year,i.month-1,i.day,i.hour,i.minute,0)).getTime()-a.getTime();return new Date(a.getTime()-p)}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)+at(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]??"",u=parseInt(p[2]??"0",10);return `${l} (fork #${u+1})`}return `${c} (fork #1)`}i.getForked=a;})(exports.SessionTitle||(exports.SessionTitle={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Jt(e){let t,n=false,r=()=>(n||(t=e(),n=true),t);return r.reset=()=>{n=false,t=void 0;},r}var Be=Jt;function Kt(e){let t,n=()=>(t||(t=e()),t);return n.reset=()=>{t=void 0;},n}var ir=Kt;exports.Lazy=void 0;(n=>(n.lazy=Jt,n.lazyAsync=Kt))(exports.Lazy||(exports.Lazy={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();var ne=chunkWWPI6PC4_cjs.a.create({service:"server"});function ae(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 ut(e){return ae({rpc:e,port:3e3})}function ur(e,t=3e3,n="0.0.0.0"){return ae({fetch:e,port:t,hostname:n})}function dt(e,t={}){return ae({...t,routes:e})}function ft(e,t={}){return ae({...t,websockets:e})}function pt(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 ae({...t,routes:n,streaming:true})}chunkVRQQ33YH_cjs.j();var ce=chunkWWPI6PC4_cjs.a.create({service:"build-api"});async function un(){try{return {available:!0,version:(await import('./chunks/main-RIJAJS2R.cjs')).version||"unknown"}}catch(e){return ce.warn("esbuild not available",{error:e.message}),{available:false}}}async function De(){let e=await un();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"&&ce.warn(`esbuild version ${e.version} may have limited features. Consider upgrading to 0.17+`);}function mr(e){if(e!==void 0)return typeof e=="boolean"?{target:void 0}:typeof e=="string"?{target:e}:e}function dn(e){let t=mr(e.compile);t&&ce.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:gr(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=hr(e.target)),e.minify===true&&(n.minifyWhitespace=true,n.minifyIdentifiers=true,n.minifySyntax=true),br(n)}function gr(e){return !e||e==="none"?false:e}function hr(e){let t={browser:"es2020",node:"node16",bun:"esnext"};return e?t[e]||e:"esnext"}function br(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 sn(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 gt(e){ce.info("Build started",{entrypoints:e.entrypoints,target:e.target,format:e.format,compile:typeof e.compile}),await De();let t=await import('./chunks/main-RIJAJS2R.cjs'),n=Date.now();try{let r=dn(e);ce.debug("esbuild options",r);let o=await t.build(r),s=Date.now();return ce.info("Build completed",{duration:s-n,outputs:(o?.outputFiles?.length??0)>0||Object.keys(o.metafile?.outputs||{}).length>0}),sn(o,n,s)}catch(r){let o=Date.now(),s=r.message;return ce.error("Build failed",{error:s,duration:o-n}),r&&typeof r=="object"&&"errors"in r?sn(r):{outputs:[],success:false,logs:[{level:"error",message:s}],metafile:void 0}}}var Tr={build:gt},fn=Tr;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 pn(e){return /[|&;<>()$`!#]/.test(e)}function mn(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 ht(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 vr=new Set(["&&","||","|",";","&",">","<",">>","<<","2>","2>>","1>","1>>","2>&1","2>&2","1>&1","1>&2",">&","<&",">&1","<&1",">&2","<&2"]);function gn(e,t=process.platform==="win32"?"windows":"unix"){return vr.has(e)?e:ht(e,t)}function hn(){return process.platform==="win32"?"windows":"unix"}function me(e,t,n=process.platform==="win32"?"windows":"unix"){let r=t.map(o=>gn(o,n));return [e,...r].join(" ")}function bn(e){if(e==null)return "";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>bn(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 Rr(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 ge(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=Rr(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 ge(e,{...t,cwd:s})},o.env=function(s){return ge(e,{...t,env:s})},o.quiet=function(){return ge(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 ge(e,{...t,nothrow:true})},o.throws=function(s){return ge(e,{...t,nothrow:!s})},o}var Re=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+=bn(n[o]));return ge(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 le({...this.options,env:t})}cwd(t){return le({...this.options,cwd:t})}nothrow(){return le({...this.options,nothrow:true})}throws(t){return le({...this.options,nothrow:!t})}};function le(e={}){let t=new Re(e);return new Proxy(t,{apply(n,r,o){return t.call(o[0],...o.slice(1))}})}var yn=le();function xn(e){return e.replace(/\\/g,"/")}function wn(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 f of m){let d=await _.which(f);if(d)return {name:f,path:d}}}_.packageManager=t;async function n(S,m){if(!S)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",d=process.env.EASBOT_BIN_PATH,y=d?f+he__default.default.delimiter+d:f,x=wn(y),h=`${S}:${x}`;if(X.has(h))return X.get(h);let R=process.platform==="win32"?"where":"which";try{let{spawn:v}=await import('child_process');return new Promise(T=>{let I=v(R,[S],{env:{...process.env,PATH:y},stdio:["pipe","pipe","ignore"],windowsHide:!0}),j="",L="";I.stdout?.on("data",N=>{j+=N.toString();}),I.stderr?.on("data",N=>{L+=N.toString();}),I.on("close",N=>{if(N===0&&j.trim()){let F=j.trim().split(`
|
|
14
|
+
`),A=F.length>0?F[0]?.trim():null;if(A){X.set(h,A),T(A);return}}X.set(h,null),T(null);}),setTimeout(()=>{I.kill(),X.set(h,null),T(null);},5e3);})}catch{return X.set(h,null),null}}_.which=n;function r(S,m){if(!S)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",d=process.env.EASBOT_BIN_PATH,y=d?f+he__default.default.delimiter+d:f,x=wn(y),h=`${S}:${x}`;if(X.has(h))return X.get(h);let R=process.platform==="win32"?"where":"which";try{let v=child_process.execSync(`${R} ${S}`,{encoding:"utf-8",stdio:["pipe","pipe","ignore"],env:{...process.env,PATH:y},timeout:5e3,windowsHide:!0});if(v.trim()){let T=v.trim().split(`
|
|
15
|
+
`),I=T.length>0?T[0]?.trim():null;if(I)return X.set(h,I),I}}catch{}return X.set(h,null),null}_.whichSync=r;function o(){X.clear();}_.clearWhichCache=o;let s=module$1.createRequire(chunkVRQQ33YH_cjs.i);async function a(S,m,f){try{let d=[];if(f?.extraPaths)for(let y of f.extraPaths){let x=he__default.default.join(y,"node_modules");d.push(x);}return m&&d.push(m),d.length>0?s.resolve(S,{paths:d}):s.resolve(S)}catch(d){throw new Error(`Cannot resolve module "${S}"${m?` from "${m}"`:""}: ${d instanceof Error?d.message:String(d)}`)}}_.resolve=a;function i(S){return {get name(){return he__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 Ne__default.default.readFileSync(S,"utf-8")},jsonSync(){let m=Ne__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=he__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 f;if(m instanceof Response){let d=await m.arrayBuffer();f=new Uint8Array(d);}else f=m;await oe__default.default.writeFile(S,f);},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,f){let d;if(m instanceof Response){let y=await m.arrayBuffer();d=new Uint8Array(y);}else d=m;await oe__default.default.writeFile(S,d,f?{mode:f.mode}:void 0);}_.write=c;function p(S,m,f){Ne__default.default.writeFileSync(S,m,f?{mode:f.mode}:void 0);}_.writeSync=p;function l(S,m="utf-8"){return Ne__default.default.readFileSync(S,m)}_.readSync=l;function u(S,m){let f,d;if(typeof S=="object"&&"cmd"in S){let v=S;f=v.cmd,d={cwd:v.cwd,env:v.env,stdout:v.stdout,stderr:v.stderr,stdin:v.stdin,signal:v.signal,windowsHide:v.windowsHide,shell:v.shell};}else f=Array.isArray(S)?S:[S],d=m||{};if(!f||f.length===0||!f[0])throw new Error("Spawn command cannot be empty");let y=[d.stdin==="inherit"?"inherit":d.stdin==="null"?"ignore":"pipe",d.stdout==="inherit"?"inherit":d.stdout==="null"?"ignore":"pipe",d.stderr==="inherit"?"inherit":d.stderr==="null"?"ignore":"pipe"],x={cwd:d.cwd,env:d.env?{...process.env,...d.env}:process.env,stdio:y,timeout:d.timeout};d.shell!==void 0&&(x.shell=d.shell),process.platform==="win32"&&(x.windowsHide=d.windowsHide??true);let h=child_process.spawn(f[0],f.slice(1),x),w;if(d.signal){w=()=>{h.kill();},d.signal.addEventListener("abort",w,{once:true});let v=()=>{w&&(d.signal?.removeEventListener("abort",w),w=void 0);};h.on("close",v),h.on("error",v);}let R=new Promise((v,T)=>{let I=false,j=()=>{I||(I=true,h.removeAllListeners());};if(h.on("close",L=>{j(),v(L??0);}),h.on("error",L=>{j(),T(L);}),d.timeout!==false){let L=d.timeout||3e5;setTimeout(()=>{if(!I){e.debug(`Process timeout after ${L}ms, killing process`,{cmd:f.join(" ")}),j();try{h.kill("SIGKILL");}catch{}T(new Error(`Process timeout after ${L}ms: ${f.join(" ")}`));}},L);}});return {stdout:h.stdout,stderr:h.stderr,stdin:h.stdin,pid:h.pid,exited:R,exitCode:h.exitCode,kill:v=>h.kill(v)}}_.spawn=u;async function g(S,m){let f=m?.stdin??"null",d=m?.stdout??"pipe",y=m?.stderr??"pipe",x=u(S,{cwd:m?.cwd,env:m?.env,stdin:f,stdout:d,stderr:y,windowsHide:m?.windowsHide,shell:m?.shell}),h=[],w=[];d==="pipe"&&x.stdout?.on("data",v=>{h.push(v);}),y==="pipe"&&x.stderr?.on("data",v=>{w.push(v);});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 v=await x.exited;return clearTimeout(R),d==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),f==="pipe"&&x.stdin?.end(),{code:v,stdout:Buffer.concat(h).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")}}catch(v){return clearTimeout(R),d==="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(w).toString("utf-8")||(v instanceof Error?v.message:String(v))}}}_.run=g;async function k(S,m={},f={}){let d=u(S,{cwd:m.cwd,env:m.env,stdout:"pipe",stderr:"pipe",stdin:"null"}),y="",x="";d.stdout?.on("data",w=>{let R=w.toString("utf-8");y+=R,f.onStdout?.(R);}),d.stderr?.on("data",w=>{let R=w.toString("utf-8");x+=R,f.onStderr?.(R);});let h=m.timeout&&m.timeout>0?setTimeout(()=>{try{d.kill("SIGKILL");}catch{}d.stdout?.destroy(),d.stderr?.destroy();},m.timeout):void 0;try{let w=await d.exited;return clearTimeout(h),f.onExit?.(w),{code:w,stdout:y,stderr:x}}catch(w){clearTimeout(h);let R=w instanceof Error?w.message:String(w);return {code:-1,stdout:y,stderr:x||R}}}_.runWithStream=k;async function E(S){if(typeof S.pipeThrough=="function")try{let y=new TextDecoderStream("utf-8"),h=S.pipeThrough(y).getReader(),w="";try{for(;;){let{done:R,value:v}=await h.read();if(R)break;w+=v;}return w}finally{h.releaseLock();}}catch{}let m=S.getReader(),f=new TextDecoder("utf-8"),d=[];try{for(;;){let{done:y,value:x}=await m.read();if(y)break;d.push(f.decode(x,{stream:!0}));}return d.push(f.decode()),d.join("")}finally{m.releaseLock();}}_.readableStreamToText=E;async function H(S){let m=[];return new Promise((f,d)=>{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");f(x);}catch(y){d(y);}}),S.on("error",y=>{d(y);});})}_.nodeReadableStreamToText=H;function U(S,m=0){let R=new TextEncoder().encode(S),v=R.length,T,I=0;if(v>=16){let F=v-16,A=m+2654435761+2246822519|0,Q=m+2246822519|0,J=m+0|0,Z=m-2654435761|0;for(;I<=F;)A=j(A,N(R,I)),I+=4,Q=j(Q,N(R,I)),I+=4,J=j(J,N(R,I)),I+=4,Z=j(Z,N(R,I)),I+=4;T=L(A,1)+L(Q,7)+L(J,12)+L(Z,18)|0;}else T=m+374761393|0;for(T=T+v|0;I+4<=v;)T=T+N(R,I)*3266489917|0,T=L(T,17)*668265263|0,I+=4;for(;I<v;)T=T+R[I]*374761393|0,T=L(T,11)*2654435761|0,I++;return T^=T>>>15,T=T*2246822519|0,T^=T>>>13,T=T*3266489917|0,T^=T>>>16,T>>>0;function j(F,A){return F=F+A*2246822519|0,F=L(F,13),F=F*2654435761|0,F}function L(F,A){return F<<A|F>>>32-A|0}function N(F,A){return (F[A]|F[A+1]<<8|F[A+2]<<16|F[A+3]<<24)>>>0}}_.xxHash32=U;function q(S){let m=0;for(let f of S){let d=f.codePointAt(0)||f.charCodeAt(0);d<127?m+=1:d>=4352&&d<=4447||d>=9001&&d<=9002||d>=11904&&d<=42191&&d!==12351||d>=44032&&d<=55203||d>=63744&&d<=64255||d>=65040&&d<=65049||d>=65072&&d<=65135||d>=65280&&d<=65376||d>=65504&&d<=65510?m+=2:m+=1;}return m}_.stringWidth=q;class Y{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 d of f)yield xn(d);}*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 d of f)yield xn(d);}match(m){return minimatch.minimatch(m,this.pattern)}}_.Glob=Y,_.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=fn.build,_.server=ae,_.nodeWebSocket=nodeWs.createNodeWebSocket,_.restServer=dt,_.rpcServer=ut,_.streamingServer=pt,_.webSocketServer=ft;})(exports.PKG||(exports.PKG={}));var Or=exports.PKG.readableStreamToText;exports.PKG.nodeReadableStreamToText;exports.PKG.which;var Fr=exports.PKG.whichSync;exports.PKG.spawn;exports.PKG.run;var kn=200,Tn={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,d){let y=f.pid;if(!(!y||d?.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(kn),d?.exited?.()||process.kill(-y,"SIGKILL");}catch{f.kill("SIGTERM"),await promises.setTimeout(kn),d?.exited?.()||f.kill("SIGKILL");}}}m.killTree=t;function n(f){if(process.platform!=="win32"||!f.includes("/")&&!f.includes("\\")&&!f.includes(":"))return f;let d=chunkJL3GR4P7_cjs.c.normalize(f);return E(d)==="bash"&&g()||d}function r(f){return Tn[E(f)]}function o(f){return r(f)?.deny!==true}function s(f){return chunkJL3GR4P7_cjs.c.isAbsolute(f)}function a(f){let d=n(f);if(s(d))return chunkJL3GR4P7_cjs.c.stat(d)?.isFile()?d:void 0;let y=exports.PKG.whichSync(d);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
16
|
`).filter(d=>d.trim()&&!d.startsWith("#")))):["/bin/bash","/bin/zsh","/bin/sh"]}function p(f,d){if(f&&(!d?.acceptable||o(f))){let y=a(f);if(y)return y}return process.platform==="win32"?i()[0]:k()}m.defaultPreferred=Be(()=>p(process.env.SHELL)),m.defaultAcceptable=Be(()=>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 d=chunkJL3GR4P7_cjs.c.normalize(he__default.default.join(f,"..","..","bin","bash.exe"));if((chunkJL3GR4P7_cjs.c.stat(d)?.size??0)>0)return d}m.gitbash=g;function k(){if(process.platform==="win32"){let d=g();return d||"/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 he__default.default.posix.basename(chunkJL3GR4P7_cjs.c.toUnixPath(f)).toLowerCase()}m.name=E;function H(f){return r(f)?.login===true}m.login=H;function U(f){return r(f)?.posix===true}m.posix=U;function q(f){return r(f)?.ps===true}m.ps=q;function Y(f){let d=n(f),y=E(d);return {path:d,name:y,acceptable:o(y)}}function G(f,d,y){let x=E(f),h=re(d),w=me(h[0]??d,h.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
|
|
@@ -23,60 +23,60 @@ ${s.stderr}`),{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode});return a},o
|
|
|
23
23
|
[[ -f ~/.bashrc ]] && source ~/.bashrc >/dev/null 2>&1 || true
|
|
24
24
|
cd -- "$1"
|
|
25
25
|
${w}
|
|
26
|
-
`,"easbot",y]:/^cmd(\.exe)?$/i.test(x)?["/c",`chcp 65001 >nul 2>&1 && ${w}`]:q(x)?["-NoProfile","-Command",`[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ${w}`]:["-c",w]}m.args=G;function de(f){return f?p(f):(0, m.defaultPreferred)()}m.preferred=de;function se(f){return f?p(f,{acceptable:true}):(0, m.defaultAcceptable)()}m.acceptable=se;function fe(){m.defaultPreferred.reset(),m.defaultAcceptable.reset();}m.reset=fe;async function ke(){return (process.platform==="win32"?i():await c()).filter(d=>a(d)).map(Y)}m.list=ke;function Te(f){return
|
|
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: ${h.code}`,{stderr:h.stderr});}catch(x){e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5F02\u5E38: ${x}`);}}m.version=$;class W extends Error{constructor(y,x,h,w){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",w);this.name="InstallFailedError";}}m.InstallFailedError=W;async function V(f,d="latest",y){let{Lock:x}=await import('./chunks/lock-LMCPTUNU.cjs'),{Filesystem:h}=await import('./chunks/filesystem-ALW6PJKX.cjs'),{PackageRegistry:w}=await import('./chunks/registry-LIPZA2EC.cjs');y=y??process.env.EASBOT_CACHE_PATH??he__default.default.join(".easbot","cache");let R=await x.write("pkg-install");try{let v=he__default.default.posix.join(y,"node_modules",f),T=he__default.default.posix.join(y,"package.json"),
|
|
26
|
+
`,"easbot",y]:/^cmd(\.exe)?$/i.test(x)?["/c",`chcp 65001 >nul 2>&1 && ${w}`]:q(x)?["-NoProfile","-Command",`[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ${w}`]:["-c",w]}m.args=G;function de(f){return f?p(f):(0, m.defaultPreferred)()}m.preferred=de;function se(f){return f?p(f,{acceptable:true}):(0, m.defaultAcceptable)()}m.acceptable=se;function fe(){m.defaultPreferred.reset(),m.defaultAcceptable.reset();}m.reset=fe;async function ke(){return (process.platform==="win32"?i():await c()).filter(d=>a(d)).map(Y)}m.list=ke;function Te(f){return Tn[E(f)]}m.metaInfo=Te;function Ut(f){return /[|&;<>()$`!#]/.test(f)}m.needsShell=Ut;function O(){return process.platform==="win32"?i():["/bin/bash","/bin/zsh","/bin/sh"]}m.platformShells=O;function C(f){return f?!!a(f):false}m.isValid=C;async function $(f){let d=a(f);if(!d)return;let y=E(d);if(!/^cmd(\.exe)?$/i.test(y))try{let x;q(y)?x=["-NoProfile","-Command","$PSVersionTable.PSVersion.ToString()"]:x=["--version"],e.debug(`\u83B7\u53D6 Shell \u7248\u672C: ${d}`,{shell:d,args:x});let h=await exports.PKG.run([d,...x]);if(h.code===0){let w=h.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: ${h.code}`,{stderr:h.stderr});}catch(x){e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5F02\u5E38: ${x}`);}}m.version=$;class W extends Error{constructor(y,x,h,w){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",w);this.name="InstallFailedError";}}m.InstallFailedError=W;async function V(f,d="latest",y){let{Lock:x}=await import('./chunks/lock-LMCPTUNU.cjs'),{Filesystem:h}=await import('./chunks/filesystem-ALW6PJKX.cjs'),{PackageRegistry:w}=await import('./chunks/registry-LIPZA2EC.cjs');y=y??process.env.EASBOT_CACHE_PATH??he__default.default.join(".easbot","cache");let R=await x.write("pkg-install");try{let v=he__default.default.posix.join(y,"node_modules",f),T=he__default.default.posix.join(y,"package.json"),j=(await h.readJson(T).catch(async()=>{let K={dependencies:{}};return await h.writeJson(T,K),K})).dependencies??{},L=await h.exists(v),N=j[f],F=!1;if(!L||!N)F=!0;else {if(d!=="latest"&&N===d)return v;if(d==="latest"){if(!await w.isOutdated(f,N,y))return v;e.info("Cached version is outdated, proceeding with install",{pkg:f,cachedVersion:N}),F=!0;}}if(!F)return v;let A=m.acceptable(process.platform==="win32"?"cmd":void 0)??k(),Q=`${f}@${d}`;e.info("installing package",{pkg:f,version:d,cache:y,shell:A});let J=await exports.PKG.packageManager();if(!J)throw new W("No package manager found (npm, pnpm, bun)",f,d,"No package manager available");let Z=J.name,Qe=Z==="pnpm"?"add":"install",et=`${J.name} ${Qe} --save-exact ${Q}`;e.info(`Using ${Z} to install package`,{pkg:f,version:d,shell:A,pmPath:J.path});try{let K=await m.run(A,et,{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}@${d} with ${Z}`);}catch(K){let qt=K instanceof Error?K:new Error(String(K));if(!await h.exists(v))throw new W(`Failed to install ${f}@${d}`,f,d,qt.message);e.warn("Package install failed but module exists, continuing",{error:qt.message});}let tt=d;d==="latest"&&(tt=(await h.readJson(he__default.default.join(v,"package.json")).catch(()=>({})))?.version??"unknown");let $e=await h.readJson(T);return $e.dependencies=$e.dependencies??{},$e.dependencies[f]=tt,await h.writeJson(T,$e),e.info("Package installation completed",{pkg:f,version:tt,path:v}),v}finally{R[Symbol.dispose]();}}m.install=V;async function ve(f,d,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),w=m.args(x,d,h);e.debug(`run shell process: ${x} ${w.join(" ")}`,{command:d,cwd:h});let{windowsHide:R,env:v,...T}=y??{},I={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...v};process.platform==="win32"&&(I.CHCP="65001");let{stdin:j,stdout:L,stderr:N,timeout:F,signal:A,...Q}=T??{},J={...Q,cwd:h,env:I,windowsHide:process.platform==="win32"?R??true:void 0,shell:Q.shell,timeout:F},Z=E(x),Qe=/^cmd(\.exe)?$/i.test(Z),et=process.platform==="win32"&&Qe?"cmd":x;return exports.PKG.run([et,...w],J)}m.run=ve;function _(f,d,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),w=m.args(x,d,h);e.debug(`Spawn shell process: ${x} ${w.join(" ")}`,{command:d,cwd:h});let{stdin:R,stdout:v,stderr:T,timeout:I,signal:j,windowsHide:L,env:N,...F}=y??{},A={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...N};process.platform==="win32"&&(A.CHCP="65001");let Q=E(x),J=/^cmd(\.exe)?$/i.test(Q),Z={...F,cwd:h,env:A,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(f,...d){let y=f.reduce((h,w,R)=>h+w+(d[R]??""),""),x=(h={})=>({quiet:()=>x({...h,quiet:true}),nothrow:()=>x({...h,nothrow:true}),cwd:w=>x({...h,cwd:w}),env:w=>x({...h,env:w}),stdin:w=>x({...h,stdin:w}),stdout:w=>x({...h,stdout:w}),stderr:w=>x({...h,stderr:w}),text:async()=>{let w=re(y.trim());if(w.length===0)throw new Error("Empty command");let R=w[0]??"",v=E(R),T=/^cmd(\.exe)?$/i.test(v),I=process.platform==="win32"&&T?"cmd":Te(R)?R:void 0,j=me(R,w.slice(1)),L=await m.run(I,j,{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(L.code!==0&&!h.nothrow)throw new Error(`Command failed with exit code ${L.code}: ${y}
|
|
28
28
|
${L.stderr}`);return L.stdout},lines:async()=>(await x(h).text()).split(`
|
|
29
|
-
`).filter(R=>R.trim()),then:(w,R)=>{let v=re(y.trim()),T=v[0]??"",
|
|
29
|
+
`).filter(R=>R.trim()),then:(w,R)=>{let v=re(y.trim()),T=v[0]??"",I=E(T),j=/^cmd(\.exe)?$/i.test(I),L=process.platform==="win32"&&j?"cmd":Te(T)?T:void 0,N=me(T,v.slice(1));return m.run(L,N,{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 A=new Error(`Command failed with exit code ${F.code}: ${y}
|
|
30
30
|
${F.stderr}`);if(R){R(A);return}throw A}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(A=>A.trim())})},R)}});return x()}m.$=S;})(exports.Shell||(exports.Shell={}));var
|
|
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 u=t.slice(r,l+1);(u.startsWith("[!")||u.startsWith("[^"))&&(u="[^"+u.slice(2)),this.ignorecase&&(u=u.toLowerCase()),n.push(u),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
|
|
33
|
-
`?o=i:/\s/.test(c)&&(s=i));}}return {lastNewline:o,lastWhitespace:s}}function
|
|
31
|
+
`).filter(A=>A.trim())})},R)}});return x()}m.$=S;})(exports.Shell||(exports.Shell={}));var $r=exports.Shell.$;chunkVRQQ33YH_cjs.j();var Me=class Me extends Error{static create(t,n){var s;let r=je__default.default.object({name:je__default.default.literal(t),data:n}).meta({ref:t}),o=(s=class extends Me{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(Me,"Unknown",Me.create("UnknownError",je__default.default.object({message:je__default.default.string()})));var bt=Me;chunkVRQQ33YH_cjs.j();exports.Ignore=void 0;(t=>{function e(n){return new xt(n)}t.create=e;})(exports.Ignore||(exports.Ignore={}));var xt=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 u=t.slice(r,l+1);(u.startsWith("[!")||u.startsWith("[^"))&&(u="[^"+u.slice(2)),this.ignorecase&&(u=u.toLowerCase()),n.push(u),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 vn(e,t){let n=r=>{let o;try{o=e.parse(r);}catch(s){throw console.trace("schema validation failure stack trace:"),s instanceof je.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 Br=vn;exports.Fn=void 0;(t=>t.fn=vn)(exports.Fn||(exports.Fn={}));chunkVRQQ33YH_cjs.j();function jr(){let n=he__default.default.join(process.cwd(),".env");Ne.existsSync(n)&&dotenv.config({path:n,override:true,debug:false,encoding:"utf-8",quiet:true});}chunkVRQQ33YH_cjs.j();async function zr(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),u=Buffer.from(p);return {exitCode:i,text:()=>l.toString(),stdout:l,stderr:u}}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 Pn(e){return e?he.dirname(url.fileURLToPath(e)):typeof __dirname<"u"?__dirname:process.cwd()}function Rn(e,t,n=3){function r(o,s){if(s>n||!Ne.existsSync(o))return null;try{let a=Ne.readdirSync(o);for(let i of a){let c=he.join(o,i);try{let p=Ne.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 Mn(e,t){let n=he.join(e,t);if(Ne.existsSync(n))return n;let r=t.split("/").pop()||t,o=e;for(let s=0;s<5;s++){let a=he.join(o,"assets","txt");if(Ne.existsSync(a)){let p=Rn(a,r,5);if(p)return p}let i=he.join(o,"dist","assets","txt");if(Ne.existsSync(i)){let p=Rn(i,r,5);if(p)return p}let c=he.join(o,"..");if(c===o)break;o=c;}return n}function Yr(e,t){return exports.Lazy.lazy(()=>{try{let n=Pn(t),r=Mn(n,e);return exports.PKG.file(r).textSync()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}function Vr(e,t){return exports.Lazy.lazy(async()=>{try{let n=Pn(t),r=Mn(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 Gr(e){return e()}chunkVRQQ33YH_cjs.j();function Jr(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 St(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 Kr(e,t){if(!e)return [];if(t<=0)return [e];if(e.length<=t)return [e]}function be(e,t,n){try{let r=je.z.string().parse(e),o=je.z.number().int().parse(t),s=Kr(r,o);if(s)return s;let a=kt(r,o,i=>{let{lastNewline:c,lastWhitespace:p}=St(i,0,i.length);return c>0?c:p});return n?.minLength&&n.minLength>0&&(a=Cn(a,n.minLength)),a}catch(r){return console.warn("Invalid input for chunkText:",r),typeof e=="string"&&e.length>0?[e]:[]}}function Cn(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
|
|
37
|
+
`+r);}else n.push(r);return n}function kt(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]),u=Math.min(o.length,i+(l?1:0));o=o.slice(u).trimStart();}return o.length>0&&r.push(o),r}chunkVRQQ33YH_cjs.j();var Tt=je.z.enum(["bold","italic","strikethrough","code","code_block","spoiler","blockquote"]),In=je.z.object({start:je.z.number().int().min(0),end:je.z.number().int().min(0),style:Tt}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),On=je.z.object({start:je.z.number().int().min(0),end:je.z.number().int().min(0),href:je.z.string().min(1)}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),Ce=je.z.object({text:je.z.string(),styles:je.z.array(In),links:je.z.array(On)}).strict(),Ie=je.z.enum(["off","bullets","code"]),He=je.z.object({linkify:je.z.boolean().default(true),enableSpoilers:je.z.boolean().default(false),headingStyle:je.z.enum(["none","bold"]).default("none"),blockquotePrefix:je.z.string().default(""),autolink:je.z.boolean().default(true),tableMode:Ie.default("off")}).partial().default({}),Fn=je.z.object({open:je.z.string(),close:je.z.string()}).strict(),vt=je.z.object({styleMarkers:je.z.record(Tt,Fn).optional(),escapeText:je.z.any().optional(),buildLink:je.z.any().optional()}).strict();je.z.object({start:je.z.number().int().min(0),end:je.z.number().int().min(0),open:je.z.string(),close:je.z.string()}).strict();var Rt=je.z.object({indentSize:je.z.number().int().min(1).default(2),listMarker:je.z.enum(["\u2022","-","*"]).default("\u2022"),codeBlockMarker:je.z.enum(["```","~~~"]).default("```"),preserveFrontmatter:je.z.boolean().default(true)}).strict(),Pt=je.z.record(je.z.string(),je.z.string()),We=je.z.object({open:je.z.boolean(),ticks:je.z.number().int().min(0)}).strict();je.z.object({inlineState:We,isInside:je.z.any()}).strict();je.z.object({start:je.z.number().int().min(0),end:je.z.number().int().min(0),openLine:je.z.string(),marker:je.z.string(),indent:je.z.string()}).strict();je.z.object({tables:Ie.optional()}).strict();function no(e){let t=new to__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 An(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 Mt(e,t){return {...e,type:"text",content:t,children:void 0}}function ro(e){for(let t of e)t.children&&t.children.length>0&&(t.children=oo(t.children));}function oo(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(Mt(a,i.slice(c)));break}if(s>=n){r.push(Mt(a,i.slice(c)));break}p>c&&r.push(Mt(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 so(){return {text:"",styles:[],openStyles:[],links:[],linkStack:[]}}function ue(e){return e.table?.currentCell??e}function Ue(e,t){if(!t)return;let n=ue(e);n.text+=t;}function ye(e,t){let n=ue(e);n.openStyles.push({style:t,start:n.text.length});}function xe(e,t){let n=ue(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 $n(e){e.env.listStack.length>0||e.table||(e.text+=`
|
|
38
38
|
|
|
39
|
-
`);}function
|
|
40
|
-
`);}function
|
|
41
|
-
`;}for(let a=1;a<o.length;a++)
|
|
42
|
-
`;}else for(let o of n){for(let s=0;s<o.length;s++)
|
|
43
|
-
`;}}function
|
|
39
|
+
`);}function io(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 ao(e,t){if(!t)return;let n=ue(e),r=n.text.length;n.text+=t,n.styles.push({start:r,end:r+t.length,style:"code"});}function co(e,t){let n=t??"",r=ue(e),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function lo(e){let t=ue(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 uo(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function fo(e){return Bn(e),{text:e.text,styles:e.styles,links:e.links}}function qe(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 Et(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 po(e,t){t.text&&(e.text+=t.text);}function Ln(e,t){let{header:n,value:r,columnIndex:o,includeColumnFallback:s}=t;r?.text&&(e.text+="\u2022 ",n?.text?(Et(e,n),e.text+=": "):s&&(e.text+=`Column ${o}: `),Et(e,r),e.text+=`
|
|
40
|
+
`);}function mo(e){if(!e.table)return;let t=e.table.headers.map(qe),n=e.table.rows.map(o=>o.map(qe));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;Et(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++)Ln(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++)Ln(e,{header:t[s],value:o[s],columnIndex:s,includeColumnFallback:false});e.text+=`
|
|
43
|
+
`;}}function go(e){if(!e.table)return;let t=e.table.headers.map(qe),n=e.table.rows.map(l=>l.map(qe)),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 u=0;u<r;u+=1){let k=l[u]?.text.length??0;(o[u]??0)<k&&(o[u]=k);}};s(t);for(let l of n)s(l);let a=e.text.length,i=l=>{e.text+="|";for(let u=0;u<r;u+=1){e.text+=" ";let g=l[u];g&&po(e,g);let k=g?.text.length??0,H=(o[u]??0)-k;H>0&&(e.text+=" ".repeat(H)),e.text+=" |";}e.text+=`
|
|
44
44
|
`;},c=()=>{e.text+="|";for(let l=0;l<r;l+=1){let u=o[l]??0,g=Math.max(3,u);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
|
|
46
|
-
`);break;case "paragraph_close"
|
|
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 Ct(e,t){for(let n of e)switch(n.type){case "inline":n.children&&Ct(n.children,t);break;case "text":Ue(t,n.content??"");break;case "em_open":ye(t,"italic");break;case "em_close":xe(t,"italic");break;case "strong_open":ye(t,"bold");break;case "strong_close":xe(t,"bold");break;case "s_open":ye(t,"strikethrough");break;case "s_close":xe(t,"strikethrough");break;case "code_inline":ao(t,n.content??"");break;case "spoiler_open":t.enableSpoilers&&ye(t,"spoiler");break;case "spoiler_close":t.enableSpoilers&&xe(t,"spoiler");break;case "link_open":{let r=An(n,"href")??"",o=ue(t);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":lo(t);break;case "image":Ue(t,n.content??"");break;case "softbreak":case "hardbreak":Ue(t,`
|
|
46
|
+
`);break;case "paragraph_close":$n(t);break;case "heading_open":t.headingStyle==="bold"&&ye(t,"bold");break;case "heading_close":t.headingStyle==="bold"&&xe(t,"bold"),$n(t);break;case "blockquote_open":t.blockquotePrefix&&(t.text+=t.blockquotePrefix),ye(t,"blockquote");break;case "blockquote_close":xe(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
|
-
`);let r=Number(
|
|
50
|
-
`);break;case "list_item_open":
|
|
49
|
+
`);let r=Number(An(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":io(t);break;case "list_item_close":t.text.endsWith(`
|
|
51
51
|
`)||(t.text+=`
|
|
52
|
-
`);break;case "code_block":case "fence":
|
|
52
|
+
`);break;case "code_block":case "fence":co(t,n.content??"");break;case "html_block":case "html_inline":Ue(t,n.content??"");break;case "table_open":t.tableMode!=="off"&&(t.table=uo(),t.hasTables=true);break;case "table_close":t.table&&(t.tableMode==="bullets"?mo(t):t.tableMode==="code"&&go(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=so());break;case "th_close":case "td_close":t.table?.currentCell&&(t.table.currentRow.push(fo(t.table.currentCell)),t.table.currentCell=null);break;case "hr":t.text+=`\u2500\u2500\u2500
|
|
53
53
|
|
|
54
|
-
`;break;default:n.children&&
|
|
55
|
-
`);let k=l.findIndex(E=>E.spanIndex===u.spanIndex&&E.type==="open");k!==-1&&l.splice(k,1);}}else if(u.type==="link_open")c+="[",l.push(u);else if(u.type==="link_close"){c+="]("+u.href+")";let g=l.findIndex(k=>k.spanIndex===u.spanIndex&&k.type==="link_open");g!==-1&&l.splice(g,1);}p=u.position;}if(p<n.text.length){let u=n.text.slice(p);c+=s?s(u):u;}return c}catch(n){return console.error("Markdown render error:",n),""}}function Se(e,t){return Fe(e,t)}chunkVRQQ33YH_cjs.j();function
|
|
54
|
+
`;break;default:n.children&&Ct(n.children,t);break}}function Bn(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 ho(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 bo(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 Dn(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 yo(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Dn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,style:o.style});}return _n(r)}function xo(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Dn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,href:o.href});}return r}function we(e,t){try{let n=typeof e=="string"?e:"",r=He.parse(t??{});return Oe(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function Oe(e,t){try{let n=typeof e=="string"?e:"",r=He.parse(t),o={listStack:[]},a=no(r).parse(n||"",o);r.enableSpoilers&&ro(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};Ct(a,c),Bn(c);let l=c.text.trimEnd().length,u=0;for(let E of c.styles)E.style==="code_block"&&E.end>u&&(u=E.end);let g=Math.max(l,u);return {ir:{text:g===c.text.length?c.text:c.text.slice(0,g),styles:_n(ho(c.styles,g)),links:bo(c.links,g)},hasTables:c.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function Nn(e,t){try{let n=Ce.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=be(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:yo(n.styles,p,l),links:xo(n.links,p,l)}),a=l;}),s}catch(n){return console.error("Chunk IR error:",n),[]}}chunkVRQQ33YH_cjs.j();var wo={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Fe(e,t){try{let n=Ce.parse(e),r=vt.parse(t??{});if(!n.text)return "";let o=r.styleMarkers??wo,s=r.escapeText??(u=>u),a=r.buildLink,i=[];for(let u=0;u<n.styles.length;u++){let g=n.styles[u];g&&(i.push({position:g.start,type:"open",style:g.style,spanIndex:u}),i.push({position:g.end,type:"close",style:g.style,spanIndex:u}));}for(let u=0;u<n.links.length;u++){let g=n.links[u];g&&(i.push({position:g.start,type:"link_open",spanIndex:u,href:g.href}),i.push({position:g.end,type:"link_close",spanIndex:u,href:g.href}));}i.sort((u,g)=>{if(u.position!==g.position)return u.position-g.position;let k=(Y,G)=>Y==="link_open"?0:Y==="open"?1:Y==="close"?2:Y==="link_close"?3:4,E=u.type==="close"||u.type==="link_close",H=g.type==="close"||g.type==="link_close",U=k(u.type,E),q=k(g.type,H);return U!==q?U-q:u.type==="open"&&g.type==="open"?u.spanIndex-g.spanIndex:u.type==="close"&&g.type==="close"?g.spanIndex-u.spanIndex:u.spanIndex-g.spanIndex});let c="",p=0,l=[];for(let u of i){if(u.position>p){let g=n.text.slice(p,u.position);c+=s?s(g):g;}if(u.type==="open"||u.type==="close"){let g=o[u.style];if(g)if(u.type==="open")c+=g.open,l.push(u);else {c+=g.close,u.style==="code_block"&&u.position<n.text.length&&(c+=`
|
|
55
|
+
`);let k=l.findIndex(E=>E.spanIndex===u.spanIndex&&E.type==="open");k!==-1&&l.splice(k,1);}}else if(u.type==="link_open")c+="[",l.push(u);else if(u.type==="link_close"){c+="]("+u.href+")";let g=l.findIndex(k=>k.spanIndex===u.spanIndex&&k.type==="link_open");g!==-1&&l.splice(g,1);}p=u.position;}if(p<n.text.length){let u=n.text.slice(p);c+=s?s(u):u;}return c}catch(n){return console.error("Markdown render error:",n),""}}function Se(e,t){return Fe(e,t)}chunkVRQQ33YH_cjs.j();function So(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 Ye(e,t){try{let n=typeof e=="string"?e:"",r=
|
|
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 Ye(e,t){try{let n=typeof e=="string"?e:"",r=Rt.parse(t??{});if(!n)return "";let{frontmatter:o,content:s}=So(n),a=we(s,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),i=Se(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
|
|
63
|
-
`).trim(),linesConsumed:r-t}}function
|
|
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:u}=
|
|
62
|
+
`+i),i}catch(n){return console.error("Markdown format error:",n),e}}chunkVRQQ33YH_cjs.j();function ko(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function To(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 vo(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=To(o);a&&(n[s]=a);}return n}catch{return null}}function Ro(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 Po(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:u}=Ro(n,r);l&&(t[a]={value:l,kind:"multiline",rawInline:i}),r+=u;continue}}let c=ko(i);c&&(t[a]={value:c,kind:"inline",rawInline:i}),r+=1;}return t}function Mo(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.value;return t}function Eo(e){return /^[|>][+-]?(\d+)?[+-]?$/.test(e)}function Co(e){let{lineEntry:t,yamlValue:n}=e;return n.kind!=="structured"||t.kind!=="inline"||Eo(t.rawInline)?false:t.value.includes(":")}function Io(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 Ae(e){try{if(typeof e!="string")return {};let t=
|
|
67
|
+
---`,3);if(n!==-1)return t.slice(4,n)}function Ae(e){try{if(typeof e!="string")return {};let t=Io(e);if(!t)return {};let n=Po(t),r=vo(t);if(r===null)return Mo(n);let o={};for(let[s,a]of Object.entries(r)){o[s]=a.value;let i=n[s];i&&Co({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 Ve(e){try{let t=Pt.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
68
|
${jn__default.default.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
|
|
69
69
|
---`}catch(t){return console.warn("Failed to serialize frontmatter:",t),""}}function Ge(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:Ae(e),content:o}}catch(t){return console.warn("Failed to extract frontmatter:",t),{frontmatter:{},content:e}}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Je(e){try{let t=
|
|
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 u=l[0];if(!u){o=a+1;continue}let g=l.length;if(!r)r={start:o,markerChar:u,markerLen:g,openLine:i,marker:l,indent:p};else if(r.markerChar===u&&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
|
|
72
|
+
---`,3);if(n===-1)return {frontmatter:{},content:e};let r=t.slice(4,n),o=t.slice(n+4).trimStart();return {frontmatter:Ae(e),content:o}}catch(t){return console.warn("Failed to extract frontmatter:",t),{frontmatter:{},content:e}}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Je(e){try{let t=je.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 u=l[0];if(!u){o=a+1;continue}let g=l.length;if(!r)r={start:o,markerChar:u,markerLen:g,openLine:i,marker:l,indent:p};else if(r.markerChar===u&&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 It(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 zn(e,t){return !It(e,t)}function Ke(){return {open:false,ticks:0}}function Ze(e,t){try{let n=je.z.string().parse(e),r=t?We.parse(t):Ke(),o=Je(n),s={open:r.open,ticks:r.ticks},{spans:a,state:i}=Ao(n,o,s);return {inlineState:i,isInside:c=>Lo(c,o)||Bo(c,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Ke(),isInside:()=>false}}}function Ao(e,t,n){let r=[],o=n.open,s=n.ticks,a=o?0:-1,i=0;for(;i<e.length;){let c=$o(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 $o(e,t){return e.find(n=>t>=n.start&&t<n.end)}function Lo(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Bo(e,t){return t.some(([n,r])=>e>=n&&e<r)}chunkVRQQ33YH_cjs.j();var Do={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Xe(e,t){try{let n=je.z.string().parse(e),r=Ie.parse(t);if(!n||r==="off")return n;let{ir:o,hasTables:s}=Oe(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return s?Fe(o,{styleMarkers:Do,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,u){try{return we(l,u)}catch(g){return console.warn("Markdown.parse error:",g),{text:"",styles:[],links:[]}}}p.parse=e;function t(l,u){try{return Se(l,u)}catch(g){return console.warn("Markdown.render error:",g),""}}p.render=t;function n(l,u){try{return Ye(l,u)}catch(g){return console.warn("Markdown.format error:",g),typeof l=="string"?l:""}}p.format=n;function r(l){try{return Ae(l)}catch(u){return console.warn("Markdown.parseFrontmatter error:",u),{}}}p.parseFrontmatter=r;function o(l){try{return Ve(l)}catch(u){return console.warn("Markdown.serializeFrontmatter error:",u),""}}p.serializeFrontmatter=o;function s(l){try{return Ge(l)}catch(u){return console.warn("Markdown.extractFrontmatter error:",u),{frontmatter:{},content:typeof l=="string"?l:""}}}p.extractFrontmatter=s;function a(l,u,g){try{return be(l,u,g)}catch(k){return console.warn("Markdown.chunk error:",k),typeof l=="string"&&l.length>0?[l]:[]}}p.chunk=a;function i(l,u){try{return Ze(l,u)}catch(g){return console.warn("Markdown.buildCodeIndex error:",g),{inlineState:{open:false,ticks:0},isInside:()=>false}}}p.buildCodeIndex=i;function c(l,u){try{return Xe(l,u)}catch(g){return console.warn("Markdown.convertTables error:",g),typeof l=="string"?l:""}}p.convertTables=c;})(exports.Markdown||(exports.Markdown={}));chunkVRQQ33YH_cjs.j();function Hn(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function No(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function jo(e){if(!e)return "";let t=e.split(".");return t[t.length-1]}function zo(e,t=20){let n=Hn(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 Ho(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 Wo=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function Uo(e){if(!e)return false;let t=String(e instanceof Error?e.message:e).toLowerCase();return Wo.some(n=>t.includes(n))}async function Ft(e,t={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:s=1e4,retryIf:a=Uo}=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(u=>setTimeout(u,l));}throw i}chunkVRQQ33YH_cjs.j();exports.Fetch=void 0;(Ut=>{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})}Ut.hasProxyConfigured=o;function s(){let O=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||O}Ut.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 $=new undici.ProxyAgent({uri:C,connectTimeout:O.connectTimeout||1e4,keepAliveTimeout:O.keepAliveTimeout||3e4});r=undici.getGlobalDispatcher(),undici.setGlobalDispatcher($),n=true,e.info(`[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u542F\u7528: ${C}`);}Ut.enableProxy=a;function i(){!n||!r||(undici.setGlobalDispatcher(r),n=false,r=null,e.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}Ut.disableProxy=i;function c(){return n}Ut.isProxyEnabled=c;async function p(O,C){let $=C?.timeout||3e4,W=C?.responseType||"json",{timeout:V,responseType:ve,..._}=C||{},S=null,m=null;try{_.signal||(S=new AbortController,m=setTimeout(()=>S.abort(),$));let f=await fetch(O,{..._,signal:_.signal||S.signal});m&&clearTimeout(m);let d;switch(W){case "arrayBuffer":d=await f.arrayBuffer();break;case "blob":d=await f.blob();break;case "buffer":{let y=await f.arrayBuffer();d=Buffer.from(y);break}case "text":d=await f.text();break;default:{let y=await f.text();try{d=JSON.parse(y);}catch{d=y;}break}}return {ok:f.ok,status:f.status,statusText:f.statusText,headers:f.headers,data:d,url:f.url}}catch(f){throw m&&clearTimeout(m),f}}async function l(O,C){let $=C?.retries??0,W=C?.retryDelay??1e3,{retries:V,retryDelay:ve,responseType:_,...S}=C||{};return Ft(()=>p(O,{...S,responseType:C?.responseType}),{attempts:$+1,delay:W,maxDelay:W*2**($+1)})}async function u(O,C){return l(O,{method:"GET",...C})}Ut.get=u;async function g(O,C,$){return l(O,{method:"POST",headers:{"Content-Type":"application/json",...$?.headers},body:C?JSON.stringify(C):void 0,...$})}Ut.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,...$})}Ut.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,...$})}Ut.del=E;async function H(O,C,$){return l(O,{method:"PATCH",headers:{"Content-Type":"application/json",...$?.headers},body:C?JSON.stringify(C):void 0,...$})}Ut.patch=H;async function U(O,C){return l(O,C)}Ut.request=U;function q(O={}){return o()?(a(O),true):false}Ut.autoProxy=q;let Y=5*1024*1024;function G(O){return new TextEncoder().encode(O)}function de(O){return chunkJL3GR4P7_cjs.c.mimeType(O)}function se(O){return O.startsWith("file://")}async function fe(O){let C=url.fileURLToPath(O);return await exports.PKG.file(C).bytes()}async function ke(O,C,$){let W=`----FetchFormBoundary${Date.now()}`,V=[],_=C.some(h=>h.filename||h.value instanceof Uint8Array||Buffer.isBuffer(h.value))&&!$?.timeout?3e5:$?.timeout;for(let h of C){let w=h.maxSize??Y,R=h.filename,v=`Content-Disposition: form-data; name="${h.name}"${R?`; filename="${R}"`:""}`;R&&(v+=`\r
|
|
74
74
|
Content-Type: ${de(R)}`),v+=`\r
|
|
75
75
|
\r
|
|
76
|
-
`,V.push(G(v));let T=h.value;if(typeof T=="string")if(se(T)){let
|
|
76
|
+
`,V.push(G(v));let T=h.value;if(typeof T=="string")if(se(T)){let I=await fe(T);if(R||(R=T.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(T));else if(Buffer.isBuffer(T)){if(T.byteLength>w)throw new Error(`Buffer size ${T.byteLength} exceeds limit ${w} bytes: ${h.name}`);V.push(new Uint8Array(T.buffer,T.byteOffset,T.byteLength));}else if(T instanceof Uint8Array){if(T.byteLength>w)throw new Error(`File size ${T.byteLength} exceeds limit ${w} bytes: ${h.name}`);V.push(T);}}let S=G(`\r
|
|
77
77
|
--${W}--`),m=G(`\r
|
|
78
78
|
--${W}\r
|
|
79
79
|
`),f=[];f.push(G(`--${W}\r
|
|
80
80
|
`));for(let h=0;h<V.length;h++)f.push(V[h]),h%2===1&&h<V.length-1&&(f.push(m),f.push(G(`--${W}\r
|
|
81
|
-
`)));f.push(S);let d=f.reduce((h,w)=>h+w.length,0),y=new Uint8Array(d),x=0;for(let h of f)y.set(h,x),x+=h.length;return l(
|
|
82
|
-
`);d=w.pop()??"";for(let R of w)if(R.startsWith("data: ")){let v=R.slice(6);if(v==="[DONE]"){C.onComplete?.();return}C.onMessage?.(v);}}C.onComplete?.();}catch(_){_.name!=="AbortError"&&C.onError?.(_);}})(),()=>{W.abort();}}Ht.sse=Te;})(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=he__default.default.resolve(n),s=he__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 u of p)if(!l.includes(u)||!e(i[u],c[u]))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("+"),u={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let g of l)switch(g){case "ctrl":u.ctrl=true;break;case "alt":case "meta":case "option":u.meta=true;break;case "super":u.super=true;break;case "shift":u.shift=true;break;case "leader":u.leader=true;break;case "esc":u.name="escape";break;default:u.name=g;break}return u})}a.parse=s;})(exports.Keybind||(exports.Keybind={}));chunkVRQQ33YH_cjs.j();exports.Locale=void 0;(p=>{function e(l){return l.replace(/\b\w/g,u=>u.toUpperCase())}p.titlecase=e;function t(l){return new Date(l).toLocaleTimeString(void 0,{timeStyle:"short"})}p.time=t;function n(l){let u=new Date(l),g=t(l),k=u.toLocaleDateString();return `${g} \xB7 ${k}`}p.datetime=n;function r(l){let u=new Date(l),g=new Date;return u.getFullYear()===g.getFullYear()&&u.getMonth()===g.getMonth()&&u.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 u=Math.floor(l/36e5);return `${Math.floor(l%36e5/864e5)}d ${u}h`}p.duration=s;function a(l,u){return l.length<=u?l:l.slice(0,u-1)+"\u2026"}p.truncate=a;function i(l,u=35){if(l.length<=u)return l;let g="\u2026",k=Math.ceil((u-g.length)/2),E=Math.floor((u-g.length)/2);return l.slice(0,k)+g+l.slice(-E)}p.truncateMiddle=i;function c(l,u,g){return (l===1?u: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 Dt=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,u=Math.round(p/1.5),g=Math.round(l/4);return Math.max(0,u+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,u=i.cache?.write??0;return c+p+l+u}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 Ne__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[u,g]of p)e(a,u)&&(l=g);return l}s.all=n;function r(a,i){let c=Object.entries(i),p=t(c),l;for(let[u,g]of p){let k=u.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 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.$=Or;exports.AsyncQueue=Dt;exports.NamedError=gt;exports.PkgShell=Re;exports.abortAfter=Hn;exports.abortAfterAny=Uo;exports.buildCodeSpanIndex=Ze;exports.chunkMarkdownIR=_n;exports.chunkText=be;exports.chunkTextByBreakResolver=wt;exports.convertMarkdownTables=Xe;exports.createInlineCodeState=Ke;exports.createPkgShell=le;exports.createRESTServer=lt;exports.createRPCServer=ct;exports.createServer=ae;exports.createStreamingServer=dt;exports.createWebSocketServer=ut;exports.defer=Yo;exports.detectPlatform=mn;exports.escapeCommandArg=mt;exports.escapeCommandArgSafe=pn;exports.extractFrontmatter=Ge;exports.findFenceSpanAt=Et;exports.findLast=Jn;exports.fn=Fr;exports.formatDuration=Vo;exports.formatLocalISO=st;exports.formatLocalISOCompact=it;exports.formatLogTime=er;exports.formatMarkdown=Ye;exports.getDirectory=Lo;exports.getFileExtension=Bo;exports.getFilename=Nn;exports.getFilenameTruncated=_o;exports.getProxyConfig=Zo;exports.getProxyUrl=Ko;exports.getTimezoneOffset=tr;exports.git=_r;exports.iife=Ur;exports.initLog=hl;exports.isSafeFenceBreak=Dn;exports.joinCommandArgs=me;exports.lazy=Be;exports.lazyAsync=nr;exports.loadEnv=Br;exports.loadTextFile=Hr;exports.loadTextFileAsync=Wr;exports.markdownToIR=we;exports.markdownToIRWithMeta=Ie;exports.needsShellExecution=dn;exports.now=Yt;exports.nowLocalISO=Xn;exports.parseCommand=re;exports.parseCommandWithOptions=fn;exports.parseFenceSpans=Je;exports.parseFrontmatterBlock=Ae;exports.parseLocalISO=Qn;exports.parseModelId=qr;exports.proxied=Jo;exports.readableStreamToText=Mr;exports.renderMarkdown=Se;exports.renderMarkdownWithMarkers=Fe;exports.retry=Ot;exports.scanParenAwareBreakpoints=xt;exports.serializeFrontmatter=Ve;exports.shell=hn;exports.signal=Qo;exports.startServer=ir;exports.truncateMiddle=jo;exports.updateSchema=ns;exports.whichSync=Er;exports.withTimeout=es;exports.work=Xo;
|
|
81
|
+
`)));f.push(S);let d=f.reduce((h,w)=>h+w.length,0),y=new Uint8Array(d),x=0;for(let h of f)y.set(h,x),x+=h.length;return l(O,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${W}`,...$?.headers},body:y,timeout:_,...$})}Ut.postForm=ke;function Te(O,C,$){let W=new AbortController,V=W.signal;return (async()=>{try{let _={Accept:"text/event-stream",...$?.headers||{}},S=await fetch(O,{...$,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 f=new TextDecoder("utf-8"),d="";for(;!V.aborted;){let{done:y,value:x}=await m.read();if(y)break;let h=f.decode(x,{stream:!0});d+=h;let w=d.split(`
|
|
82
|
+
`);d=w.pop()??"";for(let R of w)if(R.startsWith("data: ")){let v=R.slice(6);if(v==="[DONE]"){C.onComplete?.();return}C.onMessage?.(v);}}C.onComplete?.();}catch(_){_.name!=="AbortError"&&C.onError?.(_);}})(),()=>{W.abort();}}Ut.sse=Te;})(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 Un(e){let t=new AbortController,n=setTimeout(t.abort.bind(t),e);return {controller:t,signal:t.signal,clearTimeout:()=>globalThis.clearTimeout(n)}}function Go(e,...t){let n=Un(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=he__default.default.resolve(n),s=he__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 Ko(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 Zo(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 u of p)if(!l.includes(u)||!e(i[u],c[u]))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("+"),u={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let g of l)switch(g){case "ctrl":u.ctrl=true;break;case "alt":case "meta":case "option":u.meta=true;break;case "super":u.super=true;break;case "shift":u.shift=true;break;case "leader":u.leader=true;break;case "esc":u.name="escape";break;default:u.name=g;break}return u})}a.parse=s;})(exports.Keybind||(exports.Keybind={}));chunkVRQQ33YH_cjs.j();exports.Locale=void 0;(p=>{function e(l){return l.replace(/\b\w/g,u=>u.toUpperCase())}p.titlecase=e;function t(l){return new Date(l).toLocaleTimeString(void 0,{timeStyle:"short"})}p.time=t;function n(l){let u=new Date(l),g=t(l),k=u.toLocaleDateString();return `${g} \xB7 ${k}`}p.datetime=n;function r(l){let u=new Date(l),g=new Date;return u.getFullYear()===g.getFullYear()&&u.getMonth()===g.getMonth()&&u.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 u=Math.floor(l/36e5);return `${Math.floor(l%36e5/864e5)}d ${u}h`}p.duration=s;function a(l,u){return l.length<=u?l:l.slice(0,u-1)+"\u2026"}p.truncate=a;function i(l,u=35){if(l.length<=u)return l;let g="\u2026",k=Math.ceil((u-g.length)/2),E=Math.floor((u-g.length)/2);return l.slice(0,k)+g+l.slice(-E)}p.truncateMiddle=i;function c(l,u,g){return (l===1?u:g).replace("{}",l.toString())}p.pluralize=c;})(exports.Locale||(exports.Locale={}));chunkVRQQ33YH_cjs.j();var Xo=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Qo(){return Xo.some(e=>process.env[e])}function es(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function ts(){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 zt=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 ns(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 rs(){let e,t=new Promise(n=>e=n);return {trigger(){return e()},wait(){return t}}}chunkVRQQ33YH_cjs.j();function os(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,u=Math.round(p/1.5),g=Math.round(l/4);return Math.max(0,u+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,u=i.cache?.write??0;return c+p+l+u}a.total=s;})(exports.Token||(exports.Token={}));chunkVRQQ33YH_cjs.j();function is(e){let t={};for(let[n,r]of Object.entries(e.required().shape))t[n]=r.nullable();return je__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[u,g]of p)e(a,u)&&(l=g);return l}s.all=n;function r(a,i){let c=Object.entries(i),p=t(c),l;for(let[u,g]of p){let k=u.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 wl(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.$=$r;exports.AsyncQueue=zt;exports.NamedError=bt;exports.PkgShell=Re;exports.abortAfter=Un;exports.abortAfterAny=Go;exports.addMinutesInTimezone=sr;exports.buildCodeSpanIndex=Ze;exports.chunkMarkdownIR=Nn;exports.chunkText=be;exports.chunkTextByBreakResolver=kt;exports.convertMarkdownTables=Xe;exports.createInlineCodeState=Ke;exports.createPkgShell=le;exports.createRESTServer=dt;exports.createRPCServer=ut;exports.createServer=ae;exports.createStreamingServer=pt;exports.createWebSocketServer=ft;exports.defer=Ko;exports.detectPlatform=hn;exports.escapeCommandArg=ht;exports.escapeCommandArgSafe=gn;exports.extractFrontmatter=Ge;exports.findFenceSpanAt=It;exports.findLast=Zn;exports.fn=Br;exports.formatDuration=Zo;exports.formatLocalISO=it;exports.formatLocalISOCompact=at;exports.formatLogTime=nr;exports.formatMarkdown=Ye;exports.getDirectory=No;exports.getFileExtension=jo;exports.getFilename=Hn;exports.getFilenameTruncated=zo;exports.getProxyConfig=ts;exports.getProxyUrl=es;exports.getTimezoneOffset=rr;exports.getTimezoneParts=st;exports.git=zr;exports.iife=Gr;exports.initLog=wl;exports.isSafeFenceBreak=zn;exports.isValidTimezone=or;exports.joinCommandArgs=me;exports.lazy=Be;exports.lazyAsync=ir;exports.loadEnv=jr;exports.loadTextFile=Yr;exports.loadTextFileAsync=Vr;exports.markdownToIR=we;exports.markdownToIRWithMeta=Oe;exports.needsShellExecution=pn;exports.normalizeTimezone=ct;exports.now=Gt;exports.nowLocalISO=er;exports.parseCommand=re;exports.parseCommandWithOptions=mn;exports.parseFenceSpans=Je;exports.parseFrontmatterBlock=Ae;exports.parseLocalISO=tr;exports.parseModelId=Jr;exports.proxied=Qo;exports.readableStreamToText=Or;exports.renderMarkdown=Se;exports.renderMarkdownWithMarkers=Fe;exports.retry=Ft;exports.scanParenAwareBreakpoints=St;exports.serializeFrontmatter=Ve;exports.shell=yn;exports.signal=rs;exports.startServer=ur;exports.truncateMiddle=Ho;exports.updateSchema=is;exports.whichSync=Fr;exports.withTimeout=os;exports.work=ns;
|