hwjcode-personal 1.1.130 → 1.1.131
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/bundle/hwjcode.js +4 -4
- package/bundle/package.json +1 -1
- package/package.json +2 -1
package/bundle/hwjcode.js
CHANGED
|
@@ -2186,7 +2186,7 @@ ${e.format(r)}`.trim())}};Ibr.exports=Fst});var Rst=He((VMi,bbr)=>{"use strict";
|
|
|
2186
2186
|
${s}`;break;case"retry":KGr(s)&&(r[i]=s);break;case"id":$Gr(s)&&(r[i]=s);break;case"event":s.length>0&&(r[i]=s);break}}processEvent(e){e.retry&&KGr(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&$Gr(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};egr.exports={EventSourceStream:Mot}});var cgr=He((RUi,lgr)=>{"use strict";var{pipeline:F0n}=Ct("node:stream"),{fetching:w0n}=Vse(),{makeRequest:R0n}=wU(),{webidl:G2}=Rp(),{EventSourceStream:A0n}=tgr(),{parseMIMEType:E0n}=cZ(),{createFastMessageEvent:x0n}=QWe(),{isNetworkError:rgr}=xse(),{kEnumerableProperty:lS}=hs(),{environmentSettingsObject:agr}=_1(),ngr=!1,igr=3e3,Jse=0,sgr=1,Bse=2,C0n="anonymous",Y0n="use-credentials",XU=class a extends EventTarget{#e={open:null,error:null,message:null};#t;#r=!1;#a=Jse;#i=null;#n=null;#c;#o;constructor(e,r={}){super(),G2.util.markAsUncloneable(this);let n="EventSource constructor";G2.argumentLengthCheck(arguments,1,n),ngr||(ngr=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=G2.converters.USVString(e),r=G2.converters.EventSourceInitDict(r,n,"eventSourceInitDict"),this.#c=r.node.dispatcher||r.dispatcher,this.#o={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let i=agr,s;try{s=new URL(e,i.settingsObject.baseUrl),this.#o.origin=s.origin}catch(d){throw new DOMException(d,"SyntaxError")}this.#t=s.href;let t=C0n;r.withCredentials===!0&&(t=Y0n,this.#r=!0);let o={redirect:"follow",keepalive:!0,mode:"cors",credentials:t==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};o.client=agr.settingsObject,o.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],o.cache="no-store",o.initiator="other",o.urlList=[new URL(this.#t)],this.#i=R0n(o),this.#s()}get readyState(){return this.#a}get url(){return this.#t}get withCredentials(){return this.#r}#s(){if(this.#a===Bse)return;this.#a=Jse;let e={request:this.#i,dispatcher:this.#c},r=n=>{if(!rgr(n))return this.#I()};e.processResponseEndOfBody=r,e.processResponse=n=>{if(rgr(n))if(n.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#I();return}let i=n.headersList.get("content-type",!0),s=i!==null?E0n(i):"failure",t=s!=="failure"&&s.essence==="text/event-stream";if(n.status!==200||t===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#a=sgr,this.dispatchEvent(new Event("open")),this.#o.origin=n.urlList[n.urlList.length-1].origin;let o=new A0n({eventSourceSettings:this.#o,push:d=>{this.dispatchEvent(x0n(d.type,d.options))}});F0n(n.body.stream,o,d=>{d?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#n=w0n(e)}#I(){this.#a!==Bse&&(this.#a=Jse,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#a===Jse&&(this.#o.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#o.lastEventId,!0),this.#s())},this.#o.reconnectionTime)?.unref())}close(){G2.brandCheck(this,a),this.#a!==Bse&&(this.#a=Bse,this.#n.abort(),this.#i=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open);let r=G2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("open",r),this.#e.open=e):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message);let r=G2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("message",r),this.#e.message=e):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error);let r=G2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("error",r),this.#e.error=e):this.#e.error=null}},ogr={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Jse,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:sgr,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Bse,writable:!1}};Object.defineProperties(XU,ogr);Object.defineProperties(XU.prototype,ogr);Object.defineProperties(XU.prototype,{close:lS,onerror:lS,onmessage:lS,onopen:lS,readyState:lS,url:lS,withCredentials:lS});G2.converters.EventSourceInitDict=G2.dictionaryConverter([{key:"withCredentials",converter:G2.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:G2.converters.any},{key:"node",converter:G2.dictionaryConverter([{key:"reconnectionTime",converter:G2.converters["unsigned long"],defaultValue:()=>igr},{key:"dispatcher",converter:G2.converters.any}]),defaultValue:()=>({})}]);lgr.exports={EventSource:XU,defaultReconnectionTime:igr}});var _We=He((AUi,Wn)=>{"use strict";var V0n=ZV(),dgr=Lie(),Q0n=S6(),H0n=P0r(),X0n=$0r(),k0n=B6(),S0n=Eit(),L0n=Fit(),J0n=Smr(),B0n=Mmr(),T0n=_mr(),Igr=zi(),zWe=hs(),{InvalidArgumentError:UWe}=Igr,kU=Epr(),D0n=R6(),O0n=mst(),{MockCallHistory:M0n,MockCallHistoryLog:U0n}=fst(),z0n=wst(),_0n=yst(),P0n=Abr(),j0n=qit(),q0n=TNe(),{getGlobalDispatcher:hgr,setGlobalDispatcher:K0n}=aWe(),$0n=vU(),emn=Qst();Object.assign(dgr.prototype,kU);Wn.exports.Dispatcher=dgr;Wn.exports.Client=V0n;Wn.exports.Pool=Q0n;Wn.exports.BalancedPool=H0n;Wn.exports.RoundRobinPool=X0n;Wn.exports.Agent=k0n;Wn.exports.ProxyAgent=S0n;Wn.exports.Socks5ProxyAgent=L0n;Wn.exports.EnvHttpProxyAgent=J0n;Wn.exports.RetryAgent=B0n;Wn.exports.H2CClient=T0n;Wn.exports.RetryHandler=q0n;Wn.exports.DecoratorHandler=$0n;Wn.exports.RedirectHandler=emn;Wn.exports.interceptors={redirect:Lbr(),responseError:Bbr(),retry:Dbr(),dump:Mbr(),dns:Pbr(),cache:Rfr(),decompress:Yfr(),deduplicate:kfr()};Wn.exports.cacheStores={MemoryCacheStore:Pst()};var tmn=Jfr();Wn.exports.cacheStores.SqliteCacheStore=tmn;Wn.exports.buildConnector=D0n;Wn.exports.errors=Igr;Wn.exports.util={parseHeaders:zWe.parseHeaders,headerNameToString:zWe.headerNameToString};function Tse(a){return(e,r,n)=>{if(typeof r=="function"&&(n=r,r=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new UWe("invalid url");if(r!=null&&typeof r!="object")throw new UWe("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new UWe("invalid opts.path");let t=r.path;r.path.startsWith("/")||(t=`/${t}`),e=new URL(zWe.parseOrigin(e).origin+t)}else r||(r=typeof e=="object"?e:{}),e=zWe.parseURL(e);let{agent:i,dispatcher:s=hgr()}=r;if(i)throw new UWe("unsupported opts.agent. Did you mean opts.client?");return a.call(s,{...r,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:r.method||(r.body?"PUT":"GET")},n)}}Wn.exports.setGlobalDispatcher=K0n;Wn.exports.getGlobalDispatcher=hgr;var rmn=Vse().fetch,ugr=typeof __filename<"u"?__filename:void 0;function mgr(a,e){if(!a||typeof a!="object")return;let r=typeof a.stack=="string"?a.stack:"",n=e.replace(/\\/g,"/");if(r&&(r.includes(e)||r.includes(n)))return;let i={};if(Error.captureStackTrace(i,mgr),!i.stack)return;let s=i.stack.split(`
|
|
2187
2187
|
`).slice(1).join(`
|
|
2188
2188
|
`);a.stack=r?`${r}
|
|
2189
|
-
${s}`:i.stack}Wn.exports.fetch=function(e,r=void 0){return rmn(e,r).catch(n=>{throw ugr?mgr(n,ugr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=eS().Headers;Wn.exports.Response=xse().Response;Wn.exports.Request=wU().Request;Wn.exports.FormData=pNe().FormData;var{setGlobalOrigin:amn,getGlobalOrigin:nmn}=unt();Wn.exports.setGlobalOrigin=amn;Wn.exports.getGlobalOrigin=nmn;var{CacheStorage:imn}=j2r(),{kConstruct:smn}=Zc();Wn.exports.caches=new imn(smn);var{deleteCookie:omn,getCookies:lmn,getSetCookies:cmn,setCookie:umn,parseCookie:dmn}=lGr();Wn.exports.deleteCookie=omn;Wn.exports.getCookies=lmn;Wn.exports.getSetCookies=cmn;Wn.exports.setCookie=umn;Wn.exports.parseCookie=dmn;var{parseMIMEType:Imn,serializeAMimeType:hmn}=cZ();Wn.exports.parseMIMEType=Imn;Wn.exports.serializeAMimeType=hmn;var{CloseEvent:mmn,ErrorEvent:pmn,MessageEvent:bmn}=QWe(),{WebSocket:fmn,ping:Gmn}=BGr();Wn.exports.WebSocket=fmn;Wn.exports.CloseEvent=mmn;Wn.exports.ErrorEvent=pmn;Wn.exports.MessageEvent=bmn;Wn.exports.ping=Gmn;Wn.exports.WebSocketStream=PGr().WebSocketStream;Wn.exports.WebSocketError=Jot().WebSocketError;Wn.exports.request=Tse(kU.request);Wn.exports.stream=Tse(kU.stream);Wn.exports.pipeline=Tse(kU.pipeline);Wn.exports.connect=Tse(kU.connect);Wn.exports.upgrade=Tse(kU.upgrade);Wn.exports.MockClient=O0n;Wn.exports.MockCallHistory=M0n;Wn.exports.MockCallHistoryLog=U0n;Wn.exports.MockPool=_0n;Wn.exports.MockAgent=z0n;Wn.exports.SnapshotAgent=P0n;Wn.exports.mockErrors=j0n;var{EventSource:gmn}=cgr();Wn.exports.EventSource=gmn;function vmn(){globalThis.fetch=Wn.exports.fetch,globalThis.Headers=Wn.exports.Headers,globalThis.Response=Wn.exports.Response,globalThis.Request=Wn.exports.Request,globalThis.FormData=Wn.exports.FormData,globalThis.WebSocket=Wn.exports.WebSocket,globalThis.CloseEvent=Wn.exports.CloseEvent,globalThis.ErrorEvent=Wn.exports.ErrorEvent,globalThis.MessageEvent=Wn.exports.MessageEvent,globalThis.EventSource=Wn.exports.EventSource}Wn.exports.install=vmn});function dW(a){let e=a??"1.1.
|
|
2189
|
+
${s}`:i.stack}Wn.exports.fetch=function(e,r=void 0){return rmn(e,r).catch(n=>{throw ugr?mgr(n,ugr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=eS().Headers;Wn.exports.Response=xse().Response;Wn.exports.Request=wU().Request;Wn.exports.FormData=pNe().FormData;var{setGlobalOrigin:amn,getGlobalOrigin:nmn}=unt();Wn.exports.setGlobalOrigin=amn;Wn.exports.getGlobalOrigin=nmn;var{CacheStorage:imn}=j2r(),{kConstruct:smn}=Zc();Wn.exports.caches=new imn(smn);var{deleteCookie:omn,getCookies:lmn,getSetCookies:cmn,setCookie:umn,parseCookie:dmn}=lGr();Wn.exports.deleteCookie=omn;Wn.exports.getCookies=lmn;Wn.exports.getSetCookies=cmn;Wn.exports.setCookie=umn;Wn.exports.parseCookie=dmn;var{parseMIMEType:Imn,serializeAMimeType:hmn}=cZ();Wn.exports.parseMIMEType=Imn;Wn.exports.serializeAMimeType=hmn;var{CloseEvent:mmn,ErrorEvent:pmn,MessageEvent:bmn}=QWe(),{WebSocket:fmn,ping:Gmn}=BGr();Wn.exports.WebSocket=fmn;Wn.exports.CloseEvent=mmn;Wn.exports.ErrorEvent=pmn;Wn.exports.MessageEvent=bmn;Wn.exports.ping=Gmn;Wn.exports.WebSocketStream=PGr().WebSocketStream;Wn.exports.WebSocketError=Jot().WebSocketError;Wn.exports.request=Tse(kU.request);Wn.exports.stream=Tse(kU.stream);Wn.exports.pipeline=Tse(kU.pipeline);Wn.exports.connect=Tse(kU.connect);Wn.exports.upgrade=Tse(kU.upgrade);Wn.exports.MockClient=O0n;Wn.exports.MockCallHistory=M0n;Wn.exports.MockCallHistoryLog=U0n;Wn.exports.MockPool=_0n;Wn.exports.MockAgent=z0n;Wn.exports.SnapshotAgent=P0n;Wn.exports.mockErrors=j0n;var{EventSource:gmn}=cgr();Wn.exports.EventSource=gmn;function vmn(){globalThis.fetch=Wn.exports.fetch,globalThis.Headers=Wn.exports.Headers,globalThis.Response=Wn.exports.Response,globalThis.Request=Wn.exports.Request,globalThis.FormData=Wn.exports.FormData,globalThis.WebSocket=Wn.exports.WebSocket,globalThis.CloseEvent=Wn.exports.CloseEvent,globalThis.ErrorEvent=Wn.exports.ErrorEvent,globalThis.MessageEvent=Wn.exports.MessageEvent,globalThis.EventSource=Wn.exports.EventSource}Wn.exports.install=vmn});function dW(a){let e=a??"1.1.131"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${PWe}/VSCode/${i} (${r}; ${n})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${PWe}/Desktop/${i} (${r}; ${n})`}return`${PWe}/CLI/${e} (${r}; ${n})`}var PWe,cS=_e(()=>{"use strict";PWe="HwjCode"});import*as av from"node:path";import*as Li from"node:fs";import*as pgr from"node:os";import*as bgr from"node:zlib";import{spawn as jWe,spawnSync as ymn}from"node:child_process";function ggr(a){if(Li.existsSync(a)){for(let e of Li.readdirSync(a)){let r=av.join(a,e);Li.statSync(r).isDirectory()?ggr(r):Li.unlinkSync(r)}Li.rmdirSync(a)}}var fgr,Ggr,bI,vgr=_e(()=>{"use strict";fgr=Qt(_We(),1),Ggr=Qt(hKe(),1);cS();nm();bI=class{static get lspDir(){return av.join(pgr.homedir(),Qo,"lsp")}static findOnPath(e){let r=process.platform==="win32"?"where.exe":"which",i=(ymn(r,[e],{shell:!1,encoding:"utf8",windowsHide:!0}).stdout||"").toString().trim();if(!i)return null;for(let s of i.split(/\r?\n/).map(t=>t.trim()).filter(Boolean))if(Li.existsSync(s))return s;return null}static async cleanBinaryCache(e){let r=av.join(this.lspDir,e);Li.existsSync(r)&&(console.log(`[LSP] Cleaning corrupted binary cache for ${e} at ${r}`),ggr(r),console.log("[LSP] Cache cleaned successfully"))}static async ensureBinary(e,r,n){let i=n?.maxRetries??1,s=null;for(let t=0;t<=i;t++)try{let o=av.join(this.lspDir,e);return Li.existsSync(o)||Li.mkdirSync(o,{recursive:!0}),await r(o)}catch(o){s=o,t<i&&(console.log(`[LSP] Attempt ${t+1} failed: ${s.message}`),console.log(`[LSP] Cleaning cache and retrying (${i-t} retries left)...`),await this.cleanBinaryCache(e))}throw s||new Error(`Failed to ensure binary for ${e}`)}static async npmInstaller(e,r){return async n=>{let i=av.join(n,"node_modules",".bin",r+(process.platform==="win32"?".cmd":""));return Li.existsSync(i)||(console.log(`[LSP] Installing ${e.join(", ")} via npm...`),Li.existsSync(av.join(n,"package.json"))||Li.writeFileSync(av.join(n,"package.json"),JSON.stringify({name:`deepv-lsp-${r}`,version:"1.0.0",private:!0})),await new Promise((s,t)=>{let o=process.platform==="win32",d=["install",...e,"--no-save"];(o?jWe("cmd.exe",["/c","npm",...d],{cwd:n,shell:!1,stdio:"inherit"}):jWe("npm",d,{cwd:n,shell:!1,stdio:"inherit"})).on("close",u=>{u===0?s():t(new Error(`npm install failed with code ${u}`))})})),i}}static async goInstaller(e,r,n="latest"){return async i=>{let s=process.platform,t=av.join(i,r+(s==="win32"?".exe":""));if(Li.existsSync(t))return t;let o=this.findOnPath("go");if(!o)throw new Error(`[LSP] Go toolchain not found in PATH (required to install ${r}). Please install Go from https://go.dev/dl/ and ensure "go" is available in your PATH, or configure a preinstalled gopls via PATH/DEEPV_GOPLS_PATH.`);if(console.log(`[LSP] Installing ${r} via go install (${e}@${n})...`),await new Promise((d,I)=>{let u=jWe(o,["install",`${e}@${n}`],{cwd:i,shell:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"],env:{...process.env,GOBIN:i}}),h="";u.stdout?.on("data",c=>{process.stdout.write(c)}),u.stderr?.on("data",c=>{let m=c.toString();h+=m,h.length>16384&&(h=h.slice(h.length-16384)),process.stderr.write(c)}),u.on("close",c=>{if(c===0)d();else{let m=h.trim();I(new Error(`[LSP] go install failed with code ${c}`+(m?`
|
|
2190
2190
|
${m}`:"")))}}),u.on("error",c=>{I(new Error(`[LSP] Failed to spawn go (${o}): ${c.message}. Please ensure Go is installed and available in PATH.`))})}),!Li.existsSync(t))throw new Error(`[LSP] ${r} installation completed but binary not found at ${t}. This usually means Go did not honor GOBIN or the install failed silently.`);return t}}static async githubInstaller(e,r,n){return async i=>{let s=process.platform,t=process.arch,o=n(s,t),d=r+(s==="win32"?".exe":""),I=av.join(i,d);if(Li.existsSync(I))return I;console.log(`[LSP] Downloading ${r} from GitHub ${e}/${r}...`);let u=process.env.GITHUB_TOKEN||process.env.GITHUB_PAT,h={"User-Agent":dW()};u&&(h.Authorization=`Bearer ${u}`);let c=`https://api.github.com/repos/${e}/${r}/releases/latest`,Z=await(await(0,fgr.request)(c,{headers:h})).body.json(),v=Z.assets.find(A=>typeof o=="string"?A.name===o:o.test(A.name));if(!v){let A=`${s}-${t}`,p=[];r==="rust-analyzer"&&(A==="win32-x64"?p.push(/rust-analyzer.*x86_64.*windows.*\.zip/i,/rust-analyzer.*x64.*windows.*\.zip/i,/rust-analyzer.*msvc.*\.zip/i):A==="win32-arm64"?p.push(/rust-analyzer.*aarch64.*windows.*\.zip/i):A==="darwin-x64"?p.push(/rust-analyzer.*x86_64.*apple-darwin.*\.gz/i,/rust-analyzer.*x86_64.*macos.*\.gz/i):A==="darwin-arm64"?p.push(/rust-analyzer.*aarch64.*apple-darwin.*\.gz/i,/rust-analyzer.*aarch64.*macos.*\.gz/i):A==="linux-x64"?p.push(/rust-analyzer.*x86_64.*linux.*\.gz/i,/rust-analyzer.*x86_64.*gnu.*\.gz/i):A==="linux-arm64"&&p.push(/rust-analyzer.*aarch64.*linux.*\.gz/i,/rust-analyzer.*aarch64.*gnu.*\.gz/i)),p.length>0&&(v=Z.assets.find(y=>p.some(W=>W.test(y.name))))}if(!v){let A=Z.assets.map(p=>p.name).join(", ");throw new Error(`Could not find a suitable binary for ${s}-${t} in ${e}/${r} releases. Available: ${A}`)}console.log(`[LSP] Downloading: ${v.name}`),console.log(`[LSP] File size: ${(v.size/1024/1024).toFixed(1)}MB`);let N=av.join(i,v.name),g=Date.now(),E=0;if(await new Promise((A,p)=>{let y=process.platform==="win32"?"curl.exe":"curl",W=jWe(y,["-L","--fail","-o",N,v.browser_download_url]),R="",f=setInterval(()=>{if(Li.existsSync(N)){let b=Li.statSync(N).size,G=(b/(v.size||1)*100).toFixed(1),F=(b/1024/1024).toFixed(1),C=(v.size/1024/1024).toFixed(1);console.log(`[LSP] \u2B07\uFE0F ${v.name}: ${F}MB / ${C}MB (${G}%)`),E=b,g=Date.now()}},2e3);W.stderr.on("data",b=>{R+=b.toString()}),W.on("close",b=>{clearInterval(f),b===0?A():(Li.existsSync(N)&&Li.unlinkSync(N),p(new Error(`[LSP] curl failed with code ${b}: ${R}`)))}),W.on("error",b=>{clearInterval(f),Li.existsSync(N)&&Li.unlinkSync(N),p(new Error(`[LSP] Failed to spawn curl: ${b.message}. curl may not be installed or available in PATH. Please install curl and add it to your system PATH.`))})}),!Li.existsSync(N))throw new Error(`[LSP] Downloaded file not found at ${N}. curl may have failed silently.`);let w=Li.statSync(N).size;if(w===0)throw Li.unlinkSync(N),new Error(`[LSP] Downloaded file is empty (0 bytes) for ${v.name}. The download URL may be invalid or temporarily unavailable. Please retry.`);if(console.log(`[LSP] Downloaded ${w} bytes (expected: ${v.size} bytes)`),v.name.endsWith(".gz")){console.log(`[LSP] Decompressing ${v.name}...`);let A=Li.readFileSync(N);try{let p=bgr.gunzipSync(A);if(p.length===0)throw new Error("Decompressed data is empty");Li.writeFileSync(I,p)}catch(p){Li.unlinkSync(N);let y=p instanceof Error?p.message:String(p);throw new Error(`[LSP] Failed to decompress ${v.name}: ${y}. The file may be corrupted. Please retry.`)}Li.unlinkSync(N)}else if(v.name.endsWith(".zip")){console.log(`[LSP] Extracting ${v.name}...`);let A=Li.readFileSync(N);if(A.length<4)throw Li.unlinkSync(N),new Error(`[LSP] ZIP file is too small (${A.length} bytes) for ${v.name}. The download is corrupted. Please retry or check your network connection.`);if(A[0]!==80||A[1]!==75||A[2]!==3||A[3]!==4)throw Li.unlinkSync(N),new Error(`[LSP] ZIP file header is corrupted for ${v.name}. The download may have been interrupted. Please retry.`);let p;try{p=await Ggr.default.loadAsync(A)}catch(b){Li.unlinkSync(N);let G=b instanceof Error?b.message:String(b);throw new Error(`[LSP] Failed to parse ZIP file ${v.name}: ${G}. The file may be corrupted. Please retry the download.`)}let y=d.toLowerCase(),R=Object.values(p.files).filter(b=>!b.dir).filter(b=>av.posix.basename(b.name).toLowerCase()===y).sort((b,G)=>b.name.length-G.name.length)[0];if(!R)throw new Error(`Zip archive did not contain expected executable "${d}" for ${e}/${r}.`);let f=await R.async("nodebuffer");Li.writeFileSync(I,f),Li.unlinkSync(N)}else Li.renameSync(N,I);if(s!=="win32"&&Li.chmodSync(I,493),console.log(`[LSP] Binary installed at: ${I}`),console.log(`[LSP] Binary exists: ${Li.existsSync(I)}`),Li.existsSync(I)){let A=Li.statSync(I);console.log(`[LSP] Binary stats: size=${A.size}, mode=${(A.mode&parseInt("777",8)).toString(8)}`)}return I}}}});import*as F0 from"node:path";import*as GZ from"node:fs";import{spawn as XV}from"node:child_process";function SU(a,e,r){let i=process.platform==="win32"&&a.toLowerCase().endsWith(".cmd"),s={cwd:r.cwd,shell:!1,stdio:["pipe","pipe","pipe"]};if(i&&GZ.existsSync(a)){let o=GZ.readFileSync(a,"utf8").match(/%dp0%([^"]*\.m?js)/i);if(o){let d=F0.dirname(a),I=o[1].replace(/\\/g,F0.sep);I.startsWith(F0.sep)&&(I="."+I);let u=F0.resolve(d,I);if(GZ.existsSync(u))return XV(process.execPath,[u,...e],s)}return XV("cmd.exe",["/c",a,...e],s)}return XV(a,e,s)}var Dse,Zmn,Nmn,Wmn,Fmn,wmn,Rmn,Amn,Emn,xmn,ygr,Zgr=_e(()=>{"use strict";vgr();Dse=(a,e)=>async r=>{let n=F0.normalize(F0.dirname(F0.resolve(r))),i=F0.normalize(F0.resolve(e)),s=(t,o)=>{let d=t.toLowerCase(),I=o.toLowerCase();return d.startsWith(I)||d===I};for(;s(n,i);){for(let o of a)if(GZ.existsSync(F0.join(n,o)))return n;let t=F0.normalize(F0.dirname(n));if(t===n)break;n=t}return i},Zmn=a=>({id:"typescript-language-server",displayName:"TypeScript/JavaScript Language Server",extensions:[".ts",".tsx",".js",".jsx"],root:Dse(["package.json","tsconfig.json","jsconfig.json"],a),async spawn(e){let r=await bI.ensureBinary("typescript-language-server",await bI.npmInstaller(["typescript-language-server","typescript"],"typescript-language-server")),n=F0.join(F0.dirname(r),"..","..","typescript","lib","tsserver.js"),i=["--stdio"];return GZ.existsSync(n)&&i.push("--tsserver-path",n),{process:SU(r,i,{cwd:e})}}}),Nmn=a=>({id:"pyright",displayName:"Python Language Server",extensions:[".py"],root:Dse(["pyproject.toml","setup.py","requirements.txt","package.json"],a),async spawn(e){let r=await bI.ensureBinary("pyright",await bI.npmInstaller(["pyright"],"pyright-langserver"));return{process:SU(r,["--stdio"],{cwd:e})}}}),Wmn=a=>({id:"rust-analyzer",displayName:"Rust Language Server",extensions:[".rs"],root:Dse(["Cargo.toml"],a),async spawn(e){let r=process.platform,n=process.arch;console.log(`[LSP] Detecting platform for rust-analyzer: platform=${r}, arch=${n}`);let i=await bI.githubInstaller("rust-lang","rust-analyzer",(o,d)=>{let I={"win32-x64":/rust-analyzer.*x86_64.*windows.*\.zip/i,"win32-arm64":/rust-analyzer.*aarch64.*windows.*\.zip/i,"darwin-x64":/rust-analyzer.*x86_64.*apple-darwin.*\.gz/i,"darwin-arm64":/rust-analyzer.*aarch64.*apple-darwin.*\.gz/i,"linux-x64":/rust-analyzer.*x86_64.*linux.*\.gz/i,"linux-arm64":/rust-analyzer.*aarch64.*linux.*\.gz/i},u=`${o}-${d}`,h=I[u]||/rust-analyzer-.*/;return console.log(`[LSP] Asset matcher for ${u}: ${h instanceof RegExp?h.source:h}`),h}),s=await bI.ensureBinary("rust-analyzer",i,{maxRetries:1});if(console.log(`[LSP] RustAnalyzer binary path: ${s}`),console.log(`[LSP] RustAnalyzer binary exists: ${GZ.existsSync(s)}`),GZ.existsSync(s)){let o=GZ.statSync(s);console.log(`[LSP] RustAnalyzer binary stats: size=${o.size}, isFile=${o.isFile()}, mode=${(o.mode&parseInt("777",8)).toString(8)}`)}console.log(`[LSP] RustAnalyzer spawning with cwd=${e}, args=[], shell=undefined`);let t=XV(s,[],{cwd:e});return console.log(`[LSP] RustAnalyzer spawn returned: pid=${t.pid}`),t.on("error",o=>{console.error("[LSP] RustAnalyzer process error:",{code:o.code,errno:o.errno,syscall:o.syscall,path:o.path,message:o.message})}),t.on("exit",(o,d)=>{console.log(`[LSP] RustAnalyzer process exited: code=${o}, signal=${d}`)}),{process:t}}}),Fmn=a=>({id:"gopls",displayName:"Go Language Server",extensions:[".go"],root:Dse(["go.mod","go.sum"],a),async spawn(e){let r=process.env.DEEPV_GOPLS_PATH;if(r&&GZ.existsSync(r))return{process:XV(r,[],{cwd:e})};let n=bI.findOnPath("gopls");if(n)return{process:XV(n,[],{cwd:e})};let i=await bI.ensureBinary("gopls",await bI.goInstaller("golang.org/x/tools/gopls","gopls"),{maxRetries:1});return{process:XV(i,[],{cwd:e})}}}),wmn=a=>({id:"clangd",displayName:"C/C++ Language Server",extensions:[".c",".cpp",".h",".hpp",".cc"],root:Dse(["compile_commands.json","CMakeLists.txt",".git"],a),async spawn(e){let r=await bI.githubInstaller("clangd","clangd",(i,s)=>{let t=i==="win32"?"windows":i==="darwin"?"mac":"linux";return new RegExp(`clangd-${t}-.*\\.zip`)}),n=await bI.ensureBinary("clangd",r,{maxRetries:1});return{process:XV(n,[],{cwd:e})}}}),Rmn=a=>({id:"vscode-langservers-extracted",displayName:"HTML/CSS/JSON/ESLint Language Server",extensions:[".html",".css",".json",".jsonc"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("vscode-langservers-extracted",await bI.npmInstaller(["vscode-langservers-extracted"],"vscode-html-language-server"));return{process:SU(r,["--stdio"],{cwd:e})}}}),Amn=a=>({id:"sql-language-server",displayName:"SQL Language Server",extensions:[".sql"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("sql-language-server",await bI.npmInstaller(["sql-language-server"],"sql-language-server"));return{process:SU(r,["up","--method","stdio"],{cwd:e})}}}),Emn=a=>({id:"dockerfile-language-server-nodejs",displayName:"Dockerfile Language Server",extensions:["Dockerfile",".dockerfile"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("dockerfile-language-server-nodejs",await bI.npmInstaller(["dockerfile-language-server-nodejs"],"docker-langserver"));return{process:SU(r,["--stdio"],{cwd:e})}}}),xmn=a=>({id:"yaml-language-server",displayName:"YAML Language Server",extensions:[".yaml",".yml"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("yaml-language-server",await bI.npmInstaller(["yaml-language-server"],"yaml-language-server"));return{process:SU(r,["--stdio"],{cwd:e})}}}),ygr=a=>[Zmn(a),Nmn(a),Wmn(a),Fmn(a),wmn(a),Rmn(a),Amn(a),Emn(a),xmn(a)]});import*as aE from"node:path";import*as KWe from"node:fs";import{pathToFileURL as Cmn}from"node:url";var qWe,Ngr=_e(()=>{"use strict";Adr();Zgr();qWe=class{clients=new Map;servers;projectRoot;openedFiles=new Set;fileVersions=new Map;fileContents=new Map;freshClients=new Set;constructor(e){this.projectRoot=e,this.servers=ygr(e)}async getClientsForFile(e){let r=aE.extname(e).toLowerCase(),n=this.servers.filter(s=>s.extensions.includes(r)),i=[];for(let s of n){let t=await s.root(e),o=`${s.id}:${t}`;if(this.clients.has(o))i.push(this.clients.get(o));else try{console.log(`[LSP] Starting ${s.id} for root ${t}`);let{process:d}=await s.spawn(t);console.log(`[LSP] Process spawned: pid=${d.pid}, stdio=${JSON.stringify(d.stdio)}`);let I=await wdr({serverID:s.id,server:{process:d},root:t});this.clients.set(o,I),this.freshClients.add(I.serverID),i.push(I)}catch(d){let I=d instanceof Error?{message:d.message,stack:d.stack,code:d.code,errno:d.errno,syscall:d.syscall,path:d.path}:String(d);console.error(`[LSP] Failed to start ${s.id}:`,I);let u=d;(u.errno===-4094||u.code==="UNKNOWN")&&console.error(`[LSP] Binary file may be corrupted (errno=${u.errno}). Suggest deleting ${s.id} cache and reinitializing.`)}}return i}async syncDocument(e,r){let n=this.getUri(r),i=`${e.serverID}:${n}`,s=KWe.readFileSync(r,"utf8");if(!this.openedFiles.has(i))this.fileVersions.set(i,1),this.fileContents.set(i,s),await e.connection.sendNotification("textDocument/didOpen",{textDocument:{uri:n,languageId:this.getLanguageId(r),version:1,text:s}}),this.openedFiles.add(i),await new Promise(t=>setTimeout(t,3e3));else{if(this.fileContents.get(i)===s)return;let o=(this.fileVersions.get(i)||1)+1;this.fileVersions.set(i,o),this.fileContents.set(i,s),await e.connection.sendNotification("textDocument/didChange",{textDocument:{uri:n,version:o},contentChanges:[{text:s}]})}}getLanguageId(e){switch(aE.extname(e).toLowerCase()){case".ts":case".tsx":return"typescript";case".js":case".jsx":return"javascript";case".go":return"go";case".py":return"python";case".rs":return"rust";default:return"plaintext"}}getUri(e){return Cmn(aE.resolve(e)).href.replace(/^file:\/\/\/([A-Z])[:%3A]+\//i,(n,i)=>`file:///${i.toLowerCase()}%3A/`)}async shutdown(){for(let e of this.clients.values())await Rdr(e);this.clients.clear(),this.openedFiles.clear()}async run(e,r,n){let i=process.env.DEEPV_LSP_DEBUG==="1"||process.env.DEEPV_LSP_DEBUG==="true",s=Number(process.env.DEEPV_LSP_REQUEST_TIMEOUT_MS),t=n?.timeoutMs??(Number.isFinite(s)&&s>0?s:15e3),o=n?.operationName??"request",d=aE.normalize(e),I=await this.getClientsForFile(d),u=await Promise.all(I.map(async c=>{await this.syncDocument(c,d),this.freshClients.has(c.serverID)&&this.freshClients.delete(c.serverID);try{return await Promise.race([r(c),new Promise((Z,v)=>{let N=setTimeout(()=>{clearTimeout(N),v(new Error(`[LSP][${c.serverID}] ${o} timed out after ${t}ms`))},t)})])}catch(m){if(i)console.error(`[LSP][${c.serverID}] Request failed:`,m);else{let Z=m instanceof Error?m.message:String(m);Z.includes("timed out after")?console.warn(Z):console.error(`[LSP][${c.serverID}] Request failed:`,Z)}return null}})),h=[];for(let c of u)c!==null&&h.push(c);return h}async getHover(e,r,n){return this.run(e,i=>i.connection.sendRequest("textDocument/hover",{textDocument:{uri:this.getUri(e)},position:{line:r,character:n}}),{operationName:"textDocument/hover"})}async getDefinition(e,r,n){return this.run(e,i=>i.connection.sendRequest("textDocument/definition",{textDocument:{uri:this.getUri(e)},position:{line:r,character:n}}),{operationName:"textDocument/definition"})}async getReferences(e,r,n){return this.run(e,async i=>{let s={textDocument:{uri:this.getUri(e)},position:{line:r,character:n},context:{includeDeclaration:!0}},t=await i.connection.sendRequest("textDocument/references",s);return(!t||t.length===0)&&(console.log(`[LSP][${i.serverID}] No references found, retrying in 3s...`),await new Promise(o=>setTimeout(o,3e3)),t=await i.connection.sendRequest("textDocument/references",s)),t},{operationName:"textDocument/references"})}async getImplementation(e,r,n){return this.run(e,async i=>{let s={textDocument:{uri:this.getUri(e)},position:{line:r,character:n}},t=await i.connection.sendRequest("textDocument/implementation",s);return(!t||t.length===0)&&(console.log(`[LSP][${i.serverID}] No implementation found, retrying in 3s...`),await new Promise(o=>setTimeout(o,3e3)),t=await i.connection.sendRequest("textDocument/implementation",s)),t},{operationName:"textDocument/implementation"})}async getDocumentSymbols(e){return this.run(e,r=>r.connection.sendRequest("textDocument/documentSymbol",{textDocument:{uri:this.getUri(e)}}),{operationName:"textDocument/documentSymbol"})}async getWorkspaceSymbols(e){if(this.clients.size===0){console.log("[LSP] No active clients for workspace symbols, probing project...");let n=KWe.readdirSync(this.projectRoot,{recursive:!0}),i=[{ext:".ts",id:"typescript-language-server"},{ext:".py",id:"pyright"},{ext:".go",id:"gopls"},{ext:".rs",id:"rust-analyzer"},{ext:".js",id:"typescript-language-server"}];for(let s of i){let t=n.find(o=>o.endsWith(s.ext)&&!o.includes("node_modules")&&!o.includes("dist"));if(t){console.log(`[LSP] Detected ${s.ext} project, activating ${s.id}...`);let o=aE.join(this.projectRoot,t),d=await this.getClientsForFile(o);for(let I of d)await this.syncDocument(I,o);console.log(`[LSP] Waiting 5s for ${s.id} indexing...`),await new Promise(I=>setTimeout(I,5e3));break}}}let r=[];console.log(`[LSP] Searching workspace symbols for "${e}" across ${this.clients.size} clients...`);for(let n of this.clients.values())try{let i=await n.connection.sendRequest("workspace/symbol",{query:e});(!i||i.length===0)&&(console.log(`[LSP][${n.serverID}] No symbols yet, retrying in 3s...`),await new Promise(s=>setTimeout(s,3e3)),i=await n.connection.sendRequest("workspace/symbol",{query:e})),console.log(`[LSP][${n.serverID}] Found ${i?.length||0} symbols`),i&&r.push(i)}catch(i){console.error(`[LSP][${n.serverID}] Workspace symbols failed:`,i)}return r}async getDiagnostics(e){return[]}}});function Wgr(a){return Uot||(Uot=new qWe(a)),Uot}var Uot,Fgr=_e(()=>{"use strict";Ngr();Uot=null});import*as LU from"node:path";import{fileURLToPath as Ymn}from"node:url";var Ob,zot=_e(()=>{"use strict";Es();Fgr();Gi();mc();Ob=class a extends ka{config;static Name="lsp";constructor(e){super(a.Name,"LSP Tool","Perform Language Server Protocol operations like Go to Definition, Find References, Hover, etc. Useful for code navigation and understanding.",Ga.LightBulb,{properties:{operation:{type:Pt.STRING,enum:["goToDefinition","findReferences","hover","documentSymbol","workspaceSymbol","goToImplementation"],description:"The LSP operation to perform."},filePath:{type:Pt.STRING,description:"The absolute path to the file. Required for file-specific operations."},line:{type:Pt.NUMBER,description:"The 1-based line number. Required for position-specific operations."},character:{type:Pt.NUMBER,description:"The 1-based character offset. Required for position-specific operations."},query:{type:Pt.STRING,description:"Search query. Required for workspaceSymbol."}},required:["operation"],type:Pt.OBJECT}),this.config=e}validateToolParams(e){let r=ai.validate(this.schema.parameters,e,a.Name);return r||(e.operation!=="workspaceSymbol"&&(!e.filePath||!LU.isAbsolute(e.filePath))?"filePath must be an absolute path for this operation.":["goToDefinition","findReferences","hover","goToImplementation"].includes(e.operation)&&(!e.line||!e.character||e.line<1||e.character<1)?"line and character must be 1-based (>= 1) for this operation.":e.operation==="workspaceSymbol"&&!e.query?"query is required for workspaceSymbol.":null)}async execute(e){let r=Wgr(this.config.getTargetDir()),n=null,i=e.filePath?LU.resolve(e.filePath):void 0;try{switch(e.operation){case"goToDefinition":n=await r.getDefinition(i,e.line-1,e.character-1);break;case"findReferences":n=await r.getReferences(i,e.line-1,e.character-1);break;case"hover":n=await r.getHover(i,e.line-1,e.character-1);break;case"documentSymbol":n=await r.getDocumentSymbols(i);break;case"workspaceSymbol":n=await r.getWorkspaceSymbols(e.query||"");break;case"goToImplementation":n=await r.getImplementation(i,e.line-1,e.character-1);break;default:throw new Error(`Unknown operation: ${e.operation}`)}let s=n;Array.isArray(n)&&(e.operation==="hover"?s=n.find(d=>d&&d.contents)||null:e.operation==="goToDefinition"?(s=n.flat().filter(Boolean),s.length===0?s=null:s.length===1&&(s=s[0])):(s=n.flat().filter(Boolean),s.length===0&&Array.isArray(n)&&(s=[])));let t=this.formatLspResult(s,e.operation,this.config.getTargetDir());return{llmContent:`Operation ${e.operation} result:
|
|
2191
2191
|
${t}`,returnDisplay:t}}catch(s){let t=s instanceof Error?s.message:String(s);return{llmContent:`Error executing LSP operation ${e.operation}: ${t}`,returnDisplay:`Error: ${t}`}}}formatLspResult(e,r,n){if(!e)return"No result found.";let i=(s,t)=>{let o=s;s.startsWith("file://")&&(o=Ymn(s));let d=LU.relative(n,o),I=t.start.line+1,u=t.start.character+1,h=t.end.line+1,c=t.end.character+1;return I===h?`${d}:${I}:${u}-${c}`:`${d}:${I}:${u} - ${h}:${c}`};if(Array.isArray(e)){if(e.length===0)return"No results.";let s=e[0];return s.uri||s.targetUri?e.map(t=>{let o=t.uri||t.targetUri,d=t.range||t.targetSelectionRange;return`\u2022 ${i(o,d)}`}).join(`
|
|
2192
2192
|
`):s.name&&s.kind!==void 0?e.map(t=>{let d={1:"File",2:"Module",3:"Namespace",4:"Package",5:"Class",6:"Method",7:"Property",8:"Field",9:"Constructor",10:"Enum",11:"Interface",12:"Function",13:"Variable",14:"Constant",15:"String"}[t.kind]||`Kind(${t.kind})`,I="";if(t.location)I=i(t.location.uri,t.location.range);else if(t.range){let u=t.range;I=`${u.start.line+1}:${u.start.character+1}`}return`\u2022 [${d}] ${t.name} (${I})`}).join(`
|
|
@@ -4040,11 +4040,11 @@ ${g}
|
|
|
4040
4040
|
|
|
4041
4041
|
Dangerous commands cannot be auto-executed in YOLO mode. Please run this command in interactive mode for confirmation.`);console.error(`
|
|
4042
4042
|
${"=".repeat(80)}`),console.error("\u{1F6AB} DANGEROUS COMMAND EXECUTION PREVENTED"),console.error(`${"=".repeat(80)}`),console.error(`Rule: ${N}`),console.error(`Warning: ${g}`),console.error(`${"=".repeat(80)}
|
|
4043
|
-
`);let w=Date.now()-s;return console.warn(`[ToolCall] Blocked dangerous command: ${e.name}, duration: ${w}ms`),t(!1,E.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:E.message}}}],resultDisplay:E.message,error:E}}let u=await i.execute(e.args,d),h=u.llmContent,c=u.returnDisplay,m=Date.now()-s;console.debug(`[ToolCall] Success: ${e.name}, duration: ${m}ms`);let Z=typeof h=="string"?h.length:JSON.stringify(h).length;t(!0,Z);let v=HX(e.name,e.callId,h);return{callId:e.callId,responseParts:v,resultDisplay:c,error:void 0}}catch(d){let I=d instanceof Error?d:new Error(String(d)),u=Date.now()-s;return console.warn(`[ToolCall] Failed: ${e.name}, error: ${I.message}, duration: ${u}ms`),t(!1,I.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:I.message}}}],resultDisplay:I.message,error:I}}}var aAr=_e(()=>{"use strict";oGe();Nte();u$();});import{randomUUID as O4n}from"crypto";function EW(){return Sle||(Sle=O4n()),Sle}function nAr(a){Sle=a}function iAr(){Sle=void 0}var Sle,sAr,Dht=_e(()=>{"use strict";sAr=EW()});import*as Tc from"fs";import*as xW from"path";import*as MS from"os";function M4n(a){CW.configure(a)}function U4n(a){CW.setUserInfo(a)}function z4n(a){CW.setCliVersion(a)}async function _4n(){return await CW.getUserHeaders()}function P4n(){return CW.getStatus()}var Lle,Dc,CW,Jle=_e(()=>{"use strict";mut();Dht();cS();nm();Lle=259200,Dc=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return dW(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=xW.join(MS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=xW.join(MS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=xW.join(MS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=xW.join(MS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=xW.join(MS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=xW.join(MS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.130",this.config={proxyServerUrl:hut()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}if(this.jwtTokenData){let r=Date.now(),n=this.jwtTokenData.expiresAt-r,i=this.formatTimeRemaining(n),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Lle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return a.instance||(a.instance=new a),a.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Tc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Tc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Tc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,s]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=xW.dirname(this.userInfoFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Tc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Tc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=xW.dirname(this.jwtTokenFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Tc.existsSync(this.usageStatsFilePath)){let e=Tc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=xW.dirname(this.usageStatsFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Lle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Lle*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Lle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Lle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=this.getCliVersion(),n=this.getUserAgent(),i={"Content-Type":"application/json","X-Client-Version":r,"User-Agent":n,"X-Session-ID":EW()};return e&&(i["X-DVCode-Scene"]=e),i}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent();return{"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":EW()}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Tc.existsSync(this.userInfoFilePath)&&Tc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},CW=Dc.getInstance()});function j4n(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function Ble(a={}){let e=(a.baseUrl??CW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new YW("Proxy server URL is not configured");if(j4n(e))return[];let r=`${e}/web-api/models`,n=await CW.getUserHeaders(),i=a.timeoutMs??q4n,s=new AbortController,t=setTimeout(()=>s.abort(new Error(`Timed out after ${i}ms`)),i),o=[s.signal];a.signal&&o.push(a.signal);let d=o.length===1?o[0]:AbortSignal.any?.(o)??o[0];try{let I;try{I=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",...n,"User-Agent":a.userAgent??"DeepCode"},signal:d})}catch(c){if(s.signal.aborted)throw new YW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new YW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&aOe(c))throw new d_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new YW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new YW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new YW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new YW('Proxy /web-api/models response is missing the expected "data" array',I.status);let h=u.data.filter(c=>!!c&&typeof c.name=="string").map(c=>({name:c.name,displayName:typeof c.displayName=="string"&&c.displayName?c.displayName:c.name,creditsPerRequest:typeof c.creditsPerRequest=="number"?c.creditsPerRequest:0,available:c.available!==!1,maxToken:typeof c.maxToken=="number"?c.maxToken:0,highVolumeThreshold:typeof c.highVolumeThreshold=="number"?c.highVolumeThreshold:0,highVolumeCredits:typeof c.highVolumeCredits=="number"?c.highVolumeCredits:0}));return h.sort((c,m)=>c.displayName.localeCompare(m.displayName)),h}finally{clearTimeout(t)}}var q4n,YW,d_,oAr=_e(()=>{"use strict";Jle();yu();q4n=15e3,YW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},d_=class extends YW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Oht,lAr=_e(()=>{"use strict";Oht=class{onToolStatusChanged(e,r,n,i){}onOutputUpdate(e,r,n){}getPreferredEditor(e){}getStatusUpdateCallback(){}onPreToolExecution(e,r,n,i){}onAllToolsComplete(e,r){}onToolCallsUpdate(e,r){}}});import*as V5 from"node:fs";import*as h9 from"node:path";import*as cAr from"node:os";function Mht(){return h9.join(cAr.homedir(),Qo,"trusted-project-hooks.json")}function RRe(){try{let a=Mht();if(!V5.existsSync(a))return{trustedPaths:[]};let e=V5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function uAr(a){let e=Mht(),r=h9.dirname(e);V5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;V5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),V5.renameSync(n,e)}function I_(a){let e=h9.resolve(a),{trustedPaths:r}=RRe();return r.includes(e)}function Uht(a){let e=h9.resolve(a),r=RRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),uAr(r))}function zht(a){let e=h9.resolve(a),r=RRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&uAr({trustedPaths:n})}function K4n(){return RRe().trustedPaths}var dAr=_e(()=>{"use strict";nm();});function IAr(a){if(a==null)return;if(typeof a=="object"){let n=a;if(typeof n.status=="number")return n.status;if(typeof n.statusCode=="number")return n.statusCode;let i=n.response;if(i&&typeof i.status=="number")return i.status}if(fy(a)&&typeof a.error.code=="number")return a.error.code;let e=typeof a=="string"?a:typeof a=="object"&&a!==null&&"message"in a?String(a.message??""):"",r=[/API request failed \((\d{3})\)/,/Stream API error \((\d{3})\)/,/\(Status:\s*(\d{3})\)/i,/\bHTTP\s+(\d{3})\b/i,/\bstatus[\s:=]+(\d{3})\b/i];for(let n of r){let i=e.match(n);if(i){let s=parseInt(i[1],10);if(s>=100&&s<600)return s}}}function hAr(a){if(a==null)return"";if(typeof a=="string")return _ht(a)??a;if(fy(a))return a.error.message||"";if(ub(a)||a instanceof Error)return _ht(a.message)??a.message;try{return String(a)}catch{return""}}function _ht(a){if(!a)return;let e=a.indexOf("{");if(e===-1)return;let r=a.substring(e);try{let n=JSON.parse(r);if(n&&typeof n=="object"){let i=n;if(i.error&&typeof i.error=="object"&&typeof i.error.message=="string"){let s=i.error.message;if(s.trim())return`${a.substring(0,e).trim()} ${s}`.trim()}if(typeof i.message=="string"&&i.message.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.message}`:i.message}if(typeof i.error=="string"&&i.error.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.error}`:i.error}}}catch{}}function US(a){let e=IAr(a),r=hAr(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var mAr=_e(()=>{"use strict";JH();});function fAr(a){if(!a)return!1;let e=a.trim().toLowerCase(),r=e.lastIndexOf("@");if(r<=0)return!1;let n=e.slice(r+1);return $4n.includes(n)}function eAn(a){if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(a&&typeof a=="object"){let e=a;if(typeof e.message=="string")return e.message;try{return JSON.stringify(e.response?.data??e)}catch{return String(a)}}return String(a)}function GAr(a){let e=eAn(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function ARe(a){return n1(a)}function Tle(a,e={}){if(!ARe(a))return null;let r=e.locale??"zh",n=GAr(a),i=fAr(e.email);if(r==="en"){let o=n!==null?`Your credit balance is insufficient (current balance: ${n}).`:"Your credit balance is insufficient.",d=i?`As a Cheetah employee, request an "HwjCode quota" via the Feishu approval form: ${bAr}`:`Sign in at ${pAr} to recharge.`;return`${o} ${d}`}let s=n!==null?`\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3,\u5F53\u524D\u4F59\u989D:${n}\u3002`:"\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3\u3002",t=i?`\u60A8\u662F\u730E\u8C79\u5458\u5DE5,\u8BF7\u524D\u5F80\u98DE\u4E66\u5BA1\u6279(${bAr})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${pAr} \u5145\u503C\u3002`;return`${s}${t}`}var pAr,bAr,$4n,gAr=_e(()=>{"use strict";JH();pAr="https://hwjcode.bot/",bAr="https://applink.feishu.cn/T981u6WkPNNZ",$4n=["cmcm.com","orionstar.com"]});function ERe(a){let e=gw(a),r=[],n=[],i=e.toolCallReliability==="low"||e.needsFormatTolerance,s=e.needsFormatTolerance||e.proneToIncompleteStream||e.enableMalformedRetry;return e.toolCallReliability==="low"&&(r.push("Consider using sequential tool calls instead of concurrent ones"),r.push("Enable debug logging to monitor tool call success rates")),e.needsFormatTolerance&&(r.push("Tolerant parameter validation is enabled for this model"),r.push("Consider upgrading to a more capable model for production use")),e.proneToIncompleteStream&&(r.push("Streaming responses may be incomplete - validation and retry enabled"),n.push("Function calls may require automatic fixing during streaming")),e.maxConcurrentTools<3&&n.push(`Concurrent tool calls limited to ${e.maxConcurrentTools} for stability`),e.enableMalformedRetry&&r.push("Automatic retry enabled for malformed function calls"),e.enableProgressiveDegradation&&r.push("Progressive degradation enabled - will reduce complexity on failures"),{modelName:a,capabilities:e,recommendations:r,warnings:n,isSmallModel:i,needsSpecialHandling:s}}function tAn(a,e=!1){let r=ERe(a);console.log(`
|
|
4043
|
+
`);let w=Date.now()-s;return console.warn(`[ToolCall] Blocked dangerous command: ${e.name}, duration: ${w}ms`),t(!1,E.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:E.message}}}],resultDisplay:E.message,error:E}}let u=await i.execute(e.args,d),h=u.llmContent,c=u.returnDisplay,m=Date.now()-s;console.debug(`[ToolCall] Success: ${e.name}, duration: ${m}ms`);let Z=typeof h=="string"?h.length:JSON.stringify(h).length;t(!0,Z);let v=HX(e.name,e.callId,h);return{callId:e.callId,responseParts:v,resultDisplay:c,error:void 0}}catch(d){let I=d instanceof Error?d:new Error(String(d)),u=Date.now()-s;return console.warn(`[ToolCall] Failed: ${e.name}, error: ${I.message}, duration: ${u}ms`),t(!1,I.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:I.message}}}],resultDisplay:I.message,error:I}}}var aAr=_e(()=>{"use strict";oGe();Nte();u$();});import{randomUUID as O4n}from"crypto";function EW(){return Sle||(Sle=O4n()),Sle}function nAr(a){Sle=a}function iAr(){Sle=void 0}var Sle,sAr,Dht=_e(()=>{"use strict";sAr=EW()});import*as Tc from"fs";import*as xW from"path";import*as MS from"os";function M4n(a){CW.configure(a)}function U4n(a){CW.setUserInfo(a)}function z4n(a){CW.setCliVersion(a)}async function _4n(){return await CW.getUserHeaders()}function P4n(){return CW.getStatus()}var Lle,Dc,CW,Jle=_e(()=>{"use strict";mut();Dht();cS();nm();Lle=259200,Dc=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return dW(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=xW.join(MS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=xW.join(MS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=xW.join(MS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=xW.join(MS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=xW.join(MS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=xW.join(MS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.131",this.config={proxyServerUrl:hut()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}if(this.jwtTokenData){let r=Date.now(),n=this.jwtTokenData.expiresAt-r,i=this.formatTimeRemaining(n),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Lle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return a.instance||(a.instance=new a),a.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Tc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Tc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Tc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,s]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=xW.dirname(this.userInfoFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Tc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Tc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=xW.dirname(this.jwtTokenFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Tc.existsSync(this.usageStatsFilePath)){let e=Tc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=xW.dirname(this.usageStatsFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Lle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Lle*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Lle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Lle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=this.getCliVersion(),n=this.getUserAgent(),i={"Content-Type":"application/json","X-Client-Version":r,"User-Agent":n,"X-Session-ID":EW()};return e&&(i["X-DVCode-Scene"]=e),i}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent();return{"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":EW()}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Tc.existsSync(this.userInfoFilePath)&&Tc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},CW=Dc.getInstance()});function j4n(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function Ble(a={}){let e=(a.baseUrl??CW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new YW("Proxy server URL is not configured");if(j4n(e))return[];let r=`${e}/web-api/models`,n=await CW.getUserHeaders(),i=a.timeoutMs??q4n,s=new AbortController,t=setTimeout(()=>s.abort(new Error(`Timed out after ${i}ms`)),i),o=[s.signal];a.signal&&o.push(a.signal);let d=o.length===1?o[0]:AbortSignal.any?.(o)??o[0];try{let I;try{I=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",...n,"User-Agent":a.userAgent??"DeepCode"},signal:d})}catch(c){if(s.signal.aborted)throw new YW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new YW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&aOe(c))throw new d_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new YW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new YW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new YW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new YW('Proxy /web-api/models response is missing the expected "data" array',I.status);let h=u.data.filter(c=>!!c&&typeof c.name=="string").map(c=>({name:c.name,displayName:typeof c.displayName=="string"&&c.displayName?c.displayName:c.name,creditsPerRequest:typeof c.creditsPerRequest=="number"?c.creditsPerRequest:0,available:c.available!==!1,maxToken:typeof c.maxToken=="number"?c.maxToken:0,highVolumeThreshold:typeof c.highVolumeThreshold=="number"?c.highVolumeThreshold:0,highVolumeCredits:typeof c.highVolumeCredits=="number"?c.highVolumeCredits:0}));return h.sort((c,m)=>c.displayName.localeCompare(m.displayName)),h}finally{clearTimeout(t)}}var q4n,YW,d_,oAr=_e(()=>{"use strict";Jle();yu();q4n=15e3,YW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},d_=class extends YW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Oht,lAr=_e(()=>{"use strict";Oht=class{onToolStatusChanged(e,r,n,i){}onOutputUpdate(e,r,n){}getPreferredEditor(e){}getStatusUpdateCallback(){}onPreToolExecution(e,r,n,i){}onAllToolsComplete(e,r){}onToolCallsUpdate(e,r){}}});import*as V5 from"node:fs";import*as h9 from"node:path";import*as cAr from"node:os";function Mht(){return h9.join(cAr.homedir(),Qo,"trusted-project-hooks.json")}function RRe(){try{let a=Mht();if(!V5.existsSync(a))return{trustedPaths:[]};let e=V5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function uAr(a){let e=Mht(),r=h9.dirname(e);V5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;V5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),V5.renameSync(n,e)}function I_(a){let e=h9.resolve(a),{trustedPaths:r}=RRe();return r.includes(e)}function Uht(a){let e=h9.resolve(a),r=RRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),uAr(r))}function zht(a){let e=h9.resolve(a),r=RRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&uAr({trustedPaths:n})}function K4n(){return RRe().trustedPaths}var dAr=_e(()=>{"use strict";nm();});function IAr(a){if(a==null)return;if(typeof a=="object"){let n=a;if(typeof n.status=="number")return n.status;if(typeof n.statusCode=="number")return n.statusCode;let i=n.response;if(i&&typeof i.status=="number")return i.status}if(fy(a)&&typeof a.error.code=="number")return a.error.code;let e=typeof a=="string"?a:typeof a=="object"&&a!==null&&"message"in a?String(a.message??""):"",r=[/API request failed \((\d{3})\)/,/Stream API error \((\d{3})\)/,/\(Status:\s*(\d{3})\)/i,/\bHTTP\s+(\d{3})\b/i,/\bstatus[\s:=]+(\d{3})\b/i];for(let n of r){let i=e.match(n);if(i){let s=parseInt(i[1],10);if(s>=100&&s<600)return s}}}function hAr(a){if(a==null)return"";if(typeof a=="string")return _ht(a)??a;if(fy(a))return a.error.message||"";if(ub(a)||a instanceof Error)return _ht(a.message)??a.message;try{return String(a)}catch{return""}}function _ht(a){if(!a)return;let e=a.indexOf("{");if(e===-1)return;let r=a.substring(e);try{let n=JSON.parse(r);if(n&&typeof n=="object"){let i=n;if(i.error&&typeof i.error=="object"&&typeof i.error.message=="string"){let s=i.error.message;if(s.trim())return`${a.substring(0,e).trim()} ${s}`.trim()}if(typeof i.message=="string"&&i.message.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.message}`:i.message}if(typeof i.error=="string"&&i.error.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.error}`:i.error}}}catch{}}function US(a){let e=IAr(a),r=hAr(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var mAr=_e(()=>{"use strict";JH();});function fAr(a){if(!a)return!1;let e=a.trim().toLowerCase(),r=e.lastIndexOf("@");if(r<=0)return!1;let n=e.slice(r+1);return $4n.includes(n)}function eAn(a){if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(a&&typeof a=="object"){let e=a;if(typeof e.message=="string")return e.message;try{return JSON.stringify(e.response?.data??e)}catch{return String(a)}}return String(a)}function GAr(a){let e=eAn(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function ARe(a){return n1(a)}function Tle(a,e={}){if(!ARe(a))return null;let r=e.locale??"zh",n=GAr(a),i=fAr(e.email);if(r==="en"){let o=n!==null?`Your credit balance is insufficient (current balance: ${n}).`:"Your credit balance is insufficient.",d=i?`As a Cheetah employee, request an "HwjCode quota" via the Feishu approval form: ${bAr}`:`Sign in at ${pAr} to recharge.`;return`${o} ${d}`}let s=n!==null?`\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3,\u5F53\u524D\u4F59\u989D:${n}\u3002`:"\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3\u3002",t=i?`\u60A8\u662F\u730E\u8C79\u5458\u5DE5,\u8BF7\u524D\u5F80\u98DE\u4E66\u5BA1\u6279(${bAr})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${pAr} \u5145\u503C\u3002`;return`${s}${t}`}var pAr,bAr,$4n,gAr=_e(()=>{"use strict";JH();pAr="https://hwjcode.bot/",bAr="https://applink.feishu.cn/T981u6WkPNNZ",$4n=["cmcm.com","orionstar.com"]});function ERe(a){let e=gw(a),r=[],n=[],i=e.toolCallReliability==="low"||e.needsFormatTolerance,s=e.needsFormatTolerance||e.proneToIncompleteStream||e.enableMalformedRetry;return e.toolCallReliability==="low"&&(r.push("Consider using sequential tool calls instead of concurrent ones"),r.push("Enable debug logging to monitor tool call success rates")),e.needsFormatTolerance&&(r.push("Tolerant parameter validation is enabled for this model"),r.push("Consider upgrading to a more capable model for production use")),e.proneToIncompleteStream&&(r.push("Streaming responses may be incomplete - validation and retry enabled"),n.push("Function calls may require automatic fixing during streaming")),e.maxConcurrentTools<3&&n.push(`Concurrent tool calls limited to ${e.maxConcurrentTools} for stability`),e.enableMalformedRetry&&r.push("Automatic retry enabled for malformed function calls"),e.enableProgressiveDegradation&&r.push("Progressive degradation enabled - will reduce complexity on failures"),{modelName:a,capabilities:e,recommendations:r,warnings:n,isSmallModel:i,needsSpecialHandling:s}}function tAn(a,e=!1){let r=ERe(a);console.log(`
|
|
4044
4044
|
\u{1F50D} Model Diagnostics: ${a}`),console.log(`\u{1F4CA} Reliability: ${r.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${r.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${r.capabilities.maxConcurrentTools}`),r.warnings.length>0&&(console.log(`
|
|
4045
4045
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(n=>console.log(` \u2022 ${n}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
4046
4046
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(n=>console.log(` \u2022 ${n}`))),e&&(console.log(`
|
|
4047
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function rAn(a){let e=ERe(a);return e.isSmallModel||e.needsSpecialHandling}function aAn(a){let e=ERe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var vAr=_e(()=>{"use strict";vte();});import*as XZ from"fs";import*as xRe from"path";var nAn,Dle,yAr=_e(()=>{"use strict";Nd();nAn="healthy-use-reminder.json",Dle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=Pf(e);this.stateFilePath=xRe.join(r,nAn)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let s=2700*1e3;return Date.now()-i.lastReminderShownAt>=s}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{XZ.existsSync(this.stateFilePath)&&XZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!XZ.existsSync(this.stateFilePath))return null;let e=XZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=xRe.dirname(this.stateFilePath);XZ.existsSync(r)||XZ.mkdirSync(r,{recursive:!0}),XZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var Pht,jht,iAn,sAn,oAn,ZAr=_e(()=>{"use strict";Pht="--- Content from referenced files ---",jht="--- End of content ---",iAn=2e3,sAn=2e3,oAn=20});function WAr(...a){return lAn(...a)}function FAr(...a){return cAn(...a)}function NAr(a,e){return a in e}function qht(){let a={get(i,s){if(s==="write")return WAr;if(NAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,s){if(s==="write")return FAr;if(NAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var lAn,cAn,wAr=_e(()=>{"use strict";lAn=process.stdout.write.bind(process.stdout),cAn=process.stderr.write.bind(process.stderr)});import{readFile as uAn}from"node:fs/promises";import{fileURLToPath as dAn}from"node:url";import Kht from"node:path";function IAn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Kht.dirname(dAn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Q5(){return Ole||(Ole=(async()=>"1.1.130")(),Ole)}function hAn(){Ole=void 0}var Ole,$ht=_e(()=>{"use strict";});function mAn(a="latest"){let e=a?.trim().toLowerCase();return RAr.includes(e)?e:AAr}var RAr,AAr,EAr=_e(()=>{"use strict";RAr=["stable","latest"],AAr="stable"});import{EventEmitter as pAn}from"node:events";var Mle,e0t,t0t,xAr=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(Mle||(Mle={}));e0t=class{emitter=new pAn;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},t0t=new e0t});function CRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function bAn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function r0t(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??CRe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?CRe(r.content):[],i=bAn(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let s of r.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...CRe(r.content)),i)for(let s of r.toolCalls)n.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let s=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?s.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?s.push(...CRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var CAr=_e(()=>{"use strict";});var zS,YAr,Ule,VAr=_e(()=>{"use strict";zS=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},YAr="latest",Ule=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw zS.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let s=Number.parseInt(r,10);if(Number.isInteger(s)&&s.toString()===r&&s>0&&s<=n.length)return n[s-1];throw zS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===YAr){let s=await this.listSessions();if(s.length===0)throw zS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new zS(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function fAn(a,e,r){return new YRe(a,e,r)}var YRe,VRe,QRe,QAr=_e(()=>{"use strict";hte();cS();YRe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),s=await fetch(n,i);return s.status===401&&this.tokenManager&&(s=await this.handleUnauthorized(n,i)),s}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":dW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:V4("warn","\u26A0\uFE0F No access token available")}catch(n){V4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(V4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{V4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){V4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},s=fetch(e,i);return this.processRequestQueue(n),await s}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(V4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new VRe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:s})=>{s().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new QRe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},VRe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},QRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function GAn(a){return zle.getInstance(a)}function gAn(a){let e=zle.getInstance(a);return()=>e.handleAuthenticationRequired()}var zle,HAr=_e(()=>{"use strict";Jle();zle=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Dc.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Dc.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});import*as HRe from"fs";import*as x2 from"path";function vAn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var _le,a0t,XAr=_e(()=>{"use strict";_le=vAn(),a0t=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(x2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(x2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(x2.join(this.customBasePath,"auth","login","templates",e))),_le&&r.push(x2.join(_le,e)),_le){let s=_le;for(let t=0;t<10;t++)r.push(x2.join(s,"bundled","auth","login","templates",e)),r.push(x2.join(s,"bundled",e)),r.push(x2.join(s,"bundle","login","templates",e)),r.push(x2.join(s,"auth","login","templates",e)),s=x2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(x2.join(s,"bundle","login","templates",e)),r.push(x2.join(s,"dist","bundled","auth","login","templates",e)),r.push(x2.join(s,"bundled","auth","login","templates",e)),r.push(x2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(HRe.existsSync(s)){n=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${_le||"(unavailable - cross-platform build)"}`),console.warn(` Custom base path: ${this.customBasePath||"(not set)"}`),typeof process<"u"&&process.cwd)try{console.warn(` Process cwd: ${process.cwd()}`)}catch{console.warn(" Process cwd: unavailable")}return console.log(`\u2139\uFE0F [AuthTemplates] Using fallback template for ${e}`),this.generateBasicAuthSelectTemplate()}let i=HRe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
4047
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function rAn(a){let e=ERe(a);return e.isSmallModel||e.needsSpecialHandling}function aAn(a){let e=ERe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var vAr=_e(()=>{"use strict";vte();});import*as XZ from"fs";import*as xRe from"path";var nAn,Dle,yAr=_e(()=>{"use strict";Nd();nAn="healthy-use-reminder.json",Dle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=Pf(e);this.stateFilePath=xRe.join(r,nAn)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let s=2700*1e3;return Date.now()-i.lastReminderShownAt>=s}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{XZ.existsSync(this.stateFilePath)&&XZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!XZ.existsSync(this.stateFilePath))return null;let e=XZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=xRe.dirname(this.stateFilePath);XZ.existsSync(r)||XZ.mkdirSync(r,{recursive:!0}),XZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var Pht,jht,iAn,sAn,oAn,ZAr=_e(()=>{"use strict";Pht="--- Content from referenced files ---",jht="--- End of content ---",iAn=2e3,sAn=2e3,oAn=20});function WAr(...a){return lAn(...a)}function FAr(...a){return cAn(...a)}function NAr(a,e){return a in e}function qht(){let a={get(i,s){if(s==="write")return WAr;if(NAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,s){if(s==="write")return FAr;if(NAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var lAn,cAn,wAr=_e(()=>{"use strict";lAn=process.stdout.write.bind(process.stdout),cAn=process.stderr.write.bind(process.stderr)});import{readFile as uAn}from"node:fs/promises";import{fileURLToPath as dAn}from"node:url";import Kht from"node:path";function IAn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Kht.dirname(dAn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Q5(){return Ole||(Ole=(async()=>"1.1.131")(),Ole)}function hAn(){Ole=void 0}var Ole,$ht=_e(()=>{"use strict";});function mAn(a="latest"){let e=a?.trim().toLowerCase();return RAr.includes(e)?e:AAr}var RAr,AAr,EAr=_e(()=>{"use strict";RAr=["stable","latest"],AAr="stable"});import{EventEmitter as pAn}from"node:events";var Mle,e0t,t0t,xAr=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(Mle||(Mle={}));e0t=class{emitter=new pAn;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},t0t=new e0t});function CRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function bAn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function r0t(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??CRe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?CRe(r.content):[],i=bAn(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let s of r.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...CRe(r.content)),i)for(let s of r.toolCalls)n.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let s=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?s.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?s.push(...CRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var CAr=_e(()=>{"use strict";});var zS,YAr,Ule,VAr=_e(()=>{"use strict";zS=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},YAr="latest",Ule=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw zS.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let s=Number.parseInt(r,10);if(Number.isInteger(s)&&s.toString()===r&&s>0&&s<=n.length)return n[s-1];throw zS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===YAr){let s=await this.listSessions();if(s.length===0)throw zS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new zS(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function fAn(a,e,r){return new YRe(a,e,r)}var YRe,VRe,QRe,QAr=_e(()=>{"use strict";hte();cS();YRe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),s=await fetch(n,i);return s.status===401&&this.tokenManager&&(s=await this.handleUnauthorized(n,i)),s}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":dW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:V4("warn","\u26A0\uFE0F No access token available")}catch(n){V4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(V4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{V4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){V4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},s=fetch(e,i);return this.processRequestQueue(n),await s}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(V4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new VRe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:s})=>{s().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new QRe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},VRe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},QRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function GAn(a){return zle.getInstance(a)}function gAn(a){let e=zle.getInstance(a);return()=>e.handleAuthenticationRequired()}var zle,HAr=_e(()=>{"use strict";Jle();zle=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Dc.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Dc.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});import*as HRe from"fs";import*as x2 from"path";function vAn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var _le,a0t,XAr=_e(()=>{"use strict";_le=vAn(),a0t=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(x2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(x2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(x2.join(this.customBasePath,"auth","login","templates",e))),_le&&r.push(x2.join(_le,e)),_le){let s=_le;for(let t=0;t<10;t++)r.push(x2.join(s,"bundled","auth","login","templates",e)),r.push(x2.join(s,"bundled",e)),r.push(x2.join(s,"bundle","login","templates",e)),r.push(x2.join(s,"auth","login","templates",e)),s=x2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(x2.join(s,"bundle","login","templates",e)),r.push(x2.join(s,"dist","bundled","auth","login","templates",e)),r.push(x2.join(s,"bundled","auth","login","templates",e)),r.push(x2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(HRe.existsSync(s)){n=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${_le||"(unavailable - cross-platform build)"}`),console.warn(` Custom base path: ${this.customBasePath||"(not set)"}`),typeof process<"u"&&process.cwd)try{console.warn(` Process cwd: ${process.cwd()}`)}catch{console.warn(" Process cwd: unavailable")}return console.log(`\u2139\uFE0F [AuthTemplates] Using fallback template for ${e}`),this.generateBasicAuthSelectTemplate()}let i=HRe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
4048
4048
|
<!DOCTYPE html>
|
|
4049
4049
|
<html>
|
|
4050
4050
|
<head>
|
|
@@ -5479,7 +5479,7 @@ ${c}`),n?i.reset(c):c}function bQn(a,e,r,n={}){if(!G9r){G9r=!0;let s="Passing li
|
|
|
5479
5479
|
|
|
5480
5480
|
${e}
|
|
5481
5481
|
`:""}`}set message(e){this.#r=e}#n(e){if(!this.#t)return;let r=this.#e,n=vQn(r,this.#t.message);if(n)return(0,R9r.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#a??=this.#n(!0),this.#a}get rawCodeFrame(){return this.#i??=this.#n(!1),this.#i}},vQn=(a,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:s}=r.groups;return i&&s?{line:Number(i),column:Number(s)}:mpt(a,Number(n),{oneBased:!0})},yQn=a=>a.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${gQn(n)})`)});var Dce=He((x2s,E9r)=>{"use strict";var ZQn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{};E9r.exports=ZQn});var Oce=He((C2s,x9r)=>{"use strict";var NQn="2.0.0",WQn=Number.MAX_SAFE_INTEGER||9007199254740991,FQn=16,wQn=250,RQn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];x9r.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:FQn,MAX_SAFE_BUILD_LENGTH:wQn,MAX_SAFE_INTEGER:WQn,RELEASE_TYPES:RQn,SEMVER_SPEC_VERSION:NQn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var nP=He((_5,C9r)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:fpt,MAX_SAFE_BUILD_LENGTH:AQn,MAX_LENGTH:EQn}=Oce(),xQn=Dce();_5=C9r.exports={};var CQn=_5.re=[],YQn=_5.safeRe=[],An=_5.src=[],VQn=_5.safeSrc=[],En=_5.t={},QQn=0,Gpt="[a-zA-Z0-9-]",HQn=[["\\s",1],["\\d",EQn],[Gpt,AQn]],XQn=a=>{for(let[e,r]of HQn)a=a.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return a},Gs=(a,e,r)=>{let n=XQn(e),i=QQn++;xQn(a,i,e),En[a]=i,An[i]=e,VQn[i]=n,CQn[i]=new RegExp(e,r?"g":void 0),YQn[i]=new RegExp(n,r?"g":void 0)};Gs("NUMERICIDENTIFIER","0|[1-9]\\d*");Gs("NUMERICIDENTIFIERLOOSE","\\d+");Gs("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Gpt}*`);Gs("MAINVERSION",`(${An[En.NUMERICIDENTIFIER]})\\.(${An[En.NUMERICIDENTIFIER]})\\.(${An[En.NUMERICIDENTIFIER]})`);Gs("MAINVERSIONLOOSE",`(${An[En.NUMERICIDENTIFIERLOOSE]})\\.(${An[En.NUMERICIDENTIFIERLOOSE]})\\.(${An[En.NUMERICIDENTIFIERLOOSE]})`);Gs("PRERELEASEIDENTIFIER",`(?:${An[En.NONNUMERICIDENTIFIER]}|${An[En.NUMERICIDENTIFIER]})`);Gs("PRERELEASEIDENTIFIERLOOSE",`(?:${An[En.NONNUMERICIDENTIFIER]}|${An[En.NUMERICIDENTIFIERLOOSE]})`);Gs("PRERELEASE",`(?:-(${An[En.PRERELEASEIDENTIFIER]}(?:\\.${An[En.PRERELEASEIDENTIFIER]})*))`);Gs("PRERELEASELOOSE",`(?:-?(${An[En.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${An[En.PRERELEASEIDENTIFIERLOOSE]})*))`);Gs("BUILDIDENTIFIER",`${Gpt}+`);Gs("BUILD",`(?:\\+(${An[En.BUILDIDENTIFIER]}(?:\\.${An[En.BUILDIDENTIFIER]})*))`);Gs("FULLPLAIN",`v?${An[En.MAINVERSION]}${An[En.PRERELEASE]}?${An[En.BUILD]}?`);Gs("FULL",`^${An[En.FULLPLAIN]}$`);Gs("LOOSEPLAIN",`[v=\\s]*${An[En.MAINVERSIONLOOSE]}${An[En.PRERELEASELOOSE]}?${An[En.BUILD]}?`);Gs("LOOSE",`^${An[En.LOOSEPLAIN]}$`);Gs("GTLT","((?:<|>)?=?)");Gs("XRANGEIDENTIFIERLOOSE",`${An[En.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Gs("XRANGEIDENTIFIER",`${An[En.NUMERICIDENTIFIER]}|x|X|\\*`);Gs("XRANGEPLAIN",`[v=\\s]*(${An[En.XRANGEIDENTIFIER]})(?:\\.(${An[En.XRANGEIDENTIFIER]})(?:\\.(${An[En.XRANGEIDENTIFIER]})(?:${An[En.PRERELEASE]})?${An[En.BUILD]}?)?)?`);Gs("XRANGEPLAINLOOSE",`[v=\\s]*(${An[En.XRANGEIDENTIFIERLOOSE]})(?:\\.(${An[En.XRANGEIDENTIFIERLOOSE]})(?:\\.(${An[En.XRANGEIDENTIFIERLOOSE]})(?:${An[En.PRERELEASELOOSE]})?${An[En.BUILD]}?)?)?`);Gs("XRANGE",`^${An[En.GTLT]}\\s*${An[En.XRANGEPLAIN]}$`);Gs("XRANGELOOSE",`^${An[En.GTLT]}\\s*${An[En.XRANGEPLAINLOOSE]}$`);Gs("COERCEPLAIN",`(^|[^\\d])(\\d{1,${fpt}})(?:\\.(\\d{1,${fpt}}))?(?:\\.(\\d{1,${fpt}}))?`);Gs("COERCE",`${An[En.COERCEPLAIN]}(?:$|[^\\d])`);Gs("COERCEFULL",An[En.COERCEPLAIN]+`(?:${An[En.PRERELEASE]})?(?:${An[En.BUILD]})?(?:$|[^\\d])`);Gs("COERCERTL",An[En.COERCE],!0);Gs("COERCERTLFULL",An[En.COERCEFULL],!0);Gs("LONETILDE","(?:~>?)");Gs("TILDETRIM",`(\\s*)${An[En.LONETILDE]}\\s+`,!0);_5.tildeTrimReplace="$1~";Gs("TILDE",`^${An[En.LONETILDE]}${An[En.XRANGEPLAIN]}$`);Gs("TILDELOOSE",`^${An[En.LONETILDE]}${An[En.XRANGEPLAINLOOSE]}$`);Gs("LONECARET","(?:\\^)");Gs("CARETTRIM",`(\\s*)${An[En.LONECARET]}\\s+`,!0);_5.caretTrimReplace="$1^";Gs("CARET",`^${An[En.LONECARET]}${An[En.XRANGEPLAIN]}$`);Gs("CARETLOOSE",`^${An[En.LONECARET]}${An[En.XRANGEPLAINLOOSE]}$`);Gs("COMPARATORLOOSE",`^${An[En.GTLT]}\\s*(${An[En.LOOSEPLAIN]})$|^$`);Gs("COMPARATOR",`^${An[En.GTLT]}\\s*(${An[En.FULLPLAIN]})$|^$`);Gs("COMPARATORTRIM",`(\\s*)${An[En.GTLT]}\\s*(${An[En.LOOSEPLAIN]}|${An[En.XRANGEPLAIN]})`,!0);_5.comparatorTrimReplace="$1$2$3";Gs("HYPHENRANGE",`^\\s*(${An[En.XRANGEPLAIN]})\\s+-\\s+(${An[En.XRANGEPLAIN]})\\s*$`);Gs("HYPHENRANGELOOSE",`^\\s*(${An[En.XRANGEPLAINLOOSE]})\\s+-\\s+(${An[En.XRANGEPLAINLOOSE]})\\s*$`);Gs("STAR","(<|>)?=?\\s*\\*");Gs("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Gs("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var wAe=He((Y2s,Y9r)=>{"use strict";var kQn=Object.freeze({loose:!0}),SQn=Object.freeze({}),LQn=a=>a?typeof a!="object"?kQn:a:SQn;Y9r.exports=LQn});var gpt=He((V2s,H9r)=>{"use strict";var V9r=/^[0-9]+$/,Q9r=(a,e)=>{if(typeof a=="number"&&typeof e=="number")return a===e?0:a<e?-1:1;let r=V9r.test(a),n=V9r.test(e);return r&&n&&(a=+a,e=+e),a===e?0:r&&!n?-1:n&&!r?1:a<e?-1:1},JQn=(a,e)=>Q9r(e,a);H9r.exports={compareIdentifiers:Q9r,rcompareIdentifiers:JQn}});var af=He((Q2s,k9r)=>{"use strict";var RAe=Dce(),{MAX_LENGTH:X9r,MAX_SAFE_INTEGER:AAe}=Oce(),{safeRe:EAe,t:xAe}=nP(),BQn=wAe(),{compareIdentifiers:vpt}=gpt(),ypt=class a{constructor(e,r){if(r=BQn(r),e instanceof a){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>X9r)throw new TypeError(`version is longer than ${X9r} characters`);RAe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?EAe[xAe.LOOSE]:EAe[xAe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>AAe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>AAe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>AAe||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<AAe)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(RAe("SemVer.compare",this.version,this.options,e),!(e instanceof a)){if(typeof e=="string"&&e===this.version)return 0;e=new a(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof a||(e=new a(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(RAe("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return vpt(n,i)}while(++r)}compareBuild(e){e instanceof a||(e=new a(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(RAe("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return vpt(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?EAe[xAe.PRERELEASELOOSE]:EAe[xAe.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),vpt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};k9r.exports=ypt});var hL=He((H2s,L9r)=>{"use strict";var S9r=af(),TQn=(a,e,r=!1)=>{if(a instanceof S9r)return a;try{return new S9r(a,e)}catch(n){if(!r)return null;throw n}};L9r.exports=TQn});var Zpt=He((X2s,J9r)=>{"use strict";var DQn=hL(),OQn=(a,e)=>{let r=DQn(a,e);return r?r.version:null};J9r.exports=OQn});var Npt=He((k2s,B9r)=>{"use strict";var MQn=hL(),UQn=(a,e)=>{let r=MQn(a.trim().replace(/^[=v]+/,""),e);return r?r.version:null};B9r.exports=UQn});var Wpt=He((S2s,zQn)=>{zQn.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var T9r=He((L2s,_Qn)=>{_Qn.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var D9r=He((J2s,PQn)=>{PQn.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var M9r=He((B2s,O9r)=>{"use strict";var jQn=[].concat(Wpt()).concat(T9r()),qQn=D9r();O9r.exports=function(a){var e=0;function r(){return e<a.length}function n(Z){if(Z instanceof RegExp){var v=a.slice(e),N=v.match(Z);if(N)return e+=N[0].length,N[0]}else if(a.indexOf(Z,e)===e)return e+=Z.length,Z}function i(){n(/[ ]*/)}function s(){for(var Z,v=["WITH","AND","OR","(",")",":","+"],N=0;N<v.length&&(Z=n(v[N]),!Z);N++);if(Z==="+"&&e>1&&a[e-2]===" ")throw new Error("Space before `+`");return Z&&{type:"OPERATOR",string:Z}}function t(){return n(/[A-Za-z0-9-.]+/)}function o(){var Z=t();if(!Z)throw new Error("Expected idstring at offset "+e);return Z}function d(){if(n("DocumentRef-")){var Z=o();return{type:"DOCUMENTREF",string:Z}}}function I(){if(n("LicenseRef-")){var Z=o();return{type:"LICENSEREF",string:Z}}}function u(){var Z=e,v=t();if(jQn.indexOf(v)!==-1)return{type:"LICENSE",string:v};if(qQn.indexOf(v)!==-1)return{type:"EXCEPTION",string:v};e=Z}function h(){return s()||d()||I()||u()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+a[e]+"` at offset "+e);c.push(m)}return c}});var z9r=He((T2s,U9r)=>{"use strict";U9r.exports=function(a){var e=0;function r(){return e<a.length}function n(){return r()?a[e]:null}function i(){if(!r())throw new Error;e++}function s(v){var N=n();if(N&&N.type==="OPERATOR"&&v===N.string)return i(),N.string}function t(){if(s("WITH")){var v=n();if(v&&v.type==="EXCEPTION")return i(),v.string;throw new Error("Expected exception after `WITH`")}}function o(){var v=e,N="",g=n();if(g.type==="DOCUMENTREF"&&(i(),N+="DocumentRef-"+g.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(g=n(),g.type==="LICENSEREF")return i(),N+="LicenseRef-"+g.string,{license:N};e=v}function d(){var v=n();if(v&&v.type==="LICENSE"){i();var N={license:v.string};s("+")&&(N.plus=!0);var g=t();return g&&(N.exception=g),N}}function I(){var v=s("(");if(v){var N=m();if(!s(")"))throw new Error("Expected `)`");return N}}function u(){return I()||o()||d()}function h(v,N){return function g(){var E=N();if(E){if(!s(v))return E;var w=g();if(!w)throw new Error("Expected expression");return{left:E,conjunction:v.toLowerCase(),right:w}}}}var c=h("AND",u),m=h("OR",c),Z=m();if(!Z||r())throw new Error("Syntax error");return Z}});var Fpt=He((D2s,_9r)=>{"use strict";var KQn=M9r(),$Qn=z9r();_9r.exports=function(a){return $Qn(KQn(a))}});var aQr=He((O2s,rQr)=>{var eHn=Fpt(),tHn=Wpt();function CAe(a){try{return eHn(a),!0}catch{return!1}}function tQr(a,e){var r=e[0].length-a[0].length;return r!==0?r:a[0].toUpperCase().localeCompare(e[0].toUpperCase())}var P9r=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(tQr),rHn=0,aHn=1,j9r=[function(a){return a.toUpperCase()},function(a){return a.trim()},function(a){return a.replace(/\./g,"")},function(a){return a.replace(/\s+/g,"")},function(a){return a.replace(/\s+/g,"-")},function(a){return a.replace("v","-")},function(a){return a.replace(/,?\s*(\d)/,"-$1")},function(a){return a.replace(/,?\s*(\d)/,"-$1.0")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(a){return a[0].toUpperCase()+a.slice(1)},function(a){return a.replace("/","-")},function(a){return a.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(a){return a.indexOf("3.0")!==-1?a+"-or-later":a+"-only"},function(a){return a+"only"},function(a){return a.replace(/(\d)$/,"-$1.0")},function(a){return a.replace(/(-| )?(\d)$/,"-$2-Clause")},function(a){return a.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(a){return a.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(a){return a.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(a){return a.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(a){return a.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(a){return a.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(a){return"CC-"+a},function(a){return"CC-"+a+"-4.0"},function(a){return a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(a){return"CC-"+a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],wpt=tHn.map(function(a){var e=/^(.*)-\d+\.\d+$/.exec(a);return e?[e[0],e[1]]:[a,null]}).reduce(function(a,e){var r=e[1];return a[r]=a[r]||[],a[r].push(e[0]),a},{}),nHn=Object.keys(wpt).map(function(e){return[e,wpt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});wpt=void 0;var q9r=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(nHn).sort(tQr),iHn=0,sHn=1,K9r=function(a){for(var e=0;e<j9r.length;e++){var r=j9r[e](a).trim();if(r!==a&&CAe(r))return r}return null},$9r=function(a){for(var e=a.toUpperCase(),r=0;r<q9r.length;r++){var n=q9r[r];if(e.indexOf(n[iHn])>-1)return n[sHn]}return null},eQr=function(a,e){for(var r=0;r<P9r.length;r++){var n=P9r[r],i=n[rHn];if(a.indexOf(i)>-1){var s=a.replace(i,n[aHn]),t=e(s);if(t!==null)return t}}return null};rQr.exports=function(a,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(o){return r?oHn(o):o}var i=typeof a=="string"&&a.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(a=a.trim(),CAe(a))return n(a);var s=a.replace(/\+$/,"").trim();if(CAe(s))return n(s);var t=K9r(a);return t!==null||(t=eQr(a,function(o){return CAe(o)?o:K9r(o)}),t!==null)||(t=$9r(a),t!==null)||(t=eQr(a,$9r),t!==null)?n(t):null};function oHn(a){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(a)!==-1?a+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(a)!==-1?a.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(a)!==-1?a+"-or-later":a}});var oQr=He((M2s,sQr)=>{var lHn=Fpt(),cHn=aQr(),nQr='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',uHn=/^SEE LICEN[CS]E IN (.+)$/;function iQr(a,e){return e.slice(0,a.length)===a}function Rpt(a){if(a.hasOwnProperty("license")){var e=a.license;return iQr("LicenseRef",e)||iQr("DocumentRef",e)}else return Rpt(a.left)||Rpt(a.right)}sQr.exports=function(a){var e;try{e=lHn(a)}catch{var r;if(a==="UNLICENSED"||a==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=uHn.exec(a))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[nQr]};if(a.trim().length!==0){var i=cHn(a);i&&n.warnings.push('license is similar to the valid expression "'+i+'"')}return n}return Rpt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[nQr]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var IQr=He(VAe=>{"use strict";Object.defineProperty(VAe,"__esModule",{value:!0});VAe.LRUCache=void 0;var iP=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,cQr=new Set,Apt=typeof process=="object"&&process?process:{},uQr=(a,e,r,n)=>{typeof Apt.emitWarning=="function"?Apt.emitWarning(a,e,r,n):console.error(`[${r}] ${e}: ${a}`)},YAe=globalThis.AbortController,lQr=globalThis.AbortSignal;if(typeof YAe>"u"){lQr=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},YAe=class{constructor(){e()}signal=new lQr;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let a=Apt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{a&&(a=!1,uQr("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var dHn=a=>!cQr.has(a),_2s=Symbol("type"),X9=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),dQr=a=>X9(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?sP:null:null,sP=class extends Array{constructor(e){super(e),this.fill(0)}},Ept=class a{heap;length;static#e=!1;static create(e){let r=dQr(e);if(!r)return[];a.#e=!0;let n=new a(e,r);return a.#e=!1,n}constructor(e,r){if(!a.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},xpt=class a{#e;#t;#r;#a;#i;#n;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#o;#s;#I;#d;#h;#l;#p;#b;#G;#m;#N;#y;#W;#F;#v;#g;static unsafeExposeInternals(e){return{starts:e.#y,ttls:e.#W,sizes:e.#N,keyMap:e.#s,keyList:e.#I,valList:e.#d,next:e.#h,prev:e.#l,get head(){return e.#p},get tail(){return e.#b},free:e.#G,isBackgroundFetch:r=>e.#Z(r),backgroundFetch:(r,n,i,s)=>e.#C(r,n,i,s),moveToTail:r=>e.#D(r),indexes:r=>e.#L(r),rindexes:r=>e.#V(r),isStale:r=>e.#E(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#o}get size(){return this.#c}get fetchMethod(){return this.#i}get memoMethod(){return this.#n}get dispose(){return this.#r}get disposeAfter(){return this.#a}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:t,updateAgeOnHas:o,allowStale:d,dispose:I,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:Z=0,sizeCalculation:v,fetchMethod:N,memoMethod:g,noDeleteOnFetchRejection:E,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:p,ignoreFetchAbort:y}=e;if(r!==0&&!X9(r))throw new TypeError("max option must be a nonnegative integer");let W=r?dQr(r):Array;if(!W)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=Z||this.#t,this.sizeCalculation=v,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#n=g,N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#i=N,this.#v=!!N,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new W(r),this.#l=new W(r),this.#p=0,this.#b=0,this.#G=Ept.create(r),this.#c=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof u=="function"?(this.#a=u,this.#m=[]):(this.#a=void 0,this.#m=void 0),this.#F=!!this.#r,this.#g=!!this.#a,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!E,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!p,this.ignoreFetchAbort=!!y,this.maxEntrySize!==0){if(this.#t!==0&&!X9(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!X9(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#x()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!o,this.ttlResolution=X9(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!X9(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#w()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let R="LRU_CACHE_UNBOUNDED";dHn(R)&&(cQr.add(R),uQr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",R,a))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#w(){let e=new sP(this.#e),r=new sP(this.#e);this.#W=e,this.#y=r,this.#H=(s,t,o=iP.now())=>{if(r[s]=t!==0?o:0,e[s]=t,t!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#E(s)&&this.#k(this.#I[s],"expire")},t+1);d.unref&&d.unref()}},this.#A=s=>{r[s]=e[s]!==0?iP.now():0},this.#u=(s,t)=>{if(e[t]){let o=e[t],d=r[t];if(!o||!d)return;s.ttl=o,s.start=d,s.now=n||i();let I=s.now-d;s.remainingTTL=o-I}};let n=0,i=()=>{let s=iP.now();if(this.ttlResolution>0){n=s;let t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return s};this.getRemainingTTL=s=>{let t=this.#s.get(s);if(t===void 0)return 0;let o=e[t],d=r[t];if(!o||!d)return 1/0;let I=(n||i())-d;return o-I},this.#E=s=>{let t=r[s],o=e[s];return!!o&&!!t&&(n||i())-t>o}}#A=()=>{};#u=()=>{};#H=()=>{};#E=()=>!1;#x(){let e=new sP(this.#e);this.#o=0,this.#N=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#R=(r,n,i,s)=>{if(this.#Z(n))return 0;if(!X9(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!X9(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#S=(r,n,i)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#o>s;)this.#J(!0)}this.#o+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,n)=>{};#R=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#b;!(!this.#X(r)||((e||!this.#E(r))&&(yield r),r===this.#p));)r=this.#l[r]}*#V({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#p;!(!this.#X(r)||((e||!this.#E(r))&&(yield r),r===this.#b));)r=this.#h[r]}#X(e){return e!==void 0&&this.#s.get(this.#I[e])===e}*entries(){for(let e of this.#L())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*rentries(){for(let e of this.#V())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*keys(){for(let e of this.#L()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*rkeys(){for(let e of this.#V()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*values(){for(let e of this.#L())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#V())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#L()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#I[n],this))return this.get(this.#I[n],r)}}forEach(e,r=this){for(let n of this.#L()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[n],this)}}rforEach(e,r=this){for(let n of this.#V()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[n],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#E(r)&&(this.#k(this.#I[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#d[r],i=this.#Z(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#W&&this.#y){let t=this.#W[r],o=this.#y[r];if(t&&o){let d=t-(iP.now()-o);s.ttl=d,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#L({allowStale:!0})){let n=this.#I[r],i=this.#d[r],s=this.#Z(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let t={value:s};if(this.#W&&this.#y){t.ttl=this.#W[r];let o=iP.now()-this.#y[r];t.start=Math.floor(Date.now()-o)}this.#N&&(t.size=this.#N[r]),e.unshift([n,t])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=iP.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:d}=n,{noUpdateTTL:I=this.noUpdateTTL}=n,u=this.#R(e,r,n.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#k(e,"set"),this;let h=this.#c===0?void 0:this.#s.get(e);if(h===void 0)h=this.#c===0?this.#b:this.#G.length!==0?this.#G.pop():this.#c===this.#e?this.#J(!1):this.#c,this.#I[h]=e,this.#d[h]=r,this.#s.set(e,h),this.#h[this.#b]=h,this.#l[h]=this.#b,this.#b=h,this.#c++,this.#S(h,u,d),d&&(d.set="add"),I=!1;else{this.#D(h);let c=this.#d[h];if(r!==c){if(this.#v&&this.#Z(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=c;m!==void 0&&!t&&(this.#F&&this.#r?.(m,e,"set"),this.#g&&this.#m?.push([m,e,"set"]))}else t||(this.#F&&this.#r?.(c,e,"set"),this.#g&&this.#m?.push([c,e,"set"]));if(this.#Y(h),this.#S(h,u,d),this.#d[h]=r,d){d.set="replace";let m=c&&this.#Z(c)?c.__staleWhileFetching:c;m!==void 0&&(d.oldValue=m)}}else d&&(d.set="update")}if(i!==0&&!this.#W&&this.#w(),this.#W&&(I||this.#H(h,i,s),d&&this.#u(d,h)),!t&&this.#g&&this.#m){let c=this.#m,m;for(;m=c?.shift();)this.#a?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#p];if(this.#J(!0),this.#Z(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#g&&this.#m){let e=this.#m,r;for(;r=e?.shift();)this.#a?.(...r)}}}#J(e){let r=this.#p,n=this.#I[r],i=this.#d[r];return this.#v&&this.#Z(i)?i.__abortController.abort(new Error("evicted")):(this.#F||this.#g)&&(this.#F&&this.#r?.(i,n,"evict"),this.#g&&this.#m?.push([i,n,"evict"])),this.#Y(r),e&&(this.#I[r]=void 0,this.#d[r]=void 0,this.#G.push(r)),this.#c===1?(this.#p=this.#b=0,this.#G.length=0):this.#p=this.#h[r],this.#s.delete(n),this.#c--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#s.get(e);if(s!==void 0){let t=this.#d[s];if(this.#Z(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#E(s))i&&(i.has="stale",this.#u(i,s));else return n&&this.#A(s),i&&(i.has="hit",this.#u(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!n&&this.#E(i))return;let s=this.#d[i];return this.#Z(s)?s.__staleWhileFetching:s}#C(e,r,n,i){let s=r===void 0?void 0:this.#d[r];if(this.#Z(s))return s;let t=new YAe,{signal:o}=n;o?.addEventListener("abort",()=>t.abort(o.reason),{signal:t.signal});let d={signal:t.signal,options:n,context:i},I=(v,N=!1)=>{let{aborted:g}=t.signal,E=n.ignoreFetchAbort&&v!==void 0;if(n.status&&(g&&!N?(n.status.fetchAborted=!0,n.status.fetchError=t.signal.reason,E&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),g&&!E&&!N)return h(t.signal.reason);let w=m;return this.#d[r]===m&&(v===void 0?w.__staleWhileFetching?this.#d[r]=w.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,v,d.options))),v},u=v=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=v),h(v)),h=v=>{let{aborted:N}=t.signal,g=N&&n.allowStaleOnFetchAbort,E=g||n.allowStaleOnFetchRejection,w=E||n.noDeleteOnFetchRejection,A=m;if(this.#d[r]===m&&(!w||A.__staleWhileFetching===void 0?this.#k(e,"fetch"):g||(this.#d[r]=A.__staleWhileFetching)),E)return n.status&&A.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),A.__staleWhileFetching;if(A.__returned===A)throw v},c=(v,N)=>{let g=this.#i?.(e,s,d);g&&g instanceof Promise&&g.then(E=>v(E===void 0?void 0:E),N),t.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(v(void 0),n.allowStaleOnFetchAbort&&(v=E=>I(E,!0)))})};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(c).then(I,u),Z=Object.assign(m,{__abortController:t,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,Z,{...d.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=Z,Z}#Z(e){if(!this.#v)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof YAe}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:d=0,sizeCalculation:I=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:v,forceRefresh:N=!1,status:g,signal:E}=r;if(!this.#v)return g&&(g.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:g});let w={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:t,noDisposeOnSet:o,size:d,sizeCalculation:I,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:Z,ignoreFetchAbort:m,status:g,signal:E},A=this.#s.get(e);if(A===void 0){g&&(g.fetch="miss");let p=this.#C(e,A,w,v);return p.__returned=p}else{let p=this.#d[A];if(this.#Z(p)){let b=n&&p.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",b&&(g.returnedStale=!0)),b?p.__staleWhileFetching:p.__returned=p}let y=this.#E(A);if(!N&&!y)return g&&(g.fetch="hit"),this.#D(A),i&&this.#A(A),g&&this.#u(g,A),p;let W=this.#C(e,A,w,v),f=W.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=y?"stale":"refresh",f&&y&&(g.returnedStale=!0)),f?W.__staleWhileFetching:W.__returned=W}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#n;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...t}=r,o=this.get(e,t);if(!s&&o!==void 0)return o;let d=n(e,o,{options:t,context:i});return this.set(e,d,t),d}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:t}=r,o=this.#s.get(e);if(o!==void 0){let d=this.#d[o],I=this.#Z(d);return t&&this.#u(t,o),this.#E(o)?(t&&(t.get="stale"),I?(t&&n&&d.__staleWhileFetching!==void 0&&(t.returnedStale=!0),n?d.__staleWhileFetching:void 0):(s||this.#k(e,"expire"),t&&n&&(t.returnedStale=!0),n?d:void 0)):(t&&(t.get="hit"),I?d.__staleWhileFetching:(this.#D(o),i&&this.#A(o),d))}else t&&(t.get="miss")}#T(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#b&&(e===this.#p?this.#p=this.#h[e]:this.#T(this.#l[e],this.#h[e]),this.#T(this.#b,e),this.#b=e)}delete(e){return this.#k(e,"delete")}#k(e,r){let n=!1;if(this.#c!==0){let i=this.#s.get(e);if(i!==void 0)if(n=!0,this.#c===1)this.#f(r);else{this.#Y(i);let s=this.#d[i];if(this.#Z(s)?s.__abortController.abort(new Error("deleted")):(this.#F||this.#g)&&(this.#F&&this.#r?.(s,e,r),this.#g&&this.#m?.push([s,e,r])),this.#s.delete(e),this.#I[i]=void 0,this.#d[i]=void 0,i===this.#b)this.#b=this.#l[i];else if(i===this.#p)this.#p=this.#h[i];else{let t=this.#l[i];this.#h[t]=this.#h[i];let o=this.#h[i];this.#l[o]=this.#l[i]}this.#c--,this.#G.push(i)}}if(this.#g&&this.#m?.length){let i=this.#m,s;for(;s=i?.shift();)this.#a?.(...s)}return n}clear(){return this.#f("delete")}#f(e){for(let r of this.#V({allowStale:!0})){let n=this.#d[r];if(this.#Z(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#F&&this.#r?.(n,i,e),this.#g&&this.#m?.push([n,i,e])}}if(this.#s.clear(),this.#d.fill(void 0),this.#I.fill(void 0),this.#W&&this.#y&&(this.#W.fill(0),this.#y.fill(0)),this.#N&&this.#N.fill(0),this.#p=0,this.#b=0,this.#G.length=0,this.#o=0,this.#c=0,this.#g&&this.#m){let r=this.#m,n;for(;n=r?.shift();)this.#a?.(...n)}}};VAe.LRUCache=xpt});var pQr=He((j2s,mQr)=>{"use strict";var Hl=(...a)=>a.every(e=>e)?a.join(""):"",zh=a=>a?encodeURIComponent(a):"",hQr=a=>a.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),IHn={sshtemplate:({domain:a,user:e,project:r,committish:n})=>`git@${a}:${e}/${r}.git${Hl("#",n)}`,sshurltemplate:({domain:a,user:e,project:r,committish:n})=>`git+ssh://git@${a}/${e}/${r}.git${Hl("#",n)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i,path:s})=>`https://${a}/${e}/${r}${Hl("/",i,"/",zh(n||"HEAD"),"/",s)}`,browsetemplate:({domain:a,user:e,project:r,committish:n,treepath:i})=>`https://${a}/${e}/${r}${Hl("/",i,"/",zh(n))}`,browsetreetemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:s,fragment:t,hashformat:o})=>`https://${a}/${e}/${r}/${i}/${zh(n||"HEAD")}/${s}${Hl("#",o(t||""))}`,browseblobtemplate:({domain:a,user:e,project:r,committish:n,blobpath:i,path:s,fragment:t,hashformat:o})=>`https://${a}/${e}/${r}/${i}/${zh(n||"HEAD")}/${s}${Hl("#",o(t||""))}`,docstemplate:({domain:a,user:e,project:r,treepath:n,committish:i})=>`https://${a}/${e}/${r}${Hl("/",n,"/",zh(i))}#readme`,httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Hl(a,"@")}${e}/${r}/${n}.git${Hl("#",i)}`,filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/raw/${zh(n||"HEAD")}/${i}`,shortcuttemplate:({type:a,user:e,project:r,committish:n})=>`${a}:${e}/${r}${Hl("#",n)}`,pathtemplate:({user:a,project:e,committish:r})=>`${a}/${e}${Hl("#",r)}`,bugstemplate:({domain:a,user:e,project:r})=>`https://${a}/${e}/${r}/issues`,hashformat:hQr},k9={};k9.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:a,user:e,project:r,committish:n,path:i})=>`https://${Hl(a,"@")}raw.githubusercontent.com/${e}/${r}/${zh(n||"HEAD")}/${i}`,gittemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git://${Hl(a,"@")}${e}/${r}/${n}.git${Hl("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://codeload.${a}/${e}/${r}/tar.gz/${zh(n||"HEAD")}`,extract:a=>{let[,e,r,n,i]=a.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(i=a.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};k9.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:s,editpath:t})=>`https://${a}/${e}/${r}${Hl("/",i,"/",zh(n||"HEAD"),"/",s,t)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/get/${zh(n||"HEAD")}.tar.gz`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};k9.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Hl(a,"@")}${e}/${r}/${n}.git${Hl("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/repository/archive.tar.gz?ref=${zh(n||"HEAD")}`,extract:a=>{let e=a.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let i=r.join("/");if(!(!i||!n))return{user:i,project:n,committish:a.hash.slice(1)}}};k9.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:a,project:e,committish:r})=>`git@${a}:${e}.git${Hl("#",r)}`,sshurltemplate:({domain:a,project:e,committish:r})=>`git+ssh://git@${a}/${e}.git${Hl("#",r)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i})=>`https://${a}/${e}/${r}${Hl("/",zh(n))}/${i}`,browsetemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Hl("/",zh(r))}`,browsetreetemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Hl("/",zh(r))}${Hl("#",i(n))}`,browseblobtemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Hl("/",zh(r))}${Hl("#",i(n))}`,docstemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Hl("/",zh(r))}`,httpstemplate:({domain:a,project:e,committish:r})=>`git+https://${a}/${e}.git${Hl("#",r)}`,filetemplate:({user:a,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${a}/${e}/raw${Hl("/",zh(r))}/${n}`,shortcuttemplate:({type:a,project:e,committish:r})=>`${a}:${e}${Hl("#",r)}`,pathtemplate:({project:a,committish:e})=>`${a}${Hl("#",e)}`,bugstemplate:({domain:a,project:e})=>`https://${a}/${e}`,gittemplate:({domain:a,project:e,committish:r})=>`git://${a}/${e}.git${Hl("#",r)}`,tarballtemplate:({project:a,committish:e})=>`https://codeload.github.com/gist/${a}/tar.gz/${zh(e||"HEAD")}`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:a.hash.slice(1)}}},hashformat:function(a){return a&&"file-"+hQr(a)}};k9.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/blob/${zh(n)||"HEAD"}/${i}`,httpstemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}.git${Hl("#",n)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/archive/${zh(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};for(let[a,e]of Object.entries(k9))k9[a]=Object.assign({},IHn,e);mQr.exports=k9});var Ypt=He((q2s,fQr)=>{var hHn=Ct("url"),Cpt=(a,e,r)=>{let n=a.indexOf(r);return a.lastIndexOf(e,n>-1?n:1/0)},bQr=a=>{try{return new hHn.URL(a)}catch{}},mHn=(a,e)=>{let r=a.indexOf(":"),n=a.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return a;let i=a.indexOf("@");return i>-1?i>r?`git+ssh://${a}`:a:a.indexOf("//")===r+1?a:`${a.slice(0,r+1)}//${a.slice(r+1)}`},pHn=a=>{let e=Cpt(a,"@","#"),r=Cpt(a,":","#");return r>e&&(a=a.slice(0,r)+"/"+a.slice(r+1)),Cpt(a,":","#")===-1&&a.indexOf("//")===-1&&(a=`git+ssh://${a}`),a};fQr.exports=(a,e)=>{let r=e?mHn(a,e):a;return bQr(r)||bQr(pHn(r))}});var gQr=He((K2s,GQr)=>{"use strict";var bHn=Ypt(),fHn=a=>{let e=a.indexOf("#"),r=a.indexOf("/"),n=a.indexOf("/",r+1),i=a.indexOf(":"),s=/\s/.exec(a),t=a.indexOf("@"),o=!s||e>-1&&s.index>e,d=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,u=n===-1||e>-1&&n>e,h=r>0,c=e>-1?a[e-1]!=="/":!a.endsWith("/"),m=!a.startsWith(".");return o&&h&&c&&m&&d&&I&&u};GQr.exports=(a,e,{gitHosts:r,protocols:n})=>{if(!a)return;let i=fHn(a)?`github:${a}`:a,s=bHn(i,n);if(!s)return;let t=r.byShortcut[s.protocol],o=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],d=t||o;if(!d)return;let I=r[t||o],u=null;n[s.protocol]?.auth&&(s.username||s.password)&&(u=`${s.username}${s.password?":"+s.password:""}`);let h=null,c=null,m=null,Z=null;try{if(t){let v=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,N=v.indexOf("@");N>-1&&(v=v.slice(N+1));let g=v.lastIndexOf("/");g>-1?(c=decodeURIComponent(v.slice(0,g)),c||(c=null),m=decodeURIComponent(v.slice(g+1))):m=decodeURIComponent(v),m.endsWith(".git")&&(m=m.slice(0,-4)),s.hash&&(h=decodeURIComponent(s.hash.slice(1))),Z="shortcut"}else{if(!I.protocols.includes(s.protocol))return;let v=I.extract(s);if(!v)return;c=v.user&&decodeURIComponent(v.user),m=decodeURIComponent(v.project),h=decodeURIComponent(v.committish),Z=n[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(v){if(v instanceof URIError)return;throw v}return[d,c,u,m,h,Z,e]}});var yQr=He(($2s,vQr)=>{"use strict";var{LRUCache:GHn}=IQr(),gHn=pQr(),vHn=gQr(),yHn=Ypt(),Vpt=new GHn({max:1e3}),QAe=class a{constructor(e,r,n,i,s,t,o={}){Object.assign(this,a.#e[e],{type:e,user:r,auth:n,project:i,committish:s,default:t,opts:o})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){a.#e[e]=r,a.#e.byDomain[r.domain]=e,a.#e.byShortcut[`${e}:`]=e,a.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!Vpt.has(n)){let i=vHn(e,r,{gitHosts:a.#e,protocols:a.#t});Vpt.set(n,i?new a(...i):void 0)}return Vpt.get(n)}static parseUrl(e){return yHn(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let i=e(n);return n.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[a,e]of Object.entries(gHn))QAe.addHost(a,e);vQr.exports=QAe});var NQr=He((eGs,ZQr)=>{ZQr.exports=ZHn;function ZHn(a){if(!a||a==="ERROR: No README data found!")return;a=a.trim().split(`
|
|
5482
|
-
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var WQr=He((tGs,NHn)=>{NHn.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var AQr=He((rGs,RQr)=>{var WHn=Zpt(),FHn=Npt(),wHn=oQr(),HAe=yQr(),RHn=Ct("node:module"),AHn=["dependencies","devDependencies","optionalDependencies"],EHn=NQr(),Qpt=Ct("url"),S9=WQr(),FQr=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");RQr.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=HAe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(S9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,S9.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):S9.script[e]&&!a.scripts[S9.script[e]]&&this.warn("typo",e,S9.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){kHn(a,this.warn),HHn(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=HAe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!WHn(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=FHn(a.version,r),!0},fixPeople:function(a){wQr(a,VHn),wQr(a,QHn)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),YHn(a.name,r,e.allowLegacyCase),RHn.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=EHn(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=HAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")FQr(a.bugs)?a.bugs={email:a.bugs}:Qpt.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{SHn(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&Qpt.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&FQr(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=HAe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;Qpt.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!wHn(e).validForNewPackages)return this.warn("invalidLicense")}};function xHn(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function CHn(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function YHn(a,e,r){if(a.charAt(0)==="."||!(xHn(a)||CHn(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function wQr(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function VHn(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,s=i?" <"+i+">":"";return e+s+n}function QHn(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function HHn(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function XHn(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[s]=t}),n}function kHn(a,e){AHn.forEach(function(r){a[r]&&(a[r]=XHn(a[r],r,e))})}function SHn(a,e){a&&Object.keys(a).forEach(function(r){S9.bugs[r]&&(e("typo",r,S9.bugs[r],"bugs"),a[S9.bugs[r]]=a[r],delete a[r])})}});var EQr=He((aGs,LHn)=>{LHn.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var YQr=He((nGs,CQr)=>{var xQr=Ct("util"),Hpt=EQr();CQr.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return JHn.apply(null,a);var r=Hpt[e]?Hpt[e]:e+": '%s'";return a.unshift(r),xQr.format.apply(null,a)};function JHn(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),xQr.format(Hpt.typo,a,e)}});var XQr=He((iGs,HQr)=>{HQr.exports=VQr;var Xpt=AQr();VQr.fixer=Xpt;var BHn=YQr(),THn=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],DHn=["dependencies","people","typos"],kpt=THn.map(function(a){return QQr(a)+"Field"});kpt=kpt.concat(DHn);function VQr(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),Xpt.warn=function(){e(BHn.apply(null,arguments))},kpt.forEach(function(n){Xpt["fix"+QQr(n)](a,r)}),a._id=a.name+"@"+a.version}function QQr(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var kQr=_e(()=>{});import{fileURLToPath as OHn}from"node:url";function SQr(a){return a instanceof URL?OHn(a):a}var LQr=_e(()=>{kQr()});import MHn from"node:fs/promises";import UHn from"node:path";async function BQr({cwd:a,normalize:e=!0}={}){let r=await MHn.readFile(zHn(a),"utf8");return _Hn(r,e)}var JQr,zHn,_Hn,TQr=_e(()=>{A9r();JQr=Qt(XQr(),1);LQr();zHn=a=>UHn.resolve(SQr(a)??".","package.json"),_Hn=(a,e)=>{let r=typeof a=="string"?bpt(a):a;return e&&(0,JQr.default)(r),r}});import PHn from"node:path";async function DQr(a){let e=await e9r("package.json",a);if(e)return{packageJson:await BQr({...a,cwd:PHn.dirname(e)}),path:e}}var OQr=_e(()=>{t9r();TQr()});import{fileURLToPath as jHn}from"url";import qHn from"path";async function lP(){if(oP)return oP;let a=await DQr({cwd:$Hn});if(!a){let e="hwjcode-cli",r="1.1.130";return e&&r?(oP={name:e,version:r},oP):void 0}return oP=a.packageJson,oP}var KHn,$Hn,oP,XAe=_e(()=>{"use strict";OQr();KHn=jHn(import.meta.url),$Hn=qHn.dirname(KHn)});var MQr={};Xs(MQr,{getCliVersion:()=>MW});async function MW(){let a=await lP();return"1.1.130"}var mL=_e(()=>{"use strict";XAe();});import pL from"node:process";var UQr,zQr=_e(()=>{"use strict";mL();Wi();ks();ma();UQr={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=pL.platform,r="no sandbox";pL.env.SANDBOX&&pL.env.SANDBOX!=="sandbox-exec"?r=pL.env.SANDBOX:pL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${pL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await MW(),s=a.services.settings.merged.selectedAuthType||"",t=pL.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:t};a.ui.addItem(o,Date.now())}}});var _Qr,PQr=_e(()=>{"use strict";Wi();ma();_Qr={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var jQr,qQr=_e(()=>{"use strict";Wi();ma();jQr={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var KQr,$Qr=_e(()=>{"use strict";ks();Wi();ma();KQr={name:"compress",altNames:["summarize","compact"],description:we("command.compress.description"),kind:"built-in",action:async a=>{let{ui:e}=a,r=a.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:we("command.compress.starting")},Date.now());let n={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(n);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});function cP(a=UZ()){return a.edition==="personal"?["all","none"]:["all","deepv-only","none"]}function uP(a,e=UZ()){return e.edition==="personal"&&a==="deepv-only"?"all":a??"all"}function eHr(a,e=UZ()){return cP(e).includes(a)}function kAe(a,e,r=UZ()){let n=uP(e,r);if(n==="none")return{memoryContent:"",fileCount:0,filePaths:[]};if(n==="deepv-only"){let i=a.filePaths.filter(t=>!(t.split(/[\\/]/).pop()||"").toUpperCase().startsWith("AGENTS"));return i.length===a.filePaths.length?a:{memoryContent:a.memoryContent.split(`
|
|
5482
|
+
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var WQr=He((tGs,NHn)=>{NHn.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var AQr=He((rGs,RQr)=>{var WHn=Zpt(),FHn=Npt(),wHn=oQr(),HAe=yQr(),RHn=Ct("node:module"),AHn=["dependencies","devDependencies","optionalDependencies"],EHn=NQr(),Qpt=Ct("url"),S9=WQr(),FQr=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");RQr.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=HAe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(S9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,S9.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):S9.script[e]&&!a.scripts[S9.script[e]]&&this.warn("typo",e,S9.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){kHn(a,this.warn),HHn(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=HAe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!WHn(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=FHn(a.version,r),!0},fixPeople:function(a){wQr(a,VHn),wQr(a,QHn)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),YHn(a.name,r,e.allowLegacyCase),RHn.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=EHn(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=HAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")FQr(a.bugs)?a.bugs={email:a.bugs}:Qpt.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{SHn(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&Qpt.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&FQr(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=HAe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;Qpt.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!wHn(e).validForNewPackages)return this.warn("invalidLicense")}};function xHn(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function CHn(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function YHn(a,e,r){if(a.charAt(0)==="."||!(xHn(a)||CHn(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function wQr(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function VHn(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,s=i?" <"+i+">":"";return e+s+n}function QHn(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function HHn(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function XHn(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[s]=t}),n}function kHn(a,e){AHn.forEach(function(r){a[r]&&(a[r]=XHn(a[r],r,e))})}function SHn(a,e){a&&Object.keys(a).forEach(function(r){S9.bugs[r]&&(e("typo",r,S9.bugs[r],"bugs"),a[S9.bugs[r]]=a[r],delete a[r])})}});var EQr=He((aGs,LHn)=>{LHn.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var YQr=He((nGs,CQr)=>{var xQr=Ct("util"),Hpt=EQr();CQr.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return JHn.apply(null,a);var r=Hpt[e]?Hpt[e]:e+": '%s'";return a.unshift(r),xQr.format.apply(null,a)};function JHn(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),xQr.format(Hpt.typo,a,e)}});var XQr=He((iGs,HQr)=>{HQr.exports=VQr;var Xpt=AQr();VQr.fixer=Xpt;var BHn=YQr(),THn=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],DHn=["dependencies","people","typos"],kpt=THn.map(function(a){return QQr(a)+"Field"});kpt=kpt.concat(DHn);function VQr(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),Xpt.warn=function(){e(BHn.apply(null,arguments))},kpt.forEach(function(n){Xpt["fix"+QQr(n)](a,r)}),a._id=a.name+"@"+a.version}function QQr(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var kQr=_e(()=>{});import{fileURLToPath as OHn}from"node:url";function SQr(a){return a instanceof URL?OHn(a):a}var LQr=_e(()=>{kQr()});import MHn from"node:fs/promises";import UHn from"node:path";async function BQr({cwd:a,normalize:e=!0}={}){let r=await MHn.readFile(zHn(a),"utf8");return _Hn(r,e)}var JQr,zHn,_Hn,TQr=_e(()=>{A9r();JQr=Qt(XQr(),1);LQr();zHn=a=>UHn.resolve(SQr(a)??".","package.json"),_Hn=(a,e)=>{let r=typeof a=="string"?bpt(a):a;return e&&(0,JQr.default)(r),r}});import PHn from"node:path";async function DQr(a){let e=await e9r("package.json",a);if(e)return{packageJson:await BQr({...a,cwd:PHn.dirname(e)}),path:e}}var OQr=_e(()=>{t9r();TQr()});import{fileURLToPath as jHn}from"url";import qHn from"path";async function lP(){if(oP)return oP;let a=await DQr({cwd:$Hn});if(!a){let e="hwjcode-cli",r="1.1.131";return e&&r?(oP={name:e,version:r},oP):void 0}return oP=a.packageJson,oP}var KHn,$Hn,oP,XAe=_e(()=>{"use strict";OQr();KHn=jHn(import.meta.url),$Hn=qHn.dirname(KHn)});var MQr={};Xs(MQr,{getCliVersion:()=>MW});async function MW(){let a=await lP();return"1.1.131"}var mL=_e(()=>{"use strict";XAe();});import pL from"node:process";var UQr,zQr=_e(()=>{"use strict";mL();Wi();ks();ma();UQr={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=pL.platform,r="no sandbox";pL.env.SANDBOX&&pL.env.SANDBOX!=="sandbox-exec"?r=pL.env.SANDBOX:pL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${pL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await MW(),s=a.services.settings.merged.selectedAuthType||"",t=pL.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:t};a.ui.addItem(o,Date.now())}}});var _Qr,PQr=_e(()=>{"use strict";Wi();ma();_Qr={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var jQr,qQr=_e(()=>{"use strict";Wi();ma();jQr={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var KQr,$Qr=_e(()=>{"use strict";ks();Wi();ma();KQr={name:"compress",altNames:["summarize","compact"],description:we("command.compress.description"),kind:"built-in",action:async a=>{let{ui:e}=a,r=a.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:we("command.compress.starting")},Date.now());let n={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(n);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});function cP(a=UZ()){return a.edition==="personal"?["all","none"]:["all","deepv-only","none"]}function uP(a,e=UZ()){return e.edition==="personal"&&a==="deepv-only"?"all":a??"all"}function eHr(a,e=UZ()){return cP(e).includes(a)}function kAe(a,e,r=UZ()){let n=uP(e,r);if(n==="none")return{memoryContent:"",fileCount:0,filePaths:[]};if(n==="deepv-only"){let i=a.filePaths.filter(t=>!(t.split(/[\\/]/).pop()||"").toUpperCase().startsWith("AGENTS"));return i.length===a.filePaths.length?a:{memoryContent:a.memoryContent.split(`
|
|
5483
5483
|
|
|
5484
5484
|
`).filter(t=>!t.includes("AGENTS.md ---")).join(`
|
|
5485
5485
|
|
package/bundle/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hwjcode-personal",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.131",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.0.0"
|
|
6
6
|
},
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"lint": "eslint . --ext .ts,.tsx && eslint integration-tests",
|
|
62
62
|
"lint:fix": "eslint . --fix && eslint integration-tests --fix",
|
|
63
63
|
"lint:ci": "eslint . --ext .ts,.tsx --max-warnings 0 && eslint integration-tests --max-warnings 0",
|
|
64
|
+
"lint:changed": "node scripts/lint-changed.js",
|
|
64
65
|
"format": "prettier --write .",
|
|
65
66
|
"typecheck": "npm run build --workspace hwjcode-core && npm run typecheck --workspaces --if-present",
|
|
66
67
|
"preflight": "npm run clean && npm ci && npm run format && npm run lint:ci && npm run build && npm run typecheck && npm run test:ci",
|