@easbot/utils 0.3.9 → 0.3.11
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-3U5YF6EI.cjs +20 -0
- package/dist/chunks/chunk-6BCTOX3Z.mjs +2 -0
- package/dist/chunks/chunk-AUS6KQNI.cjs +5 -0
- package/dist/chunks/chunk-DELWLFU5.mjs +5 -0
- package/dist/chunks/chunk-EN7LFV4R.cjs +2 -0
- package/dist/chunks/{chunk-UZ52E7FE.mjs → chunk-EWRFKUXM.mjs} +1 -1
- package/dist/chunks/chunk-MHARKEDN.mjs +1 -0
- package/dist/chunks/{chunk-YC4AEMOP.cjs → chunk-PJIZPZPO.cjs} +1 -1
- package/dist/chunks/chunk-WW6DVU53.mjs +20 -0
- package/dist/chunks/chunk-XBAP2B6J.cjs +1 -0
- package/dist/chunks/filesystem-26SI2VQU.cjs +1 -0
- package/dist/chunks/filesystem-GHRTFLEY.mjs +1 -0
- package/dist/chunks/lock-BQX6RGCF.mjs +1 -0
- package/dist/chunks/lock-RMTHF4F6.cjs +1 -0
- package/dist/chunks/{main-ZMRSNK7G.mjs → main-GVYBF75T.mjs} +4 -4
- package/dist/chunks/{main-RIJAJS2R.cjs → main-K27GCHMT.cjs} +4 -4
- package/dist/chunks/registry-5BYC5NYM.mjs +1 -0
- package/dist/chunks/registry-Z3XETZ6O.cjs +1 -0
- package/dist/chunks/shell-52EI6MQK.cjs +1 -0
- package/dist/chunks/shell-JJRFPZC7.mjs +1 -0
- package/dist/index.cjs +47 -43
- package/dist/index.d.cts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.mjs +47 -43
- package/package.json +4 -3
- package/dist/chunks/chunk-6HZ7Q7NO.mjs +0 -2
- package/dist/chunks/chunk-6JM5F6FM.cjs +0 -2
- package/dist/chunks/chunk-A2TCSTSM.cjs +0 -5
- package/dist/chunks/chunk-AHO55TRS.cjs +0 -4
- package/dist/chunks/chunk-DAYGB2XR.mjs +0 -4
- package/dist/chunks/chunk-JQNKLHWT.cjs +0 -20
- package/dist/chunks/chunk-LBWRSUJC.mjs +0 -20
- package/dist/chunks/chunk-T3MZ3YS3.mjs +0 -5
- package/dist/chunks/chunk-V6YNYGNC.mjs +0 -1
- package/dist/chunks/chunk-VRQQ33YH.cjs +0 -1
- package/dist/chunks/filesystem-HQDKXRWJ.cjs +0 -1
- package/dist/chunks/filesystem-XE6UYBAE.mjs +0 -1
- package/dist/chunks/lock-EGXJVIO5.mjs +0 -1
- package/dist/chunks/lock-LMCPTUNU.cjs +0 -1
- package/dist/chunks/registry-BGNK5LJC.cjs +0 -1
- package/dist/chunks/registry-NQR4SFLJ.mjs +0 -1
- package/dist/chunks/shell-PXZK5BNW.mjs +0 -1
- package/dist/chunks/shell-RJBXISIH.cjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
export{a as Lock}from'./chunks/chunk-
|
|
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
|
+
export{a as Lock}from'./chunks/chunk-EWRFKUXM.mjs';import {b,D,a,G,c as c$1}from'./chunks/chunk-WW6DVU53.mjs';export{H as $,j as HTTPException,d as Hono,c as Lazy,D as PKG,A as PkgShell,G as Shell,g as compress,e as cors,s as createNodeWebSocket,B as createPkgShell,p as createRESTServer,n as createRPCServer,m as createServer,r as createStreamingServer,q as createWebSocketServer,y as detectPlatform,w as escapeCommandArg,x as escapeCommandArgSafe,z as joinCommandArgs,a as lazy,b as lazyAsync,f as logger,u as needsShellExecution,t as parseCommand,v as parseCommandWithOptions,E as readableStreamToText,h as secureHeaders,C as shell,o as startServer,i as timeout,k as validator,F as whichSync,l as zValidator}from'./chunks/chunk-WW6DVU53.mjs';import {d,b as b$2,a as a$1}from'./chunks/chunk-6BCTOX3Z.mjs';export{d as Filesystem,b as Glob,c as MIME_TYPES,a as Wildcard}from'./chunks/chunk-6BCTOX3Z.mjs';import {m,b as b$1}from'./chunks/chunk-DELWLFU5.mjs';export{m as Log,o as PackageRegistry,n as Semver,l as addMinutesInTimezone,a as formatLocalISO,b as formatLocalISOCompact,f as formatLogTime,g as formatLogTimeMs,h as getTimezoneOffset,i as getTimezoneParts,j as isValidTimezone,k as normalizeTimezone,c as now,d as nowLocalISO,e as parseLocalISO}from'./chunks/chunk-DELWLFU5.mjs';import {f,c,d as d$1}from'./chunks/chunk-MHARKEDN.mjs';import ve from'fs/promises';import Fe,{z}from'zod';import {randomBytes}from'crypto';import {config}from'dotenv';import ot,{dirname,join}from'path';import {existsSync,readdirSync,statSync}from'fs';import {xdgConfig}from'xdg-basedir';import {fileURLToPath}from'url';import er from'markdown-it';import Yt from'yaml';import {ProxyAgent,getGlobalDispatcher,setGlobalDispatcher}from'undici';import {AsyncLocalStorage}from'async_hooks';import*as Ue from'readline';import {stripVTControlCharacters}from'util';import {Writable}from'stream';import T from'picocolors';f();f();function Cn(t,e){for(let n=t.length-1;n>=0;n-=1){let r=t[n];if(r!==void 0&&e(r,n,t))return r}}f();var Ke;(n=>{function t(r,o,a){let c=0,s=r.length-1;for(;c<=s;){let l=Math.floor((c+s)/2),p=r[l];if(p===void 0)break;let u=a(p);if(u===o)return {found:true,index:l};u<o?c=l+1:s=l-1;}return {found:false,index:c}}n.search=t;function e(r,o,a){let c=a(o),s=0,l=r.length;for(;s<l;){let p=Math.floor((s+l)/2),u=r[p];if(u===void 0)break;a(u)<c?s=p+1:l=p;}return r.splice(s,0,o),r}n.insert=e;})(Ke||(Ke={}));f();var Je;(a=>{function t(c){let s=new TextEncoder().encode(c),l=Array.from(s,p=>String.fromCharCode(p)).join("");return btoa(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}a.base64Encode=t;function e(c){let s=atob(c.replace(/-/g,"+").replace(/_/g,"/")),l=Uint8Array.from(s,p=>p.charCodeAt(0));return new TextDecoder().decode(l)}a.base64Decode=e;async function n(c,s="SHA-256"){let p=new TextEncoder().encode(c),u=await crypto.subtle.digest(s,p);return Array.from(new Uint8Array(u)).map(f=>f.toString(16).padStart(2,"0")).join("")}a.hash=n;function r(c){if(!c)return;let s=2166136261;for(let l=0;l<c.length;l++)s^=c.charCodeAt(l),s=Math.imul(s,16777619);return (s>>>0).toString(36)}a.checksum=r;function o(c,s=5e5){if(!c)return;if(c.length<=s)return r(c);let l=4096,u=[0,Math.floor(c.length*.25),Math.floor(c.length*.5),Math.floor(c.length*.75),c.length-l].map(d=>{let m=Math.max(0,Math.min(c.length-l,d-Math.floor(l/2)));return r(c.slice(m,m+l))??""}).join(":");return `${c.length}:${u}`}a.sampledChecksum=o;})(Je||(Je={}));f();f();var ne;(d=>{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(m){return Fe.string().startsWith(t[m])}d.schema=e;let n=26,r=0,o=0;function a(m,f){return s(m,false,f)}d.ascending=a;function c(m,f){return s(m,true,f)}d.descending=c;function s(m,f,g){if(!g)return p(m,f);if(!g.startsWith(t[m]))throw new Error(`ID ${g} does not start with ${t[m]}`);return g}function l(m){let f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",g="",S=randomBytes(m);for(let i=0;i<m;i++){let b=S[i];b!==void 0&&(g+=f[b%62]);}return g}function p(m,f,g){let S=g??Date.now();S!==r&&(r=S,o=0),o++;let i=BigInt(S)*BigInt(4096)+BigInt(o);i=f?~i:i;let b=Buffer.alloc(6);for(let O=0;O<6;O++)b[O]=Number(i>>BigInt(40-8*O)&BigInt(255));return t[m]+"_"+b.toString("hex")+l(n-12)}d.create=p;function u(m){let f=m.split("_")[0];if(!f)return 0;let g=m.slice(f.length+1,f.length+13),S=BigInt("0x"+g);return Number(S/BigInt(4096))}d.timestamp=u;})(ne||(ne={}));var Ze;(p=>{p.DEFAULT_MAX_CHARS=4e3,p.DIRECTION="head",p.DIR=d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),p.GLOB=d.join(p.DIR,"*");let o=10080*60*1e3;function a(u,d,m){return m?`[Content truncated. Source: ${m}
|
|
2
|
+
Full ${d} saved to: ${u}
|
|
3
|
+
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${d} saved to: ${u}
|
|
4
|
+
Use Read tool with offset/limit parameters to view specific sections.]`}async function c(u,d$1={}){let m=d$1.maxChars??4e3,f=d$1.direction??p.DIRECTION,g=d$1.label??"content",S=d$1.sourcePath,i=d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),b=d$1.dir??i;if(u.length<=m)return {content:u,truncated:false};let O=ne.ascending("context"),F=d.join(b,O);await ve.mkdir(b,{recursive:true}).catch(()=>{}),await ve.writeFile(F,u,"utf-8");let q=u.length-m,L;f==="head"?L=u.slice(0,m):L=u.slice(-m);let A=a(F,g,S),z=`${q} characters truncated`;return {content:f==="head"?`${L}
|
|
5
5
|
|
|
6
|
-
...${
|
|
6
|
+
...${z}...
|
|
7
7
|
|
|
8
|
-
${
|
|
8
|
+
${A}`:`...${z}...
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${A}
|
|
11
11
|
|
|
12
|
-
${
|
|
13
|
-
`):e;for(let r=0;r<n.length;r++){let o=n[r];this.parseRule(o,r+1);}return this}parseRule(e,n){let r=e,o=e;if(r.length===0||r.startsWith("#"))return;let
|
|
12
|
+
${L}`,truncated:true,outputPath:F,originalLength:u.length,removedLength:q,label:g}}p.truncate=c;function s(u){return u.truncated?a(u.outputPath,u.label):""}p.formatHint=s;async function l(){let u=ne.timestamp(ne.create("context",false,Date.now()-o)),m=(await ve.readdir(p.DIR).catch(()=>[])).filter(f=>f.startsWith("context_"));for(let f of m)ne.timestamp(f)>=u||await ve.unlink(d.join(p.DIR,f)).catch(()=>{});}p.cleanup=l;})(Ze||(Ze={}));f();var Qe;(s=>{let t="New session - ",e="Child session - ";s.parentTitlePrefix=t,s.childTitlePrefix=e;function o(l=false){return (l?e:t)+b$1(new Date)}s.createDefault=o;function a(l){return new RegExp(`^(${t}|${e})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(l)}s.isDefault=a;function c(l){let p=l.match(/^(.+) \(fork #(\d+)\)$/);if(p){let u=p[1]??"",d=parseInt(p[2]??"0",10);return `${u} (fork #${d+1})`}return `${l} (fork #1)`}s.getForked=c;})(Qe||(Qe={}));f();var ye=class ye extends Error{static create(e,n){var a;let r=Fe.object({name:Fe.literal(e),data:n}).meta({ref:e}),o=(a=class extends ye{constructor(s,l){super(e,l);c(this,"data",s);c(this,"name",e);this.name=e;}static isInstance(s){return s!==null&&typeof s=="object"&&"name"in s&&s.name===e}schema(){return r}toObject(){return {name:e,data:this.data}}},c(a,"Schema",r),a);return Object.defineProperty(o,"name",{value:e}),o}};c(ye,"Unknown",ye.create("UnknownError",Fe.object({message:Fe.string()})));var et=ye;f();var tt;(e=>{function t(n){return new nt(n)}e.create=t;})(tt||(tt={}));var nt=class{constructor(e){c(this,"rules",[]);c(this,"ignorecase");c(this,"debug");this.ignorecase=e?.ignorecase??false,this.debug=e?.debug??false;}add(e){let n=typeof e=="string"?e.split(`
|
|
13
|
+
`):e;for(let r=0;r<n.length;r++){let o=n[r];this.parseRule(o,r+1);}return this}parseRule(e,n){let r=e,o=e;if(r.length===0||r.startsWith("#"))return;let a=r.startsWith("!");if(a&&(r=r.slice(1)),r=r.trim(),r.length===0||(r.startsWith("\\#")&&(r=r.slice(1)),r.startsWith("#")))return;let c=r.startsWith("/");c&&(r=r.slice(1));let s=r.endsWith("/");s&&(r=r.slice(0,-1)),r.length!==0&&this.rules.push({pattern:r,negative:a,isDirectory:s,anchored:c,original:o,lineNumber:n});}ignores(e,n){let r=this.normalizePath(e),o=n??e.endsWith("/"),a=this.checkIgnore(r,o);return this.debug&&console.log(`Ignore.ignores("${e}", isDirectory=${o}) => ${a}`),a}checkIgnore(e,n){let r=false;for(let o of this.rules)o.isDirectory&&!n||this.matchPath(o,e)&&(o.negative?r=false:r=true);return r}matchPath(e,n){let r=this.ignorecase?n.toLowerCase():n,a=this.ignorecase?e.pattern.toLowerCase():e.pattern;if(e.anchored)return a$1.match(r,a);if(a.includes("/"))return a$1.match(r,a);let c=r.split("/");for(let s of c)if(a$1.match(s,a))return true;return false}filter(e){return e.filter(n=>!this.ignores(n))}createFilter(){return e=>!this.ignores(e)}normalizePath(e){let n=e.replace(/\\/g,"/");if(n==="/")return "";for(;n.startsWith("./");)n=n.slice(2);return n.endsWith("/")&&n.length>1&&(n=n.slice(0,-1)),n}};f();function Et(t,e){let n=r=>{let o;try{o=t.parse(r);}catch(a){throw console.trace("schema validation failure stack trace:"),a instanceof z.ZodError&&console.error("schema validation issues:",JSON.stringify(a.issues,null,2)),a}return e(o)};return n.force=r=>e(r),n.schema=t,n}var $n=Et,rt;(e=>e.fn=Et)(rt||(rt={}));f();function zn(t={}){let e=t.isDevelopment??false,n=e?".env.dev":".env",r=t.globalConfigPath??(xdgConfig?ot.join(xdgConfig,"easbot"):void 0),o=t.projectRoot??process.cwd(),a=o?ot.join(o,".easbot"):void 0,c=[{root:r,label:"global"},{root:o,label:"project"},{root:a,label:"workspace"}];for(let{root:s}of c){if(!s)continue;let l=ot.join(s,n);if(!existsSync(l))continue;let p=config({path:l,override:true,debug:e,encoding:"utf-8",quiet:!e});if(e&&p.parsed){let d=["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(m=>m in p.parsed);d.length>0&&console.warn(`[loadEnv] ${l} contains keys that have no effect: ${d.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.`);}}}
|
|
16
|
-
`?o=s:/\s/.test(l)&&(
|
|
15
|
+
How to override: export them in the shell before loadEnv() runs, or set process.env directly.`);}}}f();async function Bn(t,e){if(process.env.EASBOT_CLIENT==="acp")try{let a=process.platform==="win32"?"cmd":void 0,c=G.spawn(a,`git ${t.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:e.cwd,env:e.env?{...process.env,...e.env}:process.env}),[s,l,p]=await Promise.all([c.exited,new Response(c.stdout).arrayBuffer(),new Response(c.stderr).arrayBuffer()]),u=Buffer.from(l),d=Buffer.from(p);return {exitCode:s,text:()=>u.toString(),stdout:u,stderr:d}}catch(a){let c=Buffer.from(a instanceof Error?a.message:String(a));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:c}}let n=e.env?{...process.env,...e.env}:void 0,r=G.$`git ${t.join(" ")}`.quiet().nothrow().cwd(e.cwd);n&&(r=r.env(n));let o=await r;return {exitCode:o.exitCode,text:()=>o.text(),stdout:o.stdout,stderr:o.stderr}}f();function _t(t){return t?dirname(fileURLToPath(t)):typeof d$1<"u"?d$1:process.cwd()}function Ct(t,e,n=3){function r(o,a){if(a>n||!existsSync(o))return null;try{let c=readdirSync(o);for(let s of c){let l=join(o,s);try{let p=statSync(l);if(p.isFile()&&l.endsWith(e))return l;if(p.isDirectory()&&a<n){let u=r(l,a+1);if(u)return u}}catch{}}}catch{}return null}return r(t,0)}function Lt(t,e){let n=join(t,e);if(existsSync(n))return n;let r=e.split("/").pop()||e,o=t;for(let a=0;a<5;a++){let c=join(o,"assets","txt");if(existsSync(c)){let p=Ct(c,r,5);if(p)return p}let s=join(o,"dist","assets","txt");if(existsSync(s)){let p=Ct(s,r,5);if(p)return p}let l=join(o,"..");if(l===o)break;o=l;}return n}function qn(t,e){return c$1.lazy(()=>{try{let n=_t(e),r=Lt(n,t);return D.file(r).textSync()}catch(n){throw console.error(`Failed to load text file: ${t}`,n),n}})}function Gn(t,e){return c$1.lazy(async()=>{try{let n=_t(e),r=Lt(n,t);return await D.file(r).text()}catch(n){throw console.error(`Failed to load text file: ${t}`,n),n}})}f();function Yn(t){return t()}f();function Vn(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)}}f();f();f();function st(t,e,n,r=()=>true){let o=-1,a=-1,c=0;for(let s=e;s<n;s++){if(!r(s))continue;let l=t[s];if(l){if(l==="("){c+=1;continue}if(l===")"&&c>0){c-=1;continue}c===0&&(l===`
|
|
16
|
+
`?o=s:/\s/.test(l)&&(a=s));}}return {lastNewline:o,lastWhitespace:a}}function Xn(t,e){if(!t)return [];if(e<=0)return [t];if(t.length<=e)return [t]}function ce(t,e,n){try{let r=z.string().parse(t),o=z.number().int().parse(e),a=Xn(r,o);if(a)return a;let c=it(r,o,s=>{let{lastNewline:l,lastWhitespace:p}=st(s,0,s.length);return l>0?l:p});return n?.minLength&&n.minLength>0&&(c=$t(c,n.minLength)),c}catch(r){return console.warn("Invalid input for chunkText:",r),typeof t=="string"&&t.length>0?[t]:[]}}function $t(t,e){if(t.length<=1||e<=0)return t;let n=[],r=t[0]??"";for(let o=1;o<t.length;o++){let a=t[o]??"";r.length<e?r=r+`
|
|
17
17
|
|
|
18
|
-
`+
|
|
18
|
+
`+a:(n.push(r),r=a);}if(r.length>0)if(r.length<e&&n.length>0){let o=n.pop();n.push(o+`
|
|
19
19
|
|
|
20
|
-
`+r);}else n.push(r);return n}function
|
|
20
|
+
`+r);}else n.push(r);return n}function it(t,e,n){if(!t)return [];if(e<=0||t.length<=e)return [t];let r=[],o=t;for(;o.length>e;){let a=o.slice(0,e),c=n(a),s=Number.isFinite(c)&&c>0&&c<=e?c:e,p=o.slice(0,s).trimEnd();p.length>0&&r.push(p);let u=s<o.length&&o[s]!==void 0&&/\s/.test(o[s]),d=Math.min(o.length,s+(u?1:0));o=o.slice(d).trimStart();}return o.length>0&&r.push(o),r}f();var at=z.enum(["bold","italic","strikethrough","code","code_block","spoiler","blockquote"]),Dt=z.object({start:z.number().int().min(0),end:z.number().int().min(0),style:at}).strict().refine(t=>t.end>=t.start,{message:"end must be greater than or equal to start"}),Nt=z.object({start:z.number().int().min(0),end:z.number().int().min(0),href:z.string().min(1)}).strict().refine(t=>t.end>=t.start,{message:"end must be greater than or equal to start"}),we=z.object({text:z.string(),styles:z.array(Dt),links:z.array(Nt)}).strict(),Se=z.enum(["off","bullets","code"]),_e=z.object({linkify:z.boolean().default(true),enableSpoilers:z.boolean().default(false),headingStyle:z.enum(["none","bold"]).default("none"),blockquotePrefix:z.string().default(""),autolink:z.boolean().default(true),tableMode:Se.default("off")}).partial().default({}),zt=z.object({open:z.string(),close:z.string()}).strict(),ct=z.object({styleMarkers:z.record(at,zt).optional(),escapeText:z.any().optional(),buildLink:z.any().optional()}).strict();z.object({start:z.number().int().min(0),end:z.number().int().min(0),open:z.string(),close:z.string()}).strict();var lt=z.object({indentSize:z.number().int().min(1).default(2),listMarker:z.enum(["\u2022","-","*"]).default("\u2022"),codeBlockMarker:z.enum(["```","~~~"]).default("```"),preserveFrontmatter:z.boolean().default(true)}).strict(),ut=z.record(z.string(),z.string()),Le=z.object({open:z.boolean(),ticks:z.number().int().min(0)}).strict();z.object({inlineState:Le,isInside:z.any()}).strict();z.object({start:z.number().int().min(0),end:z.number().int().min(0),openLine:z.string(),marker:z.string(),indent:z.string()}).strict();z.object({tables:Se.optional()}).strict();function tr(t){let e=new er({html:false,linkify:t.linkify??true,breaks:false,typographer:false});return e.enable("strikethrough"),t.tableMode&&t.tableMode!=="off"?e.enable("table"):e.disable("table"),t.autolink===false&&e.disable("autolink"),e}function Bt(t,e){if(t.attrGet)return t.attrGet(e);if(t.attrs){for(let[n,r]of t.attrs)if(n===e)return r}return null}function dt(t,e){return {...t,type:"text",content:e,children:void 0}}function nr(t){for(let e of t)e.children&&e.children.length>0&&(e.children=rr(e.children));}function rr(t){let e=0;for(let c of t){if(c.type!=="text")continue;let s=c.content??"",l=0;for(;l<s.length;){let p=s.indexOf("||",l);if(p===-1)break;e+=1,l=p+2;}}if(e<2)return t;let n=e-e%2,r=[],o={spoilerOpen:false},a=0;for(let c of t){if(c.type!=="text"){r.push(c);continue}let s=c.content??"";if(!s.includes("||")){r.push(c);continue}let l=0;for(;l<s.length;){let p=s.indexOf("||",l);if(p===-1){l<s.length&&r.push(dt(c,s.slice(l)));break}if(a>=n){r.push(dt(c,s.slice(l)));break}p>l&&r.push(dt(c,s.slice(l,p))),a+=1,o.spoilerOpen=!o.spoilerOpen,r.push({type:o.spoilerOpen?"spoiler_open":"spoiler_close"}),l=p+2;}}return r}function or(){return {text:"",styles:[],openStyles:[],links:[],linkStack:[]}}function ie(t){return t.table?.currentCell??t}function Ae(t,e){if(!e)return;let n=ie(t);n.text+=e;}function le(t,e){let n=ie(t);n.openStyles.push({style:e,start:n.text.length});}function ue(t,e){let n=ie(t);for(let r=n.openStyles.length-1;r>=0;r-=1){let o=n.openStyles[r];if(o?.style===e){let a=o.start;n.openStyles.splice(r,1);let c=n.text.length;c>a&&n.styles.push({start:a,end:c,style:e});return}}}function jt(t){t.env.listStack.length>0||t.table||(t.text+=`
|
|
21
21
|
|
|
22
|
-
`);}function
|
|
23
|
-
`);}function
|
|
24
|
-
`;}for(let
|
|
25
|
-
`;}else for(let o of n){for(let
|
|
26
|
-
`;}}function
|
|
27
|
-
`;},l=()=>{t.text+="|";for(let
|
|
28
|
-
`;};s(e),l();for(let
|
|
29
|
-
`);break;case "paragraph_close":
|
|
22
|
+
`);}function sr(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 ir(t,e){if(!e)return;let n=ie(t),r=n.text.length;n.text+=e,n.styles.push({start:r,end:r+e.length,style:"code"});}function ar(t,e){let n=e??"",r=ie(t),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function cr(t){let e=ie(t),n=e.linkStack.pop();if(!n?.href)return;let r=n.href.trim();if(!r)return;let o=n.labelStart,a=e.text.length;if(a<=o){e.links.push({start:o,end:a,href:r});return}e.links.push({start:o,end:a,href:r});}function lr(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function ur(t){return Ht(t),{text:t.text,styles:t.styles,links:t.links}}function $e(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),a=o.length,c=[];for(let l of t.styles){let p=Math.max(0,l.start-n),u=Math.min(a,l.end-n);u>p&&c.push({start:p,end:u,style:l.style});}let s=[];for(let l of t.links){let p=Math.max(0,l.start-n),u=Math.min(a,l.end-n);u>p&&s.push({start:p,end:u,href:l.href});}return {text:o,styles:c,links:s}}function ft(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 dr(t,e){e.text&&(t.text+=e.text);}function Wt(t,e){let{header:n,value:r,columnIndex:o,includeColumnFallback:a}=e;r?.text&&(t.text+="\u2022 ",n?.text?(ft(t,n),t.text+=": "):a&&(t.text+=`Column ${o}: `),ft(t,r),t.text+=`
|
|
23
|
+
`);}function fr(t){if(!t.table)return;let e=t.table.headers.map($e),n=t.table.rows.map(o=>o.map($e));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 a=o[0];if(a?.text){let c=t.text.length;ft(t,a);let s=t.text.length;s>c&&t.styles.push({start:c,end:s,style:"bold"}),t.text+=`
|
|
24
|
+
`;}for(let c=1;c<o.length;c++)Wt(t,{header:e[c],value:o[c],columnIndex:c,includeColumnFallback:true});t.text+=`
|
|
25
|
+
`;}else for(let o of n){for(let a=0;a<o.length;a++)Wt(t,{header:e[a],value:o[a],columnIndex:a,includeColumnFallback:false});t.text+=`
|
|
26
|
+
`;}}function pr(t){if(!t.table)return;let e=t.table.headers.map($e),n=t.table.rows.map(u=>u.map($e)),r=Math.max(e.length,...n.map(u=>u.length));if(r===0)return;let o=Array.from({length:r},()=>0),a=u=>{for(let d=0;d<r;d+=1){let f=u[d]?.text.length??0;(o[d]??0)<f&&(o[d]=f);}};a(e);for(let u of n)a(u);let c=t.text.length,s=u=>{t.text+="|";for(let d=0;d<r;d+=1){t.text+=" ";let m=u[d];m&&dr(t,m);let f=m?.text.length??0,S=(o[d]??0)-f;S>0&&(t.text+=" ".repeat(S)),t.text+=" |";}t.text+=`
|
|
27
|
+
`;},l=()=>{t.text+="|";for(let u=0;u<r;u+=1){let d=o[u]??0,m=Math.max(3,d);t.text+=` ${"-".repeat(m)} |`;}t.text+=`
|
|
28
|
+
`;};s(e),l();for(let u of n)s(u);let p=t.text.length;p>c&&t.styles.push({start:c,end:p,style:"code_block"});}function pt(t,e){for(let n of t)switch(n.type){case "inline":n.children&&pt(n.children,e);break;case "text":Ae(e,n.content??"");break;case "em_open":le(e,"italic");break;case "em_close":ue(e,"italic");break;case "strong_open":le(e,"bold");break;case "strong_close":ue(e,"bold");break;case "s_open":le(e,"strikethrough");break;case "s_close":ue(e,"strikethrough");break;case "code_inline":ir(e,n.content??"");break;case "spoiler_open":e.enableSpoilers&&le(e,"spoiler");break;case "spoiler_close":e.enableSpoilers&&ue(e,"spoiler");break;case "link_open":{let r=Bt(n,"href")??"",o=ie(e);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":cr(e);break;case "image":Ae(e,n.content??"");break;case "softbreak":case "hardbreak":Ae(e,`
|
|
29
|
+
`);break;case "paragraph_close":jt(e);break;case "heading_open":e.headingStyle==="bold"&&le(e,"bold");break;case "heading_close":e.headingStyle==="bold"&&ue(e,"bold"),jt(e);break;case "blockquote_open":e.blockquotePrefix&&(e.text+=e.blockquotePrefix),le(e,"blockquote");break;case "blockquote_close":ue(e,"blockquote");break;case "bullet_list_open":e.env.listStack.length>0&&(e.text+=`
|
|
30
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
31
|
`);break;case "ordered_list_open":{e.env.listStack.length>0&&(e.text+=`
|
|
32
|
-
`);let r=Number(
|
|
33
|
-
`);break;case "list_item_open":
|
|
32
|
+
`);let r=Number(Bt(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":sr(e);break;case "list_item_close":e.text.endsWith(`
|
|
34
34
|
`)||(e.text+=`
|
|
35
|
-
`);break;case "code_block":case "fence":
|
|
35
|
+
`);break;case "code_block":case "fence":ar(e,n.content??"");break;case "html_block":case "html_inline":Ae(e,n.content??"");break;case "table_open":e.tableMode!=="off"&&(e.table=lr(),e.hasTables=true);break;case "table_close":e.table&&(e.tableMode==="bullets"?fr(e):e.tableMode==="code"&&pr(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=or());break;case "th_close":case "td_close":e.table?.currentCell&&(e.table.currentRow.push(ur(e.table.currentCell)),e.table.currentCell=null);break;case "hr":e.text+=`\u2500\u2500\u2500
|
|
36
36
|
|
|
37
|
-
`;break;default:n.children&&
|
|
38
|
-
`);let
|
|
37
|
+
`;break;default:n.children&&pt(n.children,e);break}}function Ht(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 mr(t,e){let n=[];for(let r of t){let o=Math.max(0,Math.min(r.start,e)),a=Math.max(o,Math.min(r.end,e));a>o&&n.push({start:o,end:a,style:r.style});}return n}function hr(t,e){let n=[];for(let r of t){let o=Math.max(0,Math.min(r.start,e)),a=Math.max(o,Math.min(r.end,e));a>o&&n.push({start:o,end:a,href:r.href});}return n}function Ut(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 qt(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 gr(t,e,n){if(t.length===0)return [];let r=[];for(let o of t){let a=qt(o,e,n);a&&r.push({start:a.start-e,end:a.end-e,style:o.style});}return Ut(r)}function br(t,e,n){if(t.length===0)return [];let r=[];for(let o of t){let a=qt(o,e,n);a&&r.push({start:a.start-e,end:a.end-e,href:o.href});}return r}function de(t,e){try{let n=typeof t=="string"?t:"",r=_e.parse(e??{});return Te(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function Te(t,e){try{let n=typeof t=="string"?t:"",r=_e.parse(e),o={listStack:[]},c=tr(r).parse(n||"",o);r.enableSpoilers&&nr(c);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};pt(c,l),Ht(l);let u=l.text.trimEnd().length,d=0;for(let g of l.styles)g.style==="code_block"&&g.end>d&&(d=g.end);let m=Math.max(u,d);return {ir:{text:m===l.text.length?l.text:l.text.slice(0,m),styles:Ut(mr(l.styles,m)),links:hr(l.links,m)},hasTables:l.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function Gt(t,e){try{let n=we.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=ce(n.text,r),a=[],c=0;return o.forEach((s,l)=>{if(!s)return;if(l>0)for(;c<n.text.length&&/\s/.test(n.text[c]??"");)c+=1;let p=c,u=Math.min(n.text.length,p+s.length);a.push({text:s,styles:gr(n.styles,p,u),links:br(n.links,p,u)}),c=u;}),a}catch(n){return console.error("Chunk IR error:",n),[]}}f();var xr={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Me(t,e){try{let n=we.parse(t),r=ct.parse(e??{});if(!n.text)return "";let o=r.styleMarkers??xr,a=r.escapeText??(d=>d),c=r.buildLink,s=[];for(let d=0;d<n.styles.length;d++){let m=n.styles[d];m&&(s.push({position:m.start,type:"open",style:m.style,spanIndex:d}),s.push({position:m.end,type:"close",style:m.style,spanIndex:d}));}for(let d=0;d<n.links.length;d++){let m=n.links[d];m&&(s.push({position:m.start,type:"link_open",spanIndex:d,href:m.href}),s.push({position:m.end,type:"link_close",spanIndex:d,href:m.href}));}s.sort((d,m)=>{if(d.position!==m.position)return d.position-m.position;let f=(O,F)=>O==="link_open"?0:O==="open"?1:O==="close"?2:O==="link_close"?3:4,g=d.type==="close"||d.type==="link_close",S=m.type==="close"||m.type==="link_close",i=f(d.type,g),b=f(m.type,S);return i!==b?i-b:d.type==="open"&&m.type==="open"?d.spanIndex-m.spanIndex:d.type==="close"&&m.type==="close"?m.spanIndex-d.spanIndex:d.spanIndex-m.spanIndex});let l="",p=0,u=[];for(let d of s){if(d.position>p){let m=n.text.slice(p,d.position);l+=a?a(m):m;}if(d.type==="open"||d.type==="close"){let m=o[d.style];if(m)if(d.type==="open")l+=m.open,u.push(d);else {l+=m.close,d.style==="code_block"&&d.position<n.text.length&&(l+=`
|
|
38
|
+
`);let f=u.findIndex(g=>g.spanIndex===d.spanIndex&&g.type==="open");f!==-1&&u.splice(f,1);}}else if(d.type==="link_open")l+="[",u.push(d);else if(d.type==="link_close"){l+="]("+d.href+")";let m=u.findIndex(f=>f.spanIndex===d.spanIndex&&f.type==="link_open");m!==-1&&u.splice(m,1);}p=d.position;}if(p<n.text.length){let d=n.text.slice(p);l+=a?a(d):d;}return l}catch(n){return console.error("Markdown render error:",n),""}}function fe(t,e){return Me(t,e)}f();function yr(t){let e=t.replace(/\r\n/g,`
|
|
39
39
|
`).replace(/\r/g,`
|
|
40
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
|
|
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 De(t,e){try{let n=typeof t=="string"?t:"",r=lt.parse(e??{});if(!n)return "";let{frontmatter:o,content:a}=yr(n),c=de(a,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),s=fe(c);return s=s.replace(/\n{3,}/g,`
|
|
42
42
|
|
|
43
43
|
`),s=s.trimEnd()+`
|
|
44
44
|
`,r.preserveFrontmatter&&o&&(s=o+`
|
|
45
|
-
`+s),s}catch(n){return console.error("Markdown format error:",n),t}}
|
|
46
|
-
`).trim(),linesConsumed:r-e}}function
|
|
47
|
-
`),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let
|
|
45
|
+
`+s),s}catch(n){return console.error("Markdown format error:",n),t}}f();function kr(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function wr(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 Sr(t){try{let e=Yt.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 a=r.trim();if(!a)continue;let c=wr(o);c&&(n[a]=c);}return n}catch{return null}}function Tr(t,e){let n=[],r=e+1;for(;r<t.length;){let a=t[r];if(!a){r+=1;continue}if(a.length>0&&!a.startsWith(" ")&&!a.startsWith(" "))break;n.push(a),r+=1;}return {value:n.join(`
|
|
46
|
+
`).trim(),linesConsumed:r-e}}function Mr(t){let e={},n=t.split(`
|
|
47
|
+
`),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let a=o.match(/^([\w-]+):\s*(.*)$/);if(!a?.[1]||!a[2]){r+=1;continue}let c=a[1],s=a[2].trim();if(!c){r+=1;continue}if(!s&&r+1<n.length){let p=n[r+1];if(p&&(p.startsWith(" ")||p.startsWith(" "))){let{value:u,linesConsumed:d}=Tr(n,r);u&&(e[c]={value:u,kind:"multiline",rawInline:s}),r+=d;continue}}let l=kr(s);l&&(e[c]={value:l,kind:"inline",rawInline:s}),r+=1;}return e}function Ir(t){let e={};for(let[n,r]of Object.entries(t))e[n]=r.value;return e}function vr(t){return /^[|>][+-]?(\d+)?[+-]?$/.test(t)}function Rr(t){let{lineEntry:e,yamlValue:n}=t;return n.kind!=="structured"||e.kind!=="inline"||vr(e.rawInline)?false:e.value.includes(":")}function Pr(t){let e=t.replace(/\r\n/g,`
|
|
48
48
|
`).replace(/\r/g,`
|
|
49
49
|
`);if(!e.startsWith("---"))return;let n=e.indexOf(`
|
|
50
|
-
---`,3);if(n!==-1)return e.slice(4,n)}function
|
|
51
|
-
${
|
|
52
|
-
---`}catch(e){return console.warn("Failed to serialize frontmatter:",e),""}}function
|
|
50
|
+
---`,3);if(n!==-1)return e.slice(4,n)}function Ie(t){try{if(typeof t!="string")return {};let e=Pr(t);if(!e)return {};let n=Mr(e),r=Sr(e);if(r===null)return Ir(n);let o={};for(let[a,c]of Object.entries(r)){o[a]=c.value;let s=n[a];s&&Rr({lineEntry:s,yamlValue:c})&&(o[a]=s.value);}for(let[a,c]of Object.entries(n))a in o||(o[a]=c.value);return o}catch(e){return console.warn("Failed to parse frontmatter:",e),{}}}function Ne(t){try{let e=ut.parse(t);if(Object.keys(e).length===0)return "";let n={};for(let[o,a]of Object.entries(e))try{let c=JSON.parse(a);n[o]=c;}catch{n[o]=a;}return `---
|
|
51
|
+
${Yt.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
|
|
52
|
+
---`}catch(e){return console.warn("Failed to serialize frontmatter:",e),""}}function ze(t){try{if(typeof t!="string")return {frontmatter:{},content:""};let e=t.replace(/\r\n/g,`
|
|
53
53
|
`).replace(/\r/g,`
|
|
54
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:
|
|
56
|
-
`,o),a
|
|
57
|
-
Content-Type: ${
|
|
55
|
+
---`,3);if(n===-1)return {frontmatter:{},content:t};let r=e.slice(4,n),o=e.slice(n+4).trimStart();return {frontmatter:Ie(t),content:o}}catch(e){return console.warn("Failed to extract frontmatter:",e),{frontmatter:{},content:t}}}f();f();function Be(t){try{let e=z.string().parse(t),n=[],r,o=0;for(;o<=e.length;){let a=e.indexOf(`
|
|
56
|
+
`,o),c=a===-1?e.length:a,s=e.slice(o,c),l=s.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(l){let p=l[1],u=l[2];if(!p||!u){o=c+1;continue}let d=u[0];if(!d){o=c+1;continue}let m=u.length;if(!r)r={start:o,markerChar:d,markerLen:m,openLine:s,marker:u,indent:p};else if(r.markerChar===d&&m>=r.markerLen){let f=c;n.push({start:r.start,end:f,openLine:r.openLine,marker:r.marker,indent:r.indent}),r=void 0;}}if(a===-1)break;o=a+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 mt(t,e){let n=0,r=t.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),a=t[o];if(!a)break;if(e<=a.start){r=o-1;continue}if(e>=a.end){n=o+1;continue}return a}}function Vt(t,e){return !mt(t,e)}function je(){return {open:false,ticks:0}}function We(t,e){try{let n=z.string().parse(t),r=e?Le.parse(e):je(),o=Be(n),a={open:r.open,ticks:r.ticks},{spans:c,state:s}=Fr(n,o,a);return {inlineState:s,isInside:l=>_r(l,o)||Lr(l,c)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:je(),isInside:()=>false}}}function Fr(t,e,n){let r=[],o=n.open,a=n.ticks,c=o?0:-1,s=0;for(;s<t.length;){let l=Cr(e,s);if(l){s=l.end;continue}if(t[s]!=="`"){s+=1;continue}let p=s,u=0;for(;s<t.length&&t[s]==="`";)u+=1,s+=1;if(!o){o=true,a=u,c=p;continue}u===a&&(r.push([c,s]),o=false,a=0,c=-1);}return o&&r.push([c,t.length]),{spans:r,state:{open:o,ticks:a}}}function Cr(t,e){return t.find(n=>e>=n.start&&e<n.end)}function _r(t,e){return e.some(n=>t>=n.start&&t<n.end)}function Lr(t,e){return e.some(([n,r])=>t>=n&&t<r)}f();var $r={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function He(t,e){try{let n=z.string().parse(t),r=Se.parse(e);if(!n||r==="off")return n;let{ir:o,hasTables:a}=Te(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return a?Me(o,{styleMarkers:$r,escapeText:c=>c,buildLink:(c,s)=>{let l=c.href.trim();return !l||!s.slice(c.start,c.end)?null:{start:c.start,end:c.end,open:"[",close:`](${l})`}}}):n}catch(n){return console.warn("Invalid input for convertMarkdownTables:",n),typeof t=="string"?t:""}}var ht;(p=>{function t(u,d){try{return de(u,d)}catch(m){return console.warn("Markdown.parse error:",m),{text:"",styles:[],links:[]}}}p.parse=t;function e(u,d){try{return fe(u,d)}catch(m){return console.warn("Markdown.render error:",m),""}}p.render=e;function n(u,d){try{return De(u,d)}catch(m){return console.warn("Markdown.format error:",m),typeof u=="string"?u:""}}p.format=n;function r(u){try{return Ie(u)}catch(d){return console.warn("Markdown.parseFrontmatter error:",d),{}}}p.parseFrontmatter=r;function o(u){try{return Ne(u)}catch(d){return console.warn("Markdown.serializeFrontmatter error:",d),""}}p.serializeFrontmatter=o;function a(u){try{return ze(u)}catch(d){return console.warn("Markdown.extractFrontmatter error:",d),{frontmatter:{},content:typeof u=="string"?u:""}}}p.extractFrontmatter=a;function c(u,d,m){try{return ce(u,d,m)}catch(f){return console.warn("Markdown.chunk error:",f),typeof u=="string"&&u.length>0?[u]:[]}}p.chunk=c;function s(u,d){try{return We(u,d)}catch(m){return console.warn("Markdown.buildCodeIndex error:",m),{inlineState:{open:false,ticks:0},isInside:()=>false}}}p.buildCodeIndex=s;function l(u,d){try{return He(u,d)}catch(m){return console.warn("Markdown.convertTables error:",m),typeof u=="string"?u:""}}p.convertTables=l;})(ht||(ht={}));f();function Xt(t){if(!t)return "";let n=t.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function Dr(t){if(!t)return "";let n=t.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function Nr(t){if(!t)return "";let e=t.split(".");return e[e.length-1]}function zr(t,e=20){let n=Xt(t);if(n.length<=e)return n;let r=n.lastIndexOf("."),o=r<=0?"":n.slice(r),a=e-o.length-1;return a<=0?n.slice(0,e-1)+"\u2026":n.slice(0,a)+"\u2026"+o}function Br(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)}f();var jr=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function Wr(t){if(!t)return false;let e=String(t instanceof Error?t.message:t).toLowerCase();return jr.some(n=>e.includes(n))}async function gt(t,e={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:a=1e4,retryIf:c=Wr}=e,s;for(let l=0;l<n;l++)try{return await t()}catch(p){if(s=p,l===n-1||!c(p))throw p;let u=Math.min(r*o**l,a);await new Promise(d=>setTimeout(d,u));}throw s}f();var bt;(v=>{let t=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})}v.hasProxyConfigured=o;function a(){let x=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||x}v.getProxyUrl=a;function c(x={}){let y=x.httpProxy||x.httpsProxy||a();if(!y){t.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let R=new ProxyAgent({uri:y,connectTimeout:x.connectTimeout||1e4,keepAliveTimeout:x.keepAliveTimeout||3e4});r=getGlobalDispatcher(),setGlobalDispatcher(R),n=true,t.info(`[Fetch] Global proxy enabled: ${y}`);}v.enableProxy=c;function s(){!n||!r||(setGlobalDispatcher(r),n=false,r=null,t.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}v.disableProxy=s;function l(){return n}v.isProxyEnabled=l;async function p(x,y){let R=y?.timeout||3e4,B=y?.responseType||"json",{timeout:N,responseType:G,...j}=y||{},P=null,$=null;try{j.signal||(P=new AbortController,$=setTimeout(()=>P.abort(),R));let E=await fetch(x,{...j,signal:j.signal||P.signal});$&&clearTimeout($);let _;switch(B){case "arrayBuffer":_=await E.arrayBuffer();break;case "blob":_=await E.blob();break;case "buffer":{let J=await E.arrayBuffer();_=Buffer.from(J);break}case "text":_=await E.text();break;default:{let J=await E.text();try{_=JSON.parse(J);}catch{_=J;}break}}return {ok:E.ok,status:E.status,statusText:E.statusText,headers:E.headers,data:_,url:E.url}}catch(E){throw $&&clearTimeout($),E}}async function u(x,y){let R=y?.retries??0,B=y?.retryDelay??1e3,{retries:N,retryDelay:G,responseType:j,...P}=y||{};return gt(()=>p(x,{...P,responseType:y?.responseType}),{attempts:R+1,delay:B,maxDelay:B*2**(R+1)})}async function d$1(x,y){return u(x,{method:"GET",...y})}v.get=d$1;async function m$1(x,y,R){return u(x,{method:"POST",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}v.post=m$1;async function f(x,y,R){return u(x,{method:"PUT",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}v.put=f;async function g(x,y,R){return u(x,{method:"DELETE",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}v.del=g;async function S(x,y,R){return u(x,{method:"PATCH",headers:{"Content-Type":"application/json",...R?.headers},body:y?JSON.stringify(y):void 0,...R})}v.patch=S;async function i(x,y){return u(x,y)}v.request=i;function b(x={}){return o()?(c(x),true):false}v.autoProxy=b;let O=5*1024*1024;function F(x){return new TextEncoder().encode(x)}function q(x){return d.mimeType(x)}function L(x){return x.startsWith("file://")}async function A(x){let y=fileURLToPath(x);return await D.file(y).bytes()}async function z(x,y,R){let B=`----FetchFormBoundary${Date.now()}`,N=[],j=y.some(D=>D.filename||D.value instanceof Uint8Array||Buffer.isBuffer(D.value))&&!R?.timeout?3e5:R?.timeout;for(let D of y){let V=D.maxSize??O,X=D.filename,Q=`Content-Disposition: form-data; name="${D.name}"${X?`; filename="${X}"`:""}`;X&&(Q+=`\r
|
|
57
|
+
Content-Type: ${q(X)}`),Q+=`\r
|
|
58
58
|
\r
|
|
59
|
-
`,
|
|
60
|
-
--${
|
|
61
|
-
--${
|
|
62
|
-
`),
|
|
63
|
-
`));for(let
|
|
64
|
-
`)));
|
|
65
|
-
`);
|
|
59
|
+
`,N.push(F(Q));let U=D.value;if(typeof U=="string")if(L(U)){let me=await A(U);if(X||(X=U.split("/").pop()||"file"),me.byteLength>V)throw new Error(`File size ${me.byteLength} exceeds limit ${V} bytes: ${X}`);N.push(me);}else N.push(F(U));else if(Buffer.isBuffer(U)){if(U.byteLength>V)throw new Error(`Buffer size ${U.byteLength} exceeds limit ${V} bytes: ${D.name}`);N.push(new Uint8Array(U.buffer,U.byteOffset,U.byteLength));}else if(U instanceof Uint8Array){if(U.byteLength>V)throw new Error(`File size ${U.byteLength} exceeds limit ${V} bytes: ${D.name}`);N.push(U);}}let P=F(`\r
|
|
60
|
+
--${B}--`),$=F(`\r
|
|
61
|
+
--${B}\r
|
|
62
|
+
`),E=[];E.push(F(`--${B}\r
|
|
63
|
+
`));for(let D=0;D<N.length;D++)E.push(N[D]),D%2===1&&D<N.length-1&&(E.push($),E.push(F(`--${B}\r
|
|
64
|
+
`)));E.push(P);let _=E.reduce((D,V)=>D+V.length,0),J=new Uint8Array(_),ae=0;for(let D of E)J.set(D,ae),ae+=D.length;return u(x,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${B}`,...R?.headers},body:J,timeout:j,...R})}v.postForm=z;function H(x,y,R){let B=new AbortController,N=B.signal;return (async()=>{try{let j={Accept:"text/event-stream",...R?.headers||{}},P=await fetch(x,{...R,headers:j,signal:N});if(!P.ok)throw new Error(`SSE connection failed: ${P.status}`);let $=P.body?.getReader();if(!$)throw new Error("SSE stream not available");let E=new TextDecoder("utf-8"),_="";for(;!N.aborted;){let{done:J,value:ae}=await $.read();if(J)break;let D=E.decode(ae,{stream:!0});_+=D;let V=_.split(`
|
|
65
|
+
`);_=V.pop()??"";for(let X of V)if(X.startsWith("data: ")){let Q=X.slice(6);if(Q==="[DONE]"){y.onComplete?.();return}y.onMessage?.(Q);}}y.onComplete?.();}catch(j){j.name!=="AbortError"&&y.onError?.(j);}})(),()=>{B.abort();}}v.sse=H;})(bt||(bt={}));f();var xt;(r=>{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 n(){return [t[Math.floor(Math.random()*t.length)],e[Math.floor(Math.random()*e.length)]].join("-")}r.create=n;})(xt||(xt={}));f();function Jt(t){let e=new AbortController,n=setTimeout(e.abort.bind(e),t);return {controller:e,signal:e.signal,clearTimeout:()=>globalThis.clearTimeout(n)}}function Gr(t,...e){let n=Jt(t);return {signal:AbortSignal.any([n.signal,...e]),clearTimeout:n.clearTimeout}}f();var yt;(e=>{async function t(n,r){if(process.platform==="win32"){let o=ot.resolve(n),a=ot.resolve(r),c=`Expand-Archive -Path '${o}' -DestinationPath '${a}' -Force`,s=await G.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${c}"`);if(s.code!==0)throw new Error(`PowerShell exited with code ${s.code}: ${s.stderr}`)}else {let o=`unzip -o -q ${n} -d ${r}`,a=await G.run(void 0,o);if(a.code!==0)throw new Error(`unzip exited with code ${a.code}: ${a.stderr}`)}}e.extractZip=t;})(yt||(yt={}));f();var kt;(r=>{function t(o){return o?/^#[0-9a-fA-F]{6}$/.test(o):false}r.isValidHex=t;function e(o){let a=parseInt(o.slice(1,3),16),c=parseInt(o.slice(3,5),16),s=parseInt(o.slice(5,7),16);return {r:a,g:c,b:s}}r.hexToRgb=e;function n(o){if(!t(o))return;let{r:a,g:c,b:s}=e(o);return `\x1B[38;2;${a};${c};${s}m\x1B[1m`}r.hexToAnsiBold=n;})(kt||(kt={}));f();var wt;(n=>{class t extends Error{constructor(a){super(`No context found for ${a}`);c(this,"name",a);}}n.NotFound=t;function e(r){let o=new AsyncLocalStorage;return {use(){let a=o.getStore();if(!a)throw new t(r);return a},provide(a,c){return o.run(a,c)}}}n.create=e;})(wt||(wt={}));f();function Vr(t){return {[Symbol.dispose](){t();},[Symbol.asyncDispose](){return Promise.resolve(t())}}}f();var St;(e=>{async function t(){return new Promise(n=>{let r=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?n():setImmediate(r);};r();})}e.wait=t;})(St||(St={}));f();function Xr(t){if(t<=0)return "";if(t<60)return `${t}s`;if(t<3600){let n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}if(t<86400){let n=Math.floor(t/3600),r=Math.floor(t%3600/60);return r>0?`${n}h ${r}m`:`${n}h`}if(t<604800){let n=Math.floor(t/86400);return n===1?"~1 day":`~${n} days`}let e=Math.floor(t/604800);return e===1?"~1 week":`~${e} weeks`}f();var Tt;(S=>{let t=m.create({service:"grep"});async function e(){return n()}S.filepath=e;let n=b(async()=>{let i=await D.which("rg");if(!i)return null;try{if(!(await ve.stat(i)).isFile())return null}catch{return null}try{let b=await D.run([i,"--version"],{timeout:5e3});if(b.code!==0||!b.stdout.startsWith("ripgrep "))return t.warn("rg failed self-test, falling back to pure JS",{filepath:i,code:b.code,stderr:b.stderr.slice(0,200)}),null}catch(b){return t.warn("rg spawn failed during self-test, falling back to pure JS",{filepath:i,error:b.message.slice(0,200)}),null}return i});async function r(){return await e()!==null}S.isUsingRipgrep=r;async function*o(i){i.signal?.throwIfAborted();let b=await e();b?yield*a$2(b,i):(t.debug("ripgrep not available, using pure JS fallback for files()",{cwd:i.cwd}),yield*c(i));}S.files=o;async function*a$2(i,b){b.signal?.throwIfAborted();let O=["--files","--glob=!.git/*"];b.follow&&O.push("--follow");let F=b.hidden!==false;if(b.maxDepth!==void 0&&O.push(`--max-depth=${b.maxDepth}`),b.glob)for(let A of b.glob)O.push(`--glob=${A}`);try{if(!(await ve.stat(b.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${b.cwd}'`),{code:"ENOTDIR",errno:-20,path:b.cwd})}catch(A){throw A.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${b.cwd}'`),{code:"ENOENT",errno:-2,path:b.cwd}):A}let q=await D.run([i,...O],{cwd:b.cwd});if(q.code!==0&&q.code!==1)return;let L=q.stdout.split(/\r?\n/);for(let A of L){b.signal?.throwIfAborted();let z=A.trim();if(!z)continue;let H=d.toUnixPath(z);!F&&H.split("/").some(v=>v.startsWith("."))||(yield H);}}async function*c(i){i.signal?.throwIfAborted();try{if(!(await ve.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(v){throw v.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):v}let b=[],O=[];if(i.glob)for(let v of i.glob)v.startsWith("!")?O.push(v.slice(1)):b.push(v);let F=b.length>0?b:["**/*"],q=i.hidden!==false,L=new Set,A=b$2.DEFAULT_MAX_DEPTH,z;i.maxDepth===void 0?z=A:i.maxDepth<0?z=1:z=i.maxDepth+1;let H=Math.min(Math.max(z,1),A);for(let v of F){i.signal?.throwIfAborted();let x=await b$2.scan(v,{cwd:i.cwd,absolute:false,include:"file",dot:q,symlink:i.follow??false,maxDepth:H,ignore:O});for(let y of x)!q&&y.split("/").some(R=>R.startsWith("."))||L.add(y);}for(let v of Array.from(L).sort())i.signal?.throwIfAborted(),yield v;i.signal?.throwIfAborted();}async function s(i){t.debug("tree",{cwd:i.cwd}),i.signal?.throwIfAborted();let b=i.hidden!==false,O=i.glob??[],F=O.filter(P=>!P.startsWith("!")),q=O.filter(P=>P.startsWith("!")).map(P=>P.slice(1)),L=F.length>0?F:["**/*"],A=new Set,z=[];for(let P of L){i.signal?.throwIfAborted();let $=await b$2.scan(P,{cwd:i.cwd,absolute:false,include:"file",dot:b,symlink:false,maxDepth:b$2.DEFAULT_MAX_DEPTH});for(let E of $)A.has(E)||(A.add(E),z.push(E));}let H=z.filter(P=>{for(let $ of q)if(b$2.match($,P))return false;return true});function v(P,$){let E=P.children.get($);if(E)return E;let _={name:$,children:new Map};return P.children.set($,_),_}let x={children:new Map};for(let P of H){let $=P.split("/");if($.length<2)continue;let E=x;for(let _ of $.slice(0,-1))E=v(E,_);}let y=Array.from(x.children.values()).sort((P,$)=>P.name.localeCompare($.name)),R=i.limit??Number.POSITIVE_INFINITY,B=[],N=y.map(P=>({node:P,path:P.name})),G=0,j=0;for(;N.length>0;){let P=N.shift();if(!P)break;if(G++,j<R){B.push(P.path),j++;for(let $ of Array.from(P.node.children.values()).sort((E,_)=>E.name.localeCompare(_.name))){if(j>=R)break;N.push({node:$,path:`${P.path}/${$.name}`});}}}return G>j&&B.push(`[${j}/${G} shown, ${G-j} truncated]`),B.join(`
|
|
66
|
+
`)}S.tree=s;async function l(i){let b=await e();return b?p(b,i):(t.debug("ripgrep not available, using pure JS fallback for search()",{cwd:i.cwd,pattern:i.pattern}),u(i))}S.search=l;async function p(i,b){let O=["--json","--glob=!.git/*"];if(b.follow&&O.push("--follow"),b.glob)for(let z of b.glob)O.push(`--glob=${z}`);b.limit&&O.push(`--max-count=${b.limit}`),O.push("--"),O.push(b.pattern);let F=await D.run([i,...O],{cwd:b.cwd});if(F.code!==0)return [];let q=b.hidden!==false,L=F.stdout.split(/\r?\n/).filter(Boolean),A=[];for(let z of L)try{let H=JSON.parse(z);if(H?.type!=="match")continue;let v=H.data;if(!v?.path?.text||!v?.lines?.text)continue;let x=d.toUnixPath(v.path.text);if(!q&&x.split("/").some(y=>y.startsWith(".")))continue;if(A.push({path:x,lines:v.lines.text,line_number:v.line_number,absolute_offset:v.absolute_offset??0}),b.limit&&A.length>=b.limit)break}catch{}return A}async function u(i){let b;try{b=new RegExp(i.pattern);}catch{return []}try{if(!(await ve.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(v){throw v.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):v}let O=[],F=[];if(i.glob)for(let v of i.glob)v.startsWith("!")?F.push(v.slice(1)):O.push(v);let q=i.hidden!==false,L=[],A=O.length>0?O:["**/*"],z=new Set,H=[];for(let v of A){i.signal?.throwIfAborted();let x=await b$2.scan(v,{cwd:i.cwd,absolute:false,include:"file",dot:q,symlink:i.follow??false,maxDepth:void 0,ignore:F});for(let y of x)z.has(y)||(z.add(y),H.push(y));}for(let v of H){if(i.signal?.throwIfAborted(),i.limit&&L.length>=i.limit)break;let x=d.join(i.cwd,v),y;try{y=await ve.readFile(x,"utf-8");}catch{continue}let R=y.split(/\r?\n/),B=0;for(let N=0;N<R.length;N++){let G=R[N]??"";if(b.test(G)&&(L.push({path:v,lines:G,line_number:N+1,absolute_offset:B}),i.limit&&L.length>=i.limit))break;B+=Buffer.byteLength(G,"utf-8")+1;}}return L}function d$1(i,b){return a$1.match(i,b)}S.match=d$1;let m$1=a(async()=>await e());async function f(){return await m$1()}S.filepathCached=f,S._ready=a(async()=>{let i=await e();return t.debug("Grep initialized",{ripgrep:i?"available":"fallback (pure JS)"}),i});})(Tt||(Tt={}));f();var Mt;(c=>{function t(s,l){if(s===l)return true;if(typeof s!="object"||typeof l!="object"||s===null||l===null)return false;let p=Object.keys(s),u=Object.keys(l);if(p.length!==u.length)return false;for(let d of p)if(!u.includes(d)||!t(s[d],l[d]))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}c.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}}c.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 p=l.join("+");return s.leader&&(p=p?`<leader> ${p}`:"<leader>"),p}c.keyToString=o;function a(s){return s==="none"?[]:s.split(",").map(l=>{let u=l.replace(/<leader>/g,"leader+").toLowerCase().split("+"),d={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let m of u)switch(m){case "ctrl":d.ctrl=true;break;case "alt":case "meta":case "option":d.meta=true;break;case "super":d.super=true;break;case "shift":d.shift=true;break;case "leader":d.leader=true;break;case "esc":d.name="escape";break;default:d.name=m;break}return d})}c.parse=a;})(Mt||(Mt={}));f();var pe;(m=>{m.SUPPORTED_LANGS=["zh-CN","en-US"],m.DEFAULT_LANG="zh-CN";function n(f,g="EASBOT_LANG"){let S=[f,process.env[g]?.trim()];for(let i of S)if(i&&m.SUPPORTED_LANGS.includes(i))return i;return m.DEFAULT_LANG}m.resolveLocaleLang=n;function r(f){return f.replace(/\b\w/g,g=>g.toUpperCase())}m.titlecase=r;function o(f){return new Date(f).toLocaleTimeString(void 0,{timeStyle:"short"})}m.time=o;function a(f){let g=new Date(f),S=o(f),i=g.toLocaleDateString();return `${S} \xB7 ${i}`}m.datetime=a;function c(f){let g=new Date(f),S=new Date;return g.getFullYear()===S.getFullYear()&&g.getMonth()===S.getMonth()&&g.getDate()===S.getDate()?o(f):a(f)}m.todayTimeOrDateTime=c;function s(f){return f>=1e6?(f/1e6).toFixed(1)+"M":f>=1e3?(f/1e3).toFixed(1)+"K":f.toString()}m.number=s;function l(f){if(f<1e3)return `${f}ms`;if(f<6e4)return `${(f/1e3).toFixed(1)}s`;if(f<36e5){let i=Math.floor(f/6e4),b=Math.floor(f%6e4/1e3);return `${i}m ${b}s`}if(f<864e5){let i=Math.floor(f/36e5),b=Math.floor(f%36e5/6e4);return `${i}h ${b}m`}let g=Math.floor(f/36e5);return `${Math.floor(f%36e5/864e5)}d ${g}h`}m.duration=l;function p(f,g){return f.length<=g?f:f.slice(0,g-1)+"\u2026"}m.truncate=p;function u(f,g=35){if(f.length<=g)return f;let S="\u2026",i=Math.ceil((g-S.length)/2),b=Math.floor((g-S.length)/2);return f.slice(0,i)+S+f.slice(-b)}m.truncateMiddle=u;function d(f,g,S){return (f===1?g:S).replace("{}",f.toString())}m.pluralize=d;})(pe||(pe={}));var Kr=pe.resolveLocaleLang,Jr=pe.SUPPORTED_LANGS,Zr=pe.DEFAULT_LANG;f();var Qr=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function eo(){return Qr.some(t=>process.env[t])}function to(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function no(){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)}}f();var It=class{constructor(){c(this,"queue",[]);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 ro(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);}}));}f();function oo(){let t,e=new Promise(n=>t=n);return {trigger(){return t()},wait(){return e}}}f();function so(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);})])}f();var vt;(c=>{let n=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function r(s){if(!s)return 0;let l=String(s),p=(l.match(n)||[]).length,u=l.length-p,d=Math.round(p/1.5),m=Math.round(u/4);return Math.max(0,d+m)}c.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}}c.estimateObject=o;function a(s){if(s.total!==void 0&&s.total>0)return s.total;let l=s.input??0,p=s.output??0,u=s.cache?.read??0,d=s.cache?.write??0;return l+p+u+d}c.total=a;})(vt||(vt={}));f();function ao(t){let e={},n=t.shape??t.required().shape;for(let[r,o]of Object.entries(n))e[r]=o.nullable().optional();return Fe.object(e)}f();var uo=new Writable({write(t,e,n){n();}}),Re;(m=>{m.cancelSymbol=Symbol("CliSearch.cancel");function e(f){let g=0;for(let S of f){let i=S.codePointAt(0);if(i===void 0||i===0)continue;let b=i>=4352&&i<=4447||i>=8986&&i<=8987||i>=9001&&i<=9002||i>=9193&&i<=9196||i===9200||i===9203||i>=9725&&i<=9726||i>=9748&&i<=9749||i>=9800&&i<=9811||i===9855||i===9875||i===9889||i>=9898&&i<=9899||i>=9917&&i<=9918||i>=9924&&i<=9925||i===9934||i===9940||i===9962||i>=9970&&i<=9971||i===9973||i===9978||i===9981||i===9989||i>=9994&&i<=9995||i===10024||i===10060||i===10062||i>=10067&&i<=10069||i===10071||i>=10133&&i<=10135||i===10160||i===10175||i>=11035&&i<=11036||i===11088||i===11093||i>=11904&&i<=42191&&i!==12351||i>=43360&&i<=43388||i>=44032&&i<=55203||i>=63744&&i<=64255||i>=65040&&i<=65049||i>=65072&&i<=65135||i>=65280&&i<=65376||i>=65504&&i<=65510||i>=126976&&i<=129535;g+=b?2:1;}return g}m.approxStringWidth=e;function n(f,g){let S=stripVTControlCharacters(f),i=Math.max(1,g),b=e(S);return Math.max(1,Math.ceil(b/i))}m.visualRowsForLine=n;function r(f,g){let S=g!==void 0&&g>0?g:process.stdout.columns&&process.stdout.columns>0?process.stdout.columns:80,i=0;for(let b of f)i+=n(b,S);return i}m.countVisualRowsForLines=r;function o(f){let g=new Array(f.length);for(let S=0;S<f.length;S++){let i=f[S],b=i.value===null||i.value===void 0?"":String(i.value);g[S]={...i,searchKey:`${i.label}
|
|
67
|
+
${b}`.toLowerCase()};}return g}function a(f,g){return g===""||f.searchKey.includes(g)}function c(f,g){return g<=0||f<0?0:f>=g?g-1:f}function s(f){if(f?.length!==1)return false;let g=f.codePointAt(0);return !(g===void 0||g<32||g===127||g===27)}function l(){let f=process.stdout.rows;if(!f||f<=0)return 8;let g=Math.floor((f-8)/2);return Math.max(5,Math.min(15,g))}function p(f,g){try{f.write(g);}catch{}}function u(f){if(f&&f.isTTY&&typeof f.setRawMode=="function")try{f.setRawMode(!1);}catch{}}function d(f){let g=f.message,S=o(f.items),i=Math.max(1,f.maxVisible??l()),b=f.initialSelected??[],O=f.required??false,F=f.lockedSection;return new Promise(q=>{let L=process.stdin,A=process.stdout,z=Ue.createInterface({input:L,output:uo,terminal:false});try{L.isTTY&&L.setRawMode?.(!0);}catch{}Ue.emitKeypressEvents(L,z);let H="",v="",x=0,y=new Set(b),R=0,B=false,N=F?F.items.map(C=>C.value):[],G=F?F.items.map(C=>C.label):[],j=[],P=()=>{if(j.length=0,v==="")for(let C=0;C<S.length;C++){let k=S[C];j.push(k);}else for(let C=0;C<S.length;C++){let k=S[C];a(k,v)&&j.push(k);}return j},$=()=>{if(R>0){p(A,`\x1B[${R}A`);for(let C=0;C<R;C++)p(A,"\x1B[2K\x1B[1B");p(A,`\x1B[${R}A`);}},E=()=>{let C=G.slice();for(let k=0;k<S.length;k++){let W=S[k];y.has(W.value)&&C.push(W.label);}return C},_=(C="active")=>{$();let k=[],W=P(),qe=C==="active"||C==="error"?"\u25C6":C==="cancel"?"\u25A0":"\u25C7",tn=C==="cancel"?T.red(qe):C==="error"?T.red(qe):T.green(qe);if(k.push(`${tn} ${T.bold(g)}`),C==="active"||C==="error"){if(F&&F.items.length>0){k.push(T.dim("\u2502"));let re=`${T.bold(F.title)} ${T.dim("\u2500\u2500 always included")}`;k.push(`${T.dim("\u2502")} ${T.dim("\u2500\u2500")} ${re} ${T.dim("\u2500".repeat(12))}`);for(let ge of F.items)k.push(`${T.dim("\u2502")} ${T.green("\u2022")} ${T.bold(ge.label)}`);F.hiddenCount&&F.hiddenCount>0&&k.push(`${T.dim("\u2502")} ${T.dim(`...and ${F.hiddenCount} more`)}`),k.push(T.dim("\u2502")),k.push(`${T.dim("\u2502")} ${T.dim("\u2500\u2500")} ${T.bold("Additional agents")} ${T.dim("\u2500".repeat(29))}`);}let Ge=`${T.dim("\u2502")} ${T.dim("Search:")} ${H}${T.inverse(" ")}`;k.push(Ge),k.push(`${T.dim("\u2502")} ${T.dim("\u2191\u2193 move \xB7 space select \xB7 enter confirm")}`),k.push(T.dim("\u2502"));let nn=Math.max(0,W.length-i),rn=x-Math.floor(i/2),Ye=Math.max(0,Math.min(rn,nn)),Pt=Math.min(W.length,Ye+i);if(W.length===0)k.push(`${T.dim("\u2502")} ${T.dim("No matches found")}`);else {for(let ee=Ye;ee<Pt;ee++){let be=W[ee],on=y.has(be.value),Ot=ee===x,sn=on?T.green("\u25CF"):T.dim("\u25CB"),an=Ot?T.underline(be.label):be.label,cn=be.hint?T.dim(` (${be.hint})`):"",ln=Ot?T.cyan("\u276F"):" ";k.push(`${T.dim("\u2502")} ${ln} ${sn} ${an}${cn}`);}let re=Ye,ge=W.length-Pt;if(re>0||ge>0){let ee=[];re>0&&ee.push(`\u2191 ${re} more`),ge>0&&ee.push(`\u2193 ${ge} more`),k.push(`${T.dim("\u2502")} ${T.dim(ee.join(" "))}`);}}k.push(T.dim("\u2502"));let he=E();if(he.length===0)k.push(`${T.dim("\u2502")} ${T.dim("Selected: (none)")}`);else {let re=he.length<=3?he.join(", "):`${he.slice(0,3).join(", ")} +${he.length-3} more`;k.push(`${T.dim("\u2502")} ${T.green("Selected:")} ${re}`);}C==="error"&&k.push(`${T.dim("\u2502")} ${T.red("\u26A0 Please select at least one item before submitting")}`),k.push(`${T.dim("\u2514")}`);}else if(C==="submit"){let Ge=E();k.push(`${T.dim("\u2502")} ${T.dim(Ge.join(", "))}`);}else k.push(`${T.dim("\u2502")} ${T.strikethrough(T.dim("Cancelled"))}`);p(A,`${k.join(`
|
|
68
|
+
`)}
|
|
69
|
+
`);try{R=r(k,A.columns);}catch{R=k.length;}},J=false,ae=()=>{if(!J){J=true;try{L.removeListener("keypress",Rt),L.removeListener("end",Q);}catch{}try{process.removeListener("SIGINT",U),process.removeListener("SIGTERM",U);}catch{}u(L);try{z.close();}catch{}}},D=C=>{B||(B=true,ae(),q(C));},V=()=>{if(O&&y.size===0&&N.length===0){_("error");return}_("submit"),D([...N,...Array.from(y)]);},X=()=>{_("cancel"),D(m.cancelSymbol);},Q=()=>{X();},U=()=>{u(L);},me=C=>{let k=C[x];k&&(y.has(k.value)?y.delete(k.value):y.add(k.value));},Qt=C=>{H+=C,v+=C.toLowerCase();},en=()=>{H.length!==0&&(H=H.slice(0,-1),v=v.slice(0,-1));},Rt=(C,k)=>{if(!k)return;let W=P();if(x=c(x,W.length),k.name==="return"){V();return}if(k.name==="escape"||k.ctrl&&k.name==="c"){X();return}if(k.name==="up"||k.name==="left"){W.length>0&&(x=c(x-1,W.length),_());return}if(k.name==="down"||k.name==="right"){W.length>0&&(x=c(x+1,W.length),_());return}if(k.name==="pageup"){W.length>0&&(x=c(x-i,W.length),_());return}if(k.name==="pagedown"){W.length>0&&(x=c(x+i,W.length),_());return}if(k.name==="home"){W.length>0&&(x=0,_());return}if(k.name==="end"){W.length>0&&(x=W.length-1,_());return}if(k.name==="space"){me(W),_();return}if(k.name==="backspace"){H.length>0&&(en(),x=0,_());return}!k.ctrl&&!k.meta&&s(k.sequence)&&(Qt(k.sequence),x=0,_());};L.on("keypress",Rt),L.once("end",Q),process.on("SIGINT",U),process.on("SIGTERM",U),_();})}m.multiselect=d;})(Re||(Re={}));Re.cancelSymbol;Re.multiselect;export{yt as Archive,It as AsyncQueue,Ke as Binary,Re as CliSearch,kt as Color,wt as Context,Zr as DEFAULT_LANG,Je as Encode,St as EventLoop,bt as Fetch,rt as Fn,Tt as Grep,ne as Identifier,tt as Ignore,Mt as Keybind,pe as Locale,ht as Markdown,et as NamedError,Jr as SUPPORTED_LANGS,Qe as SessionTitle,xt as Slug,vt as Token,Ze as TruncateContent,Jt as abortAfter,Gr as abortAfterAny,We as buildCodeSpanIndex,Gt as chunkMarkdownIR,ce as chunkText,it as chunkTextByBreakResolver,He as convertMarkdownTables,je as createInlineCodeState,Vr as defer,ze as extractFrontmatter,mt as findFenceSpanAt,Cn as findLast,$n as fn,Xr as formatDuration,De as formatMarkdown,Dr as getDirectory,Nr as getFileExtension,Xt as getFilename,zr as getFilenameTruncated,no as getProxyConfig,to as getProxyUrl,Bn as git,Yn as iife,Vt as isSafeFenceBreak,zn as loadEnv,qn as loadTextFile,Gn as loadTextFileAsync,de as markdownToIR,Te as markdownToIRWithMeta,Be as parseFenceSpans,Ie as parseFrontmatterBlock,Vn as parseModelId,eo as proxied,fe as renderMarkdown,Me as renderMarkdownWithMarkers,Kr as resolveLocaleLang,gt as retry,st as scanParenAwareBreakpoints,Ne as serializeFrontmatter,oo as signal,Br as truncateMiddle,ao as updateSchema,so as withTimeout,ro as work};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Shared utilities library for EASBOT ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
"@hono/standard-validator": "^0.2.2",
|
|
47
47
|
"@hono/zod-validator": "^0.7.6",
|
|
48
48
|
"dotenv": "^17.4.2",
|
|
49
|
+
"picocolors": "1.1.1",
|
|
50
|
+
"glob": "^13.0.6",
|
|
49
51
|
"hono": "^4.12.18",
|
|
50
52
|
"hono-openapi": "^1.3.0",
|
|
51
53
|
"markdown-it": "^14.1.1",
|
|
@@ -54,10 +56,9 @@
|
|
|
54
56
|
"xdg-basedir": "^5.1.0",
|
|
55
57
|
"yaml": "^2.9.0",
|
|
56
58
|
"zod": "^4.4.3",
|
|
57
|
-
"@easbot/types": "0.3.
|
|
59
|
+
"@easbot/types": "0.3.11"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
|
-
"@biomejs/biome": "^2.4.14",
|
|
61
62
|
"@types/markdown-it": "^14.1.2",
|
|
62
63
|
"@types/node": "^25.6.2",
|
|
63
64
|
"@types/ws": "^8.18.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b,a}from'./chunk-DAYGB2XR.mjs';import {k}from'./chunk-V6YNYGNC.mjs';import ft,{mkdir,readFile,writeFile,chmod}from'fs/promises';import {existsSync,statSync,createWriteStream,realpathSync}from'fs';import {extname,basename,resolve,relative,sep}from'path';import {Readable}from'stream';import {pipeline}from'stream/promises';import B from'os';k();k();k();function tt(e,n){let r=new Set,i=0;for(;i<e.length;){let c=e[i];if(e[i+1]==="-"&&i+2<e.length){let l=e[i+2],g=c.charCodeAt(0),h=l.charCodeAt(0);if(g>h)return null;for(let u=g;u<=h;u++)r.add(String.fromCharCode(u));i+=3;}else r.add(c),i++;}return {kind:"class",chars:r,negate:n}}function A(e){let n=[],r="",i=0;for(;i<e.length;){let c=e[i];if(c==="\\"&&i+1<e.length){r+=e[i+1],i+=2;continue}if(c==="["){let a=e.indexOf("]",i+1);if(a!==-1){let l=e.slice(i+1,a),g=false,h=0;(l.startsWith("!")||l.startsWith("^"))&&(g=true,h=1);let u=tt(l.slice(h),g);if(u){r&&(n.push({kind:"literal",text:r}),r=""),n.push(u),i=a+1;continue}}}r+=c,i++;}return r&&n.push({kind:"literal",text:r}),n}function et(e){let n=nt(e);if(n===-1)return null;let r=it(e,n);if(r===-1)return null;let i=e.slice(n+1,r),c=rt(i);if(!c)return null;let a=e.slice(0,n),l=e.slice(r+1),g=[];for(let h of c)g.push(a+h+l);return g}function nt(e){for(let n=0;n<e.length;n++){if(e[n]==="\\"&&n+1<e.length){n++;continue}if(e[n]==="{")return n}return -1}function it(e,n){let r=1;for(let i=n+1;i<e.length;i++){if(e[i]==="\\"&&i+1<e.length){i++;continue}if(e[i]==="{")r++;else if(e[i]==="}"&&(r--,r===0))return i}return -1}function rt(e){let n=[],r="",i=0;for(let c=0;c<e.length;c++){let a=e[c];if(a==="\\"&&c+1<e.length){r+=e[c+1],c++;continue}if(a==="{")i++,r+=a;else if(a==="}"){if(i--,r+=a,i<0)return null}else a===","&&i===0?(n.push(r),r=""):r+=a;}return i!==0?null:(n.push(r),n)}function ot(e){let n=et(e);return n?[{kind:"brace",alternatives:n.map(i=>I(i))}]:I(e)}function I(e,n=false){let r=[],i="",c=0,a=n?e.length-2:e.length;for(;c<a;){let l=e[c];if(l==="\\"&&c+1<a){i+=e[c+1],c+=2;continue}if(l==="*"&&e[c+1]==="*"&&(c+2>=a||e[c+2]==="/")&&(c===0||e[c-1]==="/")){i&&(r.push(...A(i)),i=""),r.push({kind:"starstar"}),c+=2,e[c]==="/"&&c++;continue}if(l==="*"){i&&(r.push(...A(i)),i=""),r.push({kind:"star"}),c++;continue}if(l==="?"){i&&(r.push(...A(i)),i=""),r.push({kind:"question"}),c++;continue}i+=l,c++;}return i&&r.push(...A(i)),r}function st(e){let n=0;for(;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){n+=2;continue}if(r===" ")return e[n+1]==="*"&&n+2===e.length;n++;}return false}function E(e,n,r=0,i=0){for(;r<e.length;){let c=e[r];if(c.kind==="literal"){if(!n.startsWith(c.text,i))return false;i+=c.text.length;}else if(c.kind==="star"){let a=r+1;for(;a<e.length&&e[a].kind==="star";)a++;if(a>=e.length){for(let l=i;l<n.length;l++)if(n[l]==="/")return false;return true}for(let l=i;l<=n.length;l++){if(E(e,n,a,l))return true;if(n[l]==="/")break}return false}else if(c.kind==="starstar"){let a=r+1;for(;a<e.length&&e[a].kind==="starstar";)a++;if(a>=e.length)return true;for(let l=i;l<=n.length;l++)if(E(e,n,a,l))return true;return false}else if(c.kind==="question"){if(i>=n.length||n[i]==="/")return false;i++;}else if(c.kind==="class"){let a=n[i];if(a===void 0||c.chars.has(a)===c.negate)return false;i++;}else if(c.kind==="brace"){for(let a of c.alternatives)if(E(a,n,0,i))return true;return false}r++;}return i===n.length}function F(e){return e.sort((n,r)=>{let i=n[0].length-r[0].length;return i!==0?i:n[0].localeCompare(r[0])})}var z=new Map,at=1024;function H(e){let n=z.get(e);if(n)return n;let r=ot(e);if(z.size>=at){let i=z.keys().next().value;i!==void 0&&z.delete(i);}return z.set(e,r),r}var v;(c=>{function e(a,l){if(!l)return a==="";try{if(n(a,l))return !0;if(st(l)){let g=l.slice(0,-2);if(n(a,g))return !0}return !1}catch{return false}}c.match=e;function n(a,l){if(!a)return lt(l);let g=H(l);return E(g,a)}function r(a,l){let g=F(Object.entries(l)),h;for(let[u,m]of g)e(a,u)&&(h=m);return h}c.all=r;function i(a,l){let g=F(Object.entries(l)),h;for(let[u,m]of g){let x=u.split(/\s+/);x.length!==0&&e(a.head,x[0])&&(x.length===1||ct(a.tail,x.slice(1)))&&(h=m);}return h}c.allStructured=i;})(v||(v={}));function ct(e,n){if(n.length===0)return true;if(e.length<n.length)return false;for(let r=0;r<n.length;r++)if(!v.match(e[r],n[r]))return false;return true}function lt(e){let n=H(e);return E(n,"")}var W;(h=>{function e(u){return {...u,follow:u.symlink??false,nodir:u.include!=="all",maxDepth:u.maxDepth??20}}async function n(u,m={}){return b(u,e(m))}h.scan=n;function r(u,m={}){return a(u,e(m))}h.scanSync=r;function i(u,m){return v.match(m,u)}h.match=i;async function c(u){try{let m=await ft.readFile(u,"utf-8");return a$1(m)}catch{return []}}h.parseGitignore=c;function a$1(u){let m=[],x=u.split(/\r?\n/);for(let P of x){let T=P.trim();if(!T||T.startsWith("#")||T.startsWith("!"))continue;let b=T;b.endsWith("/")&&(b=`${b}**`),!b.includes("*")&&!b.includes("?")&&!b.includes("[")&&(b=`**/${b}/**`),m.push(b);}return m}h.parseGitignoreContent=a$1;function l(u,m){let x=u.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"");for(let P of m)if(v.match(x,P)||v.match(x,`${P}/**`))return true;return false}h.isIgnored=l,h.DEFAULT_IGNORE_PATTERNS=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/__pycache__/**","**/*.min.js","**/*.min.ts","**/coverage/**","**/data/**","**/*.db","**/logs/**","**/*.log","**/.DS_Store","**/Thumbs.db"];})(W||(W={}));var St=sep,U=St==="\\";var V={".html":"text/html",".htm":"text/html",".css":"text/css",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml",".toml":"application/toml",".ini":"text/plain",".cfg":"text/plain",".conf":"text/plain",".log":"text/plain",".sh":"text/x-sh",".bash":"text/x-bash",".zsh":"text/x-zsh",".fish":"text/x-fish",".ps1":"text/x-powershell",".bat":"text/x-batch",".cmd":"text/x-batch",".dockerfile":"text/x-dockerfile",".makefile":"text/x-makefile",".properties":"text/plain",".js":"application/javascript",".mjs":"application/javascript",".cjs":"application/javascript",".jsx":"text/javascript",".ts":"application/typescript",".tsx":"text/typescript",".mts":"application/typescript",".json":"application/json",".jsonc":"application/json",".json5":"application/json",".webmanifest":"application/manifest+json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".webp":"image/webp",".avif":"image/avif",".heic":"image/heic",".heif":"image/heif",".bmp":"image/bmp",".tiff":"image/tiff",".tif":"image/tiff",".mp4":"video/mp4",".webm":"video/webm",".ogg":"video/ogg",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".mov":"video/quicktime",".mp3":"audio/mpeg",".wav":"audio/wav",".flac":"audio/flac",".aac":"audio/aac",".opus":"audio/opus",".m4a":"audio/mp4",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".rtf":"application/rtf",".epub":"application/epub+zip",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".tgz":"application/gzip",".bz2":"application/x-bzip2",".xz":"application/x-xz",".7z":"application/x-7z-compressed",".rar":"application/vnd.rar",".wasm":"application/wasm",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".db":"application/x-sqlite3",".sqlite":"application/vnd.sqlite3",".proto":"application/protobuf"},yt=Object.fromEntries(Object.entries(V).map(([e,n])=>[n,e])),Y;(Ot=>{async function e(t,o){await mkdir(t,{recursive:o?.recursive??true});}Ot.mkdir=e;async function n(t){return existsSync(t)}Ot.exists=n;async function r(t){try{return statSync(t).isDirectory()}catch{return false}}Ot.isDir=r;function i(t){return statSync(t,{throwIfNoEntry:false})??void 0}Ot.stat=i;async function c(t){let o=i(t)?.size??0;return typeof o=="bigint"?Number(o):o}Ot.size=c;async function a(t){return readFile(t,"utf-8")}Ot.readText=a;async function l(t){return JSON.parse(await readFile(t,"utf-8"))}Ot.readJson=l;async function g(t){return readFile(t)}Ot.readBytes=g;async function h(t){let o=await readFile(t);return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}Ot.readArrayBuffer=h;function u(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="ENOENT"}async function m(t,o,s){try{s?await writeFile(t,o,{mode:s}):await writeFile(t,o);}catch(f){if(u(f)){await mkdir(j(t),{recursive:true}),s?await writeFile(t,o,{mode:s}):await writeFile(t,o);return}throw f}}Ot.write=m;async function x(t,o,s){return m(t,JSON.stringify(o,null,2),s)}Ot.writeJson=x;async function P(t,o,s){let f=j(t);existsSync(f)||await mkdir(f,{recursive:true});let p=o instanceof ReadableStream?Readable.fromWeb(o):o,d=createWriteStream(t);await pipeline(p,d),s&&await chmod(t,s);}Ot.writeStream=P;function T(t){let o=extname(t).toLowerCase();return V[o]||"application/octet-stream"}Ot.mimeType=T;function b(t){return yt[t]}Ot.mimeTypeToExt=b;function wt(t){return t?!!(t.startsWith("text/")||t==="application/json"||t==="application/json5"||t==="application/jsonc"||t==="application/xml"||t==="application/javascript"||t==="application/typescript"||t==="application/x-javascript"||t==="application/yaml"||t==="application/x-yaml"||t==="application/toml"||t==="application/x-sh"||t==="application/x-bash"||t==="application/x-zsh"||t==="application/x-powershell"||t==="application/x-batch"||t==="application/x-dockerfile"||t==="application/x-makefile"):false}Ot.isTextMime=wt;function j(t){if(!t||t.length===0)return ".";let o=y(t);if(o=o.replace(/\/+$/,""),!o||o===""||o==="/")return "/";let s=o.lastIndexOf("/");return s===-1?".":s===0?"/":o.slice(0,s)}Ot.dirname=j;function vt(t,o){if(!t||t.length===0)return "";let s=y(t);if(s=s.replace(/\/+$/,""),!s||s===""||s==="/")return "";let f=s.lastIndexOf("/"),p=f===-1?s:s.slice(f+1);return p?(o&&p.endsWith(o)&&(p=p.slice(0,-o.length)),p):""}Ot.basename=vt;function kt(t){if(!t)return "";let o=y(t);if(!o)return "";let s=basename(o);if(!s||s===".")return "";let f=s.lastIndexOf(".");return f===-1||f===0?"":s.slice(f)}Ot.extname=kt;function y(t){return t?t.replace(/\\/g,"/"):""}Ot.toUnixPath=y;function S(t){if(!t||t.length===0)return B.homedir();if(U&&(t=D(t)),t.startsWith("~/")||t==="~"?t=O(B.homedir(),t.slice(1)):R(t)||(t=resolve(t)),t=y(t),U)try{t=realpathSync.native(t),t=y(t);}catch{}return t}Ot.normalize=S;function Ct(t){return !t||t.length===0?B.homedir():(U&&(t=D(t)),t.startsWith("~/")||t==="~"?t=O(B.homedir(),t.slice(1)):R(t)||(t=resolve(t)),y(t))}Ot.resolve=Ct;function R(t){return !!(t.startsWith("/")||/^[a-zA-Z]:[/\\]/.test(t)||/^[a-zA-Z]:$/.test(t))}Ot.isAbsolute=R;function O(t,...o){let s=y(t);for(let f of o){let p=y(f);R(p)?s=p:(s.endsWith("/")||(s+="/"),s+=p);}return s.replace(/\\/g,"/")}Ot.join=O;function D(t){return process.platform!=="win32"?t:t.replace(/^\/([a-zA-Z]):(?:[\\/]|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/cygdrive\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/mnt\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`)}Ot.windowsPath=D;function Pt(t,o){let s=S(t),f=S(o),p=relative(s,f),d=relative(f,s);return !p?.startsWith("..")||!d?.startsWith("..")}Ot.overlaps=Pt;function Tt(t,o){let s=S(t),f=S(o);return !relative(s,f).startsWith("..")}Ot.contains=Tt;async function jt(t,o,s){let f=S(o),p=s?S(s):void 0,d=[];for(;;){let w=O(f,t);if(await n(w)&&d.push(w),p&&f===p)break;let k=j(f);if(k===f)break;f=k;}return d}Ot.findUp=jt;async function*zt(t){let{targets:o,start:s,stop:f}=t,p=S(s),d=f?S(f):void 0;for(;;){for(let k of o){let q=O(p,k);await n(q)&&(yield q);}if(d&&p===d)break;let w=j(p);if(w===p)break;p=w;}}Ot.up=zt;async function Et(t,o,s){let f=S(o),p=s?S(s):void 0,d=[];for(;;){try{let k=await W.scan(t,{cwd:f,absolute:!0,include:"file",dot:!0});d.push(...k);}catch{}if(p&&f===p)break;let w=j(f);if(w===f)break;f=w;}return d}Ot.globUp=Et;})(Y||(Y={}));
|
|
2
|
-
export{v as a,W as b,V as c,Y as d};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkAHO55TRS_cjs=require('./chunk-AHO55TRS.cjs'),chunkVRQQ33YH_cjs=require('./chunk-VRQQ33YH.cjs'),lt=require('fs/promises'),fs=require('fs'),path=require('path'),stream=require('stream'),promises=require('stream/promises'),B=require('os');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var lt__default=/*#__PURE__*/_interopDefault(lt);var B__default=/*#__PURE__*/_interopDefault(B);chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function V(e,n){let r=new Set,i=0;for(;i<e.length;){let c=e[i];if(e[i+1]==="-"&&i+2<e.length){let l=e[i+2],g=c.charCodeAt(0),h=l.charCodeAt(0);if(g>h)return null;for(let u=g;u<=h;u++)r.add(String.fromCharCode(u));i+=3;}else r.add(c),i++;}return {kind:"class",chars:r,negate:n}}function A(e){let n=[],r="",i=0;for(;i<e.length;){let c=e[i];if(c==="\\"&&i+1<e.length){r+=e[i+1],i+=2;continue}if(c==="["){let a=e.indexOf("]",i+1);if(a!==-1){let l=e.slice(i+1,a),g=false,h=0;(l.startsWith("!")||l.startsWith("^"))&&(g=true,h=1);let u=V(l.slice(h),g);if(u){r&&(n.push({kind:"literal",text:r}),r=""),n.push(u),i=a+1;continue}}}r+=c,i++;}return r&&n.push({kind:"literal",text:r}),n}function tt(e){let n=et(e);if(n===-1)return null;let r=nt(e,n);if(r===-1)return null;let i=e.slice(n+1,r),c=it(i);if(!c)return null;let a=e.slice(0,n),l=e.slice(r+1),g=[];for(let h of c)g.push(a+h+l);return g}function et(e){for(let n=0;n<e.length;n++){if(e[n]==="\\"&&n+1<e.length){n++;continue}if(e[n]==="{")return n}return -1}function nt(e,n){let r=1;for(let i=n+1;i<e.length;i++){if(e[i]==="\\"&&i+1<e.length){i++;continue}if(e[i]==="{")r++;else if(e[i]==="}"&&(r--,r===0))return i}return -1}function it(e){let n=[],r="",i=0;for(let c=0;c<e.length;c++){let a=e[c];if(a==="\\"&&c+1<e.length){r+=e[c+1],c++;continue}if(a==="{")i++,r+=a;else if(a==="}"){if(i--,r+=a,i<0)return null}else a===","&&i===0?(n.push(r),r=""):r+=a;}return i!==0?null:(n.push(r),n)}function rt(e){let n=tt(e);return n?[{kind:"brace",alternatives:n.map(i=>I(i))}]:I(e)}function I(e,n=false){let r=[],i="",c=0,a=n?e.length-2:e.length;for(;c<a;){let l=e[c];if(l==="\\"&&c+1<a){i+=e[c+1],c+=2;continue}if(l==="*"&&e[c+1]==="*"&&(c+2>=a||e[c+2]==="/")&&(c===0||e[c-1]==="/")){i&&(r.push(...A(i)),i=""),r.push({kind:"starstar"}),c+=2,e[c]==="/"&&c++;continue}if(l==="*"){i&&(r.push(...A(i)),i=""),r.push({kind:"star"}),c++;continue}if(l==="?"){i&&(r.push(...A(i)),i=""),r.push({kind:"question"}),c++;continue}i+=l,c++;}return i&&r.push(...A(i)),r}function ot(e){let n=0;for(;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){n+=2;continue}if(r===" ")return e[n+1]==="*"&&n+2===e.length;n++;}return false}function E(e,n,r=0,i=0){for(;r<e.length;){let c=e[r];if(c.kind==="literal"){if(!n.startsWith(c.text,i))return false;i+=c.text.length;}else if(c.kind==="star"){let a=r+1;for(;a<e.length&&e[a].kind==="star";)a++;if(a>=e.length){for(let l=i;l<n.length;l++)if(n[l]==="/")return false;return true}for(let l=i;l<=n.length;l++){if(E(e,n,a,l))return true;if(n[l]==="/")break}return false}else if(c.kind==="starstar"){let a=r+1;for(;a<e.length&&e[a].kind==="starstar";)a++;if(a>=e.length)return true;for(let l=i;l<=n.length;l++)if(E(e,n,a,l))return true;return false}else if(c.kind==="question"){if(i>=n.length||n[i]==="/")return false;i++;}else if(c.kind==="class"){let a=n[i];if(a===void 0||c.chars.has(a)===c.negate)return false;i++;}else if(c.kind==="brace"){for(let a of c.alternatives)if(E(a,n,0,i))return true;return false}r++;}return i===n.length}function F(e){return e.sort((n,r)=>{let i=n[0].length-r[0].length;return i!==0?i:n[0].localeCompare(r[0])})}var z=new Map,st=1024;function J(e){let n=z.get(e);if(n)return n;let r=rt(e);if(z.size>=st){let i=z.keys().next().value;i!==void 0&&z.delete(i);}return z.set(e,r),r}exports.a=void 0;(c=>{function e(a,l){if(!l)return a==="";try{if(n(a,l))return !0;if(ot(l)){let g=l.slice(0,-2);if(n(a,g))return !0}return !1}catch{return false}}c.match=e;function n(a,l){if(!a)return ct(l);let g=J(l);return E(g,a)}function r(a,l){let g=F(Object.entries(l)),h;for(let[u,m]of g)e(a,u)&&(h=m);return h}c.all=r;function i(a,l){let g=F(Object.entries(l)),h;for(let[u,m]of g){let x=u.split(/\s+/);x.length!==0&&e(a.head,x[0])&&(x.length===1||at(a.tail,x.slice(1)))&&(h=m);}return h}c.allStructured=i;})(exports.a||(exports.a={}));function at(e,n){if(n.length===0)return true;if(e.length<n.length)return false;for(let r=0;r<n.length;r++)if(!exports.a.match(e[r],n[r]))return false;return true}function ct(e){let n=J(e);return E(n,"")}exports.b=void 0;(h=>{function e(u){return {...u,follow:u.symlink??false,nodir:u.include!=="all",maxDepth:u.maxDepth??20}}async function n(u,m={}){return chunkAHO55TRS_cjs.b(u,e(m))}h.scan=n;function r(u,m={}){return chunkAHO55TRS_cjs.a(u,e(m))}h.scanSync=r;function i(u,m){return exports.a.match(m,u)}h.match=i;async function c(u){try{let m=await lt__default.default.readFile(u,"utf-8");return a(m)}catch{return []}}h.parseGitignore=c;function a(u){let m=[],x=u.split(/\r?\n/);for(let P of x){let T=P.trim();if(!T||T.startsWith("#")||T.startsWith("!"))continue;let b=T;b.endsWith("/")&&(b=`${b}**`),!b.includes("*")&&!b.includes("?")&&!b.includes("[")&&(b=`**/${b}/**`),m.push(b);}return m}h.parseGitignoreContent=a;function l(u,m){let x=u.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"");for(let P of m)if(exports.a.match(x,P)||exports.a.match(x,`${P}/**`))return true;return false}h.isIgnored=l,h.DEFAULT_IGNORE_PATTERNS=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/__pycache__/**","**/*.min.js","**/*.min.ts","**/coverage/**","**/data/**","**/*.db","**/logs/**","**/*.log","**/.DS_Store","**/Thumbs.db"];})(exports.b||(exports.b={}));var bt=path.sep,U=bt==="\\";var Y={".html":"text/html",".htm":"text/html",".css":"text/css",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml",".toml":"application/toml",".ini":"text/plain",".cfg":"text/plain",".conf":"text/plain",".log":"text/plain",".sh":"text/x-sh",".bash":"text/x-bash",".zsh":"text/x-zsh",".fish":"text/x-fish",".ps1":"text/x-powershell",".bat":"text/x-batch",".cmd":"text/x-batch",".dockerfile":"text/x-dockerfile",".makefile":"text/x-makefile",".properties":"text/plain",".js":"application/javascript",".mjs":"application/javascript",".cjs":"application/javascript",".jsx":"text/javascript",".ts":"application/typescript",".tsx":"text/typescript",".mts":"application/typescript",".json":"application/json",".jsonc":"application/json",".json5":"application/json",".webmanifest":"application/manifest+json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".webp":"image/webp",".avif":"image/avif",".heic":"image/heic",".heif":"image/heif",".bmp":"image/bmp",".tiff":"image/tiff",".tif":"image/tiff",".mp4":"video/mp4",".webm":"video/webm",".ogg":"video/ogg",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".mov":"video/quicktime",".mp3":"audio/mpeg",".wav":"audio/wav",".flac":"audio/flac",".aac":"audio/aac",".opus":"audio/opus",".m4a":"audio/mp4",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".rtf":"application/rtf",".epub":"application/epub+zip",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".tgz":"application/gzip",".bz2":"application/x-bzip2",".xz":"application/x-xz",".7z":"application/x-7z-compressed",".rar":"application/vnd.rar",".wasm":"application/wasm",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".db":"application/x-sqlite3",".sqlite":"application/vnd.sqlite3",".proto":"application/protobuf"},St=Object.fromEntries(Object.entries(Y).map(([e,n])=>[n,e]));exports.d=void 0;(Et=>{async function e(t,o){await lt.mkdir(t,{recursive:o?.recursive??true});}Et.mkdir=e;async function n(t){return fs.existsSync(t)}Et.exists=n;async function r(t){try{return fs.statSync(t).isDirectory()}catch{return false}}Et.isDir=r;function i(t){return fs.statSync(t,{throwIfNoEntry:false})??void 0}Et.stat=i;async function c(t){let o=i(t)?.size??0;return typeof o=="bigint"?Number(o):o}Et.size=c;async function a(t){return lt.readFile(t,"utf-8")}Et.readText=a;async function l(t){return JSON.parse(await lt.readFile(t,"utf-8"))}Et.readJson=l;async function g(t){return lt.readFile(t)}Et.readBytes=g;async function h(t){let o=await lt.readFile(t);return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}Et.readArrayBuffer=h;function u(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="ENOENT"}async function m(t,o,s){try{s?await lt.writeFile(t,o,{mode:s}):await lt.writeFile(t,o);}catch(f){if(u(f)){await lt.mkdir(j(t),{recursive:true}),s?await lt.writeFile(t,o,{mode:s}):await lt.writeFile(t,o);return}throw f}}Et.write=m;async function x(t,o,s){return m(t,JSON.stringify(o,null,2),s)}Et.writeJson=x;async function P(t,o,s){let f=j(t);fs.existsSync(f)||await lt.mkdir(f,{recursive:true});let p=o instanceof ReadableStream?stream.Readable.fromWeb(o):o,d=fs.createWriteStream(t);await promises.pipeline(p,d),s&&await lt.chmod(t,s);}Et.writeStream=P;function T(t){let o=path.extname(t).toLowerCase();return Y[o]||"application/octet-stream"}Et.mimeType=T;function b(t){return St[t]}Et.mimeTypeToExt=b;function yt(t){return t?!!(t.startsWith("text/")||t==="application/json"||t==="application/json5"||t==="application/jsonc"||t==="application/xml"||t==="application/javascript"||t==="application/typescript"||t==="application/x-javascript"||t==="application/yaml"||t==="application/x-yaml"||t==="application/toml"||t==="application/x-sh"||t==="application/x-bash"||t==="application/x-zsh"||t==="application/x-powershell"||t==="application/x-batch"||t==="application/x-dockerfile"||t==="application/x-makefile"):false}Et.isTextMime=yt;function j(t){if(!t||t.length===0)return ".";let o=y(t);if(o=o.replace(/\/+$/,""),!o||o===""||o==="/")return "/";let s=o.lastIndexOf("/");return s===-1?".":s===0?"/":o.slice(0,s)}Et.dirname=j;function wt(t,o){if(!t||t.length===0)return "";let s=y(t);if(s=s.replace(/\/+$/,""),!s||s===""||s==="/")return "";let f=s.lastIndexOf("/"),p=f===-1?s:s.slice(f+1);return p?(o&&p.endsWith(o)&&(p=p.slice(0,-o.length)),p):""}Et.basename=wt;function vt(t){if(!t)return "";let o=y(t);if(!o)return "";let s=path.basename(o);if(!s||s===".")return "";let f=s.lastIndexOf(".");return f===-1||f===0?"":s.slice(f)}Et.extname=vt;function y(t){return t?t.replace(/\\/g,"/"):""}Et.toUnixPath=y;function S(t){if(!t||t.length===0)return B__default.default.homedir();if(U&&(t=D(t)),t.startsWith("~/")||t==="~"?t=O(B__default.default.homedir(),t.slice(1)):R(t)||(t=path.resolve(t)),t=y(t),U)try{t=fs.realpathSync.native(t),t=y(t);}catch{}return t}Et.normalize=S;function kt(t){return !t||t.length===0?B__default.default.homedir():(U&&(t=D(t)),t.startsWith("~/")||t==="~"?t=O(B__default.default.homedir(),t.slice(1)):R(t)||(t=path.resolve(t)),y(t))}Et.resolve=kt;function R(t){return !!(t.startsWith("/")||/^[a-zA-Z]:[/\\]/.test(t)||/^[a-zA-Z]:$/.test(t))}Et.isAbsolute=R;function O(t,...o){let s=y(t);for(let f of o){let p=y(f);R(p)?s=p:(s.endsWith("/")||(s+="/"),s+=p);}return s.replace(/\\/g,"/")}Et.join=O;function D(t){return process.platform!=="win32"?t:t.replace(/^\/([a-zA-Z]):(?:[\\/]|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/cygdrive\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/mnt\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`)}Et.windowsPath=D;function Ct(t,o){let s=S(t),f=S(o),p=path.relative(s,f),d=path.relative(f,s);return !p?.startsWith("..")||!d?.startsWith("..")}Et.overlaps=Ct;function Pt(t,o){let s=S(t),f=S(o);return !path.relative(s,f).startsWith("..")}Et.contains=Pt;async function Tt(t,o,s){let f=S(o),p=s?S(s):void 0,d=[];for(;;){let w=O(f,t);if(await n(w)&&d.push(w),p&&f===p)break;let k=j(f);if(k===f)break;f=k;}return d}Et.findUp=Tt;async function*jt(t){let{targets:o,start:s,stop:f}=t,p=S(s),d=f?S(f):void 0;for(;;){for(let k of o){let q=O(p,k);await n(q)&&(yield q);}if(d&&p===d)break;let w=j(p);if(w===p)break;p=w;}}Et.up=jt;async function zt(t,o,s){let f=S(o),p=s?S(s):void 0,d=[];for(;;){try{let k=await exports.b.scan(t,{cwd:f,absolute:!0,include:"file",dot:!0});d.push(...k);}catch{}if(p&&f===p)break;let w=j(f);if(w===f)break;f=w;}return d}Et.globUp=zt;})(exports.d||(exports.d={}));
|
|
2
|
-
exports.c=Y;
|