@easbot/utils 0.3.10 → 0.3.12
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/chunks/chunk-6GZFOJRQ.mjs +2 -0
- package/dist/chunks/{chunk-3U5YF6EI.cjs → chunk-GJWUV3QH.cjs} +5 -5
- package/dist/chunks/chunk-HJFBORDG.cjs +2 -0
- package/dist/chunks/{chunk-AUS6KQNI.cjs → chunk-PGUMSM7F.cjs} +1 -1
- package/dist/chunks/{chunk-DELWLFU5.mjs → chunk-QCS3QD2D.mjs} +1 -1
- package/dist/chunks/{chunk-WW6DVU53.mjs → chunk-YP6ECIPQ.mjs} +2 -2
- package/dist/chunks/filesystem-CGAFQWRQ.cjs +1 -0
- package/dist/chunks/filesystem-O6RBT4K4.mjs +1 -0
- package/dist/chunks/registry-GBOWZBTS.mjs +1 -0
- package/dist/chunks/registry-GFAO7SFK.cjs +1 -0
- package/dist/chunks/shell-4YPSYLVZ.cjs +1 -0
- package/dist/chunks/shell-V3XGWWGO.mjs +1 -0
- package/dist/index.cjs +23 -60
- package/dist/index.d.cts +265 -207
- package/dist/index.d.ts +265 -207
- package/dist/index.mjs +23 -60
- package/package.json +4 -3
- package/dist/chunks/chunk-6BCTOX3Z.mjs +0 -2
- package/dist/chunks/chunk-EN7LFV4R.cjs +0 -2
- package/dist/chunks/filesystem-26SI2VQU.cjs +0 -1
- package/dist/chunks/filesystem-GHRTFLEY.mjs +0 -1
- package/dist/chunks/registry-5BYC5NYM.mjs +0 -1
- package/dist/chunks/registry-Z3XETZ6O.cjs +0 -1
- package/dist/chunks/shell-52EI6MQK.cjs +0 -1
- package/dist/chunks/shell-JJRFPZC7.mjs +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,66 +1,29 @@
|
|
|
1
|
-
'use strict';var chunkPJIZPZPO_cjs=require('./chunks/chunk-PJIZPZPO.cjs'),
|
|
2
|
-
Full ${
|
|
3
|
-
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${
|
|
4
|
-
Use Read tool with offset/limit parameters to view specific sections.]`}async function
|
|
1
|
+
'use strict';var chunkPJIZPZPO_cjs=require('./chunks/chunk-PJIZPZPO.cjs'),chunkGJWUV3QH_cjs=require('./chunks/chunk-GJWUV3QH.cjs'),chunkHJFBORDG_cjs=require('./chunks/chunk-HJFBORDG.cjs'),chunkPGUMSM7F_cjs=require('./chunks/chunk-PGUMSM7F.cjs'),chunkXBAP2B6J_cjs=require('./chunks/chunk-XBAP2B6J.cjs'),se=require('fs/promises'),le=require('zod'),crypto$1=require('crypto'),dotenv=require('dotenv'),Ee=require('path'),fs=require('fs'),xdgBasedir=require('xdg-basedir'),url=require('url'),fe=require('gray-matter'),undici=require('undici'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var se__default=/*#__PURE__*/_interopDefault(se);var le__default=/*#__PURE__*/_interopDefault(le);var Ee__default=/*#__PURE__*/_interopDefault(Ee);var fe__default=/*#__PURE__*/_interopDefault(fe);chunkXBAP2B6J_cjs.e();chunkXBAP2B6J_cjs.e();function pt(t,e){for(let r=t.length-1;r>=0;r-=1){let n=t[r];if(n!==void 0&&e(n,r,t))return n}}chunkXBAP2B6J_cjs.e();exports.Binary=void 0;(r=>{function t(n,s,l){let y=0,o=n.length-1;for(;y<=o;){let u=Math.floor((y+o)/2),b=n[u];if(b===void 0)break;let w=l(b);if(w===s)return {found:true,index:u};w<s?y=u+1:o=u-1;}return {found:false,index:y}}r.search=t;function e(n,s,l){let y=l(s),o=0,u=n.length;for(;o<u;){let b=Math.floor((o+u)/2),w=n[b];if(w===void 0)break;l(w)<y?o=b+1:u=b;}return n.splice(o,0,s),n}r.insert=e;})(exports.Binary||(exports.Binary={}));chunkXBAP2B6J_cjs.e();exports.Encode=void 0;(l=>{function t(y){let o=new TextEncoder().encode(y),u=Array.from(o,b=>String.fromCharCode(b)).join("");return btoa(u).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}l.base64Encode=t;function e(y){let o=atob(y.replace(/-/g,"+").replace(/_/g,"/")),u=Uint8Array.from(o,b=>b.charCodeAt(0));return new TextDecoder().decode(u)}l.base64Decode=e;async function r(y,o="SHA-256"){let b=new TextEncoder().encode(y),w=await crypto.subtle.digest(o,b);return Array.from(new Uint8Array(w)).map(g=>g.toString(16).padStart(2,"0")).join("")}l.hash=r;function n(y){if(!y)return;let o=2166136261;for(let u=0;u<y.length;u++)o^=y.charCodeAt(u),o=Math.imul(o,16777619);return (o>>>0).toString(36)}l.checksum=n;function s(y,o=5e5){if(!y)return;if(y.length<=o)return n(y);let u=4096,w=[0,Math.floor(y.length*.25),Math.floor(y.length*.5),Math.floor(y.length*.75),y.length-u].map(S=>{let R=Math.max(0,Math.min(y.length-u,S-Math.floor(u/2)));return n(y.slice(R,R+u))??""}).join(":");return `${y.length}:${w}`}l.sampledChecksum=s;})(exports.Encode||(exports.Encode={}));chunkXBAP2B6J_cjs.e();chunkXBAP2B6J_cjs.e();exports.Identifier=void 0;(S=>{let t={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",experience:"exp",pattern:"pat",knowledge:"knw",evolution:"evo",result:"res"};function e(R){return le__default.default.string().startsWith(t[R])}S.schema=e;let r=26,n=0,s=0;function l(R,g){return o(R,false,g)}S.ascending=l;function y(R,g){return o(R,true,g)}S.descending=y;function o(R,g,A){if(!A)return b(R,g);if(!A.startsWith(t[R]))throw new Error(`ID ${A} does not start with ${t[R]}`);return A}function u(R){let g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",A="",D=crypto$1.randomBytes(R);for(let i=0;i<R;i++){let h=D[i];h!==void 0&&(A+=g[h%62]);}return A}function b(R,g,A){let D=A??Date.now();D!==n&&(n=D,s=0),s++;let i=BigInt(D)*BigInt(4096)+BigInt(s);i=g?~i:i;let h=Buffer.alloc(6);for(let v=0;v<6;v++)h[v]=Number(i>>BigInt(40-8*v)&BigInt(255));return t[R]+"_"+h.toString("hex")+u(r-12)}S.create=b;function w(R){let g=R.split("_")[0];if(!g)return 0;let A=R.slice(g.length+1,g.length+13),D=BigInt("0x"+A);return Number(D/BigInt(4096))}S.timestamp=w;})(exports.Identifier||(exports.Identifier={}));exports.TruncateContent=void 0;(b=>{b.DEFAULT_MAX_CHARS=4e3,b.DIRECTION="head",b.DIR=chunkHJFBORDG_cjs.d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),b.GLOB=chunkHJFBORDG_cjs.d.join(b.DIR,"*");let s=10080*60*1e3;function l(w,S,R){return R?`[Content truncated. Source: ${R}
|
|
2
|
+
Full ${S} saved to: ${w}
|
|
3
|
+
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${S} saved to: ${w}
|
|
4
|
+
Use Read tool with offset/limit parameters to view specific sections.]`}async function y(w,S={}){let R=S.maxChars??4e3,g=S.direction??b.DIRECTION,A=S.label??"content",D=S.sourcePath,i=chunkHJFBORDG_cjs.d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),h=S.dir??i;if(w.length<=R)return {content:w,truncated:false};let v=exports.Identifier.ascending("context"),L=chunkHJFBORDG_cjs.d.join(h,v);await se__default.default.mkdir(h,{recursive:true}).catch(()=>{}),await se__default.default.writeFile(L,w,"utf-8");let z=w.length-R,M;g==="head"?M=w.slice(0,R):M=w.slice(-R);let _=l(L,A,D),a=`${z} characters truncated`;return {content:g==="head"?`${M}
|
|
5
5
|
|
|
6
|
-
...${
|
|
6
|
+
...${a}...
|
|
7
7
|
|
|
8
|
-
${
|
|
8
|
+
${_}`:`...${a}...
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${_}
|
|
11
11
|
|
|
12
|
-
${
|
|
13
|
-
`):e;for(let
|
|
12
|
+
${M}`,truncated:true,outputPath:L,originalLength:w.length,removedLength:z,label:A}}b.truncate=y;function o(w){return w.truncated?l(w.outputPath,w.label):""}b.formatHint=o;async function u(){let w=exports.Identifier.timestamp(exports.Identifier.create("context",false,Date.now()-s)),R=(await se__default.default.readdir(b.DIR).catch(()=>[])).filter(g=>g.startsWith("context_"));for(let g of R)exports.Identifier.timestamp(g)>=w||await se__default.default.unlink(chunkHJFBORDG_cjs.d.join(b.DIR,g)).catch(()=>{});}b.cleanup=u;})(exports.TruncateContent||(exports.TruncateContent={}));chunkXBAP2B6J_cjs.e();exports.SessionTitle=void 0;(o=>{let t="New session - ",e="Child session - ";o.parentTitlePrefix=t,o.childTitlePrefix=e;function s(u=false){return (u?e:t)+chunkPGUMSM7F_cjs.b(new Date)}o.createDefault=s;function l(u){return new RegExp(`^(${t}|${e})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(u)}o.isDefault=l;function y(u){let b=u.match(/^(.+) \(fork #(\d+)\)$/);if(b){let w=b[1]??"",S=parseInt(b[2]??"0",10);return `${w} (fork #${S+1})`}return `${u} (fork #1)`}o.getForked=y;})(exports.SessionTitle||(exports.SessionTitle={}));chunkXBAP2B6J_cjs.e();var re=class re extends Error{static create(e,r){var l;let n=le__default.default.object({name:le__default.default.literal(e),data:r}).meta({ref:e}),s=(l=class extends re{constructor(o,u){super(e,u);chunkXBAP2B6J_cjs.c(this,"data",o);chunkXBAP2B6J_cjs.c(this,"name",e);this.name=e;}static isInstance(o){return o!==null&&typeof o=="object"&&"name"in o&&o.name===e}schema(){return n}toObject(){return {name:e,data:this.data}}},chunkXBAP2B6J_cjs.c(l,"Schema",n),l);return Object.defineProperty(s,"name",{value:e}),s}};chunkXBAP2B6J_cjs.c(re,"Unknown",re.create("UnknownError",le__default.default.object({message:le__default.default.string()})));var ne=re;chunkXBAP2B6J_cjs.e();exports.Ignore=void 0;(e=>{function t(r){return new we(r)}e.create=t;})(exports.Ignore||(exports.Ignore={}));var we=class{constructor(e){chunkXBAP2B6J_cjs.c(this,"rules",[]);chunkXBAP2B6J_cjs.c(this,"ignorecase");chunkXBAP2B6J_cjs.c(this,"debug");this.ignorecase=e?.ignorecase??false,this.debug=e?.debug??false;}add(e){let r=typeof e=="string"?e.split(`
|
|
13
|
+
`):e;for(let n=0;n<r.length;n++){let s=r[n];this.parseRule(s,n+1);}return this}parseRule(e,r){let n=e,s=e;if(n.length===0||n.startsWith("#"))return;let l=n.startsWith("!");if(l&&(n=n.slice(1)),n=n.trim(),n.length===0||(n.startsWith("\\#")&&(n=n.slice(1)),n.startsWith("#")))return;let y=n.startsWith("/");y&&(n=n.slice(1));let o=n.endsWith("/");o&&(n=n.slice(0,-1)),n.length!==0&&this.rules.push({pattern:n,negative:l,isDirectory:o,anchored:y,original:s,lineNumber:r});}ignores(e,r){let n=this.normalizePath(e),s=r??e.endsWith("/"),l=this.checkIgnore(n,s);return this.debug&&console.log(`Ignore.ignores("${e}", isDirectory=${s}) => ${l}`),l}checkIgnore(e,r){let n=false;for(let s of this.rules)s.isDirectory&&!r||this.matchPath(s,e)&&(s.negative?n=false:n=true);return n}matchPath(e,r){let n=this.ignorecase?r.toLowerCase():r,l=this.ignorecase?e.pattern.toLowerCase():e.pattern;if(e.anchored)return chunkHJFBORDG_cjs.a.match(n,l);if(l.includes("/"))return chunkHJFBORDG_cjs.a.match(n,l);let y=n.split("/");for(let o of y)if(chunkHJFBORDG_cjs.a.match(o,l))return true;return false}filter(e){return e.filter(r=>!this.ignores(r))}createFilter(){return e=>!this.ignores(e)}normalizePath(e){let r=e.replace(/\\/g,"/");if(r==="/")return "";for(;r.startsWith("./");)r=r.slice(2);return r.endsWith("/")&&r.length>1&&(r=r.slice(0,-1)),r}};chunkXBAP2B6J_cjs.e();function Le(t,e){let r=n=>{let s;try{s=t.parse(n);}catch(l){throw console.trace("schema validation failure stack trace:"),l instanceof le.z.ZodError&&console.error("schema validation issues:",JSON.stringify(l.issues,null,2)),l}return e(s)};return r.force=n=>e(n),r.schema=t,r}var xt=Le;exports.Fn=void 0;(e=>e.fn=Le)(exports.Fn||(exports.Fn={}));chunkXBAP2B6J_cjs.e();function wt(t={}){let e=t.isDevelopment??false,r=e?".env.dev":".env",n=t.globalConfigPath??(xdgBasedir.xdgConfig?Ee__default.default.join(xdgBasedir.xdgConfig,"easbot"):void 0),s=t.projectRoot??process.cwd(),l=s?Ee__default.default.join(s,".easbot"):void 0,y=[{root:n,label:"global"},{root:s,label:"project"},{root:l,label:"workspace"}];for(let{root:o}of y){if(!o)continue;let u=Ee__default.default.join(o,r);if(!fs.existsSync(u))continue;let b=dotenv.config({path:u,override:true,debug:e,encoding:"utf-8",quiet:!e});if(e&&b.parsed){let S=["XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_CACHE_HOME","XDG_STATE_HOME","XDG_RUNTIME_DIR","EASBOT_CONFIG_PATH","EASBOT_DATA_PATH","EASBOT_CACHE_PATH","EASBOT_STATE_PATH","EASBOT_LOG_PATH","EASBOT_BIN_PATH"].filter(R=>R in b.parsed);S.length>0&&console.warn(`[loadEnv] ${u} contains keys that have no effect: ${S.join(", ")}.
|
|
14
14
|
Reason: xdg-basedir caches XDG_* on import, so this .env file loads too late.
|
|
15
|
-
How to override: export them in the shell before loadEnv() runs, or set process.env directly.`);}}}chunkXBAP2B6J_cjs.e();async function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`);}function En(t){let e=t.env.listStack,n=e[e.length-1];if(!n)return;n.index+=1;let r=" ".repeat(Math.max(0,e.length-1)),o=n.type==="ordered"?`${n.index}. `:"\u2022 ";t.text+=`${r}${o}`;}function _n(t,e){if(!e)return;let n=Z(t),r=n.text.length;n.text+=e,n.styles.push({start:r,end:r+e.length,style:"code"});}function Cn(t,e){let n=e??"",r=Z(t),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function An(t){let e=Z(t),n=e.linkStack.pop();if(!n?.href)return;let r=n.href.trim();if(!r)return;let o=n.labelStart,i=e.text.length;if(i<=o){e.links.push({start:o,end:i,href:r});return}e.links.push({start:o,end:i,href:r});}function Ln(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function Dn(t){return Rt(t),{text:t.text,styles:t.styles,links:t.links}}function Me(t){let e=t.text,n=0,r=e.length;for(;n<r&&/\s/.test(e[n]??"");)n+=1;for(;r>n&&/\s/.test(e[r-1]??"");)r-=1;if(n===0&&r===e.length)return t;let o=e.slice(n,r),i=o.length,a=[];for(let l of t.styles){let f=Math.max(0,l.start-n),c=Math.min(i,l.end-n);c>f&&a.push({start:f,end:c,style:l.style});}let s=[];for(let l of t.links){let f=Math.max(0,l.start-n),c=Math.min(i,l.end-n);c>f&&s.push({start:f,end:c,href:l.href});}return {text:o,styles:a,links:s}}function Ke(t,e){if(!e.text)return;let n=t.text.length;t.text+=e.text;for(let r of e.styles)t.styles.push({start:n+r.start,end:n+r.end,style:r.style});for(let r of e.links)t.links.push({start:n+r.start,end:n+r.end,href:r.href});}function $n(t,e){e.text&&(t.text+=e.text);}function Mt(t,e){let{header:n,value:r,columnIndex:o,includeColumnFallback:i}=e;r?.text&&(t.text+="\u2022 ",n?.text?(Ke(t,n),t.text+=": "):i&&(t.text+=`Column ${o}: `),Ke(t,r),t.text+=`
|
|
23
|
-
`);}function Nn(t){if(!t.table)return;let e=t.table.headers.map(Me),n=t.table.rows.map(o=>o.map(Me));if(e.length===0&&n.length===0)return;if(e.length>1&&n.length>0)for(let o of n){if(o.length===0)continue;let i=o[0];if(i?.text){let a=t.text.length;Ke(t,i);let s=t.text.length;s>a&&t.styles.push({start:a,end:s,style:"bold"}),t.text+=`
|
|
24
|
-
`;}for(let a=1;a<o.length;a++)Mt(t,{header:e[a],value:o[a],columnIndex:a,includeColumnFallback:true});t.text+=`
|
|
25
|
-
`;}else for(let o of n){for(let i=0;i<o.length;i++)Mt(t,{header:e[i],value:o[i],columnIndex:i,includeColumnFallback:false});t.text+=`
|
|
26
|
-
`;}}function zn(t){if(!t.table)return;let e=t.table.headers.map(Me),n=t.table.rows.map(c=>c.map(Me)),r=Math.max(e.length,...n.map(c=>c.length));if(r===0)return;let o=Array.from({length:r},()=>0),i=c=>{for(let u=0;u<r;u+=1){let h=c[u]?.text.length??0;(o[u]??0)<h&&(o[u]=h);}};i(e);for(let c of n)i(c);let a=t.text.length,s=c=>{t.text+="|";for(let u=0;u<r;u+=1){t.text+=" ";let d=c[u];d&&$n(t,d);let h=d?.text.length??0,P=(o[u]??0)-h;P>0&&(t.text+=" ".repeat(P)),t.text+=" |";}t.text+=`
|
|
27
|
-
`;},l=()=>{t.text+="|";for(let c=0;c<r;c+=1){let u=o[c]??0,d=Math.max(3,u);t.text+=` ${"-".repeat(d)} |`;}t.text+=`
|
|
28
|
-
`;};s(e),l();for(let c of n)s(c);let f=t.text.length;f>a&&t.styles.push({start:a,end:f,style:"code_block"});}function Ze(t,e){for(let n of t)switch(n.type){case "inline":n.children&&Ze(n.children,e);break;case "text":Te(e,n.content??"");break;case "em_open":te(e,"italic");break;case "em_close":ne(e,"italic");break;case "strong_open":te(e,"bold");break;case "strong_close":ne(e,"bold");break;case "s_open":te(e,"strikethrough");break;case "s_close":ne(e,"strikethrough");break;case "code_inline":_n(e,n.content??"");break;case "spoiler_open":e.enableSpoilers&&te(e,"spoiler");break;case "spoiler_close":e.enableSpoilers&&ne(e,"spoiler");break;case "link_open":{let r=St(n,"href")??"",o=Z(e);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":An(e);break;case "image":Te(e,n.content??"");break;case "softbreak":case "hardbreak":Te(e,`
|
|
29
|
-
`);break;case "paragraph_close":Tt(e);break;case "heading_open":e.headingStyle==="bold"&&te(e,"bold");break;case "heading_close":e.headingStyle==="bold"&&ne(e,"bold"),Tt(e);break;case "blockquote_open":e.blockquotePrefix&&(e.text+=e.blockquotePrefix),te(e,"blockquote");break;case "blockquote_close":ne(e,"blockquote");break;case "bullet_list_open":e.env.listStack.length>0&&(e.text+=`
|
|
30
|
-
`),e.env.listStack.push({type:"bullet",index:0});break;case "bullet_list_close":e.env.listStack.pop(),e.env.listStack.length===0&&(e.text+=`
|
|
31
|
-
`);break;case "ordered_list_open":{e.env.listStack.length>0&&(e.text+=`
|
|
32
|
-
`);let r=Number(St(n,"start")??"1");e.env.listStack.push({type:"ordered",index:r-1});break}case "ordered_list_close":e.env.listStack.pop(),e.env.listStack.length===0&&(e.text+=`
|
|
33
|
-
`);break;case "list_item_open":En(e);break;case "list_item_close":e.text.endsWith(`
|
|
34
|
-
`)||(e.text+=`
|
|
35
|
-
`);break;case "code_block":case "fence":Cn(e,n.content??"");break;case "html_block":case "html_inline":Te(e,n.content??"");break;case "table_open":e.tableMode!=="off"&&(e.table=Ln(),e.hasTables=true);break;case "table_close":e.table&&(e.tableMode==="bullets"?Nn(e):e.tableMode==="code"&&zn(e)),e.table=null;break;case "thead_open":e.table&&(e.table.inHeader=true);break;case "thead_close":e.table&&(e.table.inHeader=false);break;case "tbody_open":case "tbody_close":break;case "tr_open":e.table&&(e.table.currentRow=[]);break;case "tr_close":e.table&&(e.table.inHeader?e.table.headers=e.table.currentRow:e.table.rows.push(e.table.currentRow),e.table.currentRow=[]);break;case "th_open":case "td_open":e.table&&(e.table.currentCell=Fn());break;case "th_close":case "td_close":e.table?.currentCell&&(e.table.currentRow.push(Dn(e.table.currentCell)),e.table.currentCell=null);break;case "hr":e.text+=`\u2500\u2500\u2500
|
|
36
|
-
|
|
37
|
-
`;break;default:n.children&&Ze(n.children,e);break}}function Rt(t){for(let e=t.openStyles.length-1;e>=0;e-=1){let n=t.openStyles[e];if(!n)continue;let r=t.text.length;r>n.start&&t.styles.push({start:n.start,end:r,style:n.style});}t.openStyles=[];}function Bn(t,e){let n=[];for(let r of t){let o=Math.max(0,Math.min(r.start,e)),i=Math.max(o,Math.min(r.end,e));i>o&&n.push({start:o,end:i,style:r.style});}return n}function jn(t,e){let n=[];for(let r of t){let o=Math.max(0,Math.min(r.start,e)),i=Math.max(o,Math.min(r.end,e));i>o&&n.push({start:o,end:i,href:r.href});}return n}function It(t){let e=[...t].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 e){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 Pt(t,e,n){let r=Math.max(t.start,e),o=Math.min(t.end,n);return o<=r?null:{start:r,end:o}}function Wn(t,e,n){if(t.length===0)return [];let r=[];for(let o of t){let i=Pt(o,e,n);i&&r.push({start:i.start-e,end:i.end-e,style:o.style});}return It(r)}function Hn(t,e,n){if(t.length===0)return [];let r=[];for(let o of t){let i=Pt(o,e,n);i&&r.push({start:i.start-e,end:i.end-e,href:o.href});}return r}function re(t,e){try{let n=typeof t=="string"?t:"",r=we.parse(e??{});return fe(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function fe(t,e){try{let n=typeof t=="string"?t:"",r=we.parse(e),o={listStack:[]},a=Pn(r).parse(n||"",o);r.enableSpoilers&&vn(a);let s=r.tableMode??"off",l={text:"",styles:[],openStyles:[],links:[],linkStack:[],env:o,headingStyle:r.headingStyle??"none",blockquotePrefix:r.blockquotePrefix??"",enableSpoilers:r.enableSpoilers??!1,tableMode:s,table:null,hasTables:!1};Ze(a,l),Rt(l);let c=l.text.trimEnd().length,u=0;for(let k of l.styles)k.style==="code_block"&&k.end>u&&(u=k.end);let d=Math.max(c,u);return {ir:{text:d===l.text.length?l.text:l.text.slice(0,d),styles:It(Bn(l.styles,d)),links:jn(l.links,d)},hasTables:l.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function vt(t,e){try{let n=ce.parse(t),r=typeof e=="number"&&e>0?e:0;if(!n.text)return [];if(r<=0||n.text.length<=r)return [n];let o=ee(n.text,r),i=[],a=0;return o.forEach((s,l)=>{if(!s)return;if(l>0)for(;a<n.text.length&&/\s/.test(n.text[a]??"");)a+=1;let f=a,c=Math.min(n.text.length,f+s.length);i.push({text:s,styles:Wn(n.styles,f,c),links:Hn(n.links,f,c)}),a=c;}),i}catch(n){return console.error("Chunk IR error:",n),[]}}chunkXBAP2B6J_cjs.e();var Un={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function de(t,e){try{let n=ce.parse(t),r=Ye.parse(e??{});if(!n.text)return "";let o=r.styleMarkers??Un,i=r.escapeText??(u=>u),a=r.buildLink,s=[];for(let u=0;u<n.styles.length;u++){let d=n.styles[u];d&&(s.push({position:d.start,type:"open",style:d.style,spanIndex:u}),s.push({position:d.end,type:"close",style:d.style,spanIndex:u}));}for(let u=0;u<n.links.length;u++){let d=n.links[u];d&&(s.push({position:d.start,type:"link_open",spanIndex:u,href:d.href}),s.push({position:d.end,type:"link_close",spanIndex:u,href:d.href}));}s.sort((u,d)=>{if(u.position!==d.position)return u.position-d.position;let h=(M,O)=>M==="link_open"?0:M==="open"?1:M==="close"?2:M==="link_close"?3:4,k=u.type==="close"||u.type==="link_close",P=d.type==="close"||d.type==="link_close",p=h(u.type,k),g=h(d.type,P);return p!==g?p-g:u.type==="open"&&d.type==="open"?u.spanIndex-d.spanIndex:u.type==="close"&&d.type==="close"?d.spanIndex-u.spanIndex:u.spanIndex-d.spanIndex});let l="",f=0,c=[];for(let u of s){if(u.position>f){let d=n.text.slice(f,u.position);l+=i?i(d):d;}if(u.type==="open"||u.type==="close"){let d=o[u.style];if(d)if(u.type==="open")l+=d.open,c.push(u);else {l+=d.close,u.style==="code_block"&&u.position<n.text.length&&(l+=`
|
|
38
|
-
`);let h=c.findIndex(k=>k.spanIndex===u.spanIndex&&k.type==="open");h!==-1&&c.splice(h,1);}}else if(u.type==="link_open")l+="[",c.push(u);else if(u.type==="link_close"){l+="]("+u.href+")";let d=c.findIndex(h=>h.spanIndex===u.spanIndex&&h.type==="link_open");d!==-1&&c.splice(d,1);}f=u.position;}if(f<n.text.length){let u=n.text.slice(f);l+=i?i(u):u;}return l}catch(n){return console.error("Markdown render error:",n),""}}function oe(t,e){return de(t,e)}chunkXBAP2B6J_cjs.e();function qn(t){let e=t.replace(/\r\n/g,`
|
|
39
|
-
`).replace(/\r/g,`
|
|
40
|
-
`);if(!e.startsWith("---"))return {frontmatter:"",content:t};let n=e.indexOf(`
|
|
41
|
-
---`,3);if(n===-1)return {frontmatter:"",content:t};let r=e.slice(0,n+4),o=e.slice(n+4).trimStart();return {frontmatter:r,content:o}}function Re(t,e){try{let n=typeof t=="string"?t:"",r=Xe.parse(e??{});if(!n)return "";let{frontmatter:o,content:i}=qn(n),a=re(i,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),s=oe(a);return s=s.replace(/\n{3,}/g,`
|
|
42
|
-
|
|
43
|
-
`),s=s.trimEnd()+`
|
|
44
|
-
`,r.preserveFrontmatter&&o&&(s=o+`
|
|
45
|
-
`+s),s}catch(n){return console.error("Markdown format error:",n),t}}chunkXBAP2B6J_cjs.e();function Gn(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function Yn(t){if(t!=null){if(typeof t=="string")return {value:t.trim(),kind:"scalar"};if(typeof t=="number"||typeof t=="boolean")return {value:String(t),kind:"scalar"};if(typeof t=="object")try{return {value:JSON.stringify(t),kind:"structured"}}catch{return}}}function Xn(t){try{let e=Ot__default.default.parse(t,{schema:"core"});if(!e||typeof e!="object"||Array.isArray(e))return null;let n={};for(let[r,o]of Object.entries(e)){let i=r.trim();if(!i)continue;let a=Yn(o);a&&(n[i]=a);}return n}catch{return null}}function Vn(t,e){let n=[],r=e+1;for(;r<t.length;){let i=t[r];if(!i){r+=1;continue}if(i.length>0&&!i.startsWith(" ")&&!i.startsWith(" "))break;n.push(i),r+=1;}return {value:n.join(`
|
|
46
|
-
`).trim(),linesConsumed:r-e}}function Jn(t){let e={},n=t.split(`
|
|
47
|
-
`),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let i=o.match(/^([\w-]+):\s*(.*)$/);if(!i?.[1]||!i[2]){r+=1;continue}let a=i[1],s=i[2].trim();if(!a){r+=1;continue}if(!s&&r+1<n.length){let f=n[r+1];if(f&&(f.startsWith(" ")||f.startsWith(" "))){let{value:c,linesConsumed:u}=Vn(n,r);c&&(e[a]={value:c,kind:"multiline",rawInline:s}),r+=u;continue}}let l=Gn(s);l&&(e[a]={value:l,kind:"inline",rawInline:s}),r+=1;}return e}function Kn(t){let e={};for(let[n,r]of Object.entries(t))e[n]=r.value;return e}function Zn(t){return /^[|>][+-]?(\d+)?[+-]?$/.test(t)}function Qn(t){let{lineEntry:e,yamlValue:n}=t;return n.kind!=="structured"||e.kind!=="inline"||Zn(e.rawInline)?false:e.value.includes(":")}function er(t){let e=t.replace(/\r\n/g,`
|
|
48
|
-
`).replace(/\r/g,`
|
|
49
|
-
`);if(!e.startsWith("---"))return;let n=e.indexOf(`
|
|
50
|
-
---`,3);if(n!==-1)return e.slice(4,n)}function pe(t){try{if(typeof t!="string")return {};let e=er(t);if(!e)return {};let n=Jn(e),r=Xn(e);if(r===null)return Kn(n);let o={};for(let[i,a]of Object.entries(r)){o[i]=a.value;let s=n[i];s&&Qn({lineEntry:s,yamlValue:a})&&(o[i]=s.value);}for(let[i,a]of Object.entries(n))i in o||(o[i]=a.value);return o}catch(e){return console.warn("Failed to parse frontmatter:",e),{}}}function Ie(t){try{let e=Ve.parse(t);if(Object.keys(e).length===0)return "";let n={};for(let[o,i]of Object.entries(e))try{let a=JSON.parse(i);n[o]=a;}catch{n[o]=i;}return `---
|
|
51
|
-
${Ot__default.default.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
|
|
52
|
-
---`}catch(e){return console.warn("Failed to serialize frontmatter:",e),""}}function Pe(t){try{if(typeof t!="string")return {frontmatter:{},content:""};let e=t.replace(/\r\n/g,`
|
|
53
|
-
`).replace(/\r/g,`
|
|
54
|
-
`);if(!e.startsWith("---"))return {frontmatter:{},content:t};let n=e.indexOf(`
|
|
55
|
-
---`,3);if(n===-1)return {frontmatter:{},content:t};let r=e.slice(4,n),o=e.slice(n+4).trimStart();return {frontmatter:pe(t),content:o}}catch(e){return console.warn("Failed to extract frontmatter:",e),{frontmatter:{},content:t}}}chunkXBAP2B6J_cjs.e();chunkXBAP2B6J_cjs.e();function ve(t){try{let e=xe.z.string().parse(t),n=[],r,o=0;for(;o<=e.length;){let i=e.indexOf(`
|
|
56
|
-
`,o),a=i===-1?e.length:i,s=e.slice(o,a),l=s.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(l){let f=l[1],c=l[2];if(!f||!c){o=a+1;continue}let u=c[0];if(!u){o=a+1;continue}let d=c.length;if(!r)r={start:o,markerChar:u,markerLen:d,openLine:s,marker:c,indent:f};else if(r.markerChar===u&&d>=r.markerLen){let h=a;n.push({start:r.start,end:h,openLine:r.openLine,marker:r.marker,indent:r.indent}),r=void 0;}}if(i===-1)break;o=i+1;}return r&&n.push({start:r.start,end:e.length,openLine:r.openLine,marker:r.marker,indent:r.indent}),n}catch(e){return console.warn("Invalid input for parseFenceSpans:",e),[]}}function Qe(t,e){let n=0,r=t.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=t[o];if(!i)break;if(e<=i.start){r=o-1;continue}if(e>=i.end){n=o+1;continue}return i}}function Ft(t,e){return !Qe(t,e)}function Oe(){return {open:false,ticks:0}}function Fe(t,e){try{let n=xe.z.string().parse(t),r=e?Se.parse(e):Oe(),o=ve(n),i={open:r.open,ticks:r.ticks},{spans:a,state:s}=rr(n,o,i);return {inlineState:s,isInside:l=>sr(l,o)||ir(l,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Oe(),isInside:()=>false}}}function rr(t,e,n){let r=[],o=n.open,i=n.ticks,a=o?0:-1,s=0;for(;s<t.length;){let l=or(e,s);if(l){s=l.end;continue}if(t[s]!=="`"){s+=1;continue}let f=s,c=0;for(;s<t.length&&t[s]==="`";)c+=1,s+=1;if(!o){o=true,i=c,a=f;continue}c===i&&(r.push([a,s]),o=false,i=0,a=-1);}return o&&r.push([a,t.length]),{spans:r,state:{open:o,ticks:i}}}function or(t,e){return t.find(n=>e>=n.start&&e<n.end)}function sr(t,e){return e.some(n=>t>=n.start&&t<n.end)}function ir(t,e){return e.some(([n,r])=>t>=n&&t<r)}chunkXBAP2B6J_cjs.e();var lr={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Ee(t,e){try{let n=xe.z.string().parse(t),r=ue.parse(e);if(!n||r==="off")return n;let{ir:o,hasTables:i}=fe(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return i?de(o,{styleMarkers:lr,escapeText:a=>a,buildLink:(a,s)=>{let l=a.href.trim();return !l||!s.slice(a.start,a.end)?null:{start:a.start,end:a.end,open:"[",close:`](${l})`}}}):n}catch(n){return console.warn("Invalid input for convertMarkdownTables:",n),typeof t=="string"?t:""}}exports.Markdown=void 0;(f=>{function t(c,u){try{return re(c,u)}catch(d){return console.warn("Markdown.parse error:",d),{text:"",styles:[],links:[]}}}f.parse=t;function e(c,u){try{return oe(c,u)}catch(d){return console.warn("Markdown.render error:",d),""}}f.render=e;function n(c,u){try{return Re(c,u)}catch(d){return console.warn("Markdown.format error:",d),typeof c=="string"?c:""}}f.format=n;function r(c){try{return pe(c)}catch(u){return console.warn("Markdown.parseFrontmatter error:",u),{}}}f.parseFrontmatter=r;function o(c){try{return Ie(c)}catch(u){return console.warn("Markdown.serializeFrontmatter error:",u),""}}f.serializeFrontmatter=o;function i(c){try{return Pe(c)}catch(u){return console.warn("Markdown.extractFrontmatter error:",u),{frontmatter:{},content:typeof c=="string"?c:""}}}f.extractFrontmatter=i;function a(c,u,d){try{return ee(c,u,d)}catch(h){return console.warn("Markdown.chunk error:",h),typeof c=="string"&&c.length>0?[c]:[]}}f.chunk=a;function s(c,u){try{return Fe(c,u)}catch(d){return console.warn("Markdown.buildCodeIndex error:",d),{inlineState:{open:false,ticks:0},isInside:()=>false}}}f.buildCodeIndex=s;function l(c,u){try{return Ee(c,u)}catch(d){return console.warn("Markdown.convertTables error:",d),typeof c=="string"?c:""}}f.convertTables=l;})(exports.Markdown||(exports.Markdown={}));chunkXBAP2B6J_cjs.e();function Et(t){if(!t)return "";let n=t.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function cr(t){if(!t)return "";let n=t.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function ur(t){if(!t)return "";let e=t.split(".");return e[e.length-1]}function fr(t,e=20){let n=Et(t);if(n.length<=e)return n;let r=n.lastIndexOf("."),o=r<=0?"":n.slice(r),i=e-o.length-1;return i<=0?n.slice(0,e-1)+"\u2026":n.slice(0,i)+"\u2026"+o}function dr(t,e=20){if(t.length<=e)return t;let n=e-1,r=Math.ceil(n/2),o=Math.floor(n/2);return t.slice(0,r)+"\u2026"+t.slice(-o)}chunkXBAP2B6J_cjs.e();var pr=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function mr(t){if(!t)return false;let e=String(t instanceof Error?t.message:t).toLowerCase();return pr.some(n=>e.includes(n))}async function tt(t,e={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:i=1e4,retryIf:a=mr}=e,s;for(let l=0;l<n;l++)try{return await t()}catch(f){if(s=f,l===n-1||!a(f))throw f;let c=Math.min(r*o**l,i);await new Promise(u=>setTimeout(u,c));}throw s}chunkXBAP2B6J_cjs.e();exports.Fetch=void 0;(S=>{let t=chunkAUS6KQNI_cjs.m.create({service:"fetch"}),e=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],n=false,r=null;function o(){return e.some(x=>{let y=process.env[x];return typeof y=="string"&&y.trim().length>0})}S.hasProxyConfigured=o;function i(){let x=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||x}S.getProxyUrl=i;function a(x={}){let y=x.httpProxy||x.httpsProxy||i();if(!y){t.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let R=new undici.ProxyAgent({uri:y,connectTimeout:x.connectTimeout||1e4,keepAliveTimeout:x.keepAliveTimeout||3e4});r=undici.getGlobalDispatcher(),undici.setGlobalDispatcher(R),n=true,t.info(`[Fetch] Global proxy enabled: ${y}`);}S.enableProxy=a;function s(){!n||!r||(undici.setGlobalDispatcher(r),n=false,r=null,t.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}S.disableProxy=s;function l(){return n}S.isProxyEnabled=l;async function f(x,y){let R=y?.timeout||3e4,L=y?.responseType||"json",{timeout:_,responseType:H,...$}=y||{},T=null,v=null;try{$.signal||(T=new AbortController,v=setTimeout(()=>T.abort(),R));let I=await fetch(x,{...$,signal:$.signal||T.signal});v&&clearTimeout(v);let D;switch(L){case "arrayBuffer":D=await I.arrayBuffer();break;case "blob":D=await I.blob();break;case "buffer":{let Y=await I.arrayBuffer();D=Buffer.from(Y);break}case "text":D=await I.text();break;default:{let Y=await I.text();try{D=JSON.parse(Y);}catch{D=Y;}break}}return {ok:I.ok,status:I.status,statusText:I.statusText,headers:I.headers,data:D,url:I.url}}catch(I){throw v&&clearTimeout(v),I}}async function c(x,y){let R=y?.retries??0,L=y?.retryDelay??1e3,{retries:_,retryDelay:H,responseType:$,...T}=y||{};return tt(()=>f(x,{...T,responseType:y?.responseType}),{attempts:R+1,delay:L,maxDelay:L*2**(R+1)})}async function u(x,y){return c(x,{method:"GET",...y})}S.get=u;async function d(x,y,R){return c(x,{method:"POST",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}S.post=d;async function h(x,y,R){return c(x,{method:"PUT",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}S.put=h;async function k(x,y,R){return c(x,{method:"DELETE",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}S.del=k;async function P(x,y,R){return c(x,{method:"PATCH",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}S.patch=P;async function p(x,y){return c(x,y)}S.request=p;function g(x={}){return o()?(a(x),true):false}S.autoProxy=g;let M=5*1024*1024;function O(x){return new TextEncoder().encode(x)}function N(x){return chunkEN7LFV4R_cjs.d.mimeType(x)}function A(x){return x.startsWith("file://")}async function F(x){let y=url.fileURLToPath(x);return await chunk3U5YF6EI_cjs.D.file(y).bytes()}async function C(x,y,R){let L=`----FetchFormBoundary${Date.now()}`,_=[],$=y.some(E=>E.filename||E.value instanceof Uint8Array||Buffer.isBuffer(E.value))&&!R?.timeout?3e5:R?.timeout;for(let E of y){let U=E.maxSize??M,q=E.filename,Q=`Content-Disposition: form-data; name="${E.name}"${q?`; filename="${q}"`:""}`;q&&(Q+=`\r
|
|
57
|
-
Content-Type: ${N(q)}`),Q+=`\r
|
|
15
|
+
How to override: export them in the shell before loadEnv() runs, or set process.env directly.`);}}}chunkXBAP2B6J_cjs.e();async function Tt(t,e){if(process.env.EASBOT_CLIENT==="acp")try{let l=process.platform==="win32"?"cmd":void 0,y=chunkGJWUV3QH_cjs.G.spawn(l,`git ${t.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:e.cwd,env:e.env?{...process.env,...e.env}:process.env}),[o,u,b]=await Promise.all([y.exited,new Response(y.stdout).arrayBuffer(),new Response(y.stderr).arrayBuffer()]),w=Buffer.from(u),S=Buffer.from(b);return {exitCode:o,text:()=>w.toString(),stdout:w,stderr:S}}catch(l){let y=Buffer.from(l instanceof Error?l.message:String(l));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:y}}let r=e.env?{...process.env,...e.env}:void 0,n=chunkGJWUV3QH_cjs.G.$`git ${t.join(" ")}`.quiet().nothrow().cwd(e.cwd);r&&(n=n.env(r));let s=await n;return {exitCode:s.exitCode,text:()=>s.text(),stdout:s.stdout,stderr:s.stderr}}chunkXBAP2B6J_cjs.e();function je(t){return t?Ee.dirname(url.fileURLToPath(t)):typeof __dirname<"u"?__dirname:process.cwd()}function Me(t,e,r=3){function n(s,l){if(l>r||!fs.existsSync(s))return null;try{let y=fs.readdirSync(s);for(let o of y){let u=Ee.join(s,o);try{let b=fs.statSync(u);if(b.isFile()&&u.endsWith(e))return u;if(b.isDirectory()&&l<r){let w=n(u,l+1);if(w)return w}}catch{}}}catch{}return null}return n(t,0)}function He(t,e){let r=Ee.join(t,e);if(fs.existsSync(r))return r;let n=e.split("/").pop()||e,s=t;for(let l=0;l<5;l++){let y=Ee.join(s,"assets","txt");if(fs.existsSync(y)){let b=Me(y,n,5);if(b)return b}let o=Ee.join(s,"dist","assets","txt");if(fs.existsSync(o)){let b=Me(o,n,5);if(b)return b}let u=Ee.join(s,"..");if(u===s)break;s=u;}return r}function At(t,e){return chunkGJWUV3QH_cjs.c.lazy(()=>{try{let r=je(e),n=He(r,t);return chunkGJWUV3QH_cjs.D.file(n).textSync()}catch(r){throw console.error(`Failed to load text file: ${t}`,r),r}})}function kt(t,e){return chunkGJWUV3QH_cjs.c.lazy(async()=>{try{let r=je(e),n=He(r,t);return await chunkGJWUV3QH_cjs.D.file(n).text()}catch(r){throw console.error(`Failed to load text file: ${t}`,r),r}})}chunkXBAP2B6J_cjs.e();function Ot(t){return t()}chunkXBAP2B6J_cjs.e();function vt(t){if(!t||typeof t!="string")return {provider:"",model:""};let e=t.indexOf("/");return e===-1?{provider:"",model:t}:{provider:t.substring(0,e),model:t.substring(e+1)}}chunkXBAP2B6J_cjs.e();exports.Markdown=void 0;(_=>{_.FILE_REGEX=/(?<![\w`])#(\S+)/g,_.SHELL_REGEX=/!`([^`]+)`/g;function r(a){return Array.from(a.matchAll(_.FILE_REGEX))}_.files=r;function n(a){return Array.from(a.matchAll(_.SHELL_REGEX))}_.shell=n;function s(a){if(!a||typeof a!="string")return typeof a=="string"?a:"";let x=a.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!x)return a;let f=x[0],c=(x[1]??"").split(`
|
|
16
|
+
`),p=[];for(let P of c){if(P.trim().startsWith("#")||P.trim()===""){p.push(P);continue}if(P.match(/^\s+/)){p.push(P);continue}let $=P.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*(.*)$/);if(!$){p.push(P);continue}let I=$[1],E=$?.[2]?.trim();if(E===""||E===">"||E==="|"||E?.startsWith('"')||E?.startsWith("'")){p.push(P);continue}if(E?.includes(":")){p.push(`${I}: |-`),p.push(` ${E}`);continue}p.push(P);}let T=p.join(`
|
|
17
|
+
`);return a.replace(f,`---
|
|
18
|
+
${T}
|
|
19
|
+
---`)}_.fallbackSanitization=s;function l(a){if(typeof a!="string")return null;if(!a)return {data:{},content:""};try{let x=fe__default.default(a);return {data:x.data??{},content:x.content??""}}catch{try{let x=fe__default.default(s(a));return {data:x.data??{},content:x.content??""}}catch{return null}}}async function y(a){let x=await se.readFile(a,"utf-8"),f=l(x);if(!f){let d=`${a}: Failed to parse YAML frontmatter`;throw new _.FrontmatterError({path:a,message:d},{cause:new Error(d)})}return f}_.parse=y;function o(a){if(!a||typeof a!="string")return {frontmatter:{},content:typeof a=="string"?a:""};let x=l(a);return x?{frontmatter:x.data,content:x.content}:{frontmatter:{},content:a}}_.extractFrontmatter=o;function u(a,x){let f=a??"";return !x||Object.keys(x).length===0?fe__default.default.stringify(f,void 0):fe__default.default.stringify(f,x)}_.format=u,_.FrontmatterError=ne.create("ConfigFrontmatterError",le.z.object({path:le.z.string(),message:le.z.string()}));function w(a,x){return S(a,x)}_.replaceVariables=w;function S(a,x){return R(a,x)}_.renderTemplate=S;function R(a,x){let f=a;return f=g(f,x),f=i(f,x),f=L(f,x),f=v(f,x),f=f.replace(/\{\{([^}]*)\}\}/g,(d,c)=>{let p=c.trim();if(!p)return "";let T=de(p,x);return T!==void 0?String(M(T)):""}),f}function g(a,x){let f=a.replace(/\{\{#if\s+\((eq|ne|gt|lt|gte|lte)\s+([^)]+)\)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p,T,P)=>{if(!c||!p||!T||!P)return d;let{a:$,b:I}=A(p,x);return $===void 0||I===void 0?d:D(c,$,I)?T:P});return f=f.replace(/\{\{#if\s+\((eq|ne|gt|lt|gte|lte)\s+([^)]+)\)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p,T)=>{if(!c||!p||!T)return d;let{a:P,b:$}=A(p,x);return P===void 0||$===void 0?d:D(c,P,$)?T:""}),f}function A(a,x){let f=/"([^"]*)"|(\w+(?:\.\w+|\[\d+\])*)/g,d=[],c;for(;(c=f.exec(a))!==null;)c[1]!==void 0?d.push(c[1]):c[2]!==void 0&&d.push(c[2]);if(d.length<2)return {a:void 0,b:void 0};let p=de(d[0],x),T=de(d[1],x);return {a:p,b:T}}function D(a,x,f){switch(a){case "eq":return x===f;case "ne":return x!==f;case "gt":return Number(x)>Number(f);case "lt":return Number(x)<Number(f);case "gte":return Number(x)>=Number(f);case "lte":return Number(x)<=Number(f);default:return false}}function i(a,x){let f=a.replace(/\{\{#unless\s+(\w+)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/unless\}\}/g,(d,c,p,T)=>{if(!c||!p||!T)return d;let P=x[c];return h(P)?p:T});return f=f.replace(/\{\{#unless\s+(\w+)\}\}([\s\S]*?)\{\{\/unless\}\}/g,(d,c,p)=>{if(!c||!p)return d;let T=x[c];return h(T)?p:""}),f}function h(a){return a==null||a===false||a===""}function v(a,x){let f=a.replace(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p,T)=>{if(!c||!p||!T)return d;let P=c in x?x[c]:void 0;return h(P)?T:p});return f=f.replace(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p)=>{if(!c||!p)return d;let T=c in x?x[c]:void 0;return h(T)?"":p}),f}function L(a,x){let f=a.match(/\{\{#each\s+([\w.]+)\}\}/);if(!f?.[1])return a;let d=f[1],c=de(d,x),p=f[0],T=f.index,P=a.slice(T+p.length),$;if(Array.isArray(c))$=c.map((U,H)=>({key:String(H),value:U}));else if(c!==null&&typeof c=="object")$=Object.entries(c).map(([U,H])=>({key:U,value:H}));else return z(a,T,p,P);let I=1,E=-1,N=/\{\{#each\s+[\w.]+\}\}|\{\{\/each\}\}/g,k;for(N.lastIndex=0;(k=N.exec(P))!==null;)if(k[0].startsWith("{{#each"))I++;else if(I--,I===0){E=k.index;break}if(E===-1)return a;let j=P.slice(0,E),Z=a.slice(T,T+p.length+E+"{{/each}}".length);if($.length===0)return a.replace(Z,"");let C=$.map(({key:U,value:H},X)=>{let F={...x};return typeof H=="object"&&H!==null?(Object.assign(F,H),F.this=H,F["@value"]=H,F["@index"]=X,F["@key"]=U):(F.this=H,F["@value"]=H,F["@index"]=X,F["@key"]=U),R(j,F)});return a.replace(Z,C.join(""))}function z(a,x,f,d,c){let p=/\{\{#each\s+[\w.]+\}\}|\{\{\/each\}\}/g,T=1,P=-1,$;for(p.lastIndex=0;($=p.exec(d))!==null;)if($[0].startsWith("{{#each"))T++;else if(T--,T===0){P=$.index;break}if(P===-1)return a;let E=a.slice(x,x+f.length+P+"{{/each}}".length);return a.replace(E,"")}function M(a){return a instanceof Date?chunkPGUMSM7F_cjs.b(a):Array.isArray(a)?a.map(M).join(", "):a!==null&&typeof a=="object"?JSON.stringify(a,null,2):String(a)}_.formatVariableValue=M;})(exports.Markdown||(exports.Markdown={}));function de(t,e){let r=/(@\w+)|(\w+)|\[(\d+)\]/g,n=e,s;for(;(s=r.exec(t))!==null;){if(n==null)return;if(s[1]!==void 0){let l=s[1];n=e[l];}else if(s[2]!==void 0){let l=s[2];if(typeof n=="object"&&n!==null)n=n[l];else return}else if(s[3]!==void 0){let l=Number(s[3]);if(Array.isArray(n)&&l>=0&&l<n.length)n=n[l];else return}}return n}chunkXBAP2B6J_cjs.e();function ze(t){if(!t)return "";let r=t.replace(/[/\\]+$/,"").split(/[/\\]/);return r[r.length-1]??""}function $t(t){if(!t)return "";let r=t.replace(/[/\\]+$/,"").split(/[/\\]/);return r.slice(0,r.length-1).join("/")+"/"}function Dt(t){if(!t)return "";let e=t.split(".");return e[e.length-1]}function It(t,e=20){let r=ze(t);if(r.length<=e)return r;let n=r.lastIndexOf("."),s=n<=0?"":r.slice(n),l=e-s.length-1;return l<=0?r.slice(0,e-1)+"\u2026":r.slice(0,l)+"\u2026"+s}function Nt(t,e=20){if(t.length<=e)return t;let r=e-1,n=Math.ceil(r/2),s=Math.floor(r/2);return t.slice(0,n)+"\u2026"+t.slice(-s)}chunkXBAP2B6J_cjs.e();var Ft=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function Lt(t){if(!t)return false;let e=String(t instanceof Error?t.message:t).toLowerCase();return Ft.some(r=>e.includes(r))}async function Se(t,e={}){let{attempts:r=3,delay:n=500,factor:s=2,maxDelay:l=1e4,retryIf:y=Lt}=e,o;for(let u=0;u<r;u++)try{return await t()}catch(b){if(o=b,u===r-1||!y(b))throw b;let w=Math.min(n*s**u,l);await new Promise(S=>setTimeout(S,w));}throw o}chunkXBAP2B6J_cjs.e();exports.Fetch=void 0;(f=>{let t=chunkPGUMSM7F_cjs.m.create({service:"fetch"}),e=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],r=false,n=null;function s(){return e.some(d=>{let c=process.env[d];return typeof c=="string"&&c.trim().length>0})}f.hasProxyConfigured=s;function l(){let d=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||d}f.getProxyUrl=l;function y(d={}){let c=d.httpProxy||d.httpsProxy||l();if(!c){t.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let p=new undici.ProxyAgent({uri:c,connectTimeout:d.connectTimeout||1e4,keepAliveTimeout:d.keepAliveTimeout||3e4});n=undici.getGlobalDispatcher(),undici.setGlobalDispatcher(p),r=true,t.info(`[Fetch] Global proxy enabled: ${c}`);}f.enableProxy=y;function o(){!r||!n||(undici.setGlobalDispatcher(n),r=false,n=null,t.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}f.disableProxy=o;function u(){return r}f.isProxyEnabled=u;async function b(d,c){let p=c?.timeout||3e4,T=c?.responseType||"json",{timeout:P,responseType:$,...I}=c||{},E=null,N=null;try{I.signal||(E=new AbortController,N=setTimeout(()=>E.abort(),p));let k=await fetch(d,{...I,signal:I.signal||E.signal});N&&clearTimeout(N);let j;switch(T){case "arrayBuffer":j=await k.arrayBuffer();break;case "blob":j=await k.blob();break;case "buffer":{let q=await k.arrayBuffer();j=Buffer.from(q);break}case "text":j=await k.text();break;default:{let q=await k.text();try{j=JSON.parse(q);}catch{j=q;}break}}return {ok:k.ok,status:k.status,statusText:k.statusText,headers:k.headers,data:j,url:k.url}}catch(k){throw N&&clearTimeout(N),k}}async function w(d,c){let p=c?.retries??0,T=c?.retryDelay??1e3,{retries:P,retryDelay:$,responseType:I,...E}=c||{};return Se(()=>b(d,{...E,responseType:c?.responseType}),{attempts:p+1,delay:T,maxDelay:T*2**(p+1)})}async function S(d,c){return w(d,{method:"GET",...c})}f.get=S;async function R(d,c,p){return w(d,{method:"POST",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.post=R;async function g(d,c,p){return w(d,{method:"PUT",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.put=g;async function A(d,c,p){return w(d,{method:"DELETE",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.del=A;async function D(d,c,p){return w(d,{method:"PATCH",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.patch=D;async function i(d,c){return w(d,c)}f.request=i;function h(d={}){return s()?(y(d),true):false}f.autoProxy=h;let v=5*1024*1024;function L(d){return new TextEncoder().encode(d)}function z(d){return chunkHJFBORDG_cjs.d.mimeType(d)}function M(d){return d.startsWith("file://")}async function _(d){let c=url.fileURLToPath(d);return await chunkGJWUV3QH_cjs.D.file(c).bytes()}async function a(d,c,p){let T=`----FetchFormBoundary${Date.now()}`,P=[],I=c.some(C=>C.filename||C.value instanceof Uint8Array||Buffer.isBuffer(C.value))&&!p?.timeout?3e5:p?.timeout;for(let C of c){let U=C.maxSize??v,H=C.filename,X=`Content-Disposition: form-data; name="${C.name}"${H?`; filename="${H}"`:""}`;H&&(X+=`\r
|
|
20
|
+
Content-Type: ${z(H)}`),X+=`\r
|
|
58
21
|
\r
|
|
59
|
-
`,
|
|
60
|
-
--${
|
|
61
|
-
--${
|
|
62
|
-
`),
|
|
63
|
-
`));for(let
|
|
64
|
-
`)));
|
|
65
|
-
`);
|
|
66
|
-
`)}P.tree=s;async function l(p){let g=await e();return g?f(g,p):(t.debug("ripgrep not available, using pure JS fallback for search()",{cwd:p.cwd,pattern:p.pattern}),c(p))}P.search=l;async function f(p,g){let M=["--json","--glob=!.git/*"];if(g.follow&&M.push("--follow"),g.glob)for(let C of g.glob)M.push(`--glob=${C}`);g.limit&&M.push(`--max-count=${g.limit}`),M.push("--"),M.push(g.pattern);let O=await chunk3U5YF6EI_cjs.D.run([p,...M],{cwd:g.cwd});if(O.code!==0)return [];let N=g.hidden!==false,A=O.stdout.split(/\r?\n/).filter(Boolean),F=[];for(let C of A)try{let B=JSON.parse(C);if(B?.type!=="match")continue;let S=B.data;if(!S?.path?.text||!S?.lines?.text)continue;let x=chunkEN7LFV4R_cjs.d.toUnixPath(S.path.text);if(!N&&x.split("/").some(y=>y.startsWith(".")))continue;if(F.push({path:x,lines:S.lines.text,line_number:S.line_number,absolute_offset:S.absolute_offset??0}),g.limit&&F.length>=g.limit)break}catch{}return F}async function c(p){let g;try{g=new RegExp(p.pattern);}catch{return []}try{if(!(await me__default.default.stat(p.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${p.cwd}'`),{code:"ENOTDIR",errno:-20,path:p.cwd})}catch(S){throw S.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${p.cwd}'`),{code:"ENOENT",errno:-2,path:p.cwd}):S}let M=[],O=[];if(p.glob)for(let S of p.glob)S.startsWith("!")?O.push(S.slice(1)):M.push(S);let N=p.hidden!==false,A=[],F=M.length>0?M:["**/*"],C=new Set,B=[];for(let S of F){p.signal?.throwIfAborted();let x=await chunkEN7LFV4R_cjs.b.scan(S,{cwd:p.cwd,absolute:false,include:"file",dot:N,symlink:p.follow??false,maxDepth:void 0,ignore:O});for(let y of x)C.has(y)||(C.add(y),B.push(y));}for(let S of B){if(p.signal?.throwIfAborted(),p.limit&&A.length>=p.limit)break;let x=chunkEN7LFV4R_cjs.d.join(p.cwd,S),y;try{y=await me__default.default.readFile(x,"utf-8");}catch{continue}let R=y.split(/\r?\n/),L=0;for(let _=0;_<R.length;_++){let H=R[_]??"";if(g.test(H)&&(A.push({path:S,lines:H,line_number:_+1,absolute_offset:L}),p.limit&&A.length>=p.limit))break;L+=Buffer.byteLength(H,"utf-8")+1;}}return A}function u(p,g){return chunkEN7LFV4R_cjs.a.match(p,g)}P.match=u;let d=chunk3U5YF6EI_cjs.a(async()=>await e());async function h(){return await d()}P.filepathCached=h,P._ready=chunk3U5YF6EI_cjs.a(async()=>{let p=await e();return t.debug("Grep initialized",{ripgrep:p?"available":"fallback (pure JS)"}),p});})(exports.Grep||(exports.Grep={}));chunkXBAP2B6J_cjs.e();exports.Keybind=void 0;(a=>{function t(s,l){if(s===l)return true;if(typeof s!="object"||typeof l!="object"||s===null||l===null)return false;let f=Object.keys(s),c=Object.keys(l);if(f.length!==c.length)return false;for(let u of f)if(!c.includes(u)||!t(s[u],l[u]))return false;return true}function e(s){return {...s,super:s.super??false}}function n(s,l){return s?t(e(s),e(l)):false}a.match=n;function r(s,l=false){return {name:s.name,ctrl:s.ctrl,meta:s.meta,shift:s.shift,super:s.super??false,leader:l}}a.fromParsedKey=r;function o(s){if(!s)return "";let l=[];s.ctrl&&l.push("ctrl"),s.meta&&l.push("alt"),s.super&&l.push("super"),s.shift&&l.push("shift"),s.name&&(s.name==="delete"?l.push("del"):l.push(s.name));let f=l.join("+");return s.leader&&(f=f?`<leader> ${f}`:"<leader>"),f}a.keyToString=o;function i(s){return s==="none"?[]:s.split(",").map(l=>{let c=l.replace(/<leader>/g,"leader+").toLowerCase().split("+"),u={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let d of c)switch(d){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=d;break}return u})}a.parse=i;})(exports.Keybind||(exports.Keybind={}));chunkXBAP2B6J_cjs.e();exports.Locale=void 0;(d=>{d.SUPPORTED_LANGS=["zh-CN","en-US"],d.DEFAULT_LANG="zh-CN";function n(h,k="EASBOT_LANG"){let P=[h,process.env[k]?.trim()];for(let p of P)if(p&&d.SUPPORTED_LANGS.includes(p))return p;return d.DEFAULT_LANG}d.resolveLocaleLang=n;function r(h){return h.replace(/\b\w/g,k=>k.toUpperCase())}d.titlecase=r;function o(h){return new Date(h).toLocaleTimeString(void 0,{timeStyle:"short"})}d.time=o;function i(h){let k=new Date(h),P=o(h),p=k.toLocaleDateString();return `${P} \xB7 ${p}`}d.datetime=i;function a(h){let k=new Date(h),P=new Date;return k.getFullYear()===P.getFullYear()&&k.getMonth()===P.getMonth()&&k.getDate()===P.getDate()?o(h):i(h)}d.todayTimeOrDateTime=a;function s(h){return h>=1e6?(h/1e6).toFixed(1)+"M":h>=1e3?(h/1e3).toFixed(1)+"K":h.toString()}d.number=s;function l(h){if(h<1e3)return `${h}ms`;if(h<6e4)return `${(h/1e3).toFixed(1)}s`;if(h<36e5){let p=Math.floor(h/6e4),g=Math.floor(h%6e4/1e3);return `${p}m ${g}s`}if(h<864e5){let p=Math.floor(h/36e5),g=Math.floor(h%36e5/6e4);return `${p}h ${g}m`}let k=Math.floor(h/36e5);return `${Math.floor(h%36e5/864e5)}d ${k}h`}d.duration=l;function f(h,k){return h.length<=k?h:h.slice(0,k-1)+"\u2026"}d.truncate=f;function c(h,k=35){if(h.length<=k)return h;let P="\u2026",p=Math.ceil((k-P.length)/2),g=Math.floor((k-P.length)/2);return h.slice(0,p)+P+h.slice(-g)}d.truncateMiddle=c;function u(h,k,P){return (h===1?k:P).replace("{}",h.toString())}d.pluralize=u;})(exports.Locale||(exports.Locale={}));var Sr=exports.Locale.resolveLocaleLang,Tr=exports.Locale.SUPPORTED_LANGS,Mr=exports.Locale.DEFAULT_LANG;chunkXBAP2B6J_cjs.e();var Rr=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Ir(){return Rr.some(t=>process.env[t])}function Pr(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function vr(){let t=process.env.HTTP_PROXY||process.env.http_proxy,e=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:t,https:e,enabled:!!(t||e)}}chunkXBAP2B6J_cjs.e();var ut=class{constructor(){chunkXBAP2B6J_cjs.c(this,"queue",[]);chunkXBAP2B6J_cjs.c(this,"resolvers",[]);}push(e){let n=this.resolvers.shift();n?n(e):this.queue.push(e);}async next(){return this.queue.length>0?this.queue.shift():new Promise(e=>this.resolvers.push(e))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Or(t,e,n){let r=[...e];await Promise.all(Array.from({length:t},async()=>{for(;;){let o=r.pop();if(o===void 0)return;await n(o);}}));}chunkXBAP2B6J_cjs.e();function Fr(){let t,e=new Promise(n=>t=n);return {trigger(){return t()},wait(){return e}}}chunkXBAP2B6J_cjs.e();function Er(t,e){let n;return Promise.race([t.then(r=>(clearTimeout(n),r)),new Promise((r,o)=>{n=setTimeout(()=>{o(new Error(`Operation timed out after ${e}ms`));},e);})])}chunkXBAP2B6J_cjs.e();exports.Token=void 0;(a=>{let n=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function r(s){if(!s)return 0;let l=String(s),f=(l.match(n)||[]).length,c=l.length-f,u=Math.round(f/1.5),d=Math.round(c/4);return Math.max(0,u+d)}a.estimate=r;function o(s){if(s==null)return 0;try{let l=typeof s=="string"?s:JSON.stringify(s);return r(l)}catch{return 0}}a.estimateObject=o;function i(s){if(s.total!==void 0&&s.total>0)return s.total;let l=s.input??0,f=s.output??0,c=s.cache?.read??0,u=s.cache?.write??0;return l+f+c+u}a.total=i;})(exports.Token||(exports.Token={}));chunkXBAP2B6J_cjs.e();function Cr(t){let e={},n=t.shape??t.required().shape;for(let[r,o]of Object.entries(n))e[r]=o.nullable().optional();return xe__default.default.object(e)}Object.defineProperty(exports,"Lock",{enumerable:true,get:function(){return chunkPJIZPZPO_cjs.a}});Object.defineProperty(exports,"$",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.H}});Object.defineProperty(exports,"HTTPException",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.j}});Object.defineProperty(exports,"Hono",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.d}});Object.defineProperty(exports,"Lazy",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.c}});Object.defineProperty(exports,"PKG",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.D}});Object.defineProperty(exports,"PkgShell",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.A}});Object.defineProperty(exports,"Shell",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.G}});Object.defineProperty(exports,"compress",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.g}});Object.defineProperty(exports,"cors",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.e}});Object.defineProperty(exports,"createNodeWebSocket",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.s}});Object.defineProperty(exports,"createPkgShell",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.B}});Object.defineProperty(exports,"createRESTServer",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.p}});Object.defineProperty(exports,"createRPCServer",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.n}});Object.defineProperty(exports,"createServer",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.m}});Object.defineProperty(exports,"createStreamingServer",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.r}});Object.defineProperty(exports,"createWebSocketServer",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.q}});Object.defineProperty(exports,"detectPlatform",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.y}});Object.defineProperty(exports,"escapeCommandArg",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.w}});Object.defineProperty(exports,"escapeCommandArgSafe",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.x}});Object.defineProperty(exports,"joinCommandArgs",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.z}});Object.defineProperty(exports,"lazy",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.a}});Object.defineProperty(exports,"lazyAsync",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.b}});Object.defineProperty(exports,"logger",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.f}});Object.defineProperty(exports,"needsShellExecution",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.u}});Object.defineProperty(exports,"parseCommand",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.t}});Object.defineProperty(exports,"parseCommandWithOptions",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.v}});Object.defineProperty(exports,"readableStreamToText",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.E}});Object.defineProperty(exports,"secureHeaders",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.h}});Object.defineProperty(exports,"shell",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.C}});Object.defineProperty(exports,"startServer",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.o}});Object.defineProperty(exports,"timeout",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.i}});Object.defineProperty(exports,"validator",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.k}});Object.defineProperty(exports,"whichSync",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.F}});Object.defineProperty(exports,"zValidator",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.l}});Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkEN7LFV4R_cjs.d}});Object.defineProperty(exports,"Glob",{enumerable:true,get:function(){return chunkEN7LFV4R_cjs.b}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkEN7LFV4R_cjs.c}});Object.defineProperty(exports,"Wildcard",{enumerable:true,get:function(){return chunkEN7LFV4R_cjs.a}});Object.defineProperty(exports,"Log",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.m}});Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.o}});Object.defineProperty(exports,"Semver",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.n}});Object.defineProperty(exports,"addMinutesInTimezone",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.l}});Object.defineProperty(exports,"formatLocalISO",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.a}});Object.defineProperty(exports,"formatLocalISOCompact",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.b}});Object.defineProperty(exports,"formatLogTime",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.f}});Object.defineProperty(exports,"formatLogTimeMs",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.g}});Object.defineProperty(exports,"getTimezoneOffset",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.h}});Object.defineProperty(exports,"getTimezoneParts",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.i}});Object.defineProperty(exports,"isValidTimezone",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.j}});Object.defineProperty(exports,"normalizeTimezone",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.k}});Object.defineProperty(exports,"now",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.c}});Object.defineProperty(exports,"nowLocalISO",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.d}});Object.defineProperty(exports,"parseLocalISO",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.e}});exports.AsyncQueue=ut;exports.DEFAULT_LANG=Mr;exports.NamedError=ze;exports.SUPPORTED_LANGS=Tr;exports.abortAfter=Ct;exports.abortAfterAny=br;exports.buildCodeSpanIndex=Fe;exports.chunkMarkdownIR=vt;exports.chunkText=ee;exports.chunkTextByBreakResolver=qe;exports.convertMarkdownTables=Ee;exports.createInlineCodeState=Oe;exports.defer=kr;exports.extractFrontmatter=Pe;exports.findFenceSpanAt=Qe;exports.findLast=rn;exports.fn=ln;exports.formatDuration=wr;exports.formatMarkdown=Re;exports.getDirectory=cr;exports.getFileExtension=ur;exports.getFilename=Et;exports.getFilenameTruncated=fr;exports.getProxyConfig=vr;exports.getProxyUrl=Pr;exports.git=dn;exports.iife=xn;exports.isSafeFenceBreak=Ft;exports.loadEnv=fn;exports.loadTextFile=yn;exports.loadTextFileAsync=bn;exports.markdownToIR=re;exports.markdownToIRWithMeta=fe;exports.parseFenceSpans=ve;exports.parseFrontmatterBlock=pe;exports.parseModelId=kn;exports.proxied=Ir;exports.renderMarkdown=oe;exports.renderMarkdownWithMarkers=de;exports.resolveLocaleLang=Sr;exports.retry=tt;exports.scanParenAwareBreakpoints=Ue;exports.serializeFrontmatter=Ie;exports.signal=Fr;exports.truncateMiddle=dr;exports.updateSchema=Cr;exports.withTimeout=Er;exports.work=Or;
|
|
22
|
+
`,P.push(L(X));let F=C.value;if(typeof F=="string")if(M(F)){let pe=await _(F);if(H||(H=F.split("/").pop()||"file"),pe.byteLength>U)throw new Error(`File size ${pe.byteLength} exceeds limit ${U} bytes: ${H}`);P.push(pe);}else P.push(L(F));else if(Buffer.isBuffer(F)){if(F.byteLength>U)throw new Error(`Buffer size ${F.byteLength} exceeds limit ${U} bytes: ${C.name}`);P.push(new Uint8Array(F.buffer,F.byteOffset,F.byteLength));}else if(F instanceof Uint8Array){if(F.byteLength>U)throw new Error(`File size ${F.byteLength} exceeds limit ${U} bytes: ${C.name}`);P.push(F);}}let E=L(`\r
|
|
23
|
+
--${T}--`),N=L(`\r
|
|
24
|
+
--${T}\r
|
|
25
|
+
`),k=[];k.push(L(`--${T}\r
|
|
26
|
+
`));for(let C=0;C<P.length;C++)k.push(P[C]),C%2===1&&C<P.length-1&&(k.push(N),k.push(L(`--${T}\r
|
|
27
|
+
`)));k.push(E);let j=k.reduce((C,U)=>C+U.length,0),q=new Uint8Array(j),Z=0;for(let C of k)q.set(C,Z),Z+=C.length;return w(d,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${T}`,...p?.headers},body:q,timeout:I,...p})}f.postForm=a;function x(d,c,p){let T=new AbortController,P=T.signal;return (async()=>{try{let I={Accept:"text/event-stream",...p?.headers||{}},E=await fetch(d,{...p,headers:I,signal:P});if(!E.ok)throw new Error(`SSE connection failed: ${E.status}`);let N=E.body?.getReader();if(!N)throw new Error("SSE stream not available");let k=new TextDecoder("utf-8"),j="";for(;!P.aborted;){let{done:q,value:Z}=await N.read();if(q)break;let C=k.decode(Z,{stream:!0});j+=C;let U=j.split(`
|
|
28
|
+
`);j=U.pop()??"";for(let H of U)if(H.startsWith("data: ")){let X=H.slice(6);if(X==="[DONE]"){c.onComplete?.();return}c.onMessage?.(X);}}c.onComplete?.();}catch(I){I.name!=="AbortError"&&c.onError?.(I);}})(),()=>{T.abort();}}f.sse=x;})(exports.Fetch||(exports.Fetch={}));chunkXBAP2B6J_cjs.e();exports.Slug=void 0;(n=>{let t=["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"],e=["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 r(){return [t[Math.floor(Math.random()*t.length)],e[Math.floor(Math.random()*e.length)]].join("-")}n.create=r;})(exports.Slug||(exports.Slug={}));chunkXBAP2B6J_cjs.e();function Be(t){let e=new AbortController,r=setTimeout(e.abort.bind(e),t);return {controller:e,signal:e.signal,clearTimeout:()=>globalThis.clearTimeout(r)}}function Ht(t,...e){let r=Be(t);return {signal:AbortSignal.any([r.signal,...e]),clearTimeout:r.clearTimeout}}chunkXBAP2B6J_cjs.e();exports.Archive=void 0;(e=>{async function t(r,n){if(process.platform==="win32"){let s=Ee__default.default.resolve(r),l=Ee__default.default.resolve(n),y=`Expand-Archive -Path '${s}' -DestinationPath '${l}' -Force`,o=await chunkGJWUV3QH_cjs.G.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${y}"`);if(o.code!==0)throw new Error(`PowerShell exited with code ${o.code}: ${o.stderr}`)}else {let s=`unzip -o -q ${r} -d ${n}`,l=await chunkGJWUV3QH_cjs.G.run(void 0,s);if(l.code!==0)throw new Error(`unzip exited with code ${l.code}: ${l.stderr}`)}}e.extractZip=t;})(exports.Archive||(exports.Archive={}));chunkXBAP2B6J_cjs.e();exports.Color=void 0;(n=>{function t(s){return s?/^#[0-9a-fA-F]{6}$/.test(s):false}n.isValidHex=t;function e(s){let l=parseInt(s.slice(1,3),16),y=parseInt(s.slice(3,5),16),o=parseInt(s.slice(5,7),16);return {r:l,g:y,b:o}}n.hexToRgb=e;function r(s){if(!t(s))return;let{r:l,g:y,b:o}=e(s);return `\x1B[38;2;${l};${y};${o}m\x1B[1m`}n.hexToAnsiBold=r;})(exports.Color||(exports.Color={}));chunkXBAP2B6J_cjs.e();exports.Context=void 0;(r=>{class t extends Error{constructor(l){super(`No context found for ${l}`);chunkXBAP2B6J_cjs.c(this,"name",l);}}r.NotFound=t;function e(n){let s=new async_hooks.AsyncLocalStorage;return {use(){let l=s.getStore();if(!l)throw new t(n);return l},provide(l,y){return s.run(l,y)}}}r.create=e;})(exports.Context||(exports.Context={}));chunkXBAP2B6J_cjs.e();function Ut(t){return {[Symbol.dispose](){t();},[Symbol.asyncDispose](){return Promise.resolve(t())}}}chunkXBAP2B6J_cjs.e();exports.EventLoop=void 0;(e=>{async function t(){return new Promise(r=>{let n=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?r():setImmediate(n);};n();})}e.wait=t;})(exports.EventLoop||(exports.EventLoop={}));chunkXBAP2B6J_cjs.e();function Bt(t){if(t<=0)return "";if(t<60)return `${t}s`;if(t<3600){let r=Math.floor(t/60),n=t%60;return n>0?`${r}m ${n}s`:`${r}m`}if(t<86400){let r=Math.floor(t/3600),n=Math.floor(t%3600/60);return n>0?`${r}h ${n}m`:`${r}h`}if(t<604800){let r=Math.floor(t/86400);return r===1?"~1 day":`~${r} days`}let e=Math.floor(t/604800);return e===1?"~1 week":`~${e} weeks`}chunkXBAP2B6J_cjs.e();exports.Grep=void 0;(D=>{let t=chunkPGUMSM7F_cjs.m.create({service:"grep"});async function e(){return r()}D.filepath=e;let r=chunkGJWUV3QH_cjs.b(async()=>{let i=await chunkGJWUV3QH_cjs.D.which("rg");if(!i)return null;try{if(!(await se__default.default.stat(i)).isFile())return null}catch{return null}try{let h=await chunkGJWUV3QH_cjs.D.run([i,"--version"],{timeout:5e3});if(h.code!==0||!h.stdout.startsWith("ripgrep "))return t.warn("rg failed self-test, falling back to pure JS",{filepath:i,code:h.code,stderr:h.stderr.slice(0,200)}),null}catch(h){return t.warn("rg spawn failed during self-test, falling back to pure JS",{filepath:i,error:h.message.slice(0,200)}),null}return i});async function n(){return await e()!==null}D.isUsingRipgrep=n;async function*s(i){i.signal?.throwIfAborted();let h=await e();h?yield*l(h,i):(t.debug("ripgrep not available, using pure JS fallback for files()",{cwd:i.cwd}),yield*y(i));}D.files=s;async function*l(i,h){h.signal?.throwIfAborted();let v=["--files","--glob=!.git/*"];h.follow&&v.push("--follow");let L=h.hidden!==false;if(h.maxDepth!==void 0&&v.push(`--max-depth=${h.maxDepth}`),h.glob)for(let _ of h.glob)v.push(`--glob=${_}`);try{if(!(await se__default.default.stat(h.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${h.cwd}'`),{code:"ENOTDIR",errno:-20,path:h.cwd})}catch(_){throw _.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${h.cwd}'`),{code:"ENOENT",errno:-2,path:h.cwd}):_}let z=await chunkGJWUV3QH_cjs.D.run([i,...v],{cwd:h.cwd});if(z.code!==0&&z.code!==1)return;let M=z.stdout.split(/\r?\n/);for(let _ of M){h.signal?.throwIfAborted();let a=_.trim();if(!a)continue;let x=chunkHJFBORDG_cjs.d.toUnixPath(a);!L&&x.split("/").some(f=>f.startsWith("."))||(yield x);}}async function*y(i){i.signal?.throwIfAborted();try{if(!(await se__default.default.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(f){throw f.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):f}let h=[],v=[];if(i.glob)for(let f of i.glob)f.startsWith("!")?v.push(f.slice(1)):h.push(f);let L=h.length>0?h:["**/*"],z=i.hidden!==false,M=new Set,_=chunkHJFBORDG_cjs.b.DEFAULT_MAX_DEPTH,a;i.maxDepth===void 0?a=_:i.maxDepth<0?a=1:a=i.maxDepth+1;let x=Math.min(Math.max(a,1),_);for(let f of L){i.signal?.throwIfAborted();let d=await chunkHJFBORDG_cjs.b.scan(f,{cwd:i.cwd,absolute:false,include:"file",dot:z,symlink:i.follow??false,maxDepth:x,ignore:v});for(let c of d)!z&&c.split("/").some(p=>p.startsWith("."))||M.add(c);}for(let f of Array.from(M).sort())i.signal?.throwIfAborted(),yield f;i.signal?.throwIfAborted();}async function o(i){t.debug("tree",{cwd:i.cwd}),i.signal?.throwIfAborted();let h=i.hidden!==false,v=i.glob??[],L=v.filter(E=>!E.startsWith("!")),z=v.filter(E=>E.startsWith("!")).map(E=>E.slice(1)),M=L.length>0?L:["**/*"],_=new Set,a=[];for(let E of M){i.signal?.throwIfAborted();let N=await chunkHJFBORDG_cjs.b.scan(E,{cwd:i.cwd,absolute:false,include:"file",dot:h,symlink:false,maxDepth:chunkHJFBORDG_cjs.b.DEFAULT_MAX_DEPTH});for(let k of N)_.has(k)||(_.add(k),a.push(k));}let x=a.filter(E=>{for(let N of z)if(chunkHJFBORDG_cjs.b.match(N,E))return false;return true});function f(E,N){let k=E.children.get(N);if(k)return k;let j={name:N,children:new Map};return E.children.set(N,j),j}let d={children:new Map};for(let E of x){let N=E.split("/");if(N.length<2)continue;let k=d;for(let j of N.slice(0,-1))k=f(k,j);}let c=Array.from(d.children.values()).sort((E,N)=>E.name.localeCompare(N.name)),p=i.limit??Number.POSITIVE_INFINITY,T=[],P=c.map(E=>({node:E,path:E.name})),$=0,I=0;for(;P.length>0;){let E=P.shift();if(!E)break;if($++,I<p){T.push(E.path),I++;for(let N of Array.from(E.node.children.values()).sort((k,j)=>k.name.localeCompare(j.name))){if(I>=p)break;P.push({node:N,path:`${E.path}/${N.name}`});}}}return $>I&&T.push(`[${I}/${$} shown, ${$-I} truncated]`),T.join(`
|
|
29
|
+
`)}D.tree=o;async function u(i){let h=await e();return h?b(h,i):(t.debug("ripgrep not available, using pure JS fallback for search()",{cwd:i.cwd,pattern:i.pattern}),w(i))}D.search=u;async function b(i,h){let v=["--json","--glob=!.git/*"];if(h.follow&&v.push("--follow"),h.glob)for(let a of h.glob)v.push(`--glob=${a}`);h.limit&&v.push(`--max-count=${h.limit}`),v.push("--"),v.push(h.pattern);let L=await chunkGJWUV3QH_cjs.D.run([i,...v],{cwd:h.cwd});if(L.code!==0)return [];let z=h.hidden!==false,M=L.stdout.split(/\r?\n/).filter(Boolean),_=[];for(let a of M)try{let x=JSON.parse(a);if(x?.type!=="match")continue;let f=x.data;if(!f?.path?.text||!f?.lines?.text)continue;let d=chunkHJFBORDG_cjs.d.toUnixPath(f.path.text);if(!z&&d.split("/").some(c=>c.startsWith(".")))continue;if(_.push({path:d,lines:f.lines.text,line_number:f.line_number,absolute_offset:f.absolute_offset??0}),h.limit&&_.length>=h.limit)break}catch{}return _}async function w(i){let h;try{h=new RegExp(i.pattern);}catch{return []}try{if(!(await se__default.default.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(f){throw f.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):f}let v=[],L=[];if(i.glob)for(let f of i.glob)f.startsWith("!")?L.push(f.slice(1)):v.push(f);let z=i.hidden!==false,M=[],_=v.length>0?v:["**/*"],a=new Set,x=[];for(let f of _){i.signal?.throwIfAborted();let d=await chunkHJFBORDG_cjs.b.scan(f,{cwd:i.cwd,absolute:false,include:"file",dot:z,symlink:i.follow??false,maxDepth:void 0,ignore:L});for(let c of d)a.has(c)||(a.add(c),x.push(c));}for(let f of x){if(i.signal?.throwIfAborted(),i.limit&&M.length>=i.limit)break;let d=chunkHJFBORDG_cjs.d.join(i.cwd,f),c;try{c=await se__default.default.readFile(d,"utf-8");}catch{continue}let p=c.split(/\r?\n/),T=0;for(let P=0;P<p.length;P++){let $=p[P]??"";if(h.test($)&&(M.push({path:f,lines:$,line_number:P+1,absolute_offset:T}),i.limit&&M.length>=i.limit))break;T+=Buffer.byteLength($,"utf-8")+1;}}return M}function S(i,h){return chunkHJFBORDG_cjs.a.match(i,h)}D.match=S;let R=chunkGJWUV3QH_cjs.a(async()=>await e());async function g(){return await R()}D.filepathCached=g,D._ready=chunkGJWUV3QH_cjs.a(async()=>{let i=await e();return t.debug("Grep initialized",{ripgrep:i?"available":"fallback (pure JS)"}),i});})(exports.Grep||(exports.Grep={}));chunkXBAP2B6J_cjs.e();exports.Keybind=void 0;(y=>{function t(o,u){if(o===u)return true;if(typeof o!="object"||typeof u!="object"||o===null||u===null)return false;let b=Object.keys(o),w=Object.keys(u);if(b.length!==w.length)return false;for(let S of b)if(!w.includes(S)||!t(o[S],u[S]))return false;return true}function e(o){return {...o,super:o.super??false}}function r(o,u){return o?t(e(o),e(u)):false}y.match=r;function n(o,u=false){return {name:o.name,ctrl:o.ctrl,meta:o.meta,shift:o.shift,super:o.super??false,leader:u}}y.fromParsedKey=n;function s(o){if(!o)return "";let u=[];o.ctrl&&u.push("ctrl"),o.meta&&u.push("alt"),o.super&&u.push("super"),o.shift&&u.push("shift"),o.name&&(o.name==="delete"?u.push("del"):u.push(o.name));let b=u.join("+");return o.leader&&(b=b?`<leader> ${b}`:"<leader>"),b}y.keyToString=s;function l(o){return o==="none"?[]:o.split(",").map(u=>{let w=u.replace(/<leader>/g,"leader+").toLowerCase().split("+"),S={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let R of w)switch(R){case "ctrl":S.ctrl=true;break;case "alt":case "meta":case "option":S.meta=true;break;case "super":S.super=true;break;case "shift":S.shift=true;break;case "leader":S.leader=true;break;case "esc":S.name="escape";break;default:S.name=R;break}return S})}y.parse=l;})(exports.Keybind||(exports.Keybind={}));chunkXBAP2B6J_cjs.e();exports.Locale=void 0;(R=>{R.SUPPORTED_LANGS=["zh-CN","en-US"],R.DEFAULT_LANG="zh-CN";function r(g,A="EASBOT_LANG"){let D=[g,process.env[A]?.trim()];for(let i of D)if(i&&R.SUPPORTED_LANGS.includes(i))return i;return R.DEFAULT_LANG}R.resolveLocaleLang=r;function n(g){return g.replace(/\b\w/g,A=>A.toUpperCase())}R.titlecase=n;function s(g){return new Date(g).toLocaleTimeString(void 0,{timeStyle:"short"})}R.time=s;function l(g){let A=new Date(g),D=s(g),i=A.toLocaleDateString();return `${D} \xB7 ${i}`}R.datetime=l;function y(g){let A=new Date(g),D=new Date;return A.getFullYear()===D.getFullYear()&&A.getMonth()===D.getMonth()&&A.getDate()===D.getDate()?s(g):l(g)}R.todayTimeOrDateTime=y;function o(g){return g>=1e6?(g/1e6).toFixed(1)+"M":g>=1e3?(g/1e3).toFixed(1)+"K":g.toString()}R.number=o;function u(g){if(g<1e3)return `${g}ms`;if(g<6e4)return `${(g/1e3).toFixed(1)}s`;if(g<36e5){let i=Math.floor(g/6e4),h=Math.floor(g%6e4/1e3);return `${i}m ${h}s`}if(g<864e5){let i=Math.floor(g/36e5),h=Math.floor(g%36e5/6e4);return `${i}h ${h}m`}let A=Math.floor(g/36e5);return `${Math.floor(g%36e5/864e5)}d ${A}h`}R.duration=u;function b(g,A){return g.length<=A?g:g.slice(0,A-1)+"\u2026"}R.truncate=b;function w(g,A=35){if(g.length<=A)return g;let D="\u2026",i=Math.ceil((A-D.length)/2),h=Math.floor((A-D.length)/2);return g.slice(0,i)+D+g.slice(-h)}R.truncateMiddle=w;function S(g,A,D){return (g===1?A:D).replace("{}",g.toString())}R.pluralize=S;})(exports.Locale||(exports.Locale={}));var Gt=exports.Locale.resolveLocaleLang,qt=exports.Locale.SUPPORTED_LANGS,Wt=exports.Locale.DEFAULT_LANG;chunkXBAP2B6J_cjs.e();var Xt=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Jt(){return Xt.some(t=>process.env[t])}function Yt(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function Zt(){let t=process.env.HTTP_PROXY||process.env.http_proxy,e=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:t,https:e,enabled:!!(t||e)}}chunkXBAP2B6J_cjs.e();var Ne=class{constructor(){chunkXBAP2B6J_cjs.c(this,"queue",[]);chunkXBAP2B6J_cjs.c(this,"resolvers",[]);}push(e){let r=this.resolvers.shift();r?r(e):this.queue.push(e);}async next(){return this.queue.length>0?this.queue.shift():new Promise(e=>this.resolvers.push(e))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Vt(t,e,r){let n=[...e];await Promise.all(Array.from({length:t},async()=>{for(;;){let s=n.pop();if(s===void 0)return;await r(s);}}));}chunkXBAP2B6J_cjs.e();function Kt(){let t,e=new Promise(r=>t=r);return {trigger(){return t()},wait(){return e}}}chunkXBAP2B6J_cjs.e();function Qt(t,e){let r;return Promise.race([t.then(n=>(clearTimeout(r),n)),new Promise((n,s)=>{r=setTimeout(()=>{s(new Error(`Operation timed out after ${e}ms`));},e);})])}chunkXBAP2B6J_cjs.e();exports.Token=void 0;(y=>{let r=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function n(o){if(!o)return 0;let u=String(o),b=(u.match(r)||[]).length,w=u.length-b,S=Math.round(b/1.5),R=Math.round(w/4);return Math.max(0,S+R)}y.estimate=n;function s(o){if(o==null)return 0;try{let u=typeof o=="string"?o:JSON.stringify(o);return n(u)}catch{return 0}}y.estimateObject=s;function l(o){if(o.total!==void 0&&o.total>0)return o.total;let u=o.input??0,b=o.output??0,w=o.cache?.read??0,S=o.cache?.write??0;return u+b+w+S}y.total=l;})(exports.Token||(exports.Token={}));chunkXBAP2B6J_cjs.e();function tr(t){let e={},r=t.shape??t.required().shape;for(let[n,s]of Object.entries(r))e[n]=s.nullable().optional();return le__default.default.object(e)}Object.defineProperty(exports,"Lock",{enumerable:true,get:function(){return chunkPJIZPZPO_cjs.a}});Object.defineProperty(exports,"$",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.H}});Object.defineProperty(exports,"HTTPException",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.j}});Object.defineProperty(exports,"Hono",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.d}});Object.defineProperty(exports,"Lazy",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.c}});Object.defineProperty(exports,"PKG",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.D}});Object.defineProperty(exports,"PkgShell",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.A}});Object.defineProperty(exports,"Shell",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.G}});Object.defineProperty(exports,"compress",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.g}});Object.defineProperty(exports,"cors",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.e}});Object.defineProperty(exports,"createNodeWebSocket",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.s}});Object.defineProperty(exports,"createPkgShell",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.B}});Object.defineProperty(exports,"createRESTServer",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.p}});Object.defineProperty(exports,"createRPCServer",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.n}});Object.defineProperty(exports,"createServer",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.m}});Object.defineProperty(exports,"createStreamingServer",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.r}});Object.defineProperty(exports,"createWebSocketServer",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.q}});Object.defineProperty(exports,"detectPlatform",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.y}});Object.defineProperty(exports,"escapeCommandArg",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.w}});Object.defineProperty(exports,"escapeCommandArgSafe",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.x}});Object.defineProperty(exports,"joinCommandArgs",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.z}});Object.defineProperty(exports,"lazy",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.a}});Object.defineProperty(exports,"lazyAsync",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.b}});Object.defineProperty(exports,"logger",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.f}});Object.defineProperty(exports,"needsShellExecution",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.u}});Object.defineProperty(exports,"parseCommand",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.t}});Object.defineProperty(exports,"parseCommandWithOptions",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.v}});Object.defineProperty(exports,"readableStreamToText",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.E}});Object.defineProperty(exports,"secureHeaders",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.h}});Object.defineProperty(exports,"shell",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.C}});Object.defineProperty(exports,"startServer",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.o}});Object.defineProperty(exports,"timeout",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.i}});Object.defineProperty(exports,"validator",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.k}});Object.defineProperty(exports,"whichSync",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.F}});Object.defineProperty(exports,"zValidator",{enumerable:true,get:function(){return chunkGJWUV3QH_cjs.l}});Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkHJFBORDG_cjs.d}});Object.defineProperty(exports,"Glob",{enumerable:true,get:function(){return chunkHJFBORDG_cjs.b}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkHJFBORDG_cjs.c}});Object.defineProperty(exports,"Wildcard",{enumerable:true,get:function(){return chunkHJFBORDG_cjs.a}});Object.defineProperty(exports,"Log",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.m}});Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.o}});Object.defineProperty(exports,"Semver",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.n}});Object.defineProperty(exports,"addMinutesInTimezone",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.l}});Object.defineProperty(exports,"formatLocalISO",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.a}});Object.defineProperty(exports,"formatLocalISOCompact",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.b}});Object.defineProperty(exports,"formatLogTime",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.f}});Object.defineProperty(exports,"formatLogTimeMs",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.g}});Object.defineProperty(exports,"getTimezoneOffset",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.h}});Object.defineProperty(exports,"getTimezoneParts",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.i}});Object.defineProperty(exports,"isValidTimezone",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.j}});Object.defineProperty(exports,"normalizeTimezone",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.k}});Object.defineProperty(exports,"now",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.c}});Object.defineProperty(exports,"nowLocalISO",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.d}});Object.defineProperty(exports,"parseLocalISO",{enumerable:true,get:function(){return chunkPGUMSM7F_cjs.e}});exports.AsyncQueue=Ne;exports.DEFAULT_LANG=Wt;exports.NamedError=ne;exports.SUPPORTED_LANGS=qt;exports.abortAfter=Be;exports.abortAfterAny=Ht;exports.defer=Ut;exports.findLast=pt;exports.fn=xt;exports.formatDuration=Bt;exports.getDirectory=$t;exports.getFileExtension=Dt;exports.getFilename=ze;exports.getFilenameTruncated=It;exports.getProxyConfig=Zt;exports.getProxyUrl=Yt;exports.git=Tt;exports.iife=Ot;exports.loadEnv=wt;exports.loadTextFile=At;exports.loadTextFileAsync=kt;exports.parseModelId=vt;exports.proxied=Jt;exports.resolveLocaleLang=Gt;exports.retry=Se;exports.signal=Kt;exports.truncateMiddle=Nt;exports.updateSchema=tr;exports.withTimeout=Qt;exports.work=Vt;
|