hwjcode-personal 1.1.126 → 1.1.127
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 +1 -1
package/bundle/hwjcode.js
CHANGED
|
@@ -2186,7 +2186,7 @@ ${e.format(r)}`.trim())}};sbr.exports=gst});var yst=He((WMi,ubr)=>{"use strict";
|
|
|
2186
2186
|
${s}`;break;case"retry":UGr(s)&&(r[i]=s);break;case"id":zGr(s)&&(r[i]=s);break;case"event":s.length>0&&(r[i]=s);break}}processEvent(e){e.retry&&UGr(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&zGr(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}}};_Gr.exports={EventSourceStream:Lot}});var agr=He((GUi,rgr)=>{"use strict";var{pipeline:f0n}=Ct("node:stream"),{fetching:G0n}=Ese(),{makeRequest:g0n}=WU(),{webidl:b2}=Rp(),{EventSourceStream:v0n}=PGr(),{parseMIMEType:y0n}=lZ(),{createFastMessageEvent:Z0n}=xWe(),{isNetworkError:jGr}=wse(),{kEnumerableProperty:iS}=hs(),{environmentSettingsObject:qGr}=z1(),KGr=!1,$Gr=3e3,Xse=0,egr=1,kse=2,N0n="anonymous",W0n="use-credentials",QU=class a extends EventTarget{#e={open:null,error:null,message:null};#t;#r=!1;#a=Xse;#i=null;#n=null;#c;#o;constructor(e,r={}){super(),b2.util.markAsUncloneable(this);let n="EventSource constructor";b2.argumentLengthCheck(arguments,1,n),KGr||(KGr=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=b2.converters.USVString(e),r=b2.converters.EventSourceInitDict(r,n,"eventSourceInitDict"),this.#c=r.node.dispatcher||r.dispatcher,this.#o={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let i=qGr,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=N0n;r.withCredentials===!0&&(t=W0n,this.#r=!0);let o={redirect:"follow",keepalive:!0,mode:"cors",credentials:t==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};o.client=qGr.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=g0n(o),this.#s()}get readyState(){return this.#a}get url(){return this.#t}get withCredentials(){return this.#r}#s(){if(this.#a===kse)return;this.#a=Xse;let e={request:this.#i,dispatcher:this.#c},r=n=>{if(!jGr(n))return this.#I()};e.processResponseEndOfBody=r,e.processResponse=n=>{if(jGr(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?y0n(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=egr,this.dispatchEvent(new Event("open")),this.#o.origin=n.urlList[n.urlList.length-1].origin;let o=new v0n({eventSourceSettings:this.#o,push:d=>{this.dispatchEvent(Z0n(d.type,d.options))}});f0n(n.body.stream,o,d=>{d?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#n=G0n(e)}#I(){this.#a!==kse&&(this.#a=Xse,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#a===Xse&&(this.#o.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#o.lastEventId,!0),this.#s())},this.#o.reconnectionTime)?.unref())}close(){b2.brandCheck(this,a),this.#a!==kse&&(this.#a=kse,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=b2.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=b2.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=b2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("error",r),this.#e.error=e):this.#e.error=null}},tgr={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Xse,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:egr,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:kse,writable:!1}};Object.defineProperties(QU,tgr);Object.defineProperties(QU.prototype,tgr);Object.defineProperties(QU.prototype,{close:iS,onerror:iS,onmessage:iS,onopen:iS,readyState:iS,url:iS,withCredentials:iS});b2.converters.EventSourceInitDict=b2.dictionaryConverter([{key:"withCredentials",converter:b2.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:b2.converters.any},{key:"node",converter:b2.dictionaryConverter([{key:"reconnectionTime",converter:b2.converters["unsigned long"],defaultValue:()=>$Gr},{key:"dispatcher",converter:b2.converters.any}]),defaultValue:()=>({})}]);rgr.exports={EventSource:QU,defaultReconnectionTime:$Gr}});var OWe=He((gUi,Wn)=>{"use strict";var F0n=vV(),igr=Hie(),w0n=H6(),R0n=D0r(),A0n=z0r(),E0n=S6(),x0n=Nit(),C0n=git(),Y0n=Ymr(),V0n=Lmr(),Q0n=Tmr(),sgr=zi(),DWe=hs(),{InvalidArgumentError:TWe}=sgr,HU=Npr(),H0n=W6(),X0n=lst(),{MockCallHistory:k0n,MockCallHistoryLog:S0n}=dst(),L0n=vst(),J0n=pst(),B0n=Zbr(),T0n=Mit(),D0n=SNe(),{getGlobalDispatcher:ogr,setGlobalDispatcher:O0n}=$Ne(),M0n=GU(),U0n=Ast();Object.assign(igr.prototype,HU);Wn.exports.Dispatcher=igr;Wn.exports.Client=F0n;Wn.exports.Pool=w0n;Wn.exports.BalancedPool=R0n;Wn.exports.RoundRobinPool=A0n;Wn.exports.Agent=E0n;Wn.exports.ProxyAgent=x0n;Wn.exports.Socks5ProxyAgent=C0n;Wn.exports.EnvHttpProxyAgent=Y0n;Wn.exports.RetryAgent=V0n;Wn.exports.H2CClient=Q0n;Wn.exports.RetryHandler=D0n;Wn.exports.DecoratorHandler=M0n;Wn.exports.RedirectHandler=U0n;Wn.exports.interceptors={redirect:Vbr(),responseError:Hbr(),retry:kbr(),dump:Lbr(),dns:Dbr(),cache:yfr(),decompress:wfr(),deduplicate:Cfr()};Wn.exports.cacheStores={MemoryCacheStore:Dst()};var z0n=Qfr();Wn.exports.cacheStores.SqliteCacheStore=z0n;Wn.exports.buildConnector=H0n;Wn.exports.errors=sgr;Wn.exports.util={parseHeaders:DWe.parseHeaders,headerNameToString:DWe.headerNameToString};function Sse(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 TWe("invalid url");if(r!=null&&typeof r!="object")throw new TWe("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new TWe("invalid opts.path");let t=r.path;r.path.startsWith("/")||(t=`/${t}`),e=new URL(DWe.parseOrigin(e).origin+t)}else r||(r=typeof e=="object"?e:{}),e=DWe.parseURL(e);let{agent:i,dispatcher:s=ogr()}=r;if(i)throw new TWe("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=O0n;Wn.exports.getGlobalDispatcher=ogr;var _0n=Ese().fetch,ngr=typeof __filename<"u"?__filename:void 0;function lgr(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,lgr),!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 _0n(e,r).catch(n=>{throw ngr?lgr(n,ngr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=q6().Headers;Wn.exports.Response=wse().Response;Wn.exports.Request=WU().Request;Wn.exports.FormData=dNe().FormData;var{setGlobalOrigin:P0n,getGlobalOrigin:j0n}=nnt();Wn.exports.setGlobalOrigin=P0n;Wn.exports.getGlobalOrigin=j0n;var{CacheStorage:q0n}=O2r(),{kConstruct:K0n}=Zc();Wn.exports.caches=new q0n(K0n);var{deleteCookie:$0n,getCookies:emn,getSetCookies:tmn,setCookie:rmn,parseCookie:amn}=rGr();Wn.exports.deleteCookie=$0n;Wn.exports.getCookies=emn;Wn.exports.getSetCookies=tmn;Wn.exports.setCookie=rmn;Wn.exports.parseCookie=amn;var{parseMIMEType:nmn,serializeAMimeType:imn}=lZ();Wn.exports.parseMIMEType=nmn;Wn.exports.serializeAMimeType=imn;var{CloseEvent:smn,ErrorEvent:omn,MessageEvent:lmn}=xWe(),{WebSocket:cmn,ping:umn}=HGr();Wn.exports.WebSocket=cmn;Wn.exports.CloseEvent=smn;Wn.exports.ErrorEvent=omn;Wn.exports.MessageEvent=lmn;Wn.exports.ping=umn;Wn.exports.WebSocketStream=DGr().WebSocketStream;Wn.exports.WebSocketError=Qot().WebSocketError;Wn.exports.request=Sse(HU.request);Wn.exports.stream=Sse(HU.stream);Wn.exports.pipeline=Sse(HU.pipeline);Wn.exports.connect=Sse(HU.connect);Wn.exports.upgrade=Sse(HU.upgrade);Wn.exports.MockClient=X0n;Wn.exports.MockCallHistory=k0n;Wn.exports.MockCallHistoryLog=S0n;Wn.exports.MockPool=J0n;Wn.exports.MockAgent=L0n;Wn.exports.SnapshotAgent=B0n;Wn.exports.mockErrors=T0n;var{EventSource:dmn}=agr();Wn.exports.EventSource=dmn;function Imn(){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=Imn});function cW(a){let e=a??"1.1.
|
|
2189
|
+
${s}`:i.stack}Wn.exports.fetch=function(e,r=void 0){return _0n(e,r).catch(n=>{throw ngr?lgr(n,ngr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=q6().Headers;Wn.exports.Response=wse().Response;Wn.exports.Request=WU().Request;Wn.exports.FormData=dNe().FormData;var{setGlobalOrigin:P0n,getGlobalOrigin:j0n}=nnt();Wn.exports.setGlobalOrigin=P0n;Wn.exports.getGlobalOrigin=j0n;var{CacheStorage:q0n}=O2r(),{kConstruct:K0n}=Zc();Wn.exports.caches=new q0n(K0n);var{deleteCookie:$0n,getCookies:emn,getSetCookies:tmn,setCookie:rmn,parseCookie:amn}=rGr();Wn.exports.deleteCookie=$0n;Wn.exports.getCookies=emn;Wn.exports.getSetCookies=tmn;Wn.exports.setCookie=rmn;Wn.exports.parseCookie=amn;var{parseMIMEType:nmn,serializeAMimeType:imn}=lZ();Wn.exports.parseMIMEType=nmn;Wn.exports.serializeAMimeType=imn;var{CloseEvent:smn,ErrorEvent:omn,MessageEvent:lmn}=xWe(),{WebSocket:cmn,ping:umn}=HGr();Wn.exports.WebSocket=cmn;Wn.exports.CloseEvent=smn;Wn.exports.ErrorEvent=omn;Wn.exports.MessageEvent=lmn;Wn.exports.ping=umn;Wn.exports.WebSocketStream=DGr().WebSocketStream;Wn.exports.WebSocketError=Qot().WebSocketError;Wn.exports.request=Sse(HU.request);Wn.exports.stream=Sse(HU.stream);Wn.exports.pipeline=Sse(HU.pipeline);Wn.exports.connect=Sse(HU.connect);Wn.exports.upgrade=Sse(HU.upgrade);Wn.exports.MockClient=X0n;Wn.exports.MockCallHistory=k0n;Wn.exports.MockCallHistoryLog=S0n;Wn.exports.MockPool=J0n;Wn.exports.MockAgent=L0n;Wn.exports.SnapshotAgent=B0n;Wn.exports.mockErrors=T0n;var{EventSource:dmn}=agr();Wn.exports.EventSource=dmn;function Imn(){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=Imn});function cW(a){let e=a??"1.1.127"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${MWe}/VSCode/${i} (${r}; ${n})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${MWe}/Desktop/${i} (${r}; ${n})`}return`${MWe}/CLI/${e} (${r}; ${n})`}var MWe,sS=_e(()=>{"use strict";MWe="HwjCode"});import*as rv from"node:path";import*as Li from"node:fs";import*as cgr from"node:os";import*as ugr from"node:zlib";import{spawn as UWe,spawnSync as hmn}from"node:child_process";function hgr(a){if(Li.existsSync(a)){for(let e of Li.readdirSync(a)){let r=rv.join(a,e);Li.statSync(r).isDirectory()?hgr(r):Li.unlinkSync(r)}Li.rmdirSync(a)}}var dgr,Igr,bI,mgr=_e(()=>{"use strict";dgr=Qt(OWe(),1),Igr=Qt(sKe(),1);sS();nm();bI=class{static get lspDir(){return rv.join(cgr.homedir(),Qo,"lsp")}static findOnPath(e){let r=process.platform==="win32"?"where.exe":"which",i=(hmn(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=rv.join(this.lspDir,e);Li.existsSync(r)&&(console.log(`[LSP] Cleaning corrupted binary cache for ${e} at ${r}`),hgr(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=rv.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=rv.join(n,"node_modules",".bin",r+(process.platform==="win32"?".cmd":""));return Li.existsSync(i)||(console.log(`[LSP] Installing ${e.join(", ")} via npm...`),Li.existsSync(rv.join(n,"package.json"))||Li.writeFileSync(rv.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?UWe("cmd.exe",["/c","npm",...d],{cwd:n,shell:!1,stdio:"inherit"}):UWe("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=rv.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=UWe(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=rv.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":cW()};u&&(h.Authorization=`Bearer ${u}`);let c=`https://api.github.com/repos/${e}/${r}/releases/latest`,Z=await(await(0,dgr.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=rv.join(i,v.name),g=Date.now(),E=0;if(await new Promise((A,p)=>{let y=process.platform==="win32"?"curl.exe":"curl",W=UWe(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=ugr.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 Igr.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=>rv.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 fZ from"node:fs";import{spawn as QV}from"node:child_process";function XU(a,e,r){let i=process.platform==="win32"&&a.toLowerCase().endsWith(".cmd"),s={cwd:r.cwd,shell:!1,stdio:["pipe","pipe","pipe"]};if(i&&fZ.existsSync(a)){let o=fZ.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(fZ.existsSync(u))return QV(process.execPath,[u,...e],s)}return QV("cmd.exe",["/c",a,...e],s)}return QV(a,e,s)}var Lse,mmn,pmn,bmn,fmn,Gmn,gmn,vmn,ymn,Zmn,pgr,bgr=_e(()=>{"use strict";mgr();Lse=(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(fZ.existsSync(F0.join(n,o)))return n;let t=F0.normalize(F0.dirname(n));if(t===n)break;n=t}return i},mmn=a=>({id:"typescript-language-server",displayName:"TypeScript/JavaScript Language Server",extensions:[".ts",".tsx",".js",".jsx"],root:Lse(["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 fZ.existsSync(n)&&i.push("--tsserver-path",n),{process:XU(r,i,{cwd:e})}}}),pmn=a=>({id:"pyright",displayName:"Python Language Server",extensions:[".py"],root:Lse(["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:XU(r,["--stdio"],{cwd:e})}}}),bmn=a=>({id:"rust-analyzer",displayName:"Rust Language Server",extensions:[".rs"],root:Lse(["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: ${fZ.existsSync(s)}`),fZ.existsSync(s)){let o=fZ.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=QV(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:Lse(["go.mod","go.sum"],a),async spawn(e){let r=process.env.DEEPV_GOPLS_PATH;if(r&&fZ.existsSync(r))return{process:QV(r,[],{cwd:e})};let n=bI.findOnPath("gopls");if(n)return{process:QV(n,[],{cwd:e})};let i=await bI.ensureBinary("gopls",await bI.goInstaller("golang.org/x/tools/gopls","gopls"),{maxRetries:1});return{process:QV(i,[],{cwd:e})}}}),Gmn=a=>({id:"clangd",displayName:"C/C++ Language Server",extensions:[".c",".cpp",".h",".hpp",".cc"],root:Lse(["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:QV(n,[],{cwd:e})}}}),gmn=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:XU(r,["--stdio"],{cwd:e})}}}),vmn=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:XU(r,["up","--method","stdio"],{cwd:e})}}}),ymn=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:XU(r,["--stdio"],{cwd:e})}}}),Zmn=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:XU(r,["--stdio"],{cwd:e})}}}),pgr=a=>[mmn(a),pmn(a),bmn(a),fmn(a),Gmn(a),gmn(a),vmn(a),ymn(a),Zmn(a)]});import*as tE from"node:path";import*as _We from"node:fs";import{pathToFileURL as Nmn}from"node:url";var zWe,fgr=_e(()=>{"use strict";Zdr();bgr();zWe=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=pgr(e)}async getClientsForFile(e){let r=tE.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 vdr({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=_We.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(tE.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 Nmn(tE.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 ydr(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=tE.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=_We.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=tE.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 Ggr(a){return Jot||(Jot=new zWe(a)),Jot}var Jot,ggr=_e(()=>{"use strict";fgr();Jot=null});import*as kU from"node:path";import{fileURLToPath as Wmn}from"node:url";var Db,Bot=_e(()=>{"use strict";Es();ggr();Gi();mc();Db=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||!kU.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=Ggr(this.config.getTargetDir()),n=null,i=e.filePath?kU.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=Wmn(s));let d=kU.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=VX(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 q4r=_e(()=>{"use strict";aGe();gte();s$();});import{randomUUID as X4n}from"crypto";function RW(){return Qle||(Qle=X4n()),Qle}function K4r(a){Qle=a}function $4r(){Qle=void 0}var Qle,eAr,kht=_e(()=>{"use strict";eAr=RW()});import*as Tc from"fs";import*as AW from"path";import*as TS from"os";function k4n(a){EW.configure(a)}function S4n(a){EW.setUserInfo(a)}function L4n(a){EW.setCliVersion(a)}async function J4n(){return await EW.getUserHeaders()}function B4n(){return EW.getStatus()}var Hle,Dc,EW,Xle=_e(()=>{"use strict";lut();kht();sS();nm();Hle=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 cW(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=AW.join(TS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=AW.join(TS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.126",this.config={proxyServerUrl:out()},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-Hle*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=AW.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=AW.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=AW.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-Hle*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-Hle*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=Hle){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-Hle*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":RW()};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":RW()}}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")}},EW=Dc.getInstance()});function T4n(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function kle(a={}){let e=(a.baseUrl??EW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new xW("Proxy server URL is not configured");if(T4n(e))return[];let r=`${e}/web-api/models`,n=await EW.getUserHeaders(),i=a.timeoutMs??D4n,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 xW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new xW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&jDe(c))throw new c_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new xW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new xW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new xW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new xW('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 D4n,xW,c_,tAr=_e(()=>{"use strict";Xle();yu();D4n=15e3,xW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},c_=class extends xW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Sht,rAr=_e(()=>{"use strict";Sht=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 C5 from"node:fs";import*as d9 from"node:path";import*as aAr from"node:os";function Lht(){return d9.join(aAr.homedir(),Qo,"trusted-project-hooks.json")}function NRe(){try{let a=Lht();if(!C5.existsSync(a))return{trustedPaths:[]};let e=C5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function nAr(a){let e=Lht(),r=d9.dirname(e);C5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;C5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),C5.renameSync(n,e)}function u_(a){let e=d9.resolve(a),{trustedPaths:r}=NRe();return r.includes(e)}function Jht(a){let e=d9.resolve(a),r=NRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),nAr(r))}function Bht(a){let e=d9.resolve(a),r=NRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&nAr({trustedPaths:n})}function O4n(){return NRe().trustedPaths}var iAr=_e(()=>{"use strict";nm();});function sAr(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(by(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 oAr(a){if(a==null)return"";if(typeof a=="string")return Tht(a)??a;if(by(a))return a.error.message||"";if(cb(a)||a instanceof Error)return Tht(a.message)??a.message;try{return String(a)}catch{return""}}function Tht(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 DS(a){let e=sAr(a),r=oAr(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var lAr=_e(()=>{"use strict";SH();});function dAr(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 M4n.includes(n)}function U4n(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 IAr(a){let e=U4n(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function WRe(a){return a1(a)}function Sle(a,e={}){if(!WRe(a))return null;let r=e.locale??"zh",n=IAr(a),i=dAr(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: ${uAr}`:`Sign in at ${cAr} 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(${uAr})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${cAr} \u5145\u503C\u3002`;return`${s}${t}`}var cAr,uAr,M4n,hAr=_e(()=>{"use strict";SH();cAr="https://hwjcode.bot/",uAr="https://applink.feishu.cn/T981u6WkPNNZ",M4n=["cmcm.com","orionstar.com"]});function FRe(a){let e=fw(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 z4n(a,e=!1){let r=FRe(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=VX(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 q4r=_e(()=>{"use strict";aGe();gte();s$();});import{randomUUID as X4n}from"crypto";function RW(){return Qle||(Qle=X4n()),Qle}function K4r(a){Qle=a}function $4r(){Qle=void 0}var Qle,eAr,kht=_e(()=>{"use strict";eAr=RW()});import*as Tc from"fs";import*as AW from"path";import*as TS from"os";function k4n(a){EW.configure(a)}function S4n(a){EW.setUserInfo(a)}function L4n(a){EW.setCliVersion(a)}async function J4n(){return await EW.getUserHeaders()}function B4n(){return EW.getStatus()}var Hle,Dc,EW,Xle=_e(()=>{"use strict";lut();kht();sS();nm();Hle=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 cW(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=AW.join(TS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=AW.join(TS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.127",this.config={proxyServerUrl:out()},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-Hle*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=AW.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=AW.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=AW.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-Hle*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-Hle*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=Hle){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-Hle*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":RW()};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":RW()}}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")}},EW=Dc.getInstance()});function T4n(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function kle(a={}){let e=(a.baseUrl??EW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new xW("Proxy server URL is not configured");if(T4n(e))return[];let r=`${e}/web-api/models`,n=await EW.getUserHeaders(),i=a.timeoutMs??D4n,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 xW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new xW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&jDe(c))throw new c_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new xW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new xW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new xW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new xW('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 D4n,xW,c_,tAr=_e(()=>{"use strict";Xle();yu();D4n=15e3,xW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},c_=class extends xW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Sht,rAr=_e(()=>{"use strict";Sht=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 C5 from"node:fs";import*as d9 from"node:path";import*as aAr from"node:os";function Lht(){return d9.join(aAr.homedir(),Qo,"trusted-project-hooks.json")}function NRe(){try{let a=Lht();if(!C5.existsSync(a))return{trustedPaths:[]};let e=C5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function nAr(a){let e=Lht(),r=d9.dirname(e);C5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;C5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),C5.renameSync(n,e)}function u_(a){let e=d9.resolve(a),{trustedPaths:r}=NRe();return r.includes(e)}function Jht(a){let e=d9.resolve(a),r=NRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),nAr(r))}function Bht(a){let e=d9.resolve(a),r=NRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&nAr({trustedPaths:n})}function O4n(){return NRe().trustedPaths}var iAr=_e(()=>{"use strict";nm();});function sAr(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(by(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 oAr(a){if(a==null)return"";if(typeof a=="string")return Tht(a)??a;if(by(a))return a.error.message||"";if(cb(a)||a instanceof Error)return Tht(a.message)??a.message;try{return String(a)}catch{return""}}function Tht(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 DS(a){let e=sAr(a),r=oAr(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var lAr=_e(()=>{"use strict";SH();});function dAr(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 M4n.includes(n)}function U4n(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 IAr(a){let e=U4n(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function WRe(a){return a1(a)}function Sle(a,e={}){if(!WRe(a))return null;let r=e.locale??"zh",n=IAr(a),i=dAr(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: ${uAr}`:`Sign in at ${cAr} 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(${uAr})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${cAr} \u5145\u503C\u3002`;return`${s}${t}`}var cAr,uAr,M4n,hAr=_e(()=>{"use strict";SH();cAr="https://hwjcode.bot/",uAr="https://applink.feishu.cn/T981u6WkPNNZ",M4n=["cmcm.com","orionstar.com"]});function FRe(a){let e=fw(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 z4n(a,e=!1){let r=FRe(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 _4n(a){let e=FRe(a);return e.isSmallModel||e.needsSpecialHandling}function P4n(a){let e=FRe(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 mAr=_e(()=>{"use strict";bte();});import*as HZ from"fs";import*as wRe from"path";var j4n,Lle,pAr=_e(()=>{"use strict";Nd();j4n="healthy-use-reminder.json",Lle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=_f(e);this.stateFilePath=wRe.join(r,j4n)}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{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.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=wRe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var Dht,Oht,q4n,K4n,$4n,bAr=_e(()=>{"use strict";Dht="--- Content from referenced files ---",Oht="--- End of content ---",q4n=2e3,K4n=2e3,$4n=20});function GAr(...a){return eAn(...a)}function gAr(...a){return tAn(...a)}function fAr(a,e){return a in e}function Mht(){let a={get(i,s){if(s==="write")return GAr;if(fAr(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 gAr;if(fAr(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 eAn,tAn,vAr=_e(()=>{"use strict";eAn=process.stdout.write.bind(process.stdout),tAn=process.stderr.write.bind(process.stderr)});import{readFile as rAn}from"node:fs/promises";import{fileURLToPath as aAn}from"node:url";import Uht from"node:path";function nAn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Uht.dirname(aAn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Y5(){return Jle||(Jle=(async()=>"1.1.126")(),Jle)}function iAn(){Jle=void 0}var Jle,zht=_e(()=>{"use strict";});function sAn(a="latest"){let e=a?.trim().toLowerCase();return yAr.includes(e)?e:ZAr}var yAr,ZAr,NAr=_e(()=>{"use strict";yAr=["stable","latest"],ZAr="stable"});import{EventEmitter as oAn}from"node:events";var Ble,_ht,Pht,WAr=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(Ble||(Ble={}));_ht=class{emitter=new oAn;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()}},Pht=new _ht});function RRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function lAn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function jht(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??RRe(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?RRe(r.content):[],i=lAn(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(...RRe(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(...RRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var FAr=_e(()=>{"use strict";});var OS,wAr,Tle,RAr=_e(()=>{"use strict";OS=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}.`)}},wAr="latest",Tle=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 OS.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 OS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===wAr){let s=await this.listSessions();if(s.length===0)throw OS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new OS(`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 cAn(a,e,r){return new ARe(a,e,r)}var ARe,ERe,xRe,AAr=_e(()=>{"use strict";cte();sS();ARe=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":cW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:C4("warn","\u26A0\uFE0F No access token available")}catch(n){C4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(C4("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{C4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){C4("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&&(C4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new ERe("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 xRe(`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)}},ERe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},xRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function uAn(a){return Dle.getInstance(a)}function dAn(a){let e=Dle.getInstance(a);return()=>e.handleAuthenticationRequired()}var Dle,EAr=_e(()=>{"use strict";Xle();Dle=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 CRe from"fs";import*as A2 from"path";function IAn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ole,qht,xAr=_e(()=>{"use strict";Ole=IAn(),qht=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(A2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"auth","login","templates",e))),Ole&&r.push(A2.join(Ole,e)),Ole){let s=Ole;for(let t=0;t<10;t++)r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled",e)),r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e)),s=A2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"dist","bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(CRe.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: ${Ole||"(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=CRe.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 _4n(a){let e=FRe(a);return e.isSmallModel||e.needsSpecialHandling}function P4n(a){let e=FRe(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 mAr=_e(()=>{"use strict";bte();});import*as HZ from"fs";import*as wRe from"path";var j4n,Lle,pAr=_e(()=>{"use strict";Nd();j4n="healthy-use-reminder.json",Lle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=_f(e);this.stateFilePath=wRe.join(r,j4n)}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{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.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=wRe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var Dht,Oht,q4n,K4n,$4n,bAr=_e(()=>{"use strict";Dht="--- Content from referenced files ---",Oht="--- End of content ---",q4n=2e3,K4n=2e3,$4n=20});function GAr(...a){return eAn(...a)}function gAr(...a){return tAn(...a)}function fAr(a,e){return a in e}function Mht(){let a={get(i,s){if(s==="write")return GAr;if(fAr(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 gAr;if(fAr(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 eAn,tAn,vAr=_e(()=>{"use strict";eAn=process.stdout.write.bind(process.stdout),tAn=process.stderr.write.bind(process.stderr)});import{readFile as rAn}from"node:fs/promises";import{fileURLToPath as aAn}from"node:url";import Uht from"node:path";function nAn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Uht.dirname(aAn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Y5(){return Jle||(Jle=(async()=>"1.1.127")(),Jle)}function iAn(){Jle=void 0}var Jle,zht=_e(()=>{"use strict";});function sAn(a="latest"){let e=a?.trim().toLowerCase();return yAr.includes(e)?e:ZAr}var yAr,ZAr,NAr=_e(()=>{"use strict";yAr=["stable","latest"],ZAr="stable"});import{EventEmitter as oAn}from"node:events";var Ble,_ht,Pht,WAr=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(Ble||(Ble={}));_ht=class{emitter=new oAn;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()}},Pht=new _ht});function RRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function lAn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function jht(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??RRe(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?RRe(r.content):[],i=lAn(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(...RRe(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(...RRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var FAr=_e(()=>{"use strict";});var OS,wAr,Tle,RAr=_e(()=>{"use strict";OS=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}.`)}},wAr="latest",Tle=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 OS.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 OS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===wAr){let s=await this.listSessions();if(s.length===0)throw OS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new OS(`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 cAn(a,e,r){return new ARe(a,e,r)}var ARe,ERe,xRe,AAr=_e(()=>{"use strict";cte();sS();ARe=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":cW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:C4("warn","\u26A0\uFE0F No access token available")}catch(n){C4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(C4("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{C4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){C4("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&&(C4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new ERe("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 xRe(`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)}},ERe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},xRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function uAn(a){return Dle.getInstance(a)}function dAn(a){let e=Dle.getInstance(a);return()=>e.handleAuthenticationRequired()}var Dle,EAr=_e(()=>{"use strict";Xle();Dle=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 CRe from"fs";import*as A2 from"path";function IAn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ole,qht,xAr=_e(()=>{"use strict";Ole=IAn(),qht=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(A2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"auth","login","templates",e))),Ole&&r.push(A2.join(Ole,e)),Ole){let s=Ole;for(let t=0;t<10;t++)r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled",e)),r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e)),s=A2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"dist","bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(CRe.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: ${Ole||"(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=CRe.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 oQn(a,e,r,n={}){if(!d9r){d9r=!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=dQn(r,this.#t.message);if(n)return(0,v9r.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}},dQn=(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)}:cpt(a,Number(n),{oneBased:!0})},IQn=a=>a.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${uQn(n)})`)});var Jce=He((g2s,Z9r)=>{"use strict";var hQn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{};Z9r.exports=hQn});var Bce=He((v2s,N9r)=>{"use strict";var mQn="2.0.0",pQn=Number.MAX_SAFE_INTEGER||9007199254740991,bQn=16,fQn=250,GQn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];N9r.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:bQn,MAX_SAFE_BUILD_LENGTH:fQn,MAX_SAFE_INTEGER:pQn,RELEASE_TYPES:GQn,SEMVER_SPEC_VERSION:mQn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var rP=He((U5,W9r)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ipt,MAX_SAFE_BUILD_LENGTH:gQn,MAX_LENGTH:vQn}=Bce(),yQn=Jce();U5=W9r.exports={};var ZQn=U5.re=[],NQn=U5.safeRe=[],An=U5.src=[],WQn=U5.safeSrc=[],En=U5.t={},FQn=0,hpt="[a-zA-Z0-9-]",wQn=[["\\s",1],["\\d",vQn],[hpt,gQn]],RQn=a=>{for(let[e,r]of wQn)a=a.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return a},Gs=(a,e,r)=>{let n=RQn(e),i=FQn++;yQn(a,i,e),En[a]=i,An[i]=e,WQn[i]=n,ZQn[i]=new RegExp(e,r?"g":void 0),NQn[i]=new RegExp(n,r?"g":void 0)};Gs("NUMERICIDENTIFIER","0|[1-9]\\d*");Gs("NUMERICIDENTIFIERLOOSE","\\d+");Gs("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${hpt}*`);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",`${hpt}+`);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,${Ipt}})(?:\\.(\\d{1,${Ipt}}))?(?:\\.(\\d{1,${Ipt}}))?`);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);U5.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);U5.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);U5.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 yAe=He((y2s,F9r)=>{"use strict";var AQn=Object.freeze({loose:!0}),EQn=Object.freeze({}),xQn=a=>a?typeof a!="object"?AQn:a:EQn;F9r.exports=xQn});var mpt=He((Z2s,A9r)=>{"use strict";var w9r=/^[0-9]+$/,R9r=(a,e)=>{if(typeof a=="number"&&typeof e=="number")return a===e?0:a<e?-1:1;let r=w9r.test(a),n=w9r.test(e);return r&&n&&(a=+a,e=+e),a===e?0:r&&!n?-1:n&&!r?1:a<e?-1:1},CQn=(a,e)=>R9r(e,a);A9r.exports={compareIdentifiers:R9r,rcompareIdentifiers:CQn}});var rf=He((N2s,x9r)=>{"use strict";var ZAe=Jce(),{MAX_LENGTH:E9r,MAX_SAFE_INTEGER:NAe}=Bce(),{safeRe:WAe,t:FAe}=rP(),YQn=yAe(),{compareIdentifiers:ppt}=mpt(),bpt=class a{constructor(e,r){if(r=YQn(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>E9r)throw new TypeError(`version is longer than ${E9r} characters`);ZAe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?WAe[FAe.LOOSE]:WAe[FAe.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>NAe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>NAe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>NAe||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<NAe)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(ZAe("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(ZAe("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 ppt(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(ZAe("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 ppt(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?WAe[FAe.PRERELEASELOOSE]:WAe[FAe.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]),ppt(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}};x9r.exports=bpt});var uL=He((W2s,Y9r)=>{"use strict";var C9r=rf(),VQn=(a,e,r=!1)=>{if(a instanceof C9r)return a;try{return new C9r(a,e)}catch(n){if(!r)return null;throw n}};Y9r.exports=VQn});var fpt=He((F2s,V9r)=>{"use strict";var QQn=uL(),HQn=(a,e)=>{let r=QQn(a,e);return r?r.version:null};V9r.exports=HQn});var Gpt=He((w2s,Q9r)=>{"use strict";var XQn=uL(),kQn=(a,e)=>{let r=XQn(a.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Q9r.exports=kQn});var gpt=He((R2s,SQn)=>{SQn.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 H9r=He((A2s,LQn)=>{LQn.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 X9r=He((E2s,JQn)=>{JQn.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 S9r=He((x2s,k9r)=>{"use strict";var BQn=[].concat(gpt()).concat(H9r()),TQn=X9r();k9r.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(BQn.indexOf(v)!==-1)return{type:"LICENSE",string:v};if(TQn.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 J9r=He((C2s,L9r)=>{"use strict";L9r.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 vpt=He((Y2s,B9r)=>{"use strict";var DQn=S9r(),OQn=J9r();B9r.exports=function(a){return OQn(DQn(a))}});var j9r=He((V2s,P9r)=>{var MQn=vpt(),UQn=gpt();function wAe(a){try{return MQn(a),!0}catch{return!1}}function _9r(a,e){var r=e[0].length-a[0].length;return r!==0?r:a[0].toUpperCase().localeCompare(e[0].toUpperCase())}var T9r=[["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(_9r),zQn=0,_Qn=1,D9r=[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"}],ypt=UQn.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},{}),PQn=Object.keys(ypt).map(function(e){return[e,ypt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});ypt=void 0;var O9r=[["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(PQn).sort(_9r),jQn=0,qQn=1,M9r=function(a){for(var e=0;e<D9r.length;e++){var r=D9r[e](a).trim();if(r!==a&&wAe(r))return r}return null},U9r=function(a){for(var e=a.toUpperCase(),r=0;r<O9r.length;r++){var n=O9r[r];if(e.indexOf(n[jQn])>-1)return n[qQn]}return null},z9r=function(a,e){for(var r=0;r<T9r.length;r++){var n=T9r[r],i=n[zQn];if(a.indexOf(i)>-1){var s=a.replace(i,n[_Qn]),t=e(s);if(t!==null)return t}}return null};P9r.exports=function(a,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(o){return r?KQn(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(),wAe(a))return n(a);var s=a.replace(/\+$/,"").trim();if(wAe(s))return n(s);var t=M9r(a);return t!==null||(t=z9r(a,function(o){return wAe(o)?o:M9r(o)}),t!==null)||(t=U9r(a),t!==null)||(t=z9r(a,U9r),t!==null)?n(t):null};function KQn(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 eQr=He((Q2s,$9r)=>{var $Qn=vpt(),eHn=j9r(),q9r='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',tHn=/^SEE LICEN[CS]E IN (.+)$/;function K9r(a,e){return e.slice(0,a.length)===a}function Zpt(a){if(a.hasOwnProperty("license")){var e=a.license;return K9r("LicenseRef",e)||K9r("DocumentRef",e)}else return Zpt(a.left)||Zpt(a.right)}$9r.exports=function(a){var e;try{e=$Qn(a)}catch{var r;if(a==="UNLICENSED"||a==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=tHn.exec(a))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[q9r]};if(a.trim().length!==0){var i=eHn(a);i&&n.warnings.push('license is similar to the valid expression "'+i+'"')}return n}return Zpt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[q9r]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var iQr=He(AAe=>{"use strict";Object.defineProperty(AAe,"__esModule",{value:!0});AAe.LRUCache=void 0;var aP=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,rQr=new Set,Npt=typeof process=="object"&&process?process:{},aQr=(a,e,r,n)=>{typeof Npt.emitWarning=="function"?Npt.emitWarning(a,e,r,n):console.error(`[${r}] ${e}: ${a}`)},RAe=globalThis.AbortController,tQr=globalThis.AbortSignal;if(typeof RAe>"u"){tQr=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},RAe=class{constructor(){e()}signal=new tQr;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=Npt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{a&&(a=!1,aQr("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 rHn=a=>!rQr.has(a),k2s=Symbol("type"),Q9=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),nQr=a=>Q9(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?nP:null:null,nP=class extends Array{constructor(e){super(e),this.fill(0)}},Wpt=class a{heap;length;static#e=!1;static create(e){let r=nQr(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]}},Fpt=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&&!Q9(r))throw new TypeError("max option must be a nonnegative integer");let W=r?nQr(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=Wpt.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&&!Q9(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!Q9(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=Q9(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Q9(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";rHn(R)&&(rQr.add(R),aQr("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 nP(this.#e),r=new nP(this.#e);this.#W=e,this.#y=r,this.#H=(s,t,o=aP.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?aP.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=aP.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 nP(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(!Q9(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!Q9(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-(aP.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=aP.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=aP.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 RAe,{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 RAe}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)}}};AAe.LRUCache=Fpt});var lQr=He((L2s,oQr)=>{"use strict";var Hl=(...a)=>a.every(e=>e)?a.join(""):"",zh=a=>a?encodeURIComponent(a):"",sQr=a=>a.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),aHn={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:sQr},H9={};H9.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}}};H9.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)}}};H9.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)}}};H9.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-"+sQr(a)}};H9.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(H9))H9[a]=Object.assign({},aHn,e);oQr.exports=H9});var Rpt=He((J2s,uQr)=>{var nHn=Ct("url"),wpt=(a,e,r)=>{let n=a.indexOf(r);return a.lastIndexOf(e,n>-1?n:1/0)},cQr=a=>{try{return new nHn.URL(a)}catch{}},iHn=(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)}`},sHn=a=>{let e=wpt(a,"@","#"),r=wpt(a,":","#");return r>e&&(a=a.slice(0,r)+"/"+a.slice(r+1)),wpt(a,":","#")===-1&&a.indexOf("//")===-1&&(a=`git+ssh://${a}`),a};uQr.exports=(a,e)=>{let r=e?iHn(a,e):a;return cQr(r)||cQr(sHn(r))}});var IQr=He((B2s,dQr)=>{"use strict";var oHn=Rpt(),lHn=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};dQr.exports=(a,e,{gitHosts:r,protocols:n})=>{if(!a)return;let i=lHn(a)?`github:${a}`:a,s=oHn(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 mQr=He((T2s,hQr)=>{"use strict";var{LRUCache:cHn}=iQr(),uHn=lQr(),dHn=IQr(),IHn=Rpt(),Apt=new cHn({max:1e3}),EAe=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(!Apt.has(n)){let i=dHn(e,r,{gitHosts:a.#e,protocols:a.#t});Apt.set(n,i?new a(...i):void 0)}return Apt.get(n)}static parseUrl(e){return IHn(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(uHn))EAe.addHost(a,e);hQr.exports=EAe});var bQr=He((D2s,pQr)=>{pQr.exports=hHn;function hHn(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 fQr=He((O2s,mHn)=>{mHn.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 yQr=He((M2s,vQr)=>{var pHn=fpt(),bHn=Gpt(),fHn=eQr(),xAe=mQr(),GHn=Ct("node:module"),gHn=["dependencies","devDependencies","optionalDependencies"],vHn=bQr(),Ept=Ct("url"),X9=fQr(),GQr=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");vQr.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=xAe.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(X9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,X9.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]):X9.script[e]&&!a.scripts[X9.script[e]]&&this.warn("typo",e,X9.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){AHn(a,this.warn),wHn(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=xAe.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(!pHn(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=bHn(a.version,r),!0},fixPeople:function(a){gQr(a,WHn),gQr(a,FHn)},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()),NHn(a.name,r,e.allowLegacyCase),GHn.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=vHn(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=xAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")GQr(a.bugs)?a.bugs={email:a.bugs}:Ept.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{EHn(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&Ept.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&GQr(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=xAe.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;Ept.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(!fHn(e).validForNewPackages)return this.warn("invalidLicense")}};function yHn(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 ZHn(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function NHn(a,e,r){if(a.charAt(0)==="."||!(yHn(a)||ZHn(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function gQr(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 WHn(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 FHn(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 wHn(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 RHn(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 AHn(a,e){gHn.forEach(function(r){a[r]&&(a[r]=RHn(a[r],r,e))})}function EHn(a,e){a&&Object.keys(a).forEach(function(r){X9.bugs[r]&&(e("typo",r,X9.bugs[r],"bugs"),a[X9.bugs[r]]=a[r],delete a[r])})}});var ZQr=He((U2s,xHn)=>{xHn.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 FQr=He((z2s,WQr)=>{var NQr=Ct("util"),xpt=ZQr();WQr.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return CHn.apply(null,a);var r=xpt[e]?xpt[e]:e+": '%s'";return a.unshift(r),NQr.format.apply(null,a)};function CHn(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),NQr.format(xpt.typo,a,e)}});var EQr=He((_2s,AQr)=>{AQr.exports=wQr;var Cpt=yQr();wQr.fixer=Cpt;var YHn=FQr(),VHn=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],QHn=["dependencies","people","typos"],Ypt=VHn.map(function(a){return RQr(a)+"Field"});Ypt=Ypt.concat(QHn);function wQr(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),Cpt.warn=function(){e(YHn.apply(null,arguments))},Ypt.forEach(function(n){Cpt["fix"+RQr(n)](a,r)}),a._id=a.name+"@"+a.version}function RQr(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var xQr=_e(()=>{});import{fileURLToPath as HHn}from"node:url";function CQr(a){return a instanceof URL?HHn(a):a}var YQr=_e(()=>{xQr()});import XHn from"node:fs/promises";import kHn from"node:path";async function QQr({cwd:a,normalize:e=!0}={}){let r=await XHn.readFile(SHn(a),"utf8");return LHn(r,e)}var VQr,SHn,LHn,HQr=_e(()=>{y9r();VQr=Qt(EQr(),1);YQr();SHn=a=>kHn.resolve(CQr(a)??".","package.json"),LHn=(a,e)=>{let r=typeof a=="string"?dpt(a):a;return e&&(0,VQr.default)(r),r}});import JHn from"node:path";async function XQr(a){let e=await zVr("package.json",a);if(e)return{packageJson:await QQr({...a,cwd:JHn.dirname(e)}),path:e}}var kQr=_e(()=>{_Vr();HQr()});import{fileURLToPath as BHn}from"url";import THn from"path";async function sP(){if(iP)return iP;let a=await XQr({cwd:OHn});if(!a){let e="hwjcode-cli",r="1.1.126";return e&&r?(iP={name:e,version:r},iP):void 0}return iP=a.packageJson,iP}var DHn,OHn,iP,CAe=_e(()=>{"use strict";kQr();DHn=BHn(import.meta.url),OHn=THn.dirname(DHn)});var SQr={};Xs(SQr,{getCliVersion:()=>DW});async function DW(){let a=await sP();return"1.1.126"}var dL=_e(()=>{"use strict";CAe();});import IL from"node:process";var LQr,JQr=_e(()=>{"use strict";dL();Wi();ks();ma();LQr={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=IL.platform,r="no sandbox";IL.env.SANDBOX&&IL.env.SANDBOX!=="sandbox-exec"?r=IL.env.SANDBOX:IL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${IL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await DW(),s=a.services.settings.merged.selectedAuthType||"",t=IL.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 BQr,TQr=_e(()=>{"use strict";Wi();ma();BQr={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var DQr,OQr=_e(()=>{"use strict";Wi();ma();DQr={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var MQr,UQr=_e(()=>{"use strict";ks();Wi();ma();MQr={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)}}}});async function MHn(a){let{config:e,settings:r}=a.services;if(!e||!r)return{type:"message",messageType:"error",content:we("error.config.not.loaded")};let n=r.merged.vimMode||!1,i=e.getAgentStyle(),s=e.getApprovalMode(),t=e.getHealthyUseEnabled(),o=r.merged.preferredLanguage||we("config.value.default"),d=u=>{switch(u){case"codex":return"\u26A1";case"cursor":return"\u2197\uFE0F";case"augment":return"\u{1F680}";case"claude-code":return"\u2733\uFE0F";case"antigravity":return"\u{1F308}";case"windsurf":return"\u{1F30A}";default:return"\u{1D4E5}"}};return{type:"message",messageType:"info",content:`\u2699\uFE0F ${we("command.config.description")}
|
|
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 fQr=He((O2s,mHn)=>{mHn.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 yQr=He((M2s,vQr)=>{var pHn=fpt(),bHn=Gpt(),fHn=eQr(),xAe=mQr(),GHn=Ct("node:module"),gHn=["dependencies","devDependencies","optionalDependencies"],vHn=bQr(),Ept=Ct("url"),X9=fQr(),GQr=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");vQr.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=xAe.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(X9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,X9.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]):X9.script[e]&&!a.scripts[X9.script[e]]&&this.warn("typo",e,X9.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){AHn(a,this.warn),wHn(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=xAe.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(!pHn(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=bHn(a.version,r),!0},fixPeople:function(a){gQr(a,WHn),gQr(a,FHn)},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()),NHn(a.name,r,e.allowLegacyCase),GHn.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=vHn(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=xAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")GQr(a.bugs)?a.bugs={email:a.bugs}:Ept.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{EHn(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&Ept.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&GQr(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=xAe.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;Ept.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(!fHn(e).validForNewPackages)return this.warn("invalidLicense")}};function yHn(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 ZHn(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function NHn(a,e,r){if(a.charAt(0)==="."||!(yHn(a)||ZHn(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function gQr(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 WHn(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 FHn(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 wHn(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 RHn(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 AHn(a,e){gHn.forEach(function(r){a[r]&&(a[r]=RHn(a[r],r,e))})}function EHn(a,e){a&&Object.keys(a).forEach(function(r){X9.bugs[r]&&(e("typo",r,X9.bugs[r],"bugs"),a[X9.bugs[r]]=a[r],delete a[r])})}});var ZQr=He((U2s,xHn)=>{xHn.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 FQr=He((z2s,WQr)=>{var NQr=Ct("util"),xpt=ZQr();WQr.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return CHn.apply(null,a);var r=xpt[e]?xpt[e]:e+": '%s'";return a.unshift(r),NQr.format.apply(null,a)};function CHn(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),NQr.format(xpt.typo,a,e)}});var EQr=He((_2s,AQr)=>{AQr.exports=wQr;var Cpt=yQr();wQr.fixer=Cpt;var YHn=FQr(),VHn=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],QHn=["dependencies","people","typos"],Ypt=VHn.map(function(a){return RQr(a)+"Field"});Ypt=Ypt.concat(QHn);function wQr(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),Cpt.warn=function(){e(YHn.apply(null,arguments))},Ypt.forEach(function(n){Cpt["fix"+RQr(n)](a,r)}),a._id=a.name+"@"+a.version}function RQr(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var xQr=_e(()=>{});import{fileURLToPath as HHn}from"node:url";function CQr(a){return a instanceof URL?HHn(a):a}var YQr=_e(()=>{xQr()});import XHn from"node:fs/promises";import kHn from"node:path";async function QQr({cwd:a,normalize:e=!0}={}){let r=await XHn.readFile(SHn(a),"utf8");return LHn(r,e)}var VQr,SHn,LHn,HQr=_e(()=>{y9r();VQr=Qt(EQr(),1);YQr();SHn=a=>kHn.resolve(CQr(a)??".","package.json"),LHn=(a,e)=>{let r=typeof a=="string"?dpt(a):a;return e&&(0,VQr.default)(r),r}});import JHn from"node:path";async function XQr(a){let e=await zVr("package.json",a);if(e)return{packageJson:await QQr({...a,cwd:JHn.dirname(e)}),path:e}}var kQr=_e(()=>{_Vr();HQr()});import{fileURLToPath as BHn}from"url";import THn from"path";async function sP(){if(iP)return iP;let a=await XQr({cwd:OHn});if(!a){let e="hwjcode-cli",r="1.1.127";return e&&r?(iP={name:e,version:r},iP):void 0}return iP=a.packageJson,iP}var DHn,OHn,iP,CAe=_e(()=>{"use strict";kQr();DHn=BHn(import.meta.url),OHn=THn.dirname(DHn)});var SQr={};Xs(SQr,{getCliVersion:()=>DW});async function DW(){let a=await sP();return"1.1.127"}var dL=_e(()=>{"use strict";CAe();});import IL from"node:process";var LQr,JQr=_e(()=>{"use strict";dL();Wi();ks();ma();LQr={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=IL.platform,r="no sandbox";IL.env.SANDBOX&&IL.env.SANDBOX!=="sandbox-exec"?r=IL.env.SANDBOX:IL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${IL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await DW(),s=a.services.settings.merged.selectedAuthType||"",t=IL.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 BQr,TQr=_e(()=>{"use strict";Wi();ma();BQr={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var DQr,OQr=_e(()=>{"use strict";Wi();ma();DQr={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var MQr,UQr=_e(()=>{"use strict";ks();Wi();ma();MQr={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)}}}});async function MHn(a){let{config:e,settings:r}=a.services;if(!e||!r)return{type:"message",messageType:"error",content:we("error.config.not.loaded")};let n=r.merged.vimMode||!1,i=e.getAgentStyle(),s=e.getApprovalMode(),t=e.getHealthyUseEnabled(),o=r.merged.preferredLanguage||we("config.value.default"),d=u=>{switch(u){case"codex":return"\u26A1";case"cursor":return"\u2197\uFE0F";case"augment":return"\u{1F680}";case"claude-code":return"\u2733\uFE0F";case"antigravity":return"\u{1F308}";case"windsurf":return"\u{1F30A}";default:return"\u{1D4E5}"}};return{type:"message",messageType:"info",content:`\u2699\uFE0F ${we("command.config.description")}
|
|
5483
5483
|
|
|
5484
5484
|
${we("command.config.available.options")}:
|
|
5485
5485
|
|
package/bundle/package.json
CHANGED