@tencent-ai/codebuddy-code 0.0.1-beta.2 → 0.0.1-beta.20

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.
@@ -0,0 +1 @@
1
+ "use strict";exports.id=422,exports.ids=[422],exports.modules={7422:(e,t,n)=>{n.a(e,(async(e,r)=>{try{n.r(t),n.d(t,{LoginView:()=>LoginView});var l=n(80932),a=n(14083),o=n(96540),c=n(66814),i=n(75101),s=n(82101),u=n(34209),m=n(53829),E=n(49034),d=n(47693),g=n(83175),b=n(42790),y=e([a,s,m,E,b]);[a,s,m,E,b]=y.then?(await y)():y;const LoginView=()=>{const{staticKey:e}=(0,E._W)();return o.createElement(o.Fragment,null,o.createElement(a.jC,{key:`login-view-${e}`,items:[o.createElement(LogoBox,{key:"logo-box"}),o.createElement(NewVersionBox,{key:"new-version-box"})]},(e=>e)),o.createElement(LoginBox,null))},LogoBox=()=>{const e=`Welcome to ${u.KR}`,t=e.length+8;return o.createElement(o.Fragment,null,o.createElement(a.az,{marginBottom:1,paddingLeft:1,borderStyle:"round",borderColor:g.Q.brand,width:t},o.createElement(a.EY,{color:g.Q.brand},"✻ ",e)),o.createElement(b.H,null))},NewVersionBox=()=>{const e="cyan",t=i.CW.getCurrentPackageJson(),n=t.version.includes("beta"),r=t.version.includes("alpha"),l=n?"@beta":r?"@alpha":"";return o.createElement(a.az,{paddingX:1,flexDirection:"column",borderStyle:"round",borderColor:e},o.createElement(a.EY,{color:e},"New Version Updated v",t.version," Release! Please visit ",u.KR," website to read changelog."),o.createElement(a.EY,{color:e},"Run npm install -g ",u.JP,l))},LoginBox=()=>{const{authSession:e,navigate:t}=(0,c.i7)(m.aO,(e=>({authSession:e.authSession,navigate:e.navigate}))),[n,r]=(0,o.useState)("idle"),[i,u]=(0,o.useState)(""),[b,y]=(0,o.useState)(""),h=(0,o.useRef)(new AbortController);return(0,o.useEffect)((()=>{const e=(0,d.bi)().urlSubject.subscribe(u);return()=>e.unsubscribe()}),[]),(0,a.Ge)(((l,a)=>{if(E.Om.RETURN(a)&&"idle"===n)try{r("loading"),y(""),(0,d.Yf)().login(h.current)}catch(e){r("error"),y(e instanceof Error?e.message:"Unknown error occurred")}else E.Om.ESCAPE(a)&&("loading"===n?(h.current.abort(),r("idle")):e&&t("/chat"))})),o.createElement(a.az,{paddingX:1,flexDirection:"column",gap:1,borderStyle:"round",borderColor:"grey"},"idle"===n?o.createElement(o.Fragment,null,o.createElement(a.az,null,o.createElement(a.EY,null,"Select login method:")),o.createElement(a.az,null,o.createElement(a.EY,{color:"green"},l.Ay.bullet," Login with Tencent Cloud CodeBuddy")),o.createElement(a.az,{justifyContent:"space-between"},o.createElement(a.EY,{color:"grey"},"(Press Enter to login)"))):"loading"===n?o.createElement(a.az,{paddingY:1,gap:1,flexDirection:"column"},o.createElement(a.az,null,o.createElement(a.EY,{color:"grey"},"Browser didn't open? User the url below to sign in:")),i&&o.createElement(a.az,null,o.createElement(a.EY,{color:"grey"},i)),o.createElement(a.az,{marginTop:1,gap:1},o.createElement(a.EY,{color:g.Q.brand},o.createElement(s.y$,{type:"star"})),o.createElement(a.EY,null,"Waiting for auth... (Press ESC to cancel)"))):"error"===n?o.createElement(o.Fragment,null,o.createElement(a.EY,{color:"red"},"Failed to login."),b&&o.createElement(a.EY,{color:"red"},"Message: ",b)):void 0)};r()}catch(e){r(e)}}))},42790:(e,t,n)=>{n.a(e,(async(e,r)=>{try{n.d(t,{H:()=>LogoText});var l=n(1597),a=n(14083),o=n(96540),c=n(83175),i=e([a]);a=(i.then?(await i)():i)[0];const LogoText=()=>{const e=(0,o.useRef)((0,l.Ay)(c.Q.GradientColors)),t=(0,o.useCallback)((t=>e.current.multiline(t)),[e]);return o.createElement(a.dL,{transform:t},o.createElement(a.EY,null,"\n ██████╗ ██████╗ ██████╗ ███████╗██████╗ ██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗\n██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔══██╗██║ ██║██╔══██╗██╔══██╗╚██╗ ██╔╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝\n██║ ██║ ██║██║ ██║█████╗ ██████╔╝██║ ██║██║ ██║██║ ██║ ╚████╔╝ ██║ ██║ ██║██║ ██║█████╗ \n██║ ██║ ██║██║ ██║██╔══╝ ██╔══██╗██║ ██║██║ ██║██║ ██║ ╚██╔╝ ██║ ██║ ██║██║ ██║██╔══╝ \n╚██████╗╚██████╔╝██████╔╝███████╗██████╔╝╚██████╔╝██████╔╝██████╔╝ ██║ ╚██████╗╚██████╔╝██████╔╝███████╗\n ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝\n \n\n . * . * . *\n /\\_/\\ \n ( o.o ) * . * \n > ^ < . \n"))};r()}catch(e){r(e)}}))}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=444,exports.ids=[444],exports.modules={84444:(e,t,r)=>{r.r(t),r.d(t,{Client:()=>Client});var s=r(76889);class Protocol{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(s.CancelledNotificationSchema,(e=>{const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)})),this.setNotificationHandler(s.ProgressNotificationSchema,(e=>{this._onprogress(e)})),this.setRequestHandler(s.PingRequestSchema,(e=>({})))}_setupTimeout(e,t,r,s,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:s})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new s.McpError(s.ErrorCode.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,r,o;this._transport=e;const i=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==i||i(),this._onclose()};const n=null===(r=this.transport)||void 0===r?void 0:r.onerror;this._transport.onerror=e=>{null==n||n(e),this._onerror(e)};const a=null===(o=this._transport)||void 0===o?void 0:o.onmessage;this._transport.onmessage=(e,t)=>{null==a||a(e,t),(0,s.isJSONRPCResponse)(e)||(0,s.isJSONRPCError)(e)?this._onresponse(e):(0,s.isJSONRPCRequest)(e)?this._onrequest(e,t):(0,s.isJSONRPCNotification)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const r=new s.McpError(s.ErrorCode.ConnectionClosed,"Connection closed");for(const e of t.values())e(r)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const r=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==r&&Promise.resolve().then((()=>r(e))).catch((e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`))))}_onrequest(e,t){var r,o,i,n;const a=null!==(r=this._requestHandlers.get(e.method))&&void 0!==r?r:this.fallbackRequestHandler;if(void 0===a)return void(null===(o=this._transport)||void 0===o||o.send({jsonrpc:"2.0",id:e.id,error:{code:s.ErrorCode.MethodNotFound,message:"Method not found"}}).catch((e=>this._onerror(new Error(`Failed to send an error response: ${e}`)))));const l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);const u={signal:l.signal,sessionId:null===(i=this._transport)||void 0===i?void 0:i.sessionId,_meta:null===(n=e.params)||void 0===n?void 0:n._meta,sendNotification:t=>this.notification(t,{relatedRequestId:e.id}),sendRequest:(t,r,s)=>this.request(t,r,{...s,relatedRequestId:e.id}),authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo};Promise.resolve().then((()=>a(e,u))).then((t=>{var r;if(!l.signal.aborted)return null===(r=this._transport)||void 0===r?void 0:r.send({result:t,jsonrpc:"2.0",id:e.id})}),(t=>{var r,o;if(!l.signal.aborted)return null===(r=this._transport)||void 0===r?void 0:r.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:s.ErrorCode.InternalError,message:null!==(o=t.message)&&void 0!==o?o:"Internal error"}})})).catch((e=>this._onerror(new Error(`Failed to send response: ${e}`)))).finally((()=>{this._requestHandlerAbortControllers.delete(e.id)}))}_onprogress(e){const{progressToken:t,...r}=e.params,s=Number(t),o=this._progressHandlers.get(s);if(!o)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const i=this._responseHandlers.get(s),n=this._timeoutInfo.get(s);if(n&&i&&n.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(e){return void i(e)}o(r)}_onresponse(e){const t=Number(e.id),r=this._responseHandlers.get(t);if(void 0!==r)if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),(0,s.isJSONRPCResponse)(e))r(e);else{r(new s.McpError(e.error.code,e.error.message,e.error.data))}else this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`))}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}request(e,t,r){const{relatedRequestId:o,resumptionToken:i,onresumptiontoken:n}=null!=r?r:{};return new Promise(((a,l)=>{var u,c,d,h,p,m;if(!this._transport)return void l(new Error("Not connected"));!0===(null===(u=this._options)||void 0===u?void 0:u.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(c=null==r?void 0:r.signal)||void 0===c||c.throwIfAborted();const v=this._requestMessageId++,_={...e,jsonrpc:"2.0",id:v};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(v,r.onprogress),_.params={...e.params,_meta:{...(null===(d=e.params)||void 0===d?void 0:d._meta)||{},progressToken:v}});const cancel=e=>{var t;this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String(e)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:n}).catch((e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)))),l(e)};this._responseHandlers.set(v,(e=>{var s;if(!(null===(s=null==r?void 0:r.signal)||void 0===s?void 0:s.aborted)){if(e instanceof Error)return l(e);try{const r=t.parse(e.result);a(r)}catch(e){l(e)}}})),null===(h=null==r?void 0:r.signal)||void 0===h||h.addEventListener("abort",(()=>{var e;cancel(null===(e=null==r?void 0:r.signal)||void 0===e?void 0:e.reason)}));const f=null!==(p=null==r?void 0:r.timeout)&&void 0!==p?p:6e4;this._setupTimeout(v,f,null==r?void 0:r.maxTotalTimeout,(()=>cancel(new s.McpError(s.ErrorCode.RequestTimeout,"Request timed out",{timeout:f}))),null!==(m=null==r?void 0:r.resetTimeoutOnProgress)&&void 0!==m&&m),this._transport.send(_,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:n}).catch((e=>{this._cleanupTimeout(v),l(e)}))}))}async notification(e,t){var r,s;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);if((null!==(s=null===(r=this._options)||void 0===r?void 0:r.debouncedNotificationMethods)&&void 0!==s?s:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then((()=>{var r;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const s={...e,jsonrpc:"2.0"};null===(r=this._transport)||void 0===r||r.send(s,t).catch((e=>this._onerror(e)))}))}const o={...e,jsonrpc:"2.0"};await this._transport.send(o,t)}setRequestHandler(e,t){const r=e.shape.method.value;this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,((r,s)=>Promise.resolve(t(e.parse(r),s))))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,(r=>Promise.resolve(t(e.parse(r)))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}var o=r(82174);class Client extends Protocol{constructor(e,t){var r;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=null!==(r=null==t?void 0:t.capabilities)&&void 0!==r?r:{},this._ajv=new o}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=function mergeCapabilities(e,t){return Object.entries(t).reduce(((e,[t,r])=>(e[t]=r&&"object"==typeof r&&e[t]?{...e[t],...r}:r,e)),{...e})}(this._capabilities,e)}assertCapability(e,t){var r;if(!(null===(r=this._serverCapabilities)||void 0===r?void 0:r[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{const r=await this.request({method:"initialize",params:{protocolVersion:s.LATEST_PROTOCOL_VERSION,capabilities:this._capabilities,clientInfo:this._clientInfo}},s.InitializeResultSchema,t);if(void 0===r)throw new Error(`Server sent invalid initialize result: ${r}`);if(!s.SUPPORTED_PROTOCOL_VERSIONS.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"})}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,r,s,o,i;switch(e){case"logging/setLevel":if(!(null===(t=this._serverCapabilities)||void 0===t?void 0:t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(null===(r=this._serverCapabilities)||void 0===r?void 0:r.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(null===(s=this._serverCapabilities)||void 0===s?void 0:s.resources))throw new Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(null===(o=this._serverCapabilities)||void 0===o?void 0:o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(null===(i=this._serverCapabilities)||void 0===i?void 0:i.completions))throw new Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){var t;if("notifications/roots/list_changed"===e)if(!(null===(t=this._capabilities.roots)||void 0===t?void 0:t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`)}}async ping(e){return this.request({method:"ping"},s.EmptyResultSchema,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},s.CompleteResultSchema,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},s.EmptyResultSchema,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},s.GetPromptResultSchema,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},s.ListPromptsResultSchema,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},s.ListResourcesResultSchema,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},s.ListResourceTemplatesResultSchema,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},s.ReadResourceResultSchema,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},s.EmptyResultSchema,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},s.EmptyResultSchema,t)}async callTool(e,t=s.CallToolResultSchema,r){const o=await this.request({method:"tools/call",params:e},t,r),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new s.McpError(s.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{if(!i(o.structuredContent))throw new s.McpError(s.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(e){if(e instanceof s.McpError)throw e;throw new s.McpError(s.ErrorCode.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return o}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const t of e)if(t.outputSchema)try{const e=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}catch(e){}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const r=await this.request({method:"tools/list",params:e},s.ListToolsResultSchema,t);return this.cacheToolOutputSchemas(r.tools),r}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=452,exports.ids=[452],exports.modules={34452:(t,e,r)=>{r.r(e),r.d(e,{SSEClientTransport:()=>SSEClientTransport,SseError:()=>SseError});class ParseError extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}}function noop(t){}function createParser(t){if("function"==typeof t)throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=noop,onError:r=noop,onRetry:s=noop,onComment:i}=t;let n,o="",a=!0,h="",l="";function parseLine(t){if(""===t)return void function dispatchEvent(){h.length>0&&e({id:n,event:l||void 0,data:h.endsWith("\n")?h.slice(0,-1):h}),n=void 0,h="",l=""}();if(t.startsWith(":"))return void(i&&i(t.slice(t.startsWith(": ")?2:1)));const r=t.indexOf(":");if(-1===r)processField(t,"",t);else{const e=t.slice(0,r),s=" "===t[r+1]?2:1;processField(e,t.slice(r+s),t)}}function processField(t,e,i){switch(t){case"event":l=e;break;case"data":h=`${h}${e}\n`;break;case"id":n=e.includes("\0")?void 0:e;break;case"retry":/^\d+$/.test(e)?s(parseInt(e,10)):r(new ParseError(`Invalid \`retry\` value: "${e}"`,{type:"invalid-retry",value:e,line:i}));break;default:r(new ParseError(`Unknown field "${t.length>20?`${t.slice(0,20)}…`:t}"`,{type:"unknown-field",field:t,value:e,line:i}))}}return{feed:function feed(t){const e=a?t.replace(/^\xEF\xBB\xBF/,""):t,[r,s]=function splitLines(t){const e=[];let r="",s=0;for(;s<t.length;){const i=t.indexOf("\r",s),n=t.indexOf("\n",s);let o=-1;if(-1!==i&&-1!==n?o=Math.min(i,n):-1!==i?o=i:-1!==n&&(o=n),-1===o){r=t.slice(s);break}{const r=t.slice(s,o);e.push(r),s=o+1,"\r"===t[s-1]&&"\n"===t[s]&&s++}}return[e,r]}(`${o}${e}`);for(const t of r)parseLine(t);o=s,a=!1},reset:function reset(t={}){o&&t.consume&&parseLine(o),a=!0,n=void 0,h="",l="",o=""}}}class ErrorEvent extends Event{constructor(t,e){var r,s;super(t),this.code=null!=(r=null==e?void 0:e.code)?r:void 0,this.message=null!=(s=null==e?void 0:e.message)?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,e,r){return r(inspectableError(this),e)}[Symbol.for("Deno.customInspect")](t,e){return t(inspectableError(this),e)}}function flattenError(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(flattenError).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${flattenError(t.cause)}`:t.message:`${t}`}function inspectableError(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var s,i,n,o,a,h,l,c,d,u,v,p,f,w,E,_,m,g,S,y,b,C,O,__typeError=t=>{throw TypeError(t)},__accessCheck=(t,e,r)=>e.has(t)||__typeError("Cannot "+r),__privateGet=(t,e,r)=>(__accessCheck(t,e,"read from private field"),r?r.call(t):e.get(t)),__privateAdd=(t,e,r)=>e.has(t)?__typeError("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),__privateSet=(t,e,r,s)=>(__accessCheck(t,e,"write to private field"),e.set(t,r),r),__privateMethod=(t,e,r)=>(__accessCheck(t,e,"access private method"),r);class EventSource extends EventTarget{constructor(t,e){var r,g;super(),__privateAdd(this,w),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,__privateAdd(this,s),__privateAdd(this,i),__privateAdd(this,n),__privateAdd(this,o),__privateAdd(this,a),__privateAdd(this,h),__privateAdd(this,l),__privateAdd(this,c,null),__privateAdd(this,d),__privateAdd(this,u),__privateAdd(this,v,null),__privateAdd(this,p,null),__privateAdd(this,f,null),__privateAdd(this,_,(async t=>{var e;__privateGet(this,u).reset();const{body:r,redirected:i,status:o,headers:a}=t;if(204===o)return __privateMethod(this,w,b).call(this,"Server sent HTTP 204, not reconnecting",204),void this.close();if(__privateSet(this,n,i?new URL(t.url):void 0),200!==o)return void __privateMethod(this,w,b).call(this,`Non-200 status code (${o})`,o);if(!(a.get("content-type")||"").startsWith("text/event-stream"))return void __privateMethod(this,w,b).call(this,'Invalid content type, expected "text/event-stream"',o);if(__privateGet(this,s)===this.CLOSED)return;__privateSet(this,s,this.OPEN);const h=new Event("open");if(null==(e=__privateGet(this,f))||e.call(this,h),this.dispatchEvent(h),"object"!=typeof r||!r||!("getReader"in r))return __privateMethod(this,w,b).call(this,"Invalid response body, expected a web ReadableStream",o),void this.close();const l=new TextDecoder,c=r.getReader();let d=!0;do{const{done:t,value:e}=await c.read();e&&__privateGet(this,u).feed(l.decode(e,{stream:!t})),t&&(d=!1,__privateGet(this,u).reset(),__privateMethod(this,w,C).call(this))}while(d)})),__privateAdd(this,m,(t=>{__privateSet(this,d,void 0),"AbortError"!==t.name&&"aborted"!==t.type&&__privateMethod(this,w,C).call(this,flattenError(t))})),__privateAdd(this,S,(t=>{"string"==typeof t.id&&__privateSet(this,c,t.id);const e=new MessageEvent(t.event||"message",{data:t.data,origin:__privateGet(this,n)?__privateGet(this,n).origin:__privateGet(this,i).origin,lastEventId:t.id||""});__privateGet(this,p)&&(!t.event||"message"===t.event)&&__privateGet(this,p).call(this,e),this.dispatchEvent(e)})),__privateAdd(this,y,(t=>{__privateSet(this,h,t)})),__privateAdd(this,O,(()=>{__privateSet(this,l,void 0),__privateGet(this,s)===this.CONNECTING&&__privateMethod(this,w,E).call(this)}));try{if(t instanceof URL)__privateSet(this,i,t);else{if("string"!=typeof t)throw new Error("Invalid URL");__privateSet(this,i,new URL(t,function getBaseURL(){const t="document"in globalThis?globalThis.document:void 0;return t&&"object"==typeof t&&"baseURI"in t&&"string"==typeof t.baseURI?t.baseURI:void 0}()))}}catch{throw function syntaxError(t){const e=globalThis.DOMException;return"function"==typeof e?new e(t,"SyntaxError"):new SyntaxError(t)}("An invalid or illegal string was specified")}__privateSet(this,u,createParser({onEvent:__privateGet(this,S),onRetry:__privateGet(this,y)})),__privateSet(this,s,this.CONNECTING),__privateSet(this,h,3e3),__privateSet(this,a,null!=(r=null==e?void 0:e.fetch)?r:globalThis.fetch),__privateSet(this,o,null!=(g=null==e?void 0:e.withCredentials)&&g),__privateMethod(this,w,E).call(this)}get readyState(){return __privateGet(this,s)}get url(){return __privateGet(this,i).href}get withCredentials(){return __privateGet(this,o)}get onerror(){return __privateGet(this,v)}set onerror(t){__privateSet(this,v,t)}get onmessage(){return __privateGet(this,p)}set onmessage(t){__privateSet(this,p,t)}get onopen(){return __privateGet(this,f)}set onopen(t){__privateSet(this,f,t)}addEventListener(t,e,r){const s=e;super.addEventListener(t,s,r)}removeEventListener(t,e,r){const s=e;super.removeEventListener(t,s,r)}close(){__privateGet(this,l)&&clearTimeout(__privateGet(this,l)),__privateGet(this,s)!==this.CLOSED&&(__privateGet(this,d)&&__privateGet(this,d).abort(),__privateSet(this,s,this.CLOSED),__privateSet(this,d,void 0))}}s=new WeakMap,i=new WeakMap,n=new WeakMap,o=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,v=new WeakMap,p=new WeakMap,f=new WeakMap,w=new WeakSet,E=function(){__privateSet(this,s,this.CONNECTING),__privateSet(this,d,new AbortController),__privateGet(this,a)(__privateGet(this,i),__privateMethod(this,w,g).call(this)).then(__privateGet(this,_)).catch(__privateGet(this,m))},_=new WeakMap,m=new WeakMap,g=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...__privateGet(this,c)?{"Last-Event-ID":__privateGet(this,c)}:void 0},cache:"no-store",signal:null==(t=__privateGet(this,d))?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},S=new WeakMap,y=new WeakMap,b=function(t,e){var r;__privateGet(this,s)!==this.CLOSED&&__privateSet(this,s,this.CLOSED);const i=new ErrorEvent("error",{code:e,message:t});null==(r=__privateGet(this,v))||r.call(this,i),this.dispatchEvent(i)},C=function(t,e){var r;if(__privateGet(this,s)===this.CLOSED)return;__privateSet(this,s,this.CONNECTING);const i=new ErrorEvent("error",{code:e,message:t});null==(r=__privateGet(this,v))||r.call(this,i),this.dispatchEvent(i),__privateSet(this,l,setTimeout(__privateGet(this,O),__privateGet(this,h)))},O=new WeakMap,EventSource.CONNECTING=0,EventSource.OPEN=1,EventSource.CLOSED=2;var T=r(13298),k=r(51345);class SseError extends Error{constructor(t,e,r){super(`SSE error: ${e}`),this.code=t,this.event=r}}class SSEClientTransport{constructor(t,e){this._url=t,this._resourceMetadataUrl=void 0,this._eventSourceInit=null==e?void 0:e.eventSourceInit,this._requestInit=null==e?void 0:e.requestInit,this._authProvider=null==e?void 0:e.authProvider,this._fetch=null==e?void 0:e.fetch}async _authThenStart(){var t;if(!this._authProvider)throw new k.D_("No auth provider");let e;try{e=await(0,k.j2)(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(e){throw null===(t=this.onerror)||void 0===t||t.call(this,e),e}if("AUTHORIZED"!==e)throw new k.D_;return await this._startOrAuth()}async _commonHeaders(){var t;const e={};if(this._authProvider){const t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}return this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion),new Headers({...e,...null===(t=this._requestInit)||void 0===t?void 0:t.headers})}_startOrAuth(){var t,e,r;const s=null!==(r=null!==(e=null===(t=null==this?void 0:this._eventSourceInit)||void 0===t?void 0:t.fetch)&&void 0!==e?e:this._fetch)&&void 0!==r?r:fetch;return new Promise(((t,e)=>{this._eventSource=new EventSource(this._url.href,{...this._eventSourceInit,fetch:async(t,e)=>{const r=await this._commonHeaders();r.set("Accept","text/event-stream");const i=await s(t,{...e,headers:r});return 401===i.status&&i.headers.has("www-authenticate")&&(this._resourceMetadataUrl=(0,k.cV)(i)),i}}),this._abortController=new AbortController,this._eventSource.onerror=r=>{var s;if(401===r.code&&this._authProvider)return void this._authThenStart().then(t,e);const i=new SseError(r.code,r.message,r);e(i),null===(s=this.onerror)||void 0===s||s.call(this,i)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",(r=>{var s;const i=r;try{if(this._endpoint=new URL(i.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(t){return e(t),null===(s=this.onerror)||void 0===s||s.call(this,t),void this.close()}t()})),this._eventSource.onmessage=t=>{var e,r;const s=t;let i;try{i=T.JSONRPCMessageSchema.parse(JSON.parse(s.data))}catch(t){return void(null===(e=this.onerror)||void 0===e||e.call(this,t))}null===(r=this.onmessage)||void 0===r||r.call(this,i)}}))}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new k.D_("No auth provider");if("AUTHORIZED"!==await(0,k.j2)(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch}))throw new k.D_("Failed to authorize")}async close(){var t,e,r;null===(t=this._abortController)||void 0===t||t.abort(),null===(e=this._eventSource)||void 0===e||e.close(),null===(r=this.onclose)||void 0===r||r.call(this)}async send(t){var e,r,s;if(!this._endpoint)throw new Error("Not connected");try{const s=await this._commonHeaders();s.set("content-type","application/json");const i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:null===(e=this._abortController)||void 0===e?void 0:e.signal},n=await(null!==(r=this._fetch)&&void 0!==r?r:fetch)(this._endpoint,i);if(!n.ok){if(401===n.status&&this._authProvider){this._resourceMetadataUrl=(0,k.cV)(n);if("AUTHORIZED"!==await(0,k.j2)(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch}))throw new k.D_;return this.send(t)}const e=await n.text().catch((()=>null));throw new Error(`Error POSTing to endpoint (HTTP ${n.status}): ${e}`)}}catch(t){throw null===(s=this.onerror)||void 0===s||s.call(this,t),t}}setProtocolVersion(t){this._protocolVersion=t}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=566,exports.ids=[566],exports.modules={19250:(e,t,a)=>{a.a(e,(async(e,n)=>{try{a.d(t,{NH:()=>r.NH,pF:()=>m.pF});var l=a(77146),s=a(89536),c=a(70790),m=a(62875),r=a(82388),i=e([l,s,c,m,r]);[l,s,c,m,r]=i.then?(await i)():i,n()}catch(e){n(e)}}))},90566:(e,t,a)=>{a.a(e,(async(e,n)=>{try{a.r(t),a.d(t,{ChatView:()=>ChatView});var l=a(14083),s=a(96540),c=a(66814),m=a(26730),r=a(53829),i=a(49034),u=a(59505),o=a(19250),g=a(66530),h=a(92709),p=e([l,m,r,i,u,o,g,h]);[l,m,r,i,u,o,g,h]=p.then?(await p)():p;const E=2,d=2,f=s.memo((({availableHeight:e})=>{const t=(0,c.i7)(r.Gb,(e=>e.staticKey)),a=(0,c.i7)(r.rZ,(e=>e.messageGroups)),n=(0,h.A)(a),[m,i]=(0,s.useState)([]),[u,o]=(0,s.useState)([]);(0,s.useEffect)((()=>{i([]),o([]);for(const e of a){if("function_call_group"===e.type){if(!e.messages.find((e=>"function_call"===e.type&&e.status&&["completed","incomplete"].includes(e.status)))){o((t=>(t.push(...e.messages),t)));continue}}i((t=>(t.push(...e.messages),t)))}}),[a]);const p=s.useMemo((()=>[s.createElement(g.f,{key:"chat-header-box"}),...m.map((e=>s.createElement(h.h,{key:`message-item-${e.id}`,msg:e,expanded:n(e.id)})))]),[m,n]);return s.createElement(s.Fragment,null,s.createElement(l.jC,{key:t,items:p},(e=>e)),u.length?s.createElement(l.az,{flexDirection:"column",height:E},...u.map((e=>s.createElement(h.h,{key:`message-item-${e.id}`,msg:e,expanded:n(e.id)})))):s.createElement(s.Fragment,null))})),ChatContainer=()=>{const{terminalHeight:e}=(0,i._W)(),[t,a]=(0,s.useState)(0);return(0,s.useEffect)((()=>{a(e-d)}),[e]),(0,m.o)(),(0,u.f)(),s.createElement(s.Fragment,null,s.createElement(f,{availableHeight:t}),s.createElement(l.az,{flexDirection:"column"},s.createElement(o.NH,null,s.createElement(o.pF,{availableHeight:t}))))},ChatView=()=>s.createElement(r.Fn,null,s.createElement(r.N7,null,s.createElement(r.Y5,null,s.createElement(ChatContainer,null))));n()}catch(e){n(e)}}))}};
@@ -0,0 +1 @@
1
+ exports.id=597,exports.ids=[597],exports.modules={1597:(t,e,o)=>{"use strict";o.d(e,{Ay:()=>P});const wrapAnsi16=(t=0)=>e=>`[${e+t}m`,wrapAnsi256=(t=0)=>e=>`[${38+t};5;${e}m`,wrapAnsi16m=(t=0)=>(e,o,r)=>`[${38+t};2;${e};${o};${r}m`,r={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(r.modifier),Object.keys(r.color),Object.keys(r.bgColor);const n=function assembleStyles(){const t=new Map;for(const[e,o]of Object.entries(r)){for(const[e,n]of Object.entries(o))r[e]={open:`[${n[0]}m`,close:`[${n[1]}m`},o[e]=r[e],t.set(n[0],n[1]);Object.defineProperty(r,e,{value:o,enumerable:!1})}return Object.defineProperty(r,"codes",{value:t,enumerable:!1}),r.color.close="",r.bgColor.close="",r.color.ansi=wrapAnsi16(),r.color.ansi256=wrapAnsi256(),r.color.ansi16m=wrapAnsi16m(),r.bgColor.ansi=wrapAnsi16(10),r.bgColor.ansi256=wrapAnsi256(10),r.bgColor.ansi16m=wrapAnsi16m(10),Object.defineProperties(r,{rgbToAnsi256:{value:(t,e,o)=>t===e&&e===o?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value(t){const e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!e)return[0,0,0];let[o]=e;3===o.length&&(o=[...o].map((t=>t+t)).join(""));const r=Number.parseInt(o,16);return[r>>16&255,r>>8&255,255&r]},enumerable:!1},hexToAnsi256:{value:t=>r.rgbToAnsi256(...r.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return t-8+90;let e,o,r;if(t>=232)e=(10*(t-232)+8)/255,o=e,r=e;else{const n=(t-=16)%36;e=Math.floor(t/36)/5,o=Math.floor(n/6)/5,r=n%6/5}const n=2*Math.max(e,o,r);if(0===n)return 30;let i=30+(Math.round(r)<<2|Math.round(o)<<1|Math.round(e));return 2===n&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(t,e,o)=>r.ansi256ToAnsi(r.rgbToAnsi256(t,e,o)),enumerable:!1},hexToAnsi:{value:t=>r.ansi256ToAnsi(r.hexToAnsi256(t)),enumerable:!1}}),r}();var i=o(1708),a=o(48161),s=o(7066);function hasFlag(t,e=(globalThis.Deno?globalThis.Deno.args:i.argv)){const o=t.startsWith("-")?"":1===t.length?"-":"--",r=e.indexOf(o+t),n=e.indexOf("--");return-1!==r&&(-1===n||r<n)}const{env:l}=i;let c;function _supportsColor(t,{streamIsTTY:e,sniffFlags:o=!0}={}){const r=function envForceColor(){if("FORCE_COLOR"in l)return"true"===l.FORCE_COLOR?1:"false"===l.FORCE_COLOR?0:0===l.FORCE_COLOR.length?1:Math.min(Number.parseInt(l.FORCE_COLOR,10),3)}();void 0!==r&&(c=r);const n=o?c:r;if(0===n)return 0;if(o){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor"))return 3;if(hasFlag("color=256"))return 2}if("TF_BUILD"in l&&"AGENT_NAME"in l)return 1;if(t&&!e&&void 0===n)return 0;const s=n||0;if("dumb"===l.TERM)return s;if("win32"===i.platform){const t=a.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in l)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((t=>t in l))?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((t=>t in l))||"codeship"===l.CI_NAME?1:s;if("TEAMCITY_VERSION"in l)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0;if("truecolor"===l.COLORTERM)return 3;if("xterm-kitty"===l.TERM)return 3;if("TERM_PROGRAM"in l){const t=Number.parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(l.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM)||"COLORTERM"in l?1:s}function createSupportsColor(t,e={}){return function translateLevel(t){return 0!==t&&{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}(_supportsColor(t,{streamIsTTY:t&&t.isTTY,...e}))}hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")?c=0:(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always"))&&(c=1);const h={stdout:createSupportsColor({isTTY:s.isatty(1)}),stderr:createSupportsColor({isTTY:s.isatty(2)})};function stringReplaceAll(t,e,o){let r=t.indexOf(e);if(-1===r)return t;const n=e.length;let i=0,a="";do{a+=t.slice(i,r)+e+o,i=r+n,r=t.indexOf(e,i)}while(-1!==r);return a+=t.slice(i),a}const{stdout:u,stderr:f}=h,g=Symbol("GENERATOR"),p=Symbol("STYLER"),d=Symbol("IS_EMPTY"),b=["ansi","ansi","ansi256","ansi16m"],m=Object.create(null);const chalkFactory=t=>{const chalk=(...t)=>t.join(" ");return((t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const o=u?u.level:0;t.level=void 0===e.level?o:e.level})(chalk,t),Object.setPrototypeOf(chalk,createChalk.prototype),chalk};function createChalk(t){return chalkFactory(t)}Object.setPrototypeOf(createChalk.prototype,Function.prototype);for(const[t,e]of Object.entries(n))m[t]={get(){const o=createBuilder(this,createStyler(e.open,e.close,this[p]),this[d]);return Object.defineProperty(this,t,{value:o}),o}};m.visible={get(){const t=createBuilder(this,this[p],!0);return Object.defineProperty(this,"visible",{value:t}),t}};const getModelAnsi=(t,e,o,...r)=>"rgb"===t?"ansi16m"===e?n[o].ansi16m(...r):"ansi256"===e?n[o].ansi256(n.rgbToAnsi256(...r)):n[o].ansi(n.rgbToAnsi(...r)):"hex"===t?getModelAnsi("rgb",e,o,...n.hexToRgb(...r)):n[o][t](...r),y=["rgb","hex","ansi256"];for(const t of y){m[t]={get(){const{level:e}=this;return function(...o){const r=createStyler(getModelAnsi(t,b[e],"color",...o),n.color.close,this[p]);return createBuilder(this,r,this[d])}}};m["bg"+t[0].toUpperCase()+t.slice(1)]={get(){const{level:e}=this;return function(...o){const r=createStyler(getModelAnsi(t,b[e],"bgColor",...o),n.bgColor.close,this[p]);return createBuilder(this,r,this[d])}}}}const v=Object.defineProperties((()=>{}),{...m,level:{enumerable:!0,get(){return this[g].level},set(t){this[g].level=t}}}),createStyler=(t,e,o)=>{let r,n;return void 0===o?(r=t,n=e):(r=o.openAll+t,n=e+o.closeAll),{open:t,close:e,openAll:r,closeAll:n,parent:o}},createBuilder=(t,e,o)=>{const builder=(...t)=>applyStyle(builder,1===t.length?""+t[0]:t.join(" "));return Object.setPrototypeOf(builder,v),builder[g]=t,builder[p]=e,builder[d]=o,builder},applyStyle=(t,e)=>{if(t.level<=0||!e)return t[d]?"":e;let o=t[p];if(void 0===o)return e;const{openAll:r,closeAll:n}=o;if(e.includes(""))for(;void 0!==o;)e=stringReplaceAll(e,o.close,o.open),o=o.parent;const i=e.indexOf("\n");return-1!==i&&(e=function stringEncaseCRLFWithFirstIndex(t,e,o,r){let n=0,i="";do{const a="\r"===t[r-1];i+=t.slice(n,a?r-1:r)+e+(a?"\r\n":"\n")+o,n=r+1,r=t.indexOf("\n",n)}while(-1!==r);return i+=t.slice(n),i}(e,n,r,i)),r+e+n};Object.defineProperties(createChalk.prototype,m);const _=createChalk(),x=(createChalk({level:f?f.level:0}),_);var A=o(34192);const gradient=(...t)=>{let e,o;if(0===t.length)throw new Error("Missing gradient colors");if(Array.isArray(t[0]))e=A(t[0]),o=validateOptions(t[1]);else{if(1===t.length)throw new Error(`Expected an array of colors, received ${JSON.stringify(t[0])}`);e=A(...t)}const fn=(t,r)=>function applyGradient(t,e,o){const r=validateOptions(o),n=Math.max(t.replace(/\s/g,"").length,e.stops.length),i=getColors(e,r,n);let a="";for(const e of t)a+=e.match(/\s/g)?e:x.hex(i.shift()?.toHex()||"#000")(e);return a}(t?t.toString():"",e,r??o);return fn.multiline=(t,r)=>function multiline(t,e,o){const r=validateOptions(o),n=t.split("\n"),i=Math.max(...n.map((t=>t.length)),e.stops.length),a=getColors(e,r,i),s=[];for(const t of n){const e=a.slice(0);let o="";for(const r of t)o+=x.hex(e.shift()?.toHex()||"#000")(r);s.push(o)}return s.join("\n")}(t?t.toString():"",e,r??o),fn},getColors=(t,e,o)=>"hsv"===e.interpolation?.toLowerCase()?t.hsv(o,e.hsvSpin?.toLowerCase()||!1):t.rgb(o);function validateOptions(t){const e={interpolation:"rgb",hsvSpin:"short",...t};if(void 0!==t&&"object"!=typeof t)throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof t}\``);if("string"!=typeof e.interpolation)throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof e.interpolation}\``);if("hsv"===e.interpolation.toLowerCase()&&"string"!=typeof e.hsvSpin)throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof e.hsvSpin}\``);return e}const M={colors:["#bdfff3","#4ac29a"],options:{}},T={colors:["#77a1d3","#79cbca","#e684ae"],options:{}},w={colors:["#473b7b","#3584a7","#30d2be"],options:{}},S={colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},R={colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}},C={colors:["#f43b47","#453a94"],options:{}},H={colors:["#ff4e50","#f9d423"],options:{}},O={colors:["#833ab4","#fd1d1d","#fcb045"],options:{}},k={colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"],options:{}},E={colors:["#fdbb2d","#22c1c3"],options:{}},F={colors:["#ff0000","#ff0100"],options:{interpolation:"hsv",hsvSpin:"long"}},I={colors:["#74ebd5","#74ecd5"],options:{interpolation:"hsv",hsvSpin:"long"}};function gradientAlias(t){const result=e=>gradient(...t.colors)(e,t.options);return result.multiline=(e="")=>gradient(...t.colors).multiline(e,t.options),result}const P=gradient,N=gradientAlias({colors:["#feac5e","#c779d0","#4bc0c8"],options:{}}),j=gradientAlias(M),L=gradientAlias(T),B=gradientAlias(w),G=gradientAlias(S),$=gradientAlias(R),U=gradientAlias(C),V=gradientAlias(H),D=gradientAlias(O),Y=gradientAlias(k),z=gradientAlias(E),q=gradientAlias(F),W=gradientAlias(I);gradient.atlas=N,gradient.cristal=j,gradient.teen=L,gradient.mind=B,gradient.morning=G,gradient.vice=$,gradient.passion=U,gradient.fruit=V,gradient.instagram=D,gradient.retro=Y,gradient.summer=z,gradient.rainbow=q,gradient.pastel=W},34192:(t,e,o)=>{const r=o(45888),n={r:256,g:256,b:256,a:1},i={h:360,s:1,v:1,a:1};function stepize(t,e,o){let r={};for(let n in t)t.hasOwnProperty(n)&&(r[n]=0===o?0:(e[n]-t[n])/o);return r}function interpolate(t,e,o,r){let n={};for(let i in e)e.hasOwnProperty(i)&&(n[i]=t[i]*o+e[i],n[i]=n[i]<0?n[i]+r[i]:1!==r[i]?n[i]%r[i]:n[i]);return n}function interpolateRgb(t,e,o){const i=t.color.toRgb(),a=stepize(i,e.color.toRgb(),o);let s=[t.color];for(let t=1;t<o;t++){const e=interpolate(a,i,t,n);s.push(r(e))}return s}function interpolateHsv(t,e,o,n){const a=t.color.toHsv(),s=e.color.toHsv();if(0===a.s||0===s.s)return interpolateRgb(t,e,o);let l;if("boolean"==typeof n)l=n;else{const t=a.h<s.h&&s.h-a.h<180||a.h>s.h&&a.h-s.h>180;l="long"===n&&t||"short"===n&&!t}const c=stepize(a,s,o);let h,u=[t.color];h=a.h<=s.h&&!l||a.h>=s.h&&l?s.h-a.h:l?360-s.h+a.h:360-a.h+s.h,c.h=Math.pow(-1,l?1:0)*Math.abs(h)/o;for(let t=1;t<o;t++){const e=interpolate(c,a,t,i);u.push(r(e))}return u}function computeSubsteps(t,e){const o=t.length;if(e=parseInt(e,10),isNaN(e)||e<2)throw new Error("Invalid number of steps (< 2)");if(e<o)throw new Error("Number of steps cannot be inferior to number of stops");let r=[];for(let n=1;n<o;n++){const o=(e-1)*(t[n].pos-t[n-1].pos);r.push(Math.max(1,Math.round(o)))}let n=1;for(let t=o-1;t--;)n+=r[t];for(;n!==e;)if(n<e){const t=Math.min.apply(null,r);r[r.indexOf(t)]++,n++}else{const t=Math.max.apply(null,r);r[r.indexOf(t)]--,n--}return r}function computeAt(t,e,o,n){if(e<0||e>1)throw new Error("Position must be between 0 and 1");let i,a;for(let o=0,r=t.length;o<r-1;o++)if(e>=t[o].pos&&e<t[o+1].pos){i=t[o],a=t[o+1];break}i||(i=a=t[t.length-1]);const s=interpolate(stepize(i.color[o](),a.color[o](),100*(a.pos-i.pos)),i.color[o](),100*(e-i.pos),n);return r(s)}class TinyGradient{constructor(t){if(t.length<2)throw new Error("Invalid number of stops (< 2)");const e=void 0!==t[0].pos;let o=t.length,n=-1,i=!1;this.stops=t.map(((t,a)=>{const s=void 0!==t.pos;if(e^s)throw new Error("Cannot mix positionned and not posionned color stops");if(s){const e=void 0!==t.color;if(!e&&(i||0===a||a===o-1))throw new Error("Cannot define two consecutive position-only stops");if(i=!e,(t={color:e?r(t.color):null,colorLess:!e,pos:t.pos}).pos<0||t.pos>1)throw new Error("Color stops positions must be between 0 and 1");if(t.pos<n)throw new Error("Color stops positions are not ordered");n=t.pos}else t={color:r(void 0!==t.color?t.color:t),pos:a/(o-1)};return t})),0!==this.stops[0].pos&&(this.stops.unshift({color:this.stops[0].color,pos:0}),o++),1!==this.stops[o-1].pos&&this.stops.push({color:this.stops[o-1].color,pos:1})}reverse(){let t=[];return this.stops.forEach((function(e){t.push({color:e.color,pos:1-e.pos})})),new TinyGradient(t.reverse())}loop(){let t=[],e=[];return this.stops.forEach((e=>{t.push({color:e.color,pos:e.pos/2})})),this.stops.slice(0,-1).forEach((t=>{e.push({color:t.color,pos:1-t.pos/2})})),new TinyGradient(t.concat(e.reverse()))}rgb(t){const e=computeSubsteps(this.stops,t);let o=[];this.stops.forEach(((t,e)=>{t.colorLess&&(t.color=interpolateRgb(this.stops[e-1],this.stops[e+1],2)[1])}));for(let t=0,r=this.stops.length;t<r-1;t++){const r=interpolateRgb(this.stops[t],this.stops[t+1],e[t]);o.splice(o.length,0,...r)}return o.push(this.stops[this.stops.length-1].color),o}hsv(t,e){const o=computeSubsteps(this.stops,t);let r=[];this.stops.forEach(((t,o)=>{t.colorLess&&(t.color=interpolateHsv(this.stops[o-1],this.stops[o+1],2,e)[1])}));for(let t=0,n=this.stops.length;t<n-1;t++){const n=interpolateHsv(this.stops[t],this.stops[t+1],o[t],e);r.splice(r.length,0,...n)}return r.push(this.stops[this.stops.length-1].color),r}css(t,e){let o=(t=t||"linear")+"-gradient("+(e=e||("linear"===t?"to right":"ellipse at center"));return this.stops.forEach((function(t){o+=", "+(t.colorLess?"":t.color.toRgbString()+" ")+100*t.pos+"%"})),o+=")",o}rgbAt(t){return computeAt(this.stops,t,"toRgb",n)}hsvAt(t){return computeAt(this.stops,t,"toHsv",i)}}t.exports=function(t){if(1===arguments.length){if(!Array.isArray(arguments[0]))throw new Error('"stops" is not an array');t=arguments[0]}else t=Array.prototype.slice.call(arguments);return new TinyGradient(t)}},45888:function(t){t.exports=function(){"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}var t=/^\s+/,e=/\s+$/;function tinycolor(t,e){if(e=e||{},(t=t||"")instanceof tinycolor)return t;if(!(this instanceof tinycolor))return new tinycolor(t,e);var o=inputToRGB(t);this._originalInput=t,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||o.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function inputToRGB(t){var e={r:0,g:0,b:0},o=1,r=null,n=null,i=null,a=!1,s=!1;return"string"==typeof t&&(t=stringInputToObject(t)),"object"==_typeof(t)&&(isValidCSSUnit(t.r)&&isValidCSSUnit(t.g)&&isValidCSSUnit(t.b)?(e=rgbToRgb(t.r,t.g,t.b),a=!0,s="%"===String(t.r).substr(-1)?"prgb":"rgb"):isValidCSSUnit(t.h)&&isValidCSSUnit(t.s)&&isValidCSSUnit(t.v)?(r=convertToPercentage(t.s),n=convertToPercentage(t.v),e=hsvToRgb(t.h,r,n),a=!0,s="hsv"):isValidCSSUnit(t.h)&&isValidCSSUnit(t.s)&&isValidCSSUnit(t.l)&&(r=convertToPercentage(t.s),i=convertToPercentage(t.l),e=hslToRgb(t.h,r,i),a=!0,s="hsl"),t.hasOwnProperty("a")&&(o=t.a)),o=boundAlpha(o),{ok:a,format:t.format||s,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:o}}function rgbToRgb(t,e,o){return{r:255*bound01(t,255),g:255*bound01(e,255),b:255*bound01(o,255)}}function rgbToHsl(t,e,o){t=bound01(t,255),e=bound01(e,255),o=bound01(o,255);var r,n,i=Math.max(t,e,o),a=Math.min(t,e,o),s=(i+a)/2;if(i==a)r=n=0;else{var l=i-a;switch(n=s>.5?l/(2-i-a):l/(i+a),i){case t:r=(e-o)/l+(e<o?6:0);break;case e:r=(o-t)/l+2;break;case o:r=(t-e)/l+4}r/=6}return{h:r,s:n,l:s}}function hslToRgb(t,e,o){var r,n,i;function hue2rgb(t,e,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t}if(t=bound01(t,360),e=bound01(e,100),o=bound01(o,100),0===e)r=n=i=o;else{var a=o<.5?o*(1+e):o+e-o*e,s=2*o-a;r=hue2rgb(s,a,t+1/3),n=hue2rgb(s,a,t),i=hue2rgb(s,a,t-1/3)}return{r:255*r,g:255*n,b:255*i}}function rgbToHsv(t,e,o){t=bound01(t,255),e=bound01(e,255),o=bound01(o,255);var r,n,i=Math.max(t,e,o),a=Math.min(t,e,o),s=i,l=i-a;if(n=0===i?0:l/i,i==a)r=0;else{switch(i){case t:r=(e-o)/l+(e<o?6:0);break;case e:r=(o-t)/l+2;break;case o:r=(t-e)/l+4}r/=6}return{h:r,s:n,v:s}}function hsvToRgb(t,e,o){t=6*bound01(t,360),e=bound01(e,100),o=bound01(o,100);var r=Math.floor(t),n=t-r,i=o*(1-e),a=o*(1-n*e),s=o*(1-(1-n)*e),l=r%6;return{r:255*[o,a,i,i,s,o][l],g:255*[s,o,o,a,i,i][l],b:255*[i,i,s,o,o,a][l]}}function rgbToHex(t,e,o,r){var n=[pad2(Math.round(t).toString(16)),pad2(Math.round(e).toString(16)),pad2(Math.round(o).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function rgbaToHex(t,e,o,r,n){var i=[pad2(Math.round(t).toString(16)),pad2(Math.round(e).toString(16)),pad2(Math.round(o).toString(16)),pad2(convertDecimalToHex(r))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function rgbaToArgbHex(t,e,o,r){return[pad2(convertDecimalToHex(r)),pad2(Math.round(t).toString(16)),pad2(Math.round(e).toString(16)),pad2(Math.round(o).toString(16))].join("")}function _desaturate(t,e){e=0===e?0:e||10;var o=tinycolor(t).toHsl();return o.s-=e/100,o.s=clamp01(o.s),tinycolor(o)}function _saturate(t,e){e=0===e?0:e||10;var o=tinycolor(t).toHsl();return o.s+=e/100,o.s=clamp01(o.s),tinycolor(o)}function _greyscale(t){return tinycolor(t).desaturate(100)}function _lighten(t,e){e=0===e?0:e||10;var o=tinycolor(t).toHsl();return o.l+=e/100,o.l=clamp01(o.l),tinycolor(o)}function _brighten(t,e){e=0===e?0:e||10;var o=tinycolor(t).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(-e/100*255))),o.g=Math.max(0,Math.min(255,o.g-Math.round(-e/100*255))),o.b=Math.max(0,Math.min(255,o.b-Math.round(-e/100*255))),tinycolor(o)}function _darken(t,e){e=0===e?0:e||10;var o=tinycolor(t).toHsl();return o.l-=e/100,o.l=clamp01(o.l),tinycolor(o)}function _spin(t,e){var o=tinycolor(t).toHsl(),r=(o.h+e)%360;return o.h=r<0?360+r:r,tinycolor(o)}function _complement(t){var e=tinycolor(t).toHsl();return e.h=(e.h+180)%360,tinycolor(e)}function polyad(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var o=tinycolor(t).toHsl(),r=[tinycolor(t)],n=360/e,i=1;i<e;i++)r.push(tinycolor({h:(o.h+i*n)%360,s:o.s,l:o.l}));return r}function _splitcomplement(t){var e=tinycolor(t).toHsl(),o=e.h;return[tinycolor(t),tinycolor({h:(o+72)%360,s:e.s,l:e.l}),tinycolor({h:(o+216)%360,s:e.s,l:e.l})]}function _analogous(t,e,o){e=e||6,o=o||30;var r=tinycolor(t).toHsl(),n=360/o,i=[tinycolor(t)];for(r.h=(r.h-(n*e>>1)+720)%360;--e;)r.h=(r.h+n)%360,i.push(tinycolor(r));return i}function _monochromatic(t,e){e=e||6;for(var o=tinycolor(t).toHsv(),r=o.h,n=o.s,i=o.v,a=[],s=1/e;e--;)a.push(tinycolor({h:r,s:n,v:i})),i=(i+s)%1;return a}tinycolor.prototype={isDark:function isDark(){return this.getBrightness()<128},isLight:function isLight(){return!this.isDark()},isValid:function isValid(){return this._ok},getOriginalInput:function getOriginalInput(){return this._originalInput},getFormat:function getFormat(){return this._format},getAlpha:function getAlpha(){return this._a},getBrightness:function getBrightness(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function getLuminance(){var t,e,o,r=this.toRgb();return t=r.r/255,e=r.g/255,o=r.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))},setAlpha:function setAlpha(t){return this._a=boundAlpha(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function toHsv(){var t=rgbToHsv(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function toHsvString(){var t=rgbToHsv(this._r,this._g,this._b),e=Math.round(360*t.h),o=Math.round(100*t.s),r=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+o+"%, "+r+"%)":"hsva("+e+", "+o+"%, "+r+"%, "+this._roundA+")"},toHsl:function toHsl(){var t=rgbToHsl(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function toHslString(){var t=rgbToHsl(this._r,this._g,this._b),e=Math.round(360*t.h),o=Math.round(100*t.s),r=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+o+"%, "+r+"%)":"hsla("+e+", "+o+"%, "+r+"%, "+this._roundA+")"},toHex:function toHex(t){return rgbToHex(this._r,this._g,this._b,t)},toHexString:function toHexString(t){return"#"+this.toHex(t)},toHex8:function toHex8(t){return rgbaToHex(this._r,this._g,this._b,this._a,t)},toHex8String:function toHex8String(t){return"#"+this.toHex8(t)},toRgb:function toRgb(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function toRgbString(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function toPercentageRgb(){return{r:Math.round(100*bound01(this._r,255))+"%",g:Math.round(100*bound01(this._g,255))+"%",b:Math.round(100*bound01(this._b,255))+"%",a:this._a}},toPercentageRgbString:function toPercentageRgbString(){return 1==this._a?"rgb("+Math.round(100*bound01(this._r,255))+"%, "+Math.round(100*bound01(this._g,255))+"%, "+Math.round(100*bound01(this._b,255))+"%)":"rgba("+Math.round(100*bound01(this._r,255))+"%, "+Math.round(100*bound01(this._g,255))+"%, "+Math.round(100*bound01(this._b,255))+"%, "+this._roundA+")"},toName:function toName(){return 0===this._a?"transparent":!(this._a<1)&&(r[rgbToHex(this._r,this._g,this._b,!0)]||!1)},toFilter:function toFilter(t){var e="#"+rgbaToArgbHex(this._r,this._g,this._b,this._a),o=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var n=tinycolor(t);o="#"+rgbaToArgbHex(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+o+")"},toString:function toString(t){var e=!!t;t=t||this._format;var o=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(o=this.toRgbString()),"prgb"===t&&(o=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(o=this.toHexString()),"hex3"===t&&(o=this.toHexString(!0)),"hex4"===t&&(o=this.toHex8String(!0)),"hex8"===t&&(o=this.toHex8String()),"name"===t&&(o=this.toName()),"hsl"===t&&(o=this.toHslString()),"hsv"===t&&(o=this.toHsvString()),o||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function clone(){return tinycolor(this.toString())},_applyModification:function _applyModification(t,e){var o=t.apply(null,[this].concat([].slice.call(e)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function lighten(){return this._applyModification(_lighten,arguments)},brighten:function brighten(){return this._applyModification(_brighten,arguments)},darken:function darken(){return this._applyModification(_darken,arguments)},desaturate:function desaturate(){return this._applyModification(_desaturate,arguments)},saturate:function saturate(){return this._applyModification(_saturate,arguments)},greyscale:function greyscale(){return this._applyModification(_greyscale,arguments)},spin:function spin(){return this._applyModification(_spin,arguments)},_applyCombination:function _applyCombination(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function analogous(){return this._applyCombination(_analogous,arguments)},complement:function complement(){return this._applyCombination(_complement,arguments)},monochromatic:function monochromatic(){return this._applyCombination(_monochromatic,arguments)},splitcomplement:function splitcomplement(){return this._applyCombination(_splitcomplement,arguments)},triad:function triad(){return this._applyCombination(polyad,[3])},tetrad:function tetrad(){return this._applyCombination(polyad,[4])}},tinycolor.fromRatio=function(t,e){if("object"==_typeof(t)){var o={};for(var r in t)t.hasOwnProperty(r)&&(o[r]="a"===r?t[r]:convertToPercentage(t[r]));t=o}return tinycolor(t,e)},tinycolor.equals=function(t,e){return!(!t||!e)&&tinycolor(t).toRgbString()==tinycolor(e).toRgbString()},tinycolor.random=function(){return tinycolor.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},tinycolor.mix=function(t,e,o){o=0===o?0:o||50;var r=tinycolor(t).toRgb(),n=tinycolor(e).toRgb(),i=o/100;return tinycolor({r:(n.r-r.r)*i+r.r,g:(n.g-r.g)*i+r.g,b:(n.b-r.b)*i+r.b,a:(n.a-r.a)*i+r.a})},tinycolor.readability=function(t,e){var o=tinycolor(t),r=tinycolor(e);return(Math.max(o.getLuminance(),r.getLuminance())+.05)/(Math.min(o.getLuminance(),r.getLuminance())+.05)},tinycolor.isReadable=function(t,e,o){var r,n,i=tinycolor.readability(t,e);switch(n=!1,(r=validateWCAG2Parms(o)).level+r.size){case"AAsmall":case"AAAlarge":n=i>=4.5;break;case"AAlarge":n=i>=3;break;case"AAAsmall":n=i>=7}return n},tinycolor.mostReadable=function(t,e,o){var r,n,i,a,s=null,l=0;n=(o=o||{}).includeFallbackColors,i=o.level,a=o.size;for(var c=0;c<e.length;c++)(r=tinycolor.readability(t,e[c]))>l&&(l=r,s=tinycolor(e[c]));return tinycolor.isReadable(t,s,{level:i,size:a})||!n?s:(o.includeFallbackColors=!1,tinycolor.mostReadable(t,["#fff","#000"],o))};var o=tinycolor.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},r=tinycolor.hexNames=flip(o);function flip(t){var e={};for(var o in t)t.hasOwnProperty(o)&&(e[t[o]]=o);return e}function boundAlpha(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function bound01(t,e){isOnePointZero(t)&&(t="100%");var o=isPercentage(t);return t=Math.min(e,Math.max(0,parseFloat(t))),o&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function clamp01(t){return Math.min(1,Math.max(0,t))}function parseIntFromHex(t){return parseInt(t,16)}function isOnePointZero(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function isPercentage(t){return"string"==typeof t&&-1!=t.indexOf("%")}function pad2(t){return 1==t.length?"0"+t:""+t}function convertToPercentage(t){return t<=1&&(t=100*t+"%"),t}function convertDecimalToHex(t){return Math.round(255*parseFloat(t)).toString(16)}function convertHexToDecimal(t){return parseIntFromHex(t)/255}var n,i,a,s=(i="[\\s|\\(]+("+(n="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+a),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function isValidCSSUnit(t){return!!s.CSS_UNIT.exec(t)}function stringInputToObject(r){r=r.replace(t,"").replace(e,"").toLowerCase();var n,i=!1;if(o[r])r=o[r],i=!0;else if("transparent"==r)return{r:0,g:0,b:0,a:0,format:"name"};return(n=s.rgb.exec(r))?{r:n[1],g:n[2],b:n[3]}:(n=s.rgba.exec(r))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=s.hsl.exec(r))?{h:n[1],s:n[2],l:n[3]}:(n=s.hsla.exec(r))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=s.hsv.exec(r))?{h:n[1],s:n[2],v:n[3]}:(n=s.hsva.exec(r))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=s.hex8.exec(r))?{r:parseIntFromHex(n[1]),g:parseIntFromHex(n[2]),b:parseIntFromHex(n[3]),a:convertHexToDecimal(n[4]),format:i?"name":"hex8"}:(n=s.hex6.exec(r))?{r:parseIntFromHex(n[1]),g:parseIntFromHex(n[2]),b:parseIntFromHex(n[3]),format:i?"name":"hex"}:(n=s.hex4.exec(r))?{r:parseIntFromHex(n[1]+""+n[1]),g:parseIntFromHex(n[2]+""+n[2]),b:parseIntFromHex(n[3]+""+n[3]),a:convertHexToDecimal(n[4]+""+n[4]),format:i?"name":"hex8"}:!!(n=s.hex3.exec(r))&&{r:parseIntFromHex(n[1]+""+n[1]),g:parseIntFromHex(n[2]+""+n[2]),b:parseIntFromHex(n[3]+""+n[3]),format:i?"name":"hex"}}function validateWCAG2Parms(t){var e,o;return"AA"!==(e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==e&&(e="AA"),"small"!==(o=(t.size||"small").toLowerCase())&&"large"!==o&&(o="small"),{level:e,size:o}}return tinycolor}()}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=726,exports.ids=[726],exports.modules={51345:(r,e,t)=>{let o;async function random(r){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let t="";const n=await async function getRandomValues(r){return(await o).getRandomValues(new Uint8Array(r))}(r);for(let o=0;o<r;o++){t+=e[n[o]%66]}return t}async function generateChallenge(r){const e=await(await o).subtle.digest("SHA-256",(new TextEncoder).encode(r));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function pkceChallenge(r){if(r||(r=43),r<43||r>128)throw`Expected a length between 43 and 128. Received ${r}.`;const e=await async function generateVerifier(r){return await random(r)}(r);return{code_verifier:e,code_challenge:await generateChallenge(e)}}t.d(e,{D_:()=>UnauthorizedError,j2:()=>auth,cV:()=>extractResourceMetadataUrl}),o=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(t.t.bind(t,77598,19)).then((r=>r.webcrypto));var n=t(13298),a=t(7578);const i=a.z.object({resource:a.z.string().url(),authorization_servers:a.z.array(a.z.string().url()).optional(),jwks_uri:a.z.string().url().optional(),scopes_supported:a.z.array(a.z.string()).optional(),bearer_methods_supported:a.z.array(a.z.string()).optional(),resource_signing_alg_values_supported:a.z.array(a.z.string()).optional(),resource_name:a.z.string().optional(),resource_documentation:a.z.string().optional(),resource_policy_uri:a.z.string().url().optional(),resource_tos_uri:a.z.string().url().optional(),tls_client_certificate_bound_access_tokens:a.z.boolean().optional(),authorization_details_types_supported:a.z.array(a.z.string()).optional(),dpop_signing_alg_values_supported:a.z.array(a.z.string()).optional(),dpop_bound_access_tokens_required:a.z.boolean().optional()}).passthrough(),s=a.z.object({issuer:a.z.string(),authorization_endpoint:a.z.string(),token_endpoint:a.z.string(),registration_endpoint:a.z.string().optional(),scopes_supported:a.z.array(a.z.string()).optional(),response_types_supported:a.z.array(a.z.string()),response_modes_supported:a.z.array(a.z.string()).optional(),grant_types_supported:a.z.array(a.z.string()).optional(),token_endpoint_auth_methods_supported:a.z.array(a.z.string()).optional(),token_endpoint_auth_signing_alg_values_supported:a.z.array(a.z.string()).optional(),service_documentation:a.z.string().optional(),revocation_endpoint:a.z.string().optional(),revocation_endpoint_auth_methods_supported:a.z.array(a.z.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:a.z.array(a.z.string()).optional(),introspection_endpoint:a.z.string().optional(),introspection_endpoint_auth_methods_supported:a.z.array(a.z.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:a.z.array(a.z.string()).optional(),code_challenge_methods_supported:a.z.array(a.z.string()).optional()}).passthrough(),c=a.z.object({issuer:a.z.string(),authorization_endpoint:a.z.string(),token_endpoint:a.z.string(),userinfo_endpoint:a.z.string().optional(),jwks_uri:a.z.string(),registration_endpoint:a.z.string().optional(),scopes_supported:a.z.array(a.z.string()).optional(),response_types_supported:a.z.array(a.z.string()),response_modes_supported:a.z.array(a.z.string()).optional(),grant_types_supported:a.z.array(a.z.string()).optional(),acr_values_supported:a.z.array(a.z.string()).optional(),subject_types_supported:a.z.array(a.z.string()),id_token_signing_alg_values_supported:a.z.array(a.z.string()),id_token_encryption_alg_values_supported:a.z.array(a.z.string()).optional(),id_token_encryption_enc_values_supported:a.z.array(a.z.string()).optional(),userinfo_signing_alg_values_supported:a.z.array(a.z.string()).optional(),userinfo_encryption_alg_values_supported:a.z.array(a.z.string()).optional(),userinfo_encryption_enc_values_supported:a.z.array(a.z.string()).optional(),request_object_signing_alg_values_supported:a.z.array(a.z.string()).optional(),request_object_encryption_alg_values_supported:a.z.array(a.z.string()).optional(),request_object_encryption_enc_values_supported:a.z.array(a.z.string()).optional(),token_endpoint_auth_methods_supported:a.z.array(a.z.string()).optional(),token_endpoint_auth_signing_alg_values_supported:a.z.array(a.z.string()).optional(),display_values_supported:a.z.array(a.z.string()).optional(),claim_types_supported:a.z.array(a.z.string()).optional(),claims_supported:a.z.array(a.z.string()).optional(),service_documentation:a.z.string().optional(),claims_locales_supported:a.z.array(a.z.string()).optional(),ui_locales_supported:a.z.array(a.z.string()).optional(),claims_parameter_supported:a.z.boolean().optional(),request_parameter_supported:a.z.boolean().optional(),request_uri_parameter_supported:a.z.boolean().optional(),require_request_uri_registration:a.z.boolean().optional(),op_policy_uri:a.z.string().optional(),op_tos_uri:a.z.string().optional()}).passthrough().merge(s.pick({code_challenge_methods_supported:!0})),l=a.z.object({access_token:a.z.string(),id_token:a.z.string().optional(),token_type:a.z.string(),expires_in:a.z.number().optional(),scope:a.z.string().optional(),refresh_token:a.z.string().optional()}).strip(),p=a.z.object({error:a.z.string(),error_description:a.z.string().optional(),error_uri:a.z.string().optional()}),d=a.z.object({redirect_uris:a.z.array(a.z.string()).refine((r=>r.every((r=>URL.canParse(r)))),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:a.z.string().optional(),grant_types:a.z.array(a.z.string()).optional(),response_types:a.z.array(a.z.string()).optional(),client_name:a.z.string().optional(),client_uri:a.z.string().optional(),logo_uri:a.z.string().optional(),scope:a.z.string().optional(),contacts:a.z.array(a.z.string()).optional(),tos_uri:a.z.string().optional(),policy_uri:a.z.string().optional(),jwks_uri:a.z.string().optional(),jwks:a.z.any().optional(),software_id:a.z.string().optional(),software_version:a.z.string().optional(),software_statement:a.z.string().optional()}).strip(),u=a.z.object({client_id:a.z.string(),client_secret:a.z.string().optional(),client_id_issued_at:a.z.number().optional(),client_secret_expires_at:a.z.number().optional()}).strip(),_=d.merge(u);a.z.object({error:a.z.string(),error_description:a.z.string().optional()}).strip(),a.z.object({token:a.z.string(),token_type_hint:a.z.string().optional()}).strip();class OAuthError extends Error{constructor(r,e){super(r),this.errorUri=e,this.name=this.constructor.name}toResponseObject(){const r={error:this.errorCode,error_description:this.message};return this.errorUri&&(r.error_uri=this.errorUri),r}get errorCode(){return this.constructor.errorCode}}class InvalidRequestError extends OAuthError{}InvalidRequestError.errorCode="invalid_request";class InvalidClientError extends OAuthError{}InvalidClientError.errorCode="invalid_client";class InvalidGrantError extends OAuthError{}InvalidGrantError.errorCode="invalid_grant";class UnauthorizedClientError extends OAuthError{}UnauthorizedClientError.errorCode="unauthorized_client";class UnsupportedGrantTypeError extends OAuthError{}UnsupportedGrantTypeError.errorCode="unsupported_grant_type";class InvalidScopeError extends OAuthError{}InvalidScopeError.errorCode="invalid_scope";class AccessDeniedError extends OAuthError{}AccessDeniedError.errorCode="access_denied";class ServerError extends OAuthError{}ServerError.errorCode="server_error";class TemporarilyUnavailableError extends OAuthError{}TemporarilyUnavailableError.errorCode="temporarily_unavailable";class UnsupportedResponseTypeError extends OAuthError{}UnsupportedResponseTypeError.errorCode="unsupported_response_type";class UnsupportedTokenTypeError extends OAuthError{}UnsupportedTokenTypeError.errorCode="unsupported_token_type";class InvalidTokenError extends OAuthError{}InvalidTokenError.errorCode="invalid_token";class MethodNotAllowedError extends OAuthError{}MethodNotAllowedError.errorCode="method_not_allowed";class TooManyRequestsError extends OAuthError{}TooManyRequestsError.errorCode="too_many_requests";class InvalidClientMetadataError extends OAuthError{}InvalidClientMetadataError.errorCode="invalid_client_metadata";class InsufficientScopeError extends OAuthError{}InsufficientScopeError.errorCode="insufficient_scope";const h={[InvalidRequestError.errorCode]:InvalidRequestError,[InvalidClientError.errorCode]:InvalidClientError,[InvalidGrantError.errorCode]:InvalidGrantError,[UnauthorizedClientError.errorCode]:UnauthorizedClientError,[UnsupportedGrantTypeError.errorCode]:UnsupportedGrantTypeError,[InvalidScopeError.errorCode]:InvalidScopeError,[AccessDeniedError.errorCode]:AccessDeniedError,[ServerError.errorCode]:ServerError,[TemporarilyUnavailableError.errorCode]:TemporarilyUnavailableError,[UnsupportedResponseTypeError.errorCode]:UnsupportedResponseTypeError,[UnsupportedTokenTypeError.errorCode]:UnsupportedTokenTypeError,[InvalidTokenError.errorCode]:InvalidTokenError,[MethodNotAllowedError.errorCode]:MethodNotAllowedError,[TooManyRequestsError.errorCode]:TooManyRequestsError,[InvalidClientMetadataError.errorCode]:InvalidClientMetadataError,[InsufficientScopeError.errorCode]:InsufficientScopeError};class UnauthorizedError extends Error{constructor(r){super(null!=r?r:"Unauthorized")}}function selectClientAuthMethod(r,e){const t=void 0!==r.client_secret;return 0===e.length?t?"client_secret_post":"none":t&&e.includes("client_secret_basic")?"client_secret_basic":t&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":t?"client_secret_post":"none"}function applyClientAuthentication(r,e,t,o){const{client_id:n,client_secret:a}=e;switch(r){case"client_secret_basic":return void function applyBasicAuth(r,e,t){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const o=btoa(`${r}:${e}`);t.set("Authorization",`Basic ${o}`)}(n,a,t);case"client_secret_post":return void function applyPostAuth(r,e,t){t.set("client_id",r),e&&t.set("client_secret",e)}(n,a,o);case"none":return void function applyPublicAuth(r,e){e.set("client_id",r)}(n,o);default:throw new Error(`Unsupported client authentication method: ${r}`)}}async function parseErrorResponse(r){const e=r instanceof Response?r.status:void 0,t=r instanceof Response?await r.text():r;try{const r=p.parse(JSON.parse(t)),{error:e,error_description:o,error_uri:n}=r;return new(h[e]||ServerError)(o||"",n)}catch(r){return new ServerError(`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${r}. Raw body: ${t}`)}}async function auth(r,e){var t,o;try{return await authInternal(r,e)}catch(n){if(n instanceof InvalidClientError||n instanceof UnauthorizedClientError)return await(null===(t=r.invalidateCredentials)||void 0===t?void 0:t.call(r,"all")),await authInternal(r,e);if(n instanceof InvalidGrantError)return await(null===(o=r.invalidateCredentials)||void 0===o?void 0:o.call(r,"tokens")),await authInternal(r,e);throw n}}async function authInternal(r,{serverUrl:e,authorizationCode:t,scope:o,resourceMetadataUrl:a,fetchFn:p}){let d,u;try{d=await async function discoverOAuthProtectedResourceMetadata(r,e,t=fetch){const o=await discoverMetadataWithFallback(r,"oauth-protected-resource",t,{protocolVersion:null==e?void 0:e.protocolVersion,metadataUrl:null==e?void 0:e.resourceMetadataUrl});if(!o||404===o.status)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return i.parse(await o.json())}(e,{resourceMetadataUrl:a},p),d.authorization_servers&&d.authorization_servers.length>0&&(u=d.authorization_servers[0])}catch(r){}u||(u=e);const h=await async function selectResourceURL(r,e,t){const o=function resourceUrlFromServerUrl(r){const e="string"==typeof r?new URL(r):new URL(r.href);return e.hash="",e}(r);if(e.validateResourceURL)return await e.validateResourceURL(o,null==t?void 0:t.resource);if(!t)return;if(!function checkResourceAllowed({requestedResource:r,configuredResource:e}){const t="string"==typeof r?new URL(r):new URL(r.href),o="string"==typeof e?new URL(e):new URL(e.href);if(t.origin!==o.origin)return!1;if(t.pathname.length<o.pathname.length)return!1;const n=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(a)}({requestedResource:o,configuredResource:t.resource}))throw new Error(`Protected resource ${t.resource} does not match expected ${o} (or origin)`);return new URL(t.resource)}(e,r,d),g=await async function discoverAuthorizationServerMetadata(r,{fetchFn:e=fetch,protocolVersion:t=n.LATEST_PROTOCOL_VERSION}={}){var o;const a={"MCP-Protocol-Version":t},i=function buildDiscoveryUrls(r){const e="string"==typeof r?new URL(r):r,t="/"!==e.pathname,o=[];if(!t)return o.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),o;let n=e.pathname;n.endsWith("/")&&(n=n.slice(0,-1));return o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,e.origin),type:"oauth"}),o.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,e.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,e.origin),type:"oidc"}),o}(r);for(const{url:r,type:t}of i){const n=await fetchWithCorsRetry(r,a,e);if(n){if(!n.ok){if(n.status>=400&&n.status<500)continue;throw new Error(`HTTP ${n.status} trying to load ${"oauth"===t?"OAuth":"OpenID provider"} metadata from ${r}`)}if("oauth"===t)return s.parse(await n.json());{const e=c.parse(await n.json());if(!(null===(o=e.code_challenge_methods_supported)||void 0===o?void 0:o.includes("S256")))throw new Error(`Incompatible OIDC provider at ${r}: does not support S256 code challenge method required by MCP specification`);return e}}}return}(u,{fetchFn:p});let z=await Promise.resolve(r.clientInformation());if(!z){if(void 0!==t)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!r.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const e=await async function registerClient(r,{metadata:e,clientMetadata:t,fetchFn:o}){let n;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");n=new URL(e.registration_endpoint)}else n=new URL("/register",r);const a=await(null!=o?o:fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw await parseErrorResponse(a);return _.parse(await a.json())}(u,{metadata:g,clientMetadata:r.clientMetadata});await r.saveClientInformation(e),z=e}if(void 0!==t){const e=await r.codeVerifier(),o=await async function exchangeAuthorization(r,{metadata:e,clientInformation:t,authorizationCode:o,codeVerifier:n,redirectUri:a,resource:i,addClientAuthentication:s,fetchFn:c}){var p;const d="authorization_code",u=(null==e?void 0:e.token_endpoint)?new URL(e.token_endpoint):new URL("/token",r);if((null==e?void 0:e.grant_types_supported)&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);const _=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:o,code_verifier:n,redirect_uri:String(a)});if(s)s(_,h,r,e);else{applyClientAuthentication(selectClientAuthMethod(t,null!==(p=null==e?void 0:e.token_endpoint_auth_methods_supported)&&void 0!==p?p:[]),t,_,h)}i&&h.set("resource",i.href);const g=await(null!=c?c:fetch)(u,{method:"POST",headers:_,body:h});if(!g.ok)throw await parseErrorResponse(g);return l.parse(await g.json())}(u,{metadata:g,clientInformation:z,authorizationCode:t,codeVerifier:e,redirectUri:r.redirectUrl,resource:h,addClientAuthentication:r.addClientAuthentication,fetchFn:p});return await r.saveTokens(o),"AUTHORIZED"}const f=await r.tokens();if(null==f?void 0:f.refresh_token)try{const e=await async function refreshAuthorization(r,{metadata:e,clientInformation:t,refreshToken:o,resource:n,addClientAuthentication:a,fetchFn:i}){var s;const c="refresh_token";let p;if(e){if(p=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else p=new URL("/token",r);const d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),u=new URLSearchParams({grant_type:c,refresh_token:o});if(a)a(d,u,r,e);else{applyClientAuthentication(selectClientAuthMethod(t,null!==(s=null==e?void 0:e.token_endpoint_auth_methods_supported)&&void 0!==s?s:[]),t,d,u)}n&&u.set("resource",n.href);const _=await(null!=i?i:fetch)(p,{method:"POST",headers:d,body:u});if(!_.ok)throw await parseErrorResponse(_);return l.parse({refresh_token:o,...await _.json()})}(u,{metadata:g,clientInformation:z,refreshToken:f.refresh_token,resource:h,addClientAuthentication:r.addClientAuthentication});return await r.saveTokens(e),"AUTHORIZED"}catch(r){if(r instanceof OAuthError&&!(r instanceof ServerError))throw r}const y=r.state?await r.state():void 0,{authorizationUrl:w,codeVerifier:v}=await async function startAuthorization(r,{metadata:e,clientInformation:t,redirectUrl:o,scope:n,state:a,resource:i}){const s="code",c="S256";let l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(s))throw new Error(`Incompatible auth server: does not support response type ${s}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else l=new URL("/authorize",r);const p=await pkceChallenge(),d=p.code_verifier,u=p.code_challenge;l.searchParams.set("response_type",s),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",u),l.searchParams.set("code_challenge_method",c),l.searchParams.set("redirect_uri",String(o)),a&&l.searchParams.set("state",a);n&&l.searchParams.set("scope",n);(null==n?void 0:n.includes("offline_access"))&&l.searchParams.append("prompt","consent");i&&l.searchParams.set("resource",i.href);return{authorizationUrl:l,codeVerifier:d}}(u,{metadata:g,clientInformation:z,state:y,redirectUrl:r.redirectUrl,scope:o||r.clientMetadata.scope,resource:h});return await r.saveCodeVerifier(v),await r.redirectToAuthorization(w),"REDIRECT"}function extractResourceMetadataUrl(r){const e=r.headers.get("WWW-Authenticate");if(!e)return;const[t,o]=e.split(" ");if("bearer"!==t.toLowerCase()||!o)return;const n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch(r){return}}async function fetchWithCorsRetry(r,e,t=fetch){try{return await t(r,{headers:e})}catch(o){if(o instanceof TypeError)return e?fetchWithCorsRetry(r,void 0,t):void 0;throw o}}async function tryMetadataDiscovery(r,e,t=fetch){const o={"MCP-Protocol-Version":e};return await fetchWithCorsRetry(r,o,t)}async function discoverMetadataWithFallback(r,e,t,o){var a,i;const s=new URL(r),c=null!==(a=null==o?void 0:o.protocolVersion)&&void 0!==a?a:n.LATEST_PROTOCOL_VERSION;let l;if(null==o?void 0:o.metadataUrl)l=new URL(o.metadataUrl);else{const r=function buildWellKnownPath(r,e="",t={}){return e.endsWith("/")&&(e=e.slice(0,-1)),t.prependPathname?`${e}/.well-known/${r}`:`/.well-known/${r}${e}`}(e,s.pathname);l=new URL(r,null!==(i=null==o?void 0:o.metadataServerUrl)&&void 0!==i?i:s),l.search=s.search}let p=await tryMetadataDiscovery(l,c,t);if(!(null==o?void 0:o.metadataUrl)&&function shouldAttemptFallback(r,e){return!r||404===r.status&&"/"!==e}(p,s.pathname)){const r=new URL(`/.well-known/${e}`,s);p=await tryMetadataDiscovery(r,c,t)}return p}}};
@@ -0,0 +1 @@
1
+ exports.id=814,exports.ids=[814],exports.modules={8147:(t,r,e)=>{"use strict";const s=e(16928),n=e(54080),o=e(50078),i=e(34489),c="win32"===process.platform,a=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function parseNonShell(t){if(!c)return t;const r=function detectShebang(t){t.file=n(t);const r=t.file&&i(t.file);return r?(t.args.unshift(t.file),t.command=r,n(t)):t.file}(t),e=!a.test(r);if(t.options.forceShell||e){const e=l.test(r);t.command=s.normalize(t.command),t.command=o.command(t.command),t.args=t.args.map((t=>o.argument(t,e)));const n=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${n}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}t.exports=function parse(t,r,e){r&&!Array.isArray(r)&&(e=r,r=null);const s={command:t,args:r=r?r.slice(0):[],options:e=Object.assign({},e),file:void 0,original:{command:t,args:r}};return e.shell?s:parseNonShell(s)}},14155:(t,r,e)=>{t.exports=isexe,isexe.sync=function sync(t,r){return checkStat(s.statSync(t),r)};var s=e(79896);function isexe(t,r,e){s.stat(t,(function(t,s){e(t,!t&&checkStat(s,r))}))}function checkStat(t,r){return t.isFile()&&function checkMode(t,r){var e=t.mode,s=t.uid,n=t.gid,o=void 0!==r.uid?r.uid:process.getuid&&process.getuid(),i=void 0!==r.gid?r.gid:process.getgid&&process.getgid(),c=parseInt("100",8),a=parseInt("010",8),l=parseInt("001",8),u=c|a;return e&l||e&a&&n===i||e&c&&s===o||e&u&&0===o}(t,r)}},24326:(t,r,e)=>{const s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,n=e(16928),o=s?";":":",i=e(79882),getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),getPathInfo=(t,r)=>{const e=r.colon||o,n=t.match(/\//)||s&&t.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(e)],i=s?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",c=s?i.split(e):[""];return s&&-1!==t.indexOf(".")&&""!==c[0]&&c.unshift(""),{pathEnv:n,pathExt:c,pathExtExe:i}},which=(t,r,e)=>{"function"==typeof r&&(e=r,r={}),r||(r={});const{pathEnv:s,pathExt:o,pathExtExe:c}=getPathInfo(t,r),a=[],step=e=>new Promise(((o,i)=>{if(e===s.length)return r.all&&a.length?o(a):i(getNotFoundError(t));const c=s[e],l=/^".*"$/.test(c)?c.slice(1,-1):c,u=n.join(l,t),p=!l&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;o(subStep(p,e,0))})),subStep=(t,e,s)=>new Promise(((n,l)=>{if(s===o.length)return n(step(e+1));const u=o[s];i(t+u,{pathExt:c},((o,i)=>{if(!o&&i){if(!r.all)return n(t+u);a.push(t+u)}return n(subStep(t,e,s+1))}))}));return e?step(0).then((t=>e(null,t)),e):step(0)};t.exports=which,which.sync=(t,r)=>{r=r||{};const{pathEnv:e,pathExt:s,pathExtExe:o}=getPathInfo(t,r),c=[];for(let a=0;a<e.length;a++){const l=e[a],u=/^".*"$/.test(l)?l.slice(1,-1):l,p=n.join(u,t),d=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;for(let t=0;t<s.length;t++){const e=d+s[t];try{if(i.sync(e,{pathExt:o})){if(!r.all)return e;c.push(e)}}catch(t){}}}if(r.all&&c.length)return c;if(r.nothrow)return null;throw getNotFoundError(t)}},34489:(t,r,e)=>{"use strict";const s=e(79896),n=e(50230);t.exports=function readShebang(t){const r=Buffer.alloc(150);let e;try{e=s.openSync(t,"r"),s.readSync(e,r,0,150,0),s.closeSync(e)}catch(t){}return n(r.toString())}},47814:(t,r,e)=>{"use strict";e.r(r),e.d(r,{DEFAULT_INHERITED_ENV_VARS:()=>c,StdioClientTransport:()=>StdioClientTransport,getDefaultEnvironment:()=>getDefaultEnvironment});var s=e(91092),n=e(1708),o=e(57075),i=e(76889);class ReadBuffer{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;const t=this._buffer.indexOf("\n");if(-1===t)return null;const r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),function deserializeMessage(t){return i.JSONRPCMessageSchema.parse(JSON.parse(t))}(r)}clear(){this._buffer=void 0}}const c="win32"===n.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function getDefaultEnvironment(){const t={};for(const r of c){const e=n.env[r];void 0!==e&&(e.startsWith("()")||(t[r]=e))}return t}class StdioClientTransport{constructor(t){this._abortController=new AbortController,this._readBuffer=new ReadBuffer,this._stderrStream=null,this._serverParams=t,"pipe"!==t.stderr&&"overlapped"!==t.stderr||(this._stderrStream=new o.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise(((t,r)=>{var e,o,i,c,a;this._process=s(this._serverParams.command,null!==(e=this._serverParams.args)&&void 0!==e?e:[],{env:{...getDefaultEnvironment(),...this._serverParams.env},stdio:["pipe","pipe",null!==(o=this._serverParams.stderr)&&void 0!==o?o:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:"win32"===n.platform&&"type"in n,cwd:this._serverParams.cwd}),this._process.on("error",(t=>{var e,s;"AbortError"!==t.name?(r(t),null===(s=this.onerror)||void 0===s||s.call(this,t)):null===(e=this.onclose)||void 0===e||e.call(this)})),this._process.on("spawn",(()=>{t()})),this._process.on("close",(t=>{var r;this._process=void 0,null===(r=this.onclose)||void 0===r||r.call(this)})),null===(i=this._process.stdin)||void 0===i||i.on("error",(t=>{var r;null===(r=this.onerror)||void 0===r||r.call(this,t)})),null===(c=this._process.stdout)||void 0===c||c.on("data",(t=>{this._readBuffer.append(t),this.processReadBuffer()})),null===(a=this._process.stdout)||void 0===a||a.on("error",(t=>{var r;null===(r=this.onerror)||void 0===r||r.call(this,t)})),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)}))}get stderr(){var t,r;return this._stderrStream?this._stderrStream:null!==(r=null===(t=this._process)||void 0===t?void 0:t.stderr)&&void 0!==r?r:null}get pid(){var t,r;return null!==(r=null===(t=this._process)||void 0===t?void 0:t.pid)&&void 0!==r?r:null}processReadBuffer(){for(var t,r;;)try{const r=this._readBuffer.readMessage();if(null===r)break;null===(t=this.onmessage)||void 0===t||t.call(this,r)}catch(t){null===(r=this.onerror)||void 0===r||r.call(this,t)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(t){return new Promise((r=>{var e;if(!(null===(e=this._process)||void 0===e?void 0:e.stdin))throw new Error("Not connected");const s=function serializeMessage(t){return JSON.stringify(t)+"\n"}(t);this._process.stdin.write(s)?r():this._process.stdin.once("drain",r)}))}}},50078:t=>{"use strict";const r=/([()\][%!^"`<>&|;, *?])/g;t.exports.command=function escapeCommand(t){return t=t.replace(r,"^$1")},t.exports.argument=function escapeArgument(t,e){return t=(t=`"${t=(t=(t=`${t}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1")}"`).replace(r,"^$1"),e&&(t=t.replace(r,"^$1")),t}},50230:(t,r,e)=>{"use strict";const s=e(85672);t.exports=(t="")=>{const r=t.match(s);if(!r)return null;const[e,n]=r[0].replace(/#! ?/,"").split(" "),o=e.split("/").pop();return"env"===o?n:n?`${o} ${n}`:o}},54080:(t,r,e)=>{"use strict";const s=e(16928),n=e(24326),o=e(58139);function resolveCommandAttempt(t,r){const e=t.options.env||process.env,i=process.cwd(),c=null!=t.options.cwd,a=c&&void 0!==process.chdir&&!process.chdir.disabled;if(a)try{process.chdir(t.options.cwd)}catch(t){}let l;try{l=n.sync(t.command,{path:e[o({env:e})],pathExt:r?s.delimiter:void 0})}catch(t){}finally{a&&process.chdir(i)}return l&&(l=s.resolve(c?t.options.cwd:"",l)),l}t.exports=function resolveCommand(t){return resolveCommandAttempt(t)||resolveCommandAttempt(t,!0)}},58139:t=>{"use strict";const pathKey=(t={})=>{const r=t.env||process.env;return"win32"!==(t.platform||process.platform)?"PATH":Object.keys(r).reverse().find((t=>"PATH"===t.toUpperCase()))||"Path"};t.exports=pathKey,t.exports.default=pathKey},66095:(t,r,e)=>{t.exports=isexe,isexe.sync=function sync(t,r){return checkStat(s.statSync(t),t,r)};var s=e(79896);function checkStat(t,r,e){return!(!t.isSymbolicLink()&&!t.isFile())&&function checkPathExt(t,r){var e=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!e)return!0;if(-1!==(e=e.split(";")).indexOf(""))return!0;for(var s=0;s<e.length;s++){var n=e[s].toLowerCase();if(n&&t.substr(-n.length).toLowerCase()===n)return!0}return!1}(r,e)}function isexe(t,r,e){s.stat(t,(function(s,n){e(s,!s&&checkStat(n,t,r))}))}},79882:(t,r,e)=>{var s;e(79896);function isexe(t,r,e){if("function"==typeof r&&(e=r,r={}),!e){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise((function(e,s){isexe(t,r||{},(function(t,r){t?s(t):e(r)}))}))}s(t,r||{},(function(t,s){t&&("EACCES"===t.code||r&&r.ignoreErrors)&&(t=null,s=!1),e(t,s)}))}s="win32"===process.platform||global.TESTING_WINDOWS?e(66095):e(14155),t.exports=isexe,isexe.sync=function sync(t,r){try{return s.sync(t,r||{})}catch(t){if(r&&r.ignoreErrors||"EACCES"===t.code)return!1;throw t}}},85672:t=>{"use strict";t.exports=/^#!(.*)/},90995:t=>{"use strict";const r="win32"===process.platform;function notFoundError(t,r){return Object.assign(new Error(`${r} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${t.command}`,path:t.command,spawnargs:t.args})}function verifyENOENT(t,e){return r&&1===t&&!e.file?notFoundError(e.original,"spawn"):null}t.exports={hookChildProcess:function hookChildProcess(t,e){if(!r)return;const s=t.emit;t.emit=function(r,n){if("exit"===r){const r=verifyENOENT(n,e);if(r)return s.call(t,"error",r)}return s.apply(t,arguments)}},verifyENOENT,verifyENOENTSync:function verifyENOENTSync(t,e){return r&&1===t&&!e.file?notFoundError(e.original,"spawnSync"):null},notFoundError}},91092:(t,r,e)=>{"use strict";const s=e(35317),n=e(8147),o=e(90995);function spawn(t,r,e){const i=n(t,r,e),c=s.spawn(i.command,i.args,i.options);return o.hookChildProcess(c,i),c}t.exports=spawn,t.exports.spawn=spawn,t.exports.sync=function spawnSync(t,r,e){const i=n(t,r,e),c=s.spawnSync(i.command,i.args,i.options);return c.error=c.error||o.verifyENOENTSync(c.status,i),c},t.exports._parse=n,t.exports._enoent=o}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=889,exports.ids=[889],exports.modules={76889:(e,t,o)=>{o.r(t),o.d(t,{AudioContentSchema:()=>se,BaseMetadataSchema:()=>y,BlobResourceContentsSchema:()=>A,BooleanSchemaSchema:()=>Ne,CallToolRequestSchema:()=>be,CallToolResultSchema:()=>de,CancelledNotificationSchema:()=>f,ClientCapabilitiesSchema:()=>q,ClientNotificationSchema:()=>Fe,ClientRequestSchema:()=>De,ClientResultSchema:()=>Ge,CompatibilityCallToolResultSchema:()=>Se,CompleteRequestSchema:()=>we,CompleteResultSchema:()=>Ae,ContentBlockSchema:()=>ze,CreateMessageRequestSchema:()=>Te,CreateMessageResultSchema:()=>qe,CursorSchema:()=>l,DEFAULT_NEGOTIATED_PROTOCOL_VERSION:()=>s,ElicitRequestSchema:()=>ve,ElicitResultSchema:()=>Ie,EmbeddedResourceSchema:()=>ie,EmptyResultSchema:()=>P,EnumSchemaSchema:()=>Oe,ErrorCode:()=>x,GetPromptRequestSchema:()=>oe,GetPromptResultSchema:()=>ce,ImageContentSchema:()=>ne,ImplementationSchema:()=>T,InitializeRequestSchema:()=>N,InitializeResultSchema:()=>L,InitializedNotificationSchema:()=>O,JSONRPCErrorSchema:()=>j,JSONRPCMessageSchema:()=>C,JSONRPCNotificationSchema:()=>b,JSONRPCRequestSchema:()=>S,JSONRPCResponseSchema:()=>R,JSONRPC_VERSION:()=>r,LATEST_PROTOCOL_VERSION:()=>n,ListPromptsRequestSchema:()=>ee,ListPromptsResultSchema:()=>te,ListResourceTemplatesRequestSchema:()=>D,ListResourceTemplatesResultSchema:()=>F,ListResourcesRequestSchema:()=>U,ListResourcesResultSchema:()=>B,ListRootsRequestSchema:()=>He,ListRootsResultSchema:()=>Ue,ListToolsRequestSchema:()=>ue,ListToolsResultSchema:()=>ge,LoggingLevelSchema:()=>xe,LoggingMessageNotificationSchema:()=>Ce,McpError:()=>McpError,ModelHintSchema:()=>Pe,ModelPreferencesSchema:()=>fe,NotificationSchema:()=>u,NumberSchemaSchema:()=>Le,PaginatedRequestSchema:()=>M,PaginatedResultSchema:()=>k,PingRequestSchema:()=>_,PrimitiveSchemaDefinitionSchema:()=>_e,ProgressNotificationSchema:()=>I,ProgressSchema:()=>v,ProgressTokenSchema:()=>z,PromptArgumentSchema:()=>Y,PromptListChangedNotificationSchema:()=>me,PromptMessageSchema:()=>le,PromptReferenceSchema:()=>Je,PromptSchema:()=>Z,ReadResourceRequestSchema:()=>G,ReadResourceResultSchema:()=>W,RequestIdSchema:()=>d,RequestSchema:()=>p,ResourceContentsSchema:()=>J,ResourceLinkSchema:()=>re,ResourceListChangedNotificationSchema:()=>$,ResourceReferenceSchema:()=>ke,ResourceSchema:()=>V,ResourceTemplateReferenceSchema:()=>Me,ResourceTemplateSchema:()=>H,ResourceUpdatedNotificationSchema:()=>X,ResultSchema:()=>g,RootSchema:()=>Ve,RootsListChangedNotificationSchema:()=>Be,SUPPORTED_PROTOCOL_VERSIONS:()=>i,SamplingMessageSchema:()=>ye,ServerCapabilitiesSchema:()=>E,ServerNotificationSchema:()=>$e,ServerRequestSchema:()=>We,ServerResultSchema:()=>Ke,SetLevelRequestSchema:()=>je,StringSchemaSchema:()=>Ee,SubscribeRequestSchema:()=>K,TextContentSchema:()=>ae,TextResourceContentsSchema:()=>w,ToolAnnotationsSchema:()=>pe,ToolListChangedNotificationSchema:()=>Re,ToolSchema:()=>he,UnsubscribeRequestSchema:()=>Q,isInitializeRequest:()=>isInitializeRequest,isInitializedNotification:()=>isInitializedNotification,isJSONRPCError:()=>isJSONRPCError,isJSONRPCNotification:()=>isJSONRPCNotification,isJSONRPCRequest:()=>isJSONRPCRequest,isJSONRPCResponse:()=>isJSONRPCResponse});var a=o(7578);const n="2025-06-18",s="2025-03-26",i=[n,"2025-03-26","2024-11-05","2024-10-07"],r="2.0",z=a.z.union([a.z.string(),a.z.number().int()]),l=a.z.string(),c=a.z.object({progressToken:a.z.optional(z)}).passthrough(),m=a.z.object({_meta:a.z.optional(c)}).passthrough(),p=a.z.object({method:a.z.string(),params:a.z.optional(m)}),h=a.z.object({_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),u=a.z.object({method:a.z.string(),params:a.z.optional(h)}),g=a.z.object({_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),d=a.z.union([a.z.string(),a.z.number().int()]),S=a.z.object({jsonrpc:a.z.literal(r),id:d}).merge(p).strict(),isJSONRPCRequest=e=>S.safeParse(e).success,b=a.z.object({jsonrpc:a.z.literal(r)}).merge(u).strict(),isJSONRPCNotification=e=>b.safeParse(e).success,R=a.z.object({jsonrpc:a.z.literal(r),id:d,result:g}).strict(),isJSONRPCResponse=e=>R.safeParse(e).success;var x;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(x||(x={}));const j=a.z.object({jsonrpc:a.z.literal(r),id:d,error:a.z.object({code:a.z.number().int(),message:a.z.string(),data:a.z.optional(a.z.unknown())})}).strict(),isJSONRPCError=e=>j.safeParse(e).success,C=a.z.union([S,b,R,j]),P=g.strict(),f=u.extend({method:a.z.literal("notifications/cancelled"),params:h.extend({requestId:d,reason:a.z.string().optional()})}),y=a.z.object({name:a.z.string(),title:a.z.optional(a.z.string())}).passthrough(),T=y.extend({version:a.z.string()}),q=a.z.object({experimental:a.z.optional(a.z.object({}).passthrough()),sampling:a.z.optional(a.z.object({}).passthrough()),elicitation:a.z.optional(a.z.object({}).passthrough()),roots:a.z.optional(a.z.object({listChanged:a.z.optional(a.z.boolean())}).passthrough())}).passthrough(),N=p.extend({method:a.z.literal("initialize"),params:m.extend({protocolVersion:a.z.string(),capabilities:q,clientInfo:T})}),isInitializeRequest=e=>N.safeParse(e).success,E=a.z.object({experimental:a.z.optional(a.z.object({}).passthrough()),logging:a.z.optional(a.z.object({}).passthrough()),completions:a.z.optional(a.z.object({}).passthrough()),prompts:a.z.optional(a.z.object({listChanged:a.z.optional(a.z.boolean())}).passthrough()),resources:a.z.optional(a.z.object({subscribe:a.z.optional(a.z.boolean()),listChanged:a.z.optional(a.z.boolean())}).passthrough()),tools:a.z.optional(a.z.object({listChanged:a.z.optional(a.z.boolean())}).passthrough())}).passthrough(),L=g.extend({protocolVersion:a.z.string(),capabilities:E,serverInfo:T,instructions:a.z.optional(a.z.string())}),O=u.extend({method:a.z.literal("notifications/initialized")}),isInitializedNotification=e=>O.safeParse(e).success,_=p.extend({method:a.z.literal("ping")}),v=a.z.object({progress:a.z.number(),total:a.z.optional(a.z.number()),message:a.z.optional(a.z.string())}).passthrough(),I=u.extend({method:a.z.literal("notifications/progress"),params:h.merge(v).extend({progressToken:z})}),M=p.extend({params:m.extend({cursor:a.z.optional(l)}).optional()}),k=g.extend({nextCursor:a.z.optional(l)}),J=a.z.object({uri:a.z.string(),mimeType:a.z.optional(a.z.string()),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),w=J.extend({text:a.z.string()}),A=J.extend({blob:a.z.string().base64()}),V=y.extend({uri:a.z.string(),description:a.z.optional(a.z.string()),mimeType:a.z.optional(a.z.string()),_meta:a.z.optional(a.z.object({}).passthrough())}),H=y.extend({uriTemplate:a.z.string(),description:a.z.optional(a.z.string()),mimeType:a.z.optional(a.z.string()),_meta:a.z.optional(a.z.object({}).passthrough())}),U=M.extend({method:a.z.literal("resources/list")}),B=k.extend({resources:a.z.array(V)}),D=M.extend({method:a.z.literal("resources/templates/list")}),F=k.extend({resourceTemplates:a.z.array(H)}),G=p.extend({method:a.z.literal("resources/read"),params:m.extend({uri:a.z.string()})}),W=g.extend({contents:a.z.array(a.z.union([w,A]))}),$=u.extend({method:a.z.literal("notifications/resources/list_changed")}),K=p.extend({method:a.z.literal("resources/subscribe"),params:m.extend({uri:a.z.string()})}),Q=p.extend({method:a.z.literal("resources/unsubscribe"),params:m.extend({uri:a.z.string()})}),X=u.extend({method:a.z.literal("notifications/resources/updated"),params:h.extend({uri:a.z.string()})}),Y=a.z.object({name:a.z.string(),description:a.z.optional(a.z.string()),required:a.z.optional(a.z.boolean())}).passthrough(),Z=y.extend({description:a.z.optional(a.z.string()),arguments:a.z.optional(a.z.array(Y)),_meta:a.z.optional(a.z.object({}).passthrough())}),ee=M.extend({method:a.z.literal("prompts/list")}),te=k.extend({prompts:a.z.array(Z)}),oe=p.extend({method:a.z.literal("prompts/get"),params:m.extend({name:a.z.string(),arguments:a.z.optional(a.z.record(a.z.string()))})}),ae=a.z.object({type:a.z.literal("text"),text:a.z.string(),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),ne=a.z.object({type:a.z.literal("image"),data:a.z.string().base64(),mimeType:a.z.string(),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),se=a.z.object({type:a.z.literal("audio"),data:a.z.string().base64(),mimeType:a.z.string(),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),ie=a.z.object({type:a.z.literal("resource"),resource:a.z.union([w,A]),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),re=V.extend({type:a.z.literal("resource_link")}),ze=a.z.union([ae,ne,se,re,ie]),le=a.z.object({role:a.z.enum(["user","assistant"]),content:ze}).passthrough(),ce=g.extend({description:a.z.optional(a.z.string()),messages:a.z.array(le)}),me=u.extend({method:a.z.literal("notifications/prompts/list_changed")}),pe=a.z.object({title:a.z.optional(a.z.string()),readOnlyHint:a.z.optional(a.z.boolean()),destructiveHint:a.z.optional(a.z.boolean()),idempotentHint:a.z.optional(a.z.boolean()),openWorldHint:a.z.optional(a.z.boolean())}).passthrough(),he=y.extend({description:a.z.optional(a.z.string()),inputSchema:a.z.object({type:a.z.literal("object"),properties:a.z.optional(a.z.object({}).passthrough()),required:a.z.optional(a.z.array(a.z.string()))}).passthrough(),outputSchema:a.z.optional(a.z.object({type:a.z.literal("object"),properties:a.z.optional(a.z.object({}).passthrough()),required:a.z.optional(a.z.array(a.z.string()))}).passthrough()),annotations:a.z.optional(pe),_meta:a.z.optional(a.z.object({}).passthrough())}),ue=M.extend({method:a.z.literal("tools/list")}),ge=k.extend({tools:a.z.array(he)}),de=g.extend({content:a.z.array(ze).default([]),structuredContent:a.z.object({}).passthrough().optional(),isError:a.z.optional(a.z.boolean())}),Se=de.or(g.extend({toolResult:a.z.unknown()})),be=p.extend({method:a.z.literal("tools/call"),params:m.extend({name:a.z.string(),arguments:a.z.optional(a.z.record(a.z.unknown()))})}),Re=u.extend({method:a.z.literal("notifications/tools/list_changed")}),xe=a.z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),je=p.extend({method:a.z.literal("logging/setLevel"),params:m.extend({level:xe})}),Ce=u.extend({method:a.z.literal("notifications/message"),params:h.extend({level:xe,logger:a.z.optional(a.z.string()),data:a.z.unknown()})}),Pe=a.z.object({name:a.z.string().optional()}).passthrough(),fe=a.z.object({hints:a.z.optional(a.z.array(Pe)),costPriority:a.z.optional(a.z.number().min(0).max(1)),speedPriority:a.z.optional(a.z.number().min(0).max(1)),intelligencePriority:a.z.optional(a.z.number().min(0).max(1))}).passthrough(),ye=a.z.object({role:a.z.enum(["user","assistant"]),content:a.z.union([ae,ne,se])}).passthrough(),Te=p.extend({method:a.z.literal("sampling/createMessage"),params:m.extend({messages:a.z.array(ye),systemPrompt:a.z.optional(a.z.string()),includeContext:a.z.optional(a.z.enum(["none","thisServer","allServers"])),temperature:a.z.optional(a.z.number()),maxTokens:a.z.number().int(),stopSequences:a.z.optional(a.z.array(a.z.string())),metadata:a.z.optional(a.z.object({}).passthrough()),modelPreferences:a.z.optional(fe)})}),qe=g.extend({model:a.z.string(),stopReason:a.z.optional(a.z.enum(["endTurn","stopSequence","maxTokens"]).or(a.z.string())),role:a.z.enum(["user","assistant"]),content:a.z.discriminatedUnion("type",[ae,ne,se])}),Ne=a.z.object({type:a.z.literal("boolean"),title:a.z.optional(a.z.string()),description:a.z.optional(a.z.string()),default:a.z.optional(a.z.boolean())}).passthrough(),Ee=a.z.object({type:a.z.literal("string"),title:a.z.optional(a.z.string()),description:a.z.optional(a.z.string()),minLength:a.z.optional(a.z.number()),maxLength:a.z.optional(a.z.number()),format:a.z.optional(a.z.enum(["email","uri","date","date-time"]))}).passthrough(),Le=a.z.object({type:a.z.enum(["number","integer"]),title:a.z.optional(a.z.string()),description:a.z.optional(a.z.string()),minimum:a.z.optional(a.z.number()),maximum:a.z.optional(a.z.number())}).passthrough(),Oe=a.z.object({type:a.z.literal("string"),title:a.z.optional(a.z.string()),description:a.z.optional(a.z.string()),enum:a.z.array(a.z.string()),enumNames:a.z.optional(a.z.array(a.z.string()))}).passthrough(),_e=a.z.union([Ne,Ee,Le,Oe]),ve=p.extend({method:a.z.literal("elicitation/create"),params:m.extend({message:a.z.string(),requestedSchema:a.z.object({type:a.z.literal("object"),properties:a.z.record(a.z.string(),_e),required:a.z.optional(a.z.array(a.z.string()))}).passthrough()})}),Ie=g.extend({action:a.z.enum(["accept","decline","cancel"]),content:a.z.optional(a.z.record(a.z.string(),a.z.unknown()))}),Me=a.z.object({type:a.z.literal("ref/resource"),uri:a.z.string()}).passthrough(),ke=Me,Je=a.z.object({type:a.z.literal("ref/prompt"),name:a.z.string()}).passthrough(),we=p.extend({method:a.z.literal("completion/complete"),params:m.extend({ref:a.z.union([Je,Me]),argument:a.z.object({name:a.z.string(),value:a.z.string()}).passthrough(),context:a.z.optional(a.z.object({arguments:a.z.optional(a.z.record(a.z.string(),a.z.string()))}))})}),Ae=g.extend({completion:a.z.object({values:a.z.array(a.z.string()).max(100),total:a.z.optional(a.z.number().int()),hasMore:a.z.optional(a.z.boolean())}).passthrough()}),Ve=a.z.object({uri:a.z.string().startsWith("file://"),name:a.z.optional(a.z.string()),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),He=p.extend({method:a.z.literal("roots/list")}),Ue=g.extend({roots:a.z.array(Ve)}),Be=u.extend({method:a.z.literal("notifications/roots/list_changed")}),De=a.z.union([_,N,we,je,oe,ee,U,D,G,K,Q,be,ue]),Fe=a.z.union([f,I,O,Be]),Ge=a.z.union([P,qe,Ie,Ue]),We=a.z.union([_,Te,ve,He]),$e=a.z.union([f,I,Ce,X,$,Re,me]),Ke=a.z.union([P,L,Ae,ce,te,B,F,W,de,ge]);class McpError extends Error{constructor(e,t,o){super(`MCP error ${e}: ${t}`),this.code=e,this.data=o,this.name="McpError"}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=939,exports.ids=[939],exports.modules={9939:(e,t,r)=>{r.r(t),r.d(t,{Client:()=>Client});var s=r(37902),o=r(13298),i=r(82174);class Client extends s.Zs{constructor(e,t){var r;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=null!==(r=null==t?void 0:t.capabilities)&&void 0!==r?r:{},this._ajv=new i}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=(0,s.hG)(this._capabilities,e)}assertCapability(e,t){var r;if(!(null===(r=this._serverCapabilities)||void 0===r?void 0:r[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{const r=await this.request({method:"initialize",params:{protocolVersion:o.LATEST_PROTOCOL_VERSION,capabilities:this._capabilities,clientInfo:this._clientInfo}},o.InitializeResultSchema,t);if(void 0===r)throw new Error(`Server sent invalid initialize result: ${r}`);if(!o.SUPPORTED_PROTOCOL_VERSIONS.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"})}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,r,s,o,i;switch(e){case"logging/setLevel":if(!(null===(t=this._serverCapabilities)||void 0===t?void 0:t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(null===(r=this._serverCapabilities)||void 0===r?void 0:r.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(null===(s=this._serverCapabilities)||void 0===s?void 0:s.resources))throw new Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(null===(o=this._serverCapabilities)||void 0===o?void 0:o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(null===(i=this._serverCapabilities)||void 0===i?void 0:i.completions))throw new Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){var t;if("notifications/roots/list_changed"===e)if(!(null===(t=this._capabilities.roots)||void 0===t?void 0:t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`)}}async ping(e){return this.request({method:"ping"},o.EmptyResultSchema,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},o.CompleteResultSchema,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},o.EmptyResultSchema,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},o.GetPromptResultSchema,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},o.ListPromptsResultSchema,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},o.ListResourcesResultSchema,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},o.ListResourceTemplatesResultSchema,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},o.ReadResourceResultSchema,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},o.EmptyResultSchema,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},o.EmptyResultSchema,t)}async callTool(e,t=o.CallToolResultSchema,r){const s=await this.request({method:"tools/call",params:e},t,r),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new o.McpError(o.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{if(!i(s.structuredContent))throw new o.McpError(o.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(e){if(e instanceof o.McpError)throw e;throw new o.McpError(o.ErrorCode.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return s}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const t of e)if(t.outputSchema)try{const e=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}catch(e){}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const r=await this.request({method:"tools/list",params:e},o.ListToolsResultSchema,t);return this.cacheToolOutputSchemas(r.tools),r}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=952,exports.ids=[952],exports.modules={26952:(e,t,n)=>{n.d(t,{toFormData:()=>toFormData});var a=n(48695),r=n(79814);let i=0;const o={START_BOUNDARY:i++,HEADER_FIELD_START:i++,HEADER_FIELD:i++,HEADER_VALUE_START:i++,HEADER_VALUE:i++,HEADER_VALUE_ALMOST_DONE:i++,HEADERS_ALMOST_DONE:i++,PART_DATA_START:i++,PART_DATA:i++,END:i++};let s=1;const d=s,E=s*=2,lower=e=>32|e,noop=()=>{};class MultipartParser{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=noop,this.onHeaderField=noop,this.onHeadersEnd=noop,this.onHeaderValue=noop,this.onPartBegin=noop,this.onPartData=noop,this.onPartEnd=noop,this.boundaryChars={},e="\r\n--"+e;const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n),this.boundaryChars[t[n]]=!0;this.boundary=t,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=o.START_BOUNDARY}write(e){let t=0;const n=e.length;let a=this.index,{lookbehind:r,boundary:i,boundaryChars:s,index:A,state:h,flags:l}=this;const D=this.boundary.length,c=D-1,f=e.length;let T,_;const mark=e=>{this[e+"Mark"]=t},clear=e=>{delete this[e+"Mark"]},callback=(e,t,n,a)=>{void 0!==t&&t===n||this[e](a&&a.subarray(t,n))},dataCallback=(n,a)=>{const r=n+"Mark";r in this&&(a?(callback(n,this[r],t,e),delete this[r]):(callback(n,this[r],e.length,e),this[r]=0))};for(t=0;t<n;t++)switch(T=e[t],h){case o.START_BOUNDARY:if(A===i.length-2){if(45===T)l|=E;else if(13!==T)return;A++;break}if(A-1==i.length-2){if(l&E&&45===T)h=o.END,l=0;else{if(l&E||10!==T)return;A=0,callback("onPartBegin"),h=o.HEADER_FIELD_START}break}T!==i[A+2]&&(A=-2),T===i[A+2]&&A++;break;case o.HEADER_FIELD_START:h=o.HEADER_FIELD,mark("onHeaderField"),A=0;case o.HEADER_FIELD:if(13===T){clear("onHeaderField"),h=o.HEADERS_ALMOST_DONE;break}if(A++,45===T)break;if(58===T){if(1===A)return;dataCallback("onHeaderField",!0),h=o.HEADER_VALUE_START;break}if(_=lower(T),_<97||_>122)return;break;case o.HEADER_VALUE_START:if(32===T)break;mark("onHeaderValue"),h=o.HEADER_VALUE;case o.HEADER_VALUE:13===T&&(dataCallback("onHeaderValue",!0),callback("onHeaderEnd"),h=o.HEADER_VALUE_ALMOST_DONE);break;case o.HEADER_VALUE_ALMOST_DONE:if(10!==T)return;h=o.HEADER_FIELD_START;break;case o.HEADERS_ALMOST_DONE:if(10!==T)return;callback("onHeadersEnd"),h=o.PART_DATA_START;break;case o.PART_DATA_START:h=o.PART_DATA,mark("onPartData");case o.PART_DATA:if(a=A,0===A){for(t+=c;t<f&&!(e[t]in s);)t+=D;t-=c,T=e[t]}if(A<i.length)i[A]===T?(0===A&&dataCallback("onPartData",!0),A++):A=0;else if(A===i.length)A++,13===T?l|=d:45===T?l|=E:A=0;else if(A-1===i.length)if(l&d){if(A=0,10===T){l&=~d,callback("onPartEnd"),callback("onPartBegin"),h=o.HEADER_FIELD_START;break}}else l&E&&45===T?(callback("onPartEnd"),h=o.END,l=0):A=0;if(A>0)r[A-1]=T;else if(a>0){const e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);callback("onPartData",0,a,e),a=0,mark("onPartData"),t--}break;case o.END:break;default:throw new Error(`Unexpected state entered: ${h}`)}dataCallback("onHeaderField"),dataCallback("onHeaderValue"),dataCallback("onPartData"),this.index=A,this.state=h,this.flags=l}end(){if(this.state===o.HEADER_FIELD_START&&0===this.index||this.state===o.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==o.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}async function toFormData(e,t){if(!/multipart/i.test(t))throw new TypeError("Failed to fetch");const n=t.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!n)throw new TypeError("no or bad content-type header, no multipart boundary");const i=new MultipartParser(n[1]||n[2]);let o,s,d,E,A,h;const l=[],D=new r.fS,onPartData=e=>{d+=c.decode(e,{stream:!0})},appendToFile=e=>{l.push(e)},appendFileToFormData=()=>{const e=new a.ZH(l,h,{type:A});D.append(E,e)},appendEntryToFormData=()=>{D.append(E,d)},c=new TextDecoder("utf-8");c.decode(),i.onPartBegin=function(){i.onPartData=onPartData,i.onPartEnd=appendEntryToFormData,o="",s="",d="",E="",A="",h=null,l.length=0},i.onHeaderField=function(e){o+=c.decode(e,{stream:!0})},i.onHeaderValue=function(e){s+=c.decode(e,{stream:!0})},i.onHeaderEnd=function(){if(s+=c.decode(),o=o.toLowerCase(),"content-disposition"===o){const e=s.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);e&&(E=e[2]||e[3]||""),h=function _fileName(e){const t=e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!t)return;const n=t[2]||t[3]||"";let a=n.slice(n.lastIndexOf("\\")+1);return a=a.replace(/%22/g,'"'),a=a.replace(/&#(\d{4});/g,((e,t)=>String.fromCharCode(t))),a}(s),h&&(i.onPartData=appendToFile,i.onPartEnd=appendFileToFormData)}else"content-type"===o&&(A=s);s="",o=""};for await(const t of e)i.write(t);return i.end(),D}}};