easycode-ai 1.1.7 → 1.1.8
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 +5 -5
- package/package.json +1 -1
package/bundle/easycode.js
CHANGED
|
@@ -608,7 +608,7 @@ ${h}`)}return t}),hge=CYa(AJt);Cge=class extends Rge{create(e,r){var n;let{api_v
|
|
|
608
608
|
`):[]}};BD.NEWLINE_CHARS=new Set([`
|
|
609
609
|
`,"\r"]);BD.NEWLINE_REGEXP=/\r\n|[\n\r]/g;Yge={off:0,error:200,warn:300,info:400,debug:500},mJt=(a,e,r)=>{if(a){if(IYa(Yge,a))return a;Z2(r).warn(`${e} was set to ${JSON.stringify(a)}, expected one of ${JSON.stringify(Object.keys(Yge))}`)}};QYa={error:vre,warn:vre,info:vre,debug:vre},pJt=new WeakMap;LX=a=>(a.options&&(a.options=Object.assign({},a.options),delete a.options.headers),a.headers&&(a.headers=Object.fromEntries((a.headers instanceof Headers?[...a.headers]:Object.entries(a.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in a&&(a.retryOfRequestLogID&&(a.retryOf=a.retryOfRequestLogID),delete a.retryOfRequestLogID),a);GOe=class a{constructor(e,r,n){this.iterator=e,this.controller=r,this.client=n}static fromSSEResponse(e,r,n){let i=!1,o=n?Z2(n):console;function t(){return XD(this,arguments,function*(){var u,I,d,h;if(i)throw new zg("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,G=BX(HYa(e,r)),y;y=yield _u(G.next()),u=y.done,!u;m=!0){h=y.value,m=!1;let N=h;if(!c)if(N.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield _u(JSON.parse(N.data))}catch(Z){throw o.error("Could not parse message into JSON:",N.data),o.error("From chunk:",N.raw),Z}}}catch(N){I={error:N}}finally{try{!m&&!u&&(d=G.return)&&(yield _u(d.call(G)))}finally{if(I)throw I.error}}c=!0}catch(N){if(pOe(N))return yield _u(void 0);throw N}finally{c||r.abort()}})}return new a(t,r,n)}static fromReadableStream(e,r,n){let i=!1;function o(){return XD(this,arguments,function*(){var u,I,d,h;let c=new BD,m=GJt(e);try{for(var G=!0,y=BX(m),N;N=yield _u(y.next()),u=N.done,!u;G=!0){h=N.value,G=!1;let Z=h;for(let R of c.decode(Z))yield yield _u(R)}}catch(Z){I={error:Z}}finally{try{!G&&!u&&(d=y.return)&&(yield _u(d.call(y)))}finally{if(I)throw I.error}}for(let Z of c.flush())yield yield _u(Z)})}function t(){return XD(this,arguments,function*(){var u,I,d,h;if(i)throw new zg("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,G=BX(o()),y;y=yield _u(G.next()),u=y.done,!u;m=!0){h=y.value,m=!1;let N=h;c||N&&(yield yield _u(JSON.parse(N)))}}catch(N){I={error:N}}finally{try{!m&&!u&&(d=G.return)&&(yield _u(d.call(G)))}finally{if(I)throw I.error}}c=!0}catch(N){if(pOe(N))return yield _u(void 0);throw N}finally{c||r.abort()}})}return new a(t,r,n)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=o=>({next:()=>{if(o.length===0){let t=n.next();e.push(t),r.push(t)}return o.shift()}});return[new a(()=>i(e),this.controller,this.client),new a(()=>i(r),this.controller,this.client)]}toReadableStream(){let e=this,r;return gJt({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:o}=await r.next();if(o)return n.close();let t=ZOe(JSON.stringify(i)+`
|
|
610
610
|
`);n.enqueue(t)}catch(i){n.error(i)}},async cancel(){var n;await((n=r.return)===null||n===void 0?void 0:n.call(r))}})}};vOe=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(`
|
|
611
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=kYa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};yOe=class a extends Promise{constructor(e,r,n=SYa){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,this.client=e}_thenUnwrap(e){return new a(this.client,this.responsePromise,async(r,n)=>e(await this.parseResponse(r,n),n))}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)}};ZJt=Symbol("brand.privateNullableHeaders");Gre=a=>{let e=new Headers,r=new Set;for(let n of a){let i=new Set;for(let[o,t]of LYa(n)){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{[ZJt]:!0,values:e,nulls:r}};mOe=a=>{var e,r,n,i,o,t;if(typeof globalThis.process<"u")return(n=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[a])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n: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,a))===null||t===void 0?void 0:t.trim()};Vge=class a{constructor(e){var r,n,i,o,t,s,u,{baseURL:I=mOe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=mOe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=gge(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:d,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(n=m.timeout)!==null&&n!==void 0?n:a.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let G="warn";this.logLevel=G,this.logLevel=(t=(o=mJt(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:mJt(mOe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:G,this.fetchOptions=m.fetchOptions,this.maxRetries=(s=m.maxRetries)!==null&&s!==void 0?s:2,this.fetch=(u=m.fetch)!==null&&u!==void 0?u:vYa(),this.encoder=ZYa,this._options=m,this.apiKey=d,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=Gre([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return Gre([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Gre([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new zg(`Cannot stringify type ${typeof n}; 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 ${HD}`}defaultIdempotencyKey(){return`stainless-node-retry-${sYa()}`}makeStatusError(e,r,n,i){return Pg.generate(e,r,n,i)}buildURL(e,r,n){let i=!this.baseURLOverridden()&&n||this.baseURL,o=lYa(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return dYa(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:n}){}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,n){return this.request(Promise.resolve(n).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new yOe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){var i,o,t;let s=await e,u=(i=s.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(s);let{req:I,url:d,timeout:h}=await this.buildRequest(s,{retryCount:u-r});await this.prepareRequest(I,{url:d,options:s});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=n===void 0?"":`, retryOf: ${n}`,G=Date.now();if(Z2(this).debug(`[${c}] sending request`,LX({retryOfRequestLogID:n,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new yre;let y=new AbortController,N=await this.fetchWithTimeout(d,I,h,y).catch(fOe),Z=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 yre;let w=pOe(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(r)return Z2(this).info(`[${c}] connection ${w?"timed out":"failed"} - ${F}`),Z2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (${F})`,LX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),this.retryRequest(s,r,n??c);throw Z2(this).info(`[${c}] connection ${w?"timed out":"failed"} - error; no more retries left`),Z2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (error; no more retries left)`,LX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),w?new vge:new LD({cause:N})}let R=`[${c}${m}] ${I.method} ${d} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${Z-G}ms`;if(!N.ok){let F=await this.shouldRetry(N);if(r&&F){let f=`retrying, ${r} attempts remaining`;return await AYa(N.body),Z2(this).info(`${R} - ${f}`),Z2(this).debug(`[${c}] response error (${f})`,LX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),this.retryRequest(s,r,n??c,N.headers)}let w=F?"error; no more retries left":"error; not retryable";Z2(this).info(`${R} - ${w}`);let b=await N.text().catch(f=>fOe(f).message),v=mYa(b),A=v?void 0:b;throw Z2(this).debug(`[${c}] response error (${w})`,LX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,message:A,durationMs:Date.now()-G})),this.makeStatusError(N.status,v,A,N.headers)}return Z2(this).info(R),Z2(this).debug(`[${c}] response start`,LX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),{response:N,options:s,controller:y,requestLogID:c,retryOfRequestLogID:n,startTime:G}}async fetchWithTimeout(e,r,n,i){let o=r||{},{signal:t,method:s}=o,u=gge(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),n),d=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},d?{duplex:"half"}:{}),{method:"GET"}),u);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,n,i){var o;let t,s=i?.get("retry-after-ms");if(s){let I=parseFloat(s);Number.isNaN(I)||(t=I)}let u=i?.get("retry-after");if(u&&!t){let I=parseFloat(u);Number.isNaN(I)?t=Date.parse(u)-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 pYa(t),this.makeRequest(e,r-1,n)}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 n,i,o;let t=Object.assign({},e),{method:s,path:u,query:I,defaultBaseURL:d}=t,h=this.buildURL(u,I,d);"timeout"in t&&hYa("timeout",t.timeout),t.timeout=(n=t.timeout)!==null&&n!==void 0?n:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),G=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:G},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:n,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=Gre([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))}:{}),GYa()),this._options.defaultHeaders,n,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 n=Gre([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.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:yYa(e)}:this.encoder({body:e,headers:n})}};Vge.DEFAULT_TIMEOUT=6e4;X0=class extends Vge{constructor(){super(...arguments),this.interactions=new xge(this)}};NJt=X0;X0.GeminiNextGenAPIClient=NJt;X0.GeminiNextGenAPIClientError=zg;X0.APIError=Pg;X0.APIConnectionError=LD;X0.APIConnectionTimeoutError=vge;X0.APIUserAbortError=yre;X0.NotFoundError=Nge;X0.ConflictError=Wge;X0.RateLimitError=Ege;X0.BadRequestError=yge;X0.AuthenticationError=Age;X0.InternalServerError=wge;X0.PermissionDeniedError=Zge;X0.UnprocessableEntityError=Fge;X0.toFile=wYa;X0.Interactions=xge;bOi=1024*1024*8;});function BYa(a,e){return{...a,...e}}function WJt(a){let{prompt_id:e,...r}=a;return r}function JX(a){return Array.isArray(a)?a.map(WJt):a}var Qge=ct(()=>{"use strict";ci();});var FJt={};oo(FJt,{DEFAULT_PROXY_CONFIG:()=>DYa,getActiveProxyServerUrl:()=>DF,getAvailableProxyServers:()=>JYa,getProxyServerInfo:()=>TYa,getProxyServers:()=>Are,hasAvailableProxyServer:()=>NOe});function Are(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function DF(){let e=Are().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function JYa(){return Are().filter(e=>e.status==="active")}function NOe(){return Are().some(e=>e.status==="active")}function TYa(a){return Are().find(r=>r.url===a)}var DYa,JD=ct(()=>{"use strict";DYa={serverUrl:DF(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as OYa}from"crypto";function K1(){return Zre||(Zre=OYa()),Zre}function EJt(a){Zre=a}function wJt(){Zre=void 0}var Zre,RJt,Hge=ct(()=>{"use strict";RJt=K1()});function Nd(a){let e=a??"1.1.7"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${WOe}/VSCode/${i} (${r}; ${n})`}return`${WOe}/CLI/${e} (${r}; ${n})`}var WOe,fY=ct(()=>{"use strict";WOe="EasyCode"});import*as Eu from"fs";import*as LN from"path";import*as TX from"os";function MYa(a){yo.configure(a)}function UYa(a){yo.setUserInfo(a)}function _Ya(a){yo.setCliVersion(a)}async function zYa(){return await yo.getUserHeaders()}function PYa(){return yo.getStatus()}var Nre,Mo,yo,bY=ct(()=>{"use strict";JD();Hge();fY();Nre=259200,Mo=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Nd(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\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=LN.join(TX.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=LN.join(TX.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=LN.join(TX.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=LN.join(TX.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=LN.join(TX.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=LN.join(TX.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.7",this.config={proxyServerUrl:DF()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Nre*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${n} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return a.instance||(a.instance=new a),a.instance}loadUserInfo(){try{if(Eu.existsSync(this.userInfoFilePath)){let e=Eu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,o]=n.split("@");return i.length<=2?n:`${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=LN.dirname(this.userInfoFilePath);Eu.existsSync(e)||Eu.mkdirSync(e,{recursive:!0}),Eu.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),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(Eu.existsSync(this.jwtTokenFilePath)){let e=Eu.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=LN.dirname(this.jwtTokenFilePath);Eu.existsSync(e)||Eu.mkdirSync(e,{recursive:!0}),Eu.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),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(Eu.existsSync(this.usageStatsFilePath)){let e=Eu.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=LN.dirname(this.usageStatsFilePath);Eu.existsSync(e)||Eu.mkdirSync(e,{recursive:!0}),Eu.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),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 n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Nre*1e3),u=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${o}), next renewal: ${t}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Nre*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Nre){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Nre*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{Eu.existsSync(this.jwtTokenFilePath)&&Eu.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(),n=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":n,"User-Agent":i,"X-Session-ID":K1()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),n={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":K1()};return this.jwtTokenData?.accessToken&&(n.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),n}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{Eu.existsSync(this.userInfoFilePath)&&Eu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Eu.existsSync(this.jwtTokenFilePath)&&Eu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},yo=Mo.getInstance()});import{promises as DX}from"node:fs";import Wre from"node:path";import jYa from"os";var $1,Xge,ea,ev=ct(()=>{"use strict";(function(a){a[a.DEBUG=0]="DEBUG",a[a.INFO=1]="INFO",a[a.WARN=2]="WARN",a[a.ERROR=3]="ERROR"})($1||($1={}));Xge=class{config;logBuffer=[];constructor(e={}){if(this.config={level:$1.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=Wre.join(jYa.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...n){let i=new Date().toISOString(),o=n.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 DX.mkdir(Wre.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await DX.appendFile(this.config.filePath,e+`
|
|
611
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=kYa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};yOe=class a extends Promise{constructor(e,r,n=SYa){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,this.client=e}_thenUnwrap(e){return new a(this.client,this.responsePromise,async(r,n)=>e(await this.parseResponse(r,n),n))}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)}};ZJt=Symbol("brand.privateNullableHeaders");Gre=a=>{let e=new Headers,r=new Set;for(let n of a){let i=new Set;for(let[o,t]of LYa(n)){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{[ZJt]:!0,values:e,nulls:r}};mOe=a=>{var e,r,n,i,o,t;if(typeof globalThis.process<"u")return(n=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[a])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n: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,a))===null||t===void 0?void 0:t.trim()};Vge=class a{constructor(e){var r,n,i,o,t,s,u,{baseURL:I=mOe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=mOe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=gge(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:d,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(n=m.timeout)!==null&&n!==void 0?n:a.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let G="warn";this.logLevel=G,this.logLevel=(t=(o=mJt(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:mJt(mOe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:G,this.fetchOptions=m.fetchOptions,this.maxRetries=(s=m.maxRetries)!==null&&s!==void 0?s:2,this.fetch=(u=m.fetch)!==null&&u!==void 0?u:vYa(),this.encoder=ZYa,this._options=m,this.apiKey=d,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=Gre([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return Gre([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Gre([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new zg(`Cannot stringify type ${typeof n}; 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 ${HD}`}defaultIdempotencyKey(){return`stainless-node-retry-${sYa()}`}makeStatusError(e,r,n,i){return Pg.generate(e,r,n,i)}buildURL(e,r,n){let i=!this.baseURLOverridden()&&n||this.baseURL,o=lYa(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return dYa(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:n}){}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,n){return this.request(Promise.resolve(n).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new yOe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){var i,o,t;let s=await e,u=(i=s.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(s);let{req:I,url:d,timeout:h}=await this.buildRequest(s,{retryCount:u-r});await this.prepareRequest(I,{url:d,options:s});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=n===void 0?"":`, retryOf: ${n}`,G=Date.now();if(Z2(this).debug(`[${c}] sending request`,LX({retryOfRequestLogID:n,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new yre;let y=new AbortController,N=await this.fetchWithTimeout(d,I,h,y).catch(fOe),Z=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 yre;let w=pOe(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(r)return Z2(this).info(`[${c}] connection ${w?"timed out":"failed"} - ${F}`),Z2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (${F})`,LX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),this.retryRequest(s,r,n??c);throw Z2(this).info(`[${c}] connection ${w?"timed out":"failed"} - error; no more retries left`),Z2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (error; no more retries left)`,LX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),w?new vge:new LD({cause:N})}let R=`[${c}${m}] ${I.method} ${d} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${Z-G}ms`;if(!N.ok){let F=await this.shouldRetry(N);if(r&&F){let f=`retrying, ${r} attempts remaining`;return await AYa(N.body),Z2(this).info(`${R} - ${f}`),Z2(this).debug(`[${c}] response error (${f})`,LX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),this.retryRequest(s,r,n??c,N.headers)}let w=F?"error; no more retries left":"error; not retryable";Z2(this).info(`${R} - ${w}`);let b=await N.text().catch(f=>fOe(f).message),v=mYa(b),A=v?void 0:b;throw Z2(this).debug(`[${c}] response error (${w})`,LX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,message:A,durationMs:Date.now()-G})),this.makeStatusError(N.status,v,A,N.headers)}return Z2(this).info(R),Z2(this).debug(`[${c}] response start`,LX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),{response:N,options:s,controller:y,requestLogID:c,retryOfRequestLogID:n,startTime:G}}async fetchWithTimeout(e,r,n,i){let o=r||{},{signal:t,method:s}=o,u=gge(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),n),d=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},d?{duplex:"half"}:{}),{method:"GET"}),u);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,n,i){var o;let t,s=i?.get("retry-after-ms");if(s){let I=parseFloat(s);Number.isNaN(I)||(t=I)}let u=i?.get("retry-after");if(u&&!t){let I=parseFloat(u);Number.isNaN(I)?t=Date.parse(u)-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 pYa(t),this.makeRequest(e,r-1,n)}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 n,i,o;let t=Object.assign({},e),{method:s,path:u,query:I,defaultBaseURL:d}=t,h=this.buildURL(u,I,d);"timeout"in t&&hYa("timeout",t.timeout),t.timeout=(n=t.timeout)!==null&&n!==void 0?n:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),G=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:G},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:n,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=Gre([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))}:{}),GYa()),this._options.defaultHeaders,n,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 n=Gre([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.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:yYa(e)}:this.encoder({body:e,headers:n})}};Vge.DEFAULT_TIMEOUT=6e4;X0=class extends Vge{constructor(){super(...arguments),this.interactions=new xge(this)}};NJt=X0;X0.GeminiNextGenAPIClient=NJt;X0.GeminiNextGenAPIClientError=zg;X0.APIError=Pg;X0.APIConnectionError=LD;X0.APIConnectionTimeoutError=vge;X0.APIUserAbortError=yre;X0.NotFoundError=Nge;X0.ConflictError=Wge;X0.RateLimitError=Ege;X0.BadRequestError=yge;X0.AuthenticationError=Age;X0.InternalServerError=wge;X0.PermissionDeniedError=Zge;X0.UnprocessableEntityError=Fge;X0.toFile=wYa;X0.Interactions=xge;bOi=1024*1024*8;});function BYa(a,e){return{...a,...e}}function WJt(a){let{prompt_id:e,...r}=a;return r}function JX(a){return Array.isArray(a)?a.map(WJt):a}var Qge=ct(()=>{"use strict";ci();});var FJt={};oo(FJt,{DEFAULT_PROXY_CONFIG:()=>DYa,getActiveProxyServerUrl:()=>DF,getAvailableProxyServers:()=>JYa,getProxyServerInfo:()=>TYa,getProxyServers:()=>Are,hasAvailableProxyServer:()=>NOe});function Are(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function DF(){let e=Are().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function JYa(){return Are().filter(e=>e.status==="active")}function NOe(){return Are().some(e=>e.status==="active")}function TYa(a){return Are().find(r=>r.url===a)}var DYa,JD=ct(()=>{"use strict";DYa={serverUrl:DF(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as OYa}from"crypto";function K1(){return Zre||(Zre=OYa()),Zre}function EJt(a){Zre=a}function wJt(){Zre=void 0}var Zre,RJt,Hge=ct(()=>{"use strict";RJt=K1()});function Nd(a){let e=a??"1.1.8"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${WOe}/VSCode/${i} (${r}; ${n})`}return`${WOe}/CLI/${e} (${r}; ${n})`}var WOe,fY=ct(()=>{"use strict";WOe="EasyCode"});import*as Eu from"fs";import*as LN from"path";import*as TX from"os";function MYa(a){yo.configure(a)}function UYa(a){yo.setUserInfo(a)}function _Ya(a){yo.setCliVersion(a)}async function zYa(){return await yo.getUserHeaders()}function PYa(){return yo.getStatus()}var Nre,Mo,yo,bY=ct(()=>{"use strict";JD();Hge();fY();Nre=259200,Mo=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Nd(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\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=LN.join(TX.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=LN.join(TX.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=LN.join(TX.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=LN.join(TX.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=LN.join(TX.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=LN.join(TX.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.8",this.config={proxyServerUrl:DF()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Nre*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${n} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return a.instance||(a.instance=new a),a.instance}loadUserInfo(){try{if(Eu.existsSync(this.userInfoFilePath)){let e=Eu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,o]=n.split("@");return i.length<=2?n:`${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=LN.dirname(this.userInfoFilePath);Eu.existsSync(e)||Eu.mkdirSync(e,{recursive:!0}),Eu.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),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(Eu.existsSync(this.jwtTokenFilePath)){let e=Eu.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=LN.dirname(this.jwtTokenFilePath);Eu.existsSync(e)||Eu.mkdirSync(e,{recursive:!0}),Eu.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),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(Eu.existsSync(this.usageStatsFilePath)){let e=Eu.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=LN.dirname(this.usageStatsFilePath);Eu.existsSync(e)||Eu.mkdirSync(e,{recursive:!0}),Eu.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),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 n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Nre*1e3),u=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${o}), next renewal: ${t}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Nre*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Nre){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Nre*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{Eu.existsSync(this.jwtTokenFilePath)&&Eu.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(),n=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":n,"User-Agent":i,"X-Session-ID":K1()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),n={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":K1()};return this.jwtTokenData?.accessToken&&(n.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),n}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{Eu.existsSync(this.userInfoFilePath)&&Eu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Eu.existsSync(this.jwtTokenFilePath)&&Eu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},yo=Mo.getInstance()});import{promises as DX}from"node:fs";import Wre from"node:path";import jYa from"os";var $1,Xge,ea,ev=ct(()=>{"use strict";(function(a){a[a.DEBUG=0]="DEBUG",a[a.INFO=1]="INFO",a[a.WARN=2]="WARN",a[a.ERROR=3]="ERROR"})($1||($1={}));Xge=class{config;logBuffer=[];constructor(e={}){if(this.config={level:$1.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=Wre.join(jYa.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...n){let i=new Date().toISOString(),o=n.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 DX.mkdir(Wre.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await DX.appendFile(this.config.filePath,e+`
|
|
612
612
|
`,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await DX.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let n=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${n}.log`);await DX.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=Wre.dirname(this.config.filePath),n=(await DX.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:Wre.join(e,t),time:DX.stat(Wre.join(e,t)).then(s=>s.mtime)})),i=await Promise.all(n.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 DX.unlink(t.path)}catch(e){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",e)}}log(e,r,n,...i){if(e<this.config.level)return;let o=this.formatMessage(r,n,...i);this.config.enableConsole&&(e>=$1.ERROR?console.error:e>=$1.WARN?console.warn:e>=$1.INFO?console.log:console.debug)(o),this.config.enableFile&&this.writeToFile(o)}debug(e,...r){this.log($1.DEBUG,"DEBUG",e,...r)}info(e,...r){this.log($1.INFO,"INFO",e,...r)}warn(e,...r){this.log($1.WARN,"WARN",e,...r)}error(e,...r){this.log($1.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}:{}})}},ea=new Xge({level:process.env.FILE_DEBUG==="1"?$1.DEBUG:$1.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Zc(a){return a instanceof Error&&"code"in a}function fa(a){if(a instanceof Error)return a.message;try{return String(a)}catch{return"Failed to get error details"}}function FOe(a){if(a&&typeof a=="object"&&"response"in a){let r=qYa(a);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Sge(r.error.message);case 401:return new oI(r.error.message);case 403:return new kge(r.error.message);default:}}return a}function qYa(a){return typeof a.response?.data=="string"?JSON.parse(a.response?.data):a.response?.data}function OX(a){if(!a)return!1;try{let e=JSON.parse(a);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var kge,oI,Sge,Bc=ct(()=>{"use strict";kge=class extends Error{},oI=class extends Error{},Sge=class extends Error{}});var yn,CJt,Lh,cA=ct(()=>{"use strict";(function(a){a.CHAT_CONVERSATION="chat_conversation",a.WEB_FETCH="web_fetch",a.WEB_SEARCH="web_search",a.CONTENT_SUMMARY="content_summary",a.JSON_GENERATION="json_generation",a.COMPRESSION="compression",a.SUB_AGENT="sub_agent",a.CODE_ASSIST="code_assist",a.EDIT_CORRECTION="edit_correction",a.IMAGE_READER="image_reader"})(yn||(yn={}));CJt={[yn.CHAT_CONVERSATION]:"auto",[yn.WEB_FETCH]:"gemini-2.5-flash",[yn.WEB_SEARCH]:"gemini-2.5-flash",[yn.CODE_ASSIST]:"auto",[yn.CONTENT_SUMMARY]:"gemini-2.5-flash-lite",[yn.EDIT_CORRECTION]:"gemini-2.5-flash-lite",[yn.JSON_GENERATION]:"gemini-2.5-flash",[yn.COMPRESSION]:"gemini-2.5-flash",[yn.SUB_AGENT]:"auto",[yn.IMAGE_READER]:"gemini-2.5-flash"},Lh=class{static getModelForScene(e){if(e)return CJt[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{[yn.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[yn.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[yn.WEB_SEARCH]:"Web\u641C\u7D22",[yn.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[yn.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[yn.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[yn.JSON_GENERATION]:"JSON\u751F\u6210",[yn.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[yn.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[yn.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B"}[e]||e}}});function uA(a){return typeof a=="object"&&a!==null&&"error"in a&&typeof a.error=="object"&&"message"in a.error}function _f(a){return typeof a=="object"&&a!==null&&"message"in a&&typeof a.message=="string"}function BN(a){let e=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof a=="string")return e(a);if(_f(a))return e(a.message);if(uA(a))return e(a.error.message);if(a&&typeof a=="object"&&"response"in a){let r=a;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 n=r.response.data;return e(n.error?.message||"")}}}return!1}function JN(a){return typeof a=="string"?a.includes("Quota exceeded for quota metric"):_f(a)?a.message.includes("Quota exceeded for quota metric"):uA(a)?a.error.message.includes("Quota exceeded for quota metric"):!1}function jg(a){if(a&&typeof a=="object"&&"response"in a){let e=a;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(a instanceof Error&&a.message&&(a.message.includes("API request failed (402):")&&(a.message.includes('"error":"Quota limit exceeded"')||a.message.includes('"error":"No quota configuration"'))||a.message.includes("API request failed (500):")&&a.message.includes("quota exceeded")||a.message.includes("Stream API error (500):")&&a.message.includes("quota exceeded")))return!0;if(typeof a=="object"&&a!==null){let e=a;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 a=="string"?a.includes("Quota limit exceeded")||a.includes("No quota configuration")||a.includes("Daily token limit would be exceeded")||a.includes("Daily request limit exceeded")||a.includes("Daily cost limit would be exceeded")||a.includes("500")&&a.includes("quota exceeded"):!1}function Fre(a){let e=null;if(a&&typeof a=="object"&&"response"in a){let r=a;if(r.response?.status===402&&r.response.data)e=r.response.data;else if(r.response?.status===500&&r.response.data){let n=r.response.data;n&&typeof n.message=="string"&&n.message.includes("quota exceeded")&&(e=n)}}else if(typeof a=="object"&&a!==null){let r=a;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 n=r.message.match(/\{.*\}$/);n&&(e=JSON.parse(n[0]))}catch{}e||(e=a)}if(!e&&a instanceof Error&&a.message&&(a.message.includes("API request failed (402):")||a.message.includes("API request failed (500):")||a.message.includes("Stream API error (500):"))&&(a.message.includes('"error":"Quota limit exceeded"')||a.message.includes('"error":"No quota configuration"')||a.message.includes("quota exceeded")))try{let r=a.message.match(/\{.*\}$/);r&&(e=JSON.parse(r[0]))}catch{}return e?e.message&&e.message.includes("quota exceeded")?KYa(e):$Ya(e):null}function KYa(a){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}})(),n="",i="",o="",t="",s=a.message||"",u=s.match(/Role:\s*([^,]+)/);u&&(n=u[1].trim());let I=s.match(/Limit:\s*([^,]+)/);I&&(i=I[1].trim());let d=s.match(/Used:\s*([^,]+)/);d&&(o=d[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
|
|
613
613
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
614
614
|
`,n&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${n}
|
|
@@ -3748,7 +3748,7 @@ ${n}
|
|
|
3748
3748
|
\u{1F50D} Model Diagnostics: ${a}`),console.log(`\u{1F4CA} Reliability: ${r.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${r.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${r.capabilities.maxConcurrentTools}`),r.warnings.length>0&&(console.log(`
|
|
3749
3749
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(n=>console.log(` \u2022 ${n}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
3750
3750
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(n=>console.log(` \u2022 ${n}`))),e&&(console.log(`
|
|
3751
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function ohi(a){let e=lHe(a);return e.isSmallModel||e.needsSpecialHandling}function lhi(a){let e=lHe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var Ota=ct(()=>{"use strict";ple();});import*as SZ from"fs";import*as cHe from"path";var chi,$he,Mta=ct(()=>{"use strict";Jm();chi="healthy-use-reminder.json",$he=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=WG(e);this.stateFilePath=cHe.join(r,chi)}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{SZ.existsSync(this.stateFilePath)&&SZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!SZ.existsSync(this.stateFilePath))return null;let e=SZ.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=cHe.dirname(this.stateFilePath);SZ.existsSync(r)||SZ.mkdirSync(r,{recursive:!0}),SZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var V3t,Q3t,uhi,dhi,Ihi,Uta=ct(()=>{"use strict";V3t="--- Content from referenced files ---",Q3t="--- End of content ---",uhi=2e3,dhi=2e3,Ihi=20});function zta(...a){return hhi(...a)}function Pta(...a){return mhi(...a)}function _ta(a,e){return a in e}function H3t(){let a={get(i,o){if(o==="write")return zta;if(_ta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,o){if(o==="write")return Pta;if(_ta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var hhi,mhi,jta=ct(()=>{"use strict";hhi=process.stdout.write.bind(process.stdout),mhi=process.stderr.write.bind(process.stderr)});import{readFile as phi}from"node:fs/promises";import{fileURLToPath as fhi}from"node:url";import X3t from"node:path";function bhi(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return X3t.dirname(fhi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function BC(){return e0e||(e0e=(async()=>"1.1.7")(),e0e)}function ghi(){e0e=void 0}var e0e,k3t=ct(()=>{"use strict";});import{EventEmitter as Ghi}from"node:events";var t0e,S3t,L3t,qta=ct(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(t0e||(t0e={}));S3t=class{emitter=new Ghi;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()}},L3t=new S3t});function uHe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function vhi(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function B3t(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??uHe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?uHe(r.content):[],i=vhi(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...uHe(r.content)),i)for(let o of r.toolCalls)n.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),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(...uHe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var Kta=ct(()=>{"use strict";});var $B,$ta,r0e,era=ct(()=>{"use strict";$B=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},$ta="latest",r0e=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw $B.noSessionsFound();let i=n.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<=n.length)return n[o-1];throw $B.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===$ta){let o=await this.listSessions();if(o.length===0)throw $B.noSessionsFound();n=o[o.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new $B(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function yhi(a,e,r){return new dHe(a,e,r)}var dHe,IHe,hHe,tra=ct(()=>{"use strict";lle();fY();dHe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(n,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(n,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Nd(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:m4("warn","\u26A0\uFE0F No access token available")}catch(n){m4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(m4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{m4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){m4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},o=fetch(e,i);return this.processRequestQueue(n),await o}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(m4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new IHe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:o})=>{o().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new hHe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},IHe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},hHe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function Ahi(a){return a0e.getInstance(a)}function Zhi(a){let e=a0e.getInstance(a);return()=>e.handleAuthenticationRequired()}var a0e,rra=ct(()=>{"use strict";bY();a0e=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Mo.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Mo.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function pHe(a){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${a||7863}/callback?plat=deepvlab`};return new mHe(r)}var mHe,J3t=ct(()=>{"use strict";mHe=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 n=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}`}):n?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",n),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:n,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 fHe from"fs";import*as pg from"path";function Nhi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var n0e,J9,T3t=ct(()=>{"use strict";n0e=Nhi(),J9=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(pg.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(pg.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(pg.join(this.customBasePath,"auth","login","templates",e))),n0e&&r.push(pg.join(n0e,e)),n0e){let o=n0e;for(let t=0;t<10;t++)r.push(pg.join(o,"bundled","auth","login","templates",e)),r.push(pg.join(o,"bundled",e)),r.push(pg.join(o,"bundle","login","templates",e)),r.push(pg.join(o,"auth","login","templates",e)),o=pg.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(pg.join(o,"bundle","login","templates",e)),r.push(pg.join(o,"dist","bundled","auth","login","templates",e)),r.push(pg.join(o,"bundled","auth","login","templates",e)),r.push(pg.join(o,"auth","login","templates",e))}catch{}let n=null;for(let o of r)try{if(fHe.existsSync(o)){n=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${n0e||"(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=fHe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
3751
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function ohi(a){let e=lHe(a);return e.isSmallModel||e.needsSpecialHandling}function lhi(a){let e=lHe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var Ota=ct(()=>{"use strict";ple();});import*as SZ from"fs";import*as cHe from"path";var chi,$he,Mta=ct(()=>{"use strict";Jm();chi="healthy-use-reminder.json",$he=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=WG(e);this.stateFilePath=cHe.join(r,chi)}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{SZ.existsSync(this.stateFilePath)&&SZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!SZ.existsSync(this.stateFilePath))return null;let e=SZ.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=cHe.dirname(this.stateFilePath);SZ.existsSync(r)||SZ.mkdirSync(r,{recursive:!0}),SZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var V3t,Q3t,uhi,dhi,Ihi,Uta=ct(()=>{"use strict";V3t="--- Content from referenced files ---",Q3t="--- End of content ---",uhi=2e3,dhi=2e3,Ihi=20});function zta(...a){return hhi(...a)}function Pta(...a){return mhi(...a)}function _ta(a,e){return a in e}function H3t(){let a={get(i,o){if(o==="write")return zta;if(_ta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,o){if(o==="write")return Pta;if(_ta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var hhi,mhi,jta=ct(()=>{"use strict";hhi=process.stdout.write.bind(process.stdout),mhi=process.stderr.write.bind(process.stderr)});import{readFile as phi}from"node:fs/promises";import{fileURLToPath as fhi}from"node:url";import X3t from"node:path";function bhi(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return X3t.dirname(fhi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function BC(){return e0e||(e0e=(async()=>"1.1.8")(),e0e)}function ghi(){e0e=void 0}var e0e,k3t=ct(()=>{"use strict";});import{EventEmitter as Ghi}from"node:events";var t0e,S3t,L3t,qta=ct(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(t0e||(t0e={}));S3t=class{emitter=new Ghi;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()}},L3t=new S3t});function uHe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function vhi(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function B3t(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??uHe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?uHe(r.content):[],i=vhi(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...uHe(r.content)),i)for(let o of r.toolCalls)n.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),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(...uHe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var Kta=ct(()=>{"use strict";});var $B,$ta,r0e,era=ct(()=>{"use strict";$B=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},$ta="latest",r0e=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw $B.noSessionsFound();let i=n.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<=n.length)return n[o-1];throw $B.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===$ta){let o=await this.listSessions();if(o.length===0)throw $B.noSessionsFound();n=o[o.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new $B(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function yhi(a,e,r){return new dHe(a,e,r)}var dHe,IHe,hHe,tra=ct(()=>{"use strict";lle();fY();dHe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(n,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(n,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Nd(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:m4("warn","\u26A0\uFE0F No access token available")}catch(n){m4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(m4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{m4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){m4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},o=fetch(e,i);return this.processRequestQueue(n),await o}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(m4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new IHe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:o})=>{o().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new hHe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},IHe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},hHe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function Ahi(a){return a0e.getInstance(a)}function Zhi(a){let e=a0e.getInstance(a);return()=>e.handleAuthenticationRequired()}var a0e,rra=ct(()=>{"use strict";bY();a0e=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Mo.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Mo.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function pHe(a){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${a||7863}/callback?plat=deepvlab`};return new mHe(r)}var mHe,J3t=ct(()=>{"use strict";mHe=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 n=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}`}):n?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",n),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:n,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 fHe from"fs";import*as pg from"path";function Nhi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var n0e,J9,T3t=ct(()=>{"use strict";n0e=Nhi(),J9=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(pg.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(pg.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(pg.join(this.customBasePath,"auth","login","templates",e))),n0e&&r.push(pg.join(n0e,e)),n0e){let o=n0e;for(let t=0;t<10;t++)r.push(pg.join(o,"bundled","auth","login","templates",e)),r.push(pg.join(o,"bundled",e)),r.push(pg.join(o,"bundle","login","templates",e)),r.push(pg.join(o,"auth","login","templates",e)),o=pg.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(pg.join(o,"bundle","login","templates",e)),r.push(pg.join(o,"dist","bundled","auth","login","templates",e)),r.push(pg.join(o,"bundled","auth","login","templates",e)),r.push(pg.join(o,"auth","login","templates",e))}catch{}let n=null;for(let o of r)try{if(fHe.existsSync(o)){n=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${n0e||"(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=fHe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
3752
3752
|
<!DOCTYPE html>
|
|
3753
3753
|
<html>
|
|
3754
3754
|
<head>
|
|
@@ -4850,7 +4850,7 @@ ${c}`),n?i.reset(c):c}function Opi(a,e,r,n={}){if(!jna){jna=!0;let o="Passing li
|
|
|
4850
4850
|
|
|
4851
4851
|
${e}
|
|
4852
4852
|
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=zpi(r,this.#t.message);if(n)return(0,iia.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#a??=this.#i(!0),this.#a}get rawCodeFrame(){return this.#n??=this.#i(!1),this.#n}},zpi=(a,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:wWt(a,Number(n),{oneBased:!0})},Ppi=a=>a.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${_pi(n)})`)});var xWt=Ze((lKs,jpi)=>{jpi.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 oia=Ze((cKs,qpi)=>{qpi.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 lia=Ze((uKs,Kpi)=>{Kpi.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 uia=Ze((dKs,cia)=>{"use strict";var $pi=[].concat(xWt()).concat(oia()),efi=lia();cia.exports=function(a){var e=0;function r(){return e<a.length}function n(G){if(G instanceof RegExp){var y=a.slice(e),N=y.match(G);if(N)return e+=N[0].length,N[0]}else if(a.indexOf(G,e)===e)return e+=G.length,G}function i(){n(/[ ]*/)}function o(){for(var G,y=["WITH","AND","OR","(",")",":","+"],N=0;N<y.length&&(G=n(y[N]),!G);N++);if(G==="+"&&e>1&&a[e-2]===" ")throw new Error("Space before `+`");return G&&{type:"OPERATOR",string:G}}function t(){return n(/[A-Za-z0-9-.]+/)}function s(){var G=t();if(!G)throw new Error("Expected idstring at offset "+e);return G}function u(){if(n("DocumentRef-")){var G=s();return{type:"DOCUMENTREF",string:G}}}function I(){if(n("LicenseRef-")){var G=s();return{type:"LICENSEREF",string:G}}}function d(){var G=e,y=t();if($pi.indexOf(y)!==-1)return{type:"LICENSE",string:y};if(efi.indexOf(y)!==-1)return{type:"EXCEPTION",string:y};e=G}function h(){return o()||u()||I()||d()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+a[e]+"` at offset "+e);c.push(m)}return c}});var Iia=Ze((IKs,dia)=>{"use strict";dia.exports=function(a){var e=0;function r(){return e<a.length}function n(){return r()?a[e]:null}function i(){if(!r())throw new Error;e++}function o(y){var N=n();if(N&&N.type==="OPERATOR"&&y===N.string)return i(),N.string}function t(){if(o("WITH")){var y=n();if(y&&y.type==="EXCEPTION")return i(),y.string;throw new Error("Expected exception after `WITH`")}}function s(){var y=e,N="",Z=n();if(Z.type==="DOCUMENTREF"&&(i(),N+="DocumentRef-"+Z.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(Z=n(),Z.type==="LICENSEREF")return i(),N+="LicenseRef-"+Z.string,{license:N};e=y}function u(){var y=n();if(y&&y.type==="LICENSE"){i();var N={license:y.string};o("+")&&(N.plus=!0);var Z=t();return Z&&(N.exception=Z),N}}function I(){var y=o("(");if(y){var N=m();if(!o(")"))throw new Error("Expected `)`");return N}}function d(){return I()||s()||u()}function h(y,N){return function Z(){var R=N();if(R){if(!o(y))return R;var F=Z();if(!F)throw new Error("Expected expression");return{left:R,conjunction:y.toLowerCase(),right:F}}}}var c=h("AND",d),m=h("OR",c),G=m();if(!G||r())throw new Error("Syntax error");return G}});var YWt=Ze((hKs,hia)=>{"use strict";var tfi=uia(),rfi=Iia();hia.exports=function(a){return rfi(tfi(a))}});var Aia=Ze((mKs,yia)=>{var afi=YWt(),nfi=xWt();function oXe(a){try{return afi(a),!0}catch{return!1}}function via(a,e){var r=e[0].length-a[0].length;return r!==0?r:a[0].toUpperCase().localeCompare(e[0].toUpperCase())}var mia=[["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(via),ifi=0,sfi=1,pia=[function(a){return a.toUpperCase()},function(a){return a.trim()},function(a){return a.replace(/\./g,"")},function(a){return a.replace(/\s+/g,"")},function(a){return a.replace(/\s+/g,"-")},function(a){return a.replace("v","-")},function(a){return a.replace(/,?\s*(\d)/,"-$1")},function(a){return a.replace(/,?\s*(\d)/,"-$1.0")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(a){return a[0].toUpperCase()+a.slice(1)},function(a){return a.replace("/","-")},function(a){return a.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(a){return a.indexOf("3.0")!==-1?a+"-or-later":a+"-only"},function(a){return a+"only"},function(a){return a.replace(/(\d)$/,"-$1.0")},function(a){return a.replace(/(-| )?(\d)$/,"-$2-Clause")},function(a){return a.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(a){return a.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(a){return a.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(a){return a.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(a){return a.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(a){return a.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(a){return"CC-"+a},function(a){return"CC-"+a+"-4.0"},function(a){return a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(a){return"CC-"+a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],VWt=nfi.map(function(a){var e=/^(.*)-\d+\.\d+$/.exec(a);return e?[e[0],e[1]]:[a,null]}).reduce(function(a,e){var r=e[1];return a[r]=a[r]||[],a[r].push(e[0]),a},{}),ofi=Object.keys(VWt).map(function(e){return[e,VWt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});VWt=void 0;var fia=[["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(ofi).sort(via),lfi=0,cfi=1,bia=function(a){for(var e=0;e<pia.length;e++){var r=pia[e](a).trim();if(r!==a&&oXe(r))return r}return null},gia=function(a){for(var e=a.toUpperCase(),r=0;r<fia.length;r++){var n=fia[r];if(e.indexOf(n[lfi])>-1)return n[cfi]}return null},Gia=function(a,e){for(var r=0;r<mia.length;r++){var n=mia[r],i=n[ifi];if(a.indexOf(i)>-1){var o=a.replace(i,n[sfi]),t=e(o);if(t!==null)return t}}return null};yia.exports=function(a,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(s){return r?ufi(s):s}var i=typeof a=="string"&&a.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(a=a.trim(),oXe(a))return n(a);var o=a.replace(/\+$/,"").trim();if(oXe(o))return n(o);var t=bia(a);return t!==null||(t=Gia(a,function(s){return oXe(s)?s:bia(s)}),t!==null)||(t=gia(a),t!==null)||(t=Gia(a,gia),t!==null)?n(t):null};function ufi(a){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(a)!==-1?a+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(a)!==-1?a.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(a)!==-1?a+"-or-later":a}});var Fia=Ze((pKs,Wia)=>{var dfi=YWt(),Ifi=Aia(),Zia='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',hfi=/^SEE LICEN[CS]E IN (.+)$/;function Nia(a,e){return e.slice(0,a.length)===a}function QWt(a){if(a.hasOwnProperty("license")){var e=a.license;return Nia("LicenseRef",e)||Nia("DocumentRef",e)}else return QWt(a.left)||QWt(a.right)}Wia.exports=function(a){var e;try{e=dfi(a)}catch{var r;if(a==="UNLICENSED"||a==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=hfi.exec(a))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[Zia]};if(a.trim().length!==0){var i=Ifi(a);i&&n.warnings.push('license is similar to the valid expression "'+i+'"')}return n}return QWt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[Zia]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var xia=Ze(cXe=>{"use strict";Object.defineProperty(cXe,"__esModule",{value:!0});cXe.LRUCache=void 0;var FK=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,wia=new Set,HWt=typeof process=="object"&&process?process:{},Ria=(a,e,r,n)=>{typeof HWt.emitWarning=="function"?HWt.emitWarning(a,e,r,n):console.error(`[${r}] ${e}: ${a}`)},lXe=globalThis.AbortController,Eia=globalThis.AbortSignal;if(typeof lXe>"u"){Eia=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},lXe=class{constructor(){e()}signal=new Eia;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let a=HWt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{a&&(a=!1,Ria("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 mfi=a=>!wia.has(a),gKs=Symbol("type"),$9=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),Cia=a=>$9(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?EK:null:null,EK=class extends Array{constructor(e){super(e),this.fill(0)}},XWt=class a{heap;length;static#e=!1;static create(e){let r=Cia(e);if(!r)return[];a.#e=!0;let n=new a(e,r);return a.#e=!1,n}constructor(e,r){if(!a.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},kWt=class a{#e;#t;#r;#a;#n;#i;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#u;#o;#s;#I;#d;#h;#l;#m;#b;#A;#f;#E;#G;#Z;#N;#y;#g;static unsafeExposeInternals(e){return{starts:e.#G,ttls:e.#Z,sizes:e.#E,keyMap:e.#s,keyList:e.#I,valList:e.#d,next:e.#h,prev:e.#l,get head(){return e.#m},get tail(){return e.#b},free:e.#A,isBackgroundFetch:r=>e.#v(r),backgroundFetch:(r,n,i,o)=>e.#x(r,n,i,o),moveToTail:r=>e.#D(r),indexes:r=>e.#L(r),rindexes:r=>e.#V(r),isStale:r=>e.#R(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#o}get size(){return this.#u}get fetchMethod(){return this.#n}get memoMethod(){return this.#i}get dispose(){return this.#r}get disposeAfter(){return this.#a}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:t,updateAgeOnHas:s,allowStale:u,dispose:I,disposeAfter:d,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:G=0,sizeCalculation:y,fetchMethod:N,memoMethod:Z,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:b,ignoreFetchAbort:v}=e;if(r!==0&&!$9(r))throw new TypeError("max option must be a nonnegative integer");let A=r?Cia(r):Array;if(!A)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=G||this.#t,this.sizeCalculation=y,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(Z!==void 0&&typeof Z!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#i=Z,N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#n=N,this.#y=!!N,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new A(r),this.#l=new A(r),this.#m=0,this.#b=0,this.#A=XWt.create(r),this.#u=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof d=="function"?(this.#a=d,this.#f=[]):(this.#a=void 0,this.#f=void 0),this.#N=!!this.#r,this.#g=!!this.#a,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!v,this.maxEntrySize!==0){if(this.#t!==0&&!$9(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!$9(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!s,this.ttlResolution=$9(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!$9(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 E="LRU_CACHE_UNBOUNDED";mfi(E)&&(wia.add(E),Ria("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,a))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#W(){let e=new EK(this.#e),r=new EK(this.#e);this.#Z=e,this.#G=r,this.#H=(o,t,s=FK.now())=>{if(r[o]=t!==0?s:0,e[o]=t,t!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#R(o)&&this.#k(this.#I[o],"expire")},t+1);u.unref&&u.unref()}},this.#w=o=>{r[o]=e[o]!==0?FK.now():0},this.#c=(o,t)=>{if(e[t]){let s=e[t],u=r[t];if(!s||!u)return;o.ttl=s,o.start=u,o.now=n||i();let I=o.now-u;o.remainingTTL=s-I}};let n=0,i=()=>{let o=FK.now();if(this.ttlResolution>0){n=o;let t=setTimeout(()=>n=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],u=r[t];if(!s||!u)return 1/0;let I=(n||i())-u;return s-I},this.#R=o=>{let t=r[o],s=e[o];return!!s&&!!t&&(n||i())-t>s}}#w=()=>{};#c=()=>{};#H=()=>{};#R=()=>!1;#C(){let e=new EK(this.#e);this.#o=0,this.#E=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#F=(r,n,i,o)=>{if(this.#v(n))return 0;if(!$9(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(n,r),!$9(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#S=(r,n,i)=>{if(e[r]=n,this.#t){let o=this.#t-e[r];for(;this.#o>o;)this.#B(!0)}this.#o+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,n)=>{};#F=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#b;!(!this.#X(r)||((e||!this.#R(r))&&(yield r),r===this.#m));)r=this.#l[r]}*#V({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#m;!(!this.#X(r)||((e||!this.#R(r))&&(yield r),r===this.#b));)r=this.#h[r]}#X(e){return e!==void 0&&this.#s.get(this.#I[e])===e}*entries(){for(let e of this.#L())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#v(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.#v(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.#v(this.#d[e])&&(yield r)}}*rkeys(){for(let e of this.#V()){let r=this.#I[e];r!==void 0&&!this.#v(this.#d[e])&&(yield r)}}*values(){for(let e of this.#L())this.#d[e]!==void 0&&!this.#v(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#V())this.#d[e]!==void 0&&!this.#v(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#L()){let i=this.#d[n],o=this.#v(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#I[n],this))return this.get(this.#I[n],r)}}forEach(e,r=this){for(let n of this.#L()){let i=this.#d[n],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[n],this)}}rforEach(e,r=this){for(let n of this.#V()){let i=this.#d[n],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[n],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#R(r)&&(this.#k(this.#I[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#d[r],i=this.#v(n)?n.__staleWhileFetching:n;if(i===void 0)return;let o={value:i};if(this.#Z&&this.#G){let t=this.#Z[r],s=this.#G[r];if(t&&s){let u=t-(FK.now()-s);o.ttl=u,o.start=Date.now()}}return this.#E&&(o.size=this.#E[r]),o}dump(){let e=[];for(let r of this.#L({allowStale:!0})){let n=this.#I[r],i=this.#d[r],o=this.#v(i)?i.__staleWhileFetching:i;if(o===void 0||n===void 0)continue;let t={value:o};if(this.#Z&&this.#G){t.ttl=this.#Z[r];let s=FK.now()-this.#G[r];t.start=Math.floor(Date.now()-s)}this.#E&&(t.size=this.#E[r]),e.unshift([n,t])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=FK.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:o,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:u}=n,{noUpdateTTL:I=this.noUpdateTTL}=n,d=this.#F(e,r,n.size||0,s);if(this.maxEntrySize&&d>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#k(e,"set"),this;let h=this.#u===0?void 0:this.#s.get(e);if(h===void 0)h=this.#u===0?this.#b:this.#A.length!==0?this.#A.pop():this.#u===this.#e?this.#B(!1):this.#u,this.#I[h]=e,this.#d[h]=r,this.#s.set(e,h),this.#h[this.#b]=h,this.#l[h]=this.#b,this.#b=h,this.#u++,this.#S(h,d,u),u&&(u.set="add"),I=!1;else{this.#D(h);let c=this.#d[h];if(r!==c){if(this.#y&&this.#v(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=c;m!==void 0&&!t&&(this.#N&&this.#r?.(m,e,"set"),this.#g&&this.#f?.push([m,e,"set"]))}else t||(this.#N&&this.#r?.(c,e,"set"),this.#g&&this.#f?.push([c,e,"set"]));if(this.#Y(h),this.#S(h,d,u),this.#d[h]=r,u){u.set="replace";let m=c&&this.#v(c)?c.__staleWhileFetching:c;m!==void 0&&(u.oldValue=m)}}else u&&(u.set="update")}if(i!==0&&!this.#Z&&this.#W(),this.#Z&&(I||this.#H(h,i,o),u&&this.#c(u,h)),!t&&this.#g&&this.#f){let c=this.#f,m;for(;m=c?.shift();)this.#a?.(...m)}return this}pop(){try{for(;this.#u;){let e=this.#d[this.#m];if(this.#B(!0),this.#v(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#g&&this.#f){let e=this.#f,r;for(;r=e?.shift();)this.#a?.(...r)}}}#B(e){let r=this.#m,n=this.#I[r],i=this.#d[r];return this.#y&&this.#v(i)?i.__abortController.abort(new Error("evicted")):(this.#N||this.#g)&&(this.#N&&this.#r?.(i,n,"evict"),this.#g&&this.#f?.push([i,n,"evict"])),this.#Y(r),e&&(this.#I[r]=void 0,this.#d[r]=void 0,this.#A.push(r)),this.#u===1?(this.#m=this.#b=0,this.#A.length=0):this.#m=this.#h[r],this.#s.delete(n),this.#u--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,o=this.#s.get(e);if(o!==void 0){let t=this.#d[o];if(this.#v(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#R(o))i&&(i.has="stale",this.#c(i,o));else return n&&this.#w(o),i&&(i.has="hit",this.#c(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!n&&this.#R(i))return;let o=this.#d[i];return this.#v(o)?o.__staleWhileFetching:o}#x(e,r,n,i){let o=r===void 0?void 0:this.#d[r];if(this.#v(o))return o;let t=new lXe,{signal:s}=n;s?.addEventListener("abort",()=>t.abort(s.reason),{signal:t.signal});let u={signal:t.signal,options:n,context:i},I=(y,N=!1)=>{let{aborted:Z}=t.signal,R=n.ignoreFetchAbort&&y!==void 0;if(n.status&&(Z&&!N?(n.status.fetchAborted=!0,n.status.fetchError=t.signal.reason,R&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),Z&&!R&&!N)return h(t.signal.reason);let F=m;return this.#d[r]===m&&(y===void 0?F.__staleWhileFetching?this.#d[r]=F.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,y,u.options))),y},d=y=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=y),h(y)),h=y=>{let{aborted:N}=t.signal,Z=N&&n.allowStaleOnFetchAbort,R=Z||n.allowStaleOnFetchRejection,F=R||n.noDeleteOnFetchRejection,w=m;if(this.#d[r]===m&&(!F||w.__staleWhileFetching===void 0?this.#k(e,"fetch"):Z||(this.#d[r]=w.__staleWhileFetching)),R)return n.status&&w.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw y},c=(y,N)=>{let Z=this.#n?.(e,o,u);Z&&Z instanceof Promise&&Z.then(R=>y(R===void 0?void 0:R),N),t.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(y(void 0),n.allowStaleOnFetchAbort&&(y=R=>I(R,!0)))})};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(c).then(I,d),G=Object.assign(m,{__abortController:t,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,G,{...u.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=G,G}#v(e){if(!this.#y)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof lXe}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:u=0,sizeCalculation:I=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:G=this.allowStaleOnFetchAbort,context:y,forceRefresh:N=!1,status:Z,signal:R}=r;if(!this.#y)return Z&&(Z.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:Z});let F={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:t,noDisposeOnSet:s,size:u,sizeCalculation:I,noUpdateTTL:d,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:G,ignoreFetchAbort:m,status:Z,signal:R},w=this.#s.get(e);if(w===void 0){Z&&(Z.fetch="miss");let b=this.#x(e,w,F,y);return b.__returned=b}else{let b=this.#d[w];if(this.#v(b)){let p=n&&b.__staleWhileFetching!==void 0;return Z&&(Z.fetch="inflight",p&&(Z.returnedStale=!0)),p?b.__staleWhileFetching:b.__returned=b}let v=this.#R(w);if(!N&&!v)return Z&&(Z.fetch="hit"),this.#D(w),i&&this.#w(w),Z&&this.#c(Z,w),b;let A=this.#x(e,w,F,y),f=A.__staleWhileFetching!==void 0&&n;return Z&&(Z.fetch=v?"stale":"refresh",f&&v&&(Z.returnedStale=!0)),f?A.__staleWhileFetching:A.__returned=A}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#i;if(!n)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 u=n(e,s,{options:t,context:i});return this.set(e,u,t),u}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:t}=r,s=this.#s.get(e);if(s!==void 0){let u=this.#d[s],I=this.#v(u);return t&&this.#c(t,s),this.#R(s)?(t&&(t.get="stale"),I?(t&&n&&u.__staleWhileFetching!==void 0&&(t.returnedStale=!0),n?u.__staleWhileFetching:void 0):(o||this.#k(e,"expire"),t&&n&&(t.returnedStale=!0),n?u:void 0)):(t&&(t.get="hit"),I?u.__staleWhileFetching:(this.#D(s),i&&this.#w(s),u))}else t&&(t.get="miss")}#T(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#b&&(e===this.#m?this.#m=this.#h[e]:this.#T(this.#l[e],this.#h[e]),this.#T(this.#b,e),this.#b=e)}delete(e){return this.#k(e,"delete")}#k(e,r){let n=!1;if(this.#u!==0){let i=this.#s.get(e);if(i!==void 0)if(n=!0,this.#u===1)this.#p(r);else{this.#Y(i);let o=this.#d[i];if(this.#v(o)?o.__abortController.abort(new Error("deleted")):(this.#N||this.#g)&&(this.#N&&this.#r?.(o,e,r),this.#g&&this.#f?.push([o,e,r])),this.#s.delete(e),this.#I[i]=void 0,this.#d[i]=void 0,i===this.#b)this.#b=this.#l[i];else if(i===this.#m)this.#m=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.#u--,this.#A.push(i)}}if(this.#g&&this.#f?.length){let i=this.#f,o;for(;o=i?.shift();)this.#a?.(...o)}return n}clear(){return this.#p("delete")}#p(e){for(let r of this.#V({allowStale:!0})){let n=this.#d[r];if(this.#v(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#N&&this.#r?.(n,i,e),this.#g&&this.#f?.push([n,i,e])}}if(this.#s.clear(),this.#d.fill(void 0),this.#I.fill(void 0),this.#Z&&this.#G&&(this.#Z.fill(0),this.#G.fill(0)),this.#E&&this.#E.fill(0),this.#m=0,this.#b=0,this.#A.length=0,this.#o=0,this.#u=0,this.#g&&this.#f){let r=this.#f,n;for(;n=r?.shift();)this.#a?.(...n)}}};cXe.LRUCache=kWt});var Qia=Ze((vKs,Via)=>{"use strict";var Ul=(...a)=>a.every(e=>e)?a.join(""):"",p0=a=>a?encodeURIComponent(a):"",Yia=a=>a.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),pfi={sshtemplate:({domain:a,user:e,project:r,committish:n})=>`git@${a}:${e}/${r}.git${Ul("#",n)}`,sshurltemplate:({domain:a,user:e,project:r,committish:n})=>`git+ssh://git@${a}/${e}/${r}.git${Ul("#",n)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i,path:o})=>`https://${a}/${e}/${r}${Ul("/",i,"/",p0(n||"HEAD"),"/",o)}`,browsetemplate:({domain:a,user:e,project:r,committish:n,treepath:i})=>`https://${a}/${e}/${r}${Ul("/",i,"/",p0(n))}`,browsetreetemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:o,fragment:t,hashformat:s})=>`https://${a}/${e}/${r}/${i}/${p0(n||"HEAD")}/${o}${Ul("#",s(t||""))}`,browseblobtemplate:({domain:a,user:e,project:r,committish:n,blobpath:i,path:o,fragment:t,hashformat:s})=>`https://${a}/${e}/${r}/${i}/${p0(n||"HEAD")}/${o}${Ul("#",s(t||""))}`,docstemplate:({domain:a,user:e,project:r,treepath:n,committish:i})=>`https://${a}/${e}/${r}${Ul("/",n,"/",p0(i))}#readme`,httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Ul(a,"@")}${e}/${r}/${n}.git${Ul("#",i)}`,filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/raw/${p0(n||"HEAD")}/${i}`,shortcuttemplate:({type:a,user:e,project:r,committish:n})=>`${a}:${e}/${r}${Ul("#",n)}`,pathtemplate:({user:a,project:e,committish:r})=>`${a}/${e}${Ul("#",r)}`,bugstemplate:({domain:a,user:e,project:r})=>`https://${a}/${e}/${r}/issues`,hashformat:Yia},eH={};eH.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:a,user:e,project:r,committish:n,path:i})=>`https://${Ul(a,"@")}raw.githubusercontent.com/${e}/${r}/${p0(n||"HEAD")}/${i}`,gittemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git://${Ul(a,"@")}${e}/${r}/${n}.git${Ul("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://codeload.${a}/${e}/${r}/tar.gz/${p0(n||"HEAD")}`,extract:a=>{let[,e,r,n,i]=a.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(i=a.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};eH.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:o,editpath:t})=>`https://${a}/${e}/${r}${Ul("/",i,"/",p0(n||"HEAD"),"/",o,t)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/get/${p0(n||"HEAD")}.tar.gz`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};eH.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Ul(a,"@")}${e}/${r}/${n}.git${Ul("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/repository/archive.tar.gz?ref=${p0(n||"HEAD")}`,extract:a=>{let e=a.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let i=r.join("/");if(!(!i||!n))return{user:i,project:n,committish:a.hash.slice(1)}}};eH.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:a,project:e,committish:r})=>`git@${a}:${e}.git${Ul("#",r)}`,sshurltemplate:({domain:a,project:e,committish:r})=>`git+ssh://git@${a}/${e}.git${Ul("#",r)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i})=>`https://${a}/${e}/${r}${Ul("/",p0(n))}/${i}`,browsetemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Ul("/",p0(r))}`,browsetreetemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Ul("/",p0(r))}${Ul("#",i(n))}`,browseblobtemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Ul("/",p0(r))}${Ul("#",i(n))}`,docstemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Ul("/",p0(r))}`,httpstemplate:({domain:a,project:e,committish:r})=>`git+https://${a}/${e}.git${Ul("#",r)}`,filetemplate:({user:a,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${a}/${e}/raw${Ul("/",p0(r))}/${n}`,shortcuttemplate:({type:a,project:e,committish:r})=>`${a}:${e}${Ul("#",r)}`,pathtemplate:({project:a,committish:e})=>`${a}${Ul("#",e)}`,bugstemplate:({domain:a,project:e})=>`https://${a}/${e}`,gittemplate:({domain:a,project:e,committish:r})=>`git://${a}/${e}.git${Ul("#",r)}`,tarballtemplate:({project:a,committish:e})=>`https://codeload.github.com/gist/${a}/tar.gz/${p0(e||"HEAD")}`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:a.hash.slice(1)}}},hashformat:function(a){return a&&"file-"+Yia(a)}};eH.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/blob/${p0(n)||"HEAD"}/${i}`,httpstemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}.git${Ul("#",n)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/archive/${p0(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};for(let[a,e]of Object.entries(eH))eH[a]=Object.assign({},pfi,e);Via.exports=eH});var LWt=Ze((yKs,Xia)=>{var ffi=Wt("url"),SWt=(a,e,r)=>{let n=a.indexOf(r);return a.lastIndexOf(e,n>-1?n:1/0)},Hia=a=>{try{return new ffi.URL(a)}catch{}},bfi=(a,e)=>{let r=a.indexOf(":"),n=a.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return a;let i=a.indexOf("@");return i>-1?i>r?`git+ssh://${a}`:a:a.indexOf("//")===r+1?a:`${a.slice(0,r+1)}//${a.slice(r+1)}`},gfi=a=>{let e=SWt(a,"@","#"),r=SWt(a,":","#");return r>e&&(a=a.slice(0,r)+"/"+a.slice(r+1)),SWt(a,":","#")===-1&&a.indexOf("//")===-1&&(a=`git+ssh://${a}`),a};Xia.exports=(a,e)=>{let r=e?bfi(a,e):a;return Hia(r)||Hia(gfi(r))}});var Sia=Ze((AKs,kia)=>{"use strict";var Gfi=LWt(),vfi=a=>{let e=a.indexOf("#"),r=a.indexOf("/"),n=a.indexOf("/",r+1),i=a.indexOf(":"),o=/\s/.exec(a),t=a.indexOf("@"),s=!o||e>-1&&o.index>e,u=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,d=n===-1||e>-1&&n>e,h=r>0,c=e>-1?a[e-1]!=="/":!a.endsWith("/"),m=!a.startsWith(".");return s&&h&&c&&m&&u&&I&&d};kia.exports=(a,e,{gitHosts:r,protocols:n})=>{if(!a)return;let i=vfi(a)?`github:${a}`:a,o=Gfi(i,n);if(!o)return;let t=r.byShortcut[o.protocol],s=r.byDomain[o.hostname.startsWith("www.")?o.hostname.slice(4):o.hostname],u=t||s;if(!u)return;let I=r[t||s],d=null;n[o.protocol]?.auth&&(o.username||o.password)&&(d=`${o.username}${o.password?":"+o.password:""}`);let h=null,c=null,m=null,G=null;try{if(t){let y=o.pathname.startsWith("/")?o.pathname.slice(1):o.pathname,N=y.indexOf("@");N>-1&&(y=y.slice(N+1));let Z=y.lastIndexOf("/");Z>-1?(c=decodeURIComponent(y.slice(0,Z)),c||(c=null),m=decodeURIComponent(y.slice(Z+1))):m=decodeURIComponent(y),m.endsWith(".git")&&(m=m.slice(0,-4)),o.hash&&(h=decodeURIComponent(o.hash.slice(1))),G="shortcut"}else{if(!I.protocols.includes(o.protocol))return;let y=I.extract(o);if(!y)return;c=y.user&&decodeURIComponent(y.user),m=decodeURIComponent(y.project),h=decodeURIComponent(y.committish),G=n[o.protocol]?.name||o.protocol.slice(0,-1)}}catch(y){if(y instanceof URIError)return;throw y}return[u,c,d,m,h,G,e]}});var Bia=Ze((ZKs,Lia)=>{"use strict";var{LRUCache:yfi}=xia(),Afi=Qia(),Zfi=Sia(),Nfi=LWt(),BWt=new yfi({max:1e3}),uXe=class a{constructor(e,r,n,i,o,t,s={}){Object.assign(this,a.#e[e],{type:e,user:r,auth:n,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){a.#e[e]=r,a.#e.byDomain[r.domain]=e,a.#e.byShortcut[`${e}:`]=e,a.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!BWt.has(n)){let i=Zfi(e,r,{gitHosts:a.#e,protocols:a.#t});BWt.set(n,i?new a(...i):void 0)}return BWt.get(n)}static parseUrl(e){return Nfi(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let i=e(n);return n.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[a,e]of Object.entries(Afi))uXe.addHost(a,e);Lia.exports=uXe});var Tia=Ze((NKs,Jia)=>{Jia.exports=Wfi;function Wfi(a){if(!a||a==="ERROR: No README data found!")return;a=a.trim().split(`
|
|
4853
|
-
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var Dia=Ze((WKs,Ffi)=>{Ffi.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 _ia=Ze((FKs,Uia)=>{var Efi=Vrt(),wfi=Qrt(),Rfi=Fia(),dXe=Bia(),Cfi=Wt("node:module"),xfi=["dependencies","devDependencies","optionalDependencies"],Yfi=Tia(),JWt=Wt("url"),tH=Dia(),Oia=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");Uia.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=dXe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(tH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,tH.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):tH.script[e]&&!a.scripts[tH.script[e]]&&this.warn("typo",e,tH.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){Bfi(a,this.warn),Sfi(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=dXe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!Efi(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=wfi(a.version,r),!0},fixPeople:function(a){Mia(a,Xfi),Mia(a,kfi)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),Hfi(a.name,r,e.allowLegacyCase),Cfi.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=Yfi(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=dXe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")Oia(a.bugs)?a.bugs={email:a.bugs}:JWt.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{Jfi(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&JWt.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Oia(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=dXe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;JWt.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Rfi(e).validForNewPackages)return this.warn("invalidLicense")}};function Vfi(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Qfi(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function Hfi(a,e,r){if(a.charAt(0)==="."||!(Vfi(a)||Qfi(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function Mia(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function Xfi(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,o=i?" <"+i+">":"";return e+o+n}function kfi(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function Sfi(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function Lfi(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[o]=t}),n}function Bfi(a,e){xfi.forEach(function(r){a[r]&&(a[r]=Lfi(a[r],r,e))})}function Jfi(a,e){a&&Object.keys(a).forEach(function(r){tH.bugs[r]&&(e("typo",r,tH.bugs[r],"bugs"),a[tH.bugs[r]]=a[r],delete a[r])})}});var zia=Ze((EKs,Tfi)=>{Tfi.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 qia=Ze((wKs,jia)=>{var Pia=Wt("util"),TWt=zia();jia.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return Dfi.apply(null,a);var r=TWt[e]?TWt[e]:e+": '%s'";return a.unshift(r),Pia.format.apply(null,a)};function Dfi(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),Pia.format(TWt.typo,a,e)}});var tsa=Ze((RKs,esa)=>{esa.exports=Kia;var DWt=_ia();Kia.fixer=DWt;var Ofi=qia(),Mfi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Ufi=["dependencies","people","typos"],OWt=Mfi.map(function(a){return $ia(a)+"Field"});OWt=OWt.concat(Ufi);function Kia(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),DWt.warn=function(){e(Ofi.apply(null,arguments))},OWt.forEach(function(n){DWt["fix"+$ia(n)](a,r)}),a._id=a.name+"@"+a.version}function $ia(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var rsa=ct(()=>{});import{fileURLToPath as _fi}from"node:url";function asa(a){return a instanceof URL?_fi(a):a}var nsa=ct(()=>{rsa()});import zfi from"node:fs/promises";import Pfi from"node:path";async function ssa({cwd:a,normalize:e=!0}={}){let r=await zfi.readFile(jfi(a),"utf8");return qfi(r,e)}var isa,jfi,qfi,osa=ct(()=>{sia();isa=Lt(tsa(),1);nsa();jfi=a=>Pfi.resolve(asa(a)??".","package.json"),qfi=(a,e)=>{let r=typeof a=="string"?CWt(a):a;return e&&(0,isa.default)(r),r}});import Kfi from"node:path";async function lsa(a){let e=await Yna("package.json",a);if(e)return{packageJson:await ssa({...a,cwd:Kfi.dirname(e)}),path:e}}var csa=ct(()=>{Vna();osa()});import{fileURLToPath as $fi}from"url";import ebi from"path";async function wK(){if(IXe)return IXe;let a=await lsa({cwd:rbi});if(a)return IXe=a.packageJson,IXe}var tbi,rbi,IXe,hXe=ct(()=>{"use strict";csa();tbi=$fi(import.meta.url),rbi=ebi.dirname(tbi)});var usa={};oo(usa,{getCliVersion:()=>KC});async function KC(){let a=await wK();return"1.1.7"}var RK=ct(()=>{"use strict";hXe();});var GFt=Ze((dso,Gla)=>{Gla.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Ala=Ze((Iso,yla)=>{var $gi=GFt();function vla(a){this.mode=$gi.MODE_8BIT_BYTE,this.data=a}vla.prototype={getLength:function(){return this.data.length},write:function(a){for(var e=0;e<this.data.length;e++)a.put(this.data.charCodeAt(e),8)}};yla.exports=vla});var vFt=Ze((hso,Zla)=>{var VW={glog:function(a){if(a<1)throw new Error("glog("+a+")");return VW.LOG_TABLE[a]},gexp:function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return VW.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(f0=0;f0<8;f0++)VW.EXP_TABLE[f0]=1<<f0;var f0;for(f0=8;f0<256;f0++)VW.EXP_TABLE[f0]=VW.EXP_TABLE[f0-4]^VW.EXP_TABLE[f0-5]^VW.EXP_TABLE[f0-6]^VW.EXP_TABLE[f0-8];var f0;for(f0=0;f0<255;f0++)VW.LOG_TABLE[VW.EXP_TABLE[f0]]=f0;var f0;Zla.exports=VW});var yFt=Ze((mso,Nla)=>{var vJ=vFt();function QXe(a,e){if(a.length===void 0)throw new Error(a.length+"/"+e);for(var r=0;r<a.length&&a[r]===0;)r++;this.num=new Array(a.length-r+e);for(var n=0;n<a.length-r;n++)this.num[n]=a[n+r]}QXe.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var e=new Array(this.getLength()+a.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<a.getLength();n++)e[r+n]^=vJ.gexp(vJ.glog(this.get(r))+vJ.glog(a.get(n)));return new QXe(e,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var e=vJ.glog(this.get(0))-vJ.glog(a.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var i=0;i<a.getLength();i++)r[i]^=vJ.gexp(vJ.glog(a.get(i))+e);return new QXe(r,0).mod(a)}};Nla.exports=QXe});var Fla=Ze((pso,Wla)=>{Wla.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Rla=Ze((fso,wla)=>{var OZ=GFt(),Ela=yFt(),eGi=vFt(),sH=Fla(),yf={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var e=a<<10;yf.getBCHDigit(e)-yf.getBCHDigit(yf.G15)>=0;)e^=yf.G15<<yf.getBCHDigit(e)-yf.getBCHDigit(yf.G15);return(a<<10|e)^yf.G15_MASK},getBCHTypeNumber:function(a){for(var e=a<<12;yf.getBCHDigit(e)-yf.getBCHDigit(yf.G18)>=0;)e^=yf.G18<<yf.getBCHDigit(e)-yf.getBCHDigit(yf.G18);return a<<12|e},getBCHDigit:function(a){for(var e=0;a!==0;)e++,a>>>=1;return e},getPatternPosition:function(a){return yf.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,e,r){switch(a){case sH.PATTERN000:return(e+r)%2===0;case sH.PATTERN001:return e%2===0;case sH.PATTERN010:return r%3===0;case sH.PATTERN011:return(e+r)%3===0;case sH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case sH.PATTERN101:return e*r%2+e*r%3===0;case sH.PATTERN110:return(e*r%2+e*r%3)%2===0;case sH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var e=new Ela([1],0),r=0;r<a;r++)e=e.multiply(new Ela([1,eGi.gexp(r)],0));return e},getLengthInBits:function(a,e){if(1<=e&&e<10)switch(a){case OZ.MODE_NUMBER:return 10;case OZ.MODE_ALPHA_NUM:return 9;case OZ.MODE_8BIT_BYTE:return 8;case OZ.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(e<27)switch(a){case OZ.MODE_NUMBER:return 12;case OZ.MODE_ALPHA_NUM:return 11;case OZ.MODE_8BIT_BYTE:return 16;case OZ.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else if(e<41)switch(a){case OZ.MODE_NUMBER:return 14;case OZ.MODE_ALPHA_NUM:return 13;case OZ.MODE_8BIT_BYTE:return 16;case OZ.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}else throw new Error("type:"+e)},getLostPoint:function(a){var e=a.getModuleCount(),r=0,n=0,i=0;for(n=0;n<e;n++)for(i=0;i<e;i++){for(var o=0,t=a.isDark(n,i),s=-1;s<=1;s++)if(!(n+s<0||e<=n+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===a.isDark(n+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(n=0;n<e-1;n++)for(i=0;i<e-1;i++){var I=0;a.isDark(n,i)&&I++,a.isDark(n+1,i)&&I++,a.isDark(n,i+1)&&I++,a.isDark(n+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(n=0;n<e;n++)for(i=0;i<e-6;i++)a.isDark(n,i)&&!a.isDark(n,i+1)&&a.isDark(n,i+2)&&a.isDark(n,i+3)&&a.isDark(n,i+4)&&!a.isDark(n,i+5)&&a.isDark(n,i+6)&&(r+=40);for(i=0;i<e;i++)for(n=0;n<e-6;n++)a.isDark(n,i)&&!a.isDark(n+1,i)&&a.isDark(n+2,i)&&a.isDark(n+3,i)&&a.isDark(n+4,i)&&!a.isDark(n+5,i)&&a.isDark(n+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(n=0;n<e;n++)a.isDark(n,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};wla.exports=yf});var AFt=Ze((bso,Cla)=>{Cla.exports={L:1,M:0,Q:3,H:2}});var Yla=Ze((gso,xla)=>{var HXe=AFt();function qw(a,e){this.totalCount=a,this.dataCount=e}qw.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];qw.getRSBlocks=function(a,e){var r=qw.getRsBlockTable(a,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+e);for(var n=r.length/3,i=[],o=0;o<n;o++)for(var t=r[o*3+0],s=r[o*3+1],u=r[o*3+2],I=0;I<t;I++)i.push(new qw(s,u));return i};qw.getRsBlockTable=function(a,e){switch(e){case HXe.L:return qw.RS_BLOCK_TABLE[(a-1)*4+0];case HXe.M:return qw.RS_BLOCK_TABLE[(a-1)*4+1];case HXe.Q:return qw.RS_BLOCK_TABLE[(a-1)*4+2];case HXe.H:return qw.RS_BLOCK_TABLE[(a-1)*4+3];default:return}};xla.exports=qw});var Hla=Ze((Gso,Qla)=>{function Vla(){this.buffer=[],this.length=0}Vla.prototype={get:function(a){var e=Math.floor(a/8);return(this.buffer[e]>>>7-a%8&1)==1},put:function(a,e){for(var r=0;r<e;r++)this.putBit((a>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(a){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),a&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Qla.exports=Vla});var Lla=Ze((vso,Sla)=>{var tGi=Ala(),oH=Rla(),rGi=yFt(),Xla=Yla(),kla=Hla();function Kw(a,e){this.typeNumber=a,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}Kw.prototype={addData:function(a){var e=new tGi(a);this.dataList.push(e),this.dataCache=null},isDark:function(a,e){if(a<0||this.moduleCount<=a||e<0||this.moduleCount<=e)throw new Error(a+","+e);return this.modules[a][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var a=1;for(a=1;a<40;a++){for(var e=Xla.getRSBlocks(a,this.errorCorrectLevel),r=new kla,n=0,i=0;i<e.length;i++)n+=e[i].dataCount;for(var o=0;o<this.dataList.length;o++){var t=this.dataList[o];r.put(t.mode,4),r.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(r)}if(r.getLengthInBits()<=n*8)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,e),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache===null&&(this.dataCache=Kw.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(a,e){for(var r=-1;r<=7;r++)if(!(a+r<=-1||this.moduleCount<=a+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n===0||n===6)||0<=n&&n<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[a+r][e+n]=!0:this.modules[a+r][e+n]=!1)},getBestMaskPattern:function(){for(var a=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=oH.getLostPoint(this);(r===0||a>n)&&(a=n,e=r)}return e},createMovieClip:function(a,e,r){var n=a.createEmptyMovieClip(e,r),i=1;this.make();for(var o=0;o<this.modules.length;o++)for(var t=o*i,s=0;s<this.modules[o].length;s++){var u=s*i,I=this.modules[o][s];I&&(n.beginFill(0,100),n.moveTo(u,t),n.lineTo(u+i,t),n.lineTo(u+i,t+i),n.lineTo(u,t+i),n.endFill())}return n},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)this.modules[a][6]===null&&(this.modules[a][6]=a%2===0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]===null&&(this.modules[6][e]=e%2===0)},setupPositionAdjustPattern:function(){for(var a=oH.getPatternPosition(this.typeNumber),e=0;e<a.length;e++)for(var r=0;r<a.length;r++){var n=a[e],i=a[r];if(this.modules[n][i]===null)for(var o=-2;o<=2;o++)for(var t=-2;t<=2;t++)Math.abs(o)===2||Math.abs(t)===2||o===0&&t===0?this.modules[n+o][i+t]=!0:this.modules[n+o][i+t]=!1}},setupTypeNumber:function(a){for(var e=oH.getBCHTypeNumber(this.typeNumber),r,n=0;n<18;n++)r=!a&&(e>>n&1)===1,this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!a&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(a,e){for(var r=this.errorCorrectLevel<<3|e,n=oH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!a&&(n>>o&1)===1,o<6?this.modules[o][8]=i:o<8?this.modules[o+1][8]=i:this.modules[this.moduleCount-15+o][8]=i;for(var t=0;t<15;t++)i=!a&&(n>>t&1)===1,t<8?this.modules[8][this.moduleCount-t-1]=i:t<9?this.modules[8][15-t-1+1]=i:this.modules[8][15-t-1]=i;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,e){for(var r=-1,n=this.moduleCount-1,i=7,o=0,t=this.moduleCount-1;t>0;t-=2)for(t===6&&t--;;){for(var s=0;s<2;s++)if(this.modules[n][t-s]===null){var u=!1;o<a.length&&(u=(a[o]>>>i&1)===1);var I=oH.getMask(e,n,t-s);I&&(u=!u),this.modules[n][t-s]=u,i--,i===-1&&(o++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};Kw.PAD0=236;Kw.PAD1=17;Kw.createData=function(a,e,r){for(var n=Xla.getRSBlocks(a,e),i=new kla,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(i)}for(var s=0,u=0;u<n.length;u++)s+=n[u].dataCount;if(i.getLengthInBits()>s*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+s*8+")");for(i.getLengthInBits()+4<=s*8&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(!1);for(;!(i.getLengthInBits()>=s*8||(i.put(Kw.PAD0,8),i.getLengthInBits()>=s*8));)i.put(Kw.PAD1,8);return Kw.createBytes(i,n)};Kw.createBytes=function(a,e){for(var r=0,n=0,i=0,o=new Array(e.length),t=new Array(e.length),s=0;s<e.length;s++){var u=e[s].dataCount,I=e[s].totalCount-u;n=Math.max(n,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&a.buffer[d+r];r+=u;var h=oH.getErrorCorrectPolynomial(I),c=new rGi(o[s],h.getLength()-1),m=c.mod(h);t[s]=new Array(h.getLength()-1);for(var G=0;G<t[s].length;G++){var y=G+m.getLength()-t[s].length;t[s][G]=y>=0?m.get(y):0}}for(var N=0,Z=0;Z<e.length;Z++)N+=e[Z].totalCount;for(var R=new Array(N),F=0,w=0;w<n;w++)for(var b=0;b<e.length;b++)w<o[b].length&&(R[F++]=o[b][w]);for(var v=0;v<i;v++)for(var A=0;A<e.length;A++)v<t[A].length&&(R[F++]=t[A][v]);return R};Sla.exports=Kw});var Tla=Ze((yso,Jla)=>{var aGi=Lla(),Bla=AFt(),nGi="\x1B[40m \x1B[0m",XXe="\x1B[47m \x1B[0m",iGi=function(a){return a?nGi:XXe},ZFt=function(a){return{times:function(e){return new Array(e).join(a)}}},sGi=function(a,e){for(var r=new Array(a),n=0;n<a;n++)r[n]=e;return r};Jla.exports={error:Bla.L,generate:function(a,e,r){typeof e=="function"&&(r=e,e={});var n=new aGi(-1,this.error);n.addData(a),n.make();var i="";if(e&&e.small){var o=!0,t=!1,s=n.getModuleCount(),u=n.modules.slice(),I=s%2===1;I&&u.push(sGi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=ZFt(d.BLACK_WHITE).times(s+3),c=ZFt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
4853
|
+
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var Dia=Ze((WKs,Ffi)=>{Ffi.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 _ia=Ze((FKs,Uia)=>{var Efi=Vrt(),wfi=Qrt(),Rfi=Fia(),dXe=Bia(),Cfi=Wt("node:module"),xfi=["dependencies","devDependencies","optionalDependencies"],Yfi=Tia(),JWt=Wt("url"),tH=Dia(),Oia=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");Uia.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=dXe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(tH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,tH.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):tH.script[e]&&!a.scripts[tH.script[e]]&&this.warn("typo",e,tH.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){Bfi(a,this.warn),Sfi(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=dXe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!Efi(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=wfi(a.version,r),!0},fixPeople:function(a){Mia(a,Xfi),Mia(a,kfi)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),Hfi(a.name,r,e.allowLegacyCase),Cfi.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=Yfi(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=dXe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")Oia(a.bugs)?a.bugs={email:a.bugs}:JWt.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{Jfi(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&JWt.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Oia(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=dXe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;JWt.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Rfi(e).validForNewPackages)return this.warn("invalidLicense")}};function Vfi(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Qfi(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function Hfi(a,e,r){if(a.charAt(0)==="."||!(Vfi(a)||Qfi(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function Mia(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function Xfi(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,o=i?" <"+i+">":"";return e+o+n}function kfi(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function Sfi(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function Lfi(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[o]=t}),n}function Bfi(a,e){xfi.forEach(function(r){a[r]&&(a[r]=Lfi(a[r],r,e))})}function Jfi(a,e){a&&Object.keys(a).forEach(function(r){tH.bugs[r]&&(e("typo",r,tH.bugs[r],"bugs"),a[tH.bugs[r]]=a[r],delete a[r])})}});var zia=Ze((EKs,Tfi)=>{Tfi.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 qia=Ze((wKs,jia)=>{var Pia=Wt("util"),TWt=zia();jia.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return Dfi.apply(null,a);var r=TWt[e]?TWt[e]:e+": '%s'";return a.unshift(r),Pia.format.apply(null,a)};function Dfi(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),Pia.format(TWt.typo,a,e)}});var tsa=Ze((RKs,esa)=>{esa.exports=Kia;var DWt=_ia();Kia.fixer=DWt;var Ofi=qia(),Mfi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Ufi=["dependencies","people","typos"],OWt=Mfi.map(function(a){return $ia(a)+"Field"});OWt=OWt.concat(Ufi);function Kia(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),DWt.warn=function(){e(Ofi.apply(null,arguments))},OWt.forEach(function(n){DWt["fix"+$ia(n)](a,r)}),a._id=a.name+"@"+a.version}function $ia(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var rsa=ct(()=>{});import{fileURLToPath as _fi}from"node:url";function asa(a){return a instanceof URL?_fi(a):a}var nsa=ct(()=>{rsa()});import zfi from"node:fs/promises";import Pfi from"node:path";async function ssa({cwd:a,normalize:e=!0}={}){let r=await zfi.readFile(jfi(a),"utf8");return qfi(r,e)}var isa,jfi,qfi,osa=ct(()=>{sia();isa=Lt(tsa(),1);nsa();jfi=a=>Pfi.resolve(asa(a)??".","package.json"),qfi=(a,e)=>{let r=typeof a=="string"?CWt(a):a;return e&&(0,isa.default)(r),r}});import Kfi from"node:path";async function lsa(a){let e=await Yna("package.json",a);if(e)return{packageJson:await ssa({...a,cwd:Kfi.dirname(e)}),path:e}}var csa=ct(()=>{Vna();osa()});import{fileURLToPath as $fi}from"url";import ebi from"path";async function wK(){if(IXe)return IXe;let a=await lsa({cwd:rbi});if(a)return IXe=a.packageJson,IXe}var tbi,rbi,IXe,hXe=ct(()=>{"use strict";csa();tbi=$fi(import.meta.url),rbi=ebi.dirname(tbi)});var usa={};oo(usa,{getCliVersion:()=>KC});async function KC(){let a=await wK();return"1.1.8"}var RK=ct(()=>{"use strict";hXe();});var GFt=Ze((dso,Gla)=>{Gla.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Ala=Ze((Iso,yla)=>{var $gi=GFt();function vla(a){this.mode=$gi.MODE_8BIT_BYTE,this.data=a}vla.prototype={getLength:function(){return this.data.length},write:function(a){for(var e=0;e<this.data.length;e++)a.put(this.data.charCodeAt(e),8)}};yla.exports=vla});var vFt=Ze((hso,Zla)=>{var VW={glog:function(a){if(a<1)throw new Error("glog("+a+")");return VW.LOG_TABLE[a]},gexp:function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return VW.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(f0=0;f0<8;f0++)VW.EXP_TABLE[f0]=1<<f0;var f0;for(f0=8;f0<256;f0++)VW.EXP_TABLE[f0]=VW.EXP_TABLE[f0-4]^VW.EXP_TABLE[f0-5]^VW.EXP_TABLE[f0-6]^VW.EXP_TABLE[f0-8];var f0;for(f0=0;f0<255;f0++)VW.LOG_TABLE[VW.EXP_TABLE[f0]]=f0;var f0;Zla.exports=VW});var yFt=Ze((mso,Nla)=>{var vJ=vFt();function QXe(a,e){if(a.length===void 0)throw new Error(a.length+"/"+e);for(var r=0;r<a.length&&a[r]===0;)r++;this.num=new Array(a.length-r+e);for(var n=0;n<a.length-r;n++)this.num[n]=a[n+r]}QXe.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var e=new Array(this.getLength()+a.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<a.getLength();n++)e[r+n]^=vJ.gexp(vJ.glog(this.get(r))+vJ.glog(a.get(n)));return new QXe(e,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var e=vJ.glog(this.get(0))-vJ.glog(a.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var i=0;i<a.getLength();i++)r[i]^=vJ.gexp(vJ.glog(a.get(i))+e);return new QXe(r,0).mod(a)}};Nla.exports=QXe});var Fla=Ze((pso,Wla)=>{Wla.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Rla=Ze((fso,wla)=>{var OZ=GFt(),Ela=yFt(),eGi=vFt(),sH=Fla(),yf={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var e=a<<10;yf.getBCHDigit(e)-yf.getBCHDigit(yf.G15)>=0;)e^=yf.G15<<yf.getBCHDigit(e)-yf.getBCHDigit(yf.G15);return(a<<10|e)^yf.G15_MASK},getBCHTypeNumber:function(a){for(var e=a<<12;yf.getBCHDigit(e)-yf.getBCHDigit(yf.G18)>=0;)e^=yf.G18<<yf.getBCHDigit(e)-yf.getBCHDigit(yf.G18);return a<<12|e},getBCHDigit:function(a){for(var e=0;a!==0;)e++,a>>>=1;return e},getPatternPosition:function(a){return yf.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,e,r){switch(a){case sH.PATTERN000:return(e+r)%2===0;case sH.PATTERN001:return e%2===0;case sH.PATTERN010:return r%3===0;case sH.PATTERN011:return(e+r)%3===0;case sH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case sH.PATTERN101:return e*r%2+e*r%3===0;case sH.PATTERN110:return(e*r%2+e*r%3)%2===0;case sH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var e=new Ela([1],0),r=0;r<a;r++)e=e.multiply(new Ela([1,eGi.gexp(r)],0));return e},getLengthInBits:function(a,e){if(1<=e&&e<10)switch(a){case OZ.MODE_NUMBER:return 10;case OZ.MODE_ALPHA_NUM:return 9;case OZ.MODE_8BIT_BYTE:return 8;case OZ.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(e<27)switch(a){case OZ.MODE_NUMBER:return 12;case OZ.MODE_ALPHA_NUM:return 11;case OZ.MODE_8BIT_BYTE:return 16;case OZ.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else if(e<41)switch(a){case OZ.MODE_NUMBER:return 14;case OZ.MODE_ALPHA_NUM:return 13;case OZ.MODE_8BIT_BYTE:return 16;case OZ.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}else throw new Error("type:"+e)},getLostPoint:function(a){var e=a.getModuleCount(),r=0,n=0,i=0;for(n=0;n<e;n++)for(i=0;i<e;i++){for(var o=0,t=a.isDark(n,i),s=-1;s<=1;s++)if(!(n+s<0||e<=n+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===a.isDark(n+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(n=0;n<e-1;n++)for(i=0;i<e-1;i++){var I=0;a.isDark(n,i)&&I++,a.isDark(n+1,i)&&I++,a.isDark(n,i+1)&&I++,a.isDark(n+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(n=0;n<e;n++)for(i=0;i<e-6;i++)a.isDark(n,i)&&!a.isDark(n,i+1)&&a.isDark(n,i+2)&&a.isDark(n,i+3)&&a.isDark(n,i+4)&&!a.isDark(n,i+5)&&a.isDark(n,i+6)&&(r+=40);for(i=0;i<e;i++)for(n=0;n<e-6;n++)a.isDark(n,i)&&!a.isDark(n+1,i)&&a.isDark(n+2,i)&&a.isDark(n+3,i)&&a.isDark(n+4,i)&&!a.isDark(n+5,i)&&a.isDark(n+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(n=0;n<e;n++)a.isDark(n,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};wla.exports=yf});var AFt=Ze((bso,Cla)=>{Cla.exports={L:1,M:0,Q:3,H:2}});var Yla=Ze((gso,xla)=>{var HXe=AFt();function qw(a,e){this.totalCount=a,this.dataCount=e}qw.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];qw.getRSBlocks=function(a,e){var r=qw.getRsBlockTable(a,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+e);for(var n=r.length/3,i=[],o=0;o<n;o++)for(var t=r[o*3+0],s=r[o*3+1],u=r[o*3+2],I=0;I<t;I++)i.push(new qw(s,u));return i};qw.getRsBlockTable=function(a,e){switch(e){case HXe.L:return qw.RS_BLOCK_TABLE[(a-1)*4+0];case HXe.M:return qw.RS_BLOCK_TABLE[(a-1)*4+1];case HXe.Q:return qw.RS_BLOCK_TABLE[(a-1)*4+2];case HXe.H:return qw.RS_BLOCK_TABLE[(a-1)*4+3];default:return}};xla.exports=qw});var Hla=Ze((Gso,Qla)=>{function Vla(){this.buffer=[],this.length=0}Vla.prototype={get:function(a){var e=Math.floor(a/8);return(this.buffer[e]>>>7-a%8&1)==1},put:function(a,e){for(var r=0;r<e;r++)this.putBit((a>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(a){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),a&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Qla.exports=Vla});var Lla=Ze((vso,Sla)=>{var tGi=Ala(),oH=Rla(),rGi=yFt(),Xla=Yla(),kla=Hla();function Kw(a,e){this.typeNumber=a,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}Kw.prototype={addData:function(a){var e=new tGi(a);this.dataList.push(e),this.dataCache=null},isDark:function(a,e){if(a<0||this.moduleCount<=a||e<0||this.moduleCount<=e)throw new Error(a+","+e);return this.modules[a][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var a=1;for(a=1;a<40;a++){for(var e=Xla.getRSBlocks(a,this.errorCorrectLevel),r=new kla,n=0,i=0;i<e.length;i++)n+=e[i].dataCount;for(var o=0;o<this.dataList.length;o++){var t=this.dataList[o];r.put(t.mode,4),r.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(r)}if(r.getLengthInBits()<=n*8)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,e),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache===null&&(this.dataCache=Kw.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(a,e){for(var r=-1;r<=7;r++)if(!(a+r<=-1||this.moduleCount<=a+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n===0||n===6)||0<=n&&n<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[a+r][e+n]=!0:this.modules[a+r][e+n]=!1)},getBestMaskPattern:function(){for(var a=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=oH.getLostPoint(this);(r===0||a>n)&&(a=n,e=r)}return e},createMovieClip:function(a,e,r){var n=a.createEmptyMovieClip(e,r),i=1;this.make();for(var o=0;o<this.modules.length;o++)for(var t=o*i,s=0;s<this.modules[o].length;s++){var u=s*i,I=this.modules[o][s];I&&(n.beginFill(0,100),n.moveTo(u,t),n.lineTo(u+i,t),n.lineTo(u+i,t+i),n.lineTo(u,t+i),n.endFill())}return n},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)this.modules[a][6]===null&&(this.modules[a][6]=a%2===0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]===null&&(this.modules[6][e]=e%2===0)},setupPositionAdjustPattern:function(){for(var a=oH.getPatternPosition(this.typeNumber),e=0;e<a.length;e++)for(var r=0;r<a.length;r++){var n=a[e],i=a[r];if(this.modules[n][i]===null)for(var o=-2;o<=2;o++)for(var t=-2;t<=2;t++)Math.abs(o)===2||Math.abs(t)===2||o===0&&t===0?this.modules[n+o][i+t]=!0:this.modules[n+o][i+t]=!1}},setupTypeNumber:function(a){for(var e=oH.getBCHTypeNumber(this.typeNumber),r,n=0;n<18;n++)r=!a&&(e>>n&1)===1,this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!a&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(a,e){for(var r=this.errorCorrectLevel<<3|e,n=oH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!a&&(n>>o&1)===1,o<6?this.modules[o][8]=i:o<8?this.modules[o+1][8]=i:this.modules[this.moduleCount-15+o][8]=i;for(var t=0;t<15;t++)i=!a&&(n>>t&1)===1,t<8?this.modules[8][this.moduleCount-t-1]=i:t<9?this.modules[8][15-t-1+1]=i:this.modules[8][15-t-1]=i;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,e){for(var r=-1,n=this.moduleCount-1,i=7,o=0,t=this.moduleCount-1;t>0;t-=2)for(t===6&&t--;;){for(var s=0;s<2;s++)if(this.modules[n][t-s]===null){var u=!1;o<a.length&&(u=(a[o]>>>i&1)===1);var I=oH.getMask(e,n,t-s);I&&(u=!u),this.modules[n][t-s]=u,i--,i===-1&&(o++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};Kw.PAD0=236;Kw.PAD1=17;Kw.createData=function(a,e,r){for(var n=Xla.getRSBlocks(a,e),i=new kla,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(i)}for(var s=0,u=0;u<n.length;u++)s+=n[u].dataCount;if(i.getLengthInBits()>s*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+s*8+")");for(i.getLengthInBits()+4<=s*8&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(!1);for(;!(i.getLengthInBits()>=s*8||(i.put(Kw.PAD0,8),i.getLengthInBits()>=s*8));)i.put(Kw.PAD1,8);return Kw.createBytes(i,n)};Kw.createBytes=function(a,e){for(var r=0,n=0,i=0,o=new Array(e.length),t=new Array(e.length),s=0;s<e.length;s++){var u=e[s].dataCount,I=e[s].totalCount-u;n=Math.max(n,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&a.buffer[d+r];r+=u;var h=oH.getErrorCorrectPolynomial(I),c=new rGi(o[s],h.getLength()-1),m=c.mod(h);t[s]=new Array(h.getLength()-1);for(var G=0;G<t[s].length;G++){var y=G+m.getLength()-t[s].length;t[s][G]=y>=0?m.get(y):0}}for(var N=0,Z=0;Z<e.length;Z++)N+=e[Z].totalCount;for(var R=new Array(N),F=0,w=0;w<n;w++)for(var b=0;b<e.length;b++)w<o[b].length&&(R[F++]=o[b][w]);for(var v=0;v<i;v++)for(var A=0;A<e.length;A++)v<t[A].length&&(R[F++]=t[A][v]);return R};Sla.exports=Kw});var Tla=Ze((yso,Jla)=>{var aGi=Lla(),Bla=AFt(),nGi="\x1B[40m \x1B[0m",XXe="\x1B[47m \x1B[0m",iGi=function(a){return a?nGi:XXe},ZFt=function(a){return{times:function(e){return new Array(e).join(a)}}},sGi=function(a,e){for(var r=new Array(a),n=0;n<a;n++)r[n]=e;return r};Jla.exports={error:Bla.L,generate:function(a,e,r){typeof e=="function"&&(r=e,e={});var n=new aGi(-1,this.error);n.addData(a),n.make();var i="";if(e&&e.small){var o=!0,t=!1,s=n.getModuleCount(),u=n.modules.slice(),I=s%2===1;I&&u.push(sGi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=ZFt(d.BLACK_WHITE).times(s+3),c=ZFt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
4854
4854
|
`;for(var m=0;m<s;m+=2){i+=d.WHITE_ALL;for(var G=0;G<s;G++)u[m][G]===t&&u[m+1][G]===t?i+=d.WHITE_ALL:u[m][G]===t&&u[m+1][G]===o?i+=d.WHITE_BLACK:u[m][G]===o&&u[m+1][G]===t?i+=d.BLACK_WHITE:i+=d.BLACK_ALL;i+=d.WHITE_ALL+`
|
|
4855
4855
|
`}I||(i+=c)}else{var y=ZFt(XXe).times(n.getModuleCount()+3);i+=y+`
|
|
4856
4856
|
`,n.modules.forEach(function(N){i+=XXe,i+=N.map(iGi).join(""),i+=XXe+`
|
|
@@ -6485,7 +6485,7 @@ ${I.filter(Boolean).join(`
|
|
|
6485
6485
|
|
|
6486
6486
|
\u{1F4A1} **${R}**`,w=G.map(A=>({label:N.includes(A.label)?`\u2705 ${A.label}`:A.label,value:A.label}));w.push({label:"\u{1F197} \u786E\u5B9A\u63D0\u4EA4",value:"__submit__"}),w.push({label:"\u23ED \u8DF3\u8FC7",value:"__skip__"});let b=m.header?`[\u591A\u9009] ${m.header}: ${m.question}`:`[\u591A\u9009] ${m.question}`,v=await a.waitForCardAction(e,b,F,w,"__timeout__",bRt,r);if(v==="__timeout__")await a.sendMessage(e,"\u23F0 \u7B49\u5F85\u8D85\u65F6 \u2014 \u672A\u6536\u5230\u56DE\u7B54"),s[m.question]="\u7528\u6237\u672A\u5728\u89C4\u5B9A\u65F6\u95F4\u5185\u56DE\u7B54\uFF0C\u8BF7\u81EA\u884C\u51B3\u7B56",Z=!0;else if(v==="__skip__")await a.sendMessage(e,"\u23ED \u5DF2\u8DF3\u8FC7"),s[m.question]="\u7528\u6237\u9009\u62E9\u8DF3\u8FC7\uFF0C\u8BF7\u81EA\u884C\u51B3\u7B56",Z=!0;else if(v==="__submit__")if(N.length===0)await a.sendMessage(e,"\u26A0\uFE0F \u4F60\u5C1A\u672A\u9009\u62E9\u4EFB\u4F55\u9009\u9879\uFF0C\u8BF7\u5148\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u9009\u9879\uFF0C\u6216\u70B9\u51FB\u201C\u8DF3\u8FC7\u201D\u3002");else{let A=N.join(", ");await a.sendMessage(e,`\u2705 \u5DF2\u9009\u62E9: ${A}`),s[m.question]=A,Z=!0}else N.includes(v)?N=N.filter(A=>A!==v):N.push(v)}}else{let N=y.join(`
|
|
6487
6487
|
|
|
6488
|
-
`),Z=G.map(w=>({label:w.label,value:w.label}));Z.push({label:"\u23ED \u8DF3\u8FC7",value:"__skip__"});let R=m.header?`${m.header}: ${m.question}`:m.question,F=await a.waitForCardAction(e,R,N,Z,"__timeout__",bRt,r);{let w;F==="__timeout__"?w="\u23F0 \u7B49\u5F85\u8D85\u65F6 \u2014 \u672A\u6536\u5230\u56DE\u7B54":F==="__skip__"?w="\u23ED \u5DF2\u8DF3\u8FC7":w=`\u2705 \u5DF2\u9009\u62E9: ${F}`,await a.sendMessage(e,w)}F==="__timeout__"?s[m.question]="\u7528\u6237\u672A\u5728\u89C4\u5B9A\u65F6\u95F4\u5185\u56DE\u7B54\uFF0C\u8BF7\u81EA\u884C\u51B3\u7B56":F==="__skip__"?s[m.question]="\u7528\u6237\u9009\u62E9\u8DF3\u8FC7\uFF0C\u8BF7\u81EA\u884C\u51B3\u7B56":s[m.question]=F}}let h=Object.entries(s).map(([m,G])=>`"${m}"="${G}"`).join(", "),c=h?`User has answered your questions: ${h}. You can now continue with the user's answers in mind.`:"User has answered your questions (no answers provided).";return{functionResponse:{id:i,name:"ask_user_question",response:{output:c}}}}var aRi={"/new":"\u65B0\u5EFA\u4F1A\u8BDD\uFF08\u91CD\u7F6E\u5BF9\u8BDD\u5386\u53F2\uFF0C\u4FDD\u7559\u5DE5\u5177\u80FD\u529B\uFF09","/compress":"\u538B\u7F29\u5BF9\u8BDD\u5386\u53F2\uFF08\u91CA\u653E\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF09","/
|
|
6488
|
+
`),Z=G.map(w=>({label:w.label,value:w.label}));Z.push({label:"\u23ED \u8DF3\u8FC7",value:"__skip__"});let R=m.header?`${m.header}: ${m.question}`:m.question,F=await a.waitForCardAction(e,R,N,Z,"__timeout__",bRt,r);{let w;F==="__timeout__"?w="\u23F0 \u7B49\u5F85\u8D85\u65F6 \u2014 \u672A\u6536\u5230\u56DE\u7B54":F==="__skip__"?w="\u23ED \u5DF2\u8DF3\u8FC7":w=`\u2705 \u5DF2\u9009\u62E9: ${F}`,await a.sendMessage(e,w)}F==="__timeout__"?s[m.question]="\u7528\u6237\u672A\u5728\u89C4\u5B9A\u65F6\u95F4\u5185\u56DE\u7B54\uFF0C\u8BF7\u81EA\u884C\u51B3\u7B56":F==="__skip__"?s[m.question]="\u7528\u6237\u9009\u62E9\u8DF3\u8FC7\uFF0C\u8BF7\u81EA\u884C\u51B3\u7B56":s[m.question]=F}}let h=Object.entries(s).map(([m,G])=>`"${m}"="${G}"`).join(", "),c=h?`User has answered your questions: ${h}. You can now continue with the user's answers in mind.`:"User has answered your questions (no answers provided).";return{functionResponse:{id:i,name:"ask_user_question",response:{output:c}}}}var aRi={"/new":"\u65B0\u5EFA\u4F1A\u8BDD\uFF08\u91CD\u7F6E\u5BF9\u8BDD\u5386\u53F2\uFF0C\u4FDD\u7559\u5DE5\u5177\u80FD\u529B\uFF09","/compress":"\u538B\u7F29\u5BF9\u8BDD\u5386\u53F2\uFF08\u91CA\u653E\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF09","/stop":"\u4E2D\u6B62\u5F53\u524D\u6B63\u5728\u8FD0\u884C\u7684 AI \u4EFB\u52A1","/status":"\u67E5\u770B\u5F53\u524D\u7684 CLI \u7248\u672C\u3001\u79EF\u5206\u5269\u4F59\u3001\u5F53\u524D\u6A21\u578B\u3001\u601D\u8003\u6A21\u5F0F\u53CA\u4E0A\u4E0B\u6587\u5927\u5C0F","/thinking":"\u5207\u6362/\u914D\u7F6E AI \u601D\u8003\u6A21\u5F0F\u4E0E\u6DF1\u5EA6","/model":"\u67E5\u770B\u53EF\u7528\u6A21\u578B\uFF0C\u6216\u8F93\u5165 `/model <\u6A21\u578BID>` \u5207\u6362 AI \u6A21\u578B","/bind":"\u7ED1\u5B9A\u672C\u7FA4\u5230\u672C\u5730\u9879\u76EE\u76EE\u5F55\uFF0C\u683C\u5F0F\uFF1A`/bind <\u9879\u76EE\u7EDD\u5BF9\u8DEF\u5F84>`","/goal":"\u542F\u52A8\u76EE\u6807\u9A71\u52A8\u6A21\u5F0F\uFF08`/goal clear` \u7ED3\u675F\uFF09","/feishu restart":"\u70ED\u91CD\u542F\u98DE\u4E66\u673A\u5668\u4EBA\uFF08AI \u5361\u6B7B\u65F6\u4F7F\u7528\uFF09","/help":"\u663E\u793A\u6B64\u5E2E\u52A9"};async function nRi(a,e,r){let n=await BC().catch(()=>"unknown"),i=a?.getModel()||"\u672A\u9009\u62E9",t=a?.getCloudModelInfo?.(i)?.displayName||i,s=a?.getThinkingConfig()||{mode:"auto",effort:"auto"},d=Mo.getInstance().getUserInfo()?.name||"Not Available",h=r?Z$.get(r):null,c=h?.inputTokens||Yd.getLastPromptTokenCount()||0,m=h?.outputTokens||0,G=h?.cacheReadInputTokens||0,y=c+m,N=c>0?(G/c*100).toFixed(1)+"%":"0.0%",Z="Not Available";try{let v=await qC().getCreditsInfo(!0);v&&(Z=v.remainingCredits.toLocaleString())}catch{}let R=$I(i,a||void 0),F=c>0?(c/1e3).toFixed(1)+"k":"0k",w=R>0?(R/1e6).toFixed(1)+"m":"Unknown",b=R>0?(c/R*100).toFixed(0)+"%":"0%";return[`\u24CB **Easy Code** v${n}`,`\u{1F9E0} **Model**: ${t}`,`\u2699\uFE0F **Auth**: ${d}`,"\u{1F9EE} **Token Usage**",` Input: ${c.toLocaleString()}`,` Cache Read: ${G.toLocaleString()}`,` Output: ${m.toLocaleString()}`,` Total: ${y.toLocaleString()}`,` Cache Hit Rate: ${N}`,` Credits: ${h?.creditsUsage!=null?h.creditsUsage:0} / ${Z}`,`\u{1F4DA} **Context**: ${F}/${w} (${b})`,`\u{1F9F5} **Session**: feishu_${r||"unknown"}`,`\u2699\uFE0F **Think**: ${s.mode==="off"?"off":s.effort||"auto"}`].join(`
|
|
6489
6489
|
`)}async function mc(a,e,r){let n={};try{let i=a?.getModel()||"\u672A\u9009\u62E9",o=a?.getCloudModelInfo?.(i);n.model=o?.displayName||i;let t=a?.getThinkingConfig()||{mode:"auto",effort:"auto"};t.mode!=="off"&&(n.status=`\u601D\u8003\u7EA7\u522B: ${t.effort||"auto"}`);let s=$I(i,a||void 0);if(r){let u=r.inputTokens||0,I=r.outputTokens||0;n.tokens={input:u,output:I},r.cacheReadInputTokens>0&&(n.cacheRead=r.cacheReadInputTokens,n.cacheHitRate=u>0?r.cacheReadInputTokens/u*100:0),r.creditsUsage>0&&(n.credits=r.creditsUsage),u>0&&s&&s>0&&(n.contextPercentage=u/s*100)}else{let u=Yd.getLastPromptTokenCount();n.tokens={input:u||0,output:0},u&&s&&s>0&&(n.contextPercentage=u/s*100)}}catch(i){Bi(`Failed to get Feishu status metrics: ${i.message}`)}return n}async function iRi(a,e,r,n){switch(a.split(/\s+/)[0].toLowerCase()){case"/new":try{return await e.resetChat(),`\u2705 \u65B0\u4F1A\u8BDD\u5DF2\u521B\u5EFA
|
|
6490
6490
|
\u{1F4DD} Session ID: ${(await new Os(r?.getProjectRoot()||process.cwd()).createNewSession(void 0,process.cwd())).sessionId}
|
|
6491
6491
|
\u{1F4AC} \u53EF\u4EE5\u5F00\u59CB\u65B0\u7684\u5BF9\u8BDD\u4E86`}catch(o){return`\u274C \u521B\u5EFA\u65B0\u4F1A\u8BDD\u5931\u8D25: ${o.message}`}case"/compress":case"/compact":try{let o=`feishu-compress-${Date.now()}`,t=await e.tryCompressChat(o,new AbortController().signal,!0);return t?`\u2705 \u5BF9\u8BDD\u5DF2\u538B\u7F29
|
|
@@ -6495,7 +6495,7 @@ ${I.filter(Boolean).join(`
|
|
|
6495
6495
|
\u8BF7\u4F7F\u7528 off / auto / low / medium / high / max`}case"/model":{let o=a.split(/\s+/),t=py?.services?.settings;if(!t)return"\u274C settings \u670D\u52A1\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u66F4\u6539\u6A21\u578B\u3002";try{let{modelNames:s,modelInfos:u}=await OC(t,r||void 0);if(o.length===1){let c=["\u{1F916} **\u53EF\u7528\u6A21\u578B\u5217\u8868:**",""];return u.forEach(m=>{let G=`\u2022 **${m.name}** (${m.displayName})`;m.creditsPerRequest&&(G+=` - ${m.creditsPerRequest}x credits`),c.push(G)}),c.push(""),c.push("\u{1F4A1} **\u63D0\u793A**: \u8F93\u5165 `/model <\u6A21\u578B\u540D>` \u5373\u53EF\u5728\u7EBF\u5207\u6362 AI \u6A21\u578B"),c.join(`
|
|
6496
6496
|
`)}let I=o[1].trim(),d=u.find(c=>c.name.toLowerCase()===I.toLowerCase()||c.displayName.toLowerCase()===I.toLowerCase());if(!d)return`\u274C \u672A\u80FD\u627E\u5230\u6A21\u578B "${I}"\uFF0C\u8BF7\u901A\u8FC7\u8F93\u5165 \`/model\` \u67E5\u770B\u53EF\u7528\u6A21\u578B\u5217\u8868\u3002`;let h=d.name;if(r){let c=r.getGeminiClient();if(c){await c.waitForChatInitialized();let m=await c.switchModel(h,new AbortController().signal);if(!m.success)return`\u274C \u5207\u6362\u5230\u6A21\u578B **${d.displayName}** \u5931\u8D25: ${m.error||"\u53EF\u80FD\u7531\u4E8E\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25"}`;t.setValue("User","preferredModel",h),n&&await TJ(n,{model:h});let G=`\u2728 \u5DF2\u6210\u529F\u5207\u6362 AI \u6A21\u578B\u4E3A: **${d.displayName}** (${h})`;return m.compressionInfo?G+=`
|
|
6497
6497
|
\u{1F4E6} \u4E0A\u4E0B\u6587\u5DF2\u81EA\u52A8\u538B\u7F29: ${m.compressionInfo.originalTokenCount} \u2192 ${m.compressionInfo.newTokenCount} tokens`:m.compressionSkipReason&&(G+=`
|
|
6498
|
-
\u2713 ${m.compressionSkipReason}`),Sa.emit("model-changed",h),G}}return t.setValue("User","preferredModel",h),n&&await TJ(n,{model:h}),`\u2728 \u5DF2\u6210\u529F\u5207\u6362 AI \u6A21\u578B\u4E3A: **${d.displayName}** (${h})`}catch(s){return`\u274C \u5207\u6362\u6A21\u578B\u5931\u8D25: ${s.message}`}}case"/help":{let o=["\u{1F4D6} \u98DE\u4E66\u53EF\u7528\u547D\u4EE4:",""];for(let[t,s]of Object.entries(aRi))o.push(` ${t.padEnd(
|
|
6498
|
+
\u2713 ${m.compressionSkipReason}`),Sa.emit("model-changed",h),G}}return t.setValue("User","preferredModel",h),n&&await TJ(n,{model:h}),`\u2728 \u5DF2\u6210\u529F\u5207\u6362 AI \u6A21\u578B\u4E3A: **${d.displayName}** (${h})`}catch(s){return`\u274C \u5207\u6362\u6A21\u578B\u5931\u8D25: ${s.message}`}}case"/help":{let o=["\u{1F4D6} \u98DE\u4E66\u53EF\u7528\u547D\u4EE4:",""];for(let[t,s]of Object.entries(aRi))o.push(` ${t.padEnd(20)} ${s}`);return o.push(""),o.push("\u{1F4A1} \u6B64\u5916\u8FD8\u652F\u6301 CLI \u5185\u7F6E\u659C\u6760\u547D\u4EE4\uFF08\u5982 /ask\u3001/wiki \u7B49\uFF09"),o.push("\u{1F4A1} \u5176\u4ED6\u4EFB\u4F55\u6D88\u606F\u90FD\u4F1A\u53D1\u9001\u7ED9 AI Agent \u5904\u7406\uFF08\u652F\u6301\u5DE5\u5177\u8C03\u7528\uFF09"),o.join(`
|
|
6499
6499
|
`)}default:return null}}async function sRi(a,e,r){let n=new c0,i=new u0(n),o=new ff(n,i),t=[new yH(e),new wH(e),new WH(e),new FH(e),new EH(e),new A$(o,n)],s=new AbortController,I=(await K9.create(t,s.signal)).getCommands(),d=a.trim(),h=d.substring(1).trim().split(/\s+/),c=h.filter(F=>F);if(c.length===0)return null;let m=I,G,y=0;for(let F of c){let w=m.find(b=>b.name===F);if(w||(w=m.find(b=>b.altNames?.includes(F))),w)if(G=w,y++,w.subCommands)m=w.subCommands;else break;else break}if(!G)return null;let N=h.slice(y).join(" "),Z=[],R={invocation:{raw:d,name:G.name,args:N},isNonInteractive:!0,services:{config:e,settings:py?.services?.settings||{},git:py?.services?.git,logger:console},ui:{addItem:F=>(F&&F.text&&Z.push(F.text),Date.now()),clear:()=>{Z.push("\u{1F9F9} (\u5C4F\u5E55\u5DF2\u6E05\u7A7A)")},setDebugMessage:()=>{},pendingItem:null,setPendingItem:()=>{},loadHistory:()=>{},toggleCorgiMode:()=>{},toggleVimEnabled:async()=>!1},session:{stats:{sessionStartTime:new Date,lastPromptTokenCount:0,promptCount:0,subAgentStats:{totalApiCalls:0,totalErrors:0,totalLatencyMs:0,totalTokens:0,promptTokens:0,candidatesTokens:0,cachedTokens:0,cacheWriteTokens:0,cacheReadTokens:0,thoughtsTokens:0,toolTokens:0},metrics:{models:{},tools:{totalCalls:0,totalSuccess:0,totalFail:0,totalDurationMs:0,totalDecisions:{accept:0,reject:0,modify:0},byName:{}}}},cumulativeCredits:0,totalSessionCredits:0}};if(G.action){let F=await G.action(R,N);if(F)if(F.type==="message")Z.push(F.content);else{if(F.type==="submit_prompt")return{type:"submit_prompt",content:F.content};if(F.type==="dialog"){let w=F.dialog,b=`\u26A0\uFE0F **\u8BE5\u547D\u4EE4\u9700\u8981\u7EC8\u7AEF\uFF08TUI\uFF09\u4EA4\u4E92\u754C\u9762\u652F\u6301\u3002**
|
|
6500
6500
|
|
|
6501
6501
|
\u60A8\u5F53\u524D\u6B63\u5728\u901A\u8FC7\u3010\u98DE\u4E66\u673A\u5668\u4EBA\u8FDC\u7A0B\u6A21\u5F0F\u3011\u8FDB\u884C\u64CD\u4F5C\uFF0C\u65E0\u6CD5\u6253\u5F00\u672C\u5730 TUI \u8BBE\u7F6E\u6D6E\u7A97\u3002`;w==="settings-menu"||w==="theme"||w==="editor"?b+="\n\n\u{1F4A1} **\u60A8\u53EF\u4EE5\u901A\u8FC7\u8F93\u5165\u5177\u4F53\u7684\u914D\u7F6E\u5B50\u547D\u4EE4\u6765\u76F4\u63A5\u914D\u7F6E\uFF08\u514D\u4EA4\u4E92\uFF09**:\n \u2022 `/model <\u6A21\u578B\u540D>` - \u5728\u7EBF\u76F4\u63A5\u5207\u6362 AI \u6A21\u578B\n \u2022 `/thinking <off|auto|high>` - \u914D\u7F6E AI \u601D\u8003\u6A21\u5F0F\u4E0E\u529B\u5EA6":w==="debate-wizard"?b+="\n\n\u{1F4A1} **\u60A8\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u514D\u4EA4\u4E92\u7684\u8FA9\u8BBA\u5B50\u547D\u4EE4\u6765\u8FDB\u884C\u7BA1\u7406**:\n \u2022 `/debate status` - \u67E5\u770B\u5F53\u524D\u8FA9\u8BBA\u8BE6\u60C5\n \u2022 `/debate continue` - \u7EE7\u7EED\u6682\u505C\u7684\u8FA9\u8BBA\n \u2022 `/debate end` - \u5F3A\u5236\u7ED3\u675F\u5F53\u524D\u8FA9\u8BBA":w==="goal-wizard"&&(b+="\n\n\u{1F4A1} **\u76EE\u6807\u9A71\u52A8\u6A21\u5F0F\uFF08\u98DE\u4E66\u7AEF\u5DF2\u652F\u6301\uFF09**:\n \u2022 `/goal` \u6216 `/goal new` - \u5F39\u51FA\u76EE\u6807\u8868\u5355\u5361\u7247\uFF0C\u586B\u5199\u540E\u542F\u52A8\u76EE\u6807\u6A21\u5F0F\n \u2022 `/goal clear` - \u7ED3\u675F\u5F53\u524D goal \u6A21\u5F0F\uFF0C\u91CA\u653E\u5951\u7EA6\u7EA6\u675F"),Z.push(b)}else F.type==="select_session"?Z.push("\u26A0\uFE0F **\u8BE5\u547D\u4EE4\u9700\u8981 TUI \u5217\u8868\u5149\u6807\u4EA4\u4E92\u652F\u6301\u3002**\n\n\u60A8\u5F53\u524D\u5904\u4E8E\u98DE\u4E66\u7AEF\uFF0C\u65E0\u6CD5\u8FDB\u884C\u5149\u6807\u9009\u62E9\u3002\u5EFA\u8BAE\u60A8\u901A\u8FC7 `/new` \u76F4\u63A5\u5F00\u59CB\u4E00\u4E2A\u5E72\u51C0\u7684\u65B0\u4F1A\u8BDD\u3002"):F.type==="quit"&&Z.push("\u26A0\uFE0F **\u65E0\u6CD5\u5728\u8FDC\u7A0B\u6A21\u5F0F\u4E0B\u7EC8\u6B62\u670D\u52A1\u7AEF\u8FDB\u7A0B\u3002**\n\n\u5982\u679C\u60A8\u60F3\u4E2D\u65AD\u5F53\u524D\u7684 AI \u751F\u6210\u4EFB\u52A1\uFF0C\u8BF7\u4F7F\u7528 `/stop` \u547D\u4EE4\u3002")}}return{type:"text",content:Z.join(`
|