easycode-ai 1.1.18 → 1.1.19

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.
Files changed (2) hide show
  1. package/bundle/easycode.js +15 -11
  2. package/package.json +1 -1
@@ -608,7 +608,7 @@ ${h}`)}return t}),DGe=lHn(nDt);s1e=class extends i1e{create(e,r){var a;let{api_v
608
608
  `):[]}};EO.NEWLINE_CHARS=new Set([`
609
609
  `,"\r"]);EO.NEWLINE_REGEXP=/\r\n|[\n\r]/g;l1e={off:0,error:200,warn:300,info:400,debug:500},P8t=(n,e,r)=>{if(n){if(O9n(l1e,n))return n;Y2(r).warn(`${e} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(l1e))}`)}};IHn={error:yne,warn:yne,info:yne,debug:yne},j8t=new WeakMap;vk=n=>(n.options&&(n.options=Object.assign({},n.options),delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n);iMe=class n{constructor(e,r,a){this.iterator=e,this.controller=r,this.client=a}static fromSSEResponse(e,r,a){let i=!1,o=a?Y2(a):console;function t(){return ZO(this,arguments,function*(){var u,I,d,h;if(i)throw new $g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,g=yk(hHn(e,r)),v;v=yield td(g.next()),u=v.done,!u;m=!0){h=v.value,m=!1;let Z=h;if(!c)if(Z.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield td(JSON.parse(Z.data))}catch(A){throw o.error("Could not parse message into JSON:",Z.data),o.error("From chunk:",Z.raw),A}}}catch(Z){I={error:Z}}finally{try{!m&&!u&&(d=g.return)&&(yield td(d.call(g)))}finally{if(I)throw I.error}}c=!0}catch(Z){if(tMe(Z))return yield td(void 0);throw Z}finally{c||r.abort()}})}return new n(t,r,a)}static fromReadableStream(e,r,a){let i=!1;function o(){return ZO(this,arguments,function*(){var u,I,d,h;let c=new EO,m=eDt(e);try{for(var g=!0,v=yk(m),Z;Z=yield td(v.next()),u=Z.done,!u;g=!0){h=Z.value,g=!1;let A=h;for(let R of c.decode(A))yield yield td(R)}}catch(A){I={error:A}}finally{try{!g&&!u&&(d=v.return)&&(yield td(d.call(v)))}finally{if(I)throw I.error}}for(let A of c.flush())yield yield td(A)})}function t(){return ZO(this,arguments,function*(){var u,I,d,h;if(i)throw new $g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,g=yk(o()),v;v=yield td(g.next()),u=v.done,!u;m=!0){h=v.value,m=!1;let Z=h;c||Z&&(yield yield td(JSON.parse(Z)))}}catch(Z){I={error:Z}}finally{try{!m&&!u&&(d=g.return)&&(yield td(d.call(g)))}finally{if(I)throw I.error}}c=!0}catch(Z){if(tMe(Z))return yield td(void 0);throw Z}finally{c||r.abort()}})}return new n(t,r,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],a=this.iterator(),i=o=>({next:()=>{if(o.length===0){let t=a.next();e.push(t),r.push(t)}return o.shift()}});return[new n(()=>i(e),this.controller,this.client),new n(()=>i(r),this.controller,this.client)]}toReadableStream(){let e=this,r;return $8t({async start(){r=e[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:o}=await r.next();if(o)return a.close();let t=cMe(JSON.stringify(i)+`
610
610
  `);a.enqueue(t)}catch(i){a.error(i)}},async cancel(){var a;await((a=r.return)===null||a===void 0?void 0:a.call(r))}})}};sMe=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,a,i]=pHn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};oMe=class n extends Promise{constructor(e,r,a=fHn){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};aDt=Symbol("brand.privateNullableHeaders");vne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of bHn(a)){let s=o.toLowerCase();i.has(s)||(e.delete(o),i.add(s)),t===null?(e.delete(o),r.add(s)):(e.append(o,t),r.delete(s))}}return{[aDt]:!0,values:e,nulls:r}};eMe=n=>{var e,r,a,i,o,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(o=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||o===void 0?void 0:o.call(i,n))===null||t===void 0?void 0:t.trim()};c1e=class n{constructor(e){var r,a,i,o,t,s,u,{baseURL:I=eMe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=eMe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=zGe(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=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let g="warn";this.logLevel=g,this.logLevel=(t=(o=P8t(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:P8t(eMe("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:K9n(),this.encoder=tHn,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=vne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return vne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return vne([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new $g(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${AO}`}defaultIdempotencyKey(){return`stainless-node-retry-${S9n()}`}makeStatusError(e,r,a,i){return eG.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=B9n(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return D9n(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:a}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new oMe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){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=a===void 0?"":`, retryOf: ${a}`,g=Date.now();if(Y2(this).debug(`[${c}] sending request`,vk({retryOfRequestLogID:a,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Ane;let v=new AbortController,Z=await this.fetchWithTimeout(d,I,h,v).catch(rMe),A=Date.now();if(Z instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Ane;let w=tMe(Z)||/timed? ?out/i.test(String(Z)+("cause"in Z?String(Z.cause):""));if(r)return Y2(this).info(`[${c}] connection ${w?"timed out":"failed"} - ${F}`),Y2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (${F})`,vk({retryOfRequestLogID:a,url:d,durationMs:A-g,message:Z.message})),this.retryRequest(s,r,a??c);throw Y2(this).info(`[${c}] connection ${w?"timed out":"failed"} - error; no more retries left`),Y2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (error; no more retries left)`,vk({retryOfRequestLogID:a,url:d,durationMs:A-g,message:Z.message})),w?new jGe:new FO({cause:Z})}let R=`[${c}${m}] ${I.method} ${d} ${Z.ok?"succeeded":"failed"} with status ${Z.status} in ${A-g}ms`;if(!Z.ok){let F=await this.shouldRetry(Z);if(r&&F){let b=`retrying, ${r} attempts remaining`;return await eHn(Z.body),Y2(this).info(`${R} - ${b}`),Y2(this).debug(`[${c}] response error (${b})`,vk({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:A-g})),this.retryRequest(s,r,a??c,Z.headers)}let w=F?"error; no more retries left":"error; not retryable";Y2(this).info(`${R} - ${w}`);let p=await Z.text().catch(b=>rMe(b).message),y=U9n(p),N=y?void 0:p;throw Y2(this).debug(`[${c}] response error (${w})`,vk({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,message:N,durationMs:Date.now()-g})),this.makeStatusError(Z.status,y,N,Z.headers)}return Y2(this).info(R),Y2(this).debug(`[${c}] response start`,vk({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:A-g})),{response:Z,options:s,controller:v,requestLogID:c,retryOfRequestLogID:a,startTime:g}}async fetchWithTimeout(e,r,a,i){let o=r||{},{signal:t,method:s}=o,u=zGe(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),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,a,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 _9n(t),this.makeRequest(e,r-1,a)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,t=Math.min(.5*Math.pow(2,o),8),s=1-Math.random()*.25;return t*s*1e3}async buildRequest(e,{retryCount:r=0}={}){var a,i,o;let t=Object.assign({},e),{method:s,path:u,query:I,defaultBaseURL:d}=t,h=this.buildURL(u,I,d);"timeout"in t&&M9n("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a: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:a,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),s=vne([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))}:{}),q9n()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=vne([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:$9n(e)}:this.encoder({body:e,headers:a})}};c1e.DEFAULT_TIMEOUT=6e4;O0=class extends c1e{constructor(){super(...arguments),this.interactions=new o1e(this)}};iDt=O0;O0.GeminiNextGenAPIClient=iDt;O0.GeminiNextGenAPIClientError=$g;O0.APIError=eG;O0.APIConnectionError=FO;O0.APIConnectionTimeoutError=jGe;O0.APIUserAbortError=Ane;O0.NotFoundError=e1e;O0.ConflictError=t1e;O0.RateLimitError=n1e;O0.BadRequestError=qGe;O0.AuthenticationError=KGe;O0.InternalServerError=a1e;O0.PermissionDeniedError=$Ge;O0.UnprocessableEntityError=r1e;O0.toFile=sHn;O0.Interactions=o1e;kPi=1024*1024*8;});function gHn(n,e){return{...n,...e}}function sDt(n){let{prompt_id:e,...r}=n;return r}function JY(n){return Array.isArray(n)?n.map(sDt):n}var u1e=ct(()=>{"use strict";ii();});var oDt={};ho(oDt,{DEFAULT_PROXY_CONFIG:()=>yHn,getActiveProxyServerUrl:()=>cE,getAvailableProxyServers:()=>GHn,getProxyServerInfo:()=>vHn,getProxyServers:()=>Zne,hasAvailableProxyServer:()=>uMe});function Zne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function cE(){let e=Zne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function GHn(){return Zne().filter(e=>e.status==="active")}function uMe(){return Zne().some(e=>e.status==="active")}function vHn(n){return Zne().find(r=>r.url===n)}var yHn,wO=ct(()=>{"use strict";yHn={serverUrl:cE(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as AHn}from"crypto";function tv(){return Nne||(Nne=AHn()),Nne}function lDt(n){Nne=n}function cDt(){Nne=void 0}var Nne,uDt,d1e=ct(()=>{"use strict";uDt=tv()});function Yu(n){let e=n??"1.1.18"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${dMe}/VSCode/${i} (${r}; ${a})`}return`${dMe}/CLI/${e} (${r}; ${a})`}var dMe,k5=ct(()=>{"use strict";dMe="EasyCode"});import*as Vu from"fs";import*as $N from"path";import*as Ak from"os";function ZHn(n){Co.configure(n)}function NHn(n){Co.setUserInfo(n)}function WHn(n){Co.setCliVersion(n)}async function FHn(){return await Co.getUserHeaders()}function EHn(){return Co.getStatus()}var Wne,Ro,Co,S5=ct(()=>{"use strict";wO();d1e();k5();Wne=259200,Ro=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Yu(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${o}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${o}\u5206\u949F${t}\u79D2`:o>0?`${o}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=$N.join(Ak.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=$N.join(Ak.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.18",this.config={proxyServerUrl:cE()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Wne*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Vu.existsSync(this.userInfoFilePath)){let e=Vu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=a=>{if(!a||!a.includes("@"))return a;let[i,o]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${o}`}}}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=$N.dirname(this.userInfoFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.jwtTokenFilePath)){let e=Vu.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=$N.dirname(this.jwtTokenFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.usageStatsFilePath)){let e=Vu.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=$N.dirname(this.usageStatsFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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 a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-Wne*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,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Wne*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Wne){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let 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 a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Wne*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{Vu.existsSync(this.jwtTokenFilePath)&&Vu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":tv()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":tv()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Vu.existsSync(this.userInfoFilePath)&&Vu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Vu.existsSync(this.jwtTokenFilePath)&&Vu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},Co=Ro.getInstance()});import{promises as Zk}from"node:fs";import Fne from"node:path";import wHn from"os";var rv,I1e,en,nv=ct(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(rv||(rv={}));I1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:rv.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=Fne.join(wHn.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),o=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${o}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await Zk.mkdir(Fne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await Zk.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,a,i]=pHn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};oMe=class n extends Promise{constructor(e,r,a=fHn){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};aDt=Symbol("brand.privateNullableHeaders");vne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of bHn(a)){let s=o.toLowerCase();i.has(s)||(e.delete(o),i.add(s)),t===null?(e.delete(o),r.add(s)):(e.append(o,t),r.delete(s))}}return{[aDt]:!0,values:e,nulls:r}};eMe=n=>{var e,r,a,i,o,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(o=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||o===void 0?void 0:o.call(i,n))===null||t===void 0?void 0:t.trim()};c1e=class n{constructor(e){var r,a,i,o,t,s,u,{baseURL:I=eMe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=eMe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=zGe(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=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let g="warn";this.logLevel=g,this.logLevel=(t=(o=P8t(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:P8t(eMe("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:K9n(),this.encoder=tHn,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=vne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return vne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return vne([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new $g(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${AO}`}defaultIdempotencyKey(){return`stainless-node-retry-${S9n()}`}makeStatusError(e,r,a,i){return eG.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=B9n(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return D9n(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:a}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new oMe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){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=a===void 0?"":`, retryOf: ${a}`,g=Date.now();if(Y2(this).debug(`[${c}] sending request`,vk({retryOfRequestLogID:a,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Ane;let v=new AbortController,Z=await this.fetchWithTimeout(d,I,h,v).catch(rMe),A=Date.now();if(Z instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Ane;let w=tMe(Z)||/timed? ?out/i.test(String(Z)+("cause"in Z?String(Z.cause):""));if(r)return Y2(this).info(`[${c}] connection ${w?"timed out":"failed"} - ${F}`),Y2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (${F})`,vk({retryOfRequestLogID:a,url:d,durationMs:A-g,message:Z.message})),this.retryRequest(s,r,a??c);throw Y2(this).info(`[${c}] connection ${w?"timed out":"failed"} - error; no more retries left`),Y2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (error; no more retries left)`,vk({retryOfRequestLogID:a,url:d,durationMs:A-g,message:Z.message})),w?new jGe:new FO({cause:Z})}let R=`[${c}${m}] ${I.method} ${d} ${Z.ok?"succeeded":"failed"} with status ${Z.status} in ${A-g}ms`;if(!Z.ok){let F=await this.shouldRetry(Z);if(r&&F){let b=`retrying, ${r} attempts remaining`;return await eHn(Z.body),Y2(this).info(`${R} - ${b}`),Y2(this).debug(`[${c}] response error (${b})`,vk({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:A-g})),this.retryRequest(s,r,a??c,Z.headers)}let w=F?"error; no more retries left":"error; not retryable";Y2(this).info(`${R} - ${w}`);let p=await Z.text().catch(b=>rMe(b).message),y=U9n(p),N=y?void 0:p;throw Y2(this).debug(`[${c}] response error (${w})`,vk({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,message:N,durationMs:Date.now()-g})),this.makeStatusError(Z.status,y,N,Z.headers)}return Y2(this).info(R),Y2(this).debug(`[${c}] response start`,vk({retryOfRequestLogID:a,url:Z.url,status:Z.status,headers:Z.headers,durationMs:A-g})),{response:Z,options:s,controller:v,requestLogID:c,retryOfRequestLogID:a,startTime:g}}async fetchWithTimeout(e,r,a,i){let o=r||{},{signal:t,method:s}=o,u=zGe(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),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,a,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 _9n(t),this.makeRequest(e,r-1,a)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,t=Math.min(.5*Math.pow(2,o),8),s=1-Math.random()*.25;return t*s*1e3}async buildRequest(e,{retryCount:r=0}={}){var a,i,o;let t=Object.assign({},e),{method:s,path:u,query:I,defaultBaseURL:d}=t,h=this.buildURL(u,I,d);"timeout"in t&&M9n("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a: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:a,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),s=vne([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))}:{}),q9n()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=vne([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:$9n(e)}:this.encoder({body:e,headers:a})}};c1e.DEFAULT_TIMEOUT=6e4;O0=class extends c1e{constructor(){super(...arguments),this.interactions=new o1e(this)}};iDt=O0;O0.GeminiNextGenAPIClient=iDt;O0.GeminiNextGenAPIClientError=$g;O0.APIError=eG;O0.APIConnectionError=FO;O0.APIConnectionTimeoutError=jGe;O0.APIUserAbortError=Ane;O0.NotFoundError=e1e;O0.ConflictError=t1e;O0.RateLimitError=n1e;O0.BadRequestError=qGe;O0.AuthenticationError=KGe;O0.InternalServerError=a1e;O0.PermissionDeniedError=$Ge;O0.UnprocessableEntityError=r1e;O0.toFile=sHn;O0.Interactions=o1e;kPi=1024*1024*8;});function gHn(n,e){return{...n,...e}}function sDt(n){let{prompt_id:e,...r}=n;return r}function JY(n){return Array.isArray(n)?n.map(sDt):n}var u1e=ct(()=>{"use strict";ii();});var oDt={};ho(oDt,{DEFAULT_PROXY_CONFIG:()=>yHn,getActiveProxyServerUrl:()=>cE,getAvailableProxyServers:()=>GHn,getProxyServerInfo:()=>vHn,getProxyServers:()=>Zne,hasAvailableProxyServer:()=>uMe});function Zne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function cE(){let e=Zne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function GHn(){return Zne().filter(e=>e.status==="active")}function uMe(){return Zne().some(e=>e.status==="active")}function vHn(n){return Zne().find(r=>r.url===n)}var yHn,wO=ct(()=>{"use strict";yHn={serverUrl:cE(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as AHn}from"crypto";function tv(){return Nne||(Nne=AHn()),Nne}function lDt(n){Nne=n}function cDt(){Nne=void 0}var Nne,uDt,d1e=ct(()=>{"use strict";uDt=tv()});function Yu(n){let e=n??"1.1.19"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${dMe}/VSCode/${i} (${r}; ${a})`}return`${dMe}/CLI/${e} (${r}; ${a})`}var dMe,k5=ct(()=>{"use strict";dMe="EasyCode"});import*as Vu from"fs";import*as $N from"path";import*as Ak from"os";function ZHn(n){Co.configure(n)}function NHn(n){Co.setUserInfo(n)}function WHn(n){Co.setCliVersion(n)}async function FHn(){return await Co.getUserHeaders()}function EHn(){return Co.getStatus()}var Wne,Ro,Co,S5=ct(()=>{"use strict";wO();d1e();k5();Wne=259200,Ro=class n{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Yu(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\u5929${i}\u5C0F\u65F6${o}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${o}\u5206\u949F${t}\u79D2`:o>0?`${o}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=$N.join(Ak.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=$N.join(Ak.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.19",this.config={proxyServerUrl:cE()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Wne*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Vu.existsSync(this.userInfoFilePath)){let e=Vu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=a=>{if(!a||!a.includes("@"))return a;let[i,o]=a.split("@");return i.length<=2?a:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${o}`}}}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=$N.dirname(this.userInfoFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.jwtTokenFilePath)){let e=Vu.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=$N.dirname(this.jwtTokenFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.usageStatsFilePath)){let e=Vu.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=$N.dirname(this.usageStatsFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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 a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-Wne*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,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Wne*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Wne){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let 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 a=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:a+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Wne*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{Vu.existsSync(this.jwtTokenFilePath)&&Vu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":tv()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":tv()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Vu.existsSync(this.userInfoFilePath)&&Vu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Vu.existsSync(this.jwtTokenFilePath)&&Vu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},Co=Ro.getInstance()});import{promises as Zk}from"node:fs";import Fne from"node:path";import wHn from"os";var rv,I1e,en,nv=ct(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(rv||(rv={}));I1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:rv.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=Fne.join(wHn.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),o=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${o}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await Zk.mkdir(Fne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await Zk.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 Zk.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let a=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${a}.log`);await Zk.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=Fne.dirname(this.config.filePath),a=(await Zk.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:Fne.join(e,t),time:Zk.stat(Fne.join(e,t)).then(s=>s.mtime)})),i=await Promise.all(a.map(async t=>({...t,time:await t.time})));i.sort((t,s)=>s.time.getTime()-t.time.getTime());let o=i.slice(this.config.maxFiles||5);for(let t of o)await Zk.unlink(t.path)}catch(e){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",e)}}log(e,r,a,...i){if(e<this.config.level)return;let o=this.formatMessage(r,a,...i);this.config.enableConsole&&(e>=rv.ERROR?console.error:e>=rv.WARN?console.warn:e>=rv.INFO?console.log:console.debug)(o),this.config.enableFile&&this.writeToFile(o)}debug(e,...r){this.log(rv.DEBUG,"DEBUG",e,...r)}info(e,...r){this.log(rv.INFO,"INFO",e,...r)}warn(e,...r){this.log(rv.WARN,"WARN",e,...r)}error(e,...r){this.log(rv.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}:{}})}},en=new I1e({level:process.env.FILE_DEBUG==="1"?rv.DEBUG:rv.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Ec(n){return n instanceof Error&&"code"in n}function gn(n){if(n instanceof Error)return n.message;try{return String(n)}catch{return"Failed to get error details"}}function IMe(n){if(n&&typeof n=="object"&&"response"in n){let r=RHn(n);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new m1e(r.error.message);case 401:return new GI(r.error.message);case 403:return new h1e(r.error.message);default:}}return n}function RHn(n){return typeof n.response?.data=="string"?JSON.parse(n.response?.data):n.response?.data}function Nk(n){if(!n)return!1;try{let e=JSON.parse(n);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var h1e,GI,m1e,Oc=ct(()=>{"use strict";h1e=class extends Error{},GI=class extends Error{},m1e=class extends Error{}});var va,dDt,Ph,av=ct(()=>{"use strict";(function(n){n.CHAT_CONVERSATION="chat_conversation",n.WEB_FETCH="web_fetch",n.WEB_SEARCH="web_search",n.CONTENT_SUMMARY="content_summary",n.JSON_GENERATION="json_generation",n.COMPRESSION="compression",n.SUB_AGENT="sub_agent",n.CODE_ASSIST="code_assist",n.EDIT_CORRECTION="edit_correction",n.IMAGE_READER="image_reader",n.GOAL_EVALUATION="goal_evaluation"})(va||(va={}));dDt={[va.CHAT_CONVERSATION]:"auto",[va.WEB_FETCH]:"gemini-2.5-flash",[va.WEB_SEARCH]:"gemini-2.5-flash",[va.CODE_ASSIST]:"auto",[va.CONTENT_SUMMARY]:"gemini-2.5-flash-lite",[va.EDIT_CORRECTION]:"gemini-2.5-flash-lite",[va.JSON_GENERATION]:"gemini-2.5-flash",[va.COMPRESSION]:"gemini-2.5-flash",[va.SUB_AGENT]:"auto",[va.IMAGE_READER]:"gemini-2.5-flash",[va.GOAL_EVALUATION]:"deepseek-v4-flash"},Ph=class{static getModelForScene(e){if(e)return dDt[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{[va.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[va.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[va.WEB_SEARCH]:"Web\u641C\u7D22",[va.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[va.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[va.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[va.JSON_GENERATION]:"JSON\u751F\u6210",[va.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[va.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[va.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B",[va.GOAL_EVALUATION]:"\u76EE\u6807\u8FBE\u6210\u8BC4\u4F30"}[e]||e}}});function gA(n){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="object"&&"message"in n.error}function ab(n){return typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string"}function e3(n){let e=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof n=="string")return e(n);if(ab(n))return e(n.message);if(gA(n))return e(n.error.message);if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response&&r.response.data){if(typeof r.response.data=="string")return e(r.response.data);if(typeof r.response.data=="object"&&r.response.data!==null&&"error"in r.response.data){let a=r.response.data;return e(a.error?.message||"")}}}return!1}function t3(n){return typeof n=="string"?n.includes("Quota exceeded for quota metric"):ab(n)?n.message.includes("Quota exceeded for quota metric"):gA(n)?n.error.message.includes("Quota exceeded for quota metric"):!1}function tG(n){if(n&&typeof n=="object"&&"response"in n){let e=n;if(e.response?.status===402&&e.response.data){let r=e.response.data;if(r&&typeof r.error=="string"&&(r.error==="Quota limit exceeded"||r.error==="No quota configuration")&&typeof r.message=="string")return!0}if(e.response?.status===500&&e.response.data){let r=e.response.data;if(r&&typeof r.message=="string"&&r.message.includes("quota exceeded"))return!0}}if(n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"'))||n.message.includes("API request failed (500):")&&n.message.includes("quota exceeded")||n.message.includes("Stream API error (500):")&&n.message.includes("quota exceeded")))return!0;if(typeof n=="object"&&n!==null){let e=n;if(e.message&&typeof e.message=="string"&&(e.message.includes("API request failed (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||e.message.includes("API error (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||(e.message.includes("API request failed (500):")||e.message.includes("Stream API error (500):"))&&e.message.includes("quota exceeded"))||(e.error==="Quota limit exceeded"||e.error==="No quota configuration")&&typeof e.message=="string"||e.status===500&&typeof e.message=="string"&&e.message.includes("quota exceeded"))return!0}return typeof n=="string"?n.includes("Quota limit exceeded")||n.includes("No quota configuration")||n.includes("Daily token limit would be exceeded")||n.includes("Daily request limit exceeded")||n.includes("Daily cost limit would be exceeded")||n.includes("500")&&n.includes("quota exceeded"):!1}function Ene(n){let e=null;if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response?.status===402&&r.response.data)e=r.response.data;else if(r.response?.status===500&&r.response.data){let a=r.response.data;a&&typeof a.message=="string"&&a.message.includes("quota exceeded")&&(e=a)}}else if(typeof n=="object"&&n!==null){let r=n;if(r.message&&typeof r.message=="string"&&(r.message.includes("API request failed (402):")||r.message.includes("API request failed (500):")||r.message.includes("Stream API error (500):"))&&(r.message.includes('"error":"Quota limit exceeded"')||r.message.includes('"error":"No quota configuration"')||r.message.includes("quota exceeded")))try{let a=r.message.match(/\{.*\}$/);a&&(e=JSON.parse(a[0]))}catch{}e||(e=n)}if(!e&&n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")||n.message.includes("API request failed (500):")||n.message.includes("Stream API error (500):"))&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"')||n.message.includes("quota exceeded")))try{let r=n.message.match(/\{.*\}$/);r&&(e=JSON.parse(r[0]))}catch{}return e?e.message&&e.message.includes("quota exceeded")?CHn(e):xHn(e):null}function CHn(n){let r=(()=>{try{let c=process.env,m=c.LC_ALL||c.LC_CTYPE||c.LANG||"";return m.toLowerCase().includes("zh")||m.toLowerCase().includes("chinese")}catch{return!1}})(),a="",i="",o="",t="",s=n.message||"",u=s.match(/Role:\s*([^,]+)/);u&&(a=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
  `,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
@@ -3537,13 +3537,13 @@ Preview content is rendered as markdown in a monospace box. Multi-line text with
3537
3537
  ${Jdi}`,R0e=class n extends Tn{config;static Name="ask_user_question";pendingAnswers=new Map;constructor(e){super(n.Name,"AskUserQuestion",Ddi,Jn.Question,{type:pr.OBJECT,properties:{questions:{type:pr.ARRAY,description:"Questions to ask the user (1-4 questions in a single dialog).",items:{type:pr.OBJECT,properties:{question:{type:pr.STRING,description:'The complete question to ask the user. Should be clear, specific, and end with a question mark. Example: "Which library should we use for date formatting?"'},header:{type:pr.STRING,description:'Very short label displayed as a chip/tag (max 12 chars). Examples: "Auth method", "Library", "Approach".'},options:{type:pr.ARRAY,description:'Available choices (2-4 options). Must be distinct. Do not include "Other" \u2014 it is auto-appended by the UI.',items:{type:pr.OBJECT,properties:{label:{type:pr.STRING,description:"The display text for this option. Should be concise (1-5 words)."},description:{type:pr.STRING,description:"Explanation of what this option means or implies."},preview:{type:pr.STRING,description:"Optional preview content (markdown) rendered side-by-side when this option is focused. Single-select only."}},required:["label"]}},multiSelect:{type:pr.BOOLEAN,description:"Set to true to allow selecting multiple options. Defaults to false."}},required:["question","options"]}},metadata:{type:pr.OBJECT,description:"Optional metadata for tracking/analytics. Not displayed to user.",properties:{source:{type:pr.STRING,description:'Optional identifier for the source of this question (e.g., "remember").'}}}},required:["questions"]},!0,!1,!1,!1),this.config=e}validateToolParams(e){e&&Array.isArray(e.questions)&&(e.questions=e.questions.map(i=>{if(!i||typeof i!="object")return i;let o=i.header;(!o||typeof o!="string"||!o.trim())&&(o="Question"),o.length>12&&(o=o.substring(0,12));let t=i.options;return Array.isArray(t)&&(t=t.map(s=>{if(typeof s=="string")return{label:s,description:""};if(s&&typeof s=="object"){let u=s.label||s.value||"Option",I=String(u).trim()||"Option",d=s.description?String(s.description).trim():"";return{...s,label:I,description:d}}return{label:"Option",description:""}})),{...i,header:o,options:t}}));let r=hi.validate(this.schema.parameters,e,n.Name);if(r)return r;if(!e.questions||e.questions.length===0)return"At least one question is required.";if(e.questions.length>4)return"At most 4 questions may be asked in a single call.";let a=new Set;for(let i of e.questions){if(!i.question||!i.question.trim())return"Every question must have non-empty `question` text.";if(a.has(i.question))return`Duplicate question text: "${i.question}". Question texts must be unique within one call.`;if(a.add(i.question),!i.header||i.header.length>12)return`Question header must be 1-12 characters (got "${i.header}").`;if(!i.options||i.options.length<2||i.options.length>4)return`Each question must have 2-4 options (got ${i.options?.length??0} for "${i.question}").`;let o=new Set;for(let t of i.options){if(!t.label||!t.label.trim())return"Every option must have a non-empty label.";if(o.has(t.label))return`Duplicate option label "${t.label}" in question "${i.question}".`;if(o.add(t.label),t.label.trim().toLowerCase()==="other"||t.label.trim().toLowerCase()==="others")return'Do not include an "Other" option \u2014 it is auto-appended by the UI.';if(t.preview&&i.multiSelect)return`Preview is not supported on multiSelect questions (option "${t.label}" in "${i.question}").`}}return null}getDescription(e){let r=e.questions?.length??0;return r===0?"Ask user a question":r===1?`Ask: "${e.questions[0].question}"`:`Ask ${r} questions`}fingerprint(e){return e.questions?.map(r=>r.question).join("")??""}async shouldConfirmExecute(e,r){if(this.validateToolParams(e))return!1;let i=this.fingerprint(e);return{type:"question",title:"Questions for you",questions:e.questions,metadata:e.metadata,onConfirm:async(t,s)=>{if(t===Yn.Cancel){this.pendingAnswers.set(i,{answers:{},cancelled:!0});return}this.pendingAnswers.set(i,{answers:s?.answers??{},annotations:s?.annotations,feedback:s?.feedback})}}}async execute(e,r){let a=this.validateToolParams(e);if(a)return{llmContent:`AskUserQuestion failed: ${a}`,returnDisplay:`**AskUserQuestion input error:** ${a}`};let i=this.fingerprint(e),o=this.pendingAnswers.get(i);if(this.pendingAnswers.delete(i),!o||o.cancelled){let m="User declined to answer questions.";return{llmContent:m,returnDisplay:m,summary:m}}if(o.feedback)return{llmContent:o.feedback,returnDisplay:"User requested to chat about the questions.",summary:"User chose to chat"};let t=o.answers,s=o.annotations,I=Object.entries(t).map(([m,g])=>{let v=s?.[m],Z=[`"${m}"="${g}"`];return v?.preview&&Z.push(`selected preview:
3538
3538
  ${v.preview}`),v?.notes&&Z.push(`user notes: ${v.notes}`),Z.join(" ")}).join(", "),d=I?`User has answered your questions: ${I}. You can now continue with the user's answers in mind.`:"User has answered your questions (no answers provided).",h=Object.entries(t).map(([m,g])=>`- **${m}** \u2192 ${g}`).join(`
3539
3539
  `),c=h?`**User answered:**
3540
- ${h}`:"User answered your questions.";return{llmContent:d,returnDisplay:c,summary:Object.keys(t).length>0?`Collected ${Object.keys(t).length} answer(s)`:"No answers"}}}});function men(n,e){let r=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(n),a=o=>r.find(t=>t.type===o)?.value??"00",i=a("hour")==="24"?"00":a("hour");return`${a("year")}-${a("month")}-${a("day")} ${i}:${a("minute")}:${a("second")}`}var C0e,R3t=ct(()=>{"use strict";ii();Pi();jc();C0e=class n extends Tn{config;static Name="local_time";constructor(e){super(n.Name,"LocalTime","Returns the current wall-clock local time of the machine running Easy Code. Use this tool to determine the current real-world time, record a start time at the beginning of a long task, calculate elapsed task duration by comparing two readings, or timestamp checkpoints, logs, or todo updates. The tool is fast, side-effect free, and never requires user confirmation, so you may call it as often as needed. Returned JSON fields: iso (ISO 8601 UTC timestamp), unix_ms (number), unix_s (number), timezone (IANA name), local (YYYY-MM-DD HH:MM:SS), weekday (English).",Jn.Info,{type:pr.OBJECT,properties:{timezone:{type:pr.STRING,description:'Optional IANA timezone name (e.g. "Asia/Shanghai", "UTC"). If omitted, uses the system local timezone.'}},required:[]}),this.config=e}validateToolParams(e){let r=hi.validate(this.schema.parameters,e,n.Name);return r||(e.timezone!==void 0&&(typeof e.timezone!="string"||e.timezone.trim()==="")?'Parameter "timezone" must be a non-empty IANA timezone string.':null)}getDescription(e){return e.timezone?`Get current time in timezone "${e.timezone}"`:"Get current local time"}async execute(e,r){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:`Parameter validation failed: ${a}`};let i=new Date,o=e.timezone?.trim(),t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",s,u,I,d;try{s=o||t,u=men(i,s),I=new Intl.DateTimeFormat("en-US",{weekday:"long",timeZone:s}).format(i)}catch(m){s=t,u=men(i,s),I=new Intl.DateTimeFormat("en-US",{weekday:"long",timeZone:s}).format(i);let g=m instanceof Error?m.message:String(m);d=`Invalid timezone "${o}" (${g}); fell back to system timezone.`}let h={iso:i.toISOString(),unix_ms:i.getTime(),unix_s:Math.floor(i.getTime()/1e3),timezone:s,local:u,weekday:I};d&&(h.warning=d);let c=d?`Local time: ${u} (${s}, ${I}) - ${d}`:`Local time: ${u} (${s}, ${I})`;return{llmContent:JSON.stringify(h),returnDisplay:c,summary:u}}}});import{spawn as pen,spawnSync as Odi}from"node:child_process";import Mdi from"node:os";function zdi(n){let e=n.trim().toLowerCase();return e.startsWith("config init")||e.startsWith("auth login")||e.startsWith("auth logout")}var Udi,fen,_di,HHe,ben=ct(()=>{"use strict";ii();Pi();jc();Udi=500,fen=900*1e3,_di=/https?:\/\/[^\s'"]*?(?:page\/cli\?user_code=|open-apis\/authen)[^\s'"]*/;HHe=class n extends Tn{config;static Name="lark_cli";constructor(e){super(n.Name,"LarkCli",["Unified wrapper for the official lark-cli tool. Provides access to 18+ business domains in Lark (Feishu) for both automation and AI agent-driven workflows.","","RULES:","- ALWAYS use this tool for every Lark/Feishu operation \u2014 NEVER run lark-cli via run_shell_command/shell.",'- ROUTING: When the user wants to create a project with a local directory AND a Feishu group chat bound together (e.g. "\u62C9\u4E2A\u7FA4 + \u9879\u76EE\u8DEF\u5F84", "create a project group"), use the `create_project_and_group_chat` tool instead \u2014 it handles directory creation, group creation, user invitation, and workspace binding in one call. Note: this tool is only available when the Feishu bot is running (/feishu start). If the tool is not listed, fall back to `im +chat-create` for a standalone group chat.','- Authorization is fully automatic: if the CLI is not configured/authorized yet, this tool launches the browser device-flow login itself and streams the verification URL to the user in real time within the same call. Do NOT manually run "lark-cli config init" or "auth login" in a shell.','- Do NOT guess subcommands or flags. If unsure what a command supports, run it with "--help" first (e.g. command="calendar --help"). Error responses include hints with available options \u2014 follow them instead of guessing.',"","COMMON COMMAND CHEATSHEET (use these patterns to avoid trial-and-error):","","## Calendar",`- Today's agenda: command="calendar +agenda"`,'- Agenda by date range: command="calendar +agenda" args=["--start", "2025-01-01", "--end", "2025-01-07"]','- Create event: command="calendar +create" args=["--summary", "Meeting", "--start", "2025-01-01T10:00:00+08:00", "--end", "2025-01-01T11:00:00+08:00"]','- Update event: command="calendar +update" args=["--event-id", "<id>", "--summary", "New Title"]','- Free/busy query: command="calendar +freebusy" args=["--start", "2025-01-01", "--end", "2025-01-01"]','- Find meeting rooms: command="calendar +room-find" args=["--slot", "2025-01-01T10:00:00+08:00~2025-01-01T11:00:00+08:00"]','- RSVP to event: command="calendar +rsvp" args=["--event-id", "<id>", "--rsvp-status", "accept"]','- Smart time suggestion: command="calendar +suggestion" args=["--start", "2025-01-01", "--end", "2025-01-07"]',"","## Docs (Documents)",'- Create doc from file (RECOMMENDED for content >500 chars): command="docs +create" args=["--api-version", "v2", "--title", "Title", "--content", "@<relative-path>", "--doc-format", "markdown"]'," CRITICAL: Use --content with @file (NOT inline text for long content \u2014 inline silently drops content; NOT --markdown \u2014 that flag does not exist for create). The @ prefix reads a local file (must be relative path like temp/myfile.md). For documents longer than ~500 characters, ALWAYS write content to a temp file first and use @<relative-path>. Also always include --title.",'- Create doc from short inline text: command="docs +create" args=["--api-version", "v2", "--title", "Title", "--content", "<short-text>", "--doc-format", "markdown"]','- Fetch doc content: command="docs +fetch" args=["--api-version", "v2", "--doc", "<doc_url_or_token>"]'," NOTE: The flag is --doc (NOT --document-id). Accepts document URL or plain token.",` FALLBACK FOR OLD DOC: If docs +fetch returns error code 3380002 "Unsupported document type 'doc'", the document is an old-style doc (not docx). Fallback to the low-level api command: command="api" args=["GET", "/open-apis/doc/v2/<doc_token>/raw_content"]. This requires the docs:doc:readonly scope (NOT doc:doc:readonly \u2014 docs is the domain, doc is the sub-permission). If api fails with scope 99991672, ask the user to open the page directly.`,'- Update doc content: command="docs +update" args=["--api-version", "v2", "--doc", "<doc_url_or_token>", "--command", "overwrite", "--content", "@<relative-path>"]'," CRITICAL: v2 API requires --command (overwrite|append) and --content (NOT --markdown --mode). Use --content with @file for long content. The @ prefix reads a local file (must be relative path like temp/myfile.md).",'- Search docs: command="docs +search" args=["--query", "<keyword>"]','- Upload media to doc: command="docs +media-upload" args=["--file", "<relative-path>", "--document-id", "<id>"]',"","## Sheets (Spreadsheets)",'- Create spreadsheet: command="sheets +create" args=["--title", "My Sheet"]','- Read cells: command="sheets +read" args=["--spreadsheet-token", "<token>", "--range", "A1:D10"]','- Write cells: command="sheets +write" args=["--spreadsheet-token", "<token>", "--range", "A1", "--value", "hello"]','- Append rows: command="sheets +append" args=["--spreadsheet-token", "<token>", "--range", "A1:D1", "--values", "[[1,2,3,4]]"]','- Find in sheet: command="sheets +find" args=["--spreadsheet-token", "<token>", "--find", "keyword"]','- Export sheet: command="sheets +export" args=["--spreadsheet-token", "<token>", "--file", "output.xlsx"]',"","## IM (Messaging)",'- Send message: command="im +messages-send" args=["--receive-id-type", "chat_id", "--receive-id", "<id>", "--msg-type", "text", "--content", "{\\"text\\":\\"hello\\"}"]','- List chats: command="im +chat-list"','- Search chats: command="im +chat-search" args=["--query", "<keyword>"]','- List messages in chat: command="im +chat-messages-list" args=["--chat-id", "<id>"]','- Reply to message: command="im +messages-reply" args=["--message-id", "<id>", "--msg-type", "text", "--content", "{\\"text\\":\\"reply\\"}"]','- Create group chat (standalone, no project binding): command="im +chat-create" args=["--name", "Group Name"]','- Search messages: command="im +messages-search" args=["--query", "<keyword>"]','- Pin (flag) a message: command="im +flag-create" args=["--message-id", "<id>"]','- Download message resource: command="im +messages-resources-download" args=["--message-id", "<id>", "--file-key", "<key>", "--file", "output.png"]',"","## Drive (Cloud Drive)",'- Upload file: command="drive +upload" args=["--file", "<relative-path>"]','- Download file: command="drive +download" args=["--file-token", "<token>", "--file", "output.bin"]','- Create folder: command="drive +create-folder" args=["--name", "New Folder"]','- Search files: command="drive +search" args=["--query", "<keyword>"]','- Export document: command="drive +export" args=["--file-token", "<token>", "--type", "pdf"]',"","## Tasks",'- My tasks: command="task +get-my-tasks"','- Create task: command="task +create" args=["--summary", "Task title"]','- Complete task: command="task +complete" args=["--task-id", "<id>"]','- Search tasks: command="task +search" args=["--query", "<keyword>"]','- Create tasklist: command="task +tasklist-create" args=["--name", "My List"]',"","## Mail",'- List emails (triage): command="mail +triage" args=["--max", "20", "--format", "json"]','- Filter emails by folder: command="mail +triage" args=["--filter", "{\\"folder\\":\\"INBOX\\"}", "--format", "json"]','- Search emails by keyword: command="mail +triage" args=["--query", "keyword", "--format", "json"]','- Read single email: command="mail +message" args=["--message-id", "<id>"]','- Read multiple emails: command="mail +messages" args=["--message-ids", "id1,id2,id3"]','- Send email: command="mail +send" args=["--to", "user@example.com", "--subject", "Hello", "--body", "Content", "--confirm-send"]','- Reply to email: command="mail +reply" args=["--message-id", "<id>", "--body", "Reply content", "--confirm-send"]','- Create draft: command="mail +draft-create" args=["--to", "user@example.com", "--subject", "Draft"]','- View email thread: command="mail +thread" args=["--thread-id", "<id>"]',"","## Wiki (Knowledge Base)",'- List spaces: command="wiki +space-list"','- List nodes in space: command="wiki +node-list" args=["--space-id", "<id>"]','- Create wiki node: command="wiki +node-create" args=["--space-id", "<id>", "--title", "New Page"]','- Get node info: command="wiki +node-get" args=["--node-token", "<token>"]'," NOTE: Returns node metadata including obj_type and obj_token. To read the actual content, use docs +fetch with the obj_token from the node-get result."," READING WIKI CONTENT (full workflow):",' 1. Get node info: command="wiki +node-get" args=["--node-token", "<wiki_token>"]',' 2. Read doc content: command="docs +fetch" args=["--api-version", "v2", "--doc", "<obj_token_from_step1>", "--doc-format", "markdown"]',' 3. If step 2 fails with error 3380002 (old doc type), fallback: command="api" args=["GET", "/open-apis/doc/v2/<obj_token>/raw_content"]. Requires docs:doc:readonly scope (NOT doc:doc:readonly). If api fails with scope 99991672, the app lacks this scope \u2014 ask the user to open the wiki page in a browser or copy the content manually.',"","## VC (Video Conference)",'- Search meetings: command="vc +search" args=["--start", "2025-01-01", "--end", "2025-01-07"]','- Get meeting recording: command="vc +recording" args=["--meeting-id", "<id>"]','- Get meeting notes: command="vc +notes" args=["--meeting-id", "<id>"]',"","## Minutes (Meeting Minutes)",'- Search minutes: command="minutes +search" args=["--query", "<keyword>"]','- Download minutes: command="minutes +download" args=["--minutes-id", "<id>"]',"","## OKR",'- List OKR cycles: command="okr +cycle-list"','- Get cycle detail: command="okr +cycle-detail" args=["--cycle-id", "<id>"]','- Create progress: command="okr +progress-create" args=["--objective-id", "<id>", "--content", "Update"]',"","## Contact",'- Search user: command="contact +search-user" args=["--query", "<name>"]','- Get user info: command="contact +get-user" args=["--user-id", "<id>"]',"","## Slides (Presentations)",'- Create slides: command="slides +create" args=["--title", "My Deck"]',"","## Approval",'- Use API-style: command="approval" (then run --help for subcommands)',"",'HELP: Run command="<domain> --help" (e.g. "docs --help", "im --help") for full flag details of any domain.'].join(`
3541
- `),Jn.Hammer,{type:pr.OBJECT,properties:{command:{type:pr.STRING,description:'The lark-cli subcommand or shortcut (e.g., "calendar +agenda", "im.messages.create").'},args:{type:pr.ARRAY,items:{type:pr.STRING},description:"Optional arguments/flags to append to the command."},as:{type:pr.STRING,enum:["user","bot"],description:"Optional identity under which the command will be run."}},required:["command"]},!0,!0,!0),this.config=e}validateToolParams(e){let r=hi.validate(this.schema.parameters,e,n.Name);if(r)return r;if(!e.command||typeof e.command!="string"||e.command.trim()==="")return'Parameter "command" must be a non-empty string.';if(e.args!==void 0){if(!Array.isArray(e.args))return'Parameter "args" must be an array of strings.';for(let a of e.args)if(typeof a!="string")return'Each argument in "args" array must be a string.'}return e.as!==void 0&&e.as!=="user"&&e.as!=="bot"?'Parameter "as" must be either "user" or "bot".':null}getDescription(e){let r=e.args?` with args [${e.args.join(", ")}]`:"",a=e.as?` as ${e.as}`:"";return`Running lark-cli command: "${e.command}"${r}${a}`}detectBinary(){try{if(Odi("lark-cli",["--version"],{timeout:5e3,shell:!0}).status===0)return"lark-cli"}catch{}return"npx @larksuite/cli@latest"}sanitizeArg(e){return`"${e.replace(/(["$`\\])/g,"\\$1")}"`}buildCommand(e,r){let a=`${r} ${e.command}`;if(e.args&&e.args.length>0){let i=e.args.map(o=>this.sanitizeArg(o));a+=` ${i.join(" ")}`}return e.as&&(a+=` --as ${e.as}`),a}async execute(e,r,a){let i=this.validateToolParams(e);if(i)return{status:"failed",error:i,llmContent:JSON.stringify({status:"failed",error:i}),returnDisplay:`Parameter validation failed: ${i}`};let o=this.detectBinary(),t=this.buildCommand(e,o),s=await this.runStreaming(t,r,a);if(!zdi(e.command)&&this.needsAuthorization(s)){let u=this.classifyAuthFailure(s),I;if(u==="login"){I=this.extractAuthLoginCommand(s,e.command,o);let h;if(typeof this.config.getProjectSettingsManager=="function")try{h=this.config.getProjectSettingsManager().load()?.feishu}catch{}let c=["im:message.send_as_user"],m=h?.excludeScopes||[],g=Array.from(new Set([...c,...m]));h?.recommend&&!I.includes("--recommend")&&(I+=" --recommend"),g.length>0&&!I.includes("--exclude")&&(I+=` --exclude "${g.join(",")}"`),a&&(this.config.getFeishuMode()?a(`\u{1F511} Lark CLI \u9700\u8981\u7528\u6237\u767B\u5F55\u3002\u6B63\u5728\u542F\u52A8\u6D4F\u89C8\u5668\u6388\u6743\uFF0C\u8BF7\u7A0D\u5019...
3540
+ ${h}`:"User answered your questions.";return{llmContent:d,returnDisplay:c,summary:Object.keys(t).length>0?`Collected ${Object.keys(t).length} answer(s)`:"No answers"}}}});function men(n,e){let r=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(n),a=o=>r.find(t=>t.type===o)?.value??"00",i=a("hour")==="24"?"00":a("hour");return`${a("year")}-${a("month")}-${a("day")} ${i}:${a("minute")}:${a("second")}`}var C0e,R3t=ct(()=>{"use strict";ii();Pi();jc();C0e=class n extends Tn{config;static Name="local_time";constructor(e){super(n.Name,"LocalTime","Returns the current wall-clock local time of the machine running Easy Code. Use this tool to determine the current real-world time, record a start time at the beginning of a long task, calculate elapsed task duration by comparing two readings, or timestamp checkpoints, logs, or todo updates. The tool is fast, side-effect free, and never requires user confirmation, so you may call it as often as needed. Returned JSON fields: iso (ISO 8601 UTC timestamp), unix_ms (number), unix_s (number), timezone (IANA name), local (YYYY-MM-DD HH:MM:SS), weekday (English).",Jn.Info,{type:pr.OBJECT,properties:{timezone:{type:pr.STRING,description:'Optional IANA timezone name (e.g. "Asia/Shanghai", "UTC"). If omitted, uses the system local timezone.'}},required:[]}),this.config=e}validateToolParams(e){let r=hi.validate(this.schema.parameters,e,n.Name);return r||(e.timezone!==void 0&&(typeof e.timezone!="string"||e.timezone.trim()==="")?'Parameter "timezone" must be a non-empty IANA timezone string.':null)}getDescription(e){return e.timezone?`Get current time in timezone "${e.timezone}"`:"Get current local time"}async execute(e,r){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:`Parameter validation failed: ${a}`};let i=new Date,o=e.timezone?.trim(),t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",s,u,I,d;try{s=o||t,u=men(i,s),I=new Intl.DateTimeFormat("en-US",{weekday:"long",timeZone:s}).format(i)}catch(m){s=t,u=men(i,s),I=new Intl.DateTimeFormat("en-US",{weekday:"long",timeZone:s}).format(i);let g=m instanceof Error?m.message:String(m);d=`Invalid timezone "${o}" (${g}); fell back to system timezone.`}let h={iso:i.toISOString(),unix_ms:i.getTime(),unix_s:Math.floor(i.getTime()/1e3),timezone:s,local:u,weekday:I};d&&(h.warning=d);let c=d?`Local time: ${u} (${s}, ${I}) - ${d}`:`Local time: ${u} (${s}, ${I})`;return{llmContent:JSON.stringify(h),returnDisplay:c,summary:u}}}});import{spawn as pen,spawnSync as Odi}from"node:child_process";import Mdi from"node:os";function zdi(n){let e=n.trim().toLowerCase();return e.startsWith("config init")||e.startsWith("auth login")||e.startsWith("auth logout")}var Udi,fen,_di,HHe,ben=ct(()=>{"use strict";ii();Pi();jc();Udi=500,fen=900*1e3,_di=/https?:\/\/[^\s'"]*?(?:page\/cli\?user_code=|open-apis\/authen)[^\s'"]*/;HHe=class n extends Tn{config;static Name="lark_cli";constructor(e){super(n.Name,"LarkCli",["Unified wrapper for the official lark-cli tool. Provides access to 18+ business domains in Lark (Feishu) for both automation and AI agent-driven workflows.","","RULES:","- ALWAYS use this tool for every Lark/Feishu operation \u2014 NEVER run lark-cli via run_shell_command/shell.",'- ROUTING: When the user wants to create a project with a local directory AND a Feishu group chat bound together (e.g. "\u62C9\u4E2A\u7FA4 + \u9879\u76EE\u8DEF\u5F84", "create a project group"), use the `create_project_and_group_chat` tool instead \u2014 it handles directory creation, group creation, user invitation, and workspace binding in one call. Note: this tool is only available when the Feishu bot is running (/feishu start). If the tool is not listed, fall back to `im +chat-create` for a standalone group chat.','- Authorization is fully automatic: if the CLI is not configured/authorized yet, this tool launches the browser device-flow login itself and streams the verification URL to the user in real time within the same call. Do NOT manually run "lark-cli config init" or "auth login" in a shell.','- Do NOT guess subcommands or flags. If unsure what a command supports, run it with "--help" first (e.g. command="calendar --help"). Error responses include hints with available options \u2014 follow them instead of guessing.','- lark-cli has built-in AI agent skills with domain-specific knowledge. Use `skills list` to see all 27 skills, and `skills read <skill-name>` (e.g. command="skills" args=["read","lark-doc"]) to get version-matched API guides before using an unfamiliar domain.',,"","COMMON COMMAND CHEATSHEET (use these patterns to avoid trial-and-error):","","## Calendar",`- Today's agenda: command="calendar +agenda"`,'- Agenda by date range: command="calendar +agenda" args=["--start", "2025-01-01", "--end", "2025-01-07"]','- Create event: command="calendar +create" args=["--summary", "Meeting", "--start", "2025-01-01T10:00:00+08:00", "--end", "2025-01-01T11:00:00+08:00"]','- Update event: command="calendar +update" args=["--event-id", "<id>", "--summary", "New Title"]','- Free/busy query: command="calendar +freebusy" args=["--start", "2025-01-01", "--end", "2025-01-01"]','- Find meeting rooms: command="calendar +room-find" args=["--slot", "2025-01-01T10:00:00+08:00~2025-01-01T11:00:00+08:00"]','- RSVP to event: command="calendar +rsvp" args=["--event-id", "<id>", "--rsvp-status", "accept"]','- Smart time suggestion: command="calendar +suggestion" args=["--start", "2025-01-01", "--end", "2025-01-07"]',"","## Docs (Documents)",'- Create doc from file (RECOMMENDED for content >500 chars): command="docs +create" args=["--api-version", "v2", "--title", "Title", "--content", "@<relative-path>", "--doc-format", "markdown"]'," CRITICAL: Use --content with @file (NOT inline text for long content \u2014 inline silently drops content; NOT --markdown \u2014 that flag does not exist for create). The @ prefix reads a local file (must be relative path like temp/myfile.md). For documents longer than ~500 characters, ALWAYS write content to a temp file first and use @<relative-path>. Also always include --title.",'- Create doc from short inline text: command="docs +create" args=["--api-version", "v2", "--title", "Title", "--content", "<short-text>", "--doc-format", "markdown"]','- Fetch doc content: command="docs +fetch" args=["--api-version", "v2", "--doc", "<doc_url_or_token>"]'," NOTE: The flag is --doc (NOT --document-id). Accepts document URL or plain token.",` FALLBACK FOR OLD DOC: If docs +fetch returns error code 3380002 "Unsupported document type 'doc'", the document is an old-style doc (not docx). Fallback to the low-level api command: command="api" args=["GET", "/open-apis/doc/v2/<doc_token>/raw_content"]. This requires the docs:doc:readonly scope (NOT doc:doc:readonly \u2014 docs is the domain, doc is the sub-permission). If api fails with scope 99991672, ask the user to open the page directly.`,'- Update doc content: command="docs +update" args=["--api-version", "v2", "--doc", "<doc_url_or_token>", "--command", "overwrite", "--content", "@<relative-path>"]'," CRITICAL: v2 API requires --command (overwrite|append) and --content (NOT --markdown --mode). Use --content with @file for long content. The @ prefix reads a local file (must be relative path like temp/myfile.md).",'- Search docs: command="docs +search" args=["--query", "<keyword>"]','- Upload media to doc: command="docs +media-upload" args=["--file", "<relative-path>", "--document-id", "<id>"]',"","## Sheets (Spreadsheets)",'- Create spreadsheet: command="sheets +create" args=["--title", "My Sheet"]','- Read cells: command="sheets +read" args=["--spreadsheet-token", "<token>", "--range", "A1:D10"]','- Write cells: command="sheets +write" args=["--spreadsheet-token", "<token>", "--range", "A1", "--value", "hello"]','- Append rows: command="sheets +append" args=["--spreadsheet-token", "<token>", "--range", "A1:D1", "--values", "[[1,2,3,4]]"]','- Find in sheet: command="sheets +find" args=["--spreadsheet-token", "<token>", "--find", "keyword"]','- Export sheet: command="sheets +export" args=["--spreadsheet-token", "<token>", "--file", "output.xlsx"]',"","## IM (Messaging)",'- Send message: command="im +messages-send" args=["--receive-id-type", "chat_id", "--receive-id", "<id>", "--msg-type", "text", "--content", "{\\"text\\":\\"hello\\"}"]','- List chats: command="im +chat-list"','- Search chats: command="im +chat-search" args=["--query", "<keyword>"]','- List messages in chat: command="im +chat-messages-list" args=["--chat-id", "<id>"]','- Reply to message: command="im +messages-reply" args=["--message-id", "<id>", "--msg-type", "text", "--content", "{\\"text\\":\\"reply\\"}"]','- Create group chat (standalone, no project binding): command="im +chat-create" args=["--name", "Group Name"]','- Search messages: command="im +messages-search" args=["--query", "<keyword>"]','- Pin (flag) a message: command="im +flag-create" args=["--message-id", "<id>"]','- Download message resource: command="im +messages-resources-download" args=["--message-id", "<id>", "--file-key", "<key>", "--file", "output.png"]',"","## Drive (Cloud Drive)",'- Upload file: command="drive +upload" args=["--file", "<relative-path>"]','- Download file: command="drive +download" args=["--file-token", "<token>", "--file", "output.bin"]','- Create folder: command="drive +create-folder" args=["--name", "New Folder"]','- Search files: command="drive +search" args=["--query", "<keyword>"]','- Export document: command="drive +export" args=["--file-token", "<token>", "--type", "pdf"]',"","## Tasks",'- My tasks: command="task +get-my-tasks"','- Create task: command="task +create" args=["--summary", "Task title"]','- Complete task: command="task +complete" args=["--task-id", "<id>"]','- Search tasks: command="task +search" args=["--query", "<keyword>"]','- Create tasklist: command="task +tasklist-create" args=["--name", "My List"]',"","## Mail",'- List emails (triage): command="mail +triage" args=["--max", "20", "--format", "json"]','- Filter emails by folder: command="mail +triage" args=["--filter", "{\\"folder\\":\\"INBOX\\"}", "--format", "json"]','- Search emails by keyword: command="mail +triage" args=["--query", "keyword", "--format", "json"]','- Read single email: command="mail +message" args=["--message-id", "<id>"]','- Read multiple emails: command="mail +messages" args=["--message-ids", "id1,id2,id3"]','- Send email: command="mail +send" args=["--to", "user@example.com", "--subject", "Hello", "--body", "Content", "--confirm-send"]','- Reply to email: command="mail +reply" args=["--message-id", "<id>", "--body", "Reply content", "--confirm-send"]','- Create draft: command="mail +draft-create" args=["--to", "user@example.com", "--subject", "Draft"]','- View email thread: command="mail +thread" args=["--thread-id", "<id>"]',"","## Wiki (Knowledge Base)",'- List spaces: command="wiki +space-list"','- List nodes in space: command="wiki +node-list" args=["--space-id", "<id>"]','- Create wiki node: command="wiki +node-create" args=["--space-id", "<id>", "--title", "New Page"]','- Get node info: command="wiki +node-get" args=["--node-token", "<token>"]'," NOTE: Returns node metadata including obj_type and obj_token. To read the actual content, use docs +fetch with the obj_token from the node-get result."," READING WIKI CONTENT (full workflow):",' 1. Get node info: command="wiki +node-get" args=["--node-token", "<wiki_token>"]',' 2. Read doc content: command="docs +fetch" args=["--api-version", "v2", "--doc", "<obj_token_from_step1>", "--doc-format", "markdown"]',' 3. If step 2 fails with error 3380002 (old doc type), fallback: command="api" args=["GET", "/open-apis/doc/v2/<obj_token>/raw_content"]. Requires docs:doc:readonly scope (NOT doc:doc:readonly). If api fails with scope 99991672, the app lacks this scope \u2014 ask the user to open the wiki page in a browser or copy the content manually.',"","## VC (Video Conference)",'- Search meetings: command="vc +search" args=["--start", "2025-01-01", "--end", "2025-01-07"]','- Get meeting recording: command="vc +recording" args=["--meeting-id", "<id>"]','- Get meeting notes: command="vc +notes" args=["--meeting-id", "<id>"]',"","## Minutes (Meeting Minutes)",'- Search minutes: command="minutes +search" args=["--query", "<keyword>"]','- Download minutes: command="minutes +download" args=["--minutes-id", "<id>"]',"","## OKR",'- List OKR cycles: command="okr +cycle-list"','- Get cycle detail: command="okr +cycle-detail" args=["--cycle-id", "<id>"]','- Create progress: command="okr +progress-create" args=["--objective-id", "<id>", "--content", "Update"]',"","## Contact",'- Search user: command="contact +search-user" args=["--query", "<name>"]','- Get user info: command="contact +get-user" args=["--user-id", "<id>"]',"","## Slides (Presentations)",'- Create slides: command="slides +create" args=["--title", "My Deck"]',"","## Approval",'- Use API-style: command="approval" (then run --help for subcommands)',"","## Markdown (Drive-native Markdown files)",'- Create Markdown file: command="markdown +create" args=["--file", "<relative-path>", "--title", "My Doc"]','- Fetch Markdown file: command="markdown +fetch" args=["--file-token", "<token>"]','- Overwrite Markdown file: command="markdown +overwrite" args=["--file-token", "<token>", "--file", "<relative-path>"]','- Diff Markdown versions or against local file: command="markdown +diff" args=["--file-token", "<token>"]','- Patch Markdown file (fetch-edit-overwrite): command="markdown +patch" args=["--file-token", "<token>", "--file", "<relative-path>"]',"","## Base (Bitable / Multidimensional Table)",'- Create base: command="base +base-create" args=["--name", "My Base"]','- List tables: command="base +table-list" args=["--base-token", "<token>"]','- List records: command="base +record-list" args=["--base-token", "<token>", "--table-id", "<id>"]','- Create record: command="base +record-batch-create" args=["--base-token", "<token>", "--table-id", "<id>", "--records", "[{\\"fields\\":{\\"Name\\":\\"value\\"}}]"]','- Search records: command="base +record-search" args=["--base-token", "<token>", "--table-id", "<id>", "--query", "keyword"]','- Delete record: command="base +record-delete" args=["--base-token", "<token>", "--table-id", "<id>", "--record-ids", "id1,id2"]',' NOTE: Base has 60+ subcommands for tables, fields, records, views, dashboards, workflows, forms, and roles. Always run command="base --help" first or use command="skills" args=["read","lark-base"] to get the full domain guide.',"","## Skills (Built-in Agent Skills)",'- List all skills: command="skills list"','- Read a skill guide: command="skills" args=["read", "<skill-name>"]'," NOTE: lark-cli ships with 27 built-in skills (lark-doc, lark-base, lark-sheets, lark-im, lark-calendar, lark-drive, lark-mail, lark-wiki, lark-markdown, lark-task, lark-vc, lark-minutes, lark-note, lark-whiteboard, lark-okr, lark-contact, lark-slides, lark-approval, lark-apps, lark-event, lark-attendance, etc.). These skills contain version-matched API guides that are more up-to-date than this cheat sheet. Use skills read before working with an unfamiliar domain.","","## Note (Meeting Notes)",'- Get note detail: command="note +detail" args=["--note-id", "<id>"]','- Fetch transcript: command="note +transcript" args=["--note-id", "<id>", "--file", "transcript.txt"]',"","## Whiteboard",'- Query whiteboard: command="whiteboard +query" args=["--file-token", "<token>"]','- Update whiteboard: command="whiteboard +update" args=["--file-token", "<token>", "--mermaid", "graph TD; A-->B"]',"","## Doctor (Health Check)",'- Full health check: command="doctor"','- Offline check only: command="doctor" args=["--offline"]',"",'HELP: Run command="<domain> --help" (e.g. "docs --help", "im --help") for full flag details of any domain.'].join(`
3541
+ `),Jn.Hammer,{type:pr.OBJECT,properties:{command:{type:pr.STRING,description:'The lark-cli subcommand or shortcut (e.g., "calendar +agenda", "im.messages.create").'},args:{type:pr.ARRAY,items:{type:pr.STRING},description:"Optional arguments/flags to append to the command."},as:{type:pr.STRING,enum:["user","bot"],description:"Optional identity under which the command will be run."}},required:["command"]},!0,!0,!0),this.config=e}validateToolParams(e){let r=hi.validate(this.schema.parameters,e,n.Name);if(r)return r;if(!e.command||typeof e.command!="string"||e.command.trim()==="")return'Parameter "command" must be a non-empty string.';if(e.args!==void 0){if(!Array.isArray(e.args))return'Parameter "args" must be an array of strings.';for(let a of e.args)if(typeof a!="string")return'Each argument in "args" array must be a string.'}return e.as!==void 0&&e.as!=="user"&&e.as!=="bot"?'Parameter "as" must be either "user" or "bot".':null}getDescription(e){let r=e.args?` with args [${e.args.join(", ")}]`:"",a=e.as?` as ${e.as}`:"";return`Running lark-cli command: "${e.command}"${r}${a}`}detectBinary(){try{if(Odi("lark-cli",["--version"],{timeout:5e3,shell:!0}).status===0)return"lark-cli"}catch{}return"npx @larksuite/cli@1.0.53"}sanitizeArg(e){return`"${e.replace(/(["$`\\])/g,"\\$1")}"`}buildCommand(e,r){let a=`${r} ${e.command}`;if(e.args&&e.args.length>0){let i=e.args.map(o=>this.sanitizeArg(o));a+=` ${i.join(" ")}`}return e.as&&(a+=` --as ${e.as}`),a}async execute(e,r,a){let i=this.validateToolParams(e);if(i)return{status:"failed",error:i,llmContent:JSON.stringify({status:"failed",error:i}),returnDisplay:`Parameter validation failed: ${i}`};let o=this.detectBinary(),t=this.buildCommand(e,o),s=await this.runStreaming(t,r,a);if(!zdi(e.command)&&this.needsAuthorization(s)){let u=this.classifyAuthFailure(s),I;if(u==="login"){I=this.extractAuthLoginCommand(s,e.command,o);let h;if(typeof this.config.getProjectSettingsManager=="function")try{h=this.config.getProjectSettingsManager().load()?.feishu}catch{}let m=[...h?.excludeScopes||[]];h?.recommend&&!I.includes("--recommend")&&(I+=" --recommend"),m.length>0&&!I.includes("--exclude")&&(I+=` --exclude "${m.join(",")}"`),a&&(this.config.getFeishuMode()?a(`\u{1F511} Lark CLI \u9700\u8981\u7528\u6237\u767B\u5F55\u3002\u6B63\u5728\u542F\u52A8\u6D4F\u89C8\u5668\u6388\u6743\uFF0C\u8BF7\u7A0D\u5019...
3542
3542
  `):a(`\u{1F511} Lark CLI requires user login. Starting browser authorization...
3543
3543
  `))}else I=`${o} config init --new`,a&&(this.config.getFeishuMode()?a(`\u2699\uFE0F Lark CLI \u5C1A\u672A\u914D\u7F6E\u3002\u6B63\u5728\u542F\u52A8\u5E94\u7528\u914D\u7F6E\uFF0C\u8BF7\u7A0D\u5019...
3544
3544
  `):a(`\u2699\uFE0F Lark CLI is not configured yet. Starting app setup...
3545
3545
  `));let d=await this.runStreaming(I,r,a);return this.buildResult(d)}return this.buildResult(s)}needsAuthorization(e){if(e.code===0||e.timedOut||e.aborted)return!1;let r=`${e.stdout}
3546
- ${e.stderr}`.toLowerCase();return r.includes("pending approval")?!1:r.includes("not configured")||r.includes('"type": "config"')||r.includes('"type":"config"')||/lark-cli\s+config\s+init/.test(r)||r.includes("user_login_required")||r.includes("need_user_authorization")||r.includes("missing_scope")}classifyAuthFailure(e){let r=`${e.stdout}
3546
+ ${e.stderr}`.toLowerCase();return r.includes("pending approval")||r.includes("app_scope_not_applied")?!1:r.includes("not configured")||r.includes('"type": "config"')||r.includes('"type":"config"')||/lark-cli\s+config\s+init/.test(r)||r.includes("user_login_required")||r.includes("need_user_authorization")||r.includes("missing_scope")}classifyAuthFailure(e){let r=`${e.stdout}
3547
3547
  ${e.stderr}`.toLowerCase();return r.includes("user_login_required")||r.includes("need_user_authorization")||r.includes("missing_scope")?"login":"config"}extractAuthLoginCommand(e,r,a){let i=`${e.stdout}
3548
3548
  ${e.stderr}`,o=i.match(/lark-cli\s+auth\s+login\s+(--domain\s+[^\s`]+|--scope\s+(?:"[^"]*"|[^\s`]+(?:\s+[^\s`]+)*))/);if(o){let u=o[1];if(u.startsWith("--scope")){let d=u.match(/--scope\s+"([^"]*)"/)||u.match(/--scope\s+([^\s`]+(?:\s+[^\s`]+)*)/);if(d){let c=d[1].replace(/[\\'"]+/g,"").split(/[\s,]+/).filter(Boolean),m=Array.from(new Set(c.map(g=>g.split(":")[0]).filter(g=>g&&g.length>0)));if(m.length>0)return`${a} auth login --domain ${m.join(",")}`}}let I=o[0].replace(/^lark-cli\s+auth\s+login\s+/,"");return`${a} auth login ${I}`}let t=i.match(/current command requires scope\(s\):\s*(.+)/i);if(t){let u=t[1].split(",")[0].trim().replace(/[`'"]+$/,""),I=u.split(":")[0];return I?`${a} auth login --domain ${I}`:`${a} auth login --scope ${u}`}let s=r.trim().split(/\s+/)[0];return s?`${a} auth login --domain ${s}`:`${a} auth login`}runStreaming(e,r,a){return new Promise(i=>{let o=pen(e,{shell:!0,stdio:["ignore","pipe","pipe"],env:{...process.env}}),t="",s="",u="",I,d=0,h=!1,c=(w=!1)=>{if(!a)return;let p=Date.now();if(!w&&p-d<Udi)return;d=p;let y="";I&&(this.config.getFeishuMode()?y=`\u{1F511} \u98DE\u4E66\u7F51\u5173\u6A21\u5F0F\uFF1A\u8BF7\u70B9\u51FB\u4EE5\u4E0B\u94FE\u63A5\u8FDB\u884C\u6388\u6743\u3002\u6253\u5F00\u94FE\u63A5\u540E\uFF0C\u9009\u62E9 \u201C\u5DF2\u6709\u5E94\u7528\u201D\uFF0C\u9009\u62E9\u672C\u673A\u5668\u4EBA\u5373\u53EF\uFF1A
3549
3549
  \u{1F517} ${I}
@@ -3552,15 +3552,19 @@ ${e.stderr}`,o=i.match(/lark-cli\s+auth\s+login\s+(--domain\s+[^\s`]+|--scope\s+
3552
3552
  ${I}
3553
3553
 
3554
3554
  `),a(y+u)},m=(w,p)=>{let y=w.toString("utf8");if(p?s+=y:t+=y,u+=y,!I){let N=u.match(_di);if(N){I=N[0],c(!0);return}}c()};o.stdout?.on("data",w=>m(w,!1)),o.stderr?.on("data",w=>m(w,!0));let g=()=>{if(!o.killed)try{Mdi.platform()==="win32"&&o.pid?pen("taskkill",["/pid",String(o.pid),"/f","/t"]):o.kill("SIGTERM")}catch{}},v=!1,Z=!1,A=setTimeout(()=>{h||(v=!0,g())},fen),R=()=>{h||(Z=!0,g())};r.aborted?R():r.addEventListener("abort",R,{once:!0});let F=()=>{clearTimeout(A),r.removeEventListener("abort",R)};o.on("error",w=>{if(h)return;h=!0,F();let p=w.message||"Failed to launch lark-cli";i({code:null,stdout:t,stderr:s,authUrl:I,timedOut:v,aborted:Z,launchError:p})}),o.on("exit",w=>{h||(h=!0,F(),c(!0),i({code:w,stdout:t,stderr:s,authUrl:I,timedOut:v,aborted:Z}))})})}buildResult(e){let{code:r,stdout:a,stderr:i,authUrl:o,timedOut:t,aborted:s,launchError:u}=e,I=a.trim();if(u)return{status:"failed",error:u,llmContent:JSON.stringify({status:"failed",error:u,stderr:i}),returnDisplay:`\u274C lark-cli execution failed: ${u}`,summary:"Failed"};if(t){let g=`lark-cli timed out after ${fen/6e4} minutes`;return{status:"failed",error:g,llmContent:JSON.stringify({status:"failed",error:g,stderr:i}),returnDisplay:`\u274C ${g}`,summary:"Timed out"}}if(s){let g="lark-cli execution was cancelled";return{status:"failed",error:g,llmContent:JSON.stringify({status:"failed",error:g,stderr:i}),returnDisplay:`\u23F9\uFE0F ${g}`,summary:"Cancelled"}}if(r===0){let g;try{g=JSON.parse(I||"{}")}catch{g={rawOutput:I}}let v={status:"success",data:g,llmContent:JSON.stringify({status:"success",data:g}),returnDisplay:I||"lark-cli executed successfully.",summary:"Success"};return o&&(v.authUrl=o),v}if(o){let g={status:"auth_required",authUrl:o},v=`\u{1F511} Authentication Required: Please authorize via: ${o}`;return this.config.getFeishuMode()&&(v=`\u{1F511} \u98DE\u4E66\u7F51\u5173\u6A21\u5F0F\uFF1A\u9700\u8981\u767B\u5F55\u8BA4\u8BC1\uFF0C\u8BF7\u70B9\u51FB\u4EE5\u4E0B\u94FE\u63A5\u8FDB\u884C\u6388\u6743\u3002\u6253\u5F00\u94FE\u63A5\u540E\uFF0C\u9009\u62E9 \u201C\u5DF2\u6709\u5E94\u7528\u201D\uFF0C\u9009\u62E9\u672C\u673A\u5668\u4EBA\u5373\u53EF\uFF1A
3555
- \u{1F517} ${o}`),{status:"auth_required",authUrl:o,llmContent:JSON.stringify(g),returnDisplay:v,summary:"Auth Required"}}let d=i.trim()||I||`lark-cli exited with code ${r}`,h="";d.toLowerCase().includes("pending approval")&&(h+=`
3555
+ \u{1F517} ${o}`),{status:"auth_required",authUrl:o,llmContent:JSON.stringify(g),returnDisplay:v,summary:"Auth Required"}}let d=i.trim()||I||`lark-cli exited with code ${r}`,h="";if(d.toLowerCase().includes("pending approval")&&(h+=`
3556
3556
 
3557
3557
  \u{1F512} CRITICAL INFO FOR USER & AI:
3558
3558
  The Feishu/Lark application is currently pending approval by your corporate enterprise administrator.
3559
3559
  \u{1F449} Action required: Please contact your IT/Feishu administrator to approve this custom app in the Feishu Admin Console (\u98DE\u4E66\u7BA1\u7406\u540E\u53F0 - \u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03) first, then run this command again. Do NOT try other authentication or login commands because they will also be blocked until approved.`),(d.includes("3380002")||d.includes("Unsupported document type"))&&(h+=`
3560
3560
 
3561
- \u{1F4A1} This is an old-style 'doc' document (not docx). Fallback: command="api" args=["GET", "/open-apis/doc/v2/<doc_token>/raw_content"]. Requires docs:doc:readonly scope (NOT doc:doc:readonly). If api also fails with 99991672, ask the user to open the wiki page directly.`),(d.includes("99991672")||d.includes("app_scope_not_applied"))&&(h+=`
3561
+ \u{1F4A1} This is an old-style 'doc' document (not docx). Fallback: command="api" args=["GET", "/open-apis/doc/v2/<doc_token>/raw_content"]. Requires docs:doc:readonly scope (NOT doc:doc:readonly). If api also fails with 99991672, ask the user to open the wiki page directly.`),d.includes("99991672")||d.includes("app_scope_not_applied"))try{let v=JSON.parse(d)?.error;if(v){let Z=v.missing_scopes||[],A=v.console_url||"";Z.length>0&&(h+=`
3562
3562
 
3563
- \u{1F4A1} Missing API scope. The app needs additional permissions. Check: the old doc API (/open-apis/doc/v2/) requires docs:doc:readonly scope (NOT doc:doc:readonly). Apply at https://open.feishu.cn/app/cli_aa9c19096a7c9cc5/auth then re-authenticate.`);try{let v=JSON.parse(d)?.error;v&&(v.hint&&(h+=`
3563
+ \u{1F510} \u5F53\u524D\u5E94\u7528\u7F3A\u5C11\u4EE5\u4E0B\u6743\u9650\u8303\u56F4 (scope): ${Z.join(", ")}`),A?h+=`
3564
+ \u{1F449} \u8BF7\u5728\u98DE\u4E66\u5F00\u53D1\u8005\u540E\u53F0\u7533\u8BF7\u6743\u9650\u540E\u91CD\u65B0\u6388\u6743: ${A}`:Z.length>0&&(h+=`
3565
+ \u{1F449} \u8BF7\u5728\u98DE\u4E66\u5F00\u53D1\u8005\u540E\u53F0 (https://open.feishu.cn/app/cli_aa9c19096a7c9cc5/auth) \u7533\u8BF7\u6743\u9650\u540E\u91CD\u65B0\u6388\u6743`)}}catch{h+=`
3566
+
3567
+ \u{1F4A1} \u7F3A\u5C11 API \u6743\u9650\u3002\u8BF7\u5728\u98DE\u4E66\u5F00\u53D1\u8005\u540E\u53F0 (https://open.feishu.cn/app/cli_aa9c19096a7c9cc5/auth) \u7533\u8BF7\u6240\u9700\u6743\u9650\u540E\u91CD\u65B0\u6388\u6743\u3002`}try{let v=JSON.parse(d)?.error;v&&(v.hint&&(h+=`
3564
3568
  \u{1F4A1} Hint: ${v.hint}`),v.detail?.available&&(h+=`
3565
3569
  \u{1F4CB} Available: ${v.detail.available.join(", ")}`),v.message&&!d.includes(v.message)&&(h+=`
3566
3570
  \u{1F4C4} ${v.message}`))}catch{}let c=h?`${d}${h}`:d;return{status:"failed",error:c,llmContent:JSON.stringify({status:"failed",error:c,stderr:i}),returnDisplay:`\u274C lark-cli execution failed: ${c}`,summary:"Failed"}}}});var vT=ct(()=>{Sit();Sit()});var yu,um,VK,C3t=ct(()=>{yu={authenticate:"authenticate",initialize:"initialize",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},um={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"},VK=1});var jdi,qdi,Kdi,$di,eIi,tIi,Y3t,rIi,nIi,aIi,iIi,sIi,oIi,gen,lIi,Gen,ven,yen,Aen,cIi,uIi,Zen,Nen,dIi,V3t,IIi,hIi,mIi,pIi,XHe,Q3t,fIi,H3t,Wen,bIi,gIi,GIi,vIi,yIi,AIi,ZIi,Fen,X3t,NIi,WIi,yT,_Os,FIi,x0e,EIi,wIi,RIi,CIi,xIi,YIi,VIi,QIi,HIi,Een,XIi,k3t,wen,kIi,SIi,LIi,QK,BIi,TIi,Zh,S3t,zOs,L3t,B3t,T3t,J3t,D3t,O3t,M3t,U3t,JIi,DIi,OIi,MIi,kHe,UIi,_Ii,SHe,LHe,zIi,PIi,jIi,qIi,KIi,$Ii,ehi,thi,_3t,rhi,z3t,nhi,P3t,ahi,ihi,shi,ohi,j3t,lhi,chi,uhi,dhi,Ihi,q3t,hhi,x3t,K3t,POs,Ren,Cen,xen,Yen,Ven,mhi,Qen,$3t,phi,fhi,bhi,ghi,Ghi,vhi,jOs,yhi,Ahi,eWt,qOs,tWt,Zhi,rWt,KOs,Nhi,$Os,Hen=ct(()=>{Nwe();jdi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),terminal:ot.boolean().optional().default(!1)}),qdi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),label:ot.string().nullish(),name:ot.string(),optional:ot.boolean().optional().default(!1),secret:ot.boolean().optional().default(!0)}),Kdi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),description:ot.string().nullish(),id:ot.string(),name:ot.string()}),$di=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),description:ot.string().nullish(),id:ot.string(),link:ot.string().nullish(),name:ot.string(),vars:ot.array(qdi)}),eIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),args:ot.array(ot.string()).optional(),description:ot.string().nullish(),env:ot.record(ot.string(),ot.string()).optional(),id:ot.string(),name:ot.string()}),tIi=ot.union([$di.and(ot.object({type:ot.literal("env_var")})),eIi.and(ot.object({type:ot.literal("terminal")})),Kdi]),Y3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),methodId:ot.string()}),rIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),nIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),blob:ot.string(),mimeType:ot.string().nullish(),uri:ot.string()}),aIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),iIi=ot.object({amount:ot.number(),currency:ot.string()}),sIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),terminalId:ot.string()}),oIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),newText:ot.string(),oldText:ot.string().nullish(),path:ot.string()}),gen=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),name:ot.string(),value:ot.string()}),lIi=ot.union([ot.literal(-32700),ot.literal(-32600),ot.literal(-32601),ot.literal(-32602),ot.literal(-32603),ot.literal(-32800),ot.literal(-32e3),ot.literal(-32002),ot.number().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),Gen=ot.object({code:lIi,data:ot.unknown().optional(),message:ot.string()}),ven=ot.unknown(),yen=ot.unknown(),Aen=ot.unknown(),cIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),readTextFile:ot.boolean().optional().default(!1),writeTextFile:ot.boolean().optional().default(!1)}),uIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),auth:jdi.optional().default({terminal:!1}),fs:cIi.optional().default({readTextFile:!1,writeTextFile:!1}),terminal:ot.boolean().optional().default(!1)}),Zen=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),name:ot.string(),value:ot.string()}),Nen=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),name:ot.string(),title:ot.string().nullish(),version:ot.string()}),dIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),V3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),cursor:ot.string().nullish(),cwd:ot.string().nullish()}),IIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),http:ot.boolean().optional().default(!1),sse:ot.boolean().optional().default(!1)}),hIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),headers:ot.array(Zen),name:ot.string(),url:ot.string()}),mIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),headers:ot.array(Zen),name:ot.string(),url:ot.string()}),pIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),args:ot.array(ot.string()),command:ot.string(),env:ot.array(gen),name:ot.string()}),XHe=ot.union([hIi.and(ot.object({type:ot.literal("http")})),mIi.and(ot.object({type:ot.literal("sse")})),pIi]),Q3t=ot.string(),fIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),description:ot.string().nullish(),modelId:Q3t,name:ot.string()}),H3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),cwd:ot.string(),mcpServers:ot.array(XHe)}),Wen=ot.string(),bIi=ot.union([ot.literal("allow_once"),ot.literal("allow_always"),ot.literal("reject_once"),ot.literal("reject_always")]),gIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),kind:bIi,name:ot.string(),optionId:Wen}),GIi=ot.union([ot.literal("high"),ot.literal("medium"),ot.literal("low")]),vIi=ot.union([ot.literal("pending"),ot.literal("in_progress"),ot.literal("completed")]),yIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),content:ot.string(),priority:GIi,status:vIi}),AIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),entries:ot.array(yIi)}),ZIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),audio:ot.boolean().optional().default(!1),embeddedContext:ot.boolean().optional().default(!1),image:ot.boolean().optional().default(!1)}),Fen=ot.number().int().gte(0).lte(65535),X3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),clientCapabilities:uIi.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:Nen.nullish(),protocolVersion:Fen}),NIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),content:ot.string()}),WIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),yT=ot.union([ot.number(),ot.string()]).nullable(),_Os=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),requestId:yT}),FIi=ot.enum(["assistant","user"]),x0e=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),audience:ot.array(FIi).nullish(),lastModified:ot.string().nullish(),priority:ot.number().nullish()}),EIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),annotations:x0e.nullish(),data:ot.string(),mimeType:ot.string()}),wIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),annotations:x0e.nullish(),data:ot.string(),mimeType:ot.string(),uri:ot.string().nullish()}),RIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),annotations:x0e.nullish(),description:ot.string().nullish(),mimeType:ot.string().nullish(),name:ot.string(),size:ot.number().nullish(),title:ot.string().nullish(),uri:ot.string()}),CIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),optionId:Wen}),xIi=ot.union([ot.object({outcome:ot.literal("cancelled")}),CIi.and(ot.object({outcome:ot.literal("selected")}))]),YIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),outcome:xIi}),VIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),QIi=ot.object({currentValue:ot.boolean()}),HIi=ot.string(),Een=ot.string(),XIi=ot.union([ot.literal("mode"),ot.literal("model"),ot.literal("thought_level"),ot.string()]),k3t=ot.string(),wen=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),description:ot.string().nullish(),name:ot.string(),value:k3t}),kIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),group:HIi,name:ot.string(),options:ot.array(wen)}),SIi=ot.union([ot.array(wen),ot.array(kIi)]),LIi=ot.object({currentValue:k3t,options:SIi}),QK=ot.intersection(ot.union([LIi.and(ot.object({type:ot.literal("select")})),QIi.and(ot.object({type:ot.literal("boolean")}))]),ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),category:XIi.nullish(),description:ot.string().nullish(),id:Een,name:ot.string()})),BIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),configOptions:ot.array(QK)}),TIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),Zh=ot.string(),S3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),sessionId:Zh}),zOs=ot.object({method:ot.string(),params:ot.union([S3t,ven]).nullish()}),L3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),sessionId:Zh}),B3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),args:ot.array(ot.string()).optional(),command:ot.string(),cwd:ot.string().nullish(),env:ot.array(gen).optional(),outputByteLimit:ot.number().nullish(),sessionId:Zh}),T3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),cwd:ot.string(),mcpServers:ot.array(XHe).optional(),sessionId:Zh}),J3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),sessionId:Zh,terminalId:ot.string()}),D3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),cwd:ot.string(),mcpServers:ot.array(XHe),sessionId:Zh}),O3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),limit:ot.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:ot.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:ot.string(),sessionId:Zh}),M3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),sessionId:Zh,terminalId:ot.string()}),U3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),cwd:ot.string(),mcpServers:ot.array(XHe).optional(),sessionId:Zh}),JIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),cwd:ot.string(),sessionId:Zh,title:ot.string().nullish(),updatedAt:ot.string().nullish()}),DIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),nextCursor:ot.string().nullish(),sessions:ot.array(JIi)}),OIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),title:ot.string().nullish(),updatedAt:ot.string().nullish()}),MIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),kHe=ot.string(),UIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),currentModeId:kHe}),_Ii=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),description:ot.string().nullish(),id:kHe,name:ot.string()}),SHe=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),availableModes:ot.array(_Ii),currentModeId:kHe}),LHe=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),availableModels:ot.array(fIi),currentModelId:Q3t}),zIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),configOptions:ot.array(QK).nullish(),models:LHe.nullish(),modes:SHe.nullish(),sessionId:Zh}),PIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),configOptions:ot.array(QK).nullish(),models:LHe.nullish(),modes:SHe.nullish()}),jIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),configOptions:ot.array(QK).nullish(),models:LHe.nullish(),modes:SHe.nullish(),sessionId:Zh}),qIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),configOptions:ot.array(QK).nullish(),models:LHe.nullish(),modes:SHe.nullish()}),KIi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),$Ii=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),close:VIi.nullish(),fork:TIi.nullish(),list:MIi.nullish(),resume:KIi.nullish()}),ehi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),loadSession:ot.boolean().optional().default(!1),mcpCapabilities:IIi.optional().default({http:!1,sse:!1}),promptCapabilities:ZIi.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:$Ii.optional().default({})}),thi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),agentCapabilities:ehi.optional().default({loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:Nen.nullish(),authMethods:ot.array(tIi).optional().default([]),protocolVersion:Fen}),_3t=ot.intersection(ot.union([ot.object({type:ot.literal("boolean"),value:ot.boolean()}),ot.object({value:k3t})]),ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),configId:Een,sessionId:Zh})),rhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),configOptions:ot.array(QK)}),z3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),modeId:kHe,sessionId:Zh}),nhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),P3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),modelId:Q3t,sessionId:Zh}),ahi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),ihi=ot.union([ot.literal("end_turn"),ot.literal("max_tokens"),ot.literal("max_turn_requests"),ot.literal("refusal"),ot.literal("cancelled")]),shi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),terminalId:ot.string()}),ohi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),exitCode:ot.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:ot.string().nullish()}),j3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),sessionId:Zh,terminalId:ot.string()}),lhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),exitStatus:ohi.nullish(),output:ot.string(),truncated:ot.boolean()}),chi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),annotations:x0e.nullish(),text:ot.string()}),uhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),mimeType:ot.string().nullish(),text:ot.string(),uri:ot.string()}),dhi=ot.union([uhi,nIi]),Ihi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),annotations:x0e.nullish(),resource:dhi}),q3t=ot.union([chi.and(ot.object({type:ot.literal("text")})),wIi.and(ot.object({type:ot.literal("image")})),EIi.and(ot.object({type:ot.literal("audio")})),RIi.and(ot.object({type:ot.literal("resource_link")})),Ihi.and(ot.object({type:ot.literal("resource")}))]),hhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),content:q3t}),x3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),content:q3t,messageId:ot.string().nullish()}),K3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),messageId:ot.string().nullish(),prompt:ot.array(q3t),sessionId:Zh}),POs=ot.object({id:yT,method:ot.string(),params:ot.union([X3t,Y3t,H3t,D3t,V3t,T3t,U3t,L3t,z3t,_3t,K3t,P3t,yen]).nullish()}),Ren=ot.union([hhi.and(ot.object({type:ot.literal("content")})),oIi.and(ot.object({type:ot.literal("diff")})),shi.and(ot.object({type:ot.literal("terminal")}))]),Cen=ot.string(),xen=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),line:ot.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:ot.string()}),Yen=ot.union([ot.literal("pending"),ot.literal("in_progress"),ot.literal("completed"),ot.literal("failed")]),Ven=ot.union([ot.literal("read"),ot.literal("edit"),ot.literal("delete"),ot.literal("move"),ot.literal("search"),ot.literal("execute"),ot.literal("think"),ot.literal("fetch"),ot.literal("switch_mode"),ot.literal("other")]),mhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),content:ot.array(Ren).optional(),kind:Ven.optional(),locations:ot.array(xen).optional(),rawInput:ot.unknown().optional(),rawOutput:ot.unknown().optional(),status:Yen.optional(),title:ot.string(),toolCallId:Cen}),Qen=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),content:ot.array(Ren).nullish(),kind:Ven.nullish(),locations:ot.array(xen).nullish(),rawInput:ot.unknown().optional(),rawOutput:ot.unknown().optional(),status:Yen.nullish(),title:ot.string().nullish(),toolCallId:Cen}),$3t=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),options:ot.array(gIi),sessionId:Zh,toolCall:Qen}),phi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),hint:ot.string()}),fhi=phi,bhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),description:ot.string(),input:fhi.nullish(),name:ot.string()}),ghi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),availableCommands:ot.array(bhi)}),Ghi=ot.object({cachedReadTokens:ot.number().nullish(),cachedWriteTokens:ot.number().nullish(),inputTokens:ot.number(),outputTokens:ot.number(),thoughtTokens:ot.number().nullish(),totalTokens:ot.number()}),vhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),stopReason:ihi,usage:Ghi.nullish(),userMessageId:ot.string().nullish()}),jOs=ot.union([ot.object({id:yT,result:ot.union([thi,rIi,jIi,PIi,DIi,zIi,qIi,aIi,nhi,rhi,vhi,ahi,Aen])}),ot.object({error:Gen,id:yT})]),yhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),cost:iIi.nullish(),size:ot.number(),used:ot.number()}),Ahi=ot.union([x3t.and(ot.object({sessionUpdate:ot.literal("user_message_chunk")})),x3t.and(ot.object({sessionUpdate:ot.literal("agent_message_chunk")})),x3t.and(ot.object({sessionUpdate:ot.literal("agent_thought_chunk")})),mhi.and(ot.object({sessionUpdate:ot.literal("tool_call")})),Qen.and(ot.object({sessionUpdate:ot.literal("tool_call_update")})),AIi.and(ot.object({sessionUpdate:ot.literal("plan")})),ghi.and(ot.object({sessionUpdate:ot.literal("available_commands_update")})),UIi.and(ot.object({sessionUpdate:ot.literal("current_mode_update")})),BIi.and(ot.object({sessionUpdate:ot.literal("config_option_update")})),OIi.and(ot.object({sessionUpdate:ot.literal("session_info_update")})),yhi.and(ot.object({sessionUpdate:ot.literal("usage_update")}))]),eWt=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),sessionId:Zh,update:Ahi}),qOs=ot.object({method:ot.string(),params:ot.union([eWt,ven]).nullish()}),tWt=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),sessionId:Zh,terminalId:ot.string()}),Zhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),exitCode:ot.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:ot.string().nullish()}),rWt=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish(),content:ot.string(),path:ot.string(),sessionId:Zh}),KOs=ot.object({id:yT,method:ot.string(),params:ot.union([rWt,O3t,$3t,B3t,j3t,M3t,tWt,J3t,yen]).nullish()}),Nhi=ot.object({_meta:ot.record(ot.string(),ot.unknown()).nullish()}),$Os=ot.union([ot.object({id:yT,result:ot.union([Nhi,NIi,YIi,sIi,lhi,WIi,Zhi,dIi,Aen])}),ot.object({error:Gen,id:yT})])});function HK(n,e){let r=new TextEncoder,a=new TextDecoder,i=new ReadableStream({async start(t){let s="",u=e.getReader();try{for(;;){let{value:I,done:d}=await u.read();if(d)break;if(!I)continue;s+=a.decode(I,{stream:!0});let h=s.split(`
@@ -3837,7 +3841,7 @@ ${a}
3837
3841
  \u{1F50D} Model Diagnostics: ${n}`),console.log(`\u{1F4CA} Reliability: ${r.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${r.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${r.capabilities.maxConcurrentTools}`),r.warnings.length>0&&(console.log(`
3838
3842
  \u26A0\uFE0F Warnings:`),r.warnings.forEach(a=>console.log(` \u2022 ${a}`))),e&&r.recommendations.length>0&&(console.log(`
3839
3843
  \u{1F4A1} Recommendations:`),r.recommendations.forEach(a=>console.log(` \u2022 ${a}`))),e&&(console.log(`
3840
- \u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function wbi(n){let e=PXe(n);return e.isSmallModel||e.needsSpecialHandling}function Rbi(n){let e=PXe(n);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var sin=ct(()=>{"use strict";fce();});import*as _Z from"fs";import*as jXe from"path";var Cbi,ome,oin=ct(()=>{"use strict";qm();Cbi="healthy-use-reminder.json",ome=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=CG(e);this.stateFilePath=jXe.join(r,Cbi)}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{_Z.existsSync(this.stateFilePath)&&_Z.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!_Z.existsSync(this.stateFilePath))return null;let e=_Z.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=jXe.dirname(this.stateFilePath);_Z.existsSync(r)||_Z.mkdirSync(r,{recursive:!0}),_Z.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var eEt,tEt,xbi,Ybi,Vbi,lin=ct(()=>{"use strict";eEt="--- Content from referenced files ---",tEt="--- End of content ---",xbi=2e3,Ybi=2e3,Vbi=20});function uin(...n){return Qbi(...n)}function din(...n){return Hbi(...n)}function cin(n,e){return n in e}function rEt(){let n={get(i,o){if(o==="write")return uin;if(cin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,o){if(o==="write")return din;if(cin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var Qbi,Hbi,Iin=ct(()=>{"use strict";Qbi=process.stdout.write.bind(process.stdout),Hbi=process.stderr.write.bind(process.stderr)});import{readFile as Xbi}from"node:fs/promises";import{fileURLToPath as kbi}from"node:url";import nEt from"node:path";function Sbi(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return nEt.dirname(kbi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function ux(){return lme||(lme=(async()=>"1.1.18")(),lme)}function Lbi(){lme=void 0}var lme,aEt=ct(()=>{"use strict";});import{EventEmitter as Bbi}from"node:events";var cme,iEt,sEt,hin=ct(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(cme||(cme={}));iEt=class{emitter=new Bbi;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()}},sEt=new iEt});function qXe(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function Tbi(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function oEt(n){if(!n||n.length===0)return[];let e=[];for(let r of n){if(r.role&&(r.parts||r.content!==void 0)){let a=r.parts??qXe(r.content);e.push({role:r.role,parts:a});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let a=r.content!==void 0?qXe(r.content):[],i=Tbi(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(r.type==="gemini"){let a=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;a.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&a.push(...qXe(r.content)),i)for(let o of r.toolCalls)a.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),i){let o=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?o.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?o.push(...qXe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var min=ct(()=>{"use strict";});var XT,pin,ume,fin=ct(()=>{"use strict";XT=class n extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new n("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new n(`Session '${e}' was not found under ${r}.`)}},pin="latest",ume=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,a)=>new Date(r.startTime).getTime()-new Date(a.startTime).getTime())}async findSession(e){let r=e.trim(),a=await this.listSessions();if(a.length===0)throw XT.noSessionsFound();let i=a.find(t=>t.id===r);if(i)return i;let o=Number.parseInt(r,10);if(Number.isInteger(o)&&o.toString()===r&&o>0&&o<=a.length)return a[o-1];throw XT.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===pin){let o=await this.listSessions();if(o.length===0)throw XT.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new XT(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function Jbi(n,e,r){return new KXe(n,e,r)}var KXe,$Xe,eke,bin=ct(()=>{"use strict";cce();k5();KXe=class n{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,a){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=a}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let a=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(a,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(a,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,a={}){let i={...a,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async put(e,r,a={}){let i={...a,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Yu(),...e.headers};if(this.tokenManager)try{let a=await this.tokenManager.getAccessToken();a?r.Authorization=`Bearer ${a}`:k4("warn","\u26A0\uFE0F No access token available")}catch(a){k4("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(k4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((a,i)=>{this.requestQueue.push({resolve:a,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{k4("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){k4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${a}`}},o=fetch(e,i);return this.processRequestQueue(a),await o}else throw new Error("Failed to refresh token")}catch(a){throw console.error("\u274C Token refresh failed:",a),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(k4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new $Xe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:a,reject:i,request:o})=>{o().then(t=>a(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:a})=>{a(e)})}static async checkResponse(e){if(!e.ok){let a=await e.text();throw new eke(`HTTP ${e.status}: ${e.statusText}`,e.status,a)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let a=await this.request(e,r);return n.checkResponse(a)}async postJson(e,r){let a=await this.post(e,r);return n.checkResponse(a)}async putJson(e,r){let a=await this.put(e,r);return n.checkResponse(a)}async getJson(e){let r=await this.get(e);return n.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return n.checkResponse(r)}},$Xe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},eke=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function Dbi(n){return dme.getInstance(n)}function Obi(n){let e=dme.getInstance(n);return()=>e.handleAuthenticationRequired()}var dme,gin=ct(()=>{"use strict";S5();dme=class n{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Ro.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let a=`${Ro.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${a}`),window.location.href=a}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function rke(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new tke(r)}var tke,lEt=ct(()=>{"use strict";tke=class{config;constructor(e){this.config=e}buildAuthUrl(){let e=`${this.config.authUrl}?redirect_to=${encodeURIComponent(this.config.redirectUri)}&redirect_mode=same_window`;return console.log("\u{1F517} DeepVlab\u8BA4\u8BC1URL:",e),e}handleCallback(e){console.log("\u{1F504} [DeepVlab Auth] \u5904\u7406DeepVlab\u8BA4\u8BC1\u56DE\u8C03"),console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03URL:",e.toString());let r=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",r);let a=e.searchParams.get("token"),i=e.searchParams.get("user_id"),o=e.searchParams.get("error");return o?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",o),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${o}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as nke from"fs";import*as Ng from"path";function Mbi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ime,dH,cEt=ct(()=>{"use strict";Ime=Mbi(),dH=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(Ng.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"auth","login","templates",e))),Ime&&r.push(Ng.join(Ime,e)),Ime){let o=Ime;for(let t=0;t<10;t++)r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled",e)),r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e)),o=Ng.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e))}catch{}let a=null;for(let o of r)try{if(nke.existsSync(o)){a=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!a){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${Ime||"(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=nke.readFileSync(a,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
3844
+ \u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function wbi(n){let e=PXe(n);return e.isSmallModel||e.needsSpecialHandling}function Rbi(n){let e=PXe(n);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var sin=ct(()=>{"use strict";fce();});import*as _Z from"fs";import*as jXe from"path";var Cbi,ome,oin=ct(()=>{"use strict";qm();Cbi="healthy-use-reminder.json",ome=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=CG(e);this.stateFilePath=jXe.join(r,Cbi)}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{_Z.existsSync(this.stateFilePath)&&_Z.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!_Z.existsSync(this.stateFilePath))return null;let e=_Z.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=jXe.dirname(this.stateFilePath);_Z.existsSync(r)||_Z.mkdirSync(r,{recursive:!0}),_Z.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var eEt,tEt,xbi,Ybi,Vbi,lin=ct(()=>{"use strict";eEt="--- Content from referenced files ---",tEt="--- End of content ---",xbi=2e3,Ybi=2e3,Vbi=20});function uin(...n){return Qbi(...n)}function din(...n){return Hbi(...n)}function cin(n,e){return n in e}function rEt(){let n={get(i,o){if(o==="write")return uin;if(cin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,o){if(o==="write")return din;if(cin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var Qbi,Hbi,Iin=ct(()=>{"use strict";Qbi=process.stdout.write.bind(process.stdout),Hbi=process.stderr.write.bind(process.stderr)});import{readFile as Xbi}from"node:fs/promises";import{fileURLToPath as kbi}from"node:url";import nEt from"node:path";function Sbi(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return nEt.dirname(kbi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function ux(){return lme||(lme=(async()=>"1.1.19")(),lme)}function Lbi(){lme=void 0}var lme,aEt=ct(()=>{"use strict";});import{EventEmitter as Bbi}from"node:events";var cme,iEt,sEt,hin=ct(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(cme||(cme={}));iEt=class{emitter=new Bbi;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()}},sEt=new iEt});function qXe(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function Tbi(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function oEt(n){if(!n||n.length===0)return[];let e=[];for(let r of n){if(r.role&&(r.parts||r.content!==void 0)){let a=r.parts??qXe(r.content);e.push({role:r.role,parts:a});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let a=r.content!==void 0?qXe(r.content):[],i=Tbi(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(r.type==="gemini"){let a=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;a.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&a.push(...qXe(r.content)),i)for(let o of r.toolCalls)a.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),i){let o=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?o.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?o.push(...qXe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var min=ct(()=>{"use strict";});var XT,pin,ume,fin=ct(()=>{"use strict";XT=class n extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new n("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new n(`Session '${e}' was not found under ${r}.`)}},pin="latest",ume=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,a)=>new Date(r.startTime).getTime()-new Date(a.startTime).getTime())}async findSession(e){let r=e.trim(),a=await this.listSessions();if(a.length===0)throw XT.noSessionsFound();let i=a.find(t=>t.id===r);if(i)return i;let o=Number.parseInt(r,10);if(Number.isInteger(o)&&o.toString()===r&&o>0&&o<=a.length)return a[o-1];throw XT.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===pin){let o=await this.listSessions();if(o.length===0)throw XT.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new XT(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function Jbi(n,e,r){return new KXe(n,e,r)}var KXe,$Xe,eke,bin=ct(()=>{"use strict";cce();k5();KXe=class n{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,a){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=a}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let a=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(a,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(a,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,a={}){let i={...a,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async put(e,r,a={}){let i={...a,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Yu(),...e.headers};if(this.tokenManager)try{let a=await this.tokenManager.getAccessToken();a?r.Authorization=`Bearer ${a}`:k4("warn","\u26A0\uFE0F No access token available")}catch(a){k4("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(k4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((a,i)=>{this.requestQueue.push({resolve:a,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{k4("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){k4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${a}`}},o=fetch(e,i);return this.processRequestQueue(a),await o}else throw new Error("Failed to refresh token")}catch(a){throw console.error("\u274C Token refresh failed:",a),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(k4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new $Xe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:a,reject:i,request:o})=>{o().then(t=>a(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:a})=>{a(e)})}static async checkResponse(e){if(!e.ok){let a=await e.text();throw new eke(`HTTP ${e.status}: ${e.statusText}`,e.status,a)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let a=await this.request(e,r);return n.checkResponse(a)}async postJson(e,r){let a=await this.post(e,r);return n.checkResponse(a)}async putJson(e,r){let a=await this.put(e,r);return n.checkResponse(a)}async getJson(e){let r=await this.get(e);return n.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return n.checkResponse(r)}},$Xe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},eke=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function Dbi(n){return dme.getInstance(n)}function Obi(n){let e=dme.getInstance(n);return()=>e.handleAuthenticationRequired()}var dme,gin=ct(()=>{"use strict";S5();dme=class n{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Ro.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let a=`${Ro.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${a}`),window.location.href=a}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function rke(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new tke(r)}var tke,lEt=ct(()=>{"use strict";tke=class{config;constructor(e){this.config=e}buildAuthUrl(){let e=`${this.config.authUrl}?redirect_to=${encodeURIComponent(this.config.redirectUri)}&redirect_mode=same_window`;return console.log("\u{1F517} DeepVlab\u8BA4\u8BC1URL:",e),e}handleCallback(e){console.log("\u{1F504} [DeepVlab Auth] \u5904\u7406DeepVlab\u8BA4\u8BC1\u56DE\u8C03"),console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03URL:",e.toString());let r=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",r);let a=e.searchParams.get("token"),i=e.searchParams.get("user_id"),o=e.searchParams.get("error");return o?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",o),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${o}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as nke from"fs";import*as Ng from"path";function Mbi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ime,dH,cEt=ct(()=>{"use strict";Ime=Mbi(),dH=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(Ng.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"auth","login","templates",e))),Ime&&r.push(Ng.join(Ime,e)),Ime){let o=Ime;for(let t=0;t<10;t++)r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled",e)),r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e)),o=Ng.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e))}catch{}let a=null;for(let o of r)try{if(nke.existsSync(o)){a=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!a){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${Ime||"(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=nke.readFileSync(a,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
3841
3845
  <!DOCTYPE html>
3842
3846
  <html>
3843
3847
  <head>
@@ -5009,7 +5013,7 @@ ${c}`),a?i.reset(c):c}function v1i(n,e,r,a={}){if(!yln){yln=!0;let o="Passing li
5009
5013
 
5010
5014
  ${e}
5011
5015
  `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,a=N1i(r,this.#t.message);if(a)return(0,Cln.codeFrameColumns)(r,{start:a},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#a??=this.#i(!1),this.#a}},N1i=(n,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:a,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:$Et(n,Number(a),{oneBased:!0})},W1i=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,a)=>`"${a}"(${Z1i(a)})`)});var rwt=Ze((Vio,F1i)=>{F1i.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 Yln=Ze((Qio,E1i)=>{E1i.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 Vln=Ze((Hio,w1i)=>{w1i.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 Hln=Ze((Xio,Qln)=>{"use strict";var R1i=[].concat(rwt()).concat(Yln()),C1i=Vln();Qln.exports=function(n){var e=0;function r(){return e<n.length}function a(g){if(g instanceof RegExp){var v=n.slice(e),Z=v.match(g);if(Z)return e+=Z[0].length,Z[0]}else if(n.indexOf(g,e)===e)return e+=g.length,g}function i(){a(/[ ]*/)}function o(){for(var g,v=["WITH","AND","OR","(",")",":","+"],Z=0;Z<v.length&&(g=a(v[Z]),!g);Z++);if(g==="+"&&e>1&&n[e-2]===" ")throw new Error("Space before `+`");return g&&{type:"OPERATOR",string:g}}function t(){return a(/[A-Za-z0-9-.]+/)}function s(){var g=t();if(!g)throw new Error("Expected idstring at offset "+e);return g}function u(){if(a("DocumentRef-")){var g=s();return{type:"DOCUMENTREF",string:g}}}function I(){if(a("LicenseRef-")){var g=s();return{type:"LICENSEREF",string:g}}}function d(){var g=e,v=t();if(R1i.indexOf(v)!==-1)return{type:"LICENSE",string:v};if(C1i.indexOf(v)!==-1)return{type:"EXCEPTION",string:v};e=g}function h(){return o()||u()||I()||d()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+n[e]+"` at offset "+e);c.push(m)}return c}});var kln=Ze((kio,Xln)=>{"use strict";Xln.exports=function(n){var e=0;function r(){return e<n.length}function a(){return r()?n[e]:null}function i(){if(!r())throw new Error;e++}function o(v){var Z=a();if(Z&&Z.type==="OPERATOR"&&v===Z.string)return i(),Z.string}function t(){if(o("WITH")){var v=a();if(v&&v.type==="EXCEPTION")return i(),v.string;throw new Error("Expected exception after `WITH`")}}function s(){var v=e,Z="",A=a();if(A.type==="DOCUMENTREF"&&(i(),Z+="DocumentRef-"+A.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(A=a(),A.type==="LICENSEREF")return i(),Z+="LicenseRef-"+A.string,{license:Z};e=v}function u(){var v=a();if(v&&v.type==="LICENSE"){i();var Z={license:v.string};o("+")&&(Z.plus=!0);var A=t();return A&&(Z.exception=A),Z}}function I(){var v=o("(");if(v){var Z=m();if(!o(")"))throw new Error("Expected `)`");return Z}}function d(){return I()||s()||u()}function h(v,Z){return function A(){var R=Z();if(R){if(!o(v))return R;var F=A();if(!F)throw new Error("Expected expression");return{left:R,conjunction:v.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 nwt=Ze((Sio,Sln)=>{"use strict";var x1i=Hln(),Y1i=kln();Sln.exports=function(n){return Y1i(x1i(n))}});var _ln=Ze((Lio,Uln)=>{var V1i=nwt(),Q1i=rwt();function Pke(n){try{return V1i(n),!0}catch{return!1}}function Mln(n,e){var r=e[0].length-n[0].length;return r!==0?r:n[0].toUpperCase().localeCompare(e[0].toUpperCase())}var Lln=[["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(Mln),H1i=0,X1i=1,Bln=[function(n){return n.toUpperCase()},function(n){return n.trim()},function(n){return n.replace(/\./g,"")},function(n){return n.replace(/\s+/g,"")},function(n){return n.replace(/\s+/g,"-")},function(n){return n.replace("v","-")},function(n){return n.replace(/,?\s*(\d)/,"-$1")},function(n){return n.replace(/,?\s*(\d)/,"-$1.0")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(n){return n[0].toUpperCase()+n.slice(1)},function(n){return n.replace("/","-")},function(n){return n.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(n){return n.indexOf("3.0")!==-1?n+"-or-later":n+"-only"},function(n){return n+"only"},function(n){return n.replace(/(\d)$/,"-$1.0")},function(n){return n.replace(/(-| )?(\d)$/,"-$2-Clause")},function(n){return n.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(n){return n.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(n){return n.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(n){return n.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(n){return n.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(n){return n.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(n){return"CC-"+n},function(n){return"CC-"+n+"-4.0"},function(n){return n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(n){return"CC-"+n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],awt=Q1i.map(function(n){var e=/^(.*)-\d+\.\d+$/.exec(n);return e?[e[0],e[1]]:[n,null]}).reduce(function(n,e){var r=e[1];return n[r]=n[r]||[],n[r].push(e[0]),n},{}),k1i=Object.keys(awt).map(function(e){return[e,awt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});awt=void 0;var Tln=[["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(k1i).sort(Mln),S1i=0,L1i=1,Jln=function(n){for(var e=0;e<Bln.length;e++){var r=Bln[e](n).trim();if(r!==n&&Pke(r))return r}return null},Dln=function(n){for(var e=n.toUpperCase(),r=0;r<Tln.length;r++){var a=Tln[r];if(e.indexOf(a[S1i])>-1)return a[L1i]}return null},Oln=function(n,e){for(var r=0;r<Lln.length;r++){var a=Lln[r],i=a[H1i];if(n.indexOf(i)>-1){var o=n.replace(i,a[X1i]),t=e(o);if(t!==null)return t}}return null};Uln.exports=function(n,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function a(s){return r?B1i(s):s}var i=typeof n=="string"&&n.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(n=n.trim(),Pke(n))return a(n);var o=n.replace(/\+$/,"").trim();if(Pke(o))return a(o);var t=Jln(n);return t!==null||(t=Oln(n,function(s){return Pke(s)?s:Jln(s)}),t!==null)||(t=Dln(n),t!==null)||(t=Oln(n,Dln),t!==null)?a(t):null};function B1i(n){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(n)!==-1?n+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(n)!==-1?n.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(n)!==-1?n+"-or-later":n}});var qln=Ze((Bio,jln)=>{var T1i=nwt(),J1i=_ln(),zln='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',D1i=/^SEE LICEN[CS]E IN (.+)$/;function Pln(n,e){return e.slice(0,n.length)===n}function iwt(n){if(n.hasOwnProperty("license")){var e=n.license;return Pln("LicenseRef",e)||Pln("DocumentRef",e)}else return iwt(n.left)||iwt(n.right)}jln.exports=function(n){var e;try{e=T1i(n)}catch{var r;if(n==="UNLICENSED"||n==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=D1i.exec(n))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var a={validForOldPackages:!1,validForNewPackages:!1,warnings:[zln]};if(n.trim().length!==0){var i=J1i(n);i&&a.warnings.push('license is similar to the valid expression "'+i+'"')}return a}return iwt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[zln]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var rcn=Ze(qke=>{"use strict";Object.defineProperty(qke,"__esModule",{value:!0});qke.LRUCache=void 0;var N$=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$ln=new Set,swt=typeof process=="object"&&process?process:{},ecn=(n,e,r,a)=>{typeof swt.emitWarning=="function"?swt.emitWarning(n,e,r,a):console.error(`[${r}] ${e}: ${n}`)},jke=globalThis.AbortController,Kln=globalThis.AbortSignal;if(typeof jke>"u"){Kln=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(a,i){this._onabort.push(i)}},jke=class{constructor(){e()}signal=new Kln;abort(a){if(!this.signal.aborted){this.signal.reason=a,this.signal.aborted=!0;for(let i of this.signal._onabort)i(a);this.signal.onabort?.(a)}}};let n=swt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,ecn("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 O1i=n=>!$ln.has(n),Dio=Symbol("type"),AH=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),tcn=n=>AH(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?W$:null:null,W$=class extends Array{constructor(e){super(e),this.fill(0)}},owt=class n{heap;length;static#e=!1;static create(e){let r=tcn(e);if(!r)return[];n.#e=!0;let a=new n(e,r);return n.#e=!1,a}constructor(e,r){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},lwt=class n{#e;#t;#r;#n;#a;#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,a,i,o)=>e.#x(r,a,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.#a}get memoMethod(){return this.#i}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:a,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:t,updateAgeOnHas:s,allowStale:u,dispose:I,disposeAfter:d,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:g=0,sizeCalculation:v,fetchMethod:Z,memoMethod:A,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:p,ignoreFetchAbort:y}=e;if(r!==0&&!AH(r))throw new TypeError("max option must be a nonnegative integer");let N=r?tcn(r):Array;if(!N)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=g||this.#t,this.sizeCalculation=v,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(A!==void 0&&typeof A!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#i=A,Z!==void 0&&typeof Z!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#a=Z,this.#y=!!Z,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new N(r),this.#l=new N(r),this.#m=0,this.#b=0,this.#A=owt.create(r),this.#u=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof d=="function"?(this.#n=d,this.#f=[]):(this.#n=void 0,this.#f=void 0),this.#N=!!this.#r,this.#g=!!this.#n,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!p,this.ignoreFetchAbort=!!y,this.maxEntrySize!==0){if(this.#t!==0&&!AH(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!AH(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=AH(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=a||0,this.ttl){if(!AH(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";O1i(E)&&($ln.add(E),ecn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#W(){let e=new W$(this.#e),r=new W$(this.#e);this.#Z=e,this.#G=r,this.#H=(o,t,s=N$.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?N$.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=a||i();let I=o.now-u;o.remainingTTL=s-I}};let a=0,i=()=>{let o=N$.now();if(this.ttlResolution>0){a=o;let t=setTimeout(()=>a=0,this.ttlResolution);t.unref&&t.unref()}return o};this.getRemainingTTL=o=>{let t=this.#s.get(o);if(t===void 0)return 0;let s=e[t],u=r[t];if(!s||!u)return 1/0;let I=(a||i())-u;return s-I},this.#R=o=>{let t=r[o],s=e[o];return!!s&&!!t&&(a||i())-t>s}}#w=()=>{};#c=()=>{};#H=()=>{};#R=()=>!1;#C(){let e=new W$(this.#e);this.#o=0,this.#E=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#F=(r,a,i,o)=>{if(this.#v(a))return 0;if(!AH(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(a,r),!AH(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#S=(r,a,i)=>{if(e[r]=a,this.#t){let o=this.#t-e[r];for(;this.#o>o;)this.#B(!0)}this.#o+=e[r],i&&(i.entrySize=a,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,a)=>{};#F=(e,r,a,i)=>{if(a||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#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 a of this.#L()){let i=this.#d[a],o=this.#v(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#I[a],this))return this.get(this.#I[a],r)}}forEach(e,r=this){for(let a of this.#L()){let i=this.#d[a],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[a],this)}}rforEach(e,r=this){for(let a of this.#V()){let i=this.#d[a],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[a],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#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 a=this.#d[r],i=this.#v(a)?a.__staleWhileFetching:a;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-(N$.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 a=this.#I[r],i=this.#d[r],o=this.#v(i)?i.__staleWhileFetching:i;if(o===void 0||a===void 0)continue;let t={value:o};if(this.#Z&&this.#G){t.ttl=this.#Z[r];let s=N$.now()-this.#G[r];t.start=Math.floor(Date.now()-s)}this.#E&&(t.size=this.#E[r]),e.unshift([a,t])}return e}load(e){this.clear();for(let[r,a]of e){if(a.start){let i=Date.now()-a.start;a.start=N$.now()-i}this.set(r,a.value,a)}}set(e,r,a={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:o,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:u}=a,{noUpdateTTL:I=this.noUpdateTTL}=a,d=this.#F(e,r,a.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.#n?.(...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.#n?.(...r)}}}#B(e){let r=this.#m,a=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,a,"evict"),this.#g&&this.#f?.push([i,a,"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(a),this.#u--,r}has(e,r={}){let{updateAgeOnHas:a=this.updateAgeOnHas,status:i}=r,o=this.#s.get(e);if(o!==void 0){let t=this.#d[o];if(this.#v(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#R(o))i&&(i.has="stale",this.#c(i,o));else return a&&this.#w(o),i&&(i.has="hit",this.#c(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:a=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!a&&this.#R(i))return;let o=this.#d[i];return this.#v(o)?o.__staleWhileFetching:o}#x(e,r,a,i){let o=r===void 0?void 0:this.#d[r];if(this.#v(o))return o;let t=new jke,{signal:s}=a;s?.addEventListener("abort",()=>t.abort(s.reason),{signal:t.signal});let u={signal:t.signal,options:a,context:i},I=(v,Z=!1)=>{let{aborted:A}=t.signal,R=a.ignoreFetchAbort&&v!==void 0;if(a.status&&(A&&!Z?(a.status.fetchAborted=!0,a.status.fetchError=t.signal.reason,R&&(a.status.fetchAbortIgnored=!0)):a.status.fetchResolved=!0),A&&!R&&!Z)return h(t.signal.reason);let F=m;return this.#d[r]===m&&(v===void 0?F.__staleWhileFetching?this.#d[r]=F.__staleWhileFetching:this.#k(e,"fetch"):(a.status&&(a.status.fetchUpdated=!0),this.set(e,v,u.options))),v},d=v=>(a.status&&(a.status.fetchRejected=!0,a.status.fetchError=v),h(v)),h=v=>{let{aborted:Z}=t.signal,A=Z&&a.allowStaleOnFetchAbort,R=A||a.allowStaleOnFetchRejection,F=R||a.noDeleteOnFetchRejection,w=m;if(this.#d[r]===m&&(!F||w.__staleWhileFetching===void 0?this.#k(e,"fetch"):A||(this.#d[r]=w.__staleWhileFetching)),R)return a.status&&w.__staleWhileFetching!==void 0&&(a.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw v},c=(v,Z)=>{let A=this.#a?.(e,o,u);A&&A instanceof Promise&&A.then(R=>v(R===void 0?void 0:R),Z),t.signal.addEventListener("abort",()=>{(!a.ignoreFetchAbort||a.allowStaleOnFetchAbort)&&(v(void 0),a.allowStaleOnFetchAbort&&(v=R=>I(R,!0)))})};a.status&&(a.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 jke}async fetch(e,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size: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:v,forceRefresh:Z=!1,status:A,signal:R}=r;if(!this.#y)return A&&(A.fetch="get"),this.get(e,{allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:A});let F={allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:t,noDisposeOnSet:s,size:u,sizeCalculation:I,noUpdateTTL:d,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:g,ignoreFetchAbort:m,status:A,signal:R},w=this.#s.get(e);if(w===void 0){A&&(A.fetch="miss");let p=this.#x(e,w,F,v);return p.__returned=p}else{let p=this.#d[w];if(this.#v(p)){let f=a&&p.__staleWhileFetching!==void 0;return A&&(A.fetch="inflight",f&&(A.returnedStale=!0)),f?p.__staleWhileFetching:p.__returned=p}let y=this.#R(w);if(!Z&&!y)return A&&(A.fetch="hit"),this.#D(w),i&&this.#w(w),A&&this.#c(A,w),p;let N=this.#x(e,w,F,v),b=N.__staleWhileFetching!==void 0&&a;return A&&(A.fetch=y?"stale":"refresh",b&&y&&(A.returnedStale=!0)),b?N.__staleWhileFetching:N.__returned=N}}async forceFetch(e,r={}){let a=await this.fetch(e,r);if(a===void 0)throw new Error("fetch() returned undefined");return a}memo(e,r={}){let a=this.#i;if(!a)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:o,...t}=r,s=this.get(e,t);if(!o&&s!==void 0)return s;let u=a(e,s,{options:t,context:i});return this.set(e,u,t),u}get(e,r={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:t}=r,s=this.#s.get(e);if(s!==void 0){let u=this.#d[s],I=this.#v(u);return t&&this.#c(t,s),this.#R(s)?(t&&(t.get="stale"),I?(t&&a&&u.__staleWhileFetching!==void 0&&(t.returnedStale=!0),a?u.__staleWhileFetching:void 0):(o||this.#k(e,"expire"),t&&a&&(t.returnedStale=!0),a?u:void 0)):(t&&(t.get="hit"),I?u.__staleWhileFetching:(this.#D(s),i&&this.#w(s),u))}else t&&(t.get="miss")}#J(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#b&&(e===this.#m?this.#m=this.#h[e]:this.#J(this.#l[e],this.#h[e]),this.#J(this.#b,e),this.#b=e)}delete(e){return this.#k(e,"delete")}#k(e,r){let a=!1;if(this.#u!==0){let i=this.#s.get(e);if(i!==void 0)if(a=!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.#n?.(...o)}return a}clear(){return this.#p("delete")}#p(e){for(let r of this.#V({allowStale:!0})){let a=this.#d[r];if(this.#v(a))a.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#N&&this.#r?.(a,i,e),this.#g&&this.#f?.push([a,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,a;for(;a=r?.shift();)this.#n?.(...a)}}};qke.LRUCache=lwt});var icn=Ze((Mio,acn)=>{"use strict";var Pl=(...n)=>n.every(e=>e)?n.join(""):"",W0=n=>n?encodeURIComponent(n):"",ncn=n=>n.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),M1i={sshtemplate:({domain:n,user:e,project:r,committish:a})=>`git@${n}:${e}/${r}.git${Pl("#",a)}`,sshurltemplate:({domain:n,user:e,project:r,committish:a})=>`git+ssh://git@${n}/${e}/${r}.git${Pl("#",a)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i,path:o})=>`https://${n}/${e}/${r}${Pl("/",i,"/",W0(a||"HEAD"),"/",o)}`,browsetemplate:({domain:n,user:e,project:r,committish:a,treepath:i})=>`https://${n}/${e}/${r}${Pl("/",i,"/",W0(a))}`,browsetreetemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:o,fragment:t,hashformat:s})=>`https://${n}/${e}/${r}/${i}/${W0(a||"HEAD")}/${o}${Pl("#",s(t||""))}`,browseblobtemplate:({domain:n,user:e,project:r,committish:a,blobpath:i,path:o,fragment:t,hashformat:s})=>`https://${n}/${e}/${r}/${i}/${W0(a||"HEAD")}/${o}${Pl("#",s(t||""))}`,docstemplate:({domain:n,user:e,project:r,treepath:a,committish:i})=>`https://${n}/${e}/${r}${Pl("/",a,"/",W0(i))}#readme`,httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${Pl(n,"@")}${e}/${r}/${a}.git${Pl("#",i)}`,filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/raw/${W0(a||"HEAD")}/${i}`,shortcuttemplate:({type:n,user:e,project:r,committish:a})=>`${n}:${e}/${r}${Pl("#",a)}`,pathtemplate:({user:n,project:e,committish:r})=>`${n}/${e}${Pl("#",r)}`,bugstemplate:({domain:n,user:e,project:r})=>`https://${n}/${e}/${r}/issues`,hashformat:ncn},ZH={};ZH.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:e,project:r,committish:a,path:i})=>`https://${Pl(n,"@")}raw.githubusercontent.com/${e}/${r}/${W0(a||"HEAD")}/${i}`,gittemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git://${Pl(n,"@")}${e}/${r}/${a}.git${Pl("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://codeload.${n}/${e}/${r}/tar.gz/${W0(a||"HEAD")}`,extract:n=>{let[,e,r,a,i]=n.pathname.split("/",5);if(!(a&&a!=="tree")&&(a||(i=n.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};ZH.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:o,editpath:t})=>`https://${n}/${e}/${r}${Pl("/",i,"/",W0(a||"HEAD"),"/",o,t)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/get/${W0(a||"HEAD")}.tar.gz`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["get"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};ZH.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${Pl(n,"@")}${e}/${r}/${a}.git${Pl("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/repository/archive.tar.gz?ref=${W0(a||"HEAD")}`,extract:n=>{let e=n.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),a=r.pop();a.endsWith(".git")&&(a=a.slice(0,-4));let i=r.join("/");if(!(!i||!a))return{user:i,project:a,committish:n.hash.slice(1)}}};ZH.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:n,project:e,committish:r})=>`git@${n}:${e}.git${Pl("#",r)}`,sshurltemplate:({domain:n,project:e,committish:r})=>`git+ssh://git@${n}/${e}.git${Pl("#",r)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i})=>`https://${n}/${e}/${r}${Pl("/",W0(a))}/${i}`,browsetemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${Pl("/",W0(r))}`,browsetreetemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${Pl("/",W0(r))}${Pl("#",i(a))}`,browseblobtemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${Pl("/",W0(r))}${Pl("#",i(a))}`,docstemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${Pl("/",W0(r))}`,httpstemplate:({domain:n,project:e,committish:r})=>`git+https://${n}/${e}.git${Pl("#",r)}`,filetemplate:({user:n,project:e,committish:r,path:a})=>`https://gist.githubusercontent.com/${n}/${e}/raw${Pl("/",W0(r))}/${a}`,shortcuttemplate:({type:n,project:e,committish:r})=>`${n}:${e}${Pl("#",r)}`,pathtemplate:({project:n,committish:e})=>`${n}${Pl("#",e)}`,bugstemplate:({domain:n,project:e})=>`https://${n}/${e}`,gittemplate:({domain:n,project:e,committish:r})=>`git://${n}/${e}.git${Pl("#",r)}`,tarballtemplate:({project:n,committish:e})=>`https://codeload.github.com/gist/${n}/tar.gz/${W0(e||"HEAD")}`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(a!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:n.hash.slice(1)}}},hashformat:function(n){return n&&"file-"+ncn(n)}};ZH.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/blob/${W0(a)||"HEAD"}/${i}`,httpstemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}.git${Pl("#",a)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/archive/${W0(a)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["archive"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};for(let[n,e]of Object.entries(ZH))ZH[n]=Object.assign({},M1i,e);acn.exports=ZH});var uwt=Ze((Uio,ocn)=>{var U1i=Wt("url"),cwt=(n,e,r)=>{let a=n.indexOf(r);return n.lastIndexOf(e,a>-1?a:1/0)},scn=n=>{try{return new U1i.URL(n)}catch{}},_1i=(n,e)=>{let r=n.indexOf(":"),a=n.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,a))return n;let i=n.indexOf("@");return i>-1?i>r?`git+ssh://${n}`:n:n.indexOf("//")===r+1?n:`${n.slice(0,r+1)}//${n.slice(r+1)}`},z1i=n=>{let e=cwt(n,"@","#"),r=cwt(n,":","#");return r>e&&(n=n.slice(0,r)+"/"+n.slice(r+1)),cwt(n,":","#")===-1&&n.indexOf("//")===-1&&(n=`git+ssh://${n}`),n};ocn.exports=(n,e)=>{let r=e?_1i(n,e):n;return scn(r)||scn(z1i(r))}});var ccn=Ze((_io,lcn)=>{"use strict";var P1i=uwt(),j1i=n=>{let e=n.indexOf("#"),r=n.indexOf("/"),a=n.indexOf("/",r+1),i=n.indexOf(":"),o=/\s/.exec(n),t=n.indexOf("@"),s=!o||e>-1&&o.index>e,u=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,d=a===-1||e>-1&&a>e,h=r>0,c=e>-1?n[e-1]!=="/":!n.endsWith("/"),m=!n.startsWith(".");return s&&h&&c&&m&&u&&I&&d};lcn.exports=(n,e,{gitHosts:r,protocols:a})=>{if(!n)return;let i=j1i(n)?`github:${n}`:n,o=P1i(i,a);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;a[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 v=o.pathname.startsWith("/")?o.pathname.slice(1):o.pathname,Z=v.indexOf("@");Z>-1&&(v=v.slice(Z+1));let A=v.lastIndexOf("/");A>-1?(c=decodeURIComponent(v.slice(0,A)),c||(c=null),m=decodeURIComponent(v.slice(A+1))):m=decodeURIComponent(v),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 v=I.extract(o);if(!v)return;c=v.user&&decodeURIComponent(v.user),m=decodeURIComponent(v.project),h=decodeURIComponent(v.committish),g=a[o.protocol]?.name||o.protocol.slice(0,-1)}}catch(v){if(v instanceof URIError)return;throw v}return[u,c,d,m,h,g,e]}});var dcn=Ze((zio,ucn)=>{"use strict";var{LRUCache:q1i}=rcn(),K1i=icn(),$1i=ccn(),evi=uwt(),dwt=new q1i({max:1e3}),Kke=class n{constructor(e,r,a,i,o,t,s={}){Object.assign(this,n.#e[e],{type:e,user:r,auth:a,project:i,committish:o,default:t,opts:s})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){n.#e[e]=r,n.#e.byDomain[r.domain]=e,n.#e.byShortcut[`${e}:`]=e,n.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let a=e+JSON.stringify(r||{});if(!dwt.has(a)){let i=$1i(e,r,{gitHosts:n.#e,protocols:n.#t});dwt.set(a,i?new n(...i):void 0)}return dwt.get(a)}static parseUrl(e){return evi(e)}#r(e,r){if(typeof e!="function")return null;let a={...this,...this.opts,...r};a.path||(a.path=""),a.path.startsWith("/")&&(a.path=a.path.slice(1)),a.noCommittish&&(a.committish=null);let i=e(a);return a.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[n,e]of Object.entries(K1i))Kke.addHost(n,e);ucn.exports=Kke});var hcn=Ze((Pio,Icn)=>{Icn.exports=tvi;function tvi(n){if(!n||n==="ERROR: No README data found!")return;n=n.trim().split(`
5012
- `);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var mcn=Ze((jio,rvi)=>{rvi.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 gcn=Ze((qio,bcn)=>{var nvi=vat(),avi=yat(),ivi=qln(),$ke=dcn(),svi=Wt("node:module"),ovi=["dependencies","devDependencies","optionalDependencies"],lvi=hcn(),Iwt=Wt("url"),NH=mcn(),pcn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");bcn.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=$ke.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(NH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,NH.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):NH.script[e]&&!n.scripts[NH.script[e]]&&this.warn("typo",e,NH.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){fvi(n,this.warn),mvi(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=$ke.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!nvi(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=avi(n.version,r),!0},fixPeople:function(n){fcn(n,Ivi),fcn(n,hvi)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),dvi(n.name,r,e.allowLegacyCase),svi.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=lvi(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=$ke.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")pcn(n.bugs)?n.bugs={email:n.bugs}:Iwt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{bvi(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&Iwt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&pcn(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=$ke.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;Iwt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!ivi(e).validForNewPackages)return this.warn("invalidLicense")}};function cvi(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function uvi(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function dvi(n,e,r){if(n.charAt(0)==="."||!(cvi(n)||uvi(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function fcn(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function Ivi(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,o=i?" <"+i+">":"";return e+o+a}function hvi(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function mvi(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function pvi(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),a[o]=t}),a}function fvi(n,e){ovi.forEach(function(r){n[r]&&(n[r]=pvi(n[r],r,e))})}function bvi(n,e){n&&Object.keys(n).forEach(function(r){NH.bugs[r]&&(e("typo",r,NH.bugs[r],"bugs"),n[NH.bugs[r]]=n[r],delete n[r])})}});var Gcn=Ze((Kio,gvi)=>{gvi.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 Acn=Ze(($io,ycn)=>{var vcn=Wt("util"),hwt=Gcn();ycn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return Gvi.apply(null,n);var r=hwt[e]?hwt[e]:e+": '%s'";return n.unshift(r),vcn.format.apply(null,n)};function Gvi(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),vcn.format(hwt.typo,n,e)}});var Fcn=Ze((eso,Wcn)=>{Wcn.exports=Zcn;var mwt=gcn();Zcn.fixer=mwt;var vvi=Acn(),yvi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Avi=["dependencies","people","typos"],pwt=yvi.map(function(n){return Ncn(n)+"Field"});pwt=pwt.concat(Avi);function Zcn(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),mwt.warn=function(){e(vvi.apply(null,arguments))},pwt.forEach(function(a){mwt["fix"+Ncn(a)](n,r)}),n._id=n.name+"@"+n.version}function Ncn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Ecn=ct(()=>{});import{fileURLToPath as Zvi}from"node:url";function wcn(n){return n instanceof URL?Zvi(n):n}var Rcn=ct(()=>{Ecn()});import Nvi from"node:fs/promises";import Wvi from"node:path";async function xcn({cwd:n,normalize:e=!0}={}){let r=await Nvi.readFile(Fvi(n),"utf8");return Evi(r,e)}var Ccn,Fvi,Evi,Ycn=ct(()=>{xln();Ccn=St(Fcn(),1);Rcn();Fvi=n=>Wvi.resolve(wcn(n)??".","package.json"),Evi=(n,e)=>{let r=typeof n=="string"?twt(n):n;return e&&(0,Ccn.default)(r),r}});import wvi from"node:path";async function Vcn(n){let e=await nln("package.json",n);if(e)return{packageJson:await xcn({...n,cwd:wvi.dirname(e)}),path:e}}var Qcn=ct(()=>{aln();Ycn()});import{fileURLToPath as Rvi}from"url";import Cvi from"path";async function F$(){if(e6e)return e6e;let n=await Vcn({cwd:Yvi});if(n)return e6e=n.packageJson,e6e}var xvi,Yvi,e6e,t6e=ct(()=>{"use strict";Qcn();xvi=Rvi(import.meta.url),Yvi=Cvi.dirname(xvi)});var Hcn={};ho(Hcn,{getCliVersion:()=>Ax});async function Ax(){let n=await F$();return"1.1.18"}var E$=ct(()=>{"use strict";t6e();});var Owt=Ze((Oho,zdn)=>{zdn.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var qdn=Ze((Mho,jdn)=>{var YZi=Owt();function Pdn(n){this.mode=YZi.MODE_8BIT_BYTE,this.data=n}Pdn.prototype={getLength:function(){return this.data.length},write:function(n){for(var e=0;e<this.data.length;e++)n.put(this.data.charCodeAt(e),8)}};jdn.exports=Pdn});var Mwt=Ze((Uho,Kdn)=>{var _W={glog:function(n){if(n<1)throw new Error("glog("+n+")");return _W.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return _W.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(F0=0;F0<8;F0++)_W.EXP_TABLE[F0]=1<<F0;var F0;for(F0=8;F0<256;F0++)_W.EXP_TABLE[F0]=_W.EXP_TABLE[F0-4]^_W.EXP_TABLE[F0-5]^_W.EXP_TABLE[F0-6]^_W.EXP_TABLE[F0-8];var F0;for(F0=0;F0<255;F0++)_W.LOG_TABLE[_W.EXP_TABLE[F0]]=F0;var F0;Kdn.exports=_W});var Uwt=Ze((_ho,$dn)=>{var nJ=Mwt();function A6e(n,e){if(n.length===void 0)throw new Error(n.length+"/"+e);for(var r=0;r<n.length&&n[r]===0;)r++;this.num=new Array(n.length-r+e);for(var a=0;a<n.length-r;a++)this.num[a]=n[a+r]}A6e.prototype={get:function(n){return this.num[n]},getLength:function(){return this.num.length},multiply:function(n){for(var e=new Array(this.getLength()+n.getLength()-1),r=0;r<this.getLength();r++)for(var a=0;a<n.getLength();a++)e[r+a]^=nJ.gexp(nJ.glog(this.get(r))+nJ.glog(n.get(a)));return new A6e(e,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var e=nJ.glog(this.get(0))-nJ.glog(n.get(0)),r=new Array(this.getLength()),a=0;a<this.getLength();a++)r[a]=this.get(a);for(var i=0;i<n.getLength();i++)r[i]^=nJ.gexp(nJ.glog(n.get(i))+e);return new A6e(r,0).mod(n)}};$dn.exports=A6e});var tIn=Ze((zho,eIn)=>{eIn.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var aIn=Ze((Pho,nIn)=>{var $Z=Owt(),rIn=Uwt(),VZi=Mwt(),RH=tIn(),Vf={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(n){for(var e=n<<10;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15)>=0;)e^=Vf.G15<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15);return(n<<10|e)^Vf.G15_MASK},getBCHTypeNumber:function(n){for(var e=n<<12;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18)>=0;)e^=Vf.G18<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18);return n<<12|e},getBCHDigit:function(n){for(var e=0;n!==0;)e++,n>>>=1;return e},getPatternPosition:function(n){return Vf.PATTERN_POSITION_TABLE[n-1]},getMask:function(n,e,r){switch(n){case RH.PATTERN000:return(e+r)%2===0;case RH.PATTERN001:return e%2===0;case RH.PATTERN010:return r%3===0;case RH.PATTERN011:return(e+r)%3===0;case RH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case RH.PATTERN101:return e*r%2+e*r%3===0;case RH.PATTERN110:return(e*r%2+e*r%3)%2===0;case RH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){for(var e=new rIn([1],0),r=0;r<n;r++)e=e.multiply(new rIn([1,VZi.gexp(r)],0));return e},getLengthInBits:function(n,e){if(1<=e&&e<10)switch(n){case $Z.MODE_NUMBER:return 10;case $Z.MODE_ALPHA_NUM:return 9;case $Z.MODE_8BIT_BYTE:return 8;case $Z.MODE_KANJI:return 8;default:throw new Error("mode:"+n)}else if(e<27)switch(n){case $Z.MODE_NUMBER:return 12;case $Z.MODE_ALPHA_NUM:return 11;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 10;default:throw new Error("mode:"+n)}else if(e<41)switch(n){case $Z.MODE_NUMBER:return 14;case $Z.MODE_ALPHA_NUM:return 13;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 12;default:throw new Error("mode:"+n)}else throw new Error("type:"+e)},getLostPoint:function(n){var e=n.getModuleCount(),r=0,a=0,i=0;for(a=0;a<e;a++)for(i=0;i<e;i++){for(var o=0,t=n.isDark(a,i),s=-1;s<=1;s++)if(!(a+s<0||e<=a+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===n.isDark(a+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(a=0;a<e-1;a++)for(i=0;i<e-1;i++){var I=0;n.isDark(a,i)&&I++,n.isDark(a+1,i)&&I++,n.isDark(a,i+1)&&I++,n.isDark(a+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(a=0;a<e;a++)for(i=0;i<e-6;i++)n.isDark(a,i)&&!n.isDark(a,i+1)&&n.isDark(a,i+2)&&n.isDark(a,i+3)&&n.isDark(a,i+4)&&!n.isDark(a,i+5)&&n.isDark(a,i+6)&&(r+=40);for(i=0;i<e;i++)for(a=0;a<e-6;a++)n.isDark(a,i)&&!n.isDark(a+1,i)&&n.isDark(a+2,i)&&n.isDark(a+3,i)&&n.isDark(a+4,i)&&!n.isDark(a+5,i)&&n.isDark(a+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(a=0;a<e;a++)n.isDark(a,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};nIn.exports=Vf});var _wt=Ze((jho,iIn)=>{iIn.exports={L:1,M:0,Q:3,H:2}});var oIn=Ze((qho,sIn)=>{var Z6e=_wt();function GR(n,e){this.totalCount=n,this.dataCount=e}GR.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]];GR.getRSBlocks=function(n,e){var r=GR.getRsBlockTable(n,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+n+"/errorCorrectLevel:"+e);for(var a=r.length/3,i=[],o=0;o<a;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 GR(s,u));return i};GR.getRsBlockTable=function(n,e){switch(e){case Z6e.L:return GR.RS_BLOCK_TABLE[(n-1)*4+0];case Z6e.M:return GR.RS_BLOCK_TABLE[(n-1)*4+1];case Z6e.Q:return GR.RS_BLOCK_TABLE[(n-1)*4+2];case Z6e.H:return GR.RS_BLOCK_TABLE[(n-1)*4+3];default:return}};sIn.exports=GR});var uIn=Ze((Kho,cIn)=>{function lIn(){this.buffer=[],this.length=0}lIn.prototype={get:function(n){var e=Math.floor(n/8);return(this.buffer[e]>>>7-n%8&1)==1},put:function(n,e){for(var r=0;r<e;r++)this.putBit((n>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(n){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++}};cIn.exports=lIn});var mIn=Ze(($ho,hIn)=>{var QZi=qdn(),CH=aIn(),HZi=Uwt(),dIn=oIn(),IIn=uIn();function vR(n,e){this.typeNumber=n,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}vR.prototype={addData:function(n){var e=new QZi(n);this.dataList.push(e),this.dataCache=null},isDark:function(n,e){if(n<0||this.moduleCount<=n||e<0||this.moduleCount<=e)throw new Error(n+","+e);return this.modules[n][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var n=1;for(n=1;n<40;n++){for(var e=dIn.getRSBlocks(n,this.errorCorrectLevel),r=new IIn,a=0,i=0;i<e.length;i++)a+=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(),CH.getLengthInBits(t.mode,n)),t.write(r)}if(r.getLengthInBits()<=a*8)break}this.typeNumber=n}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(n,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 a=0;a<this.moduleCount;a++)this.modules[r][a]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(n,e),this.typeNumber>=7&&this.setupTypeNumber(n),this.dataCache===null&&(this.dataCache=vR.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(n,e){for(var r=-1;r<=7;r++)if(!(n+r<=-1||this.moduleCount<=n+r))for(var a=-1;a<=7;a++)e+a<=-1||this.moduleCount<=e+a||(0<=r&&r<=6&&(a===0||a===6)||0<=a&&a<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=a&&a<=4?this.modules[n+r][e+a]=!0:this.modules[n+r][e+a]=!1)},getBestMaskPattern:function(){for(var n=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var a=CH.getLostPoint(this);(r===0||n>a)&&(n=a,e=r)}return e},createMovieClip:function(n,e,r){var a=n.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&&(a.beginFill(0,100),a.moveTo(u,t),a.lineTo(u+i,t),a.lineTo(u+i,t+i),a.lineTo(u,t+i),a.endFill())}return a},setupTimingPattern:function(){for(var n=8;n<this.moduleCount-8;n++)this.modules[n][6]===null&&(this.modules[n][6]=n%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 n=CH.getPatternPosition(this.typeNumber),e=0;e<n.length;e++)for(var r=0;r<n.length;r++){var a=n[e],i=n[r];if(this.modules[a][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[a+o][i+t]=!0:this.modules[a+o][i+t]=!1}},setupTypeNumber:function(n){for(var e=CH.getBCHTypeNumber(this.typeNumber),r,a=0;a<18;a++)r=!n&&(e>>a&1)===1,this.modules[Math.floor(a/3)][a%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!n&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(n,e){for(var r=this.errorCorrectLevel<<3|e,a=CH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!n&&(a>>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=!n&&(a>>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]=!n},mapData:function(n,e){for(var r=-1,a=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[a][t-s]===null){var u=!1;o<n.length&&(u=(n[o]>>>i&1)===1);var I=CH.getMask(e,a,t-s);I&&(u=!u),this.modules[a][t-s]=u,i--,i===-1&&(o++,i=7)}if(a+=r,a<0||this.moduleCount<=a){a-=r,r=-r;break}}}};vR.PAD0=236;vR.PAD1=17;vR.createData=function(n,e,r){for(var a=dIn.getRSBlocks(n,e),i=new IIn,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),CH.getLengthInBits(t.mode,n)),t.write(i)}for(var s=0,u=0;u<a.length;u++)s+=a[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(vR.PAD0,8),i.getLengthInBits()>=s*8));)i.put(vR.PAD1,8);return vR.createBytes(i,a)};vR.createBytes=function(n,e){for(var r=0,a=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;a=Math.max(a,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&n.buffer[d+r];r+=u;var h=CH.getErrorCorrectPolynomial(I),c=new HZi(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 v=g+m.getLength()-t[s].length;t[s][g]=v>=0?m.get(v):0}}for(var Z=0,A=0;A<e.length;A++)Z+=e[A].totalCount;for(var R=new Array(Z),F=0,w=0;w<a;w++)for(var p=0;p<e.length;p++)w<o[p].length&&(R[F++]=o[p][w]);for(var y=0;y<i;y++)for(var N=0;N<e.length;N++)y<t[N].length&&(R[F++]=t[N][y]);return R};hIn.exports=vR});var bIn=Ze((e0o,fIn)=>{var XZi=mIn(),pIn=_wt(),kZi="\x1B[40m \x1B[0m",N6e="\x1B[47m \x1B[0m",SZi=function(n){return n?kZi:N6e},zwt=function(n){return{times:function(e){return new Array(e).join(n)}}},LZi=function(n,e){for(var r=new Array(n),a=0;a<n;a++)r[a]=e;return r};fIn.exports={error:pIn.L,generate:function(n,e,r){typeof e=="function"&&(r=e,e={});var a=new XZi(-1,this.error);a.addData(n),a.make();var i="";if(e&&e.small){var o=!0,t=!1,s=a.getModuleCount(),u=a.modules.slice(),I=s%2===1;I&&u.push(LZi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=zwt(d.BLACK_WHITE).times(s+3),c=zwt(d.WHITE_BLACK).times(s+3);i+=h+`
5016
+ `);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var mcn=Ze((jio,rvi)=>{rvi.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 gcn=Ze((qio,bcn)=>{var nvi=vat(),avi=yat(),ivi=qln(),$ke=dcn(),svi=Wt("node:module"),ovi=["dependencies","devDependencies","optionalDependencies"],lvi=hcn(),Iwt=Wt("url"),NH=mcn(),pcn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");bcn.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=$ke.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(NH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,NH.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):NH.script[e]&&!n.scripts[NH.script[e]]&&this.warn("typo",e,NH.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){fvi(n,this.warn),mvi(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=$ke.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!nvi(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=avi(n.version,r),!0},fixPeople:function(n){fcn(n,Ivi),fcn(n,hvi)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),dvi(n.name,r,e.allowLegacyCase),svi.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=lvi(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=$ke.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")pcn(n.bugs)?n.bugs={email:n.bugs}:Iwt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{bvi(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&Iwt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&pcn(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=$ke.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;Iwt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!ivi(e).validForNewPackages)return this.warn("invalidLicense")}};function cvi(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function uvi(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function dvi(n,e,r){if(n.charAt(0)==="."||!(cvi(n)||uvi(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function fcn(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function Ivi(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,o=i?" <"+i+">":"";return e+o+a}function hvi(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function mvi(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function pvi(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),a[o]=t}),a}function fvi(n,e){ovi.forEach(function(r){n[r]&&(n[r]=pvi(n[r],r,e))})}function bvi(n,e){n&&Object.keys(n).forEach(function(r){NH.bugs[r]&&(e("typo",r,NH.bugs[r],"bugs"),n[NH.bugs[r]]=n[r],delete n[r])})}});var Gcn=Ze((Kio,gvi)=>{gvi.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 Acn=Ze(($io,ycn)=>{var vcn=Wt("util"),hwt=Gcn();ycn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return Gvi.apply(null,n);var r=hwt[e]?hwt[e]:e+": '%s'";return n.unshift(r),vcn.format.apply(null,n)};function Gvi(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),vcn.format(hwt.typo,n,e)}});var Fcn=Ze((eso,Wcn)=>{Wcn.exports=Zcn;var mwt=gcn();Zcn.fixer=mwt;var vvi=Acn(),yvi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Avi=["dependencies","people","typos"],pwt=yvi.map(function(n){return Ncn(n)+"Field"});pwt=pwt.concat(Avi);function Zcn(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),mwt.warn=function(){e(vvi.apply(null,arguments))},pwt.forEach(function(a){mwt["fix"+Ncn(a)](n,r)}),n._id=n.name+"@"+n.version}function Ncn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Ecn=ct(()=>{});import{fileURLToPath as Zvi}from"node:url";function wcn(n){return n instanceof URL?Zvi(n):n}var Rcn=ct(()=>{Ecn()});import Nvi from"node:fs/promises";import Wvi from"node:path";async function xcn({cwd:n,normalize:e=!0}={}){let r=await Nvi.readFile(Fvi(n),"utf8");return Evi(r,e)}var Ccn,Fvi,Evi,Ycn=ct(()=>{xln();Ccn=St(Fcn(),1);Rcn();Fvi=n=>Wvi.resolve(wcn(n)??".","package.json"),Evi=(n,e)=>{let r=typeof n=="string"?twt(n):n;return e&&(0,Ccn.default)(r),r}});import wvi from"node:path";async function Vcn(n){let e=await nln("package.json",n);if(e)return{packageJson:await xcn({...n,cwd:wvi.dirname(e)}),path:e}}var Qcn=ct(()=>{aln();Ycn()});import{fileURLToPath as Rvi}from"url";import Cvi from"path";async function F$(){if(e6e)return e6e;let n=await Vcn({cwd:Yvi});if(n)return e6e=n.packageJson,e6e}var xvi,Yvi,e6e,t6e=ct(()=>{"use strict";Qcn();xvi=Rvi(import.meta.url),Yvi=Cvi.dirname(xvi)});var Hcn={};ho(Hcn,{getCliVersion:()=>Ax});async function Ax(){let n=await F$();return"1.1.19"}var E$=ct(()=>{"use strict";t6e();});var Owt=Ze((Oho,zdn)=>{zdn.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var qdn=Ze((Mho,jdn)=>{var YZi=Owt();function Pdn(n){this.mode=YZi.MODE_8BIT_BYTE,this.data=n}Pdn.prototype={getLength:function(){return this.data.length},write:function(n){for(var e=0;e<this.data.length;e++)n.put(this.data.charCodeAt(e),8)}};jdn.exports=Pdn});var Mwt=Ze((Uho,Kdn)=>{var _W={glog:function(n){if(n<1)throw new Error("glog("+n+")");return _W.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return _W.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(F0=0;F0<8;F0++)_W.EXP_TABLE[F0]=1<<F0;var F0;for(F0=8;F0<256;F0++)_W.EXP_TABLE[F0]=_W.EXP_TABLE[F0-4]^_W.EXP_TABLE[F0-5]^_W.EXP_TABLE[F0-6]^_W.EXP_TABLE[F0-8];var F0;for(F0=0;F0<255;F0++)_W.LOG_TABLE[_W.EXP_TABLE[F0]]=F0;var F0;Kdn.exports=_W});var Uwt=Ze((_ho,$dn)=>{var nJ=Mwt();function A6e(n,e){if(n.length===void 0)throw new Error(n.length+"/"+e);for(var r=0;r<n.length&&n[r]===0;)r++;this.num=new Array(n.length-r+e);for(var a=0;a<n.length-r;a++)this.num[a]=n[a+r]}A6e.prototype={get:function(n){return this.num[n]},getLength:function(){return this.num.length},multiply:function(n){for(var e=new Array(this.getLength()+n.getLength()-1),r=0;r<this.getLength();r++)for(var a=0;a<n.getLength();a++)e[r+a]^=nJ.gexp(nJ.glog(this.get(r))+nJ.glog(n.get(a)));return new A6e(e,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var e=nJ.glog(this.get(0))-nJ.glog(n.get(0)),r=new Array(this.getLength()),a=0;a<this.getLength();a++)r[a]=this.get(a);for(var i=0;i<n.getLength();i++)r[i]^=nJ.gexp(nJ.glog(n.get(i))+e);return new A6e(r,0).mod(n)}};$dn.exports=A6e});var tIn=Ze((zho,eIn)=>{eIn.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var aIn=Ze((Pho,nIn)=>{var $Z=Owt(),rIn=Uwt(),VZi=Mwt(),RH=tIn(),Vf={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(n){for(var e=n<<10;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15)>=0;)e^=Vf.G15<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15);return(n<<10|e)^Vf.G15_MASK},getBCHTypeNumber:function(n){for(var e=n<<12;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18)>=0;)e^=Vf.G18<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18);return n<<12|e},getBCHDigit:function(n){for(var e=0;n!==0;)e++,n>>>=1;return e},getPatternPosition:function(n){return Vf.PATTERN_POSITION_TABLE[n-1]},getMask:function(n,e,r){switch(n){case RH.PATTERN000:return(e+r)%2===0;case RH.PATTERN001:return e%2===0;case RH.PATTERN010:return r%3===0;case RH.PATTERN011:return(e+r)%3===0;case RH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case RH.PATTERN101:return e*r%2+e*r%3===0;case RH.PATTERN110:return(e*r%2+e*r%3)%2===0;case RH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){for(var e=new rIn([1],0),r=0;r<n;r++)e=e.multiply(new rIn([1,VZi.gexp(r)],0));return e},getLengthInBits:function(n,e){if(1<=e&&e<10)switch(n){case $Z.MODE_NUMBER:return 10;case $Z.MODE_ALPHA_NUM:return 9;case $Z.MODE_8BIT_BYTE:return 8;case $Z.MODE_KANJI:return 8;default:throw new Error("mode:"+n)}else if(e<27)switch(n){case $Z.MODE_NUMBER:return 12;case $Z.MODE_ALPHA_NUM:return 11;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 10;default:throw new Error("mode:"+n)}else if(e<41)switch(n){case $Z.MODE_NUMBER:return 14;case $Z.MODE_ALPHA_NUM:return 13;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 12;default:throw new Error("mode:"+n)}else throw new Error("type:"+e)},getLostPoint:function(n){var e=n.getModuleCount(),r=0,a=0,i=0;for(a=0;a<e;a++)for(i=0;i<e;i++){for(var o=0,t=n.isDark(a,i),s=-1;s<=1;s++)if(!(a+s<0||e<=a+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===n.isDark(a+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(a=0;a<e-1;a++)for(i=0;i<e-1;i++){var I=0;n.isDark(a,i)&&I++,n.isDark(a+1,i)&&I++,n.isDark(a,i+1)&&I++,n.isDark(a+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(a=0;a<e;a++)for(i=0;i<e-6;i++)n.isDark(a,i)&&!n.isDark(a,i+1)&&n.isDark(a,i+2)&&n.isDark(a,i+3)&&n.isDark(a,i+4)&&!n.isDark(a,i+5)&&n.isDark(a,i+6)&&(r+=40);for(i=0;i<e;i++)for(a=0;a<e-6;a++)n.isDark(a,i)&&!n.isDark(a+1,i)&&n.isDark(a+2,i)&&n.isDark(a+3,i)&&n.isDark(a+4,i)&&!n.isDark(a+5,i)&&n.isDark(a+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(a=0;a<e;a++)n.isDark(a,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};nIn.exports=Vf});var _wt=Ze((jho,iIn)=>{iIn.exports={L:1,M:0,Q:3,H:2}});var oIn=Ze((qho,sIn)=>{var Z6e=_wt();function GR(n,e){this.totalCount=n,this.dataCount=e}GR.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]];GR.getRSBlocks=function(n,e){var r=GR.getRsBlockTable(n,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+n+"/errorCorrectLevel:"+e);for(var a=r.length/3,i=[],o=0;o<a;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 GR(s,u));return i};GR.getRsBlockTable=function(n,e){switch(e){case Z6e.L:return GR.RS_BLOCK_TABLE[(n-1)*4+0];case Z6e.M:return GR.RS_BLOCK_TABLE[(n-1)*4+1];case Z6e.Q:return GR.RS_BLOCK_TABLE[(n-1)*4+2];case Z6e.H:return GR.RS_BLOCK_TABLE[(n-1)*4+3];default:return}};sIn.exports=GR});var uIn=Ze((Kho,cIn)=>{function lIn(){this.buffer=[],this.length=0}lIn.prototype={get:function(n){var e=Math.floor(n/8);return(this.buffer[e]>>>7-n%8&1)==1},put:function(n,e){for(var r=0;r<e;r++)this.putBit((n>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(n){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++}};cIn.exports=lIn});var mIn=Ze(($ho,hIn)=>{var QZi=qdn(),CH=aIn(),HZi=Uwt(),dIn=oIn(),IIn=uIn();function vR(n,e){this.typeNumber=n,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}vR.prototype={addData:function(n){var e=new QZi(n);this.dataList.push(e),this.dataCache=null},isDark:function(n,e){if(n<0||this.moduleCount<=n||e<0||this.moduleCount<=e)throw new Error(n+","+e);return this.modules[n][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var n=1;for(n=1;n<40;n++){for(var e=dIn.getRSBlocks(n,this.errorCorrectLevel),r=new IIn,a=0,i=0;i<e.length;i++)a+=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(),CH.getLengthInBits(t.mode,n)),t.write(r)}if(r.getLengthInBits()<=a*8)break}this.typeNumber=n}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(n,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 a=0;a<this.moduleCount;a++)this.modules[r][a]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(n,e),this.typeNumber>=7&&this.setupTypeNumber(n),this.dataCache===null&&(this.dataCache=vR.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(n,e){for(var r=-1;r<=7;r++)if(!(n+r<=-1||this.moduleCount<=n+r))for(var a=-1;a<=7;a++)e+a<=-1||this.moduleCount<=e+a||(0<=r&&r<=6&&(a===0||a===6)||0<=a&&a<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=a&&a<=4?this.modules[n+r][e+a]=!0:this.modules[n+r][e+a]=!1)},getBestMaskPattern:function(){for(var n=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var a=CH.getLostPoint(this);(r===0||n>a)&&(n=a,e=r)}return e},createMovieClip:function(n,e,r){var a=n.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&&(a.beginFill(0,100),a.moveTo(u,t),a.lineTo(u+i,t),a.lineTo(u+i,t+i),a.lineTo(u,t+i),a.endFill())}return a},setupTimingPattern:function(){for(var n=8;n<this.moduleCount-8;n++)this.modules[n][6]===null&&(this.modules[n][6]=n%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 n=CH.getPatternPosition(this.typeNumber),e=0;e<n.length;e++)for(var r=0;r<n.length;r++){var a=n[e],i=n[r];if(this.modules[a][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[a+o][i+t]=!0:this.modules[a+o][i+t]=!1}},setupTypeNumber:function(n){for(var e=CH.getBCHTypeNumber(this.typeNumber),r,a=0;a<18;a++)r=!n&&(e>>a&1)===1,this.modules[Math.floor(a/3)][a%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!n&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(n,e){for(var r=this.errorCorrectLevel<<3|e,a=CH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!n&&(a>>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=!n&&(a>>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]=!n},mapData:function(n,e){for(var r=-1,a=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[a][t-s]===null){var u=!1;o<n.length&&(u=(n[o]>>>i&1)===1);var I=CH.getMask(e,a,t-s);I&&(u=!u),this.modules[a][t-s]=u,i--,i===-1&&(o++,i=7)}if(a+=r,a<0||this.moduleCount<=a){a-=r,r=-r;break}}}};vR.PAD0=236;vR.PAD1=17;vR.createData=function(n,e,r){for(var a=dIn.getRSBlocks(n,e),i=new IIn,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),CH.getLengthInBits(t.mode,n)),t.write(i)}for(var s=0,u=0;u<a.length;u++)s+=a[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(vR.PAD0,8),i.getLengthInBits()>=s*8));)i.put(vR.PAD1,8);return vR.createBytes(i,a)};vR.createBytes=function(n,e){for(var r=0,a=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;a=Math.max(a,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&n.buffer[d+r];r+=u;var h=CH.getErrorCorrectPolynomial(I),c=new HZi(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 v=g+m.getLength()-t[s].length;t[s][g]=v>=0?m.get(v):0}}for(var Z=0,A=0;A<e.length;A++)Z+=e[A].totalCount;for(var R=new Array(Z),F=0,w=0;w<a;w++)for(var p=0;p<e.length;p++)w<o[p].length&&(R[F++]=o[p][w]);for(var y=0;y<i;y++)for(var N=0;N<e.length;N++)y<t[N].length&&(R[F++]=t[N][y]);return R};hIn.exports=vR});var bIn=Ze((e0o,fIn)=>{var XZi=mIn(),pIn=_wt(),kZi="\x1B[40m \x1B[0m",N6e="\x1B[47m \x1B[0m",SZi=function(n){return n?kZi:N6e},zwt=function(n){return{times:function(e){return new Array(e).join(n)}}},LZi=function(n,e){for(var r=new Array(n),a=0;a<n;a++)r[a]=e;return r};fIn.exports={error:pIn.L,generate:function(n,e,r){typeof e=="function"&&(r=e,e={});var a=new XZi(-1,this.error);a.addData(n),a.make();var i="";if(e&&e.small){var o=!0,t=!1,s=a.getModuleCount(),u=a.modules.slice(),I=s%2===1;I&&u.push(LZi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=zwt(d.BLACK_WHITE).times(s+3),c=zwt(d.WHITE_BLACK).times(s+3);i+=h+`
5013
5017
  `;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+`
5014
5018
  `}I||(i+=c)}else{var v=zwt(N6e).times(a.getModuleCount()+3);i+=v+`
5015
5019
  `,a.modules.forEach(function(Z){i+=N6e,i+=Z.map(SZi).join(""),i+=N6e+`
@@ -6712,9 +6716,9 @@ ${d.text}`:""):c=`\u274C \u65C1\u8DEF\u95EE\u7B54\u5931\u8D25\uFF1A${d.error??"\
6712
6716
  \u{1F4E6} \u538B\u7F29\u540E token: ${t.newTokenCount}`:"\u26A0\uFE0F \u6CA1\u6709\u9700\u8981\u538B\u7F29\u7684\u5185\u5BB9"}catch(o){return`\u274C \u538B\u7F29\u5931\u8D25: ${o.message}`}case"/stop":{let o=a?$W.get(a):n2n;if(o){if(o.abort(),a){$W.delete(a),l2n(a),qH.set(a,!1);let t=v1.get(a);if(t){for(let s of t)s.resolve(null);t.splice(0),v1.delete(a)}}else n2n=null;return"\u{1F6D1} \u5DF2\u4E2D\u6B62\u5F53\u524D\u6B63\u5728\u8FD0\u884C\u7684 AI \u4EFB\u52A1\u3002"}return"\u26A0\uFE0F \u5F53\u524D\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684 AI \u4EFB\u52A1\u3002"}case"/status":try{return await oQi(r,e,a)}catch(o){return`\u274C \u83B7\u53D6\u72B6\u6001\u4FE1\u606F\u5931\u8D25: ${o.message}`}case"/thinking":{let o=n.split(/\s+/);if(o.length===1){let u=r?.getThinkingConfig()||{mode:"auto",effort:"auto"};return["\u{1F4AD} **\u601D\u8003\u914D\u7F6E\u72B6\u6001**","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",`\u5F53\u524D\u601D\u8003\u6A21\u5F0F: **${u.mode==="on"?"\u5F00\u542F":u.mode==="off"?"\u5173\u95ED":"\u81EA\u52A8"}**`,`\u601D\u8003\u5F3A\u5EA6\u529B\u5EA6: **${u.effort||"auto"}**`,"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","\u{1F4A1} **\u4F7F\u7528\u4EE5\u4E0B\u547D\u4EE4\u8FDB\u884C\u5207\u6362**:"," /thinking off - \u5173\u95ED\u601D\u8003\u6A21\u5F0F"," /thinking auto - \u8BBE\u4E3A\u81EA\u52A8\u6A21\u5F0F"," /thinking low|medium|high|max - \u5F00\u542F\u5E76\u8BBE\u7F6E\u601D\u8003\u5F3A\u5EA6"].join(`
6713
6717
  `)}let t=o[1].toLowerCase(),s=r?.getThinkingConfig()||{mode:"auto",effort:"auto"};if(["on","off","auto"].includes(t)){let u=t,I={...s,mode:u,effort:u==="auto"?"auto":s.effort??"auto"};return r?.setThinkingConfig?.(I),G1?.services?.settings?.setValue?.("User","thinking",I),a&&await Qx(a,{thinking:I}),r&&Hn.emit("model-changed",r.getModel()||""),`\u2728 \u5DF2\u6210\u529F\u5C06\u601D\u8003\u6A21\u5F0F\u5207\u6362\u4E3A: **${u==="on"?"\u5F00\u542F":u==="off"?"\u5173\u95ED":"\u81EA\u52A8"}** (\u529B\u5EA6: ${I.effort})`}else if(["low","medium","high","max","xhigh"].includes(t)){let u=t,I={...s,mode:"on",effort:u};return r?.setThinkingConfig?.(I),G1?.services?.settings?.setValue?.("User","thinking",I),a&&await Qx(a,{thinking:I}),r&&Hn.emit("model-changed",r.getModel()||""),`\u2728 \u5DF2\u6210\u529F\u5F00\u542F\u601D\u8003\u6A21\u5F0F\uFF0C\u5E76\u8BBE\u7F6E\u601D\u8003\u529B\u5EA6\u4E3A: **${u}**`}else return`\u274C \u672A\u77E5\u7684\u601D\u8003\u53C2\u6570: ${o[1]}
6714
6718
  \u8BF7\u4F7F\u7528 off / auto / low / medium / high / max`}case"/model":{let o=n.split(/\s+/),t=G1?.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 px(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(`
6715
- `)}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),a&&await Qx(a,{model:h});let g=`\u2728 \u5DF2\u6210\u529F\u5207\u6362 AI \u6A21\u578B\u4E3A: **${d.displayName}** (${h})`;return m.compressionInfo?g+=`
6719
+ `)}let I=o[1].trim(),d,h;if(I.toLowerCase()==="auto")d="auto",h="Auto (\u667A\u80FD\u81EA\u52A8\u6A21\u5F0F)";else{let c=u.find(m=>m.name.toLowerCase()===I.toLowerCase()||m.displayName.toLowerCase()===I.toLowerCase());if(!c)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`;d=c.name,h=c.displayName}if(r){let c=r.getGeminiClient();if(c){await c.waitForChatInitialized();let m=await c.switchModel(d,new AbortController().signal);if(!m.success)return`\u274C \u5207\u6362\u5230\u6A21\u578B **${h}** \u5931\u8D25: ${m.error||"\u53EF\u80FD\u7531\u4E8E\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25"}`;t.setValue("User","preferredModel",d),a&&await Qx(a,{model:d});let g=`\u2728 \u5DF2\u6210\u529F\u5207\u6362 AI \u6A21\u578B\u4E3A: **${h}** (${d})`;return m.compressionInfo?g+=`
6716
6720
  \u{1F4E6} \u4E0A\u4E0B\u6587\u5DF2\u81EA\u52A8\u538B\u7F29: ${m.compressionInfo.originalTokenCount} \u2192 ${m.compressionInfo.newTokenCount} tokens`:m.compressionSkipReason&&(g+=`
6717
- \u2713 ${m.compressionSkipReason}`),Hn.emit("model-changed",h),g}}return t.setValue("User","preferredModel",h),a&&await Qx(a,{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(sQi))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(`
6721
+ \u2713 ${m.compressionSkipReason}`),Hn.emit("model-changed",d),g}}return t.setValue("User","preferredModel",d),a&&await Qx(a,{model:d}),`\u2728 \u5DF2\u6210\u529F\u5207\u6362 AI \u6A21\u578B\u4E3A: **${h}** (${d})`}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(sQi))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(`
6718
6722
  `)}default:return null}}async function cQi(n,e,r){let a=new G0,i=new v0(a),o=new Ef(a,i),t=[new OH(e),new KH(e),new zH(e),new PH(e),new jH(e),new Gee(o,a)],s=new AbortController,I=(await yH.create(t,s.signal)).getCommands(),d=n.trim(),h=d.substring(1).trim().split(/\s+/),c=h.filter(F=>F);if(c.length===0)return null;let m=I,g,v=0;for(let F of c){let w=m.find(p=>p.name===F);if(w||(w=m.find(p=>p.altNames?.includes(F))),w)if(g=w,v++,w.subCommands)m=w.subCommands;else break;else break}if(!g)return null;let Z=h.slice(v).join(" "),A=[],R={invocation:{raw:d,name:g.name,args:Z},isNonInteractive:!0,services:{config:e,settings:G1?.services?.settings||{},git:G1?.services?.git,logger:console},ui:{addItem:F=>(F&&F.text&&A.push(F.text),Date.now()),clear:()=>{A.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,Z);if(F)if(F.type==="message")A.push(F.content);else{if(F.type==="submit_prompt")return{type:"submit_prompt",content:F.content};if(F.type==="dialog"){let w=F.dialog,p=`\u26A0\uFE0F **\u8BE5\u547D\u4EE4\u9700\u8981\u7EC8\u7AEF\uFF08TUI\uFF09\u4EA4\u4E92\u754C\u9762\u652F\u6301\u3002**
6719
6723
 
6720
6724
  \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"?p+="\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"?p+="\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"&&(p+="\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"),A.push(p)}else F.type==="select_session"?A.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"&&A.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:A.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easycode-ai",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },