easycode-ai 1.1.55 → 1.1.56
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/easycode.js +3 -3
- package/package.json +1 -1
package/bundle/easycode.js
CHANGED
|
@@ -752,7 +752,7 @@ ${h}`)}return t}),bWe=saa(nar);kWe=class extends VWe{create(e,r){var a;let{api_v
|
|
|
752
752
|
`):[]}};jU.NEWLINE_CHARS=new Set([`
|
|
753
753
|
`,"\r"]);jU.NEWLINE_REGEXP=/\r\n|[\n\r]/g;QWe={off:0,error:200,warn:300,info:400,debug:500},Pnr=(n,e,r)=>{if(n){if(Bna(QWe,n))return n;Sg(r).warn(`${e} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(QWe))}`)}};uaa={error:Ele,warn:Ele,info:Ele,debug:Ele},jnr=new WeakMap;HT=n=>(n.options&&(n.options=Object.assign({},n.options),delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n);Utt=class n{constructor(e,r,a){this.iterator=e,this.controller=r,this.client=a}static fromSSEResponse(e,r,a){let i=!1,o=a?Sg(a):console;function t(){return MU(this,arguments,function*(){var d,I,u,h;if(i)throw new G1("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,p=QT(daa(e,r)),G;G=yield vd(p.next()),d=G.done,!d;m=!0){h=G.value,m=!1;let N=h;if(!c)if(N.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield vd(JSON.parse(N.data))}catch(v){throw o.error("Could not parse message into JSON:",N.data),o.error("From chunk:",N.raw),v}}}catch(N){I={error:N}}finally{try{!m&&!d&&(u=p.return)&&(yield vd(u.call(p)))}finally{if(I)throw I.error}}c=!0}catch(N){if(Ott(N))return yield vd(void 0);throw N}finally{c||r.abort()}})}return new n(t,r,a)}static fromReadableStream(e,r,a){let i=!1;function o(){return MU(this,arguments,function*(){var d,I,u,h;let c=new jU,m=ear(e);try{for(var p=!0,G=QT(m),N;N=yield vd(G.next()),d=N.done,!d;p=!0){h=N.value,p=!1;let v=h;for(let A of c.decode(v))yield yield vd(A)}}catch(v){I={error:v}}finally{try{!p&&!d&&(u=G.return)&&(yield vd(u.call(G)))}finally{if(I)throw I.error}}for(let v of c.flush())yield yield vd(v)})}function t(){return MU(this,arguments,function*(){var d,I,u,h;if(i)throw new G1("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,p=QT(o()),G;G=yield vd(p.next()),d=G.done,!d;m=!0){h=G.value,m=!1;let N=h;c||N&&(yield yield vd(JSON.parse(N)))}}catch(N){I={error:N}}finally{try{!m&&!d&&(u=p.return)&&(yield vd(u.call(p)))}finally{if(I)throw I.error}}c=!0}catch(N){if(Ott(N))return yield vd(void 0);throw N}finally{c||r.abort()}})}return new n(t,r,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],a=this.iterator(),i=o=>({next:()=>{if(o.length===0){let t=a.next();e.push(t),r.push(t)}return o.shift()}});return[new n(()=>i(e),this.controller,this.client),new n(()=>i(r),this.controller,this.client)]}toReadableStream(){let e=this,r;return $nr({async start(){r=e[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:o}=await r.next();if(o)return a.close();let t=qtt(JSON.stringify(i)+`
|
|
754
754
|
`);a.enqueue(t)}catch(i){a.error(i)}},async cancel(){var a;await((a=r.return)===null||a===void 0?void 0:a.call(r))}})}};ztt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
|
|
755
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=haa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};Ptt=class n extends Promise{constructor(e,r,a=maa){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};aar=Symbol("brand.privateNullableHeaders");wle=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of paa(a)){let s=o.toLowerCase();i.has(s)||(e.delete(o),i.add(s)),t===null?(e.delete(o),r.add(s)):(e.append(o,t),r.delete(s))}}return{[aar]:!0,values:e,nulls:r}};Btt=n=>{var e,r,a,i,o,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(o=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||o===void 0?void 0:o.call(i,n))===null||t===void 0?void 0:t.trim()};XWe=class n{constructor(e){var r,a,i,o,t,s,d,{baseURL:I=Btt("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:u=(r=Btt("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=ZWe(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:u,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let p="warn";this.logLevel=p,this.logLevel=(t=(o=Pnr(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:Pnr(Btt("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:p,this.fetchOptions=m.fetchOptions,this.maxRetries=(s=m.maxRetries)!==null&&s!==void 0?s:2,this.fetch=(d=m.fetch)!==null&&d!==void 0?d:jna(),this.encoder=$na,this._options=m,this.apiKey=u,this.apiVersion=h,this.clientAdapter=m.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){let r=wle([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return wle([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return wle([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new G1(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${_U}`}defaultIdempotencyKey(){return`stainless-node-retry-${Qna()}`}makeStatusError(e,r,a,i){return v1.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=Sna(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return Jna(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:a}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new Ptt(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){var i,o,t;let s=await e,d=(i=s.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=d),await this.prepareOptions(s);let{req:I,url:u,timeout:h}=await this.buildRequest(s,{retryCount:d-r});await this.prepareRequest(I,{url:u,options:s});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=a===void 0?"":`, retryOf: ${a}`,p=Date.now();if(Sg(this).debug(`[${c}] sending request`,HT({retryOfRequestLogID:a,method:s.method,url:u,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Rle;let G=new AbortController,N=await this.fetchWithTimeout(u,I,h,G).catch(Dtt),v=Date.now();if(N instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Rle;let E=Ott(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(r)return Sg(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${F}`),Sg(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${F})`,HT({retryOfRequestLogID:a,url:u,durationMs:v-p,message:N.message})),this.retryRequest(s,r,a??c);throw Sg(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),Sg(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,HT({retryOfRequestLogID:a,url:u,durationMs:v-p,message:N.message})),E?new WWe:new PU({cause:N})}let A=`[${c}${m}] ${I.method} ${u} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${v-p}ms`;if(!N.ok){let F=await this.shouldRetry(N);if(r&&F){let b=`retrying, ${r} attempts remaining`;return await Kna(N.body),Sg(this).info(`${A} - ${b}`),Sg(this).debug(`[${c}] response error (${b})`,HT({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),this.retryRequest(s,r,a??c,N.headers)}let E=F?"error; no more retries left":"error; not retryable";Sg(this).info(`${A} - ${E}`);let f=await N.text().catch(b=>Dtt(b).message),Z=Dna(f),W=Z?void 0:f;throw Sg(this).debug(`[${c}] response error (${E})`,HT({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,message:W,durationMs:Date.now()-p})),this.makeStatusError(N.status,Z,W,N.headers)}return Sg(this).info(A),Sg(this).debug(`[${c}] response start`,HT({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),{response:N,options:s,controller:G,requestLogID:c,retryOfRequestLogID:a,startTime:p}}async fetchWithTimeout(e,r,a,i){let o=r||{},{signal:t,method:s}=o,d=ZWe(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),u=globalThis.ReadableStream&&d.body instanceof globalThis.ReadableStream||typeof d.body=="object"&&d.body!==null&&Symbol.asyncIterator in d.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},u?{duplex:"half"}:{}),{method:"GET"}),d);s&&(h.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,h)}finally{clearTimeout(I)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,a,i){var o;let t,s=i?.get("retry-after-ms");if(s){let I=parseFloat(s);Number.isNaN(I)||(t=I)}let d=i?.get("retry-after");if(d&&!t){let I=parseFloat(d);Number.isNaN(I)?t=Date.parse(d)-Date.now():t=I*1e3}if(!(t&&0<=t&&t<60*1e3)){let I=(o=e.maxRetries)!==null&&o!==void 0?o:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(r,I)}return await _na(t),this.makeRequest(e,r-1,a)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,t=Math.min(.5*Math.pow(2,o),8),s=1-Math.random()*.25;return t*s*1e3}async buildRequest(e,{retryCount:r=0}={}){var a,i,o;let t=Object.assign({},e),{method:s,path:d,query:I,defaultBaseURL:u}=t,h=this.buildURL(d,I,u);"timeout"in t&&Ona("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),p=await this.buildHeaders({options:e,method:s,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:s,headers:p},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(o=t.fetchOptions)!==null&&o!==void 0?o:{}),url:h,timeout:t.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:a,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),s=wle([o,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),Pna()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=wle([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:qna(e)}:this.encoder({body:e,headers:a})}};XWe.DEFAULT_TIMEOUT=6e4;W0=class extends XWe{constructor(){super(...arguments),this.interactions=new HWe(this)}};iar=W0;W0.GeminiNextGenAPIClient=iar;W0.GeminiNextGenAPIClientError=G1;W0.APIError=v1;W0.APIConnectionError=PU;W0.APIConnectionTimeoutError=WWe;W0.APIUserAbortError=Rle;W0.NotFoundError=RWe;W0.ConflictError=AWe;W0.RateLimitError=CWe;W0.BadRequestError=FWe;W0.AuthenticationError=wWe;W0.InternalServerError=YWe;W0.PermissionDeniedError=EWe;W0.UnprocessableEntityError=xWe;W0.toFile=aaa;W0.Interactions=HWe;AXs=1024*1024*8;});function faa(n,e){return{...n,...e}}function sar(n){let{prompt_id:e,...r}=n;return r}function NH(n){return Array.isArray(n)?n.map(sar):n}var SWe=Je(()=>{"use strict";Ma();});var oar={};As(oar,{DEFAULT_PROXY_CONFIG:()=>Gaa,getActiveProxyServerUrl:()=>O5,getAvailableProxyServers:()=>baa,getProxyServerInfo:()=>gaa,getProxyServers:()=>Ale,hasAvailableProxyServer:()=>Ktt});function Ale(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function O5(){let e=Ale().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function baa(){return Ale().filter(e=>e.status==="active")}function Ktt(){return Ale().some(e=>e.status==="active")}function gaa(n){return Ale().find(r=>r.url===n)}var Gaa,qU=Je(()=>{"use strict";Gaa={serverUrl:O5(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as vaa}from"crypto";function Vy(){return xle||(xle=vaa()),xle}function lar(n){xle=n}function car(){xle=void 0}var xle,uar,LWe=Je(()=>{"use strict";uar=Vy()});function Ku(n){let e=n??"1.1.55"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${TWe}/VSCode/${i} (${r}; ${a})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${TWe}/Desktop/${i} (${r}; ${a})`}return`${TWe}/CLI/${e} (${r}; ${a})`}var TWe,JC=Je(()=>{"use strict";TWe="EasyCode"});import*as ou from"fs";import*as bw from"path";import*as XT from"os";function yaa(n){$o.configure(n)}function Zaa(n){$o.setUserInfo(n)}function Naa(n){$o.setCliVersion(n)}async function Waa(){return await $o.getUserHeaders()}function Faa(){return $o.getStatus()}var Cle,gs,$o,D5=Je(()=>{"use strict";qU();LWe();JC();Cle=259200,gs=class n{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 Ku(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${o}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${o}\u5206\u949F${t}\u79D2`:o>0?`${o}\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=bw.join(XT.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=bw.join(XT.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=bw.join(XT.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=bw.join(XT.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=bw.join(XT.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=bw.join(XT.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.55",this.config={proxyServerUrl:O5()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{ou.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(ou.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=ou.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=a=>{if(!a||!a.includes("@"))return a;let[i,o]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${o}`}}}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=bw.dirname(this.userInfoFilePath);ou.existsSync(e)||ou.mkdirSync(e,{recursive:!0,mode:448}),ou.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(ou.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=ou.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e);let r=Date.now();this.isTokenExpired()?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")}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=bw.dirname(this.jwtTokenFilePath);ou.existsSync(e)||ou.mkdirSync(e,{recursive:!0,mode:448}),ou.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(ou.existsSync(this.usageStatsFilePath)){let e=ou.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=bw.dirname(this.usageStatsFilePath);ou.existsSync(e)||ou.mkdirSync(e,{recursive:!0,mode:448}),ou.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.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 a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-Cle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${o}), 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,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Cle*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), 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=Cle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}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 a=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:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${o} (until ${t}), next renewal: ${s}${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{ou.existsSync(this.jwtTokenFilePath)&&ou.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=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":Vy()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":Vy()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}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{ou.existsSync(this.userInfoFilePath)&&ou.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{ou.existsSync(this.jwtTokenFilePath)&&ou.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},$o=gs.getInstance()});import{promises as ST}from"node:fs";import Yle from"node:path";import waa from"os";var ky,JWe,Ur,Hy=Je(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(ky||(ky={}));JWe=class{config;logBuffer=[];constructor(e={}){if(this.config={level:ky.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=Yle.join(waa.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),o=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${o}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await ST.mkdir(Yle.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await ST.appendFile(this.config.filePath,e+`
|
|
755
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=haa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};Ptt=class n extends Promise{constructor(e,r,a=maa){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};aar=Symbol("brand.privateNullableHeaders");wle=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of paa(a)){let s=o.toLowerCase();i.has(s)||(e.delete(o),i.add(s)),t===null?(e.delete(o),r.add(s)):(e.append(o,t),r.delete(s))}}return{[aar]:!0,values:e,nulls:r}};Btt=n=>{var e,r,a,i,o,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(o=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||o===void 0?void 0:o.call(i,n))===null||t===void 0?void 0:t.trim()};XWe=class n{constructor(e){var r,a,i,o,t,s,d,{baseURL:I=Btt("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:u=(r=Btt("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=ZWe(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:u,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let p="warn";this.logLevel=p,this.logLevel=(t=(o=Pnr(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:Pnr(Btt("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:p,this.fetchOptions=m.fetchOptions,this.maxRetries=(s=m.maxRetries)!==null&&s!==void 0?s:2,this.fetch=(d=m.fetch)!==null&&d!==void 0?d:jna(),this.encoder=$na,this._options=m,this.apiKey=u,this.apiVersion=h,this.clientAdapter=m.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!r.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){let r=wle([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return wle([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return wle([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new G1(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${_U}`}defaultIdempotencyKey(){return`stainless-node-retry-${Qna()}`}makeStatusError(e,r,a,i){return v1.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=Sna(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return Jna(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:a}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new Ptt(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){var i,o,t;let s=await e,d=(i=s.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=d),await this.prepareOptions(s);let{req:I,url:u,timeout:h}=await this.buildRequest(s,{retryCount:d-r});await this.prepareRequest(I,{url:u,options:s});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=a===void 0?"":`, retryOf: ${a}`,p=Date.now();if(Sg(this).debug(`[${c}] sending request`,HT({retryOfRequestLogID:a,method:s.method,url:u,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Rle;let G=new AbortController,N=await this.fetchWithTimeout(u,I,h,G).catch(Dtt),v=Date.now();if(N instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Rle;let E=Ott(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(r)return Sg(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${F}`),Sg(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${F})`,HT({retryOfRequestLogID:a,url:u,durationMs:v-p,message:N.message})),this.retryRequest(s,r,a??c);throw Sg(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),Sg(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,HT({retryOfRequestLogID:a,url:u,durationMs:v-p,message:N.message})),E?new WWe:new PU({cause:N})}let A=`[${c}${m}] ${I.method} ${u} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${v-p}ms`;if(!N.ok){let F=await this.shouldRetry(N);if(r&&F){let b=`retrying, ${r} attempts remaining`;return await Kna(N.body),Sg(this).info(`${A} - ${b}`),Sg(this).debug(`[${c}] response error (${b})`,HT({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),this.retryRequest(s,r,a??c,N.headers)}let E=F?"error; no more retries left":"error; not retryable";Sg(this).info(`${A} - ${E}`);let f=await N.text().catch(b=>Dtt(b).message),Z=Dna(f),W=Z?void 0:f;throw Sg(this).debug(`[${c}] response error (${E})`,HT({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,message:W,durationMs:Date.now()-p})),this.makeStatusError(N.status,Z,W,N.headers)}return Sg(this).info(A),Sg(this).debug(`[${c}] response start`,HT({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),{response:N,options:s,controller:G,requestLogID:c,retryOfRequestLogID:a,startTime:p}}async fetchWithTimeout(e,r,a,i){let o=r||{},{signal:t,method:s}=o,d=ZWe(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),u=globalThis.ReadableStream&&d.body instanceof globalThis.ReadableStream||typeof d.body=="object"&&d.body!==null&&Symbol.asyncIterator in d.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},u?{duplex:"half"}:{}),{method:"GET"}),d);s&&(h.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,h)}finally{clearTimeout(I)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,a,i){var o;let t,s=i?.get("retry-after-ms");if(s){let I=parseFloat(s);Number.isNaN(I)||(t=I)}let d=i?.get("retry-after");if(d&&!t){let I=parseFloat(d);Number.isNaN(I)?t=Date.parse(d)-Date.now():t=I*1e3}if(!(t&&0<=t&&t<60*1e3)){let I=(o=e.maxRetries)!==null&&o!==void 0?o:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(r,I)}return await _na(t),this.makeRequest(e,r-1,a)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,t=Math.min(.5*Math.pow(2,o),8),s=1-Math.random()*.25;return t*s*1e3}async buildRequest(e,{retryCount:r=0}={}){var a,i,o;let t=Object.assign({},e),{method:s,path:d,query:I,defaultBaseURL:u}=t,h=this.buildURL(d,I,u);"timeout"in t&&Ona("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),p=await this.buildHeaders({options:e,method:s,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:s,headers:p},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(o=t.fetchOptions)!==null&&o!==void 0?o:{}),url:h,timeout:t.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:a,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),s=wle([o,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),Pna()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=wle([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:qna(e)}:this.encoder({body:e,headers:a})}};XWe.DEFAULT_TIMEOUT=6e4;W0=class extends XWe{constructor(){super(...arguments),this.interactions=new HWe(this)}};iar=W0;W0.GeminiNextGenAPIClient=iar;W0.GeminiNextGenAPIClientError=G1;W0.APIError=v1;W0.APIConnectionError=PU;W0.APIConnectionTimeoutError=WWe;W0.APIUserAbortError=Rle;W0.NotFoundError=RWe;W0.ConflictError=AWe;W0.RateLimitError=CWe;W0.BadRequestError=FWe;W0.AuthenticationError=wWe;W0.InternalServerError=YWe;W0.PermissionDeniedError=EWe;W0.UnprocessableEntityError=xWe;W0.toFile=aaa;W0.Interactions=HWe;AXs=1024*1024*8;});function faa(n,e){return{...n,...e}}function sar(n){let{prompt_id:e,...r}=n;return r}function NH(n){return Array.isArray(n)?n.map(sar):n}var SWe=Je(()=>{"use strict";Ma();});var oar={};As(oar,{DEFAULT_PROXY_CONFIG:()=>Gaa,getActiveProxyServerUrl:()=>O5,getAvailableProxyServers:()=>baa,getProxyServerInfo:()=>gaa,getProxyServers:()=>Ale,hasAvailableProxyServer:()=>Ktt});function Ale(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function O5(){let e=Ale().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function baa(){return Ale().filter(e=>e.status==="active")}function Ktt(){return Ale().some(e=>e.status==="active")}function gaa(n){return Ale().find(r=>r.url===n)}var Gaa,qU=Je(()=>{"use strict";Gaa={serverUrl:O5(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as vaa}from"crypto";function Vy(){return xle||(xle=vaa()),xle}function lar(n){xle=n}function car(){xle=void 0}var xle,uar,LWe=Je(()=>{"use strict";uar=Vy()});function Ku(n){let e=n??"1.1.56"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${TWe}/VSCode/${i} (${r}; ${a})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${TWe}/Desktop/${i} (${r}; ${a})`}return`${TWe}/CLI/${e} (${r}; ${a})`}var TWe,JC=Je(()=>{"use strict";TWe="EasyCode"});import*as ou from"fs";import*as bw from"path";import*as XT from"os";function yaa(n){$o.configure(n)}function Zaa(n){$o.setUserInfo(n)}function Naa(n){$o.setCliVersion(n)}async function Waa(){return await $o.getUserHeaders()}function Faa(){return $o.getStatus()}var Cle,gs,$o,D5=Je(()=>{"use strict";qU();LWe();JC();Cle=259200,gs=class n{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 Ku(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${o}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${o}\u5206\u949F${t}\u79D2`:o>0?`${o}\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=bw.join(XT.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=bw.join(XT.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=bw.join(XT.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=bw.join(XT.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=bw.join(XT.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=bw.join(XT.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.56",this.config={proxyServerUrl:O5()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{ou.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(ou.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=ou.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=a=>{if(!a||!a.includes("@"))return a;let[i,o]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${o}`}}}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=bw.dirname(this.userInfoFilePath);ou.existsSync(e)||ou.mkdirSync(e,{recursive:!0,mode:448}),ou.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(ou.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=ou.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e);let r=Date.now();this.isTokenExpired()?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")}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=bw.dirname(this.jwtTokenFilePath);ou.existsSync(e)||ou.mkdirSync(e,{recursive:!0,mode:448}),ou.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(ou.existsSync(this.usageStatsFilePath)){let e=ou.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=bw.dirname(this.usageStatsFilePath);ou.existsSync(e)||ou.mkdirSync(e,{recursive:!0,mode:448}),ou.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.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 a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-Cle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${o}), 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,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Cle*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), 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=Cle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}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 a=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:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${o} (until ${t}), next renewal: ${s}${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{ou.existsSync(this.jwtTokenFilePath)&&ou.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=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":Vy()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":Vy()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}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{ou.existsSync(this.userInfoFilePath)&&ou.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{ou.existsSync(this.jwtTokenFilePath)&&ou.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},$o=gs.getInstance()});import{promises as ST}from"node:fs";import Yle from"node:path";import waa from"os";var ky,JWe,Ur,Hy=Je(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(ky||(ky={}));JWe=class{config;logBuffer=[];constructor(e={}){if(this.config={level:ky.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=Yle.join(waa.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),o=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${o}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await ST.mkdir(Yle.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await ST.appendFile(this.config.filePath,e+`
|
|
756
756
|
`,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await ST.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let a=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${a}.log`);await ST.rename(this.config.filePath,i),await this.cleanOldLogs()}}catch(e){e.code!=="ENOENT"&&console.error("\u65E5\u5FD7\u8F6E\u8F6C\u5931\u8D25:",e)}}async cleanOldLogs(){if(this.config.filePath)try{let e=Yle.dirname(this.config.filePath),a=(await ST.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:Yle.join(e,t),time:ST.stat(Yle.join(e,t)).then(s=>s.mtime)})),i=await Promise.all(a.map(async t=>({...t,time:await t.time})));i.sort((t,s)=>s.time.getTime()-t.time.getTime());let o=i.slice(this.config.maxFiles||5);for(let t of o)await ST.unlink(t.path)}catch(e){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",e)}}log(e,r,a,...i){if(e<this.config.level)return;let o=this.formatMessage(r,a,...i);this.config.enableConsole&&(e>=ky.ERROR?console.error:e>=ky.WARN?console.warn:e>=ky.INFO?console.log:console.debug)(o),this.config.enableFile&&this.writeToFile(o)}debug(e,...r){this.log(ky.DEBUG,"DEBUG",e,...r)}info(e,...r){this.log(ky.INFO,"INFO",e,...r)}warn(e,...r){this.log(ky.WARN,"WARN",e,...r)}error(e,...r){this.log(ky.ERROR,"ERROR",e,...r)}logApiRequest(e,r){this.debug("API\u8BF7\u6C42",{endpoint:e,timestamp:new Date().toISOString(),requestSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{requestData:r}:{}})}logApiResponse(e,r){this.debug("API\u54CD\u5E94",{endpoint:e,timestamp:new Date().toISOString(),responseSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{responseData:r}:{}})}},Ur=new JWe({level:process.env.FILE_DEBUG==="1"?ky.DEBUG:ky.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Bc(n){return n instanceof Error&&"code"in n}function pn(n){if(n instanceof Error)return n.message;try{return String(n)}catch{return"Failed to get error details"}}function $tt(n){if(n&&typeof n=="object"&&"response"in n){let r=Eaa(n);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new OWe(r.error.message);case 401:return new nI(r.error.message);case 403:return new BWe(r.error.message);default:}}return n}function Eaa(n){return typeof n.response?.data=="string"?JSON.parse(n.response?.data):n.response?.data}function LT(n){if(!n)return!1;try{let e=JSON.parse(n);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var BWe,nI,OWe,Oc=Je(()=>{"use strict";BWe=class extends Error{},nI=class extends Error{},OWe=class extends Error{}});var ia,dar,vI,y1=Je(()=>{"use strict";(function(n){n.CHAT_CONVERSATION="chat_conversation",n.WEB_FETCH="web_fetch",n.WEB_SEARCH="web_search",n.CONTENT_SUMMARY="content_summary",n.JSON_GENERATION="json_generation",n.COMPRESSION="compression",n.SUB_AGENT="sub_agent",n.CODE_ASSIST="code_assist",n.EDIT_CORRECTION="edit_correction",n.IMAGE_READER="image_reader",n.GOAL_EVALUATION="goal_evaluation"})(ia||(ia={}));dar={[ia.CHAT_CONVERSATION]:"auto",[ia.WEB_FETCH]:"gemini-2.5-flash",[ia.WEB_SEARCH]:"gemini-2.5-flash",[ia.CODE_ASSIST]:"auto",[ia.CONTENT_SUMMARY]:"deepseek-v4-flash",[ia.EDIT_CORRECTION]:"deepseek-v4-flash",[ia.JSON_GENERATION]:"gemini-2.5-flash",[ia.COMPRESSION]:"gemini-2.5-flash",[ia.SUB_AGENT]:"auto",[ia.IMAGE_READER]:"gemini-2.5-flash",[ia.GOAL_EVALUATION]:"deepseek-v4-flash"},vI=class{static getModelForScene(e){if(e)return dar[e]}static isClaudeModel(e){return e.includes("claude")||e.includes("anthropic")}static isGeminiModel(e){return e.includes("gemini")&&!this.isClaudeModel(e)}static getSceneDisplayName(e){return{[ia.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[ia.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[ia.WEB_SEARCH]:"Web\u641C\u7D22",[ia.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[ia.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[ia.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[ia.JSON_GENERATION]:"JSON\u751F\u6210",[ia.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[ia.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[ia.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B",[ia.GOAL_EVALUATION]:"\u76EE\u6807\u8FBE\u6210\u8BC4\u4F30"}[e]||e}}});function h3(n){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="object"&&"message"in n.error}function t2(n){return typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string"}function gw(n){let e=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof n=="string")return e(n);if(t2(n))return e(n.message);if(h3(n))return e(n.error.message);if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response&&r.response.data){if(typeof r.response.data=="string")return e(r.response.data);if(typeof r.response.data=="object"&&r.response.data!==null&&"error"in r.response.data){let a=r.response.data;return e(a.error?.message||"")}}}return!1}function Gw(n){return typeof n=="string"?n.includes("Quota exceeded for quota metric"):t2(n)?n.message.includes("Quota exceeded for quota metric"):h3(n)?n.error.message.includes("Quota exceeded for quota metric"):!1}function r2(n){if(n&&typeof n=="object"&&"response"in n){let e=n;if(e.response?.status===402&&e.response.data){let r=e.response.data;if(r&&typeof r.error=="string"&&(r.error==="Quota limit exceeded"||r.error==="No quota configuration")&&typeof r.message=="string")return!0}if(e.response?.status===500&&e.response.data){let r=e.response.data;if(r&&typeof r.message=="string"&&r.message.includes("quota exceeded"))return!0}}if(n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"'))||n.message.includes("API request failed (500):")&&n.message.includes("quota exceeded")||n.message.includes("Stream API error (500):")&&n.message.includes("quota exceeded")))return!0;if(typeof n=="object"&&n!==null){let e=n;if(e.message&&typeof e.message=="string"&&(e.message.includes("API request failed (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||e.message.includes("API error (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||(e.message.includes("API request failed (500):")||e.message.includes("Stream API error (500):"))&&e.message.includes("quota exceeded"))||(e.error==="Quota limit exceeded"||e.error==="No quota configuration")&&typeof e.message=="string"||e.status===500&&typeof e.message=="string"&&e.message.includes("quota exceeded"))return!0}return typeof n=="string"?n.includes("Quota limit exceeded")||n.includes("No quota configuration")||n.includes("Daily token limit would be exceeded")||n.includes("Daily request limit exceeded")||n.includes("Daily cost limit would be exceeded")||n.includes("500")&&n.includes("quota exceeded"):!1}function Vle(n){let e=null;if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response?.status===402&&r.response.data)e=r.response.data;else if(r.response?.status===500&&r.response.data){let a=r.response.data;a&&typeof a.message=="string"&&a.message.includes("quota exceeded")&&(e=a)}}else if(typeof n=="object"&&n!==null){let r=n;if(r.message&&typeof r.message=="string"&&(r.message.includes("API request failed (402):")||r.message.includes("API request failed (500):")||r.message.includes("Stream API error (500):"))&&(r.message.includes('"error":"Quota limit exceeded"')||r.message.includes('"error":"No quota configuration"')||r.message.includes("quota exceeded")))try{let a=r.message.match(/\{.*\}$/);a&&(e=JSON.parse(a[0]))}catch{}e||(e=n)}if(!e&&n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")||n.message.includes("API request failed (500):")||n.message.includes("Stream API error (500):"))&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"')||n.message.includes("quota exceeded")))try{let r=n.message.match(/\{.*\}$/);r&&(e=JSON.parse(r[0]))}catch{}return e?e.message&&e.message.includes("quota exceeded")?Raa(e):Aaa(e):null}function Raa(n){let r=(()=>{try{let c=process.env,m=c.LC_ALL||c.LC_CTYPE||c.LANG||"";return m.toLowerCase().includes("zh")||m.toLowerCase().includes("chinese")}catch{return!1}})(),a="",i="",o="",t="",s=n.message||"",d=s.match(/Role:\s*([^,]+)/);d&&(a=d[1].trim());let I=s.match(/Limit:\s*([^,]+)/);I&&(i=I[1].trim());let u=s.match(/Used:\s*([^,]+)/);u&&(o=u[1].trim());let h=s.match(/Cycle:\s*([^,]+)/);if(h&&(t=h[1].trim()),r){let c=`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
757
757
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
758
758
|
`,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
|
|
@@ -5616,7 +5616,7 @@ ${a}
|
|
|
5616
5616
|
\u{1F50D} Model Diagnostics: ${n}`),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(`
|
|
5617
5617
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(a=>console.log(` \u2022 ${a}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
5618
5618
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(a=>console.log(` \u2022 ${a}`))),e&&(console.log(`
|
|
5619
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function Uzi(n){let e=QOe(n);return e.isSmallModel||e.needsSpecialHandling}function zzi(n){let e=QOe(n);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 hvn=Je(()=>{"use strict";_me();});import*as qW from"fs";import*as XOe from"path";var Pzi,Qge,mvn=Je(()=>{"use strict";wI();Pzi="healthy-use-reminder.json",Qge=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=Iv(e);this.stateFilePath=XOe.join(r,Pzi)}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 o=2700*1e3;return Date.now()-i.lastReminderShownAt>=o}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{qW.existsSync(this.stateFilePath)&&qW.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!qW.existsSync(this.stateFilePath))return null;let e=qW.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=XOe.dirname(this.stateFilePath);qW.existsSync(r)||qW.mkdirSync(r,{recursive:!0}),qW.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var xQt,CQt,jzi,qzi,Kzi,pvn=Je(()=>{"use strict";xQt="--- Content from referenced files ---",CQt="--- End of content ---",jzi=2e3,qzi=2e3,Kzi=20});function bvn(...n){return $zi(...n)}function gvn(...n){return ePi(...n)}function fvn(n,e){return n in e}function YQt(){let n={get(i,o){if(o==="write")return bvn;if(fvn(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,o){if(o==="write")return gvn;if(fvn(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var $zi,ePi,Gvn=Je(()=>{"use strict";$zi=process.stdout.write.bind(process.stdout),ePi=process.stderr.write.bind(process.stderr)});import{readFile as tPi}from"node:fs/promises";import{fileURLToPath as rPi}from"node:url";import VQt from"node:path";function nPi(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return VQt.dirname(rPi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function lx(){return Xge||(Xge=(async()=>"1.1.55")(),Xge)}function aPi(){Xge=void 0}var Xge,kQt=Je(()=>{"use strict";});import{EventEmitter as iPi}from"node:events";var Sge,HQt,QQt,vvn=Je(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(Sge||(Sge={}));HQt=class{emitter=new iPi;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()}},QQt=new HQt});function SOe(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function sPi(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function XQt(n){if(!n||n.length===0)return[];let e=[];for(let r of n){if(r.role&&(r.parts||r.content!==void 0)){let a=r.parts??SOe(r.content);e.push({role:r.role,parts:a});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let a=r.content!==void 0?SOe(r.content):[],i=sPi(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(r.type==="gemini"){let a=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;a.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&a.push(...SOe(r.content)),i)for(let o of r.toolCalls)a.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),i){let o=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?o.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?o.push(...SOe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var yvn=Je(()=>{"use strict";});var jD,Zvn,Lge,Nvn=Je(()=>{"use strict";jD=class n extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new n("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new n(`Session '${e}' was not found under ${r}.`)}},Zvn="latest",Lge=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,a)=>new Date(r.startTime).getTime()-new Date(a.startTime).getTime())}async findSession(e){let r=e.trim(),a=await this.listSessions();if(a.length===0)throw jD.noSessionsFound();let i=a.find(t=>t.id===r);if(i)return i;let o=Number.parseInt(r,10);if(Number.isInteger(o)&&o.toString()===r&&o>0&&o<=a.length)return a[o-1];throw jD.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===Zvn){let o=await this.listSessions();if(o.length===0)throw jD.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new jD(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,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 oPi(n,e,r){return new LOe(n,e,r)}var LOe,TOe,JOe,Wvn=Je(()=>{"use strict";Sme();JC();LOe=class n{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,a){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=a}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let a=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(a,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(a,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,a={}){let i={...a,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async put(e,r,a={}){let i={...a,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Ku(),...e.headers};if(this.tokenManager)try{let a=await this.tokenManager.getAccessToken();a?r.Authorization=`Bearer ${a}`:aV("warn","\u26A0\uFE0F No access token available")}catch(a){aV("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(aV("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((a,i)=>{this.requestQueue.push({resolve:a,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{aV("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){aV("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${a}`}},o=fetch(e,i);return this.processRequestQueue(a),await o}else throw new Error("Failed to refresh token")}catch(a){throw console.error("\u274C Token refresh failed:",a),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(aV("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new TOe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:a,reject:i,request:o})=>{o().then(t=>a(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:a})=>{a(e)})}static async checkResponse(e){if(!e.ok){let a=await e.text();throw new JOe(`HTTP ${e.status}: ${e.statusText}`,e.status,a)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let a=await this.request(e,r);return n.checkResponse(a)}async postJson(e,r){let a=await this.post(e,r);return n.checkResponse(a)}async putJson(e,r){let a=await this.put(e,r);return n.checkResponse(a)}async getJson(e){let r=await this.get(e);return n.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return n.checkResponse(r)}},TOe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},JOe=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function lPi(n){return Tge.getInstance(n)}function cPi(n){let e=Tge.getInstance(n);return()=>e.handleAuthenticationRequired()}var Tge,Fvn=Je(()=>{"use strict";D5();Tge=class n{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.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"),gs.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 a=`${gs.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${a}`),window.location.href=a}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function OOe(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new BOe(r)}var BOe,SQt=Je(()=>{"use strict";BOe=class{config;constructor(e){this.config=e}buildAuthUrl(){let e=`${this.config.authUrl}?redirect_to=${encodeURIComponent(this.config.redirectUri)}&redirect_mode=same_window`;return console.log("\u{1F517} DeepVlab\u8BA4\u8BC1URL:",e),e}handleCallback(e){console.log("\u{1F504} [DeepVlab Auth] \u5904\u7406DeepVlab\u8BA4\u8BC1\u56DE\u8C03"),console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03URL:",e.toString());let r=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",r);let a=e.searchParams.get("token"),i=e.searchParams.get("user_id"),o=e.searchParams.get("error");return o?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",o),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${o}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as DOe from"fs";import*as SG from"path";function uPi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Jge,lS,LQt=Je(()=>{"use strict";Jge=uPi(),lS=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(SG.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(SG.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(SG.join(this.customBasePath,"auth","login","templates",e))),Jge&&r.push(SG.join(Jge,e)),Jge){let o=Jge;for(let t=0;t<10;t++)r.push(SG.join(o,"bundled","auth","login","templates",e)),r.push(SG.join(o,"bundled",e)),r.push(SG.join(o,"bundle","login","templates",e)),r.push(SG.join(o,"auth","login","templates",e)),o=SG.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(SG.join(o,"bundle","login","templates",e)),r.push(SG.join(o,"dist","bundled","auth","login","templates",e)),r.push(SG.join(o,"bundled","auth","login","templates",e)),r.push(SG.join(o,"auth","login","templates",e))}catch{}let a=null;for(let o of r)try{if(DOe.existsSync(o)){a=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!a){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((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${Jge||"(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=DOe.readFileSync(a,"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`
|
|
5619
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function Uzi(n){let e=QOe(n);return e.isSmallModel||e.needsSpecialHandling}function zzi(n){let e=QOe(n);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 hvn=Je(()=>{"use strict";_me();});import*as qW from"fs";import*as XOe from"path";var Pzi,Qge,mvn=Je(()=>{"use strict";wI();Pzi="healthy-use-reminder.json",Qge=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=Iv(e);this.stateFilePath=XOe.join(r,Pzi)}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 o=2700*1e3;return Date.now()-i.lastReminderShownAt>=o}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{qW.existsSync(this.stateFilePath)&&qW.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!qW.existsSync(this.stateFilePath))return null;let e=qW.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=XOe.dirname(this.stateFilePath);qW.existsSync(r)||qW.mkdirSync(r,{recursive:!0}),qW.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var xQt,CQt,jzi,qzi,Kzi,pvn=Je(()=>{"use strict";xQt="--- Content from referenced files ---",CQt="--- End of content ---",jzi=2e3,qzi=2e3,Kzi=20});function bvn(...n){return $zi(...n)}function gvn(...n){return ePi(...n)}function fvn(n,e){return n in e}function YQt(){let n={get(i,o){if(o==="write")return bvn;if(fvn(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,o){if(o==="write")return gvn;if(fvn(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var $zi,ePi,Gvn=Je(()=>{"use strict";$zi=process.stdout.write.bind(process.stdout),ePi=process.stderr.write.bind(process.stderr)});import{readFile as tPi}from"node:fs/promises";import{fileURLToPath as rPi}from"node:url";import VQt from"node:path";function nPi(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return VQt.dirname(rPi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function lx(){return Xge||(Xge=(async()=>"1.1.56")(),Xge)}function aPi(){Xge=void 0}var Xge,kQt=Je(()=>{"use strict";});import{EventEmitter as iPi}from"node:events";var Sge,HQt,QQt,vvn=Je(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(Sge||(Sge={}));HQt=class{emitter=new iPi;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()}},QQt=new HQt});function SOe(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function sPi(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function XQt(n){if(!n||n.length===0)return[];let e=[];for(let r of n){if(r.role&&(r.parts||r.content!==void 0)){let a=r.parts??SOe(r.content);e.push({role:r.role,parts:a});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let a=r.content!==void 0?SOe(r.content):[],i=sPi(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(r.type==="gemini"){let a=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;a.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&a.push(...SOe(r.content)),i)for(let o of r.toolCalls)a.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),i){let o=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?o.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?o.push(...SOe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var yvn=Je(()=>{"use strict";});var jD,Zvn,Lge,Nvn=Je(()=>{"use strict";jD=class n extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new n("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new n(`Session '${e}' was not found under ${r}.`)}},Zvn="latest",Lge=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,a)=>new Date(r.startTime).getTime()-new Date(a.startTime).getTime())}async findSession(e){let r=e.trim(),a=await this.listSessions();if(a.length===0)throw jD.noSessionsFound();let i=a.find(t=>t.id===r);if(i)return i;let o=Number.parseInt(r,10);if(Number.isInteger(o)&&o.toString()===r&&o>0&&o<=a.length)return a[o-1];throw jD.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===Zvn){let o=await this.listSessions();if(o.length===0)throw jD.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new jD(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,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 oPi(n,e,r){return new LOe(n,e,r)}var LOe,TOe,JOe,Wvn=Je(()=>{"use strict";Sme();JC();LOe=class n{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,a){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=a}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let a=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(a,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(a,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,a={}){let i={...a,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async put(e,r,a={}){let i={...a,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Ku(),...e.headers};if(this.tokenManager)try{let a=await this.tokenManager.getAccessToken();a?r.Authorization=`Bearer ${a}`:aV("warn","\u26A0\uFE0F No access token available")}catch(a){aV("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(aV("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((a,i)=>{this.requestQueue.push({resolve:a,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{aV("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){aV("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${a}`}},o=fetch(e,i);return this.processRequestQueue(a),await o}else throw new Error("Failed to refresh token")}catch(a){throw console.error("\u274C Token refresh failed:",a),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(aV("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new TOe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:a,reject:i,request:o})=>{o().then(t=>a(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:a})=>{a(e)})}static async checkResponse(e){if(!e.ok){let a=await e.text();throw new JOe(`HTTP ${e.status}: ${e.statusText}`,e.status,a)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let a=await this.request(e,r);return n.checkResponse(a)}async postJson(e,r){let a=await this.post(e,r);return n.checkResponse(a)}async putJson(e,r){let a=await this.put(e,r);return n.checkResponse(a)}async getJson(e){let r=await this.get(e);return n.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return n.checkResponse(r)}},TOe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},JOe=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function lPi(n){return Tge.getInstance(n)}function cPi(n){let e=Tge.getInstance(n);return()=>e.handleAuthenticationRequired()}var Tge,Fvn=Je(()=>{"use strict";D5();Tge=class n{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.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"),gs.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 a=`${gs.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${a}`),window.location.href=a}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function OOe(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new BOe(r)}var BOe,SQt=Je(()=>{"use strict";BOe=class{config;constructor(e){this.config=e}buildAuthUrl(){let e=`${this.config.authUrl}?redirect_to=${encodeURIComponent(this.config.redirectUri)}&redirect_mode=same_window`;return console.log("\u{1F517} DeepVlab\u8BA4\u8BC1URL:",e),e}handleCallback(e){console.log("\u{1F504} [DeepVlab Auth] \u5904\u7406DeepVlab\u8BA4\u8BC1\u56DE\u8C03"),console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03URL:",e.toString());let r=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",r);let a=e.searchParams.get("token"),i=e.searchParams.get("user_id"),o=e.searchParams.get("error");return o?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",o),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${o}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as DOe from"fs";import*as SG from"path";function uPi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Jge,lS,LQt=Je(()=>{"use strict";Jge=uPi(),lS=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(SG.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(SG.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(SG.join(this.customBasePath,"auth","login","templates",e))),Jge&&r.push(SG.join(Jge,e)),Jge){let o=Jge;for(let t=0;t<10;t++)r.push(SG.join(o,"bundled","auth","login","templates",e)),r.push(SG.join(o,"bundled",e)),r.push(SG.join(o,"bundle","login","templates",e)),r.push(SG.join(o,"auth","login","templates",e)),o=SG.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(SG.join(o,"bundle","login","templates",e)),r.push(SG.join(o,"dist","bundled","auth","login","templates",e)),r.push(SG.join(o,"bundled","auth","login","templates",e)),r.push(SG.join(o,"auth","login","templates",e))}catch{}let a=null;for(let o of r)try{if(DOe.existsSync(o)){a=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!a){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((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${Jge||"(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=DOe.readFileSync(a,"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`
|
|
5620
5620
|
<!DOCTYPE html>
|
|
5621
5621
|
<html>
|
|
5622
5622
|
<head>
|
|
@@ -7005,7 +7005,7 @@ ${c}`),a?i.reset(c):c}function Vts(n,e,r,a={}){if(!UWn){UWn=!0;let o="Passing li
|
|
|
7005
7005
|
|
|
7006
7006
|
${e}
|
|
7007
7007
|
`:""}`}set message(e){this.#r=e}#a(e){if(!this.#t)return;let r=this.#e,a=Xts(r,this.#t.message);if(a)return(0,rFn.codeFrameColumns)(r,{start:a},{highlightCode:e})}get codeFrame(){return this.#n??=this.#a(!0),this.#n}get rawCodeFrame(){return this.#i??=this.#a(!1),this.#i}},Xts=(n,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:a,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:_6t(n,Number(a),{oneBased:!0})},Sts=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,a)=>`"${a}"(${Qts(a)})`)});var CGe=ve((Ozo,aFn)=>{"use strict";var Lts=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};aFn.exports=Lts});var YGe=ve((Dzo,iFn)=>{"use strict";var Tts="2.0.0",Jts=Number.MAX_SAFE_INTEGER||9007199254740991,Bts=16,Ots=250,Dts=["major","premajor","minor","preminor","patch","prepatch","prerelease"];iFn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Bts,MAX_SAFE_BUILD_LENGTH:Ots,MAX_SAFE_INTEGER:Jts,RELEASE_TYPES:Dts,SEMVER_SPEC_VERSION:Tts,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Aae=ve((Zx,sFn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:z6t,MAX_SAFE_BUILD_LENGTH:_ts,MAX_LENGTH:Mts}=YGe(),Uts=CGe();Zx=sFn.exports={};var zts=Zx.re=[],Pts=Zx.safeRe=[],Va=Zx.src=[],jts=Zx.safeSrc=[],ka=Zx.t={},qts=0,P6t="[a-zA-Z0-9-]",Kts=[["\\s",1],["\\d",Mts],[P6t,_ts]],$ts=n=>{for(let[e,r]of Kts)n=n.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return n},Ys=(n,e,r)=>{let a=$ts(e),i=qts++;Uts(n,i,e),ka[n]=i,Va[i]=e,jts[i]=a,zts[i]=new RegExp(e,r?"g":void 0),Pts[i]=new RegExp(a,r?"g":void 0)};Ys("NUMERICIDENTIFIER","0|[1-9]\\d*");Ys("NUMERICIDENTIFIERLOOSE","\\d+");Ys("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${P6t}*`);Ys("MAINVERSION",`(${Va[ka.NUMERICIDENTIFIER]})\\.(${Va[ka.NUMERICIDENTIFIER]})\\.(${Va[ka.NUMERICIDENTIFIER]})`);Ys("MAINVERSIONLOOSE",`(${Va[ka.NUMERICIDENTIFIERLOOSE]})\\.(${Va[ka.NUMERICIDENTIFIERLOOSE]})\\.(${Va[ka.NUMERICIDENTIFIERLOOSE]})`);Ys("PRERELEASEIDENTIFIER",`(?:${Va[ka.NONNUMERICIDENTIFIER]}|${Va[ka.NUMERICIDENTIFIER]})`);Ys("PRERELEASEIDENTIFIERLOOSE",`(?:${Va[ka.NONNUMERICIDENTIFIER]}|${Va[ka.NUMERICIDENTIFIERLOOSE]})`);Ys("PRERELEASE",`(?:-(${Va[ka.PRERELEASEIDENTIFIER]}(?:\\.${Va[ka.PRERELEASEIDENTIFIER]})*))`);Ys("PRERELEASELOOSE",`(?:-?(${Va[ka.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Va[ka.PRERELEASEIDENTIFIERLOOSE]})*))`);Ys("BUILDIDENTIFIER",`${P6t}+`);Ys("BUILD",`(?:\\+(${Va[ka.BUILDIDENTIFIER]}(?:\\.${Va[ka.BUILDIDENTIFIER]})*))`);Ys("FULLPLAIN",`v?${Va[ka.MAINVERSION]}${Va[ka.PRERELEASE]}?${Va[ka.BUILD]}?`);Ys("FULL",`^${Va[ka.FULLPLAIN]}$`);Ys("LOOSEPLAIN",`[v=\\s]*${Va[ka.MAINVERSIONLOOSE]}${Va[ka.PRERELEASELOOSE]}?${Va[ka.BUILD]}?`);Ys("LOOSE",`^${Va[ka.LOOSEPLAIN]}$`);Ys("GTLT","((?:<|>)?=?)");Ys("XRANGEIDENTIFIERLOOSE",`${Va[ka.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Ys("XRANGEIDENTIFIER",`${Va[ka.NUMERICIDENTIFIER]}|x|X|\\*`);Ys("XRANGEPLAIN",`[v=\\s]*(${Va[ka.XRANGEIDENTIFIER]})(?:\\.(${Va[ka.XRANGEIDENTIFIER]})(?:\\.(${Va[ka.XRANGEIDENTIFIER]})(?:${Va[ka.PRERELEASE]})?${Va[ka.BUILD]}?)?)?`);Ys("XRANGEPLAINLOOSE",`[v=\\s]*(${Va[ka.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Va[ka.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Va[ka.XRANGEIDENTIFIERLOOSE]})(?:${Va[ka.PRERELEASELOOSE]})?${Va[ka.BUILD]}?)?)?`);Ys("XRANGE",`^${Va[ka.GTLT]}\\s*${Va[ka.XRANGEPLAIN]}$`);Ys("XRANGELOOSE",`^${Va[ka.GTLT]}\\s*${Va[ka.XRANGEPLAINLOOSE]}$`);Ys("COERCEPLAIN",`(^|[^\\d])(\\d{1,${z6t}})(?:\\.(\\d{1,${z6t}}))?(?:\\.(\\d{1,${z6t}}))?`);Ys("COERCE",`${Va[ka.COERCEPLAIN]}(?:$|[^\\d])`);Ys("COERCEFULL",Va[ka.COERCEPLAIN]+`(?:${Va[ka.PRERELEASE]})?(?:${Va[ka.BUILD]})?(?:$|[^\\d])`);Ys("COERCERTL",Va[ka.COERCE],!0);Ys("COERCERTLFULL",Va[ka.COERCEFULL],!0);Ys("LONETILDE","(?:~>?)");Ys("TILDETRIM",`(\\s*)${Va[ka.LONETILDE]}\\s+`,!0);Zx.tildeTrimReplace="$1~";Ys("TILDE",`^${Va[ka.LONETILDE]}${Va[ka.XRANGEPLAIN]}$`);Ys("TILDELOOSE",`^${Va[ka.LONETILDE]}${Va[ka.XRANGEPLAINLOOSE]}$`);Ys("LONECARET","(?:\\^)");Ys("CARETTRIM",`(\\s*)${Va[ka.LONECARET]}\\s+`,!0);Zx.caretTrimReplace="$1^";Ys("CARET",`^${Va[ka.LONECARET]}${Va[ka.XRANGEPLAIN]}$`);Ys("CARETLOOSE",`^${Va[ka.LONECARET]}${Va[ka.XRANGEPLAINLOOSE]}$`);Ys("COMPARATORLOOSE",`^${Va[ka.GTLT]}\\s*(${Va[ka.LOOSEPLAIN]})$|^$`);Ys("COMPARATOR",`^${Va[ka.GTLT]}\\s*(${Va[ka.FULLPLAIN]})$|^$`);Ys("COMPARATORTRIM",`(\\s*)${Va[ka.GTLT]}\\s*(${Va[ka.LOOSEPLAIN]}|${Va[ka.XRANGEPLAIN]})`,!0);Zx.comparatorTrimReplace="$1$2$3";Ys("HYPHENRANGE",`^\\s*(${Va[ka.XRANGEPLAIN]})\\s+-\\s+(${Va[ka.XRANGEPLAIN]})\\s*$`);Ys("HYPHENRANGELOOSE",`^\\s*(${Va[ka.XRANGEPLAINLOOSE]})\\s+-\\s+(${Va[ka.XRANGEPLAINLOOSE]})\\s*$`);Ys("STAR","(<|>)?=?\\s*\\*");Ys("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Ys("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Y_e=ve((_zo,oFn)=>{"use strict";var ers=Object.freeze({loose:!0}),trs=Object.freeze({}),rrs=n=>n?typeof n!="object"?ers:n:trs;oFn.exports=rrs});var j6t=ve((Mzo,uFn)=>{"use strict";var lFn=/^[0-9]+$/,cFn=(n,e)=>{if(typeof n=="number"&&typeof e=="number")return n===e?0:n<e?-1:1;let r=lFn.test(n),a=lFn.test(e);return r&&a&&(n=+n,e=+e),n===e?0:r&&!a?-1:a&&!r?1:n<e?-1:1},nrs=(n,e)=>cFn(e,n);uFn.exports={compareIdentifiers:cFn,rcompareIdentifiers:nrs}});var ng=ve((Uzo,IFn)=>{"use strict";var V_e=CGe(),{MAX_LENGTH:dFn,MAX_SAFE_INTEGER:k_e}=YGe(),{safeRe:H_e,t:Q_e}=Aae(),ars=Y_e(),{compareIdentifiers:q6t}=j6t(),K6t=class n{constructor(e,r){if(r=ars(r),e instanceof n){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>dFn)throw new TypeError(`version is longer than ${dFn} characters`);V_e("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let a=e.trim().match(r.loose?H_e[Q_e.LOOSE]:H_e[Q_e.FULL]);if(!a)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>k_e||this.major<0)throw new TypeError("Invalid major version");if(this.minor>k_e||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>k_e||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let o=+i;if(o>=0&&o<k_e)return o}return i}):this.prerelease=[],this.build=a[5]?a[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(V_e("SemVer.compare",this.version,this.options,e),!(e instanceof n)){if(typeof e=="string"&&e===this.version)return 0;e=new n(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof n||(e=new n(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 n||(e=new n(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 a=this.prerelease[r],i=e.prerelease[r];if(V_e("prerelease compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return q6t(a,i)}while(++r)}compareBuild(e){e instanceof n||(e=new n(e,this.options));let r=0;do{let a=this.build[r],i=e.build[r];if(V_e("build compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return q6t(a,i)}while(++r)}inc(e,r,a){if(e.startsWith("pre")){if(!r&&a===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?H_e[Q_e.PRERELEASELOOSE]:H_e[Q_e.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,a);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,a);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,a),this.inc("pre",r,a);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,a),this.inc("pre",r,a);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(a)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&a===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let o=[r,i];a===!1&&(o=[r]),q6t(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};IFn.exports=K6t});var p_=ve((zzo,mFn)=>{"use strict";var hFn=ng(),irs=(n,e,r=!1)=>{if(n instanceof hFn)return n;try{return new hFn(n,e)}catch(a){if(!r)return null;throw a}};mFn.exports=irs});var $6t=ve((Pzo,pFn)=>{"use strict";var srs=p_(),ors=(n,e)=>{let r=srs(n,e);return r?r.version:null};pFn.exports=ors});var eSt=ve((jzo,fFn)=>{"use strict";var lrs=p_(),crs=(n,e)=>{let r=lrs(n.trim().replace(/^[=v]+/,""),e);return r?r.version:null};fFn.exports=crs});var tSt=ve((qzo,urs)=>{urs.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 bFn=ve((Kzo,drs)=>{drs.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 gFn=ve(($zo,Irs)=>{Irs.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 vFn=ve((ePo,GFn)=>{"use strict";var hrs=[].concat(tSt()).concat(bFn()),mrs=gFn();GFn.exports=function(n){var e=0;function r(){return e<n.length}function a(p){if(p instanceof RegExp){var G=n.slice(e),N=G.match(p);if(N)return e+=N[0].length,N[0]}else if(n.indexOf(p,e)===e)return e+=p.length,p}function i(){a(/[ ]*/)}function o(){for(var p,G=["WITH","AND","OR","(",")",":","+"],N=0;N<G.length&&(p=a(G[N]),!p);N++);if(p==="+"&&e>1&&n[e-2]===" ")throw new Error("Space before `+`");return p&&{type:"OPERATOR",string:p}}function t(){return a(/[A-Za-z0-9-.]+/)}function s(){var p=t();if(!p)throw new Error("Expected idstring at offset "+e);return p}function d(){if(a("DocumentRef-")){var p=s();return{type:"DOCUMENTREF",string:p}}}function I(){if(a("LicenseRef-")){var p=s();return{type:"LICENSEREF",string:p}}}function u(){var p=e,G=t();if(hrs.indexOf(G)!==-1)return{type:"LICENSE",string:G};if(mrs.indexOf(G)!==-1)return{type:"EXCEPTION",string:G};e=p}function h(){return o()||d()||I()||u()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+n[e]+"` at offset "+e);c.push(m)}return c}});var ZFn=ve((tPo,yFn)=>{"use strict";yFn.exports=function(n){var e=0;function r(){return e<n.length}function a(){return r()?n[e]:null}function i(){if(!r())throw new Error;e++}function o(G){var N=a();if(N&&N.type==="OPERATOR"&&G===N.string)return i(),N.string}function t(){if(o("WITH")){var G=a();if(G&&G.type==="EXCEPTION")return i(),G.string;throw new Error("Expected exception after `WITH`")}}function s(){var G=e,N="",v=a();if(v.type==="DOCUMENTREF"&&(i(),N+="DocumentRef-"+v.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(v=a(),v.type==="LICENSEREF")return i(),N+="LicenseRef-"+v.string,{license:N};e=G}function d(){var G=a();if(G&&G.type==="LICENSE"){i();var N={license:G.string};o("+")&&(N.plus=!0);var v=t();return v&&(N.exception=v),N}}function I(){var G=o("(");if(G){var N=m();if(!o(")"))throw new Error("Expected `)`");return N}}function u(){return I()||s()||d()}function h(G,N){return function v(){var A=N();if(A){if(!o(G))return A;var F=v();if(!F)throw new Error("Expected expression");return{left:A,conjunction:G.toLowerCase(),right:F}}}}var c=h("AND",u),m=h("OR",c),p=m();if(!p||r())throw new Error("Syntax error");return p}});var rSt=ve((rPo,NFn)=>{"use strict";var prs=vFn(),frs=ZFn();NFn.exports=function(n){return frs(prs(n))}});var YFn=ve((nPo,CFn)=>{var brs=rSt(),grs=tSt();function X_e(n){try{return brs(n),!0}catch{return!1}}function xFn(n,e){var r=e[0].length-n[0].length;return r!==0?r:n[0].toUpperCase().localeCompare(e[0].toUpperCase())}var WFn=[["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(xFn),Grs=0,vrs=1,FFn=[function(n){return n.toUpperCase()},function(n){return n.trim()},function(n){return n.replace(/\./g,"")},function(n){return n.replace(/\s+/g,"")},function(n){return n.replace(/\s+/g,"-")},function(n){return n.replace("v","-")},function(n){return n.replace(/,?\s*(\d)/,"-$1")},function(n){return n.replace(/,?\s*(\d)/,"-$1.0")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(n){return n[0].toUpperCase()+n.slice(1)},function(n){return n.replace("/","-")},function(n){return n.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(n){return n.indexOf("3.0")!==-1?n+"-or-later":n+"-only"},function(n){return n+"only"},function(n){return n.replace(/(\d)$/,"-$1.0")},function(n){return n.replace(/(-| )?(\d)$/,"-$2-Clause")},function(n){return n.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(n){return n.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(n){return n.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(n){return n.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(n){return n.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(n){return n.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(n){return"CC-"+n},function(n){return"CC-"+n+"-4.0"},function(n){return n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(n){return"CC-"+n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],nSt=grs.map(function(n){var e=/^(.*)-\d+\.\d+$/.exec(n);return e?[e[0],e[1]]:[n,null]}).reduce(function(n,e){var r=e[1];return n[r]=n[r]||[],n[r].push(e[0]),n},{}),yrs=Object.keys(nSt).map(function(e){return[e,nSt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});nSt=void 0;var wFn=[["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(yrs).sort(xFn),Zrs=0,Nrs=1,EFn=function(n){for(var e=0;e<FFn.length;e++){var r=FFn[e](n).trim();if(r!==n&&X_e(r))return r}return null},RFn=function(n){for(var e=n.toUpperCase(),r=0;r<wFn.length;r++){var a=wFn[r];if(e.indexOf(a[Zrs])>-1)return a[Nrs]}return null},AFn=function(n,e){for(var r=0;r<WFn.length;r++){var a=WFn[r],i=a[Grs];if(n.indexOf(i)>-1){var o=n.replace(i,a[vrs]),t=e(o);if(t!==null)return t}}return null};CFn.exports=function(n,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function a(s){return r?Wrs(s):s}var i=typeof n=="string"&&n.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(n=n.trim(),X_e(n))return a(n);var o=n.replace(/\+$/,"").trim();if(X_e(o))return a(o);var t=EFn(n);return t!==null||(t=AFn(n,function(s){return X_e(s)?s:EFn(s)}),t!==null)||(t=RFn(n),t!==null)||(t=AFn(n,RFn),t!==null)?a(t):null};function Wrs(n){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(n)!==-1?n+"-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(n)!==-1?n.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(n)!==-1?n+"-or-later":n}});var QFn=ve((aPo,HFn)=>{var Frs=rSt(),wrs=YFn(),VFn='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',Ers=/^SEE LICEN[CS]E IN (.+)$/;function kFn(n,e){return e.slice(0,n.length)===n}function aSt(n){if(n.hasOwnProperty("license")){var e=n.license;return kFn("LicenseRef",e)||kFn("DocumentRef",e)}else return aSt(n.left)||aSt(n.right)}HFn.exports=function(n){var e;try{e=Frs(n)}catch{var r;if(n==="UNLICENSED"||n==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=Ers.exec(n))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var a={validForOldPackages:!1,validForNewPackages:!1,warnings:[VFn]};if(n.trim().length!==0){var i=wrs(n);i&&a.warnings.push('license is similar to the valid expression "'+i+'"')}return a}return aSt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[VFn]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var JFn=ve(L_e=>{"use strict";Object.defineProperty(L_e,"__esModule",{value:!0});L_e.LRUCache=void 0;var xae=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,SFn=new Set,iSt=typeof process=="object"&&process?process:{},LFn=(n,e,r,a)=>{typeof iSt.emitWarning=="function"?iSt.emitWarning(n,e,r,a):console.error(`[${r}] ${e}: ${n}`)},S_e=globalThis.AbortController,XFn=globalThis.AbortSignal;if(typeof S_e>"u"){XFn=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(a,i){this._onabort.push(i)}},S_e=class{constructor(){e()}signal=new XFn;abort(a){if(!this.signal.aborted){this.signal.reason=a,this.signal.aborted=!0;for(let i of this.signal._onabort)i(a);this.signal.onabort?.(a)}}};let n=iSt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,LFn("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 Rrs=n=>!SFn.has(n),oPo=Symbol("type"),VS=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),TFn=n=>VS(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Cae:null:null,Cae=class extends Array{constructor(e){super(e),this.fill(0)}},sSt=class n{heap;length;static#e=!1;static create(e){let r=TFn(e);if(!r)return[];n.#e=!0;let a=new n(e,r);return n.#e=!1,a}constructor(e,r){if(!n.#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]}},oSt=class n{#e;#t;#r;#n;#i;#a;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#o;#s;#I;#d;#h;#l;#p;#f;#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.#f},free:e.#g,isBackgroundFetch:r=>e.#Z(r),backgroundFetch:(r,a,i,o)=>e.#C(r,a,i,o),moveToTail:r=>e.#O(r),indexes:r=>e.#L(r),rindexes:r=>e.#V(r),isStale:r=>e.#A(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.#a}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:a,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:t,updateAgeOnHas:s,allowStale:d,dispose:I,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:p=0,sizeCalculation:G,fetchMethod:N,memoMethod:v,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:f,ignoreFetchAbort:Z}=e;if(r!==0&&!VS(r))throw new TypeError("max option must be a nonnegative integer");let W=r?TFn(r):Array;if(!W)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=p||this.#t,this.sizeCalculation=G,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(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#a=v,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.#f=0,this.#g=sSt.create(r),this.#c=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof u=="function"?(this.#n=u,this.#m=[]):(this.#n=void 0,this.#m=void 0),this.#F=!!this.#r,this.#G=!!this.#n,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!f,this.ignoreFetchAbort=!!Z,this.maxEntrySize!==0){if(this.#t!==0&&!VS(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!VS(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#x()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!s,this.ttlResolution=VS(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=a||0,this.ttl){if(!VS(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";Rrs(R)&&(SFn.add(R),LFn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",R,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#w(){let e=new Cae(this.#e),r=new Cae(this.#e);this.#W=e,this.#y=r,this.#H=(o,t,s=xae.now())=>{if(r[o]=t!==0?s:0,e[o]=t,t!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#A(o)&&this.#X(this.#I[o],"expire")},t+1);d.unref&&d.unref()}},this.#R=o=>{r[o]=e[o]!==0?xae.now():0},this.#u=(o,t)=>{if(e[t]){let s=e[t],d=r[t];if(!s||!d)return;o.ttl=s,o.start=d,o.now=a||i();let I=o.now-d;o.remainingTTL=s-I}};let a=0,i=()=>{let o=xae.now();if(this.ttlResolution>0){a=o;let t=setTimeout(()=>a=0,this.ttlResolution);t.unref&&t.unref()}return o};this.getRemainingTTL=o=>{let t=this.#s.get(o);if(t===void 0)return 0;let s=e[t],d=r[t];if(!s||!d)return 1/0;let I=(a||i())-d;return s-I},this.#A=o=>{let t=r[o],s=e[o];return!!s&&!!t&&(a||i())-t>s}}#R=()=>{};#u=()=>{};#H=()=>{};#A=()=>!1;#x(){let e=new Cae(this.#e);this.#o=0,this.#N=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#E=(r,a,i,o)=>{if(this.#Z(a))return 0;if(!VS(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(a,r),!VS(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,a,i)=>{if(e[r]=a,this.#t){let o=this.#t-e[r];for(;this.#o>o;)this.#T(!0)}this.#o+=e[r],i&&(i.entrySize=a,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,a)=>{};#E=(e,r,a,i)=>{if(a||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.#f;!(!this.#Q(r)||((e||!this.#A(r))&&(yield r),r===this.#p));)r=this.#l[r]}*#V({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#p;!(!this.#Q(r)||((e||!this.#A(r))&&(yield r),r===this.#f));)r=this.#h[r]}#Q(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 a of this.#L()){let i=this.#d[a],o=this.#Z(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#I[a],this))return this.get(this.#I[a],r)}}forEach(e,r=this){for(let a of this.#L()){let i=this.#d[a],o=this.#Z(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[a],this)}}rforEach(e,r=this){for(let a of this.#V()){let i=this.#d[a],o=this.#Z(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[a],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#A(r)&&(this.#X(this.#I[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let a=this.#d[r],i=this.#Z(a)?a.__staleWhileFetching:a;if(i===void 0)return;let o={value:i};if(this.#W&&this.#y){let t=this.#W[r],s=this.#y[r];if(t&&s){let d=t-(xae.now()-s);o.ttl=d,o.start=Date.now()}}return this.#N&&(o.size=this.#N[r]),o}dump(){let e=[];for(let r of this.#L({allowStale:!0})){let a=this.#I[r],i=this.#d[r],o=this.#Z(i)?i.__staleWhileFetching:i;if(o===void 0||a===void 0)continue;let t={value:o};if(this.#W&&this.#y){t.ttl=this.#W[r];let s=xae.now()-this.#y[r];t.start=Math.floor(Date.now()-s)}this.#N&&(t.size=this.#N[r]),e.unshift([a,t])}return e}load(e){this.clear();for(let[r,a]of e){if(a.start){let i=Date.now()-a.start;a.start=xae.now()-i}this.set(r,a.value,a)}}set(e,r,a={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:o,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:d}=a,{noUpdateTTL:I=this.noUpdateTTL}=a,u=this.#E(e,r,a.size||0,s);if(this.maxEntrySize&&u>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#X(e,"set"),this;let h=this.#c===0?void 0:this.#s.get(e);if(h===void 0)h=this.#c===0?this.#f:this.#g.length!==0?this.#g.pop():this.#c===this.#e?this.#T(!1):this.#c,this.#I[h]=e,this.#d[h]=r,this.#s.set(e,h),this.#h[this.#f]=h,this.#l[h]=this.#f,this.#f=h,this.#c++,this.#S(h,u,d),d&&(d.set="add"),I=!1;else{this.#O(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,o),d&&this.#u(d,h)),!t&&this.#G&&this.#m){let c=this.#m,m;for(;m=c?.shift();)this.#n?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#p];if(this.#T(!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.#n?.(...r)}}}#T(e){let r=this.#p,a=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,a,"evict"),this.#G&&this.#m?.push([i,a,"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.#f=0,this.#g.length=0):this.#p=this.#h[r],this.#s.delete(a),this.#c--,r}has(e,r={}){let{updateAgeOnHas:a=this.updateAgeOnHas,status:i}=r,o=this.#s.get(e);if(o!==void 0){let t=this.#d[o];if(this.#Z(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#A(o))i&&(i.has="stale",this.#u(i,o));else return a&&this.#R(o),i&&(i.has="hit",this.#u(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:a=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!a&&this.#A(i))return;let o=this.#d[i];return this.#Z(o)?o.__staleWhileFetching:o}#C(e,r,a,i){let o=r===void 0?void 0:this.#d[r];if(this.#Z(o))return o;let t=new S_e,{signal:s}=a;s?.addEventListener("abort",()=>t.abort(s.reason),{signal:t.signal});let d={signal:t.signal,options:a,context:i},I=(G,N=!1)=>{let{aborted:v}=t.signal,A=a.ignoreFetchAbort&&G!==void 0;if(a.status&&(v&&!N?(a.status.fetchAborted=!0,a.status.fetchError=t.signal.reason,A&&(a.status.fetchAbortIgnored=!0)):a.status.fetchResolved=!0),v&&!A&&!N)return h(t.signal.reason);let F=m;return this.#d[r]===m&&(G===void 0?F.__staleWhileFetching?this.#d[r]=F.__staleWhileFetching:this.#X(e,"fetch"):(a.status&&(a.status.fetchUpdated=!0),this.set(e,G,d.options))),G},u=G=>(a.status&&(a.status.fetchRejected=!0,a.status.fetchError=G),h(G)),h=G=>{let{aborted:N}=t.signal,v=N&&a.allowStaleOnFetchAbort,A=v||a.allowStaleOnFetchRejection,F=A||a.noDeleteOnFetchRejection,E=m;if(this.#d[r]===m&&(!F||E.__staleWhileFetching===void 0?this.#X(e,"fetch"):v||(this.#d[r]=E.__staleWhileFetching)),A)return a.status&&E.__staleWhileFetching!==void 0&&(a.status.returnedStale=!0),E.__staleWhileFetching;if(E.__returned===E)throw G},c=(G,N)=>{let v=this.#i?.(e,o,d);v&&v instanceof Promise&&v.then(A=>G(A===void 0?void 0:A),N),t.signal.addEventListener("abort",()=>{(!a.ignoreFetchAbort||a.allowStaleOnFetchAbort)&&(G(void 0),a.allowStaleOnFetchAbort&&(G=A=>I(A,!0)))})};a.status&&(a.status.fetchDispatched=!0);let m=new Promise(c).then(I,u),p=Object.assign(m,{__abortController:t,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,p,{...d.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=p,p}#Z(e){if(!this.#v)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof S_e}async fetch(e,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:s=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:p=this.allowStaleOnFetchAbort,context:G,forceRefresh:N=!1,status:v,signal:A}=r;if(!this.#v)return v&&(v.fetch="get"),this.get(e,{allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:v});let F={allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:t,noDisposeOnSet:s,size:d,sizeCalculation:I,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:p,ignoreFetchAbort:m,status:v,signal:A},E=this.#s.get(e);if(E===void 0){v&&(v.fetch="miss");let f=this.#C(e,E,F,G);return f.__returned=f}else{let f=this.#d[E];if(this.#Z(f)){let g=a&&f.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",g&&(v.returnedStale=!0)),g?f.__staleWhileFetching:f.__returned=f}let Z=this.#A(E);if(!N&&!Z)return v&&(v.fetch="hit"),this.#O(E),i&&this.#R(E),v&&this.#u(v,E),f;let W=this.#C(e,E,F,G),b=W.__staleWhileFetching!==void 0&&a;return v&&(v.fetch=Z?"stale":"refresh",b&&Z&&(v.returnedStale=!0)),b?W.__staleWhileFetching:W.__returned=W}}async forceFetch(e,r={}){let a=await this.fetch(e,r);if(a===void 0)throw new Error("fetch() returned undefined");return a}memo(e,r={}){let a=this.#a;if(!a)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:o,...t}=r,s=this.get(e,t);if(!o&&s!==void 0)return s;let d=a(e,s,{options:t,context:i});return this.set(e,d,t),d}get(e,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:t}=r,s=this.#s.get(e);if(s!==void 0){let d=this.#d[s],I=this.#Z(d);return t&&this.#u(t,s),this.#A(s)?(t&&(t.get="stale"),I?(t&&a&&d.__staleWhileFetching!==void 0&&(t.returnedStale=!0),a?d.__staleWhileFetching:void 0):(o||this.#X(e,"expire"),t&&a&&(t.returnedStale=!0),a?d:void 0)):(t&&(t.get="hit"),I?d.__staleWhileFetching:(this.#O(s),i&&this.#R(s),d))}else t&&(t.get="miss")}#B(e,r){this.#l[r]=e,this.#h[e]=r}#O(e){e!==this.#f&&(e===this.#p?this.#p=this.#h[e]:this.#B(this.#l[e],this.#h[e]),this.#B(this.#f,e),this.#f=e)}delete(e){return this.#X(e,"delete")}#X(e,r){let a=!1;if(this.#c!==0){let i=this.#s.get(e);if(i!==void 0)if(a=!0,this.#c===1)this.#b(r);else{this.#Y(i);let o=this.#d[i];if(this.#Z(o)?o.__abortController.abort(new Error("deleted")):(this.#F||this.#G)&&(this.#F&&this.#r?.(o,e,r),this.#G&&this.#m?.push([o,e,r])),this.#s.delete(e),this.#I[i]=void 0,this.#d[i]=void 0,i===this.#f)this.#f=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 s=this.#h[i];this.#l[s]=this.#l[i]}this.#c--,this.#g.push(i)}}if(this.#G&&this.#m?.length){let i=this.#m,o;for(;o=i?.shift();)this.#n?.(...o)}return a}clear(){return this.#b("delete")}#b(e){for(let r of this.#V({allowStale:!0})){let a=this.#d[r];if(this.#Z(a))a.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#F&&this.#r?.(a,i,e),this.#G&&this.#m?.push([a,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.#f=0,this.#g.length=0,this.#o=0,this.#c=0,this.#G&&this.#m){let r=this.#m,a;for(;a=r?.shift();)this.#n?.(...a)}}};L_e.LRUCache=oSt});var DFn=ve((cPo,OFn)=>{"use strict";var tc=(...n)=>n.every(e=>e)?n.join(""):"",i0=n=>n?encodeURIComponent(n):"",BFn=n=>n.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),Ars={sshtemplate:({domain:n,user:e,project:r,committish:a})=>`git@${n}:${e}/${r}.git${tc("#",a)}`,sshurltemplate:({domain:n,user:e,project:r,committish:a})=>`git+ssh://git@${n}/${e}/${r}.git${tc("#",a)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i,path:o})=>`https://${n}/${e}/${r}${tc("/",i,"/",i0(a||"HEAD"),"/",o)}`,browsetemplate:({domain:n,user:e,project:r,committish:a,treepath:i})=>`https://${n}/${e}/${r}${tc("/",i,"/",i0(a))}`,browsetreetemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:o,fragment:t,hashformat:s})=>`https://${n}/${e}/${r}/${i}/${i0(a||"HEAD")}/${o}${tc("#",s(t||""))}`,browseblobtemplate:({domain:n,user:e,project:r,committish:a,blobpath:i,path:o,fragment:t,hashformat:s})=>`https://${n}/${e}/${r}/${i}/${i0(a||"HEAD")}/${o}${tc("#",s(t||""))}`,docstemplate:({domain:n,user:e,project:r,treepath:a,committish:i})=>`https://${n}/${e}/${r}${tc("/",a,"/",i0(i))}#readme`,httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${tc(n,"@")}${e}/${r}/${a}.git${tc("#",i)}`,filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/raw/${i0(a||"HEAD")}/${i}`,shortcuttemplate:({type:n,user:e,project:r,committish:a})=>`${n}:${e}/${r}${tc("#",a)}`,pathtemplate:({user:n,project:e,committish:r})=>`${n}/${e}${tc("#",r)}`,bugstemplate:({domain:n,user:e,project:r})=>`https://${n}/${e}/${r}/issues`,hashformat:BFn},kS={};kS.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:e,project:r,committish:a,path:i})=>`https://${tc(n,"@")}raw.githubusercontent.com/${e}/${r}/${i0(a||"HEAD")}/${i}`,gittemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git://${tc(n,"@")}${e}/${r}/${a}.git${tc("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://codeload.${n}/${e}/${r}/tar.gz/${i0(a||"HEAD")}`,extract:n=>{let[,e,r,a,i]=n.pathname.split("/",5);if(!(a&&a!=="tree")&&(a||(i=n.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};kS.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:o,editpath:t})=>`https://${n}/${e}/${r}${tc("/",i,"/",i0(a||"HEAD"),"/",o,t)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/get/${i0(a||"HEAD")}.tar.gz`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["get"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};kS.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${tc(n,"@")}${e}/${r}/${a}.git${tc("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/repository/archive.tar.gz?ref=${i0(a||"HEAD")}`,extract:n=>{let e=n.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),a=r.pop();a.endsWith(".git")&&(a=a.slice(0,-4));let i=r.join("/");if(!(!i||!a))return{user:i,project:a,committish:n.hash.slice(1)}}};kS.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:n,project:e,committish:r})=>`git@${n}:${e}.git${tc("#",r)}`,sshurltemplate:({domain:n,project:e,committish:r})=>`git+ssh://git@${n}/${e}.git${tc("#",r)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i})=>`https://${n}/${e}/${r}${tc("/",i0(a))}/${i}`,browsetemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${tc("/",i0(r))}`,browsetreetemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${tc("/",i0(r))}${tc("#",i(a))}`,browseblobtemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${tc("/",i0(r))}${tc("#",i(a))}`,docstemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${tc("/",i0(r))}`,httpstemplate:({domain:n,project:e,committish:r})=>`git+https://${n}/${e}.git${tc("#",r)}`,filetemplate:({user:n,project:e,committish:r,path:a})=>`https://gist.githubusercontent.com/${n}/${e}/raw${tc("/",i0(r))}/${a}`,shortcuttemplate:({type:n,project:e,committish:r})=>`${n}:${e}${tc("#",r)}`,pathtemplate:({project:n,committish:e})=>`${n}${tc("#",e)}`,bugstemplate:({domain:n,project:e})=>`https://${n}/${e}`,gittemplate:({domain:n,project:e,committish:r})=>`git://${n}/${e}.git${tc("#",r)}`,tarballtemplate:({project:n,committish:e})=>`https://codeload.github.com/gist/${n}/tar.gz/${i0(e||"HEAD")}`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(a!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:n.hash.slice(1)}}},hashformat:function(n){return n&&"file-"+BFn(n)}};kS.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/blob/${i0(a)||"HEAD"}/${i}`,httpstemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}.git${tc("#",a)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/archive/${i0(a)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["archive"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};for(let[n,e]of Object.entries(kS))kS[n]=Object.assign({},Ars,e);OFn.exports=kS});var cSt=ve((uPo,MFn)=>{var xrs=Nt("url"),lSt=(n,e,r)=>{let a=n.indexOf(r);return n.lastIndexOf(e,a>-1?a:1/0)},_Fn=n=>{try{return new xrs.URL(n)}catch{}},Crs=(n,e)=>{let r=n.indexOf(":"),a=n.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,a))return n;let i=n.indexOf("@");return i>-1?i>r?`git+ssh://${n}`:n:n.indexOf("//")===r+1?n:`${n.slice(0,r+1)}//${n.slice(r+1)}`},Yrs=n=>{let e=lSt(n,"@","#"),r=lSt(n,":","#");return r>e&&(n=n.slice(0,r)+"/"+n.slice(r+1)),lSt(n,":","#")===-1&&n.indexOf("//")===-1&&(n=`git+ssh://${n}`),n};MFn.exports=(n,e)=>{let r=e?Crs(n,e):n;return _Fn(r)||_Fn(Yrs(r))}});var zFn=ve((dPo,UFn)=>{"use strict";var Vrs=cSt(),krs=n=>{let e=n.indexOf("#"),r=n.indexOf("/"),a=n.indexOf("/",r+1),i=n.indexOf(":"),o=/\s/.exec(n),t=n.indexOf("@"),s=!o||e>-1&&o.index>e,d=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,u=a===-1||e>-1&&a>e,h=r>0,c=e>-1?n[e-1]!=="/":!n.endsWith("/"),m=!n.startsWith(".");return s&&h&&c&&m&&d&&I&&u};UFn.exports=(n,e,{gitHosts:r,protocols:a})=>{if(!n)return;let i=krs(n)?`github:${n}`:n,o=Vrs(i,a);if(!o)return;let t=r.byShortcut[o.protocol],s=r.byDomain[o.hostname.startsWith("www.")?o.hostname.slice(4):o.hostname],d=t||s;if(!d)return;let I=r[t||s],u=null;a[o.protocol]?.auth&&(o.username||o.password)&&(u=`${o.username}${o.password?":"+o.password:""}`);let h=null,c=null,m=null,p=null;try{if(t){let G=o.pathname.startsWith("/")?o.pathname.slice(1):o.pathname,N=G.indexOf("@");N>-1&&(G=G.slice(N+1));let v=G.lastIndexOf("/");v>-1?(c=decodeURIComponent(G.slice(0,v)),c||(c=null),m=decodeURIComponent(G.slice(v+1))):m=decodeURIComponent(G),m.endsWith(".git")&&(m=m.slice(0,-4)),o.hash&&(h=decodeURIComponent(o.hash.slice(1))),p="shortcut"}else{if(!I.protocols.includes(o.protocol))return;let G=I.extract(o);if(!G)return;c=G.user&&decodeURIComponent(G.user),m=decodeURIComponent(G.project),h=decodeURIComponent(G.committish),p=a[o.protocol]?.name||o.protocol.slice(0,-1)}}catch(G){if(G instanceof URIError)return;throw G}return[d,c,u,m,h,p,e]}});var jFn=ve((IPo,PFn)=>{"use strict";var{LRUCache:Hrs}=JFn(),Qrs=DFn(),Xrs=zFn(),Srs=cSt(),uSt=new Hrs({max:1e3}),T_e=class n{constructor(e,r,a,i,o,t,s={}){Object.assign(this,n.#e[e],{type:e,user:r,auth:a,project:i,committish:o,default:t,opts:s})}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){n.#e[e]=r,n.#e.byDomain[r.domain]=e,n.#e.byShortcut[`${e}:`]=e,n.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let a=e+JSON.stringify(r||{});if(!uSt.has(a)){let i=Xrs(e,r,{gitHosts:n.#e,protocols:n.#t});uSt.set(a,i?new n(...i):void 0)}return uSt.get(a)}static parseUrl(e){return Srs(e)}#r(e,r){if(typeof e!="function")return null;let a={...this,...this.opts,...r};a.path||(a.path=""),a.path.startsWith("/")&&(a.path=a.path.slice(1)),a.noCommittish&&(a.committish=null);let i=e(a);return a.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[n,e]of Object.entries(Qrs))T_e.addHost(n,e);PFn.exports=T_e});var KFn=ve((hPo,qFn)=>{qFn.exports=Lrs;function Lrs(n){if(!n||n==="ERROR: No README data found!")return;n=n.trim().split(`
|
|
7008
|
-
`);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var $Fn=ve((mPo,Trs)=>{Trs.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 nwn=ve((pPo,rwn)=>{var Jrs=$6t(),Brs=eSt(),Ors=QFn(),J_e=jFn(),Drs=Nt("node:module"),_rs=["dependencies","devDependencies","optionalDependencies"],Mrs=KFn(),dSt=Nt("url"),HS=$Fn(),ewn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");rwn.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=J_e.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(HS.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,HS.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):HS.script[e]&&!n.scripts[HS.script[e]]&&this.warn("typo",e,HS.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){ens(n,this.warn),Krs(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=J_e.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!Jrs(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=Brs(n.version,r),!0},fixPeople:function(n){twn(n,jrs),twn(n,qrs)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),Prs(n.name,r,e.allowLegacyCase),Drs.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=Mrs(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=J_e.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")ewn(n.bugs)?n.bugs={email:n.bugs}:dSt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{tns(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&dSt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&ewn(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=J_e.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;dSt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Ors(e).validForNewPackages)return this.warn("invalidLicense")}};function Urs(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function zrs(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function Prs(n,e,r){if(n.charAt(0)==="."||!(Urs(n)||zrs(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function twn(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function jrs(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,o=i?" <"+i+">":"";return e+o+a}function qrs(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function Krs(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function $rs(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),a[o]=t}),a}function ens(n,e){_rs.forEach(function(r){n[r]&&(n[r]=$rs(n[r],r,e))})}function tns(n,e){n&&Object.keys(n).forEach(function(r){HS.bugs[r]&&(e("typo",r,HS.bugs[r],"bugs"),n[HS.bugs[r]]=n[r],delete n[r])})}});var awn=ve((fPo,rns)=>{rns.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 own=ve((bPo,swn)=>{var iwn=Nt("util"),ISt=awn();swn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return nns.apply(null,n);var r=ISt[e]?ISt[e]:e+": '%s'";return n.unshift(r),iwn.format.apply(null,n)};function nns(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),iwn.format(ISt.typo,n,e)}});var dwn=ve((gPo,uwn)=>{uwn.exports=lwn;var hSt=nwn();lwn.fixer=hSt;var ans=own(),ins=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],sns=["dependencies","people","typos"],mSt=ins.map(function(n){return cwn(n)+"Field"});mSt=mSt.concat(sns);function lwn(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),hSt.warn=function(){e(ans.apply(null,arguments))},mSt.forEach(function(a){hSt["fix"+cwn(a)](n,r)}),n._id=n.name+"@"+n.version}function cwn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Iwn=Je(()=>{});import{fileURLToPath as ons}from"node:url";function hwn(n){return n instanceof URL?ons(n):n}var mwn=Je(()=>{Iwn()});import lns from"node:fs/promises";import cns from"node:path";async function fwn({cwd:n,normalize:e=!0}={}){let r=await lns.readFile(uns(n),"utf8");return dns(r,e)}var pwn,uns,dns,bwn=Je(()=>{nFn();pwn=Yt(dwn(),1);mwn();uns=n=>cns.resolve(hwn(n)??".","package.json"),dns=(n,e)=>{let r=typeof n=="string"?U6t(n):n;return e&&(0,pwn.default)(r),r}});import Ins from"node:path";async function gwn(n){let e=await AWn("package.json",n);if(e)return{packageJson:await fwn({...n,cwd:Ins.dirname(e)}),path:e}}var Gwn=Je(()=>{xWn();bwn()});import{fileURLToPath as hns}from"url";import mns from"path";async function Vae(){if(Yae)return Yae;let n=await gwn({cwd:fns});if(!n){let e="easycode-cli",r="1.1.55";return e&&r?(Yae={name:e,version:r},Yae):void 0}return Yae=n.packageJson,Yae}var pns,fns,Yae,B_e=Je(()=>{"use strict";Gwn();pns=hns(import.meta.url),fns=mns.dirname(pns)});var vwn={};As(vwn,{getCliVersion:()=>FR});async function FR(){let n=await Vae();return"1.1.55"}var f_=Je(()=>{"use strict";B_e();});import b_ from"node:process";var ywn,Zwn=Je(()=>{"use strict";f_();di();Xs();un();ywn={name:"about",description:We("command.about.description"),kind:"built-in",action:async n=>{let e=b_.platform,r="no sandbox";b_.env.SANDBOX&&b_.env.SANDBOX!=="sandbox-exec"?r=b_.env.SANDBOX:b_.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${b_.env.SEATBELT_PROFILE||"unknown"})`);let a=n.services.config?.getModel()||"Unknown",i=await FR(),o=n.services.settings.merged.selectedAuthType||"",t=b_.env.GOOGLE_CLOUD_PROJECT||"",s={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:a,selectedAuthType:o,gcpProject:t};n.ui.addItem(s,Date.now())}}});var Nwn,Wwn=Je(()=>{"use strict";di();un();Nwn={name:"auth",description:We("command.auth.description"),kind:"built-in",action:(n,e)=>({type:"dialog",dialog:"auth"})}});var Fwn,wwn=Je(()=>{"use strict";di();un();Fwn={name:"clear",description:We("command.clear.description"),kind:"built-in",action:async(n,e)=>{n.ui.setDebugMessage("Clearing terminal screen."),n.ui.clear()}}});var Ewn,Rwn=Je(()=>{"use strict";Xs();di();un();Ewn={name:"compress",altNames:["summarize","compact"],description:We("command.compress.description"),kind:"built-in",action:async n=>{let{ui:e}=n,r=n.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 a={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(a);let i=`compress-${Date.now()}`,o=await r?.tryCompressChat(i,new AbortController().signal,!0);o?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:o.originalTokenCount,newTokenCount:o.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 bns(n){let{config:e,settings:r}=n.services;if(!e||!r)return{type:"message",messageType:"error",content:We("error.config.not.loaded")};let a=r.merged.vimMode||!1,i=e.getAgentStyle(),o=e.getApprovalMode(),t=e.getHealthyUseEnabled(),s=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")}
|
|
7008
|
+
`);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var $Fn=ve((mPo,Trs)=>{Trs.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 nwn=ve((pPo,rwn)=>{var Jrs=$6t(),Brs=eSt(),Ors=QFn(),J_e=jFn(),Drs=Nt("node:module"),_rs=["dependencies","devDependencies","optionalDependencies"],Mrs=KFn(),dSt=Nt("url"),HS=$Fn(),ewn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");rwn.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=J_e.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(HS.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,HS.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):HS.script[e]&&!n.scripts[HS.script[e]]&&this.warn("typo",e,HS.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){ens(n,this.warn),Krs(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=J_e.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!Jrs(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=Brs(n.version,r),!0},fixPeople:function(n){twn(n,jrs),twn(n,qrs)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),Prs(n.name,r,e.allowLegacyCase),Drs.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=Mrs(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=J_e.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")ewn(n.bugs)?n.bugs={email:n.bugs}:dSt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{tns(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&dSt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&ewn(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=J_e.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;dSt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Ors(e).validForNewPackages)return this.warn("invalidLicense")}};function Urs(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function zrs(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function Prs(n,e,r){if(n.charAt(0)==="."||!(Urs(n)||zrs(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function twn(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function jrs(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,o=i?" <"+i+">":"";return e+o+a}function qrs(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function Krs(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function $rs(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),a[o]=t}),a}function ens(n,e){_rs.forEach(function(r){n[r]&&(n[r]=$rs(n[r],r,e))})}function tns(n,e){n&&Object.keys(n).forEach(function(r){HS.bugs[r]&&(e("typo",r,HS.bugs[r],"bugs"),n[HS.bugs[r]]=n[r],delete n[r])})}});var awn=ve((fPo,rns)=>{rns.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 own=ve((bPo,swn)=>{var iwn=Nt("util"),ISt=awn();swn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return nns.apply(null,n);var r=ISt[e]?ISt[e]:e+": '%s'";return n.unshift(r),iwn.format.apply(null,n)};function nns(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),iwn.format(ISt.typo,n,e)}});var dwn=ve((gPo,uwn)=>{uwn.exports=lwn;var hSt=nwn();lwn.fixer=hSt;var ans=own(),ins=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],sns=["dependencies","people","typos"],mSt=ins.map(function(n){return cwn(n)+"Field"});mSt=mSt.concat(sns);function lwn(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),hSt.warn=function(){e(ans.apply(null,arguments))},mSt.forEach(function(a){hSt["fix"+cwn(a)](n,r)}),n._id=n.name+"@"+n.version}function cwn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Iwn=Je(()=>{});import{fileURLToPath as ons}from"node:url";function hwn(n){return n instanceof URL?ons(n):n}var mwn=Je(()=>{Iwn()});import lns from"node:fs/promises";import cns from"node:path";async function fwn({cwd:n,normalize:e=!0}={}){let r=await lns.readFile(uns(n),"utf8");return dns(r,e)}var pwn,uns,dns,bwn=Je(()=>{nFn();pwn=Yt(dwn(),1);mwn();uns=n=>cns.resolve(hwn(n)??".","package.json"),dns=(n,e)=>{let r=typeof n=="string"?U6t(n):n;return e&&(0,pwn.default)(r),r}});import Ins from"node:path";async function gwn(n){let e=await AWn("package.json",n);if(e)return{packageJson:await fwn({...n,cwd:Ins.dirname(e)}),path:e}}var Gwn=Je(()=>{xWn();bwn()});import{fileURLToPath as hns}from"url";import mns from"path";async function Vae(){if(Yae)return Yae;let n=await gwn({cwd:fns});if(!n){let e="easycode-cli",r="1.1.56";return e&&r?(Yae={name:e,version:r},Yae):void 0}return Yae=n.packageJson,Yae}var pns,fns,Yae,B_e=Je(()=>{"use strict";Gwn();pns=hns(import.meta.url),fns=mns.dirname(pns)});var vwn={};As(vwn,{getCliVersion:()=>FR});async function FR(){let n=await Vae();return"1.1.56"}var f_=Je(()=>{"use strict";B_e();});import b_ from"node:process";var ywn,Zwn=Je(()=>{"use strict";f_();di();Xs();un();ywn={name:"about",description:We("command.about.description"),kind:"built-in",action:async n=>{let e=b_.platform,r="no sandbox";b_.env.SANDBOX&&b_.env.SANDBOX!=="sandbox-exec"?r=b_.env.SANDBOX:b_.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${b_.env.SEATBELT_PROFILE||"unknown"})`);let a=n.services.config?.getModel()||"Unknown",i=await FR(),o=n.services.settings.merged.selectedAuthType||"",t=b_.env.GOOGLE_CLOUD_PROJECT||"",s={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:a,selectedAuthType:o,gcpProject:t};n.ui.addItem(s,Date.now())}}});var Nwn,Wwn=Je(()=>{"use strict";di();un();Nwn={name:"auth",description:We("command.auth.description"),kind:"built-in",action:(n,e)=>({type:"dialog",dialog:"auth"})}});var Fwn,wwn=Je(()=>{"use strict";di();un();Fwn={name:"clear",description:We("command.clear.description"),kind:"built-in",action:async(n,e)=>{n.ui.setDebugMessage("Clearing terminal screen."),n.ui.clear()}}});var Ewn,Rwn=Je(()=>{"use strict";Xs();di();un();Ewn={name:"compress",altNames:["summarize","compact"],description:We("command.compress.description"),kind:"built-in",action:async n=>{let{ui:e}=n,r=n.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 a={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(a);let i=`compress-${Date.now()}`,o=await r?.tryCompressChat(i,new AbortController().signal,!0);o?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:o.originalTokenCount,newTokenCount:o.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 bns(n){let{config:e,settings:r}=n.services;if(!e||!r)return{type:"message",messageType:"error",content:We("error.config.not.loaded")};let a=r.merged.vimMode||!1,i=e.getAgentStyle(),o=e.getApprovalMode(),t=e.getHealthyUseEnabled(),s=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")}
|
|
7009
7009
|
|
|
7010
7010
|
${We("command.config.available.options")}:
|
|
7011
7011
|
|