@doubao-dev/cli 1.0.0-legacy-rc.13 → 1.0.0-legacy-rc.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/1349~0.js +2 -2
  2. package/dist/1453.js +2 -2
  3. package/dist/1499~0.js +13 -0
  4. package/dist/1547~0.js +29 -0
  5. package/dist/351.js +1 -1
  6. package/dist/4569~0.js +1 -0
  7. package/dist/4946.js +3 -3
  8. package/dist/5085~0.js +1 -1
  9. package/dist/5329~0.js +98 -0
  10. package/dist/{5792~0.js.LICENSE.txt → 5329~0.js.LICENSE.txt} +40 -0
  11. package/dist/5343~0.js +1 -1
  12. package/dist/5641~0.js +2 -2
  13. package/dist/5725~0.js +1 -1
  14. package/dist/678~0.js +1 -1
  15. package/dist/8352~0.js +1 -0
  16. package/dist/8652~0.js +5 -5
  17. package/dist/9652~0.js +1 -0
  18. package/dist/@inquirer/select.js +1 -1
  19. package/dist/app.js +1 -1
  20. package/dist/build.js +4 -4
  21. package/dist/business-template-personal-information.js +1 -1
  22. package/dist/check.js +2 -2
  23. package/dist/components-loader.js +1 -1
  24. package/dist/demo-server.js +1 -1
  25. package/dist/demo.js +1 -1
  26. package/dist/dev-service-client.js +1 -1
  27. package/dist/dev-shell.js +1 -1
  28. package/dist/dev.js +7 -12
  29. package/dist/dev2.js +4 -33
  30. package/dist/dist.js +1 -1
  31. package/dist/dist~1.js +1 -1
  32. package/dist/info.js +2 -2
  33. package/dist/init.js +4 -4
  34. package/dist/inquirer.js +1 -1
  35. package/dist/login.js +2 -2
  36. package/dist/main.js +1 -1
  37. package/dist/manifest-headers.js +1 -1
  38. package/dist/mcp-bridge.js +1 -1
  39. package/dist/ora.js +3 -3
  40. package/dist/sandbox.js +1 -1
  41. package/dist/sdk.js +37 -37
  42. package/dist/skills.js +1 -1
  43. package/dist/skills~1.js +1 -1
  44. package/dist/status.js +1 -1
  45. package/dist/stop.js +1 -1
  46. package/dist/sync.js +1 -1
  47. package/dist/yaml.js +1 -1
  48. package/package.json +5 -5
  49. package/dist/4970~0.js +0 -5
  50. package/dist/5792~0.js +0 -30
  51. package/dist/6179~0.js +0 -25
  52. package/dist/6611~0.js +0 -34
  53. package/dist/6686~0.js +0 -1
  54. package/dist/8348~0.js +0 -1
  55. package/dist/9966~0.js +0 -15
  56. package/dist/9966~0.js.LICENSE.txt +0 -39
package/dist/8652~0.js CHANGED
@@ -1,14 +1,14 @@
1
1
  /*! LICENSE: 8652~0.js.LICENSE.txt */
2
- let e,t,r,o,a,s,i,n;import"node:module";import{__webpack_require__ as l}from"./rslib-runtime~0.js";import"./6686~0.js";import{CreateMessageRequestParamsSchema as c,InitializeRequestSchema as u,ListResourcesResultSchema as d,LoggingMessageNotificationParamsSchema as h,PromptArgumentSchema as p,SingleSelectEnumSchemaSchema as m,PROTOCOL_VERSION_META_KEY as f,ClientResultSchema as y,ProgressNotificationSchema as v,TitledMultiSelectEnumSchemaSchema as g,OpenIdProviderDiscoveryMetadataSchema as _,SubscriptionsListenResultSchema as S,DiscoverResultSchema as b,TaskStatusNotificationSchema as $,CancelTaskRequestSchema as w,CLIENT_INFO_META_KEY as R,JSONObjectSchema as P,ProgressSchema as E,ResourceTemplateSchema as C,CompleteResultSchema as T,CompleteRequestSchema as k,DiscoverRequestSchema as I,GetTaskPayloadResultSchema as x,ClientCapabilitiesSchema as j,OAuthClientMetadataSchema as O,OAuthErrorResponseSchema as N,EmptyResultSchema as q,ModelPreferencesSchema as M,JSONRPCNotificationSchema as A,PromptMessageSchema as L,JSONRPCErrorResponseSchema as U,TaskStatusNotificationParamsSchema as V,SetLevelRequestParamsSchema as z,ListChangedOptionsBaseSchema as D,TextResourceContentsSchema as H,ToolResultContentSchema as F,TaskMetadataSchema as G,ReadResourceRequestParamsSchema as K,ElicitResultSchema as W,CreateMessageResultSchema as J,ResourceLinkSchema as B,CreateMessageResultWithToolsSchema as Z,CursorSchema as X,TaskSchema as Q,ToolExecutionSchema as Y,IconSchema as ee,PromptReferenceSchema as et,ResourceUpdatedNotificationParamsSchema as er,looseObject as eo,schemas_enum as ea,SUBSCRIPTION_ID_META_KEY as es,OAuthClientInformationFullSchema as ei,ListTasksRequestSchema as en,unknown as el,ResourceTemplateReferenceSchema as ec,ResourceSchema as eu,OAuthTokenRevocationRequestSchema as ed,CreateTaskResultSchema as eh,PaginatedRequestSchema as ep,union as em,BaseRequestParamsSchema as ef,LegacyTitledEnumSchemaSchema as ey,TitledSingleSelectEnumSchemaSchema as ev,ProgressNotificationParamsSchema as eg,GetTaskRequestSchema as e_,optional as eS,lazy as eb,JSONRPCMessageSchema as e$,OpenIdProviderMetadataSchema as ew,ResourceContentsSchema as eR,SetLevelRequestSchema as eP,PromptListChangedNotificationSchema as eE,BooleanSchemaSchema as eC,CLIENT_CAPABILITIES_META_KEY as eT,ElicitRequestFormParamsSchema as ek,CallToolResultSchema as eI,JSONArraySchema as ex,ServerResultSchema as ej,iso_date as eO,JSONRPCRequestSchema as eN,CancelledNotificationSchema as eq,ServerRequestSchema as eM,EmbeddedResourceSchema as eA,JSONRPCResultResponseSchema as eL,CreateMessageRequestSchema as eU,ResultSchema as eV,BlobResourceContentsSchema as ez,RootsListChangedNotificationSchema as eD,SamplingMessageSchema as eH,ServerNotificationSchema as eF,SubscribeRequestParamsSchema as eG,StringSchemaSchema as eK,schemas_number as eW,JSONRPCResponseSchema as eJ,RequestSchema as eB,InitializeResultSchema as eZ,SubscriptionFilterSchema as eX,NotificationSchema as eQ,InitializedNotificationSchema as eY,MultiSelectEnumSchemaSchema as e0,ServerTasksCapabilitySchema as e1,ClientRequestSchema as e2,RoleSchema as e9,ToolChoiceSchema as e4,ToolSchema as e5,PaginatedResultSchema as e3,UntitledSingleSelectEnumSchemaSchema as e6,OAuthClientRegistrationErrorSchema as e7,SamplingContentSchema as e8,schemas_boolean as te,ImageContentSchema as tt,OAuthClientInformationSchema as tr,NumberSchemaSchema as to,ElicitRequestURLParamsSchema as ta,ReadResourceResultSchema as ts,ElicitRequestParamsSchema as ti,record as tn,ElicitRequestSchema as tl,CancelTaskResultSchema as tc,IconsSchema as tu,InitializeRequestParamsSchema as td,discriminatedUnion as th,AudioContentSchema as tp,EnumSchemaSchema as tm,ListPromptsResultSchema as tf,ToolListChangedNotificationSchema as ty,ListRootsResultSchema as tv,NotificationsParamsSchema as tg,SamplingMessageContentBlockSchema as t_,ListResourcesRequestSchema as tS,GetPromptResultSchema as tb,PrimitiveSchemaDefinitionSchema as t$,PromptSchema as tw,RelatedTaskMetadataSchema as tR,LoggingLevelSchema as tP,ClientNotificationSchema as tE,schemas_url as tC,PaginatedRequestParamsSchema as tT,CompatibilityCallToolResultSchema as tk,ImplementationSchema as tI,ModelHintSchema as tx,ProgressTokenSchema as tj,ClientTasksCapabilitySchema as tO,SubscriptionsAcknowledgedNotificationSchema as tN,TaskAugmentedRequestParamsSchema as tq,UnsubscribeRequestParamsSchema as tM,GetTaskPayloadRequestSchema as tA,SERVER_INFO_META_KEY as tL,BaseMetadataSchema as tU,ListResourceTemplatesResultSchema as tV,SubscriptionsAcknowledgedNotificationParamsSchema as tz,ElicitationCompleteNotificationParamsSchema as tD,schemas_null as tH,GetPromptRequestParamsSchema as tF,ListResourceTemplatesRequestSchema as tG,JSONValueSchema as tK,SubscribeRequestSchema as tW,SubscriptionsListenResultMetaSchema as tJ,TaskStatusSchema as tB,ToolAnnotationsSchema as tZ,SubscriptionsListenRequestParamsSchema as tX,LOG_LEVEL_META_KEY as tQ,ResourceUpdatedNotificationSchema as tY,SUPPORTED_PROTOCOL_VERSIONS as t0,UnsubscribeRequestSchema as t1,ResultMetaObjectSchema as t2,LoggingMessageNotificationSchema as t9,schemas_object as t4,CallToolRequestParamsSchema as t5,schemas_email as t3,ListToolsResultSchema as t6,TaskCreationParamsSchema as t7,intersection as t8,TextContentSchema as re,IdJagTokenExchangeResponseSchema as rt,CallToolRequestSchema as rr,preprocess as ro,OAuthMetadataSchema as ra,ToolUseContentSchema as rs,LATEST_PROTOCOL_VERSION as ri,ResourceListChangedNotificationSchema as rn,ListRootsRequestSchema as rl,RequestMetaSchema as rc,ListTasksResultSchema as ru,toJSONSchema as rd,ReadResourceRequestSchema as rh,GetPromptRequestSchema as rp,RootSchema as rm,SubscriptionsListenRequestSchema as rf,parse_safeParse as ry,schemas_string as rv,iso_datetime as rg,OAuthProtectedResourceMetadataSchema as r_,ListToolsRequestSchema as rS,ContentBlockSchema as rb,ElicitationCompleteNotificationSchema as r$,AnnotationsSchema as rw,literal as rR,schemas_array as rP,OAuthTokensSchema as rE,GetTaskResultSchema as rC,CancelledNotificationParamsSchema as rT,CompleteRequestParamsSchema as rk,PingRequestSchema as rI,RequestIdSchema as rx,ResourceRequestParamsSchema as rj,ServerCapabilitiesSchema as rO,UntitledMultiSelectEnumSchemaSchema as rN,ListPromptsRequestSchema as rq}from"./7754~0.js";import{stringField as rM,tryParseJson as rA,isRecord as rL}from"./6179~0.js";var rU,rV=Object.create,rz=Object.defineProperty,rD=Object.getOwnPropertyDescriptor,rH=Object.getOwnPropertyNames,rF=Object.getPrototypeOf,rG=Object.prototype.hasOwnProperty,rK=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),rW=(e,t,r)=>(r=null!=e?rV(rF(e)):{},((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var o,a=rH(t),s=0,i=a.length;s<i;s++)o=a[s],rG.call(e,o)||void 0===o||rz(e,o,{get:(e=>t[e]).bind(null,o),enumerable:!(r=rD(t,o))||r.enumerable});return e})(!t&&e&&e.__esModule?r:rz(r,"default",{value:e,enumerable:!0}),e));let rJ=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),rB=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),rZ=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),rX=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),rQ=Symbol.for("mcp.sdk.errorBrands");function rY(e,t){let r=new Set,o=t;for(;"function"==typeof o;){let e=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&"string"==typeof e&&r.add(e),o=Object.getPrototypeOf(o)}0!==r.size&&Object.defineProperty(e,rQ,{value:r,enumerable:!1,configurable:!0})}function r0(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,rQ)){let r=t[rQ];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let r1=((iw={}).InvalidRequest="invalid_request",iw.InvalidClient="invalid_client",iw.InvalidGrant="invalid_grant",iw.UnauthorizedClient="unauthorized_client",iw.UnsupportedGrantType="unsupported_grant_type",iw.InvalidScope="invalid_scope",iw.AccessDenied="access_denied",iw.ServerError="server_error",iw.TemporarilyUnavailable="temporarily_unavailable",iw.UnsupportedResponseType="unsupported_response_type",iw.UnsupportedTokenType="unsupported_token_type",iw.InvalidToken="invalid_token",iw.MethodNotAllowed="method_not_allowed",iw.TooManyRequests="too_many_requests",iw.InvalidClientMetadata="invalid_client_metadata",iw.InvalidRedirectUri="invalid_redirect_uri",iw.InsufficientScope="insufficient_scope",iw.InvalidTarget="invalid_target",iw);var r2=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",rY(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}};let r9=((iR={}).NotConnected="NOT_CONNECTED",iR.AlreadyConnected="ALREADY_CONNECTED",iR.NotInitialized="NOT_INITIALIZED",iR.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",iR.RequestTimeout="REQUEST_TIMEOUT",iR.ConnectionClosed="CONNECTION_CLOSED",iR.SendFailed="SEND_FAILED",iR.InvalidResult="INVALID_RESULT",iR.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",iR.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",iR.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",iR.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",iR.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",iR.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",iR.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",iR.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",iR.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",iR.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",iR.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",iR);var r4=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",rY(this,new.target)}},r5=class extends r4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};let r3="2026-07-28",r6=[r3];function r7(e){return e.filter(e=>!(e>=r3))}function r8(e){return e.filter(e=>e>=r3)}function oe(e){let t=e.structuredContent;return void 0===t||!("object"!=typeof t||null===t||Array.isArray(t))||e.content?.some(e=>"text"===e.type)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}let ot=["task","inputRequests","requestState"];function or(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||ot.some(t=>t in e)?e:{...e,content:[]}}function oo(){let t,r,o,a,s,i,n,l,c,u,d,h,p,m,f,y,v,g,_,S,b,$,w,R,P,E,C,T,k,I,x,j,O,N,q,M,A,L,U,V,z,D,H,F,G,K,W,J,B,Z,X,Q,Y,ee,et,er,es,ei,en,ec,eu,ed,eh,ep,ef,ey,ev,eg,e_,e$,ew,eR,eP,eE,eC,eT,ek,eI,ex,ej,eO,eN,eq,eM,eA,eL,eU,eV,ez,eD,eH,eF,eG,eK,eJ,eB,eZ,eX,eQ,eY,e0,e1,e2,e9,e4,e5,e3,e6,e7,e8,tt,tr,to,ta,ts,ti,tl,tc,tu,td,tp,tm,tf,ty,tv,tg,t_,tS,tb,t$,tw,tR,tP,tE,tC,tT,tk,tI,tx,tj;return e??=(t=eb(()=>em([rv(),eW(),te(),tH(),tn(rv(),t),rP(t)])),r=tn(rv(),t),o=em([rv(),eW().int()]),a=rv(),s=t4({ttl:eW().optional()}),i=t4({taskId:rv()}),c=(l=t4({_meta:(n=eo({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()})).optional()})).extend({task:s.optional()}),u=t4({method:rv(),params:l.loose().optional()}),d=t4({_meta:n.optional()}),h=t4({method:rv(),params:d.loose().optional()}),p=eo({_meta:n.optional()}),m=em([rv(),eW().int()]),f=p.strict(),y=d.extend({requestId:m.optional(),reason:rv().optional()}),v=h.extend({method:rR("notifications/cancelled"),params:y}),g=t4({src:rv(),mimeType:rv().optional(),sizes:rP(rv()).optional(),theme:ea(["light","dark"]).optional()}),_=t4({icons:rP(g).optional()}),b=(S=t4({name:rv(),title:rv().optional()})).extend({...S.shape,..._.shape,version:rv(),websiteUrl:rv().optional(),description:rv().optional()}),$=t8(t4({applyDefaults:te().optional()}),r),w=ro(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,t8(t4({form:$.optional(),url:r.optional()}),r.optional())),R=eo({list:r.optional(),cancel:r.optional(),requests:eo({sampling:eo({createMessage:r.optional()}).optional(),elicitation:eo({create:r.optional()}).optional()}).optional()}),P=eo({list:r.optional(),cancel:r.optional(),requests:eo({tools:eo({call:r.optional()}).optional()}).optional()}),E=t4({experimental:tn(rv(),r).optional(),sampling:t4({context:r.optional(),tools:r.optional()}).optional(),elicitation:w.optional(),roots:t4({listChanged:te().optional()}).optional(),tasks:R.optional(),extensions:tn(rv(),r).optional()}),C=l.extend({protocolVersion:rv(),capabilities:E,clientInfo:b}),T=u.extend({method:rR("initialize"),params:C}),k=t4({experimental:tn(rv(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:t4({listChanged:te().optional()}).optional(),resources:t4({subscribe:te().optional(),listChanged:te().optional()}).optional(),tools:t4({listChanged:te().optional()}).optional(),tasks:P.optional(),extensions:tn(rv(),r).optional()}),I=p.extend({protocolVersion:rv(),capabilities:k,serverInfo:b,instructions:rv().optional()}),x=h.extend({method:rR("notifications/initialized"),params:d.optional()}),j=u.extend({method:rR("ping"),params:l.optional()}),O=t4({progress:eW(),total:eS(eW()),message:eS(rv())}),N=t4({...d.shape,...O.shape,progressToken:o}),q=h.extend({method:rR("notifications/progress"),params:N}),M=l.extend({cursor:a.optional()}),A=u.extend({params:M.optional()}),L=p.extend({nextCursor:a.optional()}),V=(U=t4({uri:rv(),mimeType:eS(rv()),_meta:tn(rv(),el()).optional()})).extend({text:rv()}),z=rv().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),D=U.extend({blob:z}),F=t4({audience:rP(H=ea(["user","assistant"])).optional(),priority:eW().min(0).max(1).optional(),lastModified:rg({offset:!0}).optional()}),G=t4({...S.shape,..._.shape,uri:rv(),description:eS(rv()),mimeType:eS(rv()),size:eS(eW()),annotations:F.optional(),_meta:eS(eo({}))}),K=t4({...S.shape,..._.shape,uriTemplate:rv(),description:eS(rv()),mimeType:eS(rv()),annotations:F.optional(),_meta:eS(eo({}))}),W=A.extend({method:rR("resources/list")}),J=L.extend({resources:rP(G)}),B=A.extend({method:rR("resources/templates/list")}),Z=L.extend({resourceTemplates:rP(K)}),X=l.extend({uri:rv()}),Q=u.extend({method:rR("resources/read"),params:X}),Y=p.extend({contents:rP(em([V,D]))}),ee=h.extend({method:rR("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:rR("resources/subscribe"),params:X}),er=u.extend({method:rR("resources/unsubscribe"),params:X}),es=d.extend({uri:rv()}),ei=h.extend({method:rR("notifications/resources/updated"),params:es}),en=t4({name:rv(),description:eS(rv()),required:eS(te())}),ec=t4({...S.shape,..._.shape,description:eS(rv()),arguments:eS(rP(en)),_meta:eS(eo({}))}),eu=A.extend({method:rR("prompts/list")}),ed=L.extend({prompts:rP(ec)}),eh=l.extend({name:rv(),arguments:tn(rv(),rv()).optional()}),ep=u.extend({method:rR("prompts/get"),params:eh}),ef=t4({type:rR("text"),text:rv(),annotations:F.optional(),_meta:tn(rv(),el()).optional()}),ey=t4({type:rR("image"),data:z,mimeType:rv(),annotations:F.optional(),_meta:tn(rv(),el()).optional()}),ev=t4({type:rR("audio"),data:z,mimeType:rv(),annotations:F.optional(),_meta:tn(rv(),el()).optional()}),eg=t4({type:rR("tool_use"),name:rv(),id:rv(),input:tn(rv(),el()),_meta:tn(rv(),el()).optional()}),e_=t4({type:rR("resource"),resource:em([V,D]),annotations:F.optional(),_meta:tn(rv(),el()).optional()}),eR=t4({role:H,content:ew=em([ef,ey,ev,e$=G.extend({type:rR("resource_link")}),e_])}),eP=p.extend({description:rv().optional(),messages:rP(eR)}),eE=h.extend({method:rR("notifications/prompts/list_changed"),params:d.optional()}),eC=t4({title:rv().optional(),readOnlyHint:te().optional(),destructiveHint:te().optional(),idempotentHint:te().optional(),openWorldHint:te().optional()}),eT=t4({taskSupport:ea(["required","optional","forbidden"]).optional()}),ek=t4({...S.shape,..._.shape,description:rv().optional(),inputSchema:t4({type:rR("object"),properties:tn(rv(),t).optional(),required:rP(rv()).optional()}).catchall(el()),outputSchema:t4({type:rR("object"),properties:tn(rv(),t).optional(),required:rP(rv()).optional()}).catchall(el()).optional(),annotations:eC.optional(),execution:eT.optional(),_meta:tn(rv(),el()).optional()}),eI=A.extend({method:rR("tools/list")}),ex=L.extend({tools:rP(ek)}),ej=p.extend({content:rP(ew),structuredContent:tn(rv(),el()).optional(),isError:te().optional()}),eO=c.extend({name:rv(),arguments:tn(rv(),el()).optional()}),eN=u.extend({method:rR("tools/call"),params:eO}),eq=h.extend({method:rR("notifications/tools/list_changed"),params:d.optional()}),eM=ea(["debug","info","notice","warning","error","critical","alert","emergency"]),eA=l.extend({level:eM}),eL=u.extend({method:rR("logging/setLevel"),params:eA}),eU=d.extend({level:eM,logger:rv().optional(),data:el()}),eV=h.extend({method:rR("notifications/message"),params:eU}),ez=t4({name:rv().optional()}),eD=t4({hints:rP(ez).optional(),costPriority:eW().min(0).max(1).optional(),speedPriority:eW().min(0).max(1).optional(),intelligencePriority:eW().min(0).max(1).optional()}),eH=t4({mode:ea(["auto","required","none"]).optional()}),eF=t4({type:rR("tool_result"),toolUseId:rv().describe("The unique identifier for the corresponding tool call."),content:rP(ew),structuredContent:t4({}).loose().optional(),isError:te().optional(),_meta:tn(rv(),el()).optional()}),eG=th("type",[ef,ey,ev]),eJ=t4({role:H,content:em([eK=th("type",[ef,ey,ev,eg,eF]),rP(eK)]),_meta:tn(rv(),el()).optional()}),eB=c.extend({messages:rP(eJ),modelPreferences:eD.optional(),systemPrompt:rv().optional(),includeContext:ea(["none","thisServer","allServers"]).optional(),temperature:eW().optional(),maxTokens:eW().int(),stopSequences:rP(rv()).optional(),metadata:r.optional(),tools:rP(ek).optional(),toolChoice:eH.optional()}),eZ=u.extend({method:rR("sampling/createMessage"),params:eB}),eX=p.extend({model:rv(),stopReason:eS(ea(["endTurn","stopSequence","maxTokens"]).or(rv())),role:H,content:eG}),eQ=p.extend({model:rv(),stopReason:eS(ea(["endTurn","stopSequence","maxTokens","toolUse"]).or(rv())),role:H,content:em([eK,rP(eK)])}),eY=t4({type:rR("boolean"),title:rv().optional(),description:rv().optional(),default:te().optional()}),e0=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),minLength:eW().optional(),maxLength:eW().optional(),format:ea(["email","uri","date","date-time"]).optional(),default:rv().optional()}),e1=t4({type:ea(["number","integer"]),title:rv().optional(),description:rv().optional(),minimum:eW().optional(),maximum:eW().optional(),default:eW().optional()}),e2=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),enum:rP(rv()),default:rv().optional()}),e9=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),oneOf:rP(t4({const:rv(),title:rv()})),default:rv().optional()}),e4=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),enum:rP(rv()),enumNames:rP(rv()).optional(),default:rv().optional()}),e5=em([e2,e9]),e3=t4({type:rR("array"),title:rv().optional(),description:rv().optional(),minItems:eW().optional(),maxItems:eW().optional(),items:t4({type:rR("string"),enum:rP(rv())}),default:rP(rv()).optional()}),e7=em([e3,e6=t4({type:rR("array"),title:rv().optional(),description:rv().optional(),minItems:eW().optional(),maxItems:eW().optional(),items:t4({anyOf:rP(t4({const:rv(),title:rv()}))}),default:rP(rv()).optional()})]),e8=em([e4,e5,e7]),tt=em([e8,eY,e0,e1]),tr=c.extend({mode:rR("form").optional(),message:rv(),requestedSchema:t4({type:rR("object"),properties:tn(rv(),tt),required:rP(rv()).optional()}).catchall(el())}),ta=em([tr,to=c.extend({mode:rR("url"),message:rv(),elicitationId:rv(),url:rv().url()})]),ts=u.extend({method:rR("elicitation/create"),params:ta}),ti=d.extend({elicitationId:rv()}),tl=h.extend({method:rR("notifications/elicitation/complete"),params:ti}),tc=p.extend({action:ea(["accept","decline","cancel"]),content:ro(e=>null===e?void 0:e,tn(rv(),em([rv(),eW(),te(),rP(rv())])).optional())}),tu=t4({type:rR("ref/resource"),uri:rv()}),td=t4({type:rR("ref/prompt"),name:rv()}),tp=l.extend({ref:em([td,tu]),argument:t4({name:rv(),value:rv()}),context:t4({arguments:tn(rv(),rv()).optional()}).optional()}),tm=u.extend({method:rR("completion/complete"),params:tp}),tf=p.extend({completion:eo({values:rP(rv()).max(100),total:eS(eW().int()),hasMore:eS(te())})}),ty=t4({uri:rv().startsWith("file://"),name:rv().optional(),_meta:tn(rv(),el()).optional()}),tv=u.extend({method:rR("roots/list"),params:l.optional()}),tg=p.extend({roots:rP(ty)}),t_=h.extend({method:rR("notifications/roots/list_changed"),params:d.optional()}),tS=eo({ttl:eW().optional(),pollInterval:eW().optional()}),tb=ea(["working","input_required","completed","failed","cancelled"]),t$=t4({taskId:rv(),status:tb,ttl:em([eW(),tH()]),createdAt:rv(),lastUpdatedAt:rv(),pollInterval:eS(eW()),statusMessage:eS(rv())}),tw=p.extend({task:t$}),tR=d.merge(t$),tP=h.extend({method:rR("notifications/tasks/status"),params:tR}),tE=u.extend({method:rR("tasks/get"),params:l.extend({taskId:rv()})}),tC=p.merge(t$),tT=u.extend({method:rR("tasks/result"),params:l.extend({taskId:rv()})}),tk=p.loose(),tI=A.extend({method:rR("tasks/list")}),tx=L.extend({tasks:rP(t$)}),tj=u.extend({method:rR("tasks/cancel"),params:l.extend({taskId:rv()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:a,TaskMetadataSchema:s,RelatedTaskMetadataSchema:i,RequestMetaSchema:n,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:h,ResultSchema:p,RequestIdSchema:m,EmptyResultSchema:f,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:v,IconSchema:g,IconsSchema:_,BaseMetadataSchema:S,ImplementationSchema:b,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:P,ClientCapabilitiesSchema:E,InitializeRequestParamsSchema:C,InitializeRequestSchema:T,ServerCapabilitiesSchema:k,InitializeResultSchema:I,InitializedNotificationSchema:x,PingRequestSchema:j,ProgressSchema:O,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:q,PaginatedRequestParamsSchema:M,PaginatedRequestSchema:A,PaginatedResultSchema:L,ResourceContentsSchema:U,TextResourceContentsSchema:V,BlobResourceContentsSchema:D,RoleSchema:H,AnnotationsSchema:F,ResourceSchema:G,ResourceTemplateSchema:K,ListResourcesRequestSchema:W,ListResourcesResultSchema:J,ListResourceTemplatesRequestSchema:B,ListResourceTemplatesResultSchema:Z,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Q,ReadResourceResultSchema:Y,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:es,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:en,PromptSchema:ec,ListPromptsRequestSchema:eu,ListPromptsResultSchema:ed,GetPromptRequestParamsSchema:eh,GetPromptRequestSchema:ep,TextContentSchema:ef,ImageContentSchema:ey,AudioContentSchema:ev,ToolUseContentSchema:eg,EmbeddedResourceSchema:e_,ResourceLinkSchema:e$,ContentBlockSchema:ew,PromptMessageSchema:eR,GetPromptResultSchema:eP,PromptListChangedNotificationSchema:eE,ToolAnnotationsSchema:eC,ToolExecutionSchema:eT,ToolSchema:ek,ListToolsRequestSchema:eI,ListToolsResultSchema:ex,CallToolResultSchema:ej,CallToolRequestParamsSchema:eO,CallToolRequestSchema:eN,ToolListChangedNotificationSchema:eq,LoggingLevelSchema:eM,SetLevelRequestParamsSchema:eA,SetLevelRequestSchema:eL,LoggingMessageNotificationParamsSchema:eU,LoggingMessageNotificationSchema:eV,ModelHintSchema:ez,ModelPreferencesSchema:eD,ToolChoiceSchema:eH,ToolResultContentSchema:eF,SamplingContentSchema:eG,SamplingMessageContentBlockSchema:eK,SamplingMessageSchema:eJ,CreateMessageRequestParamsSchema:eB,CreateMessageRequestSchema:eZ,CreateMessageResultSchema:eX,CreateMessageResultWithToolsSchema:eQ,BooleanSchemaSchema:eY,StringSchemaSchema:e0,NumberSchemaSchema:e1,UntitledSingleSelectEnumSchemaSchema:e2,TitledSingleSelectEnumSchemaSchema:e9,LegacyTitledEnumSchemaSchema:e4,SingleSelectEnumSchemaSchema:e5,UntitledMultiSelectEnumSchemaSchema:e3,TitledMultiSelectEnumSchemaSchema:e6,MultiSelectEnumSchemaSchema:e7,EnumSchemaSchema:e8,PrimitiveSchemaDefinitionSchema:tt,ElicitRequestFormParamsSchema:tr,ElicitRequestURLParamsSchema:to,ElicitRequestParamsSchema:ta,ElicitRequestSchema:ts,ElicitationCompleteNotificationParamsSchema:ti,ElicitationCompleteNotificationSchema:tl,ElicitResultSchema:tc,ResourceTemplateReferenceSchema:tu,PromptReferenceSchema:td,CompleteRequestParamsSchema:tp,CompleteRequestSchema:tm,CompleteResultSchema:tf,RootSchema:ty,ListRootsRequestSchema:tv,ListRootsResultSchema:tg,RootsListChangedNotificationSchema:t_,TaskCreationParamsSchema:tS,TaskStatusSchema:tb,TaskSchema:t$,CreateTaskResultSchema:tw,TaskStatusNotificationParamsSchema:tR,TaskStatusNotificationSchema:tP,GetTaskRequestSchema:tE,GetTaskResultSchema:tC,GetTaskPayloadRequestSchema:tT,GetTaskPayloadResultSchema:tk,ListTasksRequestSchema:tI,ListTasksResultSchema:tx,CancelTaskRequestSchema:tj,CancelTaskResultSchema:p.merge(t$),ClientRequestSchema:em([j,T,tm,eL,ep,eu,W,B,Q,et,er,eN,eI,tE,tT,tI,tj]),ClientNotificationSchema:em([v,q,x,t_,tP]),ClientResultSchema:em([f,eX,eQ,tc,tg,tC,tx,tw]),ServerRequestSchema:em([j,eZ,ts,tv,tE,tT,tI,tj]),ServerNotificationSchema:em([v,q,eV,ei,ee,eq,eE,tP,tl]),ServerResultSchema:em([f,I,tf,eP,ed,J,Z,Y,ej,ex,tC,tx,tw]),CallToolResultWireSchema:el().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of ot)if(r in e)return void t.addIssue({code:"custom",message:`content is required when the body carries '${r}' — another result family cannot default into an empty tools/call success`})}}).transform(or).pipe(ej)})}function oa(e){return"object"!==e.type}let os=new Set(["const","enum","default","examples"]),oi=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function on(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let ol={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},oc={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},ou={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};function od(){if(t)return t;let e=oo();return t={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}}}function oh(e){return Object.prototype.hasOwnProperty.call(ol,e)}function op(e){return Object.prototype.hasOwnProperty.call(oc,e)}function om(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function of(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(ol),Object.keys(oc);let oy={ok:!1,reason:"not-in-era"};function ov(e){return om(e)&&om(e.outputSchema)&&oa(e.outputSchema)}let og={era:"2025-11-25",hasRequestMethod:oh,hasNotificationMethod:op,validateRequest:(e,t)=>of(oh(e)?od().requestSchemas[e]:void 0,t),validateResult:(e,t)=>of(Object.prototype.hasOwnProperty.call(ou,e)?od().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>of(op(e)?od().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>oy,validateInputResponse:()=>oy,samplingResultVariant:(e,t)=>{let r=oo();return of(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=oe(e),o=r.structuredContent;if(void 0===o)return r;let a="object"!=typeof o||null===o||Array.isArray(o),s=void 0!==t&&oa(t);return a||s?{...r,structuredContent:{result:o}}:r},decodeResult(e,t){if(om(t)&&"resultType"in t){let e={...t};return delete e.resultType,{kind:"complete",result:e}}return{kind:"complete",result:t}},encodeResult(e,t){if("tools/list"!==e)return t;let r=t.tools;return Array.isArray(r)&&r.some(e=>ov(e))?{...t,tools:r.map(e=>ov(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(on(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let o="string"==typeof(t=e.$schema)&&rB.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,a=(e,t)=>{if(Array.isArray(e))return e.map(e=>a(e,!1));if(null===e||"object"!=typeof e||!t&&on(e.$id))return e;let r={},s=!1;for(let[i,n]of Object.entries(e))t?r[i]=a(n,!1):("$ref"===i||"$dynamicRef"===i)&&"string"==typeof n?r[i]="#"===n?"#/properties/result":n.startsWith("#/")?`#/properties/result${n.slice(1)}`:n:"$recursiveRef"===i&&"#"===n&&o?s=!0:os.has(i)?r[i]=n:oi.has(i)?r[i]=a(n,!0):r[i]=a(n,!1);return s&&("$ref"in r?r.allOf=[...Array.isArray(r.allOf)?r.allOf:[],{$ref:"#/properties/result"}]:r.$ref="#/properties/result"),r};return{...void 0!==r&&{$schema:r},type:"object",properties:{result:a(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function o_(){return r??=function(){let e=eb(()=>em([rv(),eW(),te(),tH(),tn(rv(),e),rP(e)])),t=tn(rv(),e),r=em([rv(),eW().int()]),o=rv(),a=em([rv(),eW().int()]),s=ea(["user","assistant"]),i=ea(["debug","info","notice","warning","error","critical","alert","emergency"]),n=rv().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=t4({ttl:eW().optional()}),c=t4({taskId:rv()}),u=eo({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=t4({_meta:u.optional()}),h=d.extend({task:l.optional()}),p=t4({_meta:u.optional()}),m=t4({method:rv(),params:p.loose().optional()}),y=t4({src:rv(),mimeType:rv().optional(),sizes:rP(rv()).optional(),theme:ea(["light","dark"]).optional()}),v=t4({icons:rP(y).optional()}),g=t4({name:rv(),title:rv().optional()}),_=g.extend({...g.shape,...v.shape,version:rv(),websiteUrl:rv().optional(),description:rv().optional()}),S=t8(t4({applyDefaults:te().optional()}),t),b=ro(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,t8(t4({form:S.optional(),url:t.optional()}),t.optional())),$=eo({list:t.optional(),cancel:t.optional(),requests:eo({sampling:eo({createMessage:t.optional()}).optional(),elicitation:eo({create:t.optional()}).optional()}).optional()}),w=eo({list:t.optional(),cancel:t.optional(),requests:eo({tools:eo({call:t.optional()}).optional()}).optional()}),P=t4({experimental:tn(rv(),t).optional(),sampling:t4({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:t4({listChanged:te().optional()}).optional(),tasks:$.optional(),extensions:tn(rv(),t).optional()}),E=t4({experimental:tn(rv(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:t4({listChanged:te().optional()}).optional(),resources:t4({subscribe:te().optional(),listChanged:te().optional()}).optional(),tools:t4({listChanged:te().optional()}).optional(),tasks:w.optional(),extensions:tn(rv(),t).optional()}),C=t4({progress:eW(),total:eS(eW()),message:eS(rv())}),T=t4({...p.shape,...C.shape,progressToken:r}),k=m.extend({method:rR("notifications/progress"),params:T}),I=p.extend({level:i,logger:rv().optional(),data:el()}),x=m.extend({method:rR("notifications/message"),params:I}),j=t4({uri:rv(),mimeType:eS(rv()),_meta:tn(rv(),el()).optional()}),O=j.extend({text:rv()}),N=j.extend({blob:n}),q=t4({audience:rP(s).optional(),priority:eW().min(0).max(1).optional(),lastModified:rg({offset:!0}).optional()}),M=t4({...g.shape,...v.shape,uri:rv(),description:eS(rv()),mimeType:eS(rv()),size:eS(eW()),annotations:q.optional(),_meta:eS(eo({}))}),A=t4({...g.shape,...v.shape,uriTemplate:rv(),description:eS(rv()),mimeType:eS(rv()),annotations:q.optional(),_meta:eS(eo({}))}),L=m.extend({method:rR("notifications/resources/list_changed"),params:p.optional()}),U=p.extend({uri:rv()}),V=m.extend({method:rR("notifications/resources/updated"),params:U}),z=t4({name:rv(),description:eS(rv()),required:eS(te())}),D=t4({...g.shape,...v.shape,description:eS(rv()),arguments:eS(rP(z)),_meta:eS(eo({}))}),H=m.extend({method:rR("notifications/prompts/list_changed"),params:p.optional()}),F=t4({type:rR("text"),text:rv(),annotations:q.optional(),_meta:tn(rv(),el()).optional()}),G=t4({type:rR("image"),data:n,mimeType:rv(),annotations:q.optional(),_meta:tn(rv(),el()).optional()}),K=t4({type:rR("audio"),data:n,mimeType:rv(),annotations:q.optional(),_meta:tn(rv(),el()).optional()}),W=t4({type:rR("tool_use"),name:rv(),id:rv(),input:tn(rv(),el()),_meta:tn(rv(),el()).optional()}),J=t4({type:rR("resource"),resource:em([O,N]),annotations:q.optional(),_meta:tn(rv(),el()).optional()}),B=M.extend({type:rR("resource_link")}),Z=em([F,G,K,B,J]),X=t4({role:s,content:Z}),Q=t4({title:rv().optional(),readOnlyHint:te().optional(),destructiveHint:te().optional(),idempotentHint:te().optional(),openWorldHint:te().optional()}),Y=m.extend({method:rR("notifications/tools/list_changed"),params:p.optional()}),ee=t4({name:rv().optional()}),et=t4({hints:rP(ee).optional(),costPriority:eW().min(0).max(1).optional(),speedPriority:eW().min(0).max(1).optional(),intelligencePriority:eW().min(0).max(1).optional()}),er=t4({mode:ea(["auto","required","none"]).optional()}),es=t4({type:rR("boolean"),title:rv().optional(),description:rv().optional(),default:te().optional()}),ei=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),minLength:eW().optional(),maxLength:eW().optional(),format:ea(["email","uri","date","date-time"]).optional(),default:rv().optional()}),en=t4({type:ea(["number","integer"]),title:rv().optional(),description:rv().optional(),minimum:eW().optional(),maximum:eW().optional(),default:eW().optional()}),ec=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),enum:rP(rv()),default:rv().optional()}),eu=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),oneOf:rP(t4({const:rv(),title:rv()})),default:rv().optional()}),ed=t4({type:rR("string"),title:rv().optional(),description:rv().optional(),enum:rP(rv()),enumNames:rP(rv()).optional(),default:rv().optional()}),eh=em([ec,eu]),ep=t4({type:rR("array"),title:rv().optional(),description:rv().optional(),minItems:eW().optional(),maxItems:eW().optional(),items:t4({type:rR("string"),enum:rP(rv())}),default:rP(rv()).optional()}),ef=t4({type:rR("array"),title:rv().optional(),description:rv().optional(),minItems:eW().optional(),maxItems:eW().optional(),items:t4({anyOf:rP(t4({const:rv(),title:rv()}))}),default:rP(rv()).optional()}),ey=em([ep,ef]),ev=em([ed,eh,ey]),eg=em([ev,es,ei,en]),e_=h.extend({mode:rR("form").optional(),message:rv(),requestedSchema:t4({type:rR("object"),properties:tn(rv(),eg),required:rP(rv()).optional()}).catchall(el())}),e$=t4({type:rR("ref/resource"),uri:rv()}),ew=t4({type:rR("ref/prompt"),name:rv()}),eR=t4({uri:rv().startsWith("file://"),name:rv().optional(),_meta:tn(rv(),el()).optional()}),eP=P.shape,eE=t4({experimental:eP.experimental,sampling:eP.sampling,elicitation:eP.elicitation,roots:eP.roots,extensions:eP.extensions}),eC=E.shape,ek=t4({experimental:eC.experimental,logging:eC.logging,completions:eC.completions,prompts:eC.prompts,resources:eC.resources,tools:eC.tools,extensions:eC.extensions}),eI=eo({progressToken:r.optional(),[f]:rv(),[R]:_.optional(),[eT]:eE,[tQ]:i.optional()}),ex=t4({...g.shape,...v.shape,description:rv().optional(),inputSchema:eo({$schema:rv().optional(),type:rR("object")}),outputSchema:eo({$schema:rv().optional()}).optional(),annotations:Q.optional(),_meta:tn(rv(),el()).optional()}),ej=t4({type:rR("tool_result"),toolUseId:rv(),content:rP(Z),structuredContent:el().optional(),isError:te().optional(),_meta:tn(rv(),el()).optional()}),eO=em([F,G,K,W,ej]),eN=t4({role:s,content:em([eO,rP(eO)]),_meta:tn(rv(),el()).optional()}),eq=rv(),eM=eo({[tL]:_.optional().catch(void 0)}),eA=eM.optional();function eL(e){return eo({_meta:eA,resultType:eq.default("complete"),...e})}let eU=eL({}),eV=eL({nextCursor:o.optional()}),ez=eL({content:rP(Z),structuredContent:el().optional(),isError:te().optional()}),eD=eL({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),tools:rP(ex),nextCursor:o.optional()}),eH=eL({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),prompts:rP(D),nextCursor:o.optional()}),eF=eL({description:rv().optional(),messages:rP(X)}),eG=eL({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),resources:rP(M),nextCursor:o.optional()}),eK=eL({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),resourceTemplates:rP(A),nextCursor:o.optional()}),eJ=eL({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),contents:rP(em([O,N]))}),eB=eL({completion:t4({values:rP(rv()).max(100),total:eW().int().optional(),hasMore:te().optional()}).loose()}),eZ=eL({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"])}),eX=eL({ttlMs:eW().int().min(0).catch(0),cacheScope:ea(["public","private"]).catch("private"),supportedVersions:rP(rv()),capabilities:ek,instructions:rv().optional()}),eQ=t4({messages:rP(eN),modelPreferences:et.optional(),systemPrompt:rv().optional(),includeContext:ea(["none","thisServer","allServers"]).optional(),temperature:eW().optional(),maxTokens:eW().int(),stopSequences:rP(rv()).optional(),metadata:t.optional(),tools:rP(ex).optional(),toolChoice:er.optional()}),eY=t4({method:rR("sampling/createMessage"),params:eQ}),e0=t4({method:rR("roots/list"),params:t4({_meta:tn(rv(),el()).optional()}).optional()}),e1=t4({...eN.shape,model:rv(),stopReason:rv().optional()}),e2=t4({roots:rP(eR)}),e9=t4({action:ea(["accept","decline","cancel"]),content:tn(rv(),em([rv(),eW(),te(),rP(rv())])).optional()}),e4=t4({mode:rR("url"),message:rv(),url:rv().url()}),e5=em([e_,e4]),e3=t4({method:rR("elicitation/create"),params:e5}),e6=em([eY,e0,e3]),e7=em([e1,e2,e9]),e8=tn(rv(),e6),tt=tn(rv(),e7),tr=eL({inputRequests:e8.optional(),requestState:rv().optional()}),to={inputResponses:tt.optional(),requestState:rv().optional()},ta=t4({_meta:eI,...to}),ts=eo({progressToken:r.optional()});function ti(e,t){return t4({method:rR(e),params:t4({_meta:eI,...t})})}function tl(e,t){return t4({method:rR(e),params:t4({_meta:ts.optional(),...t}).optional()})}let tc={name:rv(),arguments:tn(rv(),el()).optional(),...to},tu={cursor:o.optional()},td=ti("tools/call",tc),th=ti("tools/list",tu),tp=ti("prompts/list",tu),tm=ti("prompts/get",{name:rv(),arguments:tn(rv(),rv()).optional(),...to}),tf=ti("resources/list",tu),ty=ti("resources/templates/list",tu),tv=ti("resources/read",{uri:rv(),...to}),tg={ref:em([ew,e$]),argument:t4({name:rv(),value:rv()}),context:t4({arguments:tn(rv(),rv()).optional()}).optional()},t_=ti("completion/complete",tg),tS=ti("server/discover",{}),tb=t4({toolsListChanged:te().optional(),promptsListChanged:te().optional(),resourcesListChanged:te().optional(),resourceSubscriptions:rP(rv()).optional()}),t$={notifications:tb},tw=ti("subscriptions/listen",t$),tR=eM.extend({"io.modelcontextprotocol/subscriptionId":a}),tP=eo({_meta:tR,resultType:eq.default("complete")}),tE={"tools/call":tl("tools/call",tc),"tools/list":tl("tools/list",tu),"prompts/get":tl("prompts/get",{name:rv(),arguments:tn(rv(),rv()).optional()}),"prompts/list":tl("prompts/list",tu),"resources/list":tl("resources/list",tu),"resources/templates/list":tl("resources/templates/list",tu),"resources/read":tl("resources/read",{uri:rv()}),"completion/complete":tl("completion/complete",tg),"server/discover":tl("server/discover",{}),"subscriptions/listen":tl("subscriptions/listen",t$)};function tC(e){return eo({_meta:eA,...e})}let tT={"tools/call":tC({content:rP(Z),structuredContent:el().optional(),isError:te().optional()}),"tools/list":tC({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),tools:rP(ex),nextCursor:o.optional()}),"prompts/get":tC({description:rv().optional(),messages:rP(X)}),"prompts/list":tC({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),prompts:rP(D),nextCursor:o.optional()}),"resources/list":tC({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),resources:rP(M),nextCursor:o.optional()}),"resources/templates/list":tC({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),resourceTemplates:rP(A),nextCursor:o.optional()}),"resources/read":tC({ttlMs:eW().int().min(0),cacheScope:ea(["public","private"]),contents:rP(em([O,N]))}),"completion/complete":tC({completion:t4({values:rP(rv()).max(100),total:eW().int().optional(),hasMore:te().optional()}).loose()}),"server/discover":tC({ttlMs:eW().int().min(0).catch(0),cacheScope:ea(["public","private"]).catch("private"),supportedVersions:rP(rv()),capabilities:ek,instructions:rv().optional()}),"subscriptions/listen":tC({})},tk=eo({"io.modelcontextprotocol/subscriptionId":a.optional()}),tI=t4({method:rR("notifications/subscriptions/acknowledged"),params:t4({_meta:tk.optional(),notifications:tb})}),tx=t4({_meta:tk.optional(),requestId:a,reason:rv().optional()}),tj=t4({method:rR("notifications/cancelled"),params:tx}),tO=e=>t4({jsonrpc:rR("2.0"),id:em([rv(),eW().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:a,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:y,IconsSchema:v,BaseMetadataSchema:g,ImplementationSchema:_,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:P,ServerCapabilitiesSchema:E,ProgressSchema:C,ProgressNotificationParamsSchema:T,ProgressNotificationSchema:k,LoggingMessageNotificationParamsSchema:I,LoggingMessageNotificationSchema:x,ResourceContentsSchema:j,TextResourceContentsSchema:O,BlobResourceContentsSchema:N,AnnotationsSchema:q,ResourceSchema:M,ResourceTemplateSchema:A,ResourceListChangedNotificationSchema:L,ResourceUpdatedNotificationParamsSchema:U,ResourceUpdatedNotificationSchema:V,PromptArgumentSchema:z,PromptSchema:D,PromptListChangedNotificationSchema:H,TextContentSchema:F,ImageContentSchema:G,AudioContentSchema:K,ToolUseContentSchema:W,EmbeddedResourceSchema:J,ResourceLinkSchema:B,ContentBlockSchema:Z,PromptMessageSchema:X,ToolAnnotationsSchema:Q,ToolListChangedNotificationSchema:Y,ModelHintSchema:ee,ModelPreferencesSchema:et,ToolChoiceSchema:er,BooleanSchemaSchema:es,StringSchemaSchema:ei,NumberSchemaSchema:en,UntitledSingleSelectEnumSchemaSchema:ec,TitledSingleSelectEnumSchemaSchema:eu,LegacyTitledEnumSchemaSchema:ed,SingleSelectEnumSchemaSchema:eh,UntitledMultiSelectEnumSchemaSchema:ep,TitledMultiSelectEnumSchemaSchema:ef,MultiSelectEnumSchemaSchema:ey,EnumSchemaSchema:ev,PrimitiveSchemaDefinitionSchema:eg,ElicitRequestFormParamsSchema:e_,ResourceTemplateReferenceSchema:e$,PromptReferenceSchema:ew,RootSchema:eR,ClientCapabilities2026Schema:eE,ServerCapabilities2026Schema:ek,RequestMetaEnvelopeSchema:eI,ToolSchema:ex,ToolResultContentSchema:ej,SamplingMessageContentBlockSchema:eO,SamplingMessageSchema:eN,ResultTypeSchema:eq,ResultMetaSchema:eM,ResultSchema:eU,PaginatedResultSchema:eV,CallToolResultSchema:ez,ListToolsResultSchema:eD,ListPromptsResultSchema:eH,GetPromptResultSchema:eF,ListResourcesResultSchema:eG,ListResourceTemplatesResultSchema:eK,ReadResourceResultSchema:eJ,CompleteResultSchema:eB,CacheableResultSchema:eZ,DiscoverResultSchema:eX,CreateMessageRequestParamsSchema:eQ,CreateMessageRequestSchema:eY,ListRootsRequestSchema:e0,CreateMessageResultSchema:e1,ListRootsResultSchema:e2,ElicitResultSchema:e9,ElicitRequestURLParamsSchema:e4,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e3,InputRequestSchema:e6,InputResponseSchema:e7,InputRequestsSchema:e8,InputResponsesSchema:tt,InputRequiredResultSchema:tr,InputResponseRequestParamsSchema:ta,CallToolRequestSchema:td,ListToolsRequestSchema:th,ListPromptsRequestSchema:tp,GetPromptRequestSchema:tm,ListResourcesRequestSchema:tf,ListResourceTemplatesRequestSchema:ty,ReadResourceRequestSchema:tv,CompleteRequestSchema:t_,DiscoverRequestSchema:tS,SubscriptionFilterSchema:tb,SubscriptionsListenRequestSchema:tw,SubscriptionsListenResultMetaSchema:tR,SubscriptionsListenResultSchema:tP,dispatchRequestSchemas:tE,dispatchResultSchemas:tT,NotificationMetaSchema:tk,SubscriptionsAcknowledgedNotificationSchema:tI,CancelledNotificationParamsSchema:tx,CancelledNotificationSchema:tj,notificationSchemas2026:{"notifications/cancelled":tj,"notifications/progress":k,"notifications/message":x,"notifications/resources/updated":V,"notifications/resources/list_changed":L,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":H,"notifications/subscriptions/acknowledged":tI},JSONRPCResultResponseSchema:tO(eU),CallToolResultResponseSchema:tO(em([ez,tr])),ListToolsResultResponseSchema:tO(eD),ListPromptsResultResponseSchema:tO(eH),GetPromptResultResponseSchema:tO(em([eF,tr])),ListResourcesResultResponseSchema:tO(eG),ListResourceTemplatesResultResponseSchema:tO(eK),ReadResourceResultResponseSchema:tO(em([eJ,tr])),CompleteResultResponseSchema:tO(eB),DiscoverResultResponseSchema:tO(eX)}}()}let oS=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],ob=Symbol("modelcontextprotocol.resultCacheHintFallback");function o$(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function ow(e){return"public"===e||"private"===e}let oR=((iP={})[iP.ParseError=-32700]="ParseError",iP[iP.InvalidRequest=-32600]="InvalidRequest",iP[iP.MethodNotFound=-32601]="MethodNotFound",iP[iP.InvalidParams=-32602]="InvalidParams",iP[iP.InternalError=-32603]="InternalError",iP[iP.ResourceNotFound=-32002]="ResourceNotFound",iP[iP.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",iP[iP.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",iP[iP.UrlElicitationRequired=-32042]="UrlElicitationRequired",iP);var oP=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",rY(this,new.target)}static fromError(t,r,o){return t===oR.UrlElicitationRequired&&o&&o.elicitations?new oC(o.elicitations,r):t===oR.UnsupportedProtocolVersion&&o&&Array.isArray(o.supported)&&"string"==typeof o.requested?new oT({supported:o.supported,requested:o.requested},r):(t===oR.InvalidParams||t===oR.ResourceNotFound)&&"string"==typeof o?.uri&&(t===oR.ResourceNotFound||1===Object.keys(o).length)?new oE(o.uri,r):t===oR.MissingRequiredClientCapability&&o&&null!==o.requiredCapabilities&&"object"==typeof o.requiredCapabilities&&!Array.isArray(o.requiredCapabilities)?new ok({requiredCapabilities:o.requiredCapabilities},r):new e(t,r,o)}},oE=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(oR.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},oC=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(oR.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},oT=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(oR.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ok=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(oR.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let oI=["tools/call","prompts/get","resources/read"],ox=["elicitation/create","sampling/createMessage","roots/list"];function oj(){if(o)return o;let e=o_();return o={request:{"elicitation/create":t4({method:rR("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":t4({method:rR("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":t4({method:rR("roots/list"),params:eo({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function oO(e){return ox.includes(e)}function oN(e){return oO(e)?oj().request[e]:void 0}let oq={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},oM={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function oA(e){return Object.prototype.hasOwnProperty.call(oq,e)}function oL(e){return Object.prototype.hasOwnProperty.call(oM,e)}function oU(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function oV(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(oq),Object.keys(oM);let oz={ok:!1,reason:"not-in-era"},oD=[f,eT],oH={era:"2026-07-28",hasRequestMethod:oA,hasNotificationMethod:oL,hasInputRequestMethod:e=>void 0!==oN(e),validateRequest:(e,t)=>oV(oA(e)?o_().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>oV(Object.prototype.hasOwnProperty.call(oq,e)?o_().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>oV(oL(e)?o_().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>oV(oN(e),t),validateInputResponse:(e,t)=>oV(oO(e)?oj().response[e]:void 0,t),samplingResultVariant:()=>oz,outboundEnvelope:e=>({[f]:e.protocolVersion,[R]:e.clientInfo,[eT]:e.clientCapabilities,...void 0!==e.logLevel&&{[tQ]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of oD)r in e||t.push({key:r,problem:"missing"});let r=o_().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let e of r.error.issues){let r=e.path.map(String),o=r.length>0?r.join("."):"_meta";1===r.length&&t.some(e=>e.key===o&&"missing"===e.problem)||t.push({key:o,problem:e.message})}return t},projectCallToolResult:e=>oe(e),inputRequestSchema:oN,decodeResult(e,t){if(!oU(t))return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if("string"!=typeof r)return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,o=oU(r)?r:{},a=t.requestState;return 0===Object.keys(o).length&&"string"!=typeof a?{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:o,..."string"==typeof a&&{requestState:a}}}if("complete"!==r)return{kind:"invalid",error:new r4(r9.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=function(){if(a)return a;let e=o_();return a={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema}}(),s=Object.hasOwn(o,e)?o[e]:void 0;if(void 0!==s){let r=s.safeParse(t);if(!r.success)return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: ${r.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult:(e,t,r)=>(function(e,t){if(void 0===t)return e;let r=e._meta;return void 0===r?{...e,_meta:{[tL]:t}}:null===r||"object"!=typeof r||Array.isArray(r)||void 0!==r[tL]?e:{...e,_meta:{...r,[tL]:t}}})(function(e,t){var r,o;let a=t[ob];if("complete"!==t.resultType||!oS.includes(e)){let e;return void 0===a?t:(e={...t},delete e[ob],e)}let s=o$(t.ttlMs)?t.ttlMs:void 0!==(r=a)&&o$(r.ttlMs)?r.ttlMs:0,i=ow(t.cacheScope)?t.cacheScope:void 0!==(o=a)&&ow(o.cacheScope)?o.cacheScope:"private",n={...t,ttlMs:s,cacheScope:i};return delete n[ob],n}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||oI.includes(e))return t;throw new oP(oR.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}(e,function(e,t){let r=t,o=!1,a=()=>(o||(r={...r},o=!0),r),s=t.tools;"tools/list"===e&&Array.isArray(s)&&s.some(e=>oU(e)&&"execution"in e)&&(a().tools=s.map(e=>{if(!oU(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let i=t.capabilities;if(oU(i)&&"tasks"in i){let e={...i};delete e.tasks,a().capabilities=e}return r}(e,t))),r),encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope(e){if(void 0===e.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=o_().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join("; ")}`}},oF="2026-07-28";function oG(e){return void 0!==e&&e>=r3?oH:og}function oK(e){return void 0!==e.revision?oG(e.revision).era:"modern"===e.era?oH.era:og.era}function oW(e){return oB.some(t=>t.hasRequestMethod(e))}function oJ(e){return oB.some(t=>t.hasNotificationMethod(e))}let oB=[og,oH];var oZ=(e=>{let t={};for(var r in e)rz(t,r,{get:e[r],enumerable:!0});return t})({AnnotationsSchema:()=>rw,AudioContentSchema:()=>tp,BaseMetadataSchema:()=>tU,BaseRequestParamsSchema:()=>ef,BlobResourceContentsSchema:()=>ez,BooleanSchemaSchema:()=>eC,CallToolRequestParamsSchema:()=>t5,CallToolRequestSchema:()=>rr,CallToolResultSchema:()=>eI,CancelTaskRequestSchema:()=>w,CancelTaskResultSchema:()=>tc,CancelledNotificationParamsSchema:()=>rT,CancelledNotificationSchema:()=>eq,ClientCapabilitiesSchema:()=>j,ClientNotificationSchema:()=>tE,ClientRequestSchema:()=>e2,ClientResultSchema:()=>y,ClientTasksCapabilitySchema:()=>tO,CompatibilityCallToolResultSchema:()=>tk,CompleteRequestParamsSchema:()=>rk,CompleteRequestSchema:()=>k,CompleteResultSchema:()=>T,ContentBlockSchema:()=>rb,CreateMessageRequestParamsSchema:()=>c,CreateMessageRequestSchema:()=>eU,CreateMessageResultSchema:()=>J,CreateMessageResultWithToolsSchema:()=>Z,CreateTaskResultSchema:()=>eh,CursorSchema:()=>X,DiscoverRequestSchema:()=>I,DiscoverResultSchema:()=>b,ElicitRequestFormParamsSchema:()=>ek,ElicitRequestParamsSchema:()=>ti,ElicitRequestSchema:()=>tl,ElicitRequestURLParamsSchema:()=>ta,ElicitResultSchema:()=>W,ElicitationCompleteNotificationParamsSchema:()=>tD,ElicitationCompleteNotificationSchema:()=>r$,EmbeddedResourceSchema:()=>eA,EmptyResultSchema:()=>q,EnumSchemaSchema:()=>tm,GetPromptRequestParamsSchema:()=>tF,GetPromptRequestSchema:()=>rp,GetPromptResultSchema:()=>tb,GetTaskPayloadRequestSchema:()=>tA,GetTaskPayloadResultSchema:()=>x,GetTaskRequestSchema:()=>e_,GetTaskResultSchema:()=>rC,IconSchema:()=>ee,IconsSchema:()=>tu,ImageContentSchema:()=>tt,ImplementationSchema:()=>tI,InitializeRequestParamsSchema:()=>td,InitializeRequestSchema:()=>u,InitializeResultSchema:()=>eZ,InitializedNotificationSchema:()=>eY,JSONArraySchema:()=>ex,JSONObjectSchema:()=>P,JSONRPCErrorResponseSchema:()=>U,JSONRPCMessageSchema:()=>e$,JSONRPCNotificationSchema:()=>A,JSONRPCRequestSchema:()=>eN,JSONRPCResponseSchema:()=>eJ,JSONRPCResultResponseSchema:()=>eL,JSONValueSchema:()=>tK,LegacyTitledEnumSchemaSchema:()=>ey,ListChangedOptionsBaseSchema:()=>D,ListPromptsRequestSchema:()=>rq,ListPromptsResultSchema:()=>tf,ListResourceTemplatesRequestSchema:()=>tG,ListResourceTemplatesResultSchema:()=>tV,ListResourcesRequestSchema:()=>tS,ListResourcesResultSchema:()=>d,ListRootsRequestSchema:()=>rl,ListRootsResultSchema:()=>tv,ListTasksRequestSchema:()=>en,ListTasksResultSchema:()=>ru,ListToolsRequestSchema:()=>rS,ListToolsResultSchema:()=>t6,LoggingLevelSchema:()=>tP,LoggingMessageNotificationParamsSchema:()=>h,LoggingMessageNotificationSchema:()=>t9,ModelHintSchema:()=>tx,ModelPreferencesSchema:()=>M,MultiSelectEnumSchemaSchema:()=>e0,NotificationSchema:()=>eQ,NotificationsParamsSchema:()=>tg,NumberSchemaSchema:()=>to,PaginatedRequestParamsSchema:()=>tT,PaginatedRequestSchema:()=>ep,PaginatedResultSchema:()=>e3,PingRequestSchema:()=>rI,PrimitiveSchemaDefinitionSchema:()=>t$,ProgressNotificationParamsSchema:()=>eg,ProgressNotificationSchema:()=>v,ProgressSchema:()=>E,ProgressTokenSchema:()=>tj,PromptArgumentSchema:()=>p,PromptListChangedNotificationSchema:()=>eE,PromptMessageSchema:()=>L,PromptReferenceSchema:()=>et,PromptSchema:()=>tw,ReadResourceRequestParamsSchema:()=>K,ReadResourceRequestSchema:()=>rh,ReadResourceResultSchema:()=>ts,RelatedTaskMetadataSchema:()=>tR,RequestIdSchema:()=>rx,RequestMetaSchema:()=>rc,RequestSchema:()=>eB,ResourceContentsSchema:()=>eR,ResourceLinkSchema:()=>B,ResourceListChangedNotificationSchema:()=>rn,ResourceRequestParamsSchema:()=>rj,ResourceSchema:()=>eu,ResourceTemplateReferenceSchema:()=>ec,ResourceTemplateSchema:()=>C,ResourceUpdatedNotificationParamsSchema:()=>er,ResourceUpdatedNotificationSchema:()=>tY,ResultMetaObjectSchema:()=>t2,ResultSchema:()=>eV,RoleSchema:()=>e9,RootSchema:()=>rm,RootsListChangedNotificationSchema:()=>eD,SamplingContentSchema:()=>e8,SamplingMessageContentBlockSchema:()=>t_,SamplingMessageSchema:()=>eH,ServerCapabilitiesSchema:()=>rO,ServerNotificationSchema:()=>eF,ServerRequestSchema:()=>eM,ServerResultSchema:()=>ej,ServerTasksCapabilitySchema:()=>e1,SetLevelRequestParamsSchema:()=>z,SetLevelRequestSchema:()=>eP,SingleSelectEnumSchemaSchema:()=>m,StringSchemaSchema:()=>eK,SubscribeRequestParamsSchema:()=>eG,SubscribeRequestSchema:()=>tW,SubscriptionFilterSchema:()=>eX,SubscriptionsAcknowledgedNotificationParamsSchema:()=>tz,SubscriptionsAcknowledgedNotificationSchema:()=>tN,SubscriptionsListenRequestParamsSchema:()=>tX,SubscriptionsListenRequestSchema:()=>rf,SubscriptionsListenResultMetaSchema:()=>tJ,SubscriptionsListenResultSchema:()=>S,TaskAugmentedRequestParamsSchema:()=>tq,TaskCreationParamsSchema:()=>t7,TaskMetadataSchema:()=>G,TaskSchema:()=>Q,TaskStatusNotificationParamsSchema:()=>V,TaskStatusNotificationSchema:()=>$,TaskStatusSchema:()=>tB,TextContentSchema:()=>re,TextResourceContentsSchema:()=>H,TitledMultiSelectEnumSchemaSchema:()=>g,TitledSingleSelectEnumSchemaSchema:()=>ev,ToolAnnotationsSchema:()=>tZ,ToolChoiceSchema:()=>e4,ToolExecutionSchema:()=>Y,ToolListChangedNotificationSchema:()=>ty,ToolResultContentSchema:()=>F,ToolSchema:()=>e5,ToolUseContentSchema:()=>rs,UnsubscribeRequestParamsSchema:()=>tM,UnsubscribeRequestSchema:()=>t1,UntitledMultiSelectEnumSchemaSchema:()=>rN,UntitledSingleSelectEnumSchemaSchema:()=>e6});let oX=e=>eL.safeParse(e).success,oQ=e=>U.safeParse(e).success,oY=e=>eJ.safeParse(e).success,o0=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,o1="x-mcp-header",o2=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,o9=new Set(["string","integer","boolean","number"]);function o4(e){let t=[],r=new Map,o=(e,a,s)=>{if(null===e||"object"!=typeof e)return;if(o1 in e){if(!s||0===a.length)return`${o6(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let o=e[o1];if("string"!=typeof o||0===o.length)return`${o6(a)}: x-mcp-header MUST be a non-empty string`;if(!o2.test(o))return`${o6(a)}: x-mcp-header '${o}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let i="string"==typeof e.type?e.type:void 0;if(void 0===i||!o9.has(i))return`${o6(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${i??"<none>"}`;let n=o.toLowerCase(),l=r.get(n);if(void 0!==l)return`x-mcp-header '${o}' is not case-insensitively unique (also declared as '${l}')`;r.set(n,o),t.push({path:a,headerName:o,type:i})}let i=e.properties;if(null!==i&&"object"==typeof i)for(let[e,t]of Object.entries(i)){let r=o(t,[...a,e],s);if(void 0!==r)return r}for(let t of o5){let r=e[t];if(void 0!==r)for(let e of Array.isArray(r)?r:null!==r&&"object"==typeof r&&o3.has(t)?Object.values(r):[r]){let r=o(e,[...a,`<${t}>`],!1);if(void 0!==r)return r}}},a=o(e,[],!0);return void 0===a?{valid:!0,declarations:t}:{valid:!1,reason:a}}let o5=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],o3=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function o6(e){return 0===e.length?"<root>":e.join(".")}let o7="=?base64?";function o8(e){return!function(e){if(0===e.length||e.startsWith(o7)&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(9!==r&&(!(r>=32)||!(r<=126)))return!0}return!1}(e)?e:`${o7}${function(e){let t=new TextEncoder().encode(e),r="";for(let e of t)r+=String.fromCodePoint(e);return btoa(r)}(e)}?=`}function ae(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function at(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}oR.InvalidRequest,oR.UnsupportedProtocolVersion,oR.InvalidParams,oR.MethodNotFound,oR.InvalidParams,oR.MissingRequiredClientCapability,oR.ParseError,oR.InvalidRequest,oR.MethodNotFound,oR.UnsupportedProtocolVersion,oR.MissingRequiredClientCapability;let ar=!1,ao="draft-2020-12";async function aa(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(e=>e.path?.length?`${e.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${e.message}`:e.message).join(", ")}:{success:!0,data:r.value}}let as=/\\\.\\d\{(\d+)\}/;function ai(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let an=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function al(e){return an.has(e)||e.startsWith("x-")}let ac=new Set(["$schema",...Object.keys(ek.shape.requestedSchema.shape)]),au={string:ae([eK,e6,ev,ey]),number:ae([to]),integer:ae([to]),boolean:ae([eC]),array:ae([rN,g])},ad=new Set(eK.shape.format.unwrap().options);async function ah(e){let{config:t,method:r,originalParams:o,requestOptions:a,hooks:s,signal:i}=e,n=e.flowStartedAt??Date.now(),l=e.firstPayload,c=0;for(;;){let e;if((c+=1)>t.maxRounds){var u;throw new r4(r9.InputRequiredRoundsExceeded,(u=t.maxRounds,`Multi-round-trip request '${r}' still required input after ${u} rounds (inputRequired.maxRounds)`),{rounds:t.maxRounds,lastResult:{inputRequests:l.inputRequests,...void 0!==l.requestState&&{requestState:l.requestState}}})}a.onprogress?.({progress:c,message:`Fulfilling input required by '${r}' (round ${c})`});let d=Object.entries(l.inputRequests??{});if(d.length>0){let t=function(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener("abort",r)}}(i);try{let r=await Promise.all(d.map(async([e,r])=>{try{return[e,await s.dispatchInputRequest(e,r,t.signal)]}catch(e){throw t.abort(e),e}}));e=Object.fromEntries(r)}finally{t.dispose()}}else await function(e){return new Promise((t,r)=>{if(e?.aborted)return void r(e.reason instanceof r4?e.reason:new r4(r9.RequestTimeout,String(e.reason)));let o=setTimeout(()=>{e?.removeEventListener("abort",a),t()},250),a=()=>{clearTimeout(o),r(e?.reason instanceof r4?e.reason:new r4(r9.RequestTimeout,String(e?.reason)))};e?.addEventListener("abort",a,{once:!0})})}(i);let h={...void 0!==a.timeout&&{timeout:a.timeout}};if(void 0!==a.maxTotalTimeout){let e=Date.now()-n,t=a.maxTotalTimeout-e;if(t<=0)throw new r4(r9.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:e});h.maxTotalTimeout=t}let p=await s.retry(function(e,t,r){let o=void 0!==t&&Object.keys(t).length>0;return o||void 0!==r?{...e,...o&&{inputResponses:t},...void 0!==r&&{requestState:r}}:e}(o,e,l.requestState),h);if(o0(p)){l={inputRequests:p.inputRequests??{},...void 0!==p.requestState&&{requestState:p.requestState}};continue}return p}}Object.assign(function(e){let t=void 0!==e.inputRequests&&Object.keys(e.inputRequests).length>0,r="string"==typeof e.requestState;if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==e.inputRequests&&{inputRequests:e.inputRequests},...void 0!==e.requestState&&{requestState:e.requestState}}},{elicit(e){try{return{method:"elicitation/create",params:function(e){var t;if(!at(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let r=e.requestedSchema["~standard"].vendor,o=function(e,t){let r={},o=[];for(let[a,s]of Object.entries(e))"properties"===a&&ai(s)?r[a]=Object.fromEntries(Object.entries(s).map(([e,r])=>[e,function(e,t,r,o){if(!ai(e))return e;let a="string"==typeof e.type&&Object.hasOwn(au,e.type)?au[e.type]:void 0;if(void 0===a)return e;let s={};for(let[n,l]of Object.entries(e))if(a.has(n)||al(n))s[n]=l;else if("pattern"===n&&"string"===e.type&&"string"==typeof e.format)if(ad.has(e.format)){var i;"string"==typeof l&&(i=e.format,"zod"!==r||(function(e,t){let r;switch(e){case"email":r=[t3()];break;case"uri":r=[tC()];break;case"date":r=[eO()];break;case"date-time":let o,a;o=as.exec(t),a=[void 0,-1,0],o&&a.push(Number(o[1])),r=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>a.map(r=>rg({local:e,offset:t,precision:r}))))}return new Set(r.map(e=>{let t;return t=rd(e,{target:ao,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(i,l).has(l))||o.push(`${t}.${n}`)}else s[n]=l;else o.push(`${t}.${n}`);return s}(r,`properties.${e}`,t,o)])):ac.has(a)?r[a]=s:al(a)||o.push(a);if(o.length>0)throw new oP(oR.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}(function(e){try{return function(e,t="input"){let r,o=e["~standard"];if(o.jsonSchema)r=o.jsonSchema[t]({target:ao});else if("zod"===o.vendor){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");ar||(ar=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=rd(e,{target:ao,io:t})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===t)return void 0!==r.type||!function e(t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;for(let r of["oneOf","anyOf","allOf"]){let o=t[r];if(Array.isArray(o)&&o.length>0)return o.every(t=>null!==t&&"object"==typeof t&&("object"===t.type||e(t)))}return!1}(r)?r:{type:"object",...r};if(void 0!==r.type&&"object"!==r.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new oP(oR.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),a=(t=ek.shape.requestedSchema,ry(t,o));if(!a.success)throw new oP(oR.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!ai(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!ry(t$,e).success).map(([e])=>`properties.${e}`);return r.length>0?r.join(", "):t}(o,a.error.message)}`);let s=function e(t,r,o=""){return Array.isArray(t)&&Array.isArray(r)?t.flatMap((t,a)=>e(t,r[a],`${o}[${a}]`)):ai(t)&&ai(r)?Object.entries(t).flatMap(([t,a])=>{let s=o?`${o}.${t}`:t;return Object.prototype.hasOwnProperty.call(r,t)?e(a,r[t],s):al(t)?[]:[s]}):[]}(o,a.data);if(s.length>0)throw new oP(oR.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);let i=(a.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(a.data.properties,e));if(i.length>0)throw new oP(oR.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:a.data}}(e)}}catch(e){throw e instanceof oP?TypeError(e.message,{cause:e}):e}},elicitUrl:e=>({method:"elicitation/create",params:{...e,mode:"url"}}),createMessage:e=>({method:"sampling/createMessage",params:e}),listRoots:()=>({method:"roots/list"})});let ap={},am={};function af(e,t){let r=e.slice(0,-6);ap[r]=t,am[r]=e=>t.safeParse(e).success}for(let e of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])af(e,oZ[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:rt,OAuthClientInformationFullSchema:ei,OAuthClientInformationSchema:tr,OAuthClientMetadataSchema:O,OAuthClientRegistrationErrorSchema:e7,OAuthErrorResponseSchema:N,OAuthMetadataSchema:ra,OAuthProtectedResourceMetadataSchema:r_,OAuthTokenRevocationRequestSchema:ed,OAuthTokensSchema:rE,OpenIdProviderDiscoveryMetadataSchema:_,OpenIdProviderMetadataSchema:ew}))af(e,t);Object.freeze(ap);let ay=Object.freeze(am),av=[f,R,eT,tQ],ag=["inputResponses","requestState"];function a_(e,t){let r=e.params;if(!aw(r))return{message:e,lifted:{}};let o=r._meta,a=aw(o)?av.filter(e=>e in o):[],s="request"===t?ag.filter(e=>e in r):[];if(0===a.length&&0===s.length)return{message:e,lifted:{}};let i={},n={...r};if(a.length>0&&aw(o)){let e={},t={...o};for(let r of a)e[r]=o[r],delete t[r];i.envelope=e,Object.keys(t).length>0?n._meta=t:delete n._meta}for(let e of s)"inputResponses"===e&&(i.inputResponses=n[e]),"requestState"===e&&(i.requestState=n[e]),delete n[e];return{message:{...e,params:n},lifted:i}}function aS(e,t){let r=e.validateResult(t,void 0);if(r.ok||"not-in-era"!==r.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let o=e.validateResult(t,r);return o.ok?{value:o.value}:{issues:[{message:"invalid"===o.reason?o.message:`not-in-era: ${t}`}]}}}}}let ab=(iE=void 0,()=>iE);var a$=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??t0,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(void 0===t)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new r4(r9.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new r4(r9.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let o=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(o?.(e,t),oX(e)||oQ(e))this._onresponse(e);else if(eN.safeParse(e).success)this._onrequest(e,t);else A.safeParse(e).success?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new r4(r9.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(r);for(let e of t.values())e.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=a_(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=oK(t.classification);if(e!==o.era)return void this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${e} but this instance serves ${o.era}`))}if(oJ(r.method)&&!o.hasNotificationMethod(r.method))return;let a=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;(void 0!==a||void 0!==s)&&Promise.resolve().then(()=>void 0===a?s(r):a(r,o)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r;let{message:o,lifted:a}=a_(e,"request"),s=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return void this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));let i=this._transport,n=(e,t,r)=>{let a={jsonrpc:"2.0",id:o.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};i?.send(a).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=oK(t.classification);if(e!==s.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${e} but this instance serves ${s.era}`));let r=t.classification.revision??e;n(oR.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(oW(o.method)&&!s.hasRequestMethod(o.method))return void n(oR.MethodNotFound,"Method not found");let l=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(void 0===l)return void n(oR.MethodNotFound,"Method not found");let c=s.checkInboundEnvelope(a);if(void 0!==c)return void n(oR.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:o.id}),d=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:o.id}),h=new AbortController;this._requestHandlerAbortControllers.set(o.id,h);let p=void 0===a.inputResponses?void 0:function(e){let t={},r=[];if(!aR(e))return{accepted:t,droppedKeys:r};for(let[o,a]of Object.entries(e)){if(!aR(a)||"method"in a||"result"in a){r.push(o);continue}t[o]=a}return{accepted:t,droppedKeys:r}}(a.inputResponses),m={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...void 0!==a.envelope&&{envelope:a.envelope},...void 0!==p&&{inputResponses:p.accepted},...void 0!==p&&p.droppedKeys.length>0&&{droppedInputResponseKeys:p.droppedKeys},requestState:void 0===a.requestState?ab:(r=a.requestState,()=>r),signal:h.signal,send:(e,t,r)=>{let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),at(t))return d(e,t,r);let a=aS(o,e.method);if(void 0===a)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,a,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(m,t);Promise.resolve().then(()=>l(o,f)).then(async e=>{let t;if(h.signal.aborted)return;try{t=s.encodeResult(o.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${o.method}: ${e}`)),n(oR.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:o.id};await i?.send(r)},async e=>{if(h.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:oR.InternalError,r={jsonrpc:"2.0",id:o.id,error:{code:s.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await i?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(o.id)===h&&this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),a=this._progressHandlers.get(o);if(!a)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(e){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(e);return}a(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);void 0===r?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),r(oX(e)?e:oP.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),at(t))return this._requestWithSchemaViaCodec(o,e,t,r);let a=aS(o,e.method);if(void 0===a)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,a,t)}_negotiatedWireCodec(){return oG(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(void 0===this._negotiatedProtocolVersion){let t=function(e){switch(e){case"initialize":case"notifications/initialized":return oG(void 0);case"server/discover":return oG(oF);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(oW(t)&&!e.hasRequestMethod(t))throw new r4(r9.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let a,s,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:l,headers:c}=o??{},u=Date.now();return new Promise((d,h)=>{let p=e=>{h(e)};if(!this._transport)return void p(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(o?.signal?.aborted){let e=o.signal.reason;throw e instanceof r4?e:new r4(r9.RequestTimeout,String(e))}let m=e.era===oF&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;s=f;let y={...t,jsonrpc:"2.0",id:f};o?.onprogress&&(this._progressHandlers.set(f,o.onprogress),y.params={...t.params,_meta:{...t.params?._meta,progressToken:f}});let v=this._envelopeOutbound(y),g=!1,_=e=>{g||(this._progressHandlers.delete(f),void 0===m?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:i,resumptionToken:n,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),h(e instanceof r4?e:new r4(r9.RequestTimeout,String(e))))};this._responseHandlers.set(f,a=>{let s;if(!o?.signal?.aborted){if(g=!0,a instanceof Error)return h(a);try{s=e.decodeResult(t.method,a.result)}catch(e){return h(e instanceof Error?e:Error(String(e)))}if("invalid"===s.kind)return h(s.error);if("input_required"===s.kind){var i;return o?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(i=s).inputRequests,...void 0!==i.requestState&&{requestState:i.requestState}}):d(this._resolveNonCompleteResult(s,{codec:e,request:t,resultSchema:r,options:o,flowStartedAt:u,retry:(o,a)=>this._requestWithSchemaViaCodec(e,void 0===o?{method:t.method}:{method:t.method,params:o},r,a)}))}aa(r,s.result).then(e=>{e.success?d(e.data):h(new r4(r9.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},h)}}),a=()=>_(o?.signal?.reason),o?.signal?.addEventListener("abort",a,{once:!0});let S=o?.timeout??6e4;this._setupTimeout(f,S,o?.maxTotalTimeout,()=>_(new r4(r9.RequestTimeout,"Request timed out",{timeout:S})),o?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:l,headers:c,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(f),h(e)})}).finally(()=>{a&&o?.signal?.removeEventListener("abort",a),void 0!==s&&(this._responseHandlers.delete(s),this._cleanupTimeout(s))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new r4(r9.NotConnected,"Not connected");if(oJ(t.method)&&!e.hasNotificationMethod(t.method))throw new r4(r9.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(e=>this._onerror(e))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){let o;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!oW(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(r,o)=>{let a=this._negotiatedWireCodec(),s=a.validateRequest(e,r);if(s.ok||"not-in-era"!==s.reason||(s=a.validateInputRequest(e,r)),!s.ok){if("not-in-era"===s.reason)throw new oP(oR.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value,o))}}else if(r)o=async(o,a)=>{let s=await aa(t.params,{...o.params});if(!s.success)throw new oP(oR.InvalidParams,`Invalid params for ${e}: ${s.error}`);return r(s.data,a)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if("function"==typeof t){if(!oJ(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,o)=>{let a=o.validateNotification(e,r);if(!a.ok){if("not-in-era"===a.reason)throw new oP(oR.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let a=await aa(t.params,{...o.params});if(!a.success)throw new oP(oR.InvalidParams,`Invalid params for notification ${e}: ${a.error}`);await r(a.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function aw(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function aR(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function aP(e){throw new r4(r9.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}async function aE(e,t,r,o,a){var s;if(!aR(o)||"string"!=typeof o.method)throw new r4(r9.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let i=o.method;if(!t.hasInputRequestMethod(i))throw new r4(r9.InvalidResult,`Invalid input request '${r}': '${i}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:i});let n=e.getRequestHandler(i);if(void 0===n)throw new r4(r9.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${i}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:i});let l=aR(o.params)?o.params:void 0;return await n({jsonrpc:"2.0",id:r,method:i,...void 0!==l&&{params:l}},e.buildContext({sessionId:e.sessionId,mcpReq:{id:r,method:i,_meta:l?._meta,requestState:(s=void 0,()=>s),signal:a,send:()=>aP("send"),notify:()=>aP("notify")}}))}var aC=rW(rK(e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function a(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var s,i,n,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var c=l.indexOf(";"),u=-1!==c?l.slice(0,c).trim():l.trim();if(!o.test(u))throw TypeError("invalid media type");var d=new a(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;i=t.exec(l);){if(i.index!==c)throw TypeError("invalid parameter format");c+=i[0].length,s=i[1].toLowerCase(),34===(n=i[2]).charCodeAt(0)&&-1!==(n=n.slice(1,-1)).indexOf("\\")&&(n=n.replace(r,"$1")),d.parameters[s]=n}if(c!==l.length)throw TypeError("invalid parameter format")}return d}})(),1);function aT(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function ak(e=fetch,t){return t?async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...aT(t.headers),...aT(o.headers)}:t.headers}):e}var aI=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}};function a(e,...t){let r=[e[0]],s=0;for(;s<t.length;)n(r,t[s]),r.push(e[++s]);return new o(r)}e._Code=o,e.nil=new o(""),e._=a;let s=new o("+");function i(e,...t){let a=[l(e[0])],c=0;for(;c<t.length;)a.push(s),n(a,t[c]),a.push(s,l(e[++c]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){var o,a;let s=(o=e[t-1],'""'===(a=e[t+1])?o:'""'===o?a:"string"==typeof o?a instanceof r||'"'!==o[o.length-1]?void 0:"string"!=typeof a?`${o.slice(0,-1)}${a}"`:'"'===a[0]?o.slice(0,-1)+a.slice(1):void 0:"string"!=typeof a||'"'!==a[0]||o instanceof r?void 0:`"${o}${a.slice(1)}`);if(void 0!==s){e.splice(t-1,3,s);continue}e[t++]="+"}t++}}(a),new o(a)}function n(e,t){var a;t instanceof o?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(a=t)||"boolean"==typeof a||null===a?a:l(Array.isArray(a)?a.join(","):a))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=i,e.addCodeArg=n,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:i`${e}${t}`},e.stringify=function(e){return new o(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new o(`.${t}`):a`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new o(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new o(e.toString())}}),ax=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=aI();var r,o,a=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=o||(e.UsedValueState=o={}))[r.Started=0]="Started",r[r.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var s=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=s;var i=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(r)}[${o}]`}};e.ValueScopeName=i;let n=(0,t._)`\n`;var l=class extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?n:t.nil}}get(){return this._scope}name(e){return new i(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:a}=o,s=null!=(r=t.key)?r:t.ref,i=this._values[a];if(i){let e=i.get(s);if(e)return e}else i=this._values[a]=new Map;i.set(s,o);let n=this._scope[a]||(this._scope[a]=[]),l=n.length;return n[l]=t.ref,o.setValue(t,{property:a,itemIndex:l}),o}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw Error(`CodeGen: name "${r}" has no value`);return(0,t._)`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(r,s,i={},n){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=i[c]=i[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,o.Started);let i=s(r);if(i){let o=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${o} ${r} = ${i};${this.opts._n}`}else if(i=null==n?void 0:n(r))l=(0,t._)`${l}${i}${this.opts._n}`;else throw new a(r);d.set(r,o.Completed)})}return l}};e.ValueScope=l}),aj=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=aI(),r=ax();var o=aI();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var a=ax();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},i=class extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let o=e?r.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${o} ${this.name}${a};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},n=class extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,r),this}get names(){return k(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends n{constructor(e,t,r,o){super(e,r,o),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},c=class extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},h=class extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;for(;o--;){let a=r[o];a.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,a.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>T(e,t.names),{})}},m=class extends p{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},f=class extends p{},y=class extends m{};y.kind="else";var v=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(!0===t)return this.nodes;let r=this.else;if(r){let e=r.optimizeNodes();r=this.else=Array.isArray(e)?new y(e):e}return r?!1===t?r instanceof e?r:r.nodes:this.nodes.length?this:new e(x(t),r instanceof e?[r]:r.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){let e=super.names;return k(e,this.condition),this.else&&T(e,this.else.names),e}};v.kind="if";var g=class extends m{};g.kind="for";var _=class extends g{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}},S=class extends g{constructor(e,t,r,o){super(),this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:o,from:a,to:s}=this;return`for(${t} ${o}=${a}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){return k(k(super.names,this.from),this.to)}},b=class extends g{constructor(e,t,r,o){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}},$=class extends m{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$.kind="func";var w=class extends p{render(e){return"return "+super.render(e)}};w.kind="return";var R=class extends m{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(o=this.finally)||o.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}},P=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};P.kind="catch";var E=class extends m{render(e){return"finally"+super.render(e)}};E.kind="finally";var C=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new f]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let a=this._scope.toName(t);return void 0!==r&&o&&(this._constants[a.str]=r),this._leafNode(new i(e,a,r)),a}const(e,t,o){return this._def(r.varKinds.const,e,t,o)}let(e,t,o){return this._def(r.varKinds.let,e,t,o)}var(e,t,o){return this._def(r.varKinds.var,e,t,o)}assign(e,t,r){return this._leafNode(new n(e,t,r))}add(t,r){return this._leafNode(new l(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new h(e)),this}object(...e){let r=["{"];for(let[o,a]of e)r.length>1&&r.push(","),r.push(o),(o!==a||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,a));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new v(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new v(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(v,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,o,a,s=this.opts.es5?r.varKinds.var:r.varKinds.let){let i=this._scope.toName(e);return this._for(new S(s,i,t,o),()=>a(i))}forOf(e,o,a,s=r.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let e=o instanceof t.Name?o:this.var("_arr",o);return this.forRange("_i",0,(0,t._)`${e}.length`,r=>{this.var(i,(0,t._)`${e}[${r}]`),a(i)})}return this._for(new b("of",s,i,o),()=>a(i))}forIn(e,o,a,s=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${o})`,a);let i=this._scope.toName(e);return this._for(new b("in",s,i,o),()=>a(i))}endFor(){return this._endBlockNode(g)}label(e){return this._leafNode(new c(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new w;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new R;if(this._blockNode(o),this.code(e),t){let e=this.name("e");this._currNode=o.catch=new P(e),t(e)}return r&&(this._currNode=o.finally=new E,this.code(r)),this._endBlockNode(P,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,o,a){return this._blockNode(new $(e,r,o)),a&&this.code(a).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function T(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function k(e,r){return r instanceof t._CodeOrName?T(e,r.names):e}function I(e,r,o){var a;if(e instanceof t.Name)return s(e);if(!((a=e)instanceof t._Code&&a._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==o[e.str])))return e;return new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function s(e){let t=o[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function x(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${q(e)}`}e.CodeGen=C,e.not=x;let j=N(e.operators.AND);e.and=function(...e){return e.reduce(j)};let O=N(e.operators.OR);function N(e){return(r,o)=>r===t.nil?o:o===t.nil?r:(0,t._)`${q(r)} ${e} ${q(o)}`}function q(e){return e instanceof t.Name?e:(0,t._)`(${e})`}e.or=function(...e){return e.reduce(O)}}),aO=rK(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let o=aj(),a=aI();function s(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||"boolean"==typeof t)return;let a=o.RULES.keywords;for(let r in t)a[r]||p(e,`unknown keyword: "${r}"`)}function i(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(s,i,n,l)=>{let c=void 0===n?i:n instanceof o.Name?(i instanceof o.Name?e(s,i,n):t(s,i,n),n):i instanceof o.Name?(t(s,n,i),i):r(i,n);return l!==o.Name||c instanceof o.Name?c:a(s,c)}}function u(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,o._)`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign((0,o._)`${t}${(0,o.getProperty)(r)}`,!0))}e.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(s(e,t),!i(t,e.self.RULES.all))},e.checkUnknownRules=s,e.schemaHasRules=i,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,a,s){if(!s){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,o._)`${r}`}return(0,o._)`${e}${t}${(0,o.getProperty)(a)}`},e.unescapeFragment=function(e){return l(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(n(e))},e.escapeJsonPointer=n,e.unescapeJsonPointer=l,e.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},e.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,o._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,o._)`${r} || {}`).code((0,o._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,o._)`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,o._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>e.assign(r,!0===t||(0,o._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=u,e.setEvaluated=d;let h={};function p(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new a._Code(t.code))})},(r=t||(e.Type=t={}))[r.Num=0]="Num",r[r.Str=1]="Str",e.getErrorPath=function(e,r,a){if(e instanceof o.Name){let s=r===t.Num;return a?s?(0,o._)`"[" + ${e} + "]"`:(0,o._)`"['" + ${e} + "']"`:s?(0,o._)`"/" + ${e}`:(0,o._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,o.getProperty)(e).toString():"/"+n(e)},e.checkStrictMode=p}),aN=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")}}),aq=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=aj(),r=aO(),o=aN();function a(e,r){let a=e.const("err",r);e.if((0,t._)`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,(0,t._)`[${a}]`),(0,t._)`${o.default.vErrors}.push(${a})`),e.code((0,t._)`${o.default.errors}++`)}function s(e,r){let{gen:o,validateName:a,schemaEnv:s}=e;s.$async?o.throw((0,t._)`new ${e.ValidationError}(${r})`):(o.assign((0,t._)`${a}.errors`,r),o.return(!1))}e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?(0,t.str)`"${e}" keyword must be ${r} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`},e.reportError=function(r,o=e.keywordError,i,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:h}=c,p=n(r,o,i);(null!=l?l:d||h)?a(u,p):s(c,(0,t._)`[${p}]`)},e.reportExtraError=function(t,r=e.keywordError,i){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;a(c,n(t,r,i)),u||d||s(l,o.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(o.default.errors,r),e.if((0,t._)`${o.default.vErrors} !== null`,()=>e.if(r,()=>e.assign((0,t._)`${o.default.vErrors}.length`,r),()=>e.assign(o.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:a,data:s,errsCount:i,it:n}){if(void 0===i)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",i,o.default.errors,i=>{e.const(l,(0,t._)`${o.default.vErrors}[${i}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(o.default.instancePath,n.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${n.errSchemaPath}/${r}`),n.opts.verbose&&(e.assign((0,t._)`${l}.schema`,a),e.assign((0,t._)`${l}.data`,s))})};let i={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function n(e,a,s){let{createErrors:n}=e.it;return!1===n?(0,t._)`{}`:function(e,a,s={}){let{gen:n,it:l}=e,c=[function({errorPath:e},{instancePath:a}){let s=a?(0,t.str)`${e}${(0,r.getErrorPath)(a,r.Type.Str)}`:e;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,s)]}(l,s),function({keyword:e,it:{errSchemaPath:o}},{schemaPath:a,parentSchema:s}){let n=s?o:(0,t.str)`${o}/${e}`;return a&&(n=(0,t.str)`${n}${(0,r.getErrorPath)(a,r.Type.Str)}`),[i.schemaPath,n]}(e,s)];return function(e,{params:r,message:a},s){let{keyword:n,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:h,topSchemaRef:p,schemaPath:m}=u;s.push([i.keyword,n],[i.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&s.push([i.message,"function"==typeof a?a(e):a]),d.verbose&&s.push([i.schema,c],[i.parentSchema,(0,t._)`${p}${m}`],[o.default.data,l]),h&&s.push([i.propertyName,h])}(e,a,c),n.object(...c)}(e,a,s)}}),aM=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=aq(),r=aj(),o=aN(),a={message:"boolean schema is false"};function s(e,r){let{gen:o,data:s}=e;(0,t.reportError)({gen:o,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},a,void 0,r)}e.topBoolOrEmptySchema=function(e){let{gen:t,schema:a,validateName:i}=e;!1===a?s(e,!1):"object"==typeof a&&!0===a.$async?t.return(o.default.data):(t.assign((0,r._)`${i}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){let{gen:r,schema:o}=e;!1===o?(r.var(t,!1),s(e)):r.var(t,!0)}}),aA=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(e){return"string"==typeof e&&t.has(e)},e.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}}),aL=rK(e=>{function t(e,t){return t.rules.some(t=>r(e,t))}function r(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:e,self:r},o){let a=r.RULES.types[o];return a&&!0!==a&&t(e,a)},e.shouldUseGroup=t,e.shouldUseRule=r}),aU=rK(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let o=aA(),a=aL(),s=aq(),i=aj(),n=aO();function l(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(o.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(r=t||(e.DataType=t={}))[r.Correct=0]="Correct",r[r.Wrong=1]="Wrong",e.getSchemaTypes=function(e){let t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=l,e.coerceAndCheckDataType=function(e,r){var o,s;let{gen:n,data:l,opts:u}=e,h=(o=r,(s=u.coerceTypes)?o.filter(e=>c.has(e)||"array"===s&&"array"===e):[]),m=r.length>0&&!(0===h.length&&1===r.length&&(0,a.schemaHasRulesForType)(e,r[0]));if(m){let o=d(r,l,u.strictNumbers,t.Wrong);n.if(o,()=>{h.length?function(e,t,r){let{gen:o,data:a,opts:s}=e,n=o.let("dataType",(0,i._)`typeof ${a}`),l=o.let("coerced",(0,i._)`undefined`);for(let e of("array"===s.coerceTypes&&o.if((0,i._)`${n} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>o.assign(a,(0,i._)`${a}[0]`).assign(n,(0,i._)`typeof ${a}`).if(d(t,a,s.strictNumbers),()=>o.assign(l,a))),o.if((0,i._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===s.coerceTypes)&&function(e){switch(e){case"string":o.elseIf((0,i._)`${n} == "number" || ${n} == "boolean"`).assign(l,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(l,(0,i._)`""`);return;case"number":o.elseIf((0,i._)`${n} == "boolean" || ${a} === null
2
+ let e,t,r,o,a,s,i,n;import"node:module";import{__webpack_require__ as l}from"./rslib-runtime~0.js";import{stringField as c,tryParseJson as u,isRecord as d}from"./1547~0.js";import{CreateMessageRequestParamsSchema as h,InitializeRequestSchema as p,ListResourcesResultSchema as m,LoggingMessageNotificationParamsSchema as f,PromptArgumentSchema as y,SingleSelectEnumSchemaSchema as v,PROTOCOL_VERSION_META_KEY as g,ClientResultSchema as _,ProgressNotificationSchema as S,TitledMultiSelectEnumSchemaSchema as b,OpenIdProviderDiscoveryMetadataSchema as $,SubscriptionsListenResultSchema as w,DiscoverResultSchema as R,TaskStatusNotificationSchema as P,CancelTaskRequestSchema as E,CLIENT_INFO_META_KEY as C,JSONObjectSchema as T,ProgressSchema as k,ResourceTemplateSchema as I,CompleteResultSchema as x,CompleteRequestSchema as j,DiscoverRequestSchema as O,GetTaskPayloadResultSchema as N,ClientCapabilitiesSchema as q,OAuthClientMetadataSchema as M,OAuthErrorResponseSchema as A,EmptyResultSchema as L,ModelPreferencesSchema as V,JSONRPCNotificationSchema as U,PromptMessageSchema as z,JSONRPCErrorResponseSchema as D,TaskStatusNotificationParamsSchema as H,SetLevelRequestParamsSchema as F,ListChangedOptionsBaseSchema as G,TextResourceContentsSchema as K,ToolResultContentSchema as W,TaskMetadataSchema as J,ReadResourceRequestParamsSchema as B,ElicitResultSchema as Z,CreateMessageResultSchema as X,ResourceLinkSchema as Q,CreateMessageResultWithToolsSchema as Y,CursorSchema as ee,TaskSchema as et,ToolExecutionSchema as er,IconSchema as eo,PromptReferenceSchema as ea,ResourceUpdatedNotificationParamsSchema as es,looseObject as ei,schemas_enum as en,SUBSCRIPTION_ID_META_KEY as el,OAuthClientInformationFullSchema as ec,ListTasksRequestSchema as eu,unknown as ed,ResourceTemplateReferenceSchema as eh,ResourceSchema as ep,OAuthTokenRevocationRequestSchema as em,CreateTaskResultSchema as ef,PaginatedRequestSchema as ey,union as ev,BaseRequestParamsSchema as eg,LegacyTitledEnumSchemaSchema as e_,TitledSingleSelectEnumSchemaSchema as eS,ProgressNotificationParamsSchema as eb,GetTaskRequestSchema as e$,optional as ew,lazy as eR,JSONRPCMessageSchema as eP,OpenIdProviderMetadataSchema as eE,ResourceContentsSchema as eC,SetLevelRequestSchema as eT,PromptListChangedNotificationSchema as ek,BooleanSchemaSchema as eI,CLIENT_CAPABILITIES_META_KEY as ex,ElicitRequestFormParamsSchema as ej,CallToolResultSchema as eO,JSONArraySchema as eN,ServerResultSchema as eq,iso_date as eM,JSONRPCRequestSchema as eA,CancelledNotificationSchema as eL,ServerRequestSchema as eV,EmbeddedResourceSchema as eU,JSONRPCResultResponseSchema as ez,CreateMessageRequestSchema as eD,ResultSchema as eH,BlobResourceContentsSchema as eF,RootsListChangedNotificationSchema as eG,SamplingMessageSchema as eK,ServerNotificationSchema as eW,SubscribeRequestParamsSchema as eJ,StringSchemaSchema as eB,schemas_number as eZ,JSONRPCResponseSchema as eX,RequestSchema as eQ,InitializeResultSchema as eY,SubscriptionFilterSchema as e0,NotificationSchema as e1,InitializedNotificationSchema as e2,MultiSelectEnumSchemaSchema as e9,ServerTasksCapabilitySchema as e4,ClientRequestSchema as e5,RoleSchema as e3,ToolChoiceSchema as e6,ToolSchema as e7,PaginatedResultSchema as e8,UntitledSingleSelectEnumSchemaSchema as te,OAuthClientRegistrationErrorSchema as tt,SamplingContentSchema as tr,schemas_boolean as to,ImageContentSchema as ta,OAuthClientInformationSchema as ts,NumberSchemaSchema as ti,ElicitRequestURLParamsSchema as tn,ReadResourceResultSchema as tl,ElicitRequestParamsSchema as tc,record as tu,ElicitRequestSchema as td,CancelTaskResultSchema as th,IconsSchema as tp,InitializeRequestParamsSchema as tm,discriminatedUnion as tf,AudioContentSchema as ty,EnumSchemaSchema as tv,ListPromptsResultSchema as tg,ToolListChangedNotificationSchema as t_,ListRootsResultSchema as tS,NotificationsParamsSchema as tb,SamplingMessageContentBlockSchema as t$,ListResourcesRequestSchema as tw,GetPromptResultSchema as tR,PrimitiveSchemaDefinitionSchema as tP,PromptSchema as tE,RelatedTaskMetadataSchema as tC,LoggingLevelSchema as tT,ClientNotificationSchema as tk,schemas_url as tI,PaginatedRequestParamsSchema as tx,CompatibilityCallToolResultSchema as tj,ImplementationSchema as tO,ModelHintSchema as tN,ProgressTokenSchema as tq,ClientTasksCapabilitySchema as tM,SubscriptionsAcknowledgedNotificationSchema as tA,TaskAugmentedRequestParamsSchema as tL,UnsubscribeRequestParamsSchema as tV,GetTaskPayloadRequestSchema as tU,SERVER_INFO_META_KEY as tz,BaseMetadataSchema as tD,ListResourceTemplatesResultSchema as tH,SubscriptionsAcknowledgedNotificationParamsSchema as tF,ElicitationCompleteNotificationParamsSchema as tG,schemas_null as tK,GetPromptRequestParamsSchema as tW,ListResourceTemplatesRequestSchema as tJ,JSONValueSchema as tB,SubscribeRequestSchema as tZ,SubscriptionsListenResultMetaSchema as tX,TaskStatusSchema as tQ,ToolAnnotationsSchema as tY,SubscriptionsListenRequestParamsSchema as t0,LOG_LEVEL_META_KEY as t1,ResourceUpdatedNotificationSchema as t2,SUPPORTED_PROTOCOL_VERSIONS as t9,UnsubscribeRequestSchema as t4,ResultMetaObjectSchema as t5,LoggingMessageNotificationSchema as t3,schemas_object as t6,CallToolRequestParamsSchema as t7,schemas_email as t8,ListToolsResultSchema as re,TaskCreationParamsSchema as rt,intersection as rr,TextContentSchema as ro,IdJagTokenExchangeResponseSchema as ra,CallToolRequestSchema as rs,preprocess as ri,OAuthMetadataSchema as rn,ToolUseContentSchema as rl,LATEST_PROTOCOL_VERSION as rc,ResourceListChangedNotificationSchema as ru,ListRootsRequestSchema as rd,RequestMetaSchema as rh,ListTasksResultSchema as rp,toJSONSchema as rm,ReadResourceRequestSchema as rf,GetPromptRequestSchema as ry,RootSchema as rv,SubscriptionsListenRequestSchema as rg,parse_safeParse as r_,schemas_string as rS,iso_datetime as rb,OAuthProtectedResourceMetadataSchema as r$,ListToolsRequestSchema as rw,ContentBlockSchema as rR,ElicitationCompleteNotificationSchema as rP,AnnotationsSchema as rE,literal as rC,schemas_array as rT,OAuthTokensSchema as rk,GetTaskResultSchema as rI,CancelledNotificationParamsSchema as rx,CompleteRequestParamsSchema as rj,PingRequestSchema as rO,RequestIdSchema as rN,ResourceRequestParamsSchema as rq,ServerCapabilitiesSchema as rM,UntitledMultiSelectEnumSchemaSchema as rA,ListPromptsRequestSchema as rL}from"./7754~0.js";var rV,rU=Object.create,rz=Object.defineProperty,rD=Object.getOwnPropertyDescriptor,rH=Object.getOwnPropertyNames,rF=Object.getPrototypeOf,rG=Object.prototype.hasOwnProperty,rK=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),rW=(e,t,r)=>(r=null!=e?rU(rF(e)):{},((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var o,a=rH(t),s=0,i=a.length;s<i;s++)o=a[s],rG.call(e,o)||void 0===o||rz(e,o,{get:(e=>t[e]).bind(null,o),enumerable:!(r=rD(t,o))||r.enumerable});return e})(!t&&e&&e.__esModule?r:rz(r,"default",{value:e,enumerable:!0}),e));let rJ=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),rB=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),rZ=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),rX=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),rQ=Symbol.for("mcp.sdk.errorBrands");function rY(e,t){let r=new Set,o=t;for(;"function"==typeof o;){let e=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&"string"==typeof e&&r.add(e),o=Object.getPrototypeOf(o)}0!==r.size&&Object.defineProperty(e,rQ,{value:r,enumerable:!1,configurable:!0})}function r0(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,rQ)){let r=t[rQ];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let r1=((iw={}).InvalidRequest="invalid_request",iw.InvalidClient="invalid_client",iw.InvalidGrant="invalid_grant",iw.UnauthorizedClient="unauthorized_client",iw.UnsupportedGrantType="unsupported_grant_type",iw.InvalidScope="invalid_scope",iw.AccessDenied="access_denied",iw.ServerError="server_error",iw.TemporarilyUnavailable="temporarily_unavailable",iw.UnsupportedResponseType="unsupported_response_type",iw.UnsupportedTokenType="unsupported_token_type",iw.InvalidToken="invalid_token",iw.MethodNotAllowed="method_not_allowed",iw.TooManyRequests="too_many_requests",iw.InvalidClientMetadata="invalid_client_metadata",iw.InvalidRedirectUri="invalid_redirect_uri",iw.InsufficientScope="insufficient_scope",iw.InvalidTarget="invalid_target",iw);var r2=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",rY(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}};let r9=((iR={}).NotConnected="NOT_CONNECTED",iR.AlreadyConnected="ALREADY_CONNECTED",iR.NotInitialized="NOT_INITIALIZED",iR.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",iR.RequestTimeout="REQUEST_TIMEOUT",iR.ConnectionClosed="CONNECTION_CLOSED",iR.SendFailed="SEND_FAILED",iR.InvalidResult="INVALID_RESULT",iR.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",iR.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",iR.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",iR.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",iR.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",iR.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",iR.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",iR.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",iR.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",iR.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",iR.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",iR);var r4=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",rY(this,new.target)}},r5=class extends r4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};let r3="2026-07-28",r6=[r3];function r7(e){return e.filter(e=>!(e>=r3))}function r8(e){return e.filter(e=>e>=r3)}function oe(e){let t=e.structuredContent;return void 0===t||!("object"!=typeof t||null===t||Array.isArray(t))||e.content?.some(e=>"text"===e.type)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}let ot=["task","inputRequests","requestState"];function or(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||ot.some(t=>t in e)?e:{...e,content:[]}}function oo(){let t,r,o,a,s,i,n,l,c,u,d,h,p,m,f,y,v,g,_,S,b,$,w,R,P,E,C,T,k,I,x,j,O,N,q,M,A,L,V,U,z,D,H,F,G,K,W,J,B,Z,X,Q,Y,ee,et,er,eo,ea,es,el,ec,eu,eh,ep,em,ef,ey,eg,e_,eS,eb,e$,eP,eE,eC,eT,ek,eI,ex,ej,eO,eN,eq,eM,eA,eL,eV,eU,ez,eD,eH,eF,eG,eK,eW,eJ,eB,eX,eQ,eY,e0,e1,e2,e9,e4,e5,e3,e6,e7,e8,te,tt,tr,ta,ts,ti,tn,tl,tc,td,th,tp,tm,ty,tv,tg,t_,tS,tb,t$,tw,tR,tP,tE,tC,tT,tk,tI,tx,tj;return e??=(t=eR(()=>ev([rS(),eZ(),to(),tK(),tu(rS(),t),rT(t)])),r=tu(rS(),t),o=ev([rS(),eZ().int()]),a=rS(),s=t6({ttl:eZ().optional()}),i=t6({taskId:rS()}),c=(l=t6({_meta:(n=ei({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()})).optional()})).extend({task:s.optional()}),u=t6({method:rS(),params:l.loose().optional()}),d=t6({_meta:n.optional()}),h=t6({method:rS(),params:d.loose().optional()}),p=ei({_meta:n.optional()}),m=ev([rS(),eZ().int()]),f=p.strict(),y=d.extend({requestId:m.optional(),reason:rS().optional()}),v=h.extend({method:rC("notifications/cancelled"),params:y}),g=t6({src:rS(),mimeType:rS().optional(),sizes:rT(rS()).optional(),theme:en(["light","dark"]).optional()}),_=t6({icons:rT(g).optional()}),b=(S=t6({name:rS(),title:rS().optional()})).extend({...S.shape,..._.shape,version:rS(),websiteUrl:rS().optional(),description:rS().optional()}),$=rr(t6({applyDefaults:to().optional()}),r),w=ri(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,rr(t6({form:$.optional(),url:r.optional()}),r.optional())),R=ei({list:r.optional(),cancel:r.optional(),requests:ei({sampling:ei({createMessage:r.optional()}).optional(),elicitation:ei({create:r.optional()}).optional()}).optional()}),P=ei({list:r.optional(),cancel:r.optional(),requests:ei({tools:ei({call:r.optional()}).optional()}).optional()}),E=t6({experimental:tu(rS(),r).optional(),sampling:t6({context:r.optional(),tools:r.optional()}).optional(),elicitation:w.optional(),roots:t6({listChanged:to().optional()}).optional(),tasks:R.optional(),extensions:tu(rS(),r).optional()}),C=l.extend({protocolVersion:rS(),capabilities:E,clientInfo:b}),T=u.extend({method:rC("initialize"),params:C}),k=t6({experimental:tu(rS(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:t6({listChanged:to().optional()}).optional(),resources:t6({subscribe:to().optional(),listChanged:to().optional()}).optional(),tools:t6({listChanged:to().optional()}).optional(),tasks:P.optional(),extensions:tu(rS(),r).optional()}),I=p.extend({protocolVersion:rS(),capabilities:k,serverInfo:b,instructions:rS().optional()}),x=h.extend({method:rC("notifications/initialized"),params:d.optional()}),j=u.extend({method:rC("ping"),params:l.optional()}),O=t6({progress:eZ(),total:ew(eZ()),message:ew(rS())}),N=t6({...d.shape,...O.shape,progressToken:o}),q=h.extend({method:rC("notifications/progress"),params:N}),M=l.extend({cursor:a.optional()}),A=u.extend({params:M.optional()}),L=p.extend({nextCursor:a.optional()}),U=(V=t6({uri:rS(),mimeType:ew(rS()),_meta:tu(rS(),ed()).optional()})).extend({text:rS()}),z=rS().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),D=V.extend({blob:z}),F=t6({audience:rT(H=en(["user","assistant"])).optional(),priority:eZ().min(0).max(1).optional(),lastModified:rb({offset:!0}).optional()}),G=t6({...S.shape,..._.shape,uri:rS(),description:ew(rS()),mimeType:ew(rS()),size:ew(eZ()),annotations:F.optional(),_meta:ew(ei({}))}),K=t6({...S.shape,..._.shape,uriTemplate:rS(),description:ew(rS()),mimeType:ew(rS()),annotations:F.optional(),_meta:ew(ei({}))}),W=A.extend({method:rC("resources/list")}),J=L.extend({resources:rT(G)}),B=A.extend({method:rC("resources/templates/list")}),Z=L.extend({resourceTemplates:rT(K)}),X=l.extend({uri:rS()}),Q=u.extend({method:rC("resources/read"),params:X}),Y=p.extend({contents:rT(ev([U,D]))}),ee=h.extend({method:rC("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:rC("resources/subscribe"),params:X}),er=u.extend({method:rC("resources/unsubscribe"),params:X}),eo=d.extend({uri:rS()}),ea=h.extend({method:rC("notifications/resources/updated"),params:eo}),es=t6({name:rS(),description:ew(rS()),required:ew(to())}),el=t6({...S.shape,..._.shape,description:ew(rS()),arguments:ew(rT(es)),_meta:ew(ei({}))}),ec=A.extend({method:rC("prompts/list")}),eu=L.extend({prompts:rT(el)}),eh=l.extend({name:rS(),arguments:tu(rS(),rS()).optional()}),ep=u.extend({method:rC("prompts/get"),params:eh}),em=t6({type:rC("text"),text:rS(),annotations:F.optional(),_meta:tu(rS(),ed()).optional()}),ef=t6({type:rC("image"),data:z,mimeType:rS(),annotations:F.optional(),_meta:tu(rS(),ed()).optional()}),ey=t6({type:rC("audio"),data:z,mimeType:rS(),annotations:F.optional(),_meta:tu(rS(),ed()).optional()}),eg=t6({type:rC("tool_use"),name:rS(),id:rS(),input:tu(rS(),ed()),_meta:tu(rS(),ed()).optional()}),e_=t6({type:rC("resource"),resource:ev([U,D]),annotations:F.optional(),_meta:tu(rS(),ed()).optional()}),e$=t6({role:H,content:eb=ev([em,ef,ey,eS=G.extend({type:rC("resource_link")}),e_])}),eP=p.extend({description:rS().optional(),messages:rT(e$)}),eE=h.extend({method:rC("notifications/prompts/list_changed"),params:d.optional()}),eC=t6({title:rS().optional(),readOnlyHint:to().optional(),destructiveHint:to().optional(),idempotentHint:to().optional(),openWorldHint:to().optional()}),eT=t6({taskSupport:en(["required","optional","forbidden"]).optional()}),ek=t6({...S.shape,..._.shape,description:rS().optional(),inputSchema:t6({type:rC("object"),properties:tu(rS(),t).optional(),required:rT(rS()).optional()}).catchall(ed()),outputSchema:t6({type:rC("object"),properties:tu(rS(),t).optional(),required:rT(rS()).optional()}).catchall(ed()).optional(),annotations:eC.optional(),execution:eT.optional(),_meta:tu(rS(),ed()).optional()}),eI=A.extend({method:rC("tools/list")}),ex=L.extend({tools:rT(ek)}),ej=p.extend({content:rT(eb),structuredContent:tu(rS(),ed()).optional(),isError:to().optional()}),eO=c.extend({name:rS(),arguments:tu(rS(),ed()).optional()}),eN=u.extend({method:rC("tools/call"),params:eO}),eq=h.extend({method:rC("notifications/tools/list_changed"),params:d.optional()}),eM=en(["debug","info","notice","warning","error","critical","alert","emergency"]),eA=l.extend({level:eM}),eL=u.extend({method:rC("logging/setLevel"),params:eA}),eV=d.extend({level:eM,logger:rS().optional(),data:ed()}),eU=h.extend({method:rC("notifications/message"),params:eV}),ez=t6({name:rS().optional()}),eD=t6({hints:rT(ez).optional(),costPriority:eZ().min(0).max(1).optional(),speedPriority:eZ().min(0).max(1).optional(),intelligencePriority:eZ().min(0).max(1).optional()}),eH=t6({mode:en(["auto","required","none"]).optional()}),eF=t6({type:rC("tool_result"),toolUseId:rS().describe("The unique identifier for the corresponding tool call."),content:rT(eb),structuredContent:t6({}).loose().optional(),isError:to().optional(),_meta:tu(rS(),ed()).optional()}),eG=tf("type",[em,ef,ey]),eW=t6({role:H,content:ev([eK=tf("type",[em,ef,ey,eg,eF]),rT(eK)]),_meta:tu(rS(),ed()).optional()}),eJ=c.extend({messages:rT(eW),modelPreferences:eD.optional(),systemPrompt:rS().optional(),includeContext:en(["none","thisServer","allServers"]).optional(),temperature:eZ().optional(),maxTokens:eZ().int(),stopSequences:rT(rS()).optional(),metadata:r.optional(),tools:rT(ek).optional(),toolChoice:eH.optional()}),eB=u.extend({method:rC("sampling/createMessage"),params:eJ}),eX=p.extend({model:rS(),stopReason:ew(en(["endTurn","stopSequence","maxTokens"]).or(rS())),role:H,content:eG}),eQ=p.extend({model:rS(),stopReason:ew(en(["endTurn","stopSequence","maxTokens","toolUse"]).or(rS())),role:H,content:ev([eK,rT(eK)])}),eY=t6({type:rC("boolean"),title:rS().optional(),description:rS().optional(),default:to().optional()}),e0=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),minLength:eZ().optional(),maxLength:eZ().optional(),format:en(["email","uri","date","date-time"]).optional(),default:rS().optional()}),e1=t6({type:en(["number","integer"]),title:rS().optional(),description:rS().optional(),minimum:eZ().optional(),maximum:eZ().optional(),default:eZ().optional()}),e2=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),enum:rT(rS()),default:rS().optional()}),e9=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),oneOf:rT(t6({const:rS(),title:rS()})),default:rS().optional()}),e4=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),enum:rT(rS()),enumNames:rT(rS()).optional(),default:rS().optional()}),e5=ev([e2,e9]),e3=t6({type:rC("array"),title:rS().optional(),description:rS().optional(),minItems:eZ().optional(),maxItems:eZ().optional(),items:t6({type:rC("string"),enum:rT(rS())}),default:rT(rS()).optional()}),e7=ev([e3,e6=t6({type:rC("array"),title:rS().optional(),description:rS().optional(),minItems:eZ().optional(),maxItems:eZ().optional(),items:t6({anyOf:rT(t6({const:rS(),title:rS()}))}),default:rT(rS()).optional()})]),e8=ev([e4,e5,e7]),te=ev([e8,eY,e0,e1]),tt=c.extend({mode:rC("form").optional(),message:rS(),requestedSchema:t6({type:rC("object"),properties:tu(rS(),te),required:rT(rS()).optional()}).catchall(ed())}),ta=ev([tt,tr=c.extend({mode:rC("url"),message:rS(),elicitationId:rS(),url:rS().url()})]),ts=u.extend({method:rC("elicitation/create"),params:ta}),ti=d.extend({elicitationId:rS()}),tn=h.extend({method:rC("notifications/elicitation/complete"),params:ti}),tl=p.extend({action:en(["accept","decline","cancel"]),content:ri(e=>null===e?void 0:e,tu(rS(),ev([rS(),eZ(),to(),rT(rS())])).optional())}),tc=t6({type:rC("ref/resource"),uri:rS()}),td=t6({type:rC("ref/prompt"),name:rS()}),th=l.extend({ref:ev([td,tc]),argument:t6({name:rS(),value:rS()}),context:t6({arguments:tu(rS(),rS()).optional()}).optional()}),tp=u.extend({method:rC("completion/complete"),params:th}),tm=p.extend({completion:ei({values:rT(rS()).max(100),total:ew(eZ().int()),hasMore:ew(to())})}),ty=t6({uri:rS().startsWith("file://"),name:rS().optional(),_meta:tu(rS(),ed()).optional()}),tv=u.extend({method:rC("roots/list"),params:l.optional()}),tg=p.extend({roots:rT(ty)}),t_=h.extend({method:rC("notifications/roots/list_changed"),params:d.optional()}),tS=ei({ttl:eZ().optional(),pollInterval:eZ().optional()}),tb=en(["working","input_required","completed","failed","cancelled"]),t$=t6({taskId:rS(),status:tb,ttl:ev([eZ(),tK()]),createdAt:rS(),lastUpdatedAt:rS(),pollInterval:ew(eZ()),statusMessage:ew(rS())}),tw=p.extend({task:t$}),tR=d.merge(t$),tP=h.extend({method:rC("notifications/tasks/status"),params:tR}),tE=u.extend({method:rC("tasks/get"),params:l.extend({taskId:rS()})}),tC=p.merge(t$),tT=u.extend({method:rC("tasks/result"),params:l.extend({taskId:rS()})}),tk=p.loose(),tI=A.extend({method:rC("tasks/list")}),tx=L.extend({tasks:rT(t$)}),tj=u.extend({method:rC("tasks/cancel"),params:l.extend({taskId:rS()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:o,CursorSchema:a,TaskMetadataSchema:s,RelatedTaskMetadataSchema:i,RequestMetaSchema:n,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:h,ResultSchema:p,RequestIdSchema:m,EmptyResultSchema:f,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:v,IconSchema:g,IconsSchema:_,BaseMetadataSchema:S,ImplementationSchema:b,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:P,ClientCapabilitiesSchema:E,InitializeRequestParamsSchema:C,InitializeRequestSchema:T,ServerCapabilitiesSchema:k,InitializeResultSchema:I,InitializedNotificationSchema:x,PingRequestSchema:j,ProgressSchema:O,ProgressNotificationParamsSchema:N,ProgressNotificationSchema:q,PaginatedRequestParamsSchema:M,PaginatedRequestSchema:A,PaginatedResultSchema:L,ResourceContentsSchema:V,TextResourceContentsSchema:U,BlobResourceContentsSchema:D,RoleSchema:H,AnnotationsSchema:F,ResourceSchema:G,ResourceTemplateSchema:K,ListResourcesRequestSchema:W,ListResourcesResultSchema:J,ListResourceTemplatesRequestSchema:B,ListResourceTemplatesResultSchema:Z,ResourceRequestParamsSchema:X,ReadResourceRequestParamsSchema:X,ReadResourceRequestSchema:Q,ReadResourceResultSchema:Y,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:X,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:X,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:eo,ResourceUpdatedNotificationSchema:ea,PromptArgumentSchema:es,PromptSchema:el,ListPromptsRequestSchema:ec,ListPromptsResultSchema:eu,GetPromptRequestParamsSchema:eh,GetPromptRequestSchema:ep,TextContentSchema:em,ImageContentSchema:ef,AudioContentSchema:ey,ToolUseContentSchema:eg,EmbeddedResourceSchema:e_,ResourceLinkSchema:eS,ContentBlockSchema:eb,PromptMessageSchema:e$,GetPromptResultSchema:eP,PromptListChangedNotificationSchema:eE,ToolAnnotationsSchema:eC,ToolExecutionSchema:eT,ToolSchema:ek,ListToolsRequestSchema:eI,ListToolsResultSchema:ex,CallToolResultSchema:ej,CallToolRequestParamsSchema:eO,CallToolRequestSchema:eN,ToolListChangedNotificationSchema:eq,LoggingLevelSchema:eM,SetLevelRequestParamsSchema:eA,SetLevelRequestSchema:eL,LoggingMessageNotificationParamsSchema:eV,LoggingMessageNotificationSchema:eU,ModelHintSchema:ez,ModelPreferencesSchema:eD,ToolChoiceSchema:eH,ToolResultContentSchema:eF,SamplingContentSchema:eG,SamplingMessageContentBlockSchema:eK,SamplingMessageSchema:eW,CreateMessageRequestParamsSchema:eJ,CreateMessageRequestSchema:eB,CreateMessageResultSchema:eX,CreateMessageResultWithToolsSchema:eQ,BooleanSchemaSchema:eY,StringSchemaSchema:e0,NumberSchemaSchema:e1,UntitledSingleSelectEnumSchemaSchema:e2,TitledSingleSelectEnumSchemaSchema:e9,LegacyTitledEnumSchemaSchema:e4,SingleSelectEnumSchemaSchema:e5,UntitledMultiSelectEnumSchemaSchema:e3,TitledMultiSelectEnumSchemaSchema:e6,MultiSelectEnumSchemaSchema:e7,EnumSchemaSchema:e8,PrimitiveSchemaDefinitionSchema:te,ElicitRequestFormParamsSchema:tt,ElicitRequestURLParamsSchema:tr,ElicitRequestParamsSchema:ta,ElicitRequestSchema:ts,ElicitationCompleteNotificationParamsSchema:ti,ElicitationCompleteNotificationSchema:tn,ElicitResultSchema:tl,ResourceTemplateReferenceSchema:tc,PromptReferenceSchema:td,CompleteRequestParamsSchema:th,CompleteRequestSchema:tp,CompleteResultSchema:tm,RootSchema:ty,ListRootsRequestSchema:tv,ListRootsResultSchema:tg,RootsListChangedNotificationSchema:t_,TaskCreationParamsSchema:tS,TaskStatusSchema:tb,TaskSchema:t$,CreateTaskResultSchema:tw,TaskStatusNotificationParamsSchema:tR,TaskStatusNotificationSchema:tP,GetTaskRequestSchema:tE,GetTaskResultSchema:tC,GetTaskPayloadRequestSchema:tT,GetTaskPayloadResultSchema:tk,ListTasksRequestSchema:tI,ListTasksResultSchema:tx,CancelTaskRequestSchema:tj,CancelTaskResultSchema:p.merge(t$),ClientRequestSchema:ev([j,T,tp,eL,ep,ec,W,B,Q,et,er,eN,eI,tE,tT,tI,tj]),ClientNotificationSchema:ev([v,q,x,t_,tP]),ClientResultSchema:ev([f,eX,eQ,tl,tg,tC,tx,tw]),ServerRequestSchema:ev([j,eB,ts,tv,tE,tT,tI,tj]),ServerNotificationSchema:ev([v,q,eU,ea,ee,eq,eE,tP,tn]),ServerResultSchema:ev([f,I,tm,eP,eu,J,Z,Y,ej,ex,tC,tx,tw]),CallToolResultWireSchema:ed().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of ot)if(r in e)return void t.addIssue({code:"custom",message:`content is required when the body carries '${r}' — another result family cannot default into an empty tools/call success`})}}).transform(or).pipe(ej)})}function oa(e){return"object"!==e.type}let os=new Set(["const","enum","default","examples"]),oi=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function on(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let ol={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},oc={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},ou={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};function od(){if(t)return t;let e=oo();return t={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}}}function oh(e){return Object.prototype.hasOwnProperty.call(ol,e)}function op(e){return Object.prototype.hasOwnProperty.call(oc,e)}function om(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function of(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(ol),Object.keys(oc);let oy={ok:!1,reason:"not-in-era"};function ov(e){return om(e)&&om(e.outputSchema)&&oa(e.outputSchema)}let og={era:"2025-11-25",hasRequestMethod:oh,hasNotificationMethod:op,validateRequest:(e,t)=>of(oh(e)?od().requestSchemas[e]:void 0,t),validateResult:(e,t)=>of(Object.prototype.hasOwnProperty.call(ou,e)?od().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>of(op(e)?od().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>oy,validateInputResponse:()=>oy,samplingResultVariant:(e,t)=>{let r=oo();return of(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=oe(e),o=r.structuredContent;if(void 0===o)return r;let a="object"!=typeof o||null===o||Array.isArray(o),s=void 0!==t&&oa(t);return a||s?{...r,structuredContent:{result:o}}:r},decodeResult(e,t){if(om(t)&&"resultType"in t){let e={...t};return delete e.resultType,{kind:"complete",result:e}}return{kind:"complete",result:t}},encodeResult(e,t){if("tools/list"!==e)return t;let r=t.tools;return Array.isArray(r)&&r.some(e=>ov(e))?{...t,tools:r.map(e=>ov(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(on(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let o="string"==typeof(t=e.$schema)&&rB.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,a=(e,t)=>{if(Array.isArray(e))return e.map(e=>a(e,!1));if(null===e||"object"!=typeof e||!t&&on(e.$id))return e;let r={},s=!1;for(let[i,n]of Object.entries(e))t?r[i]=a(n,!1):("$ref"===i||"$dynamicRef"===i)&&"string"==typeof n?r[i]="#"===n?"#/properties/result":n.startsWith("#/")?`#/properties/result${n.slice(1)}`:n:"$recursiveRef"===i&&"#"===n&&o?s=!0:os.has(i)?r[i]=n:oi.has(i)?r[i]=a(n,!0):r[i]=a(n,!1);return s&&("$ref"in r?r.allOf=[...Array.isArray(r.allOf)?r.allOf:[],{$ref:"#/properties/result"}]:r.$ref="#/properties/result"),r};return{...void 0!==r&&{$schema:r},type:"object",properties:{result:a(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function o_(){return r??=function(){let e=eR(()=>ev([rS(),eZ(),to(),tK(),tu(rS(),e),rT(e)])),t=tu(rS(),e),r=ev([rS(),eZ().int()]),o=rS(),a=ev([rS(),eZ().int()]),s=en(["user","assistant"]),i=en(["debug","info","notice","warning","error","critical","alert","emergency"]),n=rS().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=t6({ttl:eZ().optional()}),c=t6({taskId:rS()}),u=ei({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=t6({_meta:u.optional()}),h=d.extend({task:l.optional()}),p=t6({_meta:u.optional()}),m=t6({method:rS(),params:p.loose().optional()}),f=t6({src:rS(),mimeType:rS().optional(),sizes:rT(rS()).optional(),theme:en(["light","dark"]).optional()}),y=t6({icons:rT(f).optional()}),v=t6({name:rS(),title:rS().optional()}),_=v.extend({...v.shape,...y.shape,version:rS(),websiteUrl:rS().optional(),description:rS().optional()}),S=rr(t6({applyDefaults:to().optional()}),t),b=ri(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,rr(t6({form:S.optional(),url:t.optional()}),t.optional())),$=ei({list:t.optional(),cancel:t.optional(),requests:ei({sampling:ei({createMessage:t.optional()}).optional(),elicitation:ei({create:t.optional()}).optional()}).optional()}),w=ei({list:t.optional(),cancel:t.optional(),requests:ei({tools:ei({call:t.optional()}).optional()}).optional()}),R=t6({experimental:tu(rS(),t).optional(),sampling:t6({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:t6({listChanged:to().optional()}).optional(),tasks:$.optional(),extensions:tu(rS(),t).optional()}),P=t6({experimental:tu(rS(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:t6({listChanged:to().optional()}).optional(),resources:t6({subscribe:to().optional(),listChanged:to().optional()}).optional(),tools:t6({listChanged:to().optional()}).optional(),tasks:w.optional(),extensions:tu(rS(),t).optional()}),E=t6({progress:eZ(),total:ew(eZ()),message:ew(rS())}),T=t6({...p.shape,...E.shape,progressToken:r}),k=m.extend({method:rC("notifications/progress"),params:T}),I=p.extend({level:i,logger:rS().optional(),data:ed()}),x=m.extend({method:rC("notifications/message"),params:I}),j=t6({uri:rS(),mimeType:ew(rS()),_meta:tu(rS(),ed()).optional()}),O=j.extend({text:rS()}),N=j.extend({blob:n}),q=t6({audience:rT(s).optional(),priority:eZ().min(0).max(1).optional(),lastModified:rb({offset:!0}).optional()}),M=t6({...v.shape,...y.shape,uri:rS(),description:ew(rS()),mimeType:ew(rS()),size:ew(eZ()),annotations:q.optional(),_meta:ew(ei({}))}),A=t6({...v.shape,...y.shape,uriTemplate:rS(),description:ew(rS()),mimeType:ew(rS()),annotations:q.optional(),_meta:ew(ei({}))}),L=m.extend({method:rC("notifications/resources/list_changed"),params:p.optional()}),V=p.extend({uri:rS()}),U=m.extend({method:rC("notifications/resources/updated"),params:V}),z=t6({name:rS(),description:ew(rS()),required:ew(to())}),D=t6({...v.shape,...y.shape,description:ew(rS()),arguments:ew(rT(z)),_meta:ew(ei({}))}),H=m.extend({method:rC("notifications/prompts/list_changed"),params:p.optional()}),F=t6({type:rC("text"),text:rS(),annotations:q.optional(),_meta:tu(rS(),ed()).optional()}),G=t6({type:rC("image"),data:n,mimeType:rS(),annotations:q.optional(),_meta:tu(rS(),ed()).optional()}),K=t6({type:rC("audio"),data:n,mimeType:rS(),annotations:q.optional(),_meta:tu(rS(),ed()).optional()}),W=t6({type:rC("tool_use"),name:rS(),id:rS(),input:tu(rS(),ed()),_meta:tu(rS(),ed()).optional()}),J=t6({type:rC("resource"),resource:ev([O,N]),annotations:q.optional(),_meta:tu(rS(),ed()).optional()}),B=M.extend({type:rC("resource_link")}),Z=ev([F,G,K,B,J]),X=t6({role:s,content:Z}),Q=t6({title:rS().optional(),readOnlyHint:to().optional(),destructiveHint:to().optional(),idempotentHint:to().optional(),openWorldHint:to().optional()}),Y=m.extend({method:rC("notifications/tools/list_changed"),params:p.optional()}),ee=t6({name:rS().optional()}),et=t6({hints:rT(ee).optional(),costPriority:eZ().min(0).max(1).optional(),speedPriority:eZ().min(0).max(1).optional(),intelligencePriority:eZ().min(0).max(1).optional()}),er=t6({mode:en(["auto","required","none"]).optional()}),eo=t6({type:rC("boolean"),title:rS().optional(),description:rS().optional(),default:to().optional()}),ea=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),minLength:eZ().optional(),maxLength:eZ().optional(),format:en(["email","uri","date","date-time"]).optional(),default:rS().optional()}),es=t6({type:en(["number","integer"]),title:rS().optional(),description:rS().optional(),minimum:eZ().optional(),maximum:eZ().optional(),default:eZ().optional()}),el=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),enum:rT(rS()),default:rS().optional()}),ec=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),oneOf:rT(t6({const:rS(),title:rS()})),default:rS().optional()}),eu=t6({type:rC("string"),title:rS().optional(),description:rS().optional(),enum:rT(rS()),enumNames:rT(rS()).optional(),default:rS().optional()}),eh=ev([el,ec]),ep=t6({type:rC("array"),title:rS().optional(),description:rS().optional(),minItems:eZ().optional(),maxItems:eZ().optional(),items:t6({type:rC("string"),enum:rT(rS())}),default:rT(rS()).optional()}),em=t6({type:rC("array"),title:rS().optional(),description:rS().optional(),minItems:eZ().optional(),maxItems:eZ().optional(),items:t6({anyOf:rT(t6({const:rS(),title:rS()}))}),default:rT(rS()).optional()}),ef=ev([ep,em]),ey=ev([eu,eh,ef]),eg=ev([ey,eo,ea,es]),e_=h.extend({mode:rC("form").optional(),message:rS(),requestedSchema:t6({type:rC("object"),properties:tu(rS(),eg),required:rT(rS()).optional()}).catchall(ed())}),eS=t6({type:rC("ref/resource"),uri:rS()}),eb=t6({type:rC("ref/prompt"),name:rS()}),e$=t6({uri:rS().startsWith("file://"),name:rS().optional(),_meta:tu(rS(),ed()).optional()}),eP=R.shape,eE=t6({experimental:eP.experimental,sampling:eP.sampling,elicitation:eP.elicitation,roots:eP.roots,extensions:eP.extensions}),eC=P.shape,eT=t6({experimental:eC.experimental,logging:eC.logging,completions:eC.completions,prompts:eC.prompts,resources:eC.resources,tools:eC.tools,extensions:eC.extensions}),ek=ei({progressToken:r.optional(),[g]:rS(),[C]:_.optional(),[ex]:eE,[t1]:i.optional()}),eI=t6({...v.shape,...y.shape,description:rS().optional(),inputSchema:ei({$schema:rS().optional(),type:rC("object")}),outputSchema:ei({$schema:rS().optional()}).optional(),annotations:Q.optional(),_meta:tu(rS(),ed()).optional()}),ej=t6({type:rC("tool_result"),toolUseId:rS(),content:rT(Z),structuredContent:ed().optional(),isError:to().optional(),_meta:tu(rS(),ed()).optional()}),eO=ev([F,G,K,W,ej]),eN=t6({role:s,content:ev([eO,rT(eO)]),_meta:tu(rS(),ed()).optional()}),eq=rS(),eM=ei({[tz]:_.optional().catch(void 0)}),eA=eM.optional();function eL(e){return ei({_meta:eA,resultType:eq.default("complete"),...e})}let eV=eL({}),eU=eL({nextCursor:o.optional()}),ez=eL({content:rT(Z),structuredContent:ed().optional(),isError:to().optional()}),eD=eL({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),tools:rT(eI),nextCursor:o.optional()}),eH=eL({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),prompts:rT(D),nextCursor:o.optional()}),eF=eL({description:rS().optional(),messages:rT(X)}),eG=eL({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),resources:rT(M),nextCursor:o.optional()}),eK=eL({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),resourceTemplates:rT(A),nextCursor:o.optional()}),eW=eL({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),contents:rT(ev([O,N]))}),eJ=eL({completion:t6({values:rT(rS()).max(100),total:eZ().int().optional(),hasMore:to().optional()}).loose()}),eB=eL({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"])}),eX=eL({ttlMs:eZ().int().min(0).catch(0),cacheScope:en(["public","private"]).catch("private"),supportedVersions:rT(rS()),capabilities:eT,instructions:rS().optional()}),eQ=t6({messages:rT(eN),modelPreferences:et.optional(),systemPrompt:rS().optional(),includeContext:en(["none","thisServer","allServers"]).optional(),temperature:eZ().optional(),maxTokens:eZ().int(),stopSequences:rT(rS()).optional(),metadata:t.optional(),tools:rT(eI).optional(),toolChoice:er.optional()}),eY=t6({method:rC("sampling/createMessage"),params:eQ}),e0=t6({method:rC("roots/list"),params:t6({_meta:tu(rS(),ed()).optional()}).optional()}),e1=t6({...eN.shape,model:rS(),stopReason:rS().optional()}),e2=t6({roots:rT(e$)}),e9=t6({action:en(["accept","decline","cancel"]),content:tu(rS(),ev([rS(),eZ(),to(),rT(rS())])).optional()}),e4=t6({mode:rC("url"),message:rS(),url:rS().url()}),e5=ev([e_,e4]),e3=t6({method:rC("elicitation/create"),params:e5}),e6=ev([eY,e0,e3]),e7=ev([e1,e2,e9]),e8=tu(rS(),e6),te=tu(rS(),e7),tt=eL({inputRequests:e8.optional(),requestState:rS().optional()}),tr={inputResponses:te.optional(),requestState:rS().optional()},ta=t6({_meta:ek,...tr}),ts=ei({progressToken:r.optional()});function ti(e,t){return t6({method:rC(e),params:t6({_meta:ek,...t})})}function tn(e,t){return t6({method:rC(e),params:t6({_meta:ts.optional(),...t}).optional()})}let tl={name:rS(),arguments:tu(rS(),ed()).optional(),...tr},tc={cursor:o.optional()},td=ti("tools/call",tl),th=ti("tools/list",tc),tp=ti("prompts/list",tc),tm=ti("prompts/get",{name:rS(),arguments:tu(rS(),rS()).optional(),...tr}),tf=ti("resources/list",tc),ty=ti("resources/templates/list",tc),tv=ti("resources/read",{uri:rS(),...tr}),tg={ref:ev([eb,eS]),argument:t6({name:rS(),value:rS()}),context:t6({arguments:tu(rS(),rS()).optional()}).optional()},t_=ti("completion/complete",tg),tS=ti("server/discover",{}),tb=t6({toolsListChanged:to().optional(),promptsListChanged:to().optional(),resourcesListChanged:to().optional(),resourceSubscriptions:rT(rS()).optional()}),t$={notifications:tb},tw=ti("subscriptions/listen",t$),tR=eM.extend({"io.modelcontextprotocol/subscriptionId":a}),tP=ei({_meta:tR,resultType:eq.default("complete")}),tE={"tools/call":tn("tools/call",tl),"tools/list":tn("tools/list",tc),"prompts/get":tn("prompts/get",{name:rS(),arguments:tu(rS(),rS()).optional()}),"prompts/list":tn("prompts/list",tc),"resources/list":tn("resources/list",tc),"resources/templates/list":tn("resources/templates/list",tc),"resources/read":tn("resources/read",{uri:rS()}),"completion/complete":tn("completion/complete",tg),"server/discover":tn("server/discover",{}),"subscriptions/listen":tn("subscriptions/listen",t$)};function tC(e){return ei({_meta:eA,...e})}let tT={"tools/call":tC({content:rT(Z),structuredContent:ed().optional(),isError:to().optional()}),"tools/list":tC({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),tools:rT(eI),nextCursor:o.optional()}),"prompts/get":tC({description:rS().optional(),messages:rT(X)}),"prompts/list":tC({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),prompts:rT(D),nextCursor:o.optional()}),"resources/list":tC({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),resources:rT(M),nextCursor:o.optional()}),"resources/templates/list":tC({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),resourceTemplates:rT(A),nextCursor:o.optional()}),"resources/read":tC({ttlMs:eZ().int().min(0),cacheScope:en(["public","private"]),contents:rT(ev([O,N]))}),"completion/complete":tC({completion:t6({values:rT(rS()).max(100),total:eZ().int().optional(),hasMore:to().optional()}).loose()}),"server/discover":tC({ttlMs:eZ().int().min(0).catch(0),cacheScope:en(["public","private"]).catch("private"),supportedVersions:rT(rS()),capabilities:eT,instructions:rS().optional()}),"subscriptions/listen":tC({})},tk=ei({"io.modelcontextprotocol/subscriptionId":a.optional()}),tI=t6({method:rC("notifications/subscriptions/acknowledged"),params:t6({_meta:tk.optional(),notifications:tb})}),tx=t6({_meta:tk.optional(),requestId:a,reason:rS().optional()}),tj=t6({method:rC("notifications/cancelled"),params:tx}),tO=e=>t6({jsonrpc:rC("2.0"),id:ev([rS(),eZ().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:a,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:f,IconsSchema:y,BaseMetadataSchema:v,ImplementationSchema:_,ClientTasksCapabilitySchema:$,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:R,ServerCapabilitiesSchema:P,ProgressSchema:E,ProgressNotificationParamsSchema:T,ProgressNotificationSchema:k,LoggingMessageNotificationParamsSchema:I,LoggingMessageNotificationSchema:x,ResourceContentsSchema:j,TextResourceContentsSchema:O,BlobResourceContentsSchema:N,AnnotationsSchema:q,ResourceSchema:M,ResourceTemplateSchema:A,ResourceListChangedNotificationSchema:L,ResourceUpdatedNotificationParamsSchema:V,ResourceUpdatedNotificationSchema:U,PromptArgumentSchema:z,PromptSchema:D,PromptListChangedNotificationSchema:H,TextContentSchema:F,ImageContentSchema:G,AudioContentSchema:K,ToolUseContentSchema:W,EmbeddedResourceSchema:J,ResourceLinkSchema:B,ContentBlockSchema:Z,PromptMessageSchema:X,ToolAnnotationsSchema:Q,ToolListChangedNotificationSchema:Y,ModelHintSchema:ee,ModelPreferencesSchema:et,ToolChoiceSchema:er,BooleanSchemaSchema:eo,StringSchemaSchema:ea,NumberSchemaSchema:es,UntitledSingleSelectEnumSchemaSchema:el,TitledSingleSelectEnumSchemaSchema:ec,LegacyTitledEnumSchemaSchema:eu,SingleSelectEnumSchemaSchema:eh,UntitledMultiSelectEnumSchemaSchema:ep,TitledMultiSelectEnumSchemaSchema:em,MultiSelectEnumSchemaSchema:ef,EnumSchemaSchema:ey,PrimitiveSchemaDefinitionSchema:eg,ElicitRequestFormParamsSchema:e_,ResourceTemplateReferenceSchema:eS,PromptReferenceSchema:eb,RootSchema:e$,ClientCapabilities2026Schema:eE,ServerCapabilities2026Schema:eT,RequestMetaEnvelopeSchema:ek,ToolSchema:eI,ToolResultContentSchema:ej,SamplingMessageContentBlockSchema:eO,SamplingMessageSchema:eN,ResultTypeSchema:eq,ResultMetaSchema:eM,ResultSchema:eV,PaginatedResultSchema:eU,CallToolResultSchema:ez,ListToolsResultSchema:eD,ListPromptsResultSchema:eH,GetPromptResultSchema:eF,ListResourcesResultSchema:eG,ListResourceTemplatesResultSchema:eK,ReadResourceResultSchema:eW,CompleteResultSchema:eJ,CacheableResultSchema:eB,DiscoverResultSchema:eX,CreateMessageRequestParamsSchema:eQ,CreateMessageRequestSchema:eY,ListRootsRequestSchema:e0,CreateMessageResultSchema:e1,ListRootsResultSchema:e2,ElicitResultSchema:e9,ElicitRequestURLParamsSchema:e4,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e3,InputRequestSchema:e6,InputResponseSchema:e7,InputRequestsSchema:e8,InputResponsesSchema:te,InputRequiredResultSchema:tt,InputResponseRequestParamsSchema:ta,CallToolRequestSchema:td,ListToolsRequestSchema:th,ListPromptsRequestSchema:tp,GetPromptRequestSchema:tm,ListResourcesRequestSchema:tf,ListResourceTemplatesRequestSchema:ty,ReadResourceRequestSchema:tv,CompleteRequestSchema:t_,DiscoverRequestSchema:tS,SubscriptionFilterSchema:tb,SubscriptionsListenRequestSchema:tw,SubscriptionsListenResultMetaSchema:tR,SubscriptionsListenResultSchema:tP,dispatchRequestSchemas:tE,dispatchResultSchemas:tT,NotificationMetaSchema:tk,SubscriptionsAcknowledgedNotificationSchema:tI,CancelledNotificationParamsSchema:tx,CancelledNotificationSchema:tj,notificationSchemas2026:{"notifications/cancelled":tj,"notifications/progress":k,"notifications/message":x,"notifications/resources/updated":U,"notifications/resources/list_changed":L,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":H,"notifications/subscriptions/acknowledged":tI},JSONRPCResultResponseSchema:tO(eV),CallToolResultResponseSchema:tO(ev([ez,tt])),ListToolsResultResponseSchema:tO(eD),ListPromptsResultResponseSchema:tO(eH),GetPromptResultResponseSchema:tO(ev([eF,tt])),ListResourcesResultResponseSchema:tO(eG),ListResourceTemplatesResultResponseSchema:tO(eK),ReadResourceResultResponseSchema:tO(ev([eW,tt])),CompleteResultResponseSchema:tO(eJ),DiscoverResultResponseSchema:tO(eX)}}()}let oS=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],ob=Symbol("modelcontextprotocol.resultCacheHintFallback");function o$(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function ow(e){return"public"===e||"private"===e}let oR=((iP={})[iP.ParseError=-32700]="ParseError",iP[iP.InvalidRequest=-32600]="InvalidRequest",iP[iP.MethodNotFound=-32601]="MethodNotFound",iP[iP.InvalidParams=-32602]="InvalidParams",iP[iP.InternalError=-32603]="InternalError",iP[iP.ResourceNotFound=-32002]="ResourceNotFound",iP[iP.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",iP[iP.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",iP[iP.UrlElicitationRequired=-32042]="UrlElicitationRequired",iP);var oP=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",rY(this,new.target)}static fromError(t,r,o){return t===oR.UrlElicitationRequired&&o&&o.elicitations?new oC(o.elicitations,r):t===oR.UnsupportedProtocolVersion&&o&&Array.isArray(o.supported)&&"string"==typeof o.requested?new oT({supported:o.supported,requested:o.requested},r):(t===oR.InvalidParams||t===oR.ResourceNotFound)&&"string"==typeof o?.uri&&(t===oR.ResourceNotFound||1===Object.keys(o).length)?new oE(o.uri,r):t===oR.MissingRequiredClientCapability&&o&&null!==o.requiredCapabilities&&"object"==typeof o.requiredCapabilities&&!Array.isArray(o.requiredCapabilities)?new ok({requiredCapabilities:o.requiredCapabilities},r):new e(t,r,o)}},oE=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(oR.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},oC=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(oR.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},oT=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(oR.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ok=class extends oP{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(oR.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let oI=["tools/call","prompts/get","resources/read"],ox=["elicitation/create","sampling/createMessage","roots/list"];function oj(){if(o)return o;let e=o_();return o={request:{"elicitation/create":t6({method:rC("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":t6({method:rC("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":t6({method:rC("roots/list"),params:ei({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function oO(e){return ox.includes(e)}function oN(e){return oO(e)?oj().request[e]:void 0}let oq={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},oM={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function oA(e){return Object.prototype.hasOwnProperty.call(oq,e)}function oL(e){return Object.prototype.hasOwnProperty.call(oM,e)}function oV(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function oU(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(oq),Object.keys(oM);let oz={ok:!1,reason:"not-in-era"},oD=[g,ex],oH={era:"2026-07-28",hasRequestMethod:oA,hasNotificationMethod:oL,hasInputRequestMethod:e=>void 0!==oN(e),validateRequest:(e,t)=>oU(oA(e)?o_().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>oU(Object.prototype.hasOwnProperty.call(oq,e)?o_().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>oU(oL(e)?o_().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>oU(oN(e),t),validateInputResponse:(e,t)=>oU(oO(e)?oj().response[e]:void 0,t),samplingResultVariant:()=>oz,outboundEnvelope:e=>({[g]:e.protocolVersion,[C]:e.clientInfo,[ex]:e.clientCapabilities,...void 0!==e.logLevel&&{[t1]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of oD)r in e||t.push({key:r,problem:"missing"});let r=o_().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let e of r.error.issues){let r=e.path.map(String),o=r.length>0?r.join("."):"_meta";1===r.length&&t.some(e=>e.key===o&&"missing"===e.problem)||t.push({key:o,problem:e.message})}return t},projectCallToolResult:e=>oe(e),inputRequestSchema:oN,decodeResult(e,t){if(!oV(t))return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if("string"!=typeof r)return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,o=oV(r)?r:{},a=t.requestState;return 0===Object.keys(o).length&&"string"!=typeof a?{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:o,..."string"==typeof a&&{requestState:a}}}if("complete"!==r)return{kind:"invalid",error:new r4(r9.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=function(){if(a)return a;let e=o_();return a={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema}}(),s=Object.hasOwn(o,e)?o[e]:void 0;if(void 0!==s){let r=s.safeParse(t);if(!r.success)return{kind:"invalid",error:new r4(r9.InvalidResult,`Invalid result for ${e}: ${r.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult:(e,t,r)=>(function(e,t){if(void 0===t)return e;let r=e._meta;return void 0===r?{...e,_meta:{[tz]:t}}:null===r||"object"!=typeof r||Array.isArray(r)||void 0!==r[tz]?e:{...e,_meta:{...r,[tz]:t}}})(function(e,t){var r,o;let a=t[ob];if("complete"!==t.resultType||!oS.includes(e)){let e;return void 0===a?t:(e={...t},delete e[ob],e)}let s=o$(t.ttlMs)?t.ttlMs:void 0!==(r=a)&&o$(r.ttlMs)?r.ttlMs:0,i=ow(t.cacheScope)?t.cacheScope:void 0!==(o=a)&&ow(o.cacheScope)?o.cacheScope:"private",n={...t,ttlMs:s,cacheScope:i};return delete n[ob],n}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||oI.includes(e))return t;throw new oP(oR.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}(e,function(e,t){let r=t,o=!1,a=()=>(o||(r={...r},o=!0),r),s=t.tools;"tools/list"===e&&Array.isArray(s)&&s.some(e=>oV(e)&&"execution"in e)&&(a().tools=s.map(e=>{if(!oV(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let i=t.capabilities;if(oV(i)&&"tasks"in i){let e={...i};delete e.tasks,a().capabilities=e}return r}(e,t))),r),encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope(e){if(void 0===e.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=o_().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join("; ")}`}},oF="2026-07-28";function oG(e){return void 0!==e&&e>=r3?oH:og}function oK(e){return void 0!==e.revision?oG(e.revision).era:"modern"===e.era?oH.era:og.era}function oW(e){return oB.some(t=>t.hasRequestMethod(e))}function oJ(e){return oB.some(t=>t.hasNotificationMethod(e))}let oB=[og,oH];var oZ=(e=>{let t={};for(var r in e)rz(t,r,{get:e[r],enumerable:!0});return t})({AnnotationsSchema:()=>rE,AudioContentSchema:()=>ty,BaseMetadataSchema:()=>tD,BaseRequestParamsSchema:()=>eg,BlobResourceContentsSchema:()=>eF,BooleanSchemaSchema:()=>eI,CallToolRequestParamsSchema:()=>t7,CallToolRequestSchema:()=>rs,CallToolResultSchema:()=>eO,CancelTaskRequestSchema:()=>E,CancelTaskResultSchema:()=>th,CancelledNotificationParamsSchema:()=>rx,CancelledNotificationSchema:()=>eL,ClientCapabilitiesSchema:()=>q,ClientNotificationSchema:()=>tk,ClientRequestSchema:()=>e5,ClientResultSchema:()=>_,ClientTasksCapabilitySchema:()=>tM,CompatibilityCallToolResultSchema:()=>tj,CompleteRequestParamsSchema:()=>rj,CompleteRequestSchema:()=>j,CompleteResultSchema:()=>x,ContentBlockSchema:()=>rR,CreateMessageRequestParamsSchema:()=>h,CreateMessageRequestSchema:()=>eD,CreateMessageResultSchema:()=>X,CreateMessageResultWithToolsSchema:()=>Y,CreateTaskResultSchema:()=>ef,CursorSchema:()=>ee,DiscoverRequestSchema:()=>O,DiscoverResultSchema:()=>R,ElicitRequestFormParamsSchema:()=>ej,ElicitRequestParamsSchema:()=>tc,ElicitRequestSchema:()=>td,ElicitRequestURLParamsSchema:()=>tn,ElicitResultSchema:()=>Z,ElicitationCompleteNotificationParamsSchema:()=>tG,ElicitationCompleteNotificationSchema:()=>rP,EmbeddedResourceSchema:()=>eU,EmptyResultSchema:()=>L,EnumSchemaSchema:()=>tv,GetPromptRequestParamsSchema:()=>tW,GetPromptRequestSchema:()=>ry,GetPromptResultSchema:()=>tR,GetTaskPayloadRequestSchema:()=>tU,GetTaskPayloadResultSchema:()=>N,GetTaskRequestSchema:()=>e$,GetTaskResultSchema:()=>rI,IconSchema:()=>eo,IconsSchema:()=>tp,ImageContentSchema:()=>ta,ImplementationSchema:()=>tO,InitializeRequestParamsSchema:()=>tm,InitializeRequestSchema:()=>p,InitializeResultSchema:()=>eY,InitializedNotificationSchema:()=>e2,JSONArraySchema:()=>eN,JSONObjectSchema:()=>T,JSONRPCErrorResponseSchema:()=>D,JSONRPCMessageSchema:()=>eP,JSONRPCNotificationSchema:()=>U,JSONRPCRequestSchema:()=>eA,JSONRPCResponseSchema:()=>eX,JSONRPCResultResponseSchema:()=>ez,JSONValueSchema:()=>tB,LegacyTitledEnumSchemaSchema:()=>e_,ListChangedOptionsBaseSchema:()=>G,ListPromptsRequestSchema:()=>rL,ListPromptsResultSchema:()=>tg,ListResourceTemplatesRequestSchema:()=>tJ,ListResourceTemplatesResultSchema:()=>tH,ListResourcesRequestSchema:()=>tw,ListResourcesResultSchema:()=>m,ListRootsRequestSchema:()=>rd,ListRootsResultSchema:()=>tS,ListTasksRequestSchema:()=>eu,ListTasksResultSchema:()=>rp,ListToolsRequestSchema:()=>rw,ListToolsResultSchema:()=>re,LoggingLevelSchema:()=>tT,LoggingMessageNotificationParamsSchema:()=>f,LoggingMessageNotificationSchema:()=>t3,ModelHintSchema:()=>tN,ModelPreferencesSchema:()=>V,MultiSelectEnumSchemaSchema:()=>e9,NotificationSchema:()=>e1,NotificationsParamsSchema:()=>tb,NumberSchemaSchema:()=>ti,PaginatedRequestParamsSchema:()=>tx,PaginatedRequestSchema:()=>ey,PaginatedResultSchema:()=>e8,PingRequestSchema:()=>rO,PrimitiveSchemaDefinitionSchema:()=>tP,ProgressNotificationParamsSchema:()=>eb,ProgressNotificationSchema:()=>S,ProgressSchema:()=>k,ProgressTokenSchema:()=>tq,PromptArgumentSchema:()=>y,PromptListChangedNotificationSchema:()=>ek,PromptMessageSchema:()=>z,PromptReferenceSchema:()=>ea,PromptSchema:()=>tE,ReadResourceRequestParamsSchema:()=>B,ReadResourceRequestSchema:()=>rf,ReadResourceResultSchema:()=>tl,RelatedTaskMetadataSchema:()=>tC,RequestIdSchema:()=>rN,RequestMetaSchema:()=>rh,RequestSchema:()=>eQ,ResourceContentsSchema:()=>eC,ResourceLinkSchema:()=>Q,ResourceListChangedNotificationSchema:()=>ru,ResourceRequestParamsSchema:()=>rq,ResourceSchema:()=>ep,ResourceTemplateReferenceSchema:()=>eh,ResourceTemplateSchema:()=>I,ResourceUpdatedNotificationParamsSchema:()=>es,ResourceUpdatedNotificationSchema:()=>t2,ResultMetaObjectSchema:()=>t5,ResultSchema:()=>eH,RoleSchema:()=>e3,RootSchema:()=>rv,RootsListChangedNotificationSchema:()=>eG,SamplingContentSchema:()=>tr,SamplingMessageContentBlockSchema:()=>t$,SamplingMessageSchema:()=>eK,ServerCapabilitiesSchema:()=>rM,ServerNotificationSchema:()=>eW,ServerRequestSchema:()=>eV,ServerResultSchema:()=>eq,ServerTasksCapabilitySchema:()=>e4,SetLevelRequestParamsSchema:()=>F,SetLevelRequestSchema:()=>eT,SingleSelectEnumSchemaSchema:()=>v,StringSchemaSchema:()=>eB,SubscribeRequestParamsSchema:()=>eJ,SubscribeRequestSchema:()=>tZ,SubscriptionFilterSchema:()=>e0,SubscriptionsAcknowledgedNotificationParamsSchema:()=>tF,SubscriptionsAcknowledgedNotificationSchema:()=>tA,SubscriptionsListenRequestParamsSchema:()=>t0,SubscriptionsListenRequestSchema:()=>rg,SubscriptionsListenResultMetaSchema:()=>tX,SubscriptionsListenResultSchema:()=>w,TaskAugmentedRequestParamsSchema:()=>tL,TaskCreationParamsSchema:()=>rt,TaskMetadataSchema:()=>J,TaskSchema:()=>et,TaskStatusNotificationParamsSchema:()=>H,TaskStatusNotificationSchema:()=>P,TaskStatusSchema:()=>tQ,TextContentSchema:()=>ro,TextResourceContentsSchema:()=>K,TitledMultiSelectEnumSchemaSchema:()=>b,TitledSingleSelectEnumSchemaSchema:()=>eS,ToolAnnotationsSchema:()=>tY,ToolChoiceSchema:()=>e6,ToolExecutionSchema:()=>er,ToolListChangedNotificationSchema:()=>t_,ToolResultContentSchema:()=>W,ToolSchema:()=>e7,ToolUseContentSchema:()=>rl,UnsubscribeRequestParamsSchema:()=>tV,UnsubscribeRequestSchema:()=>t4,UntitledMultiSelectEnumSchemaSchema:()=>rA,UntitledSingleSelectEnumSchemaSchema:()=>te});let oX=e=>ez.safeParse(e).success,oQ=e=>D.safeParse(e).success,oY=e=>eX.safeParse(e).success,o0=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,o1="x-mcp-header",o2=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,o9=new Set(["string","integer","boolean","number"]);function o4(e){let t=[],r=new Map,o=(e,a,s)=>{if(null===e||"object"!=typeof e)return;if(o1 in e){if(!s||0===a.length)return`${o6(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let o=e[o1];if("string"!=typeof o||0===o.length)return`${o6(a)}: x-mcp-header MUST be a non-empty string`;if(!o2.test(o))return`${o6(a)}: x-mcp-header '${o}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let i="string"==typeof e.type?e.type:void 0;if(void 0===i||!o9.has(i))return`${o6(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${i??"<none>"}`;let n=o.toLowerCase(),l=r.get(n);if(void 0!==l)return`x-mcp-header '${o}' is not case-insensitively unique (also declared as '${l}')`;r.set(n,o),t.push({path:a,headerName:o,type:i})}let i=e.properties;if(null!==i&&"object"==typeof i)for(let[e,t]of Object.entries(i)){let r=o(t,[...a,e],s);if(void 0!==r)return r}for(let t of o5){let r=e[t];if(void 0!==r)for(let e of Array.isArray(r)?r:null!==r&&"object"==typeof r&&o3.has(t)?Object.values(r):[r]){let r=o(e,[...a,`<${t}>`],!1);if(void 0!==r)return r}}},a=o(e,[],!0);return void 0===a?{valid:!0,declarations:t}:{valid:!1,reason:a}}let o5=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],o3=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function o6(e){return 0===e.length?"<root>":e.join(".")}let o7="=?base64?";function o8(e){return!function(e){if(0===e.length||e.startsWith(o7)&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(9!==r&&(!(r>=32)||!(r<=126)))return!0}return!1}(e)?e:`${o7}${function(e){let t=new TextEncoder().encode(e),r="";for(let e of t)r+=String.fromCodePoint(e);return btoa(r)}(e)}?=`}function ae(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function at(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}oR.InvalidRequest,oR.UnsupportedProtocolVersion,oR.InvalidParams,oR.MethodNotFound,oR.InvalidParams,oR.MissingRequiredClientCapability,oR.ParseError,oR.InvalidRequest,oR.MethodNotFound,oR.UnsupportedProtocolVersion,oR.MissingRequiredClientCapability;let ar=!1,ao="draft-2020-12";async function aa(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(e=>e.path?.length?`${e.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${e.message}`:e.message).join(", ")}:{success:!0,data:r.value}}let as=/\\\.\\d\{(\d+)\}/;function ai(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let an=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function al(e){return an.has(e)||e.startsWith("x-")}let ac=new Set(["$schema",...Object.keys(ej.shape.requestedSchema.shape)]),au={string:ae([eB,te,eS,e_]),number:ae([ti]),integer:ae([ti]),boolean:ae([eI]),array:ae([rA,b])},ad=new Set(eB.shape.format.unwrap().options);async function ah(e){let{config:t,method:r,originalParams:o,requestOptions:a,hooks:s,signal:i}=e,n=e.flowStartedAt??Date.now(),l=e.firstPayload,c=0;for(;;){let e;if((c+=1)>t.maxRounds){var u;throw new r4(r9.InputRequiredRoundsExceeded,(u=t.maxRounds,`Multi-round-trip request '${r}' still required input after ${u} rounds (inputRequired.maxRounds)`),{rounds:t.maxRounds,lastResult:{inputRequests:l.inputRequests,...void 0!==l.requestState&&{requestState:l.requestState}}})}a.onprogress?.({progress:c,message:`Fulfilling input required by '${r}' (round ${c})`});let d=Object.entries(l.inputRequests??{});if(d.length>0){let t=function(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener("abort",r)}}(i);try{let r=await Promise.all(d.map(async([e,r])=>{try{return[e,await s.dispatchInputRequest(e,r,t.signal)]}catch(e){throw t.abort(e),e}}));e=Object.fromEntries(r)}finally{t.dispose()}}else await function(e){return new Promise((t,r)=>{if(e?.aborted)return void r(e.reason instanceof r4?e.reason:new r4(r9.RequestTimeout,String(e.reason)));let o=setTimeout(()=>{e?.removeEventListener("abort",a),t()},250),a=()=>{clearTimeout(o),r(e?.reason instanceof r4?e.reason:new r4(r9.RequestTimeout,String(e?.reason)))};e?.addEventListener("abort",a,{once:!0})})}(i);let h={...void 0!==a.timeout&&{timeout:a.timeout}};if(void 0!==a.maxTotalTimeout){let e=Date.now()-n,t=a.maxTotalTimeout-e;if(t<=0)throw new r4(r9.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:e});h.maxTotalTimeout=t}let p=await s.retry(function(e,t,r){let o=void 0!==t&&Object.keys(t).length>0;return o||void 0!==r?{...e,...o&&{inputResponses:t},...void 0!==r&&{requestState:r}}:e}(o,e,l.requestState),h);if(o0(p)){l={inputRequests:p.inputRequests??{},...void 0!==p.requestState&&{requestState:p.requestState}};continue}return p}}Object.assign(function(e){let t=void 0!==e.inputRequests&&Object.keys(e.inputRequests).length>0,r="string"==typeof e.requestState;if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==e.inputRequests&&{inputRequests:e.inputRequests},...void 0!==e.requestState&&{requestState:e.requestState}}},{elicit(e){try{return{method:"elicitation/create",params:function(e){var t;if(!at(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let r=e.requestedSchema["~standard"].vendor,o=function(e,t){let r={},o=[];for(let[a,s]of Object.entries(e))"properties"===a&&ai(s)?r[a]=Object.fromEntries(Object.entries(s).map(([e,r])=>[e,function(e,t,r,o){if(!ai(e))return e;let a="string"==typeof e.type&&Object.hasOwn(au,e.type)?au[e.type]:void 0;if(void 0===a)return e;let s={};for(let[n,l]of Object.entries(e))if(a.has(n)||al(n))s[n]=l;else if("pattern"===n&&"string"===e.type&&"string"==typeof e.format)if(ad.has(e.format)){var i;"string"==typeof l&&(i=e.format,"zod"!==r||(function(e,t){let r;switch(e){case"email":r=[t8()];break;case"uri":r=[tI()];break;case"date":r=[eM()];break;case"date-time":let o,a;o=as.exec(t),a=[void 0,-1,0],o&&a.push(Number(o[1])),r=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>a.map(r=>rb({local:e,offset:t,precision:r}))))}return new Set(r.map(e=>{let t;return t=rm(e,{target:ao,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(i,l).has(l))||o.push(`${t}.${n}`)}else s[n]=l;else o.push(`${t}.${n}`);return s}(r,`properties.${e}`,t,o)])):ac.has(a)?r[a]=s:al(a)||o.push(a);if(o.length>0)throw new oP(oR.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}(function(e){try{return function(e,t="input"){let r,o=e["~standard"];if(o.jsonSchema)r=o.jsonSchema[t]({target:ao});else if("zod"===o.vendor){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");ar||(ar=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=rm(e,{target:ao,io:t})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===t)return void 0!==r.type||!function e(t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;for(let r of["oneOf","anyOf","allOf"]){let o=t[r];if(Array.isArray(o)&&o.length>0)return o.every(t=>null!==t&&"object"==typeof t&&("object"===t.type||e(t)))}return!1}(r)?r:{type:"object",...r};if(void 0!==r.type&&"object"!==r.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new oP(oR.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),a=(t=ej.shape.requestedSchema,r_(t,o));if(!a.success)throw new oP(oR.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!ai(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!r_(tP,e).success).map(([e])=>`properties.${e}`);return r.length>0?r.join(", "):t}(o,a.error.message)}`);let s=function e(t,r,o=""){return Array.isArray(t)&&Array.isArray(r)?t.flatMap((t,a)=>e(t,r[a],`${o}[${a}]`)):ai(t)&&ai(r)?Object.entries(t).flatMap(([t,a])=>{let s=o?`${o}.${t}`:t;return Object.prototype.hasOwnProperty.call(r,t)?e(a,r[t],s):al(t)?[]:[s]}):[]}(o,a.data);if(s.length>0)throw new oP(oR.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);let i=(a.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(a.data.properties,e));if(i.length>0)throw new oP(oR.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:a.data}}(e)}}catch(e){throw e instanceof oP?TypeError(e.message,{cause:e}):e}},elicitUrl:e=>({method:"elicitation/create",params:{...e,mode:"url"}}),createMessage:e=>({method:"sampling/createMessage",params:e}),listRoots:()=>({method:"roots/list"})});let ap={},am={};function af(e,t){let r=e.slice(0,-6);ap[r]=t,am[r]=e=>t.safeParse(e).success}for(let e of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])af(e,oZ[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:ra,OAuthClientInformationFullSchema:ec,OAuthClientInformationSchema:ts,OAuthClientMetadataSchema:M,OAuthClientRegistrationErrorSchema:tt,OAuthErrorResponseSchema:A,OAuthMetadataSchema:rn,OAuthProtectedResourceMetadataSchema:r$,OAuthTokenRevocationRequestSchema:em,OAuthTokensSchema:rk,OpenIdProviderDiscoveryMetadataSchema:$,OpenIdProviderMetadataSchema:eE}))af(e,t);Object.freeze(ap);let ay=Object.freeze(am),av=[g,C,ex,t1],ag=["inputResponses","requestState"];function a_(e,t){let r=e.params;if(!aw(r))return{message:e,lifted:{}};let o=r._meta,a=aw(o)?av.filter(e=>e in o):[],s="request"===t?ag.filter(e=>e in r):[];if(0===a.length&&0===s.length)return{message:e,lifted:{}};let i={},n={...r};if(a.length>0&&aw(o)){let e={},t={...o};for(let r of a)e[r]=o[r],delete t[r];i.envelope=e,Object.keys(t).length>0?n._meta=t:delete n._meta}for(let e of s)"inputResponses"===e&&(i.inputResponses=n[e]),"requestState"===e&&(i.requestState=n[e]),delete n[e];return{message:{...e,params:n},lifted:i}}function aS(e,t){let r=e.validateResult(t,void 0);if(r.ok||"not-in-era"!==r.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let o=e.validateResult(t,r);return o.ok?{value:o.value}:{issues:[{message:"invalid"===o.reason?o.message:`not-in-era: ${t}`}]}}}}}let ab=(iE=void 0,()=>iE);var a$=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??t9,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(void 0===t)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new r4(r9.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new r4(r9.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let o=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(o?.(e,t),oX(e)||oQ(e))this._onresponse(e);else if(eA.safeParse(e).success)this._onrequest(e,t);else U.safeParse(e).success?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new r4(r9.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(r);for(let e of t.values())e.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=a_(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=oK(t.classification);if(e!==o.era)return void this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${e} but this instance serves ${o.era}`))}if(oJ(r.method)&&!o.hasNotificationMethod(r.method))return;let a=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;(void 0!==a||void 0!==s)&&Promise.resolve().then(()=>void 0===a?s(r):a(r,o)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r;let{message:o,lifted:a}=a_(e,"request"),s=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return void this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));let i=this._transport,n=(e,t,r)=>{let a={jsonrpc:"2.0",id:o.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};i?.send(a).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=oK(t.classification);if(e!==s.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${e} but this instance serves ${s.era}`));let r=t.classification.revision??e;n(oR.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(oW(o.method)&&!s.hasRequestMethod(o.method))return void n(oR.MethodNotFound,"Method not found");let l=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(void 0===l)return void n(oR.MethodNotFound,"Method not found");let c=s.checkInboundEnvelope(a);if(void 0!==c)return void n(oR.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:o.id}),d=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:o.id}),h=new AbortController;this._requestHandlerAbortControllers.set(o.id,h);let p=void 0===a.inputResponses?void 0:function(e){let t={},r=[];if(!aR(e))return{accepted:t,droppedKeys:r};for(let[o,a]of Object.entries(e)){if(!aR(a)||"method"in a||"result"in a){r.push(o);continue}t[o]=a}return{accepted:t,droppedKeys:r}}(a.inputResponses),m={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...void 0!==a.envelope&&{envelope:a.envelope},...void 0!==p&&{inputResponses:p.accepted},...void 0!==p&&p.droppedKeys.length>0&&{droppedInputResponseKeys:p.droppedKeys},requestState:void 0===a.requestState?ab:(r=a.requestState,()=>r),signal:h.signal,send:(e,t,r)=>{let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),at(t))return d(e,t,r);let a=aS(o,e.method);if(void 0===a)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,a,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(m,t);Promise.resolve().then(()=>l(o,f)).then(async e=>{let t;if(h.signal.aborted)return;try{t=s.encodeResult(o.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${o.method}: ${e}`)),n(oR.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:o.id};await i?.send(r)},async e=>{if(h.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:oR.InternalError,r={jsonrpc:"2.0",id:o.id,error:{code:s.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await i?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(o.id)===h&&this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),a=this._progressHandlers.get(o);if(!a)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(e){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(e);return}a(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);void 0===r?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),r(oX(e)?e:oP.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),at(t))return this._requestWithSchemaViaCodec(o,e,t,r);let a=aS(o,e.method);if(void 0===a)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,a,t)}_negotiatedWireCodec(){return oG(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(void 0===this._negotiatedProtocolVersion){let t=function(e){switch(e){case"initialize":case"notifications/initialized":return oG(void 0);case"server/discover":return oG(oF);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(oW(t)&&!e.hasRequestMethod(t))throw new r4(r9.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let a,s,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:l,headers:c}=o??{},u=Date.now();return new Promise((d,h)=>{let p=e=>{h(e)};if(!this._transport)return void p(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(o?.signal?.aborted){let e=o.signal.reason;throw e instanceof r4?e:new r4(r9.RequestTimeout,String(e))}let m=e.era===oF&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;s=f;let y={...t,jsonrpc:"2.0",id:f};o?.onprogress&&(this._progressHandlers.set(f,o.onprogress),y.params={...t.params,_meta:{...t.params?._meta,progressToken:f}});let v=this._envelopeOutbound(y),g=!1,_=e=>{g||(this._progressHandlers.delete(f),void 0===m?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:i,resumptionToken:n,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),h(e instanceof r4?e:new r4(r9.RequestTimeout,String(e))))};this._responseHandlers.set(f,a=>{let s;if(!o?.signal?.aborted){if(g=!0,a instanceof Error)return h(a);try{s=e.decodeResult(t.method,a.result)}catch(e){return h(e instanceof Error?e:Error(String(e)))}if("invalid"===s.kind)return h(s.error);if("input_required"===s.kind){var i;return o?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(i=s).inputRequests,...void 0!==i.requestState&&{requestState:i.requestState}}):d(this._resolveNonCompleteResult(s,{codec:e,request:t,resultSchema:r,options:o,flowStartedAt:u,retry:(o,a)=>this._requestWithSchemaViaCodec(e,void 0===o?{method:t.method}:{method:t.method,params:o},r,a)}))}aa(r,s.result).then(e=>{e.success?d(e.data):h(new r4(r9.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},h)}}),a=()=>_(o?.signal?.reason),o?.signal?.addEventListener("abort",a,{once:!0});let S=o?.timeout??6e4;this._setupTimeout(f,S,o?.maxTotalTimeout,()=>_(new r4(r9.RequestTimeout,"Request timed out",{timeout:S})),o?.resetTimeoutOnProgress??!1),this._transport.send(v,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:l,headers:c,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(f),h(e)})}).finally(()=>{a&&o?.signal?.removeEventListener("abort",a),void 0!==s&&(this._responseHandlers.delete(s),this._cleanupTimeout(s))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new r4(r9.NotConnected,"Not connected");if(oJ(t.method)&&!e.hasNotificationMethod(t.method))throw new r4(r9.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(e=>this._onerror(e))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){let o;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!oW(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(r,o)=>{let a=this._negotiatedWireCodec(),s=a.validateRequest(e,r);if(s.ok||"not-in-era"!==s.reason||(s=a.validateInputRequest(e,r)),!s.ok){if("not-in-era"===s.reason)throw new oP(oR.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value,o))}}else if(r)o=async(o,a)=>{let s=await aa(t.params,{...o.params});if(!s.success)throw new oP(oR.InvalidParams,`Invalid params for ${e}: ${s.error}`);return r(s.data,a)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if("function"==typeof t){if(!oJ(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,o)=>{let a=o.validateNotification(e,r);if(!a.ok){if("not-in-era"===a.reason)throw new oP(oR.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let a=await aa(t.params,{...o.params});if(!a.success)throw new oP(oR.InvalidParams,`Invalid params for notification ${e}: ${a.error}`);await r(a.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function aw(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function aR(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function aP(e){throw new r4(r9.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}async function aE(e,t,r,o,a){var s;if(!aR(o)||"string"!=typeof o.method)throw new r4(r9.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let i=o.method;if(!t.hasInputRequestMethod(i))throw new r4(r9.InvalidResult,`Invalid input request '${r}': '${i}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:i});let n=e.getRequestHandler(i);if(void 0===n)throw new r4(r9.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${i}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:i});let l=aR(o.params)?o.params:void 0;return await n({jsonrpc:"2.0",id:r,method:i,...void 0!==l&&{params:l}},e.buildContext({sessionId:e.sessionId,mcpReq:{id:r,method:i,_meta:l?._meta,requestState:(s=void 0,()=>s),signal:a,send:()=>aP("send"),notify:()=>aP("notify")}}))}var aC=rW(rK(e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function a(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var s,i,n,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var c=l.indexOf(";"),u=-1!==c?l.slice(0,c).trim():l.trim();if(!o.test(u))throw TypeError("invalid media type");var d=new a(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;i=t.exec(l);){if(i.index!==c)throw TypeError("invalid parameter format");c+=i[0].length,s=i[1].toLowerCase(),34===(n=i[2]).charCodeAt(0)&&-1!==(n=n.slice(1,-1)).indexOf("\\")&&(n=n.replace(r,"$1")),d.parameters[s]=n}if(c!==l.length)throw TypeError("invalid parameter format")}return d}})(),1);function aT(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function ak(e=fetch,t){return t?async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...aT(t.headers),...aT(o.headers)}:t.headers}):e}var aI=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}};function a(e,...t){let r=[e[0]],s=0;for(;s<t.length;)n(r,t[s]),r.push(e[++s]);return new o(r)}e._Code=o,e.nil=new o(""),e._=a;let s=new o("+");function i(e,...t){let a=[l(e[0])],c=0;for(;c<t.length;)a.push(s),n(a,t[c]),a.push(s,l(e[++c]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){var o,a;let s=(o=e[t-1],'""'===(a=e[t+1])?o:'""'===o?a:"string"==typeof o?a instanceof r||'"'!==o[o.length-1]?void 0:"string"!=typeof a?`${o.slice(0,-1)}${a}"`:'"'===a[0]?o.slice(0,-1)+a.slice(1):void 0:"string"!=typeof a||'"'!==a[0]||o instanceof r?void 0:`"${o}${a.slice(1)}`);if(void 0!==s){e.splice(t-1,3,s);continue}e[t++]="+"}t++}}(a),new o(a)}function n(e,t){var a;t instanceof o?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(a=t)||"boolean"==typeof a||null===a?a:l(Array.isArray(a)?a.join(","):a))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=i,e.addCodeArg=n,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:i`${e}${t}`},e.stringify=function(e){return new o(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new o(`.${t}`):a`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new o(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new o(e.toString())}}),ax=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=aI();var r,o,a=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=o||(e.UsedValueState=o={}))[r.Started=0]="Started",r[r.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var s=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=s;var i=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(r)}[${o}]`}};e.ValueScopeName=i;let n=(0,t._)`\n`;var l=class extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?n:t.nil}}get(){return this._scope}name(e){return new i(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:a}=o,s=null!=(r=t.key)?r:t.ref,i=this._values[a];if(i){let e=i.get(s);if(e)return e}else i=this._values[a]=new Map;i.set(s,o);let n=this._scope[a]||(this._scope[a]=[]),l=n.length;return n[l]=t.ref,o.setValue(t,{property:a,itemIndex:l}),o}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw Error(`CodeGen: name "${r}" has no value`);return(0,t._)`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(r,s,i={},n){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=i[c]=i[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,o.Started);let i=s(r);if(i){let o=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${o} ${r} = ${i};${this.opts._n}`}else if(i=null==n?void 0:n(r))l=(0,t._)`${l}${i}${this.opts._n}`;else throw new a(r);d.set(r,o.Completed)})}return l}};e.ValueScope=l}),aj=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=aI(),r=ax();var o=aI();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var a=ax();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},i=class extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let o=e?r.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${o} ${this.name}${a};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},n=class extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,r),this}get names(){return k(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends n{constructor(e,t,r,o){super(e,r,o),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},c=class extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},h=class extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;for(;o--;){let a=r[o];a.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,a.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>T(e,t.names),{})}},m=class extends p{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},f=class extends p{},y=class extends m{};y.kind="else";var v=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(!0===t)return this.nodes;let r=this.else;if(r){let e=r.optimizeNodes();r=this.else=Array.isArray(e)?new y(e):e}return r?!1===t?r instanceof e?r:r.nodes:this.nodes.length?this:new e(x(t),r instanceof e?[r]:r.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){let e=super.names;return k(e,this.condition),this.else&&T(e,this.else.names),e}};v.kind="if";var g=class extends m{};g.kind="for";var _=class extends g{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}},S=class extends g{constructor(e,t,r,o){super(),this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:o,from:a,to:s}=this;return`for(${t} ${o}=${a}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){return k(k(super.names,this.from),this.to)}},b=class extends g{constructor(e,t,r,o){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}},$=class extends m{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$.kind="func";var w=class extends p{render(e){return"return "+super.render(e)}};w.kind="return";var R=class extends m{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(o=this.finally)||o.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}},P=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};P.kind="catch";var E=class extends m{render(e){return"finally"+super.render(e)}};E.kind="finally";var C=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new f]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let a=this._scope.toName(t);return void 0!==r&&o&&(this._constants[a.str]=r),this._leafNode(new i(e,a,r)),a}const(e,t,o){return this._def(r.varKinds.const,e,t,o)}let(e,t,o){return this._def(r.varKinds.let,e,t,o)}var(e,t,o){return this._def(r.varKinds.var,e,t,o)}assign(e,t,r){return this._leafNode(new n(e,t,r))}add(t,r){return this._leafNode(new l(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new h(e)),this}object(...e){let r=["{"];for(let[o,a]of e)r.length>1&&r.push(","),r.push(o),(o!==a||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,a));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new v(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new v(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(v,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,o,a,s=this.opts.es5?r.varKinds.var:r.varKinds.let){let i=this._scope.toName(e);return this._for(new S(s,i,t,o),()=>a(i))}forOf(e,o,a,s=r.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let e=o instanceof t.Name?o:this.var("_arr",o);return this.forRange("_i",0,(0,t._)`${e}.length`,r=>{this.var(i,(0,t._)`${e}[${r}]`),a(i)})}return this._for(new b("of",s,i,o),()=>a(i))}forIn(e,o,a,s=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${o})`,a);let i=this._scope.toName(e);return this._for(new b("in",s,i,o),()=>a(i))}endFor(){return this._endBlockNode(g)}label(e){return this._leafNode(new c(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new w;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new R;if(this._blockNode(o),this.code(e),t){let e=this.name("e");this._currNode=o.catch=new P(e),t(e)}return r&&(this._currNode=o.finally=new E,this.code(r)),this._endBlockNode(P,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,o,a){return this._blockNode(new $(e,r,o)),a&&this.code(a).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function T(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function k(e,r){return r instanceof t._CodeOrName?T(e,r.names):e}function I(e,r,o){var a;if(e instanceof t.Name)return s(e);if(!((a=e)instanceof t._Code&&a._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==o[e.str])))return e;return new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function s(e){let t=o[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function x(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${q(e)}`}e.CodeGen=C,e.not=x;let j=N(e.operators.AND);e.and=function(...e){return e.reduce(j)};let O=N(e.operators.OR);function N(e){return(r,o)=>r===t.nil?o:o===t.nil?r:(0,t._)`${q(r)} ${e} ${q(o)}`}function q(e){return e instanceof t.Name?e:(0,t._)`(${e})`}e.or=function(...e){return e.reduce(O)}}),aO=rK(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let o=aj(),a=aI();function s(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||"boolean"==typeof t)return;let a=o.RULES.keywords;for(let r in t)a[r]||p(e,`unknown keyword: "${r}"`)}function i(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(s,i,n,l)=>{let c=void 0===n?i:n instanceof o.Name?(i instanceof o.Name?e(s,i,n):t(s,i,n),n):i instanceof o.Name?(t(s,n,i),i):r(i,n);return l!==o.Name||c instanceof o.Name?c:a(s,c)}}function u(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,o._)`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign((0,o._)`${t}${(0,o.getProperty)(r)}`,!0))}e.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(s(e,t),!i(t,e.self.RULES.all))},e.checkUnknownRules=s,e.schemaHasRules=i,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,a,s){if(!s){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,o._)`${r}`}return(0,o._)`${e}${t}${(0,o.getProperty)(a)}`},e.unescapeFragment=function(e){return l(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(n(e))},e.escapeJsonPointer=n,e.unescapeJsonPointer=l,e.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},e.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,o._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,o._)`${r} || {}`).code((0,o._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,o._)`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,o._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>e.assign(r,!0===t||(0,o._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=u,e.setEvaluated=d;let h={};function p(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new a._Code(t.code))})},(r=t||(e.Type=t={}))[r.Num=0]="Num",r[r.Str=1]="Str",e.getErrorPath=function(e,r,a){if(e instanceof o.Name){let s=r===t.Num;return a?s?(0,o._)`"[" + ${e} + "]"`:(0,o._)`"['" + ${e} + "']"`:s?(0,o._)`"/" + ${e}`:(0,o._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return a?(0,o.getProperty)(e).toString():"/"+n(e)},e.checkStrictMode=p}),aN=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")}}),aq=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=aj(),r=aO(),o=aN();function a(e,r){let a=e.const("err",r);e.if((0,t._)`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,(0,t._)`[${a}]`),(0,t._)`${o.default.vErrors}.push(${a})`),e.code((0,t._)`${o.default.errors}++`)}function s(e,r){let{gen:o,validateName:a,schemaEnv:s}=e;s.$async?o.throw((0,t._)`new ${e.ValidationError}(${r})`):(o.assign((0,t._)`${a}.errors`,r),o.return(!1))}e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?(0,t.str)`"${e}" keyword must be ${r} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`},e.reportError=function(r,o=e.keywordError,i,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:h}=c,p=n(r,o,i);(null!=l?l:d||h)?a(u,p):s(c,(0,t._)`[${p}]`)},e.reportExtraError=function(t,r=e.keywordError,i){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;a(c,n(t,r,i)),u||d||s(l,o.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(o.default.errors,r),e.if((0,t._)`${o.default.vErrors} !== null`,()=>e.if(r,()=>e.assign((0,t._)`${o.default.vErrors}.length`,r),()=>e.assign(o.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:a,data:s,errsCount:i,it:n}){if(void 0===i)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",i,o.default.errors,i=>{e.const(l,(0,t._)`${o.default.vErrors}[${i}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(o.default.instancePath,n.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${n.errSchemaPath}/${r}`),n.opts.verbose&&(e.assign((0,t._)`${l}.schema`,a),e.assign((0,t._)`${l}.data`,s))})};let i={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function n(e,a,s){let{createErrors:n}=e.it;return!1===n?(0,t._)`{}`:function(e,a,s={}){let{gen:n,it:l}=e,c=[function({errorPath:e},{instancePath:a}){let s=a?(0,t.str)`${e}${(0,r.getErrorPath)(a,r.Type.Str)}`:e;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,s)]}(l,s),function({keyword:e,it:{errSchemaPath:o}},{schemaPath:a,parentSchema:s}){let n=s?o:(0,t.str)`${o}/${e}`;return a&&(n=(0,t.str)`${n}${(0,r.getErrorPath)(a,r.Type.Str)}`),[i.schemaPath,n]}(e,s)];return function(e,{params:r,message:a},s){let{keyword:n,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:h,topSchemaRef:p,schemaPath:m}=u;s.push([i.keyword,n],[i.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&s.push([i.message,"function"==typeof a?a(e):a]),d.verbose&&s.push([i.schema,c],[i.parentSchema,(0,t._)`${p}${m}`],[o.default.data,l]),h&&s.push([i.propertyName,h])}(e,a,c),n.object(...c)}(e,a,s)}}),aM=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=aq(),r=aj(),o=aN(),a={message:"boolean schema is false"};function s(e,r){let{gen:o,data:s}=e;(0,t.reportError)({gen:o,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},a,void 0,r)}e.topBoolOrEmptySchema=function(e){let{gen:t,schema:a,validateName:i}=e;!1===a?s(e,!1):"object"==typeof a&&!0===a.$async?t.return(o.default.data):(t.assign((0,r._)`${i}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){let{gen:r,schema:o}=e;!1===o?(r.var(t,!1),s(e)):r.var(t,!0)}}),aA=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(e){return"string"==typeof e&&t.has(e)},e.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}}),aL=rK(e=>{function t(e,t){return t.rules.some(t=>r(e,t))}function r(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:e,self:r},o){let a=r.RULES.types[o];return a&&!0!==a&&t(e,a)},e.shouldUseGroup=t,e.shouldUseRule=r}),aV=rK(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let o=aA(),a=aL(),s=aq(),i=aj(),n=aO();function l(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(o.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(r=t||(e.DataType=t={}))[r.Correct=0]="Correct",r[r.Wrong=1]="Wrong",e.getSchemaTypes=function(e){let t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=l,e.coerceAndCheckDataType=function(e,r){var o,s;let{gen:n,data:l,opts:u}=e,h=(o=r,(s=u.coerceTypes)?o.filter(e=>c.has(e)||"array"===s&&"array"===e):[]),m=r.length>0&&!(0===h.length&&1===r.length&&(0,a.schemaHasRulesForType)(e,r[0]));if(m){let o=d(r,l,u.strictNumbers,t.Wrong);n.if(o,()=>{h.length?function(e,t,r){let{gen:o,data:a,opts:s}=e,n=o.let("dataType",(0,i._)`typeof ${a}`),l=o.let("coerced",(0,i._)`undefined`);for(let e of("array"===s.coerceTypes&&o.if((0,i._)`${n} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>o.assign(a,(0,i._)`${a}[0]`).assign(n,(0,i._)`typeof ${a}`).if(d(t,a,s.strictNumbers),()=>o.assign(l,a))),o.if((0,i._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===s.coerceTypes)&&function(e){switch(e){case"string":o.elseIf((0,i._)`${n} == "number" || ${n} == "boolean"`).assign(l,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(l,(0,i._)`""`);return;case"number":o.elseIf((0,i._)`${n} == "boolean" || ${a} === null
3
3
  || (${n} == "string" && ${a} && ${a} == +${a})`).assign(l,(0,i._)`+${a}`);return;case"integer":o.elseIf((0,i._)`${n} === "boolean" || ${a} === null
4
4
  || (${n} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(l,(0,i._)`+${a}`);return;case"boolean":o.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(l,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(l,!0);return;case"null":o.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),o.assign(l,null);return;case"array":o.elseIf((0,i._)`${n} === "string" || ${n} === "number"
5
- || ${n} === "boolean" || ${a} === null`).assign(l,(0,i._)`[${a}]`)}}(e);o.else(),p(e),o.endIf(),o.if((0,i._)`${l} !== undefined`,()=>{o.assign(a,l),function({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${r}]`,o))}(e,l)})}(e,r,h):p(e)})}return m};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,o,a=t.Correct){let s,n=a===t.Correct?i.operators.EQ:i.operators.NEQ;switch(e){case"null":return(0,i._)`${r} ${n} null`;case"array":s=(0,i._)`Array.isArray(${r})`;break;case"object":s=(0,i._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":s=l((0,i._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":s=l();break;default:return(0,i._)`typeof ${r} ${n} ${e}`}return a===t.Correct?s:(0,i.not)(s);function l(e=i.nil){return(0,i.and)((0,i._)`typeof ${r} == "number"`,e,o?(0,i._)`isFinite(${r})`:i.nil)}}function d(e,t,r,o){let a;if(1===e.length)return u(e[0],t,r,o);let s=(0,n.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;a=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else a=i.nil;for(let e in s.number&&delete s.integer,s)a=(0,i.and)(a,u(e,t,r,o));return a}e.checkDataType=u,e.checkDataTypes=d;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function p(e){let t=function(e){let{gen:t,data:r,schema:o}=e,a=(0,n.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:a,schemaValue:a,parentSchema:o,params:{},it:e}}(e);(0,s.reportError)(t,h)}e.reportTypeError=p}),aV=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=aj(),r=aO();function o(e,o,a){let{gen:s,compositeRule:i,data:n,opts:l}=e;if(void 0===a)return;let c=(0,t._)`${n}${(0,t.getProperty)(o)}`;if(i)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=(0,t._)`${c} === undefined`;"empty"===l.useDefaults&&(u=(0,t._)`${u} || ${c} === null || ${c} === ""`),s.if(u,(0,t._)`${c} = ${(0,t.stringify)(a)}`)}e.assignDefaults=function(e,t){let{properties:r,items:a}=e.schema;if("object"===t&&r)for(let t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(a)&&a.forEach((t,r)=>o(e,r,t.default))}}),az=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=aj(),r=aO(),o=aN(),a=aO();function s(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function i(e,r,o){return(0,t._)`${s(e)}.call(${r}, ${o})`}function n(e,r,o,a){let s=(0,t._)`${r}${(0,t.getProperty)(o)} === undefined`;return a?(0,t.or)(s,(0,t.not)(i(e,r,o))):s}function l(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){let{gen:o,data:a,it:s}=e;o.if(n(o,a,r,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:o}},a,s){return(0,t.or)(...a.map(a=>(0,t.and)(n(e,r,a,o.ownProperties),(0,t._)`${s} = ${a}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=s,e.isOwnProperty=i,e.propertyInData=function(e,r,o,a){let s=(0,t._)`${r}${(0,t.getProperty)(o)} !== undefined`;return a?(0,t._)`${s} && ${i(e,r,o)}`:s},e.noPropertyInData=n,e.allSchemaProperties=l,e.schemaProperties=function(e,t){return l(t).filter(o=>!(0,r.alwaysValidSchema)(e,t[o]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:a,topSchemaRef:s,schemaPath:i,errorPath:n},it:l},c,u,d){let h=d?(0,t._)`${e}, ${r}, ${s}${i}`:r,p=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,n)],[o.default.parentData,l.parentData],[o.default.parentDataProperty,l.parentDataProperty],[o.default.rootData,o.default.rootData]];l.opts.dynamicRef&&p.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let m=(0,t._)`${h}, ${a.object(...p)}`;return u!==t.nil?(0,t._)`${c}.call(${u}, ${m})`:(0,t._)`${c}(${m})`};let c=(0,t._)`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},o){let s=r.unicodeRegExp?"u":"",{regExp:i}=r.code,n=i(o,s);return e.scopeValue("pattern",{key:n.toString(),ref:n,code:(0,t._)`${"new RegExp"===i.code?c:(0,a.useFunc)(e,i)}(${o}, ${s})`})},e.validateArray=function(e){let{gen:o,data:a,keyword:s,it:i}=e,n=o.name("valid");if(i.allErrors){let e=o.let("valid",!0);return l(()=>o.assign(e,!1)),e}return o.var(n,!0),l(()=>o.break()),n;function l(i){let l=o.const("len",(0,t._)`${a}.length`);o.forRange("i",0,l,a=>{e.subschema({keyword:s,dataProp:a,dataPropType:r.Type.Num},n),o.if((0,t.not)(n),i)})}},e.validateUnion=function(e){let{gen:o,schema:a,keyword:s,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");if(a.some(e=>(0,r.alwaysValidSchema)(i,e))&&!i.opts.unevaluated)return;let n=o.let("valid",!1),l=o.name("_valid");o.block(()=>a.forEach((r,a)=>{let i=e.subschema({keyword:s,schemaProp:a,compositeRule:!0},l);o.assign(n,(0,t._)`${n} || ${l}`),e.mergeValidEvaluated(i,l)||o.if((0,t.not)(n))})),e.result(n,()=>e.reset(),()=>e.error(!0))}}),aD=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=aj(),r=aN(),o=az(),a=aq();function s(e){let{gen:r,data:o,it:a}=e;r.if(a.parentData,()=>r.assign(o,(0,t._)`${a.parentData}[${a.parentDataProperty}]`))}function i(e,r,o){if(void 0===o)throw Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof o?{ref:o}:{ref:o,code:(0,t.stringify)(o)})}e.macroKeywordCode=function(e,r){let{gen:o,keyword:a,schema:s,parentSchema:n,it:l}=e,c=r.macro.call(l.self,s,n,l),u=i(o,a,c);!1!==l.opts.validateSchema&&l.self.validateSchema(c,!0);let d=o.name("valid");e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${l.errSchemaPath}/${a}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,n){var l;let{gen:c,keyword:u,schema:d,parentSchema:h,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(m,n);let f=i(c,u,!p&&n.compile?n.compile.call(m.self,d,h,m):n.validate),y=c.let("valid");function v(a=n.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?r.default.this:r.default.self,i=!("compile"in n&&!p||!1===n.schema);c.assign(y,(0,t._)`${a}${(0,o.callValidateCode)(e,f,s,i)}`,n.modifying)}function g(e){var r;c.if((0,t.not)(null!=(r=n.valid)?r:y),e)}e.block$data(y,function(){if(!1===n.errors)v(),n.modifying&&s(e),g(()=>e.error());else{let o,i,l=n.async?(o=c.let("ruleErrs",null),c.try(()=>v((0,t._)`await `),e=>c.assign(y,!1).if((0,t._)`${e} instanceof ${m.ValidationError}`,()=>c.assign(o,(0,t._)`${e}.errors`),()=>c.throw(e))),o):(i=(0,t._)`${f}.errors`,c.assign(i,null),v(t.nil),i);n.modifying&&s(e),g(()=>(function(e,o){let{gen:s}=e;s.if((0,t._)`Array.isArray(${o})`,()=>{s.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${o} : ${r.default.vErrors}.concat(${o})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,a.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(l=n.valid)?l:y)},e.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},e.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:o},a,s){if(Array.isArray(a.keyword)?!a.keyword.includes(s):a.keyword!==s)throw Error("ajv implementation error");let i=a.dependencies;if(null==i?void 0:i.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(a.validateSchema&&!a.validateSchema(e[s])){let e=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(a.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}}),aH=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=aj(),r=aO();e.getSubschema=function(e,{keyword:o,schemaProp:a,schema:s,schemaPath:i,errSchemaPath:n,topSchemaRef:l}){if(void 0!==o&&void 0!==s)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){let s=e.schema[o];return void 0===a?{schema:s,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(o)}`,errSchemaPath:`${e.errSchemaPath}/${o}`}:{schema:s[a],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(o)}${(0,t.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${o}/${(0,r.escapeFragment)(a)}`}}if(void 0!==s){if(void 0===i||void 0===n||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:i,topSchemaRef:l,errSchemaPath:n}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,o,{dataProp:a,dataPropType:s,data:i,dataTypes:n,propertyName:l}){if(void 0!==i&&void 0!==a)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=o;if(void 0!==a){let{errorPath:i,dataPathArr:n,opts:l}=o;u(c.let("data",(0,t._)`${o.data}${(0,t.getProperty)(a)}`,!0)),e.errorPath=(0,t.str)`${i}${(0,r.getErrorPath)(a,s,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${a}`,e.dataPathArr=[...n,e.parentDataProperty]}function u(t){e.data=t,e.dataLevel=o.dataLevel+1,e.dataTypes=[],o.definedProperties=new Set,e.parentData=o.data,e.dataNames=[...o.dataNames,t]}void 0!==i&&(u(i instanceof t.Name?i:c.let("data",i,!0)),void 0!==l&&(e.propertyName=l)),n&&(e.dataTypes=n)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:a,allErrors:s}){void 0!==o&&(e.compositeRule=o),void 0!==a&&(e.createErrors=a),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}}),aF=rK((e,t)=>{t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((o=t.length)!=r.length)return!1;for(a=o;0!=a--;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((o=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(a=o;0!=a--;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=o;0!=a--;){var o,a,s,i=s[a];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}}),aG=rK((e,t)=>{var r=t.exports=function(e,t,o){"function"==typeof t&&(o=t,t={});var a="function"==typeof(o=t.cb||o)?o:o.pre||function(){};!function e(t,o,a,s,i,n,l,c,u,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in o(s,i,n,l,c,u,d),s){var p=s[h];if(Array.isArray(p)){if(h in r.arrayKeywords)for(var m=0;m<p.length;m++)e(t,o,a,p[m],i+"/"+h+"/"+m,n,i,h,s,m)}else if(h in r.propsKeywords){if(p&&"object"==typeof p)for(var f in p)e(t,o,a,p[f],i+"/"+h+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),n,i,h,s,f)}else(h in r.keywords||t.allKeys&&!(h in r.skipKeywords))&&e(t,o,a,p,i+"/"+h,n,i,h,s)}a(s,i,n,l,c,u,d)}}(t,a,o.post||function(){},e,"",e)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}),aK=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=aO(),r=aF(),o=aG(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(e,r=!0){return"boolean"==typeof e||(!0===r?!function e(t){for(let r in t){if(s.has(r))return!0;let o=t[r];if(Array.isArray(o)&&o.some(e)||"object"==typeof o&&e(o))return!0}return!1}(e):!!r&&function e(r){let o=0;for(let s in r)if("$ref"===s||(o++,!a.has(s)&&("object"==typeof r[s]&&(0,t.eachItem)(r[s],t=>o+=e(t)),o===1/0)))return 1/0;return o}(e)<=r)};let s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(e,t="",r){return!1!==r&&(t=c(t)),n(e,e.parse(t))}function n(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=i,e._getFullPath=n;let l=/#\/?$/;function c(e){return e?e.replace(l,""):""}e.normalizeId=c,e.resolveUrl=function(e,t,r){return r=c(r),e.resolve(t,r)};let u=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:a,uriResolver:s}=this.opts,n=c(e[a]||t),l={"":n},d=i(s,n,!1),h={},p=new Set;return o(e,{allKeys:!0},(e,t,r,o)=>{if(void 0===o)return;let s=d+t,i=l[o];function n(t){let r=this.opts.uriResolver.resolve;if(t=c(i?r(i,t):t),p.has(t))throw f(t);p.add(t);let o=this.refs[t];return"string"==typeof o&&(o=this.refs[o]),"object"==typeof o?m(e,o.schema,t):t!==c(s)&&("#"===t[0]?(m(e,h[t],t),h[t]=e):this.refs[t]=s),t}function y(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);n.call(this,`#${e}`)}}"string"==typeof e[a]&&(i=n.call(this,e[a])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),l[t]=i}),h;function m(e,t,o){if(void 0!==t&&!r(e,t))throw f(o)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}}),aW=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=aM(),r=aU(),o=aL(),a=aU(),s=aV(),i=aD(),n=aH(),l=aj(),c=aN(),u=aK(),d=aO(),h=aq();function p({gen:e,validateName:t,schema:r,schemaEnv:o,opts:a},s){var i;a.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,o.$async,()=>{var t,o;e.code((0,l._)`"use strict"; ${m(r,a)}`),t=e,o=a,t.if(c.default.valCxt,()=>{t.var(c.default.instancePath,(0,l._)`${c.default.valCxt}.${c.default.instancePath}`),t.var(c.default.parentData,(0,l._)`${c.default.valCxt}.${c.default.parentData}`),t.var(c.default.parentDataProperty,(0,l._)`${c.default.valCxt}.${c.default.parentDataProperty}`),t.var(c.default.rootData,(0,l._)`${c.default.valCxt}.${c.default.rootData}`),o.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{t.var(c.default.instancePath,(0,l._)`""`),t.var(c.default.parentData,(0,l._)`undefined`),t.var(c.default.parentDataProperty,(0,l._)`undefined`),t.var(c.default.rootData,c.default.data),o.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(s)}):e.func(t,(0,l._)`${c.default.data}, ${(i=a,(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${i.dynamicRef?(0,l._)`, ${c.default.dynamicAnchors}={}`:l.nil}}={}`)}`,o.$async,()=>e.code(m(r,a)).code(s))}function m(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,l._)`/*# sourceURL=${r} */`:l.nil}function f({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function v(e){(0,d.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:o,self:a}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function g(e,t){if(e.opts.jtd)return S(e,[],!1,t);let o=(0,r.getSchemaTypes)(e.schema);S(e,o,!(0,r.coerceAndCheckDataType)(e,o),t)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:a}){let s=r.$comment;if(!0===a.$comment)e.code((0,l._)`${c.default.self}.logger.log(${s})`);else if("function"==typeof a.$comment){let r=(0,l.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${c.default.self}.opts.$comment(${s}, ${r}, ${a}.schema)`)}}function S(e,t,r,s){var i,n,u,h;let{gen:p,schema:m,data:f,allErrors:y,opts:v,self:g}=e,{RULES:_}=g;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(m,_)))return void p.block(()=>P(e,"$ref",_.all.$ref.definition));function S(i){(0,o.shouldUseGroup)(m,i)&&(i.type?(p.if((0,a.checkDataType)(i.type,f,v.strictNumbers)),b(e,i),1===t.length&&t[0]===i.type&&r&&(p.else(),(0,a.reportTypeError)(e)),p.endIf()):b(e,i),y||p.if((0,l._)`${c.default.errors} === ${s||0}`))}v.jtd||(i=e,n=t,!i.schemaEnv.meta&&i.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{$(e.dataTypes,t)||w(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let o of e.dataTypes)$(t,o)?r.push(o):t.includes("integer")&&"number"===o&&r.push("integer");e.dataTypes=r}(e,t)}}(i,n),i.opts.allowUnionTypes||(u=i,(h=n).length>1&&!(2===h.length&&h.includes("null"))&&w(u,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let a in r){let s=r[a];if("object"==typeof s&&(0,o.shouldUseRule)(e.schema,s)){let{type:r}=s.definition;r.length&&!r.some(e=>{var r,o;return r=t,o=e,r.includes(o)||"number"===o&&r.includes("integer")})&&w(e,`missing type "${r.join(",")}" for keyword "${a}"`)}}}(i,i.dataTypes))),p.block(()=>{for(let e of _.rules)S(e);S(_.post)})}function b(e,t){let{gen:r,schema:a,opts:{useDefaults:i}}=e;i&&(0,s.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,o.shouldUseRule)(a,r)&&P(e,r.keyword,r.definition,t.type)})}function $(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function w(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}e.validateFunctionCode=function(e){y(e)&&(v(e),f(e))?function(e){let{schema:t,opts:r,gen:o}=e;p(e,()=>{r.$comment&&t.$comment&&_(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),o.let(c.default.vErrors,null),o.let(c.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,l._)`${r}.evaluated`),t.if((0,l._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,l._)`${e.evaluated}.props`,(0,l._)`undefined`)),t.if((0,l._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,l._)`${e.evaluated}.items`,(0,l._)`undefined`))}(e),g(e),function(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:a,opts:s}=e;r.$async?t.if((0,l._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,l._)`new ${a}(${c.default.vErrors})`)):(t.assign((0,l._)`${o}.errors`,c.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:o}){r instanceof l.Name&&e.assign((0,l._)`${t}.props`,r),o instanceof l.Name&&e.assign((0,l._)`${t}.items`,o)}(e),t.return((0,l._)`${c.default.errors} === 0`))}(e)})}(e):p(e,()=>(0,t.topBoolOrEmptySchema)(e))};var R=class{constructor(e,t,r){if((0,i.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",T(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,l.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,l._)`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=l.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=l.nil,t=l.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:a,def:s}=this;r.if((0,l.or)((0,l._)`${o} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(a.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==l.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:s}=this;return(0,l.or)(function(){if(r.length){if(!(t instanceof l.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,l._)`${(0,a.checkDataTypes)(e,t,s.opts.strictNumbers,a.DataType.Wrong)}`}return l.nil}(),function(){if(o.validateSchema){let r=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}())}subschema(e,r){let o=(0,n.getSubschema)(this.it,e);(0,n.extendSubschemaData)(o,this.it,e),(0,n.extendSubschemaMode)(o,e);let a={...this.it,...o,items:void 0,props:void 0};return!function(e,r){if(y(e)&&(v(e),f(e)))return function(e,t){var r;let o,{schema:a,gen:s,opts:i}=e;i.$comment&&a.$comment&&_(e),(o=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,u.resolveUrl)(r.opts.uriResolver,r.baseId,o)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let n=s.const("_errs",c.default.errors);g(e,n),s.var(t,(0,l._)`${n} === ${c.default.errors}`)}(e,r);(0,t.boolOrEmptySchema)(e,r)}(a,r),a}mergeEvaluated(e,t){let{it:r,gen:o}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(o,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(o,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return o.if(t,()=>this.mergeEvaluated(e,l.Name)),!0}};function P(e,t,r,o){let a=new R(e,r,t);"code"in r?r.code(a,o):a.$data&&r.validate?(0,i.funcKeywordCode)(a,r):"macro"in r?(0,i.macroKeywordCode)(a,r):(r.compile||r.validate)&&(0,i.funcKeywordCode)(a,r)}e.KeywordCxt=R;let E=/^\/(?:[^~]|~0|~1)*$/,C=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let a,s;if(""===e)return c.default.rootData;if("/"===e[0]){if(!E.test(e))throw Error(`Invalid JSON-pointer: ${e}`);a=e,s=c.default.rootData}else{let i=C.exec(e);if(!i)throw Error(`Invalid JSON-pointer: ${e}`);let l=+i[1];if("#"===(a=i[2])){if(l>=t)throw Error(n("property/index",l));return o[t-l]}if(l>t)throw Error(n("data",l));if(s=r[t-l],!a)return s}let i=s;for(let e of a.split("/"))e&&(s=(0,l._)`${s}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,i=(0,l._)`${i} && ${s}`);return i;function n(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=T}),aJ=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}}),aB=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aK();e.default=class extends Error{constructor(e,r,o,a){super(a||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,o),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}}),aZ=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=aj(),r=aJ(),o=aN(),a=aK(),s=aO(),i=aW();var n=class{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,a.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}};function l(e){let s,n,l=u.call(this,e);if(l)return l;let c=(0,a.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:h}=this.opts.code,{ownProperties:p}=this.opts,m=new t.CodeGen(this.scope,{es5:d,lines:h,ownProperties:p});e.$async&&(s=m.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let f=m.scopeName("validate");e.validateName=f;let y={gen:m,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:m.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,i.validateFunctionCode)(y),m.optimize(this.opts.code.optimize);let r=m.toString();n=`${m.scopeRefs(o.default.scope)}return ${r}`,this.opts.code.process&&(n=this.opts.code.process(n,e));let a=Function(`${o.default.self}`,`${o.default.scope}`,n)(this,this.scope.get());if(this.scope.value(f,{ref:a}),a.errors=null,a.schema=e.schema,a.schemaEnv=e,e.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:f,validateCode:r,scopeValues:m._values}),this.opts.unevaluated){let{props:e,items:r}=y;a.evaluated={props:e instanceof t.Name?void 0:e,items:r instanceof t.Name?void 0:r,dynamicProps:e instanceof t.Name,dynamicItems:r instanceof t.Name},a.source&&(a.source.evaluated=(0,t.stringify)(a.evaluated))}return e.validate=a,e}catch(t){throw delete e.validate,delete e.validateName,n&&this.logger.error("Error compiling schema, function code:",n),t}finally{this._compilations.delete(e)}}function c(e){return(0,a.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function u(e){for(let o of this._compilations){var t,r;if(t=o,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return o}}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){let r=this.opts.uriResolver.parse(t),o=(0,a._getFullPath)(this.opts.uriResolver,r),s=(0,a.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===s)return m.call(this,r,e);let i=(0,a.normalizeId)(o),c=this.refs[i]||this.schemas[i];if("string"==typeof c){let t=h.call(this,e,c);if("object"!=typeof(null==t?void 0:t.schema))return;return m.call(this,r,t)}if("object"==typeof(null==c?void 0:c.schema)){if(c.validate||l.call(this,c),i===(0,a.normalizeId)(t)){let{schema:t}=c,{schemaId:r}=this.opts,o=t[r];return o&&(s=(0,a.resolveUrl)(this.opts.uriResolver,s,o)),new n({schema:t,schemaId:r,root:e,baseId:s})}return m.call(this,r,c)}}e.SchemaEnv=n,e.compileSchema=l,e.resolveRef=function(e,t,r){var o;r=(0,a.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=d.call(this,e,r);if(void 0===i){let a=null==(o=e.localRefs)?void 0:o[r],{schemaId:s}=this.opts;a&&(i=new n({schema:a,schemaId:s,root:e,baseId:t}))}if(void 0!==i)return e.refs[r]=c.call(this,i)},e.getCompilingSchema=u,e.resolveSchema=h;let p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,{baseId:t,schema:r,root:o}){var i;let l;if((null==(i=e.fragment)?void 0:i[0])!=="/")return;for(let o of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,s.unescapeFragment)(o)];if(void 0===e)return;let i="object"==typeof(r=e)&&r[this.opts.schemaId];!p.has(o)&&i&&(t=(0,a.resolveUrl)(this.opts.uriResolver,t,i))}if("boolean"!=typeof r&&r.$ref&&!(0,s.schemaHasRulesButRef)(r,this.RULES)){let e=(0,a.resolveUrl)(this.opts.uriResolver,t,r.$ref);l=h.call(this,o,e)}let{schemaId:c}=this.opts;if((l=l||new n({schema:r,schemaId:c,root:o,baseId:t})).schema!==l.root.schema)return l}}),aX=rK((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),aQ=rK((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function a(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(48!==(r=e[o].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(!((r=e[o].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}function s(e){return e.length=0,!0}function i(e,t,r){if(e.length){let o=a(e);if(""===o)return r.error=!0,!1;t.push(o),e.length=0}return!0}function n(e){if(2>function(e){let t=0;for(let r=0;r<e.length;r++)":"===e[r]&&t++;return t}(e))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],l=!1,c=!1,u=i;for(let a=0;a<e.length;a++){let i=e[a];if("["!==i&&"]"!==i)if(":"===i){if(!0===l&&(c=!0),!u(n,o,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(l=!0),o.push(":");continue}else if("%"===i){if(!u(n,o,r))break;u=s}else{n.push(i);continue}}return n.length&&(u===s?r.zone=n.join(""):c?o.push(n.join("")):o.push(a(n))),r.address=o.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}t.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let r=unescape(e.host);if(!o(r)){let t=n(r);r=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(r)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){let r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e,r=[],o=-1,a=0;for(;a=t.length;){if(1===a)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===a){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===a&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(o=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")},isIPv4:o,isUUID:r,normalizeIPv6:n,stringArrayToHexStripped:a}}),aY=rK((e,t)=>{let{isUUID:r}=aQ(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a=["http","https","ws","wss","urn","urn:uuid"];function s(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function n(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let l={scheme:"http",domainHost:!0,parse:i,serialize:n},c={scheme:"https",domainHost:l.domainHost,parse:i,serialize:n},u={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=s(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(s(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},d={scheme:"wss",domainHost:u.domainHost,parse:u.parse,serialize:u.serialize},h={http:l,https:c,ws:u,wss:d,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(o);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let a=p(`${o}:${t.nid||e.nid}`);e.path=void 0,a&&(e=a.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),a=p(`${r}:${t.nid||o}`);a&&(e=a.serialize(e,t));let s=e,i=e.nss;return s.path=`${o||t.nid}:${i}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&r(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function p(e){return e&&(h[e]||h[e.toLowerCase()])||void 0}Object.setPrototypeOf(h,null),t.exports={wsIsSecure:s,SCHEMES:h,isValidSchemeName:function(e){return -1!==a.indexOf(e)},getSchemeHandler:p}}),a0=rK((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:a,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:n}=aQ(),{SCHEMES:l,getSchemeHandler:c}=aY();function u(e,t,r,a){let s={};return a||(e=p(d(e,r),r),t=p(d(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=o(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=o(t.path||""),s.query=t.query):(t.path?("/"===t.path[0]?s.path=o(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=o(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function d(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),i=[],n=c(s.scheme||r.scheme);n&&n.serialize&&n.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&i.push(r.scheme,":");let l=a(r);if(void 0!==l&&("suffix"!==s.reference&&i.push("//"),i.push(l),r.path&&"/"!==r.path[0]&&i.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||n&&n.absolutePath||(e=o(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),i.push(e)}return void 0!==r.query&&i.push("?",r.query),void 0!==r.fragment&&i.push("#",r.fragment),i.join("")}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(e,t){let o=Object.assign({},t),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1;"suffix"===o.reference&&(e=o.scheme?o.scheme+":"+e:"//"+e);let l=e.match(h);if(l){if(a.scheme=l[1],a.userinfo=l[3],a.host=l[4],a.port=parseInt(l[5],10),a.path=l[6]||"",a.query=l[7],a.fragment=l[8],isNaN(a.port)&&(a.port=l[5]),a.host)if(!1===i(a.host)){let e=r(a.host);a.host=e.host.toLowerCase(),s=e.isIPV6}else s=!0;void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||void 0!==a.query||a.path?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",o.reference&&"suffix"!==o.reference&&o.reference!==a.reference&&(a.error=a.error||"URI is not a "+o.reference+" reference.");let t=c(o.scheme||a.scheme);if(!o.unicodeSupport&&(!t||!t.unicodeSupport)&&a.host&&(o.domainHost||t&&t.domainHost)&&!1===s&&n(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(e){a.error=a.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==a.scheme&&(a.scheme=unescape(a.scheme)),void 0!==a.host&&(a.host=unescape(a.host))),a.path&&(a.path=escape(unescape(a.path))),a.fragment&&(a.fragment=encodeURI(decodeURIComponent(a.fragment)))),t&&t.parse&&t.parse(a,o)}else a.error=a.error||"URI can not be parsed.";return a}let m={SCHEMES:l,normalize:function(e,t){return"string"==typeof e?e=d(p(e,t),t):"object"==typeof e&&(e=p(d(e,t),t)),e},resolve:function(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},a=u(p(e,o),p(t,o),o,!0);return o.skipEscape=!0,d(a,o)},resolveComponent:u,equal:function(e,t,r){return"string"==typeof e?e=d(s(p(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=d(s(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=d(s(p(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=d(s(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:d,parse:p};t.exports=m,t.exports.default=m,t.exports.fastUri=m}),a1=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a0();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),a2=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=aJ(),a=aB(),s=aA(),i=aZ(),n=aj(),l=aK(),c=aU(),u=aO(),d=aX(),h=a1(),p=(e,t)=>new RegExp(e,t);p.code="new RegExp";let m=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var g=class{constructor(e={}){var t,r,o,a,i,l,c,u,d,m,g,S,E,C,T,k,I,x,j,O,N,q,M,A,L,U;let V,z,D,H,F;this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...(V=(t=e).strict,D=!0===(z=null==(r=t.code)?void 0:r.optimize)||void 0===z?1:z||0,H=null!=(a=null==(o=t.code)?void 0:o.regExp)?a:p,F=null!=(i=t.uriResolver)?i:h.default,{strictSchema:null==(c=null!=(l=t.strictSchema)?l:V)||c,strictNumbers:null==(d=null!=(u=t.strictNumbers)?u:V)||d,strictTypes:null!=(g=null!=(m=t.strictTypes)?m:V)?g:"log",strictTuples:null!=(E=null!=(S=t.strictTuples)?S:V)?E:"log",strictRequired:null!=(T=null!=(C=t.strictRequired)?C:V)&&T,code:t.code?{...t.code,optimize:D,regExp:H}:{optimize:D,regExp:H},loopRequired:null!=(k=t.loopRequired)?k:200,loopEnum:null!=(I=t.loopEnum)?I:200,meta:null==(x=t.meta)||x,messages:null==(j=t.messages)||j,inlineRefs:null==(O=t.inlineRefs)||O,schemaId:null!=(N=t.schemaId)?N:"$id",addUsedSchema:null==(q=t.addUsedSchema)||q,validateSchema:null==(M=t.validateSchema)||M,validateFormats:null==(A=t.validateFormats)||A,unicodeRegExp:null==(L=t.unicodeRegExp)||L,int32range:null==(U=t.int32range)||U,uriResolver:F})};let{es5:G,lines:K}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:f,es5:G,lines:K}),this.logger=function(e){if(!1===e)return P;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);let W=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),_.call(this,y,e,"NOT SUPPORTED"),_.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=R.call(this),e.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&w.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=d;"id"===r&&((o={...d}).id=o.$id,delete o.$id),t&&e&&this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);return"$async"in r||(this.errors=r.errors),o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(e,t){await s.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await o.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return n.call(this,t),await l.call(this,t.missingSchema),i.call(this,e)}}function n({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await c.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function c(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,o=this.opts.validateSchema){let a;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,o);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(a=e[t])&&"string"!=typeof a)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||a),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return o}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,o=new i.SchemaEnv({schema:{},schemaId:r});if(!(t=i.resolveSchema.call(this,o,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,l.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(C.call(this,r,t),!t)return(0,u.eachItem)(r,e=>T.call(this,e)),this;I.call(this,t);let o={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===o.type.length?e=>T.call(this,e,o):e=>o.type.forEach(t=>T.call(this,e,o,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let o of(e=JSON.parse(JSON.stringify(e)),t)){let t=o.split("/").slice(1),a=e;for(let e of t)a=a[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:o}=t.definition,s=a[e];o&&s&&(a[e]=j(s))}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];(!t||t.test(r))&&("string"==typeof o?delete e[r]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[r]))}}_addSchema(e,t,r,o=this.opts.validateSchema,a=this.opts.addUsedSchema){let s,{schemaId:n}=this.opts;if("object"==typeof e)s=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let c=this._cache.get(e);if(void 0!==c)return c;r=(0,l.normalizeId)(s||r);let u=l.getSchemaRefs.call(this,e,r);return c=new i.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),a&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):i.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,e)}finally{this.opts=t}}};function _(e,t,r,o="error"){for(let a in e)a in t&&this.logger[o](`${r}: option ${a}. ${e[a]}`)}function S(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function $(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function w(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function R(){let e={...this.opts};for(let t of m)delete e[t];return e}g.ValidationError=o.default,g.MissingRefError=a.default,e.default=g;let P={log(){},warn(){},error(){}},E=/^[a-z_$][a-z0-9_$:-]*$/i;function C(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!E.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function T(e,t,r){var o;let a=null==t?void 0:t.post;if(r&&a)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=a?s.post:s.rules.find(({type:e})=>e===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let n={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?k.call(this,i,n,t.before):i.rules.push(n),s.all[e]=n,null==(o=t.implements)||o.forEach(e=>this.addKeyword(e))}function k(e,t,r){let o=e.rules.findIndex(e=>e.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function I(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=j(t)),e.validateSchema=this.compile(t,!0))}let x={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function j(e){return{anyOf:[e,x]}}}),a9=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),a4=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=aB(),r=az(),o=aj(),a=aN(),s=aZ(),i=aO();function n(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,o._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,s,n){let{gen:l,it:c}=e,{allErrors:u,schemaEnv:d,opts:h}=c,p=h.passContext?a.default.this:o.nil;function m(e){let t=(0,o._)`${e}.errors`;l.assign(a.default.vErrors,(0,o._)`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`),l.assign(a.default.errors,(0,o._)`${a.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;let r=null==(t=null==s?void 0:s.validate)?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=i.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,o._)`${e}.evaluated.props`);c.props=i.mergeEvaluated.props(l,t,c.props,o.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=i.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,o._)`${e}.evaluated.items`);c.items=i.mergeEvaluated.items(l,t,c.items,o.Name)}}n?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let a=l.let("valid");l.try(()=>{l.code((0,o._)`await ${(0,r.callValidateCode)(e,t,p)}`),f(t),u||l.assign(a,!0)},e=>{l.if((0,o._)`!(${e} instanceof ${c.ValidationError})`,()=>l.throw(e)),m(e),u||l.assign(a,!1)}),e.ok(a)}():e.result((0,r.callValidateCode)(e,t,p),()=>f(t),()=>m(t))}e.getValidate=n,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){var r,a;let i,c,u,{gen:d,schema:h,it:p}=e,{baseId:m,schemaEnv:f,validateName:y,opts:v,self:g}=p,{root:_}=f;if(("#"===h||"#/"===h)&&m===_.baseId){if(f===_)return l(e,y,f,f.$async);let t=d.scopeValue("root",{ref:_});return l(e,(0,o._)`${t}.validate`,_,_.$async)}let S=s.resolveRef.call(g,_,m,h);if(void 0===S)throw new t.default(p.opts.uriResolver,m,h);return S instanceof s.SchemaEnv?void l(e,n(e,r=S),r,r.$async):(a=S,i=d.scopeValue("schema",!0===v.code.source?{ref:a,code:(0,o.stringify)(a)}:{ref:a}),c=d.name("valid"),u=e.subschema({schema:a,dataTypes:[],schemaPath:o.nil,topSchemaRef:i,errSchemaPath:h},c),void(e.mergeEvaluated(u),e.ok(c)))}}}),a5=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a9(),r=a4();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),a3=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}};e.default={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must be ${o[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>(0,t._)`{comparison: ${o[e].okStr}, limit: ${r}}`},code(e){let{keyword:r,data:a,schemaCode:s}=e;e.fail$data((0,t._)`${a} ${o[r].fail} ${s} || isNaN(${a})`)}}}),a6=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:r,data:o,schemaCode:a,it:s}=e,i=s.opts.multipleOfPrecision,n=r.let("res"),l=i?(0,t._)`Math.abs(Math.round(${n}) - ${n}) > 1e-${i}`:(0,t._)`${n} !== parseInt(${n})`;e.fail$data((0,t._)`(${a} === 0 || (${n} = ${o}/${a}, ${l}))`)}}}),a7=rK(e=>{function t(e){let t,r=e.length,o=0,a=0;for(;a<r;)o++,(t=e.charCodeAt(a++))>=55296&&t<=56319&&a<r&&(64512&(t=e.charCodeAt(a)))==56320&&a++;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),a8=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=a7();e.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${r} characters`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:a,data:s,schemaCode:i,it:n}=e,l="maxLength"===a?t.operators.GT:t.operators.LT,c=!1===n.opts.unicode?(0,t._)`${s}.length`:(0,t._)`${(0,r.useFunc)(e.gen,o.default)}(${s})`;e.fail$data((0,t._)`${c} ${l} ${i}`)}}}),se=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aO(),o=aj();e.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,o.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,o._)`{pattern: ${e}}`},code(e){let{gen:a,data:s,$data:i,schema:n,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(i){let{regExp:t}=c.opts.code,i="new RegExp"===t.code?(0,o._)`new RegExp`:(0,r.useFunc)(a,t),n=a.let("valid");a.try(()=>a.assign(n,(0,o._)`${i}(${l}, ${u}).test(${s})`),()=>a.assign(n,!1)),e.fail$data((0,o._)`!${n}`)}else{let r=(0,t.usePattern)(e,n);e.fail$data((0,o._)`!${r}.test(${s})`)}}}}),st=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${r} properties`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:o,schemaCode:a}=e,s="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${o}).length ${s} ${a}`)}}}),sr=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aj(),o=aO();e.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,r.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,r._)`{missingProperty: ${e}}`},code(e){let{gen:a,schema:s,schemaCode:i,data:n,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===s.length)return;let d=s.length>=u.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(r.nil,h);else for(let r of s)(0,t.checkReportMissingProp)(e,r)}():function(){let o=a.let("missing");if(d||l){let s=a.let("valid",!0);e.block$data(s,()=>{var l,c;return l=o,c=s,void(e.setParams({missingProperty:l}),a.forOf(l,i,()=>{a.assign(c,(0,t.propertyInData)(a,n,l,u.ownProperties)),a.if((0,r.not)(c),()=>{e.error(),a.break()})},r.nil))}),e.ok(s)}else a.if((0,t.checkMissingProp)(e,s,o)),(0,t.reportMissingProp)(e,o),a.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:r}=e.it;for(let e of s)if((null==t?void 0:t[e])===void 0&&!r.has(e)){let t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(c,t,c.opts.strictRequired)}}function h(){a.forOf("prop",i,r=>{e.setParams({missingProperty:r}),a.if((0,t.noPropertyInData)(a,n,r,u.ownProperties),()=>e.error())})}}}}),so=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${r} items`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:o,schemaCode:a}=e,s="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${o}.length ${s} ${a}`)}}}),sa=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aF();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),ss=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aU(),r=aj(),o=aO(),a=sa();e.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,r.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,r._)`{i: ${e}, j: ${t}}`},code(e){let{gen:s,data:i,$data:n,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!n&&!l)return;let h=s.let("valid"),p=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(h,function(){let n=s.let("i",(0,r._)`${i}.length`),l=s.let("j");e.setParams({i:n,j:l}),s.assign(h,!0),s.if((0,r._)`${n} > 1`,()=>(p.length>0&&!p.some(e=>"object"===e||"array"===e)?function(o,a){let n=s.name("item"),l=(0,t.checkDataTypes)(p,n,d.opts.strictNumbers,t.DataType.Wrong),c=s.const("indices",(0,r._)`{}`);s.for((0,r._)`;${o}--;`,()=>{s.let(n,(0,r._)`${i}[${o}]`),s.if(l,(0,r._)`continue`),p.length>1&&s.if((0,r._)`typeof ${n} == "string"`,(0,r._)`${n} += "_"`),s.if((0,r._)`typeof ${c}[${n}] == "number"`,()=>{s.assign(a,(0,r._)`${c}[${n}]`),e.error(),s.assign(h,!1).break()}).code((0,r._)`${c}[${n}] = ${o}`)})}:function(t,n){let l=(0,o.useFunc)(s,a.default),c=s.name("outer");s.label(c).for((0,r._)`;${t}--;`,()=>s.for((0,r._)`${n} = ${t}; ${n}--;`,()=>s.if((0,r._)`${l}(${i}[${t}], ${i}[${n}])`,()=>{e.error(),s.assign(h,!1).break(c)})))})(n,l))},(0,r._)`${u} === false`),e.ok(h)}}}),si=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=sa();e.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:a,data:s,$data:i,schemaCode:n,schema:l}=e;i||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(a,o.default)}(${s}, ${n})`):e.fail((0,t._)`${l} !== ${s}`)}}}),sn=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=sa();e.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let a,s,{gen:i,data:n,$data:l,schema:c,schemaCode:u,it:d}=e;if(!l&&0===c.length)throw Error("enum must have non-empty array");let h=c.length>=d.opts.loopEnum,p=()=>null!=a?a:a=(0,r.useFunc)(i,o.default);if(h||l)s=i.let("valid"),e.block$data(s,function(){i.assign(s,!1),i.forOf("v",u,e=>i.if((0,t._)`${p()}(${n}, ${e})`,()=>i.assign(s,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=i.const("vSchema",u);s=(0,t.or)(...c.map((r,o)=>{var a,s;let i;return a=e,"object"==typeof(i=c[s=o])&&null!==i?(0,t._)`${p()}(${n}, ${a}[${s}])`:(0,t._)`${n} === ${i}`}))}e.pass(s)}}}),sl=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a3(),r=a6(),o=a8(),a=se(),s=st(),i=sr(),n=so(),l=ss(),c=si(),u=sn();e.default=[t.default,r.default,o.default,a.default,s.default,i.default,n.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),sc=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=aj(),r=aO();function o(e,o){let{gen:a,schema:s,data:i,keyword:n,it:l}=e;l.items=!0;let c=a.const("len",(0,t._)`${i}.length`);if(!1===s)e.setParams({len:o.length}),e.pass((0,t._)`${c} <= ${o.length}`);else if("object"==typeof s&&!(0,r.alwaysValidSchema)(l,s)){let s=a.var("valid",(0,t._)`${c} <= ${o.length}`);a.if((0,t.not)(s),()=>{var i;return i=s,void a.forRange("i",o.length,c,o=>{e.subschema({keyword:n,dataProp:o,dataPropType:r.Type.Num},i),l.allErrors||a.if((0,t.not)(i),()=>a.break())})}),e.ok(s)}}e.validateAdditionalItems=o,e.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:a}=e,{items:s}=t;Array.isArray(s)?o(e,s):(0,r.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),su=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=aj(),r=aO(),o=az();function a(e,o,s=e.schema){let{gen:i,parentSchema:n,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:a}=u,i=s.length,n=i===e.minItems&&(i===e.maxItems||!1===e[o]);if(t.strictTuples&&!n){let e=`"${c}" is ${i}-tuple, but minItems or maxItems/${o} are not specified or different at path "${a}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(n),u.opts.unevaluated&&s.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(i,s.length,u.items));let d=i.name("valid"),h=i.const("len",(0,t._)`${l}.length`);s.forEach((o,a)=>{(0,r.alwaysValidSchema)(u,o)||(i.if((0,t._)`${h} > ${a}`,()=>e.subschema({keyword:c,schemaProp:a,dataProp:a},d)),e.ok(d))})}e.validateTuple=a,e.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:s}=e;if(Array.isArray(t))return a(e,"additionalItems",t);s.items=!0,(0,r.alwaysValidSchema)(s,t)||e.ok((0,o.validateArray)(e))}}}),sd=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=su();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),sh=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=az(),a=sc();e.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:s,it:i}=e,{prefixItems:n}=s;i.items=!0,(0,r.alwaysValidSchema)(i,t)||(n?(0,a.validateAdditionalItems)(e,n):e.ok((0,o.validateArray)(e)))}}}),sp=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:r}})=>void 0===r?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${r} valid item(s)`,params:({params:{min:e,max:r}})=>void 0===r?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${r}}`},code(e){let o,a,{gen:s,schema:i,parentSchema:n,data:l,it:c}=e,{minContains:u,maxContains:d}=n;c.opts.next?(o=void 0===u?1:u,a=d):o=1;let h=s.const("len",(0,t._)`${l}.length`);if(e.setParams({min:o,max:a}),void 0===a&&0===o)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&o>a){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,i)){let r=(0,t._)`${h} >= ${o}`;void 0!==a&&(r=(0,t._)`${r} && ${h} <= ${a}`),e.pass(r);return}c.items=!0;let p=s.name("valid");function m(){let e=s.name("_valid"),r=s.let("count",0);f(e,()=>s.if(e,()=>{var e;return e=r,void(s.code((0,t._)`${e}++`),void 0===a?s.if((0,t._)`${e} >= ${o}`,()=>s.assign(p,!0).break()):(s.if((0,t._)`${e} > ${a}`,()=>s.assign(p,!1).break()),1===o?s.assign(p,!0):s.if((0,t._)`${e} >= ${o}`,()=>s.assign(p,!0))))}))}function f(t,o){s.forRange("i",0,h,a=>{e.subschema({keyword:"contains",dataProp:a,dataPropType:r.Type.Num,compositeRule:!0},t),o()})}void 0===a&&1===o?f(p,()=>s.if(p,()=>s.break())):0===o?(s.let(p,!0),void 0!==a&&s.if((0,t._)`${l}.length > 0`,m)):(s.let(p,!1),m()),e.result(p,()=>e.reset())}}}),sm=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=aj(),r=aO(),o=az();e.error={message:({params:{property:e,depsCount:r,deps:o}})=>(0,t.str)`must have ${1===r?"property":"properties"} ${o} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:o,missingProperty:a}})=>(0,t._)`{property: ${e},
5
+ || ${n} === "boolean" || ${a} === null`).assign(l,(0,i._)`[${a}]`)}}(e);o.else(),p(e),o.endIf(),o.if((0,i._)`${l} !== undefined`,()=>{o.assign(a,l),function({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${r}]`,o))}(e,l)})}(e,r,h):p(e)})}return m};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,o,a=t.Correct){let s,n=a===t.Correct?i.operators.EQ:i.operators.NEQ;switch(e){case"null":return(0,i._)`${r} ${n} null`;case"array":s=(0,i._)`Array.isArray(${r})`;break;case"object":s=(0,i._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":s=l((0,i._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":s=l();break;default:return(0,i._)`typeof ${r} ${n} ${e}`}return a===t.Correct?s:(0,i.not)(s);function l(e=i.nil){return(0,i.and)((0,i._)`typeof ${r} == "number"`,e,o?(0,i._)`isFinite(${r})`:i.nil)}}function d(e,t,r,o){let a;if(1===e.length)return u(e[0],t,r,o);let s=(0,n.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;a=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else a=i.nil;for(let e in s.number&&delete s.integer,s)a=(0,i.and)(a,u(e,t,r,o));return a}e.checkDataType=u,e.checkDataTypes=d;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function p(e){let t=function(e){let{gen:t,data:r,schema:o}=e,a=(0,n.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:a,schemaValue:a,parentSchema:o,params:{},it:e}}(e);(0,s.reportError)(t,h)}e.reportTypeError=p}),aU=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=aj(),r=aO();function o(e,o,a){let{gen:s,compositeRule:i,data:n,opts:l}=e;if(void 0===a)return;let c=(0,t._)`${n}${(0,t.getProperty)(o)}`;if(i)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=(0,t._)`${c} === undefined`;"empty"===l.useDefaults&&(u=(0,t._)`${u} || ${c} === null || ${c} === ""`),s.if(u,(0,t._)`${c} = ${(0,t.stringify)(a)}`)}e.assignDefaults=function(e,t){let{properties:r,items:a}=e.schema;if("object"===t&&r)for(let t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(a)&&a.forEach((t,r)=>o(e,r,t.default))}}),az=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=aj(),r=aO(),o=aN(),a=aO();function s(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function i(e,r,o){return(0,t._)`${s(e)}.call(${r}, ${o})`}function n(e,r,o,a){let s=(0,t._)`${r}${(0,t.getProperty)(o)} === undefined`;return a?(0,t.or)(s,(0,t.not)(i(e,r,o))):s}function l(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){let{gen:o,data:a,it:s}=e;o.if(n(o,a,r,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:o}},a,s){return(0,t.or)(...a.map(a=>(0,t.and)(n(e,r,a,o.ownProperties),(0,t._)`${s} = ${a}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=s,e.isOwnProperty=i,e.propertyInData=function(e,r,o,a){let s=(0,t._)`${r}${(0,t.getProperty)(o)} !== undefined`;return a?(0,t._)`${s} && ${i(e,r,o)}`:s},e.noPropertyInData=n,e.allSchemaProperties=l,e.schemaProperties=function(e,t){return l(t).filter(o=>!(0,r.alwaysValidSchema)(e,t[o]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:a,topSchemaRef:s,schemaPath:i,errorPath:n},it:l},c,u,d){let h=d?(0,t._)`${e}, ${r}, ${s}${i}`:r,p=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,n)],[o.default.parentData,l.parentData],[o.default.parentDataProperty,l.parentDataProperty],[o.default.rootData,o.default.rootData]];l.opts.dynamicRef&&p.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let m=(0,t._)`${h}, ${a.object(...p)}`;return u!==t.nil?(0,t._)`${c}.call(${u}, ${m})`:(0,t._)`${c}(${m})`};let c=(0,t._)`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},o){let s=r.unicodeRegExp?"u":"",{regExp:i}=r.code,n=i(o,s);return e.scopeValue("pattern",{key:n.toString(),ref:n,code:(0,t._)`${"new RegExp"===i.code?c:(0,a.useFunc)(e,i)}(${o}, ${s})`})},e.validateArray=function(e){let{gen:o,data:a,keyword:s,it:i}=e,n=o.name("valid");if(i.allErrors){let e=o.let("valid",!0);return l(()=>o.assign(e,!1)),e}return o.var(n,!0),l(()=>o.break()),n;function l(i){let l=o.const("len",(0,t._)`${a}.length`);o.forRange("i",0,l,a=>{e.subschema({keyword:s,dataProp:a,dataPropType:r.Type.Num},n),o.if((0,t.not)(n),i)})}},e.validateUnion=function(e){let{gen:o,schema:a,keyword:s,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");if(a.some(e=>(0,r.alwaysValidSchema)(i,e))&&!i.opts.unevaluated)return;let n=o.let("valid",!1),l=o.name("_valid");o.block(()=>a.forEach((r,a)=>{let i=e.subschema({keyword:s,schemaProp:a,compositeRule:!0},l);o.assign(n,(0,t._)`${n} || ${l}`),e.mergeValidEvaluated(i,l)||o.if((0,t.not)(n))})),e.result(n,()=>e.reset(),()=>e.error(!0))}}),aD=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=aj(),r=aN(),o=az(),a=aq();function s(e){let{gen:r,data:o,it:a}=e;r.if(a.parentData,()=>r.assign(o,(0,t._)`${a.parentData}[${a.parentDataProperty}]`))}function i(e,r,o){if(void 0===o)throw Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof o?{ref:o}:{ref:o,code:(0,t.stringify)(o)})}e.macroKeywordCode=function(e,r){let{gen:o,keyword:a,schema:s,parentSchema:n,it:l}=e,c=r.macro.call(l.self,s,n,l),u=i(o,a,c);!1!==l.opts.validateSchema&&l.self.validateSchema(c,!0);let d=o.name("valid");e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${l.errSchemaPath}/${a}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,n){var l;let{gen:c,keyword:u,schema:d,parentSchema:h,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(m,n);let f=i(c,u,!p&&n.compile?n.compile.call(m.self,d,h,m):n.validate),y=c.let("valid");function v(a=n.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?r.default.this:r.default.self,i=!("compile"in n&&!p||!1===n.schema);c.assign(y,(0,t._)`${a}${(0,o.callValidateCode)(e,f,s,i)}`,n.modifying)}function g(e){var r;c.if((0,t.not)(null!=(r=n.valid)?r:y),e)}e.block$data(y,function(){if(!1===n.errors)v(),n.modifying&&s(e),g(()=>e.error());else{let o,i,l=n.async?(o=c.let("ruleErrs",null),c.try(()=>v((0,t._)`await `),e=>c.assign(y,!1).if((0,t._)`${e} instanceof ${m.ValidationError}`,()=>c.assign(o,(0,t._)`${e}.errors`),()=>c.throw(e))),o):(i=(0,t._)`${f}.errors`,c.assign(i,null),v(t.nil),i);n.modifying&&s(e),g(()=>(function(e,o){let{gen:s}=e;s.if((0,t._)`Array.isArray(${o})`,()=>{s.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${o} : ${r.default.vErrors}.concat(${o})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,a.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(l=n.valid)?l:y)},e.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},e.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:o},a,s){if(Array.isArray(a.keyword)?!a.keyword.includes(s):a.keyword!==s)throw Error("ajv implementation error");let i=a.dependencies;if(null==i?void 0:i.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(a.validateSchema&&!a.validateSchema(e[s])){let e=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(a.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}}),aH=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=aj(),r=aO();e.getSubschema=function(e,{keyword:o,schemaProp:a,schema:s,schemaPath:i,errSchemaPath:n,topSchemaRef:l}){if(void 0!==o&&void 0!==s)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){let s=e.schema[o];return void 0===a?{schema:s,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(o)}`,errSchemaPath:`${e.errSchemaPath}/${o}`}:{schema:s[a],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(o)}${(0,t.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${o}/${(0,r.escapeFragment)(a)}`}}if(void 0!==s){if(void 0===i||void 0===n||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:i,topSchemaRef:l,errSchemaPath:n}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,o,{dataProp:a,dataPropType:s,data:i,dataTypes:n,propertyName:l}){if(void 0!==i&&void 0!==a)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=o;if(void 0!==a){let{errorPath:i,dataPathArr:n,opts:l}=o;u(c.let("data",(0,t._)`${o.data}${(0,t.getProperty)(a)}`,!0)),e.errorPath=(0,t.str)`${i}${(0,r.getErrorPath)(a,s,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${a}`,e.dataPathArr=[...n,e.parentDataProperty]}function u(t){e.data=t,e.dataLevel=o.dataLevel+1,e.dataTypes=[],o.definedProperties=new Set,e.parentData=o.data,e.dataNames=[...o.dataNames,t]}void 0!==i&&(u(i instanceof t.Name?i:c.let("data",i,!0)),void 0!==l&&(e.propertyName=l)),n&&(e.dataTypes=n)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:a,allErrors:s}){void 0!==o&&(e.compositeRule=o),void 0!==a&&(e.createErrors=a),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}}),aF=rK((e,t)=>{t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((o=t.length)!=r.length)return!1;for(a=o;0!=a--;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((o=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(a=o;0!=a--;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=o;0!=a--;){var o,a,s,i=s[a];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}}),aG=rK((e,t)=>{var r=t.exports=function(e,t,o){"function"==typeof t&&(o=t,t={});var a="function"==typeof(o=t.cb||o)?o:o.pre||function(){};!function e(t,o,a,s,i,n,l,c,u,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in o(s,i,n,l,c,u,d),s){var p=s[h];if(Array.isArray(p)){if(h in r.arrayKeywords)for(var m=0;m<p.length;m++)e(t,o,a,p[m],i+"/"+h+"/"+m,n,i,h,s,m)}else if(h in r.propsKeywords){if(p&&"object"==typeof p)for(var f in p)e(t,o,a,p[f],i+"/"+h+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),n,i,h,s,f)}else(h in r.keywords||t.allKeys&&!(h in r.skipKeywords))&&e(t,o,a,p,i+"/"+h,n,i,h,s)}a(s,i,n,l,c,u,d)}}(t,a,o.post||function(){},e,"",e)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}),aK=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=aO(),r=aF(),o=aG(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(e,r=!0){return"boolean"==typeof e||(!0===r?!function e(t){for(let r in t){if(s.has(r))return!0;let o=t[r];if(Array.isArray(o)&&o.some(e)||"object"==typeof o&&e(o))return!0}return!1}(e):!!r&&function e(r){let o=0;for(let s in r)if("$ref"===s||(o++,!a.has(s)&&("object"==typeof r[s]&&(0,t.eachItem)(r[s],t=>o+=e(t)),o===1/0)))return 1/0;return o}(e)<=r)};let s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(e,t="",r){return!1!==r&&(t=c(t)),n(e,e.parse(t))}function n(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=i,e._getFullPath=n;let l=/#\/?$/;function c(e){return e?e.replace(l,""):""}e.normalizeId=c,e.resolveUrl=function(e,t,r){return r=c(r),e.resolve(t,r)};let u=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:a,uriResolver:s}=this.opts,n=c(e[a]||t),l={"":n},d=i(s,n,!1),h={},p=new Set;return o(e,{allKeys:!0},(e,t,r,o)=>{if(void 0===o)return;let s=d+t,i=l[o];function n(t){let r=this.opts.uriResolver.resolve;if(t=c(i?r(i,t):t),p.has(t))throw f(t);p.add(t);let o=this.refs[t];return"string"==typeof o&&(o=this.refs[o]),"object"==typeof o?m(e,o.schema,t):t!==c(s)&&("#"===t[0]?(m(e,h[t],t),h[t]=e):this.refs[t]=s),t}function y(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);n.call(this,`#${e}`)}}"string"==typeof e[a]&&(i=n.call(this,e[a])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),l[t]=i}),h;function m(e,t,o){if(void 0!==t&&!r(e,t))throw f(o)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}}),aW=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=aM(),r=aV(),o=aL(),a=aV(),s=aU(),i=aD(),n=aH(),l=aj(),c=aN(),u=aK(),d=aO(),h=aq();function p({gen:e,validateName:t,schema:r,schemaEnv:o,opts:a},s){var i;a.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,o.$async,()=>{var t,o;e.code((0,l._)`"use strict"; ${m(r,a)}`),t=e,o=a,t.if(c.default.valCxt,()=>{t.var(c.default.instancePath,(0,l._)`${c.default.valCxt}.${c.default.instancePath}`),t.var(c.default.parentData,(0,l._)`${c.default.valCxt}.${c.default.parentData}`),t.var(c.default.parentDataProperty,(0,l._)`${c.default.valCxt}.${c.default.parentDataProperty}`),t.var(c.default.rootData,(0,l._)`${c.default.valCxt}.${c.default.rootData}`),o.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{t.var(c.default.instancePath,(0,l._)`""`),t.var(c.default.parentData,(0,l._)`undefined`),t.var(c.default.parentDataProperty,(0,l._)`undefined`),t.var(c.default.rootData,c.default.data),o.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(s)}):e.func(t,(0,l._)`${c.default.data}, ${(i=a,(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${i.dynamicRef?(0,l._)`, ${c.default.dynamicAnchors}={}`:l.nil}}={}`)}`,o.$async,()=>e.code(m(r,a)).code(s))}function m(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,l._)`/*# sourceURL=${r} */`:l.nil}function f({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function v(e){(0,d.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:o,self:a}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function g(e,t){if(e.opts.jtd)return S(e,[],!1,t);let o=(0,r.getSchemaTypes)(e.schema);S(e,o,!(0,r.coerceAndCheckDataType)(e,o),t)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:a}){let s=r.$comment;if(!0===a.$comment)e.code((0,l._)`${c.default.self}.logger.log(${s})`);else if("function"==typeof a.$comment){let r=(0,l.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${c.default.self}.opts.$comment(${s}, ${r}, ${a}.schema)`)}}function S(e,t,r,s){var i,n,u,h;let{gen:p,schema:m,data:f,allErrors:y,opts:v,self:g}=e,{RULES:_}=g;if(m.$ref&&(v.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(m,_)))return void p.block(()=>P(e,"$ref",_.all.$ref.definition));function S(i){(0,o.shouldUseGroup)(m,i)&&(i.type?(p.if((0,a.checkDataType)(i.type,f,v.strictNumbers)),b(e,i),1===t.length&&t[0]===i.type&&r&&(p.else(),(0,a.reportTypeError)(e)),p.endIf()):b(e,i),y||p.if((0,l._)`${c.default.errors} === ${s||0}`))}v.jtd||(i=e,n=t,!i.schemaEnv.meta&&i.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{$(e.dataTypes,t)||w(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let o of e.dataTypes)$(t,o)?r.push(o):t.includes("integer")&&"number"===o&&r.push("integer");e.dataTypes=r}(e,t)}}(i,n),i.opts.allowUnionTypes||(u=i,(h=n).length>1&&!(2===h.length&&h.includes("null"))&&w(u,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let a in r){let s=r[a];if("object"==typeof s&&(0,o.shouldUseRule)(e.schema,s)){let{type:r}=s.definition;r.length&&!r.some(e=>{var r,o;return r=t,o=e,r.includes(o)||"number"===o&&r.includes("integer")})&&w(e,`missing type "${r.join(",")}" for keyword "${a}"`)}}}(i,i.dataTypes))),p.block(()=>{for(let e of _.rules)S(e);S(_.post)})}function b(e,t){let{gen:r,schema:a,opts:{useDefaults:i}}=e;i&&(0,s.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,o.shouldUseRule)(a,r)&&P(e,r.keyword,r.definition,t.type)})}function $(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function w(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}e.validateFunctionCode=function(e){y(e)&&(v(e),f(e))?function(e){let{schema:t,opts:r,gen:o}=e;p(e,()=>{r.$comment&&t.$comment&&_(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),o.let(c.default.vErrors,null),o.let(c.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,l._)`${r}.evaluated`),t.if((0,l._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,l._)`${e.evaluated}.props`,(0,l._)`undefined`)),t.if((0,l._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,l._)`${e.evaluated}.items`,(0,l._)`undefined`))}(e),g(e),function(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:a,opts:s}=e;r.$async?t.if((0,l._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,l._)`new ${a}(${c.default.vErrors})`)):(t.assign((0,l._)`${o}.errors`,c.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:o}){r instanceof l.Name&&e.assign((0,l._)`${t}.props`,r),o instanceof l.Name&&e.assign((0,l._)`${t}.items`,o)}(e),t.return((0,l._)`${c.default.errors} === 0`))}(e)})}(e):p(e,()=>(0,t.topBoolOrEmptySchema)(e))};var R=class{constructor(e,t,r){if((0,i.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",T(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,l.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,l._)`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=l.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=l.nil,t=l.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:a,def:s}=this;r.if((0,l.or)((0,l._)`${o} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(a.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==l.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:s}=this;return(0,l.or)(function(){if(r.length){if(!(t instanceof l.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,l._)`${(0,a.checkDataTypes)(e,t,s.opts.strictNumbers,a.DataType.Wrong)}`}return l.nil}(),function(){if(o.validateSchema){let r=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}())}subschema(e,r){let o=(0,n.getSubschema)(this.it,e);(0,n.extendSubschemaData)(o,this.it,e),(0,n.extendSubschemaMode)(o,e);let a={...this.it,...o,items:void 0,props:void 0};return!function(e,r){if(y(e)&&(v(e),f(e)))return function(e,t){var r;let o,{schema:a,gen:s,opts:i}=e;i.$comment&&a.$comment&&_(e),(o=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,u.resolveUrl)(r.opts.uriResolver,r.baseId,o)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let n=s.const("_errs",c.default.errors);g(e,n),s.var(t,(0,l._)`${n} === ${c.default.errors}`)}(e,r);(0,t.boolOrEmptySchema)(e,r)}(a,r),a}mergeEvaluated(e,t){let{it:r,gen:o}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(o,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(o,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return o.if(t,()=>this.mergeEvaluated(e,l.Name)),!0}};function P(e,t,r,o){let a=new R(e,r,t);"code"in r?r.code(a,o):a.$data&&r.validate?(0,i.funcKeywordCode)(a,r):"macro"in r?(0,i.macroKeywordCode)(a,r):(r.compile||r.validate)&&(0,i.funcKeywordCode)(a,r)}e.KeywordCxt=R;let E=/^\/(?:[^~]|~0|~1)*$/,C=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let a,s;if(""===e)return c.default.rootData;if("/"===e[0]){if(!E.test(e))throw Error(`Invalid JSON-pointer: ${e}`);a=e,s=c.default.rootData}else{let i=C.exec(e);if(!i)throw Error(`Invalid JSON-pointer: ${e}`);let l=+i[1];if("#"===(a=i[2])){if(l>=t)throw Error(n("property/index",l));return o[t-l]}if(l>t)throw Error(n("data",l));if(s=r[t-l],!a)return s}let i=s;for(let e of a.split("/"))e&&(s=(0,l._)`${s}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,i=(0,l._)`${i} && ${s}`);return i;function n(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=T}),aJ=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}}),aB=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aK();e.default=class extends Error{constructor(e,r,o,a){super(a||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,o),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}}),aZ=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=aj(),r=aJ(),o=aN(),a=aK(),s=aO(),i=aW();var n=class{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,a.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}};function l(e){let s,n,l=u.call(this,e);if(l)return l;let c=(0,a.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:h}=this.opts.code,{ownProperties:p}=this.opts,m=new t.CodeGen(this.scope,{es5:d,lines:h,ownProperties:p});e.$async&&(s=m.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let f=m.scopeName("validate");e.validateName=f;let y={gen:m,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:m.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,i.validateFunctionCode)(y),m.optimize(this.opts.code.optimize);let r=m.toString();n=`${m.scopeRefs(o.default.scope)}return ${r}`,this.opts.code.process&&(n=this.opts.code.process(n,e));let a=Function(`${o.default.self}`,`${o.default.scope}`,n)(this,this.scope.get());if(this.scope.value(f,{ref:a}),a.errors=null,a.schema=e.schema,a.schemaEnv=e,e.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:f,validateCode:r,scopeValues:m._values}),this.opts.unevaluated){let{props:e,items:r}=y;a.evaluated={props:e instanceof t.Name?void 0:e,items:r instanceof t.Name?void 0:r,dynamicProps:e instanceof t.Name,dynamicItems:r instanceof t.Name},a.source&&(a.source.evaluated=(0,t.stringify)(a.evaluated))}return e.validate=a,e}catch(t){throw delete e.validate,delete e.validateName,n&&this.logger.error("Error compiling schema, function code:",n),t}finally{this._compilations.delete(e)}}function c(e){return(0,a.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function u(e){for(let o of this._compilations){var t,r;if(t=o,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return o}}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){let r=this.opts.uriResolver.parse(t),o=(0,a._getFullPath)(this.opts.uriResolver,r),s=(0,a.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===s)return m.call(this,r,e);let i=(0,a.normalizeId)(o),c=this.refs[i]||this.schemas[i];if("string"==typeof c){let t=h.call(this,e,c);if("object"!=typeof(null==t?void 0:t.schema))return;return m.call(this,r,t)}if("object"==typeof(null==c?void 0:c.schema)){if(c.validate||l.call(this,c),i===(0,a.normalizeId)(t)){let{schema:t}=c,{schemaId:r}=this.opts,o=t[r];return o&&(s=(0,a.resolveUrl)(this.opts.uriResolver,s,o)),new n({schema:t,schemaId:r,root:e,baseId:s})}return m.call(this,r,c)}}e.SchemaEnv=n,e.compileSchema=l,e.resolveRef=function(e,t,r){var o;r=(0,a.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=d.call(this,e,r);if(void 0===i){let a=null==(o=e.localRefs)?void 0:o[r],{schemaId:s}=this.opts;a&&(i=new n({schema:a,schemaId:s,root:e,baseId:t}))}if(void 0!==i)return e.refs[r]=c.call(this,i)},e.getCompilingSchema=u,e.resolveSchema=h;let p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,{baseId:t,schema:r,root:o}){var i;let l;if((null==(i=e.fragment)?void 0:i[0])!=="/")return;for(let o of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,s.unescapeFragment)(o)];if(void 0===e)return;let i="object"==typeof(r=e)&&r[this.opts.schemaId];!p.has(o)&&i&&(t=(0,a.resolveUrl)(this.opts.uriResolver,t,i))}if("boolean"!=typeof r&&r.$ref&&!(0,s.schemaHasRulesButRef)(r,this.RULES)){let e=(0,a.resolveUrl)(this.opts.uriResolver,t,r.$ref);l=h.call(this,o,e)}let{schemaId:c}=this.opts;if((l=l||new n({schema:r,schemaId:c,root:o,baseId:t})).schema!==l.root.schema)return l}}),aX=rK((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),aQ=rK((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function a(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(48!==(r=e[o].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(!((r=e[o].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}function s(e){return e.length=0,!0}function i(e,t,r){if(e.length){let o=a(e);if(""===o)return r.error=!0,!1;t.push(o),e.length=0}return!0}function n(e){if(2>function(e){let t=0;for(let r=0;r<e.length;r++)":"===e[r]&&t++;return t}(e))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],l=!1,c=!1,u=i;for(let a=0;a<e.length;a++){let i=e[a];if("["!==i&&"]"!==i)if(":"===i){if(!0===l&&(c=!0),!u(n,o,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(l=!0),o.push(":");continue}else if("%"===i){if(!u(n,o,r))break;u=s}else{n.push(i);continue}}return n.length&&(u===s?r.zone=n.join(""):c?o.push(n.join("")):o.push(a(n))),r.address=o.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}t.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let r=unescape(e.host);if(!o(r)){let t=n(r);r=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(r)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){let r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e,r=[],o=-1,a=0;for(;a=t.length;){if(1===a)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===a){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===a&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(o=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")},isIPv4:o,isUUID:r,normalizeIPv6:n,stringArrayToHexStripped:a}}),aY=rK((e,t)=>{let{isUUID:r}=aQ(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a=["http","https","ws","wss","urn","urn:uuid"];function s(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function n(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let l={scheme:"http",domainHost:!0,parse:i,serialize:n},c={scheme:"https",domainHost:l.domainHost,parse:i,serialize:n},u={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=s(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(s(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},d={scheme:"wss",domainHost:u.domainHost,parse:u.parse,serialize:u.serialize},h={http:l,https:c,ws:u,wss:d,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(o);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let a=p(`${o}:${t.nid||e.nid}`);e.path=void 0,a&&(e=a.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),a=p(`${r}:${t.nid||o}`);a&&(e=a.serialize(e,t));let s=e,i=e.nss;return s.path=`${o||t.nid}:${i}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&r(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function p(e){return e&&(h[e]||h[e.toLowerCase()])||void 0}Object.setPrototypeOf(h,null),t.exports={wsIsSecure:s,SCHEMES:h,isValidSchemeName:function(e){return -1!==a.indexOf(e)},getSchemeHandler:p}}),a0=rK((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:a,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:n}=aQ(),{SCHEMES:l,getSchemeHandler:c}=aY();function u(e,t,r,a){let s={};return a||(e=p(d(e,r),r),t=p(d(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=o(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=o(t.path||""),s.query=t.query):(t.path?("/"===t.path[0]?s.path=o(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=o(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function d(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),i=[],n=c(s.scheme||r.scheme);n&&n.serialize&&n.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&i.push(r.scheme,":");let l=a(r);if(void 0!==l&&("suffix"!==s.reference&&i.push("//"),i.push(l),r.path&&"/"!==r.path[0]&&i.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||n&&n.absolutePath||(e=o(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),i.push(e)}return void 0!==r.query&&i.push("?",r.query),void 0!==r.fragment&&i.push("#",r.fragment),i.join("")}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(e,t){let o=Object.assign({},t),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1;"suffix"===o.reference&&(e=o.scheme?o.scheme+":"+e:"//"+e);let l=e.match(h);if(l){if(a.scheme=l[1],a.userinfo=l[3],a.host=l[4],a.port=parseInt(l[5],10),a.path=l[6]||"",a.query=l[7],a.fragment=l[8],isNaN(a.port)&&(a.port=l[5]),a.host)if(!1===i(a.host)){let e=r(a.host);a.host=e.host.toLowerCase(),s=e.isIPV6}else s=!0;void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||void 0!==a.query||a.path?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",o.reference&&"suffix"!==o.reference&&o.reference!==a.reference&&(a.error=a.error||"URI is not a "+o.reference+" reference.");let t=c(o.scheme||a.scheme);if(!o.unicodeSupport&&(!t||!t.unicodeSupport)&&a.host&&(o.domainHost||t&&t.domainHost)&&!1===s&&n(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(e){a.error=a.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==a.scheme&&(a.scheme=unescape(a.scheme)),void 0!==a.host&&(a.host=unescape(a.host))),a.path&&(a.path=escape(unescape(a.path))),a.fragment&&(a.fragment=encodeURI(decodeURIComponent(a.fragment)))),t&&t.parse&&t.parse(a,o)}else a.error=a.error||"URI can not be parsed.";return a}let m={SCHEMES:l,normalize:function(e,t){return"string"==typeof e?e=d(p(e,t),t):"object"==typeof e&&(e=p(d(e,t),t)),e},resolve:function(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},a=u(p(e,o),p(t,o),o,!0);return o.skipEscape=!0,d(a,o)},resolveComponent:u,equal:function(e,t,r){return"string"==typeof e?e=d(s(p(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=d(s(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=d(s(p(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=d(s(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:d,parse:p};t.exports=m,t.exports.default=m,t.exports.fastUri=m}),a1=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a0();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),a2=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=aJ(),a=aB(),s=aA(),i=aZ(),n=aj(),l=aK(),c=aV(),u=aO(),d=aX(),h=a1(),p=(e,t)=>new RegExp(e,t);p.code="new RegExp";let m=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var g=class{constructor(e={}){var t,r,o,a,i,l,c,u,d,m,g,S,E,C,T,k,I,x,j,O,N,q,M,A,L,V;let U,z,D,H,F;this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...(U=(t=e).strict,D=!0===(z=null==(r=t.code)?void 0:r.optimize)||void 0===z?1:z||0,H=null!=(a=null==(o=t.code)?void 0:o.regExp)?a:p,F=null!=(i=t.uriResolver)?i:h.default,{strictSchema:null==(c=null!=(l=t.strictSchema)?l:U)||c,strictNumbers:null==(d=null!=(u=t.strictNumbers)?u:U)||d,strictTypes:null!=(g=null!=(m=t.strictTypes)?m:U)?g:"log",strictTuples:null!=(E=null!=(S=t.strictTuples)?S:U)?E:"log",strictRequired:null!=(T=null!=(C=t.strictRequired)?C:U)&&T,code:t.code?{...t.code,optimize:D,regExp:H}:{optimize:D,regExp:H},loopRequired:null!=(k=t.loopRequired)?k:200,loopEnum:null!=(I=t.loopEnum)?I:200,meta:null==(x=t.meta)||x,messages:null==(j=t.messages)||j,inlineRefs:null==(O=t.inlineRefs)||O,schemaId:null!=(N=t.schemaId)?N:"$id",addUsedSchema:null==(q=t.addUsedSchema)||q,validateSchema:null==(M=t.validateSchema)||M,validateFormats:null==(A=t.validateFormats)||A,unicodeRegExp:null==(L=t.unicodeRegExp)||L,int32range:null==(V=t.int32range)||V,uriResolver:F})};let{es5:G,lines:K}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:f,es5:G,lines:K}),this.logger=function(e){if(!1===e)return P;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);let W=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),_.call(this,y,e,"NOT SUPPORTED"),_.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=R.call(this),e.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&w.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=d;"id"===r&&((o={...d}).id=o.$id,delete o.$id),t&&e&&this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);return"$async"in r||(this.errors=r.errors),o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(e,t){await s.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await o.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return n.call(this,t),await l.call(this,t.missingSchema),i.call(this,e)}}function n({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await c.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function c(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,o=this.opts.validateSchema){let a;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,o);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(a=e[t])&&"string"!=typeof a)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||a),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return o}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,o=new i.SchemaEnv({schema:{},schemaId:r});if(!(t=i.resolveSchema.call(this,o,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,l.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(C.call(this,r,t),!t)return(0,u.eachItem)(r,e=>T.call(this,e)),this;I.call(this,t);let o={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===o.type.length?e=>T.call(this,e,o):e=>o.type.forEach(t=>T.call(this,e,o,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let o of(e=JSON.parse(JSON.stringify(e)),t)){let t=o.split("/").slice(1),a=e;for(let e of t)a=a[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:o}=t.definition,s=a[e];o&&s&&(a[e]=j(s))}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];(!t||t.test(r))&&("string"==typeof o?delete e[r]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[r]))}}_addSchema(e,t,r,o=this.opts.validateSchema,a=this.opts.addUsedSchema){let s,{schemaId:n}=this.opts;if("object"==typeof e)s=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let c=this._cache.get(e);if(void 0!==c)return c;r=(0,l.normalizeId)(s||r);let u=l.getSchemaRefs.call(this,e,r);return c=new i.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),a&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):i.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,e)}finally{this.opts=t}}};function _(e,t,r,o="error"){for(let a in e)a in t&&this.logger[o](`${r}: option ${a}. ${e[a]}`)}function S(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function $(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function w(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function R(){let e={...this.opts};for(let t of m)delete e[t];return e}g.ValidationError=o.default,g.MissingRefError=a.default,e.default=g;let P={log(){},warn(){},error(){}},E=/^[a-z_$][a-z0-9_$:-]*$/i;function C(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!E.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function T(e,t,r){var o;let a=null==t?void 0:t.post;if(r&&a)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=a?s.post:s.rules.find(({type:e})=>e===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let n={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?k.call(this,i,n,t.before):i.rules.push(n),s.all[e]=n,null==(o=t.implements)||o.forEach(e=>this.addKeyword(e))}function k(e,t,r){let o=e.rules.findIndex(e=>e.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function I(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=j(t)),e.validateSchema=this.compile(t,!0))}let x={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function j(e){return{anyOf:[e,x]}}}),a9=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),a4=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=aB(),r=az(),o=aj(),a=aN(),s=aZ(),i=aO();function n(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,o._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,s,n){let{gen:l,it:c}=e,{allErrors:u,schemaEnv:d,opts:h}=c,p=h.passContext?a.default.this:o.nil;function m(e){let t=(0,o._)`${e}.errors`;l.assign(a.default.vErrors,(0,o._)`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`),l.assign(a.default.errors,(0,o._)`${a.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;let r=null==(t=null==s?void 0:s.validate)?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=i.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,o._)`${e}.evaluated.props`);c.props=i.mergeEvaluated.props(l,t,c.props,o.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=i.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,o._)`${e}.evaluated.items`);c.items=i.mergeEvaluated.items(l,t,c.items,o.Name)}}n?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let a=l.let("valid");l.try(()=>{l.code((0,o._)`await ${(0,r.callValidateCode)(e,t,p)}`),f(t),u||l.assign(a,!0)},e=>{l.if((0,o._)`!(${e} instanceof ${c.ValidationError})`,()=>l.throw(e)),m(e),u||l.assign(a,!1)}),e.ok(a)}():e.result((0,r.callValidateCode)(e,t,p),()=>f(t),()=>m(t))}e.getValidate=n,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){var r,a;let i,c,u,{gen:d,schema:h,it:p}=e,{baseId:m,schemaEnv:f,validateName:y,opts:v,self:g}=p,{root:_}=f;if(("#"===h||"#/"===h)&&m===_.baseId){if(f===_)return l(e,y,f,f.$async);let t=d.scopeValue("root",{ref:_});return l(e,(0,o._)`${t}.validate`,_,_.$async)}let S=s.resolveRef.call(g,_,m,h);if(void 0===S)throw new t.default(p.opts.uriResolver,m,h);return S instanceof s.SchemaEnv?void l(e,n(e,r=S),r,r.$async):(a=S,i=d.scopeValue("schema",!0===v.code.source?{ref:a,code:(0,o.stringify)(a)}:{ref:a}),c=d.name("valid"),u=e.subschema({schema:a,dataTypes:[],schemaPath:o.nil,topSchemaRef:i,errSchemaPath:h},c),void(e.mergeEvaluated(u),e.ok(c)))}}}),a5=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a9(),r=a4();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),a3=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}};e.default={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must be ${o[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>(0,t._)`{comparison: ${o[e].okStr}, limit: ${r}}`},code(e){let{keyword:r,data:a,schemaCode:s}=e;e.fail$data((0,t._)`${a} ${o[r].fail} ${s} || isNaN(${a})`)}}}),a6=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:r,data:o,schemaCode:a,it:s}=e,i=s.opts.multipleOfPrecision,n=r.let("res"),l=i?(0,t._)`Math.abs(Math.round(${n}) - ${n}) > 1e-${i}`:(0,t._)`${n} !== parseInt(${n})`;e.fail$data((0,t._)`(${a} === 0 || (${n} = ${o}/${a}, ${l}))`)}}}),a7=rK(e=>{function t(e){let t,r=e.length,o=0,a=0;for(;a<r;)o++,(t=e.charCodeAt(a++))>=55296&&t<=56319&&a<r&&(64512&(t=e.charCodeAt(a)))==56320&&a++;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),a8=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=a7();e.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${r} characters`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:a,data:s,schemaCode:i,it:n}=e,l="maxLength"===a?t.operators.GT:t.operators.LT,c=!1===n.opts.unicode?(0,t._)`${s}.length`:(0,t._)`${(0,r.useFunc)(e.gen,o.default)}(${s})`;e.fail$data((0,t._)`${c} ${l} ${i}`)}}}),se=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aO(),o=aj();e.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,o.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,o._)`{pattern: ${e}}`},code(e){let{gen:a,data:s,$data:i,schema:n,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(i){let{regExp:t}=c.opts.code,i="new RegExp"===t.code?(0,o._)`new RegExp`:(0,r.useFunc)(a,t),n=a.let("valid");a.try(()=>a.assign(n,(0,o._)`${i}(${l}, ${u}).test(${s})`),()=>a.assign(n,!1)),e.fail$data((0,o._)`!${n}`)}else{let r=(0,t.usePattern)(e,n);e.fail$data((0,o._)`!${r}.test(${s})`)}}}}),st=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${r} properties`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:o,schemaCode:a}=e,s="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${o}).length ${s} ${a}`)}}}),sr=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aj(),o=aO();e.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,r.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,r._)`{missingProperty: ${e}}`},code(e){let{gen:a,schema:s,schemaCode:i,data:n,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===s.length)return;let d=s.length>=u.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(r.nil,h);else for(let r of s)(0,t.checkReportMissingProp)(e,r)}():function(){let o=a.let("missing");if(d||l){let s=a.let("valid",!0);e.block$data(s,()=>{var l,c;return l=o,c=s,void(e.setParams({missingProperty:l}),a.forOf(l,i,()=>{a.assign(c,(0,t.propertyInData)(a,n,l,u.ownProperties)),a.if((0,r.not)(c),()=>{e.error(),a.break()})},r.nil))}),e.ok(s)}else a.if((0,t.checkMissingProp)(e,s,o)),(0,t.reportMissingProp)(e,o),a.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:r}=e.it;for(let e of s)if((null==t?void 0:t[e])===void 0&&!r.has(e)){let t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(c,t,c.opts.strictRequired)}}function h(){a.forOf("prop",i,r=>{e.setParams({missingProperty:r}),a.if((0,t.noPropertyInData)(a,n,r,u.ownProperties),()=>e.error())})}}}}),so=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${r} items`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:o,schemaCode:a}=e,s="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${o}.length ${s} ${a}`)}}}),sa=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aF();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),ss=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aV(),r=aj(),o=aO(),a=sa();e.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,r.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,r._)`{i: ${e}, j: ${t}}`},code(e){let{gen:s,data:i,$data:n,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!n&&!l)return;let h=s.let("valid"),p=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(h,function(){let n=s.let("i",(0,r._)`${i}.length`),l=s.let("j");e.setParams({i:n,j:l}),s.assign(h,!0),s.if((0,r._)`${n} > 1`,()=>(p.length>0&&!p.some(e=>"object"===e||"array"===e)?function(o,a){let n=s.name("item"),l=(0,t.checkDataTypes)(p,n,d.opts.strictNumbers,t.DataType.Wrong),c=s.const("indices",(0,r._)`{}`);s.for((0,r._)`;${o}--;`,()=>{s.let(n,(0,r._)`${i}[${o}]`),s.if(l,(0,r._)`continue`),p.length>1&&s.if((0,r._)`typeof ${n} == "string"`,(0,r._)`${n} += "_"`),s.if((0,r._)`typeof ${c}[${n}] == "number"`,()=>{s.assign(a,(0,r._)`${c}[${n}]`),e.error(),s.assign(h,!1).break()}).code((0,r._)`${c}[${n}] = ${o}`)})}:function(t,n){let l=(0,o.useFunc)(s,a.default),c=s.name("outer");s.label(c).for((0,r._)`;${t}--;`,()=>s.for((0,r._)`${n} = ${t}; ${n}--;`,()=>s.if((0,r._)`${l}(${i}[${t}], ${i}[${n}])`,()=>{e.error(),s.assign(h,!1).break(c)})))})(n,l))},(0,r._)`${u} === false`),e.ok(h)}}}),si=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=sa();e.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:a,data:s,$data:i,schemaCode:n,schema:l}=e;i||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(a,o.default)}(${s}, ${n})`):e.fail((0,t._)`${l} !== ${s}`)}}}),sn=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=sa();e.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let a,s,{gen:i,data:n,$data:l,schema:c,schemaCode:u,it:d}=e;if(!l&&0===c.length)throw Error("enum must have non-empty array");let h=c.length>=d.opts.loopEnum,p=()=>null!=a?a:a=(0,r.useFunc)(i,o.default);if(h||l)s=i.let("valid"),e.block$data(s,function(){i.assign(s,!1),i.forOf("v",u,e=>i.if((0,t._)`${p()}(${n}, ${e})`,()=>i.assign(s,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=i.const("vSchema",u);s=(0,t.or)(...c.map((r,o)=>{var a,s;let i;return a=e,"object"==typeof(i=c[s=o])&&null!==i?(0,t._)`${p()}(${n}, ${a}[${s}])`:(0,t._)`${n} === ${i}`}))}e.pass(s)}}}),sl=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a3(),r=a6(),o=a8(),a=se(),s=st(),i=sr(),n=so(),l=ss(),c=si(),u=sn();e.default=[t.default,r.default,o.default,a.default,s.default,i.default,n.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),sc=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=aj(),r=aO();function o(e,o){let{gen:a,schema:s,data:i,keyword:n,it:l}=e;l.items=!0;let c=a.const("len",(0,t._)`${i}.length`);if(!1===s)e.setParams({len:o.length}),e.pass((0,t._)`${c} <= ${o.length}`);else if("object"==typeof s&&!(0,r.alwaysValidSchema)(l,s)){let s=a.var("valid",(0,t._)`${c} <= ${o.length}`);a.if((0,t.not)(s),()=>{var i;return i=s,void a.forRange("i",o.length,c,o=>{e.subschema({keyword:n,dataProp:o,dataPropType:r.Type.Num},i),l.allErrors||a.if((0,t.not)(i),()=>a.break())})}),e.ok(s)}}e.validateAdditionalItems=o,e.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:a}=e,{items:s}=t;Array.isArray(s)?o(e,s):(0,r.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),su=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=aj(),r=aO(),o=az();function a(e,o,s=e.schema){let{gen:i,parentSchema:n,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:a}=u,i=s.length,n=i===e.minItems&&(i===e.maxItems||!1===e[o]);if(t.strictTuples&&!n){let e=`"${c}" is ${i}-tuple, but minItems or maxItems/${o} are not specified or different at path "${a}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(n),u.opts.unevaluated&&s.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(i,s.length,u.items));let d=i.name("valid"),h=i.const("len",(0,t._)`${l}.length`);s.forEach((o,a)=>{(0,r.alwaysValidSchema)(u,o)||(i.if((0,t._)`${h} > ${a}`,()=>e.subschema({keyword:c,schemaProp:a,dataProp:a},d)),e.ok(d))})}e.validateTuple=a,e.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:s}=e;if(Array.isArray(t))return a(e,"additionalItems",t);s.items=!0,(0,r.alwaysValidSchema)(s,t)||e.ok((0,o.validateArray)(e))}}}),sd=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=su();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),sh=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=az(),a=sc();e.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:s,it:i}=e,{prefixItems:n}=s;i.items=!0,(0,r.alwaysValidSchema)(i,t)||(n?(0,a.validateAdditionalItems)(e,n):e.ok((0,o.validateArray)(e)))}}}),sp=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:r}})=>void 0===r?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${r} valid item(s)`,params:({params:{min:e,max:r}})=>void 0===r?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${r}}`},code(e){let o,a,{gen:s,schema:i,parentSchema:n,data:l,it:c}=e,{minContains:u,maxContains:d}=n;c.opts.next?(o=void 0===u?1:u,a=d):o=1;let h=s.const("len",(0,t._)`${l}.length`);if(e.setParams({min:o,max:a}),void 0===a&&0===o)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&o>a){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,i)){let r=(0,t._)`${h} >= ${o}`;void 0!==a&&(r=(0,t._)`${r} && ${h} <= ${a}`),e.pass(r);return}c.items=!0;let p=s.name("valid");function m(){let e=s.name("_valid"),r=s.let("count",0);f(e,()=>s.if(e,()=>{var e;return e=r,void(s.code((0,t._)`${e}++`),void 0===a?s.if((0,t._)`${e} >= ${o}`,()=>s.assign(p,!0).break()):(s.if((0,t._)`${e} > ${a}`,()=>s.assign(p,!1).break()),1===o?s.assign(p,!0):s.if((0,t._)`${e} >= ${o}`,()=>s.assign(p,!0))))}))}function f(t,o){s.forRange("i",0,h,a=>{e.subschema({keyword:"contains",dataProp:a,dataPropType:r.Type.Num,compositeRule:!0},t),o()})}void 0===a&&1===o?f(p,()=>s.if(p,()=>s.break())):0===o?(s.let(p,!0),void 0!==a&&s.if((0,t._)`${l}.length > 0`,m)):(s.let(p,!1),m()),e.result(p,()=>e.reset())}}}),sm=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=aj(),r=aO(),o=az();e.error={message:({params:{property:e,depsCount:r,deps:o}})=>(0,t.str)`must have ${1===r?"property":"properties"} ${o} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:o,missingProperty:a}})=>(0,t._)`{property: ${e},
6
6
  missingProperty: ${a},
7
7
  depsCount: ${r},
8
- deps: ${o}}`};let a={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let o in e)"__proto__"!==o&&((Array.isArray(e[o])?t:r)[o]=e[o]);return[t,r]}(e);s(e,t),i(e,r)}};function s(e,r=e.schema){let{gen:a,data:i,it:n}=e;if(0===Object.keys(r).length)return;let l=a.let("missing");for(let s in r){let c=r[s];if(0===c.length)continue;let u=(0,o.propertyInData)(a,i,s,n.opts.ownProperties);e.setParams({property:s,depsCount:c.length,deps:c.join(", ")}),n.allErrors?a.if(u,()=>{for(let t of c)(0,o.checkReportMissingProp)(e,t)}):(a.if((0,t._)`${u} && (${(0,o.checkMissingProp)(e,c,l)})`),(0,o.reportMissingProp)(e,l),a.else())}}function i(e,t=e.schema){let{gen:a,data:s,keyword:n,it:l}=e,c=a.name("valid");for(let i in t)(0,r.alwaysValidSchema)(l,t[i])||(a.if((0,o.propertyInData)(a,s,i,l.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:i},c);e.mergeValidEvaluated(t,c)},()=>a.var(c,!0)),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=i,e.default=a}),sf=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:o,schema:a,data:s,it:i}=e;if((0,r.alwaysValidSchema)(i,a))return;let n=o.name("valid");o.forIn("key",s,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},n),o.if((0,t.not)(n),()=>{e.error(!0),i.allErrors||o.break()})}),e.ok(n)}}}),sy=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aj(),o=aN(),a=aO();e.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,r._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:s,schema:i,parentSchema:n,data:l,errsCount:c,it:u}=e;if(!c)throw Error("ajv implementation error");let{allErrors:d,opts:h}=u;if(u.props=!0,"all"!==h.removeAdditional&&(0,a.alwaysValidSchema)(u,i))return;let p=(0,t.allSchemaProperties)(n.properties),m=(0,t.allSchemaProperties)(n.patternProperties);function f(e){s.code((0,r._)`delete ${l}[${e}]`)}function y(t){if("all"===h.removeAdditional||h.removeAdditional&&!1===i)return void f(t);if(!1===i){e.setParams({additionalProperty:t}),e.error(),d||s.break();return}if("object"==typeof i&&!(0,a.alwaysValidSchema)(u,i)){let o=s.name("valid");"failing"===h.removeAdditional?(v(t,o,!1),s.if((0,r.not)(o),()=>{e.reset(),f(t)})):(v(t,o),d||s.if((0,r.not)(o),()=>s.break()))}}function v(t,r,o){let s={keyword:"additionalProperties",dataProp:t,dataPropType:a.Type.Str};!1===o&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(s,r)}s.forIn("key",l,o=>{p.length||m.length?s.if(function(o){let i;if(p.length>8){let e=(0,a.schemaRefOrVal)(u,n.properties,"properties");i=(0,t.isOwnProperty)(s,e,o)}else i=p.length?(0,r.or)(...p.map(e=>(0,r._)`${o} === ${e}`)):r.nil;return m.length&&(i=(0,r.or)(i,...m.map(a=>(0,r._)`${(0,t.usePattern)(e,a)}.test(${o})`))),(0,r.not)(i)}(o),()=>y(o)):y(o)}),e.ok((0,r._)`${c} === ${o.default.errors}`)}}}),sv=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aW(),r=az(),o=aO(),a=sy();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:s,schema:i,parentSchema:n,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===n.additionalProperties&&a.default.code(new t.KeywordCxt(c,a.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(i);for(let e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=o.mergeEvaluated.props(s,(0,o.toHash)(u),c.props));let d=u.filter(e=>!(0,o.alwaysValidSchema)(c,i[e]));if(0===d.length)return;let h=s.name("valid");for(let t of d){var p;(p=t,c.opts.useDefaults&&!c.compositeRule&&void 0!==i[p].default)?m(t):(s.if((0,r.propertyInData)(s,l,t,c.opts.ownProperties)),m(t),c.allErrors||s.else().var(h,!0),s.endIf()),e.it.definedProperties.add(t),e.ok(h)}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},h)}}}}),sg=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aj(),o=aO(),a=aO();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:s,schema:i,data:n,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(i),h=d.filter(e=>(0,o.alwaysValidSchema)(c,i[e]));if(0===d.length||h.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;let p=u.strictSchema&&!u.allowMatchingProperties&&l.properties,m=s.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,a.evaluatedPropsToName)(s,c.props));let{props:f}=c;for(let e of d)p&&function(e){for(let t in p)new RegExp(e).test(t)&&(0,o.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),c.allErrors?y(e):(s.var(m,!0),y(e),s.if(m));function y(o){s.forIn("key",n,i=>{s.if((0,r._)`${(0,t.usePattern)(e,o)}.test(${i})`,()=>{let t=h.includes(o);t||e.subschema({keyword:"patternProperties",schemaProp:o,dataProp:i,dataPropType:a.Type.Str},m),c.opts.unevaluated&&!0!==f?s.assign((0,r._)`${f}[${i}]`,!0):t||c.allErrors||s.if((0,r.not)(m),()=>s.break())})})}}}}),s_=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:r,schema:o,it:a}=e;if((0,t.alwaysValidSchema)(a,o))return void e.fail();let s=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}}),sS=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:az().validateUnion,error:{message:"must match a schema in anyOf"}}}),sb=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:o,schema:a,parentSchema:s,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");if(i.opts.discriminator&&s.discriminator)return;let n=o.let("valid",!1),l=o.let("passing",null),c=o.name("_valid");e.setParams({passing:l}),o.block(function(){a.forEach((a,s)=>{let u;(0,r.alwaysValidSchema)(i,a)?o.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},c),s>0&&o.if((0,t._)`${c} && ${n}`).assign(n,!1).assign(l,(0,t._)`[${l}, ${s}]`).else(),o.if(c,()=>{o.assign(n,!0),o.assign(l,s),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(n,()=>e.reset(),()=>e.error(!0))}}}),s$=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:"allOf",schemaType:"array",code(e){let{gen:r,schema:o,it:a}=e;if(!Array.isArray(o))throw Error("ajv implementation error");let s=r.name("valid");o.forEach((r,o)=>{if((0,t.alwaysValidSchema)(a,r))return;let i=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(i)})}}}),sw=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();function o(e,t){let o=e.schema[t];return void 0!==o&&!(0,r.alwaysValidSchema)(e,o)}e.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let a,{gen:s,parentSchema:i,it:n}=e;void 0===i.then&&void 0===i.else&&(0,r.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let l=o(n,"then"),c=o(n,"else");if(!l&&!c)return;let u=s.let("valid",!0),d=s.name("_valid");if(a=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(a),e.reset(),l&&c){let t=s.let("ifClause");e.setParams({ifClause:t}),s.if(d,h("then",t),h("else",t))}else l?s.if(d,h("then")):s.if((0,t.not)(d),h("else"));function h(r,o){return()=>{let a=e.subschema({keyword:r},d);s.assign(u,d),e.mergeValidEvaluated(a,u),o?s.assign(o,(0,t._)`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}}}),sR=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:o}){void 0===r.if&&(0,t.checkStrictMode)(o,`"${e}" without "if" is ignored`)}}}),sP=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sc(),r=sd(),o=su(),a=sh(),s=sp(),i=sm(),n=sf(),l=sy(),c=sv(),u=sg(),d=s_(),h=sS(),p=sb(),m=s$(),f=sw(),y=sR();e.default=function(e=!1){let v=[d.default,h.default,p.default,m.default,f.default,y.default,n.default,l.default,i.default,c.default,u.default];return e?v.push(r.default,a.default):v.push(t.default,o.default),v.push(s.default),v}}),sE=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,r){let o,a,s,i,n,l,{gen:c,data:u,$data:d,schema:h,schemaCode:p,it:m}=e,{opts:f,errSchemaPath:y,schemaEnv:v,self:g}=m;f.validateFormats&&(d?(o=c.scopeValue("formats",{ref:g.formats,code:f.code.formats}),a=c.const("fDef",(0,t._)`${o}[${p}]`),s=c.let("fType"),i=c.let("format"),c.if((0,t._)`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>c.assign(s,(0,t._)`${a}.type || "string"`).assign(i,(0,t._)`${a}.validate`),()=>c.assign(s,(0,t._)`"string"`).assign(i,a)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${p} && !${i}`,(n=v.$async?(0,t._)`(${a}.async ? await ${i}(${u}) : ${i}(${u}))`:(0,t._)`${i}(${u})`,l=(0,t._)`(typeof ${i} == "function" ? ${n} : ${i}.test(${u}))`,(0,t._)`${i} && ${i} !== true && ${s} === ${r} && !${l}`)))):function(){var o;let a,s,i=g.formats[h];if(!i){if(!1===f.strictSchema)return g.logger.warn(n());throw Error(n());function n(){return`unknown format "${h}" ignored in schema at path "${y}"`}}if(!0===i)return;let[l,d,p]=(a=(o=i)instanceof RegExp?(0,t.regexpCode)(o):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(h)}`:void 0,s=c.scopeValue("formats",{key:h,ref:o,code:a}),"object"!=typeof o||o instanceof RegExp?["string",o,s]:[o.type||"string",o.validate,(0,t._)`${s}.validate`]);l===r&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!v.$async)throw Error("async format in sync schema");return(0,t._)`await ${p}(${u})`}return"function"==typeof d?(0,t._)`${p}(${u})`:(0,t._)`${p}.test(${u})`}())}())}}}),sC=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[sE().default]}),sT=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),sk=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a5(),r=sl(),o=sP(),a=sC(),s=sT();e.default=[t.default,r.default,(0,o.default)(),a.default,s.metadataVocabulary,s.contentVocabulary]}),sI=rK(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),sx=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=sI(),o=aZ(),a=aB(),s=aO();e.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:r,tagName:o}})=>(0,t._)`{error: ${e}, tag: ${o}, tagValue: ${r}}`},code(e){let{gen:i,data:n,schema:l,parentSchema:c,it:u}=e,{oneOf:d}=c;if(!u.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=l.propertyName;if("string"!=typeof h)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let p=i.let("valid",!1),m=i.const("tag",(0,t._)`${n}${(0,t.getProperty)(h)}`);i.if((0,t._)`typeof ${m} == "string"`,()=>(function(){let n=function(){var e;let t={},r=n(c),i=!0;for(let t=0;t<d.length;t++){let c=d[t];if((null==c?void 0:c.$ref)&&!(0,s.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if((c=o.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof o.SchemaEnv&&(c=c.schema),void 0===c)throw new a.default(u.opts.uriResolver,u.baseId,e)}let p=null==(e=null==c?void 0:c.properties)?void 0:e[h];if("object"!=typeof p)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);i=i&&(r||n(c)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}(p,t)}if(!i)throw Error(`discriminator: "${h}" must be required`);return t;function n({required:e}){return Array.isArray(e)&&e.includes(h)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${h}" values must be unique strings`);t[e]=r}}();for(let r in i.if(!1),n)i.elseIf((0,t._)`${m} === ${r}`),i.assign(p,function(r){let o=i.name("valid"),a=e.subschema({keyword:"oneOf",schemaProp:r},o);return e.mergeEvaluated(a,t.Name),o}(n[r]));i.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:h}),i.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:h})),e.ok(p)}}}),sj=rK((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),sO=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=a2(),o=sk(),a=sx(),s=sj(),i=["/properties"],n="http://json-schema.org/draft-07/schema";var l=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(e,n,!1),this.refs["http://json-schema.org/schema"]=n}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=aJ();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var h=aB();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),sN=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=aj(),r=aN(),o=aZ(),a=a4();function s(e,s){let{gen:i,it:n}=e;n.schemaEnv.root.dynamicAnchors[s]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(s)}`,c="#"===n.errSchemaPath?n.validateName:function(e){let{schemaEnv:t,schema:r,self:s}=e.it,{root:i,baseId:n,localRefs:l,meta:c}=t.root,{schemaId:u}=s.opts,d=new o.SchemaEnv({schema:r,schemaId:u,root:i,baseId:n,localRefs:l,meta:c});return o.compileSchema.call(s,d),(0,a.getValidate)(e,d)}(e);i.if((0,t._)`!${l}`,()=>i.assign(l,c))}e.dynamicAnchor=s,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>s(e,e.schema)}}),sq=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=aj(),r=aN(),o=a4();function a(e,a){let{gen:s,keyword:i,it:n}=e;if("#"!==a[0])throw Error(`"${i}" only supports hash fragment reference`);let l=a.slice(1);if(n.allErrors)c();else{let t=s.let("valid",!1);c(t),e.ok(t)}function c(e){if(n.schemaEnv.root.dynamicAnchors[l]){let o=s.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`);s.if(o,u(o,e),u(n.validateName,e))}else u(n.validateName,e)()}function u(t,r){return r?()=>s.block(()=>{(0,o.callRef)(e,t),s.let(r,!0)}):()=>(0,o.callRef)(e,t)}}e.dynamicRef=a,e.default={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)}}),sM=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sN(),r=aO();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),sA=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sq();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),sL=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sN(),r=sq(),o=sM(),a=sA();e.default=[t.default,r.default,o.default,a.default]}),sU=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sm();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),sV=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sm();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),sz=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:r,it:o}){void 0===r.contains&&(0,t.checkStrictMode)(o,`"${e}" without "contains" is ignored`)}}}),sD=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sU(),r=sV(),o=sz();e.default=[t.default,r.default,o.default]}),sH=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=aN();e.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:a,schema:s,data:i,errsCount:n,it:l}=e;if(!n)throw Error("ajv implementation error");let{allErrors:c,props:u}=l;function d(o){if(!1===s){e.setParams({unevaluatedProperty:o}),e.error(),c||a.break();return}if(!(0,r.alwaysValidSchema)(l,s)){let s=a.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:o,dataPropType:r.Type.Str},s),c||a.if((0,t.not)(s),()=>a.break())}}u instanceof t.Name?a.if((0,t._)`${u} !== true`,()=>a.forIn("key",i,e=>{var r,o;return a.if((r=u,o=e,(0,t._)`!${r} || !${r}[${o}]`),()=>d(e))})):!0!==u&&a.forIn("key",i,e=>void 0===u?d(e):a.if(function(e,r){let o=[];for(let a in e)!0===e[a]&&o.push((0,t._)`${r} !== ${a}`);return(0,t.and)(...o)}(u,e),()=>d(e))),l.props=!0,e.ok((0,t._)`${n} === ${o.default.errors}`)}}}),sF=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:o,schema:a,data:s,it:i}=e,n=i.items||0;if(!0===n)return;let l=o.const("len",(0,t._)`${s}.length`);if(!1===a)e.setParams({len:n}),e.fail((0,t._)`${l} > ${n}`);else if("object"==typeof a&&!(0,r.alwaysValidSchema)(i,a)){let a=o.var("valid",(0,t._)`${l} <= ${n}`);o.if((0,t.not)(a),()=>{var s,c;return s=a,c=n,void o.forRange("i",c,l,a=>{e.subschema({keyword:"unevaluatedItems",dataProp:a,dataPropType:r.Type.Num},s),i.allErrors||o.if((0,t.not)(s),()=>o.break())})}),e.ok(a)}i.items=!0}}}),sG=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sH(),r=sF();e.default=[t.default,r.default]}),sK=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),sW=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),sJ=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),sB=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),sZ=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),sX=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),sQ=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),sY=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sK(),r=sW(),o=sJ(),a=sB(),s=sZ(),i=sX(),n=sQ(),l=["/properties"];e.default=function(e){return[t,r,o,a,c(this,s),i,c(this,n)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),s0=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=a2(),o=sk(),a=sL(),s=sD(),i=sG(),n=sx(),l=sY(),c="https://json-schema.org/draft/2019-09/schema";var u=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(a.default),o.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(l.default.call(this,e),this.refs["http://json-schema.org/schema"]=c)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var h=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var p=aJ();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=aB();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),s1=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a5(),r=sl(),o=sP(),a=sL(),s=sD(),i=sG(),n=sC(),l=sT();e.default=[a.default,t.default,r.default,(0,o.default)(!0),n.default,l.metadataVocabulary,l.contentVocabulary,s.default,i.default]}),s2=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),s9=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),s4=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),s5=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),s3=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),s6=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),s7=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),s8=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),ie=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=s2(),r=s9(),o=s4(),a=s5(),s=s3(),i=s6(),n=s7(),l=s8(),c=["/properties"];e.default=function(e){return[t,r,o,a,s,u(this,i),n,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),it=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=a2(),o=s1(),a=sx(),s=ie(),i="https://json-schema.org/draft/2020-12/schema";var n=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(s.default.call(this,e),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=n,t.exports=e=n,t.exports.Ajv2020=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;var l=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var u=aJ();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=aB();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),ir=rK(e=>{function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(a,s),time:t(n(!0),l),"date-time":t(d(!0),h),"iso-time":t(n(),c),"iso-date-time":t(d(),p),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&f.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(S.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return y.lastIndex=0,y.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=g&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){var t;let a=r.exec(e);if(!a)return!1;let s=+a[1],i=+a[2],n=+a[3];return i>=1&&i<=12&&n>=1&&n<=(2===i&&(t=s)%4==0&&(t%100!=0||t%400==0)?29:o[i])}function s(e,t){if(e&&t)return e>t?1:e<t?-1:0}let i=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function n(e){return function(t){let r=i.exec(t);if(!r)return!1;let o=+r[1],a=+r[2],s=+r[3],n=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!n)return!1;if(o<=23&&a<=59&&s<60)return!0;let d=a-u*l,h=o-c*l-(d<0);return(23===h||-1===h)&&(59===d||-1===d)&&s<61}}function l(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function c(e,t){if(!(e&&t))return;let r=i.exec(e),o=i.exec(t);if(r&&o)return(e=r[1]+r[2]+r[3])>(t=o[1]+o[2]+o[3])?1:e<t?-1:0}let u=/t|\s/i;function d(e){let t=n(e);return function(e){let r=e.split(u);return 2===r.length&&a(r[0])&&t(r[1])}}function h(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function p(e,t){if(!(e&&t))return;let[r,o]=e.split(u),[a,i]=t.split(u),n=s(r,a);if(void 0!==n)return n||l(o,i)}let m=/\/|:/,f=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,g=0x80000000-1;function _(){return!0}let S=/[^\\]\\Z/}),io=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=sO(),r=aj(),o=r.operators,a={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};e.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,r.str)`should be ${a[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,r._)`{comparison: ${a[e].okStr}, limit: ${t}}`},code(e){let o,s,{gen:i,data:n,schemaCode:l,keyword:c,it:u}=e,{opts:d,self:h}=u;if(!d.validateFormats)return;let p=new t.KeywordCxt(u,h.RULES.all.format.definition,"format");function m(e){return(0,r._)`${e}.compare(${n}, ${l}) ${a[c].fail} 0`}p.$data?(o=i.scopeValue("formats",{ref:h.formats,code:d.code.formats}),s=i.const("fmt",(0,r._)`${o}[${p.schemaCode}]`),e.fail$data((0,r.or)((0,r._)`typeof ${s} != "object"`,(0,r._)`${s} instanceof RegExp`,(0,r._)`typeof ${s}.compare != "function"`,m(s)))):function(){let t=p.schema,o=h.formats[t];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw Error(`"${c}": format "${t}" does not define "compare" function`);let a=i.scopeValue("formats",{key:t,ref:o,code:d.code.formats?(0,r._)`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(m(a))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}),ia=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=ir(),o=io(),a=aj(),s=new a.Name("fullFormats"),i=new a.Name("fastFormats"),n=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,s),e;let[a,n]="fast"===t.mode?[r.fastFormats,i]:[r.fullFormats,s];return l(e,t.formats||r.formatNames,a,n),t.keywords&&(0,o.default)(e),e};function l(e,t,r,o){var s;for(let i of(null!=(s=e.opts.code).formats||(s.formats=(0,a._)`require("ajv-formats/dist/formats").${o}`),t))e.addFormat(i,r[i])}n.get=(e,t="full")=>{let o=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o},t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n}),is=sO(),ii=s0(),il=it();let ic=rW(ia(),1).default;function iu(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ic(t),t}var id=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=iu(il.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=function(e,t){if(!("$schema"in e)||"string"!=typeof e.$schema)return"2020-12";let r=e.$schema.replace(/#$/,"");if(rJ.has(r))return"2020-12";if(rB.has(r))return"2019-09";if(rZ.has(r)||rX.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===t?this.ajv:"2019-09"===t?this._ajv2019??=iu(ii.Ajv2019):this._ajvDraft7??=iu(is.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&"string"==typeof e.$id?t.getSchema(e.$id)??t.compile(e):t.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}};async function ih(e){return(await s).getRandomValues(new Uint8Array(e))}async function ip(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=256-256%t.length,o="";for(;o.length<e;)for(let a of(await ih(e-o.length)))a<r&&(o+=t[a%t.length]);return o}async function im(e){return await ip(e)}async function iy(e){return btoa(String.fromCharCode(...new Uint8Array(await (await s).subtle.digest("SHA-256",new TextEncoder().encode(e))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function iv(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await im(e),r=await iy(t);return{code_verifier:t,code_challenge:r}}is.Ajv,s=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:module").then(function(e){return l.t(e.createRequire(import.meta.url)("node:crypto"),18)}).then(e=>e.webcrypto);class ig extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function i_(e){}function iS(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=i_,onError:r=i_,onRetry:o=i_,onComment:a}=e,s="",i=!0,n,l="",c="";function u(e){if(""===e)return void(l.length>0&&t({id:n,event:c||void 0,data:l.endsWith(`
8
+ deps: ${o}}`};let a={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let o in e)"__proto__"!==o&&((Array.isArray(e[o])?t:r)[o]=e[o]);return[t,r]}(e);s(e,t),i(e,r)}};function s(e,r=e.schema){let{gen:a,data:i,it:n}=e;if(0===Object.keys(r).length)return;let l=a.let("missing");for(let s in r){let c=r[s];if(0===c.length)continue;let u=(0,o.propertyInData)(a,i,s,n.opts.ownProperties);e.setParams({property:s,depsCount:c.length,deps:c.join(", ")}),n.allErrors?a.if(u,()=>{for(let t of c)(0,o.checkReportMissingProp)(e,t)}):(a.if((0,t._)`${u} && (${(0,o.checkMissingProp)(e,c,l)})`),(0,o.reportMissingProp)(e,l),a.else())}}function i(e,t=e.schema){let{gen:a,data:s,keyword:n,it:l}=e,c=a.name("valid");for(let i in t)(0,r.alwaysValidSchema)(l,t[i])||(a.if((0,o.propertyInData)(a,s,i,l.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:i},c);e.mergeValidEvaluated(t,c)},()=>a.var(c,!0)),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=i,e.default=a}),sf=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:o,schema:a,data:s,it:i}=e;if((0,r.alwaysValidSchema)(i,a))return;let n=o.name("valid");o.forIn("key",s,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},n),o.if((0,t.not)(n),()=>{e.error(!0),i.allErrors||o.break()})}),e.ok(n)}}}),sy=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aj(),o=aN(),a=aO();e.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,r._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:s,schema:i,parentSchema:n,data:l,errsCount:c,it:u}=e;if(!c)throw Error("ajv implementation error");let{allErrors:d,opts:h}=u;if(u.props=!0,"all"!==h.removeAdditional&&(0,a.alwaysValidSchema)(u,i))return;let p=(0,t.allSchemaProperties)(n.properties),m=(0,t.allSchemaProperties)(n.patternProperties);function f(e){s.code((0,r._)`delete ${l}[${e}]`)}function y(t){if("all"===h.removeAdditional||h.removeAdditional&&!1===i)return void f(t);if(!1===i){e.setParams({additionalProperty:t}),e.error(),d||s.break();return}if("object"==typeof i&&!(0,a.alwaysValidSchema)(u,i)){let o=s.name("valid");"failing"===h.removeAdditional?(v(t,o,!1),s.if((0,r.not)(o),()=>{e.reset(),f(t)})):(v(t,o),d||s.if((0,r.not)(o),()=>s.break()))}}function v(t,r,o){let s={keyword:"additionalProperties",dataProp:t,dataPropType:a.Type.Str};!1===o&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(s,r)}s.forIn("key",l,o=>{p.length||m.length?s.if(function(o){let i;if(p.length>8){let e=(0,a.schemaRefOrVal)(u,n.properties,"properties");i=(0,t.isOwnProperty)(s,e,o)}else i=p.length?(0,r.or)(...p.map(e=>(0,r._)`${o} === ${e}`)):r.nil;return m.length&&(i=(0,r.or)(i,...m.map(a=>(0,r._)`${(0,t.usePattern)(e,a)}.test(${o})`))),(0,r.not)(i)}(o),()=>y(o)):y(o)}),e.ok((0,r._)`${c} === ${o.default.errors}`)}}}),sv=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aW(),r=az(),o=aO(),a=sy();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:s,schema:i,parentSchema:n,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===n.additionalProperties&&a.default.code(new t.KeywordCxt(c,a.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(i);for(let e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=o.mergeEvaluated.props(s,(0,o.toHash)(u),c.props));let d=u.filter(e=>!(0,o.alwaysValidSchema)(c,i[e]));if(0===d.length)return;let h=s.name("valid");for(let t of d){var p;(p=t,c.opts.useDefaults&&!c.compositeRule&&void 0!==i[p].default)?m(t):(s.if((0,r.propertyInData)(s,l,t,c.opts.ownProperties)),m(t),c.allErrors||s.else().var(h,!0),s.endIf()),e.it.definedProperties.add(t),e.ok(h)}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},h)}}}}),sg=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=az(),r=aj(),o=aO(),a=aO();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:s,schema:i,data:n,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(i),h=d.filter(e=>(0,o.alwaysValidSchema)(c,i[e]));if(0===d.length||h.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;let p=u.strictSchema&&!u.allowMatchingProperties&&l.properties,m=s.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,a.evaluatedPropsToName)(s,c.props));let{props:f}=c;for(let e of d)p&&function(e){for(let t in p)new RegExp(e).test(t)&&(0,o.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),c.allErrors?y(e):(s.var(m,!0),y(e),s.if(m));function y(o){s.forIn("key",n,i=>{s.if((0,r._)`${(0,t.usePattern)(e,o)}.test(${i})`,()=>{let t=h.includes(o);t||e.subschema({keyword:"patternProperties",schemaProp:o,dataProp:i,dataPropType:a.Type.Str},m),c.opts.unevaluated&&!0!==f?s.assign((0,r._)`${f}[${i}]`,!0):t||c.allErrors||s.if((0,r.not)(m),()=>s.break())})})}}}}),s_=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:r,schema:o,it:a}=e;if((0,t.alwaysValidSchema)(a,o))return void e.fail();let s=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}}),sS=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:az().validateUnion,error:{message:"must match a schema in anyOf"}}}),sb=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:o,schema:a,parentSchema:s,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");if(i.opts.discriminator&&s.discriminator)return;let n=o.let("valid",!1),l=o.let("passing",null),c=o.name("_valid");e.setParams({passing:l}),o.block(function(){a.forEach((a,s)=>{let u;(0,r.alwaysValidSchema)(i,a)?o.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},c),s>0&&o.if((0,t._)`${c} && ${n}`).assign(n,!1).assign(l,(0,t._)`[${l}, ${s}]`).else(),o.if(c,()=>{o.assign(n,!0),o.assign(l,s),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(n,()=>e.reset(),()=>e.error(!0))}}}),s$=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:"allOf",schemaType:"array",code(e){let{gen:r,schema:o,it:a}=e;if(!Array.isArray(o))throw Error("ajv implementation error");let s=r.name("valid");o.forEach((r,o)=>{if((0,t.alwaysValidSchema)(a,r))return;let i=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(i)})}}}),sw=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();function o(e,t){let o=e.schema[t];return void 0!==o&&!(0,r.alwaysValidSchema)(e,o)}e.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let a,{gen:s,parentSchema:i,it:n}=e;void 0===i.then&&void 0===i.else&&(0,r.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let l=o(n,"then"),c=o(n,"else");if(!l&&!c)return;let u=s.let("valid",!0),d=s.name("_valid");if(a=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(a),e.reset(),l&&c){let t=s.let("ifClause");e.setParams({ifClause:t}),s.if(d,h("then",t),h("else",t))}else l?s.if(d,h("then")):s.if((0,t.not)(d),h("else"));function h(r,o){return()=>{let a=e.subschema({keyword:r},d);s.assign(u,d),e.mergeValidEvaluated(a,u),o?s.assign(o,(0,t._)`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}}}),sR=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:o}){void 0===r.if&&(0,t.checkStrictMode)(o,`"${e}" without "if" is ignored`)}}}),sP=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sc(),r=sd(),o=su(),a=sh(),s=sp(),i=sm(),n=sf(),l=sy(),c=sv(),u=sg(),d=s_(),h=sS(),p=sb(),m=s$(),f=sw(),y=sR();e.default=function(e=!1){let v=[d.default,h.default,p.default,m.default,f.default,y.default,n.default,l.default,i.default,c.default,u.default];return e?v.push(r.default,a.default):v.push(t.default,o.default),v.push(s.default),v}}),sE=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj();e.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,r){let o,a,s,i,n,l,{gen:c,data:u,$data:d,schema:h,schemaCode:p,it:m}=e,{opts:f,errSchemaPath:y,schemaEnv:v,self:g}=m;f.validateFormats&&(d?(o=c.scopeValue("formats",{ref:g.formats,code:f.code.formats}),a=c.const("fDef",(0,t._)`${o}[${p}]`),s=c.let("fType"),i=c.let("format"),c.if((0,t._)`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>c.assign(s,(0,t._)`${a}.type || "string"`).assign(i,(0,t._)`${a}.validate`),()=>c.assign(s,(0,t._)`"string"`).assign(i,a)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${p} && !${i}`,(n=v.$async?(0,t._)`(${a}.async ? await ${i}(${u}) : ${i}(${u}))`:(0,t._)`${i}(${u})`,l=(0,t._)`(typeof ${i} == "function" ? ${n} : ${i}.test(${u}))`,(0,t._)`${i} && ${i} !== true && ${s} === ${r} && !${l}`)))):function(){var o;let a,s,i=g.formats[h];if(!i){if(!1===f.strictSchema)return g.logger.warn(n());throw Error(n());function n(){return`unknown format "${h}" ignored in schema at path "${y}"`}}if(!0===i)return;let[l,d,p]=(a=(o=i)instanceof RegExp?(0,t.regexpCode)(o):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(h)}`:void 0,s=c.scopeValue("formats",{key:h,ref:o,code:a}),"object"!=typeof o||o instanceof RegExp?["string",o,s]:[o.type||"string",o.validate,(0,t._)`${s}.validate`]);l===r&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!v.$async)throw Error("async format in sync schema");return(0,t._)`await ${p}(${u})`}return"function"==typeof d?(0,t._)`${p}(${u})`:(0,t._)`${p}.test(${u})`}())}())}}}),sC=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[sE().default]}),sT=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),sk=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a5(),r=sl(),o=sP(),a=sC(),s=sT();e.default=[t.default,r.default,(0,o.default)(),a.default,s.metadataVocabulary,s.contentVocabulary]}),sI=rK(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),sx=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=sI(),o=aZ(),a=aB(),s=aO();e.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:r,tagName:o}})=>(0,t._)`{error: ${e}, tag: ${o}, tagValue: ${r}}`},code(e){let{gen:i,data:n,schema:l,parentSchema:c,it:u}=e,{oneOf:d}=c;if(!u.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=l.propertyName;if("string"!=typeof h)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let p=i.let("valid",!1),m=i.const("tag",(0,t._)`${n}${(0,t.getProperty)(h)}`);i.if((0,t._)`typeof ${m} == "string"`,()=>(function(){let n=function(){var e;let t={},r=n(c),i=!0;for(let t=0;t<d.length;t++){let c=d[t];if((null==c?void 0:c.$ref)&&!(0,s.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if((c=o.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof o.SchemaEnv&&(c=c.schema),void 0===c)throw new a.default(u.opts.uriResolver,u.baseId,e)}let p=null==(e=null==c?void 0:c.properties)?void 0:e[h];if("object"!=typeof p)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);i=i&&(r||n(c)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}(p,t)}if(!i)throw Error(`discriminator: "${h}" must be required`);return t;function n({required:e}){return Array.isArray(e)&&e.includes(h)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${h}" values must be unique strings`);t[e]=r}}();for(let r in i.if(!1),n)i.elseIf((0,t._)`${m} === ${r}`),i.assign(p,function(r){let o=i.name("valid"),a=e.subschema({keyword:"oneOf",schemaProp:r},o);return e.mergeEvaluated(a,t.Name),o}(n[r]));i.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:h}),i.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:h})),e.ok(p)}}}),sj=rK((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),sO=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=a2(),o=sk(),a=sx(),s=sj(),i=["/properties"],n="http://json-schema.org/draft-07/schema";var l=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(e,n,!1),this.refs["http://json-schema.org/schema"]=n}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=aJ();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var h=aB();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),sN=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=aj(),r=aN(),o=aZ(),a=a4();function s(e,s){let{gen:i,it:n}=e;n.schemaEnv.root.dynamicAnchors[s]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(s)}`,c="#"===n.errSchemaPath?n.validateName:function(e){let{schemaEnv:t,schema:r,self:s}=e.it,{root:i,baseId:n,localRefs:l,meta:c}=t.root,{schemaId:u}=s.opts,d=new o.SchemaEnv({schema:r,schemaId:u,root:i,baseId:n,localRefs:l,meta:c});return o.compileSchema.call(s,d),(0,a.getValidate)(e,d)}(e);i.if((0,t._)`!${l}`,()=>i.assign(l,c))}e.dynamicAnchor=s,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>s(e,e.schema)}}),sq=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=aj(),r=aN(),o=a4();function a(e,a){let{gen:s,keyword:i,it:n}=e;if("#"!==a[0])throw Error(`"${i}" only supports hash fragment reference`);let l=a.slice(1);if(n.allErrors)c();else{let t=s.let("valid",!1);c(t),e.ok(t)}function c(e){if(n.schemaEnv.root.dynamicAnchors[l]){let o=s.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`);s.if(o,u(o,e),u(n.validateName,e))}else u(n.validateName,e)()}function u(t,r){return r?()=>s.block(()=>{(0,o.callRef)(e,t),s.let(r,!0)}):()=>(0,o.callRef)(e,t)}}e.dynamicRef=a,e.default={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)}}),sM=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sN(),r=aO();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),sA=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sq();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),sL=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sN(),r=sq(),o=sM(),a=sA();e.default=[t.default,r.default,o.default,a.default]}),sV=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sm();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),sU=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sm();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),sz=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aO();e.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:r,it:o}){void 0===r.contains&&(0,t.checkStrictMode)(o,`"${e}" without "contains" is ignored`)}}}),sD=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sV(),r=sU(),o=sz();e.default=[t.default,r.default,o.default]}),sH=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO(),o=aN();e.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:a,schema:s,data:i,errsCount:n,it:l}=e;if(!n)throw Error("ajv implementation error");let{allErrors:c,props:u}=l;function d(o){if(!1===s){e.setParams({unevaluatedProperty:o}),e.error(),c||a.break();return}if(!(0,r.alwaysValidSchema)(l,s)){let s=a.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:o,dataPropType:r.Type.Str},s),c||a.if((0,t.not)(s),()=>a.break())}}u instanceof t.Name?a.if((0,t._)`${u} !== true`,()=>a.forIn("key",i,e=>{var r,o;return a.if((r=u,o=e,(0,t._)`!${r} || !${r}[${o}]`),()=>d(e))})):!0!==u&&a.forIn("key",i,e=>void 0===u?d(e):a.if(function(e,r){let o=[];for(let a in e)!0===e[a]&&o.push((0,t._)`${r} !== ${a}`);return(0,t.and)(...o)}(u,e),()=>d(e))),l.props=!0,e.ok((0,t._)`${n} === ${o.default.errors}`)}}}),sF=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=aj(),r=aO();e.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:o,schema:a,data:s,it:i}=e,n=i.items||0;if(!0===n)return;let l=o.const("len",(0,t._)`${s}.length`);if(!1===a)e.setParams({len:n}),e.fail((0,t._)`${l} > ${n}`);else if("object"==typeof a&&!(0,r.alwaysValidSchema)(i,a)){let a=o.var("valid",(0,t._)`${l} <= ${n}`);o.if((0,t.not)(a),()=>{var s,c;return s=a,c=n,void o.forRange("i",c,l,a=>{e.subschema({keyword:"unevaluatedItems",dataProp:a,dataPropType:r.Type.Num},s),i.allErrors||o.if((0,t.not)(s),()=>o.break())})}),e.ok(a)}i.items=!0}}}),sG=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sH(),r=sF();e.default=[t.default,r.default]}),sK=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),sW=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),sJ=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),sB=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),sZ=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),sX=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),sQ=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),sY=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sK(),r=sW(),o=sJ(),a=sB(),s=sZ(),i=sX(),n=sQ(),l=["/properties"];e.default=function(e){return[t,r,o,a,c(this,s),i,c(this,n)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),s0=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=a2(),o=sk(),a=sL(),s=sD(),i=sG(),n=sx(),l=sY(),c="https://json-schema.org/draft/2019-09/schema";var u=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(a.default),o.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(l.default.call(this,e),this.refs["http://json-schema.org/schema"]=c)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var h=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var p=aJ();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=aB();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})}),s1=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=a5(),r=sl(),o=sP(),a=sL(),s=sD(),i=sG(),n=sC(),l=sT();e.default=[a.default,t.default,r.default,(0,o.default)(!0),n.default,l.metadataVocabulary,l.contentVocabulary,s.default,i.default]}),s2=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),s9=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),s4=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),s5=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),s3=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),s6=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),s7=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),s8=rK((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),ie=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=s2(),r=s9(),o=s4(),a=s5(),s=s3(),i=s6(),n=s7(),l=s8(),c=["/properties"];e.default=function(e){return[t,r,o,a,s,u(this,i),n,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),it=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=a2(),o=s1(),a=sx(),s=ie(),i="https://json-schema.org/draft/2020-12/schema";var n=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(s.default.call(this,e),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=n,t.exports=e=n,t.exports.Ajv2020=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;var l=aW();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=aj();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var u=aJ();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=aB();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),ir=rK(e=>{function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(a,s),time:t(n(!0),l),"date-time":t(d(!0),h),"iso-time":t(n(),c),"iso-date-time":t(d(),p),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&f.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(S.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return y.lastIndex=0,y.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=g&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){var t;let a=r.exec(e);if(!a)return!1;let s=+a[1],i=+a[2],n=+a[3];return i>=1&&i<=12&&n>=1&&n<=(2===i&&(t=s)%4==0&&(t%100!=0||t%400==0)?29:o[i])}function s(e,t){if(e&&t)return e>t?1:e<t?-1:0}let i=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function n(e){return function(t){let r=i.exec(t);if(!r)return!1;let o=+r[1],a=+r[2],s=+r[3],n=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!n)return!1;if(o<=23&&a<=59&&s<60)return!0;let d=a-u*l,h=o-c*l-(d<0);return(23===h||-1===h)&&(59===d||-1===d)&&s<61}}function l(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function c(e,t){if(!(e&&t))return;let r=i.exec(e),o=i.exec(t);if(r&&o)return(e=r[1]+r[2]+r[3])>(t=o[1]+o[2]+o[3])?1:e<t?-1:0}let u=/t|\s/i;function d(e){let t=n(e);return function(e){let r=e.split(u);return 2===r.length&&a(r[0])&&t(r[1])}}function h(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function p(e,t){if(!(e&&t))return;let[r,o]=e.split(u),[a,i]=t.split(u),n=s(r,a);if(void 0!==n)return n||l(o,i)}let m=/\/|:/,f=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,g=0x80000000-1;function _(){return!0}let S=/[^\\]\\Z/}),io=rK(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=sO(),r=aj(),o=r.operators,a={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}};e.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,r.str)`should be ${a[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,r._)`{comparison: ${a[e].okStr}, limit: ${t}}`},code(e){let o,s,{gen:i,data:n,schemaCode:l,keyword:c,it:u}=e,{opts:d,self:h}=u;if(!d.validateFormats)return;let p=new t.KeywordCxt(u,h.RULES.all.format.definition,"format");function m(e){return(0,r._)`${e}.compare(${n}, ${l}) ${a[c].fail} 0`}p.$data?(o=i.scopeValue("formats",{ref:h.formats,code:d.code.formats}),s=i.const("fmt",(0,r._)`${o}[${p.schemaCode}]`),e.fail$data((0,r.or)((0,r._)`typeof ${s} != "object"`,(0,r._)`${s} instanceof RegExp`,(0,r._)`typeof ${s}.compare != "function"`,m(s)))):function(){let t=p.schema,o=h.formats[t];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw Error(`"${c}": format "${t}" does not define "compare" function`);let a=i.scopeValue("formats",{key:t,ref:o,code:d.code.formats?(0,r._)`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(m(a))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}),ia=rK((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=ir(),o=io(),a=aj(),s=new a.Name("fullFormats"),i=new a.Name("fastFormats"),n=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,s),e;let[a,n]="fast"===t.mode?[r.fastFormats,i]:[r.fullFormats,s];return l(e,t.formats||r.formatNames,a,n),t.keywords&&(0,o.default)(e),e};function l(e,t,r,o){var s;for(let i of(null!=(s=e.opts.code).formats||(s.formats=(0,a._)`require("ajv-formats/dist/formats").${o}`),t))e.addFormat(i,r[i])}n.get=(e,t="full")=>{let o=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o},t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n}),is=sO(),ii=s0(),il=it();let ic=rW(ia(),1).default;function iu(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ic(t),t}var id=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=iu(il.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=function(e,t){if(!("$schema"in e)||"string"!=typeof e.$schema)return"2020-12";let r=e.$schema.replace(/#$/,"");if(rJ.has(r))return"2020-12";if(rB.has(r))return"2019-09";if(rZ.has(r)||rX.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===t?this.ajv:"2019-09"===t?this._ajv2019??=iu(ii.Ajv2019):this._ajvDraft7??=iu(is.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&"string"==typeof e.$id?t.getSchema(e.$id)??t.compile(e):t.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}};async function ih(e){return(await s).getRandomValues(new Uint8Array(e))}async function ip(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=256-256%t.length,o="";for(;o.length<e;)for(let a of(await ih(e-o.length)))a<r&&(o+=t[a%t.length]);return o}async function im(e){return await ip(e)}async function iy(e){return btoa(String.fromCharCode(...new Uint8Array(await (await s).subtle.digest("SHA-256",new TextEncoder().encode(e))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function iv(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await im(e),r=await iy(t);return{code_verifier:t,code_challenge:r}}is.Ajv,s=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:module").then(function(e){return l.t(e.createRequire(import.meta.url)("node:crypto"),18)}).then(e=>e.webcrypto);class ig extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function i_(e){}function iS(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=i_,onError:r=i_,onRetry:o=i_,onComment:a}=e,s="",i=!0,n,l="",c="";function u(e){if(""===e)return void(l.length>0&&t({id:n,event:c||void 0,data:l.endsWith(`
9
9
  `)?l.slice(0,-1):l}),n=void 0,l="",c="");if(e.startsWith(":")){a&&a(e.slice(e.startsWith(": ")?2:1));return}let r=e.indexOf(":");if(-1!==r){let t=e.slice(0,r),o=" "===e[r+1]?2:1;d(t,e.slice(r+o),e);return}d(e,"",e)}function d(e,t,a){switch(e){case"event":c=t;break;case"data":l=`${l}${t}
10
10
  `;break;case"id":n=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?o(parseInt(t,10)):r(new ig(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:a}));break;default:r(new ig(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:a}))}}return{feed:function(e){let t=i?e.replace(/^\xEF\xBB\xBF/,""):e,[r,o]=function(e){let t=[],r="",o=0;for(;o<e.length;){let a=e.indexOf("\r",o),s=e.indexOf(`
11
11
  `,o),i=-1;if(-1!==a&&-1!==s?i=Math.min(a,s):-1!==a?i=a===e.length-1?-1:a:-1!==s&&(i=s),-1===i){r=e.slice(o);break}{let r=e.slice(o,i);t.push(r),"\r"===e[(o=i+1)-1]&&e[o]===`
12
- `&&o++}}return[t,r]}(`${s}${t}`);for(let e of r)u(e);s=o,i=!1},reset:function(e={}){s&&e.consume&&u(s),i=!0,n=void 0,l="",c="",s=""}}}class ib extends Event{constructor(e,t){var r,o;super(e),this.code=null!=(r=null==t?void 0:t.code)?r:void 0,this.message=null!=(o=null==t?void 0:t.message)?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,r){return r(i$(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(i$(this),t)}}function i$(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var iw,iR,iP,iE,iC,iT,ik,iI,ix,ij,iO,iN,iq,iM,iA,iL,iU,iV,iz,iD,iH,iF,iG,iK,iW,iJ,iB,iZ=e=>{throw TypeError(e)},iX=(e,t,r)=>t.has(e)||iZ("Cannot "+r),iQ=(e,t,r)=>(iX(e,t,"read from private field"),r?r.call(e):t.get(e)),iY=(e,t,r)=>t.has(e)?iZ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),i0=(e,t,r,o)=>(iX(e,t,"write to private field"),t.set(e,r),r),i1=(e,t,r)=>(iX(e,t,"access private method"),r);class i2 extends EventTarget{constructor(e,t){var r,o,a;super(),iY(this,iV),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,iY(this,iC),iY(this,iT),iY(this,ik),iY(this,iI),iY(this,ix),iY(this,ij),iY(this,iO),iY(this,iN,null),iY(this,iq),iY(this,iM),iY(this,iA,null),iY(this,iL,null),iY(this,iU,null),iY(this,iD,async e=>{var t;iQ(this,iM).reset();let{body:r,redirected:o,status:a,headers:s}=e;if(204===a){i1(this,iV,iW).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(o?i0(this,ik,new URL(e.url)):i0(this,ik,void 0),200!==a)return void i1(this,iV,iW).call(this,`Non-200 status code (${a})`,a);if(!(s.get("content-type")||"").startsWith("text/event-stream"))return void i1(this,iV,iW).call(this,'Invalid content type, expected "text/event-stream"',a);if(iQ(this,iC)===this.CLOSED)return;i0(this,iC,this.OPEN);let i=new Event("open");if(null==(t=iQ(this,iU))||t.call(this,i),this.dispatchEvent(i),"object"!=typeof r||!r||!("getReader"in r)){i1(this,iV,iW).call(this,"Invalid response body, expected a web ReadableStream",a),this.close();return}let n=new TextDecoder,l=r.getReader(),c=!0;do{let{done:e,value:t}=await l.read();t&&iQ(this,iM).feed(n.decode(t,{stream:!e})),e&&(c=!1,iQ(this,iM).reset(),i1(this,iV,iJ).call(this))}while(c)}),iY(this,iH,e=>{i0(this,iq,void 0),"AbortError"!==e.name&&"aborted"!==e.type&&i1(this,iV,iJ).call(this,function e(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(e).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${e(t.cause)}`:t.message:`${t}`}(e))}),iY(this,iG,e=>{"string"==typeof e.id&&i0(this,iN,e.id);let t=new MessageEvent(e.event||"message",{data:e.data,origin:iQ(this,ik)?iQ(this,ik).origin:iQ(this,iT).origin,lastEventId:e.id||""});iQ(this,iL)&&(!e.event||"message"===e.event)&&iQ(this,iL).call(this,t),this.dispatchEvent(t)}),iY(this,iK,e=>{i0(this,ij,e)}),iY(this,iB,()=>{i0(this,iO,void 0),iQ(this,iC)===this.CONNECTING&&i1(this,iV,iz).call(this)});try{if(e instanceof URL)i0(this,iT,e);else if("string"==typeof e){let t;i0(this,iT,new URL(e,(t="document"in globalThis?globalThis.document:void 0)&&"object"==typeof t&&"baseURI"in t&&"string"==typeof t.baseURI?t.baseURI:void 0))}else throw Error("Invalid URL")}catch{let e;throw a="An invalid or illegal string was specified","function"==typeof(e=globalThis.DOMException)?new e(a,"SyntaxError"):SyntaxError(a)}i0(this,iM,iS({onEvent:iQ(this,iG),onRetry:iQ(this,iK)})),i0(this,iC,this.CONNECTING),i0(this,ij,3e3),i0(this,ix,null!=(r=null==t?void 0:t.fetch)?r:globalThis.fetch),i0(this,iI,null!=(o=null==t?void 0:t.withCredentials)&&o),i1(this,iV,iz).call(this)}get readyState(){return iQ(this,iC)}get url(){return iQ(this,iT).href}get withCredentials(){return iQ(this,iI)}get onerror(){return iQ(this,iA)}set onerror(e){i0(this,iA,e)}get onmessage(){return iQ(this,iL)}set onmessage(e){i0(this,iL,e)}get onopen(){return iQ(this,iU)}set onopen(e){i0(this,iU,e)}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}close(){iQ(this,iO)&&clearTimeout(iQ(this,iO)),iQ(this,iC)!==this.CLOSED&&(iQ(this,iq)&&iQ(this,iq).abort(),i0(this,iC,this.CLOSED),i0(this,iq,void 0))}}iC=new WeakMap,iT=new WeakMap,ik=new WeakMap,iI=new WeakMap,ix=new WeakMap,ij=new WeakMap,iO=new WeakMap,iN=new WeakMap,iq=new WeakMap,iM=new WeakMap,iA=new WeakMap,iL=new WeakMap,iU=new WeakMap,iV=new WeakSet,iz=function(){i0(this,iC,this.CONNECTING),i0(this,iq,new AbortController),iQ(this,ix)(iQ(this,iT),i1(this,iV,iF).call(this)).then(iQ(this,iD)).catch(iQ(this,iH))},iD=new WeakMap,iH=new WeakMap,iF=function(){var e;let t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...iQ(this,iN)?{"Last-Event-ID":iQ(this,iN)}:void 0},cache:"no-store",signal:null==(e=iQ(this,iq))?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},iG=new WeakMap,iK=new WeakMap,iW=function(e,t){var r;iQ(this,iC)!==this.CLOSED&&i0(this,iC,this.CLOSED);let o=new ib("error",{code:t,message:e});null==(r=iQ(this,iA))||r.call(this,o),this.dispatchEvent(o)},iJ=function(e,t){var r;if(iQ(this,iC)===this.CLOSED)return;i0(this,iC,this.CONNECTING);let o=new ib("error",{code:t,message:e});null==(r=iQ(this,iA))||r.call(this,o),this.dispatchEvent(o),i0(this,iO,setTimeout(iQ(this,iB),iQ(this,ij)))},iB=new WeakMap,i2.CONNECTING=0,i2.OPEN=1,i2.CLOSED=2;class i9 extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let o;super({start(a){o=iS({onEvent:e=>{a.enqueue(e)},onError(t){"terminate"===e?a.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){o.feed(e)}})}}var i4=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e){super(e),this.name=new.target.name,rY(this,new.target)}},i5=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${"metadata"===e?"authorization server metadata (RFC 8414 \xa73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`),this.kind=e,this.expected=t,this.received=r}},i3=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},i6=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},i7=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},i8=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function ne(e,t,r){if(void 0!==e)return void 0===e.issuer?(r?.canPersistStamp!==!1&&console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field."),e):nt(e.issuer,t)?e:void 0}function nt(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}function nr(e){return null!=e&&"function"==typeof e.tokens&&"function"==typeof e.clientInformation}async function no(e,t,r){let{resourceMetadataUrl:o,scope:a}=nv(t.response);if(await nm(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:a,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new ns}function na(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async r=>no(e,r,t)}}var ns=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",rY(this,new.target)}};function ni(e){return e?.authorization_response_iss_parameter_supported===!0}function nn({iss:e,expectedIssuer:t,issParameterSupported:r}){if(void 0!==t){if(void 0===e){if(r)throw new i5("authorization_response",t,void 0);return}if(e!==t)throw new i5("authorization_response",t,e)}}function nl(...e){let t=new Set;for(let r of e)if(r)for(let e of r.split(/\s+/))e&&t.add(e);return t.size>0?[...t].join(" "):void 0}async function nc(e,t,r,o,a){if("string"==typeof e)return{authorizationCode:e,iss:t};let s=e.get("iss")??void 0,i=e.get("code");if(i)return{authorizationCode:i,iss:s};let n=(await r.discoveryState?.())?.authorizationServerMetadata;if(!n)try{n=(await nR(o,a)).authorizationServerMetadata}catch{n=void 0}if(!n)throw new ns("Authorization callback failed and the issuer could not be verified");nn({iss:s,expectedIssuer:n.issuer,issParameterSupported:ni(n)});let l=e.get("error");if(l)throw new r2(l,e.get("error_description")??l,e.get("error_uri")??void 0);throw new ns("Authorization callback contained neither `code` nor `error`")}let nu="code",nd="S256";function nh(e){return"localhost"===e||"127.0.0.1"===e||"[::1]"===e||"::1"===e}async function np(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let e=N.parse(JSON.parse(r));return r2.fromResponse(e)}catch(o){let e=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new r2(r1.ServerError,e)}}async function nm(e,t){try{return await nf(e,t)}catch(r){if(r instanceof r2){if(r.code===r1.InvalidClient||r.code===r1.UnauthorizedClient)return await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await nf(e,t);else if(r.code===r1.InvalidGrant)return await e.invalidateCredentials?.("tokens"),await nf(e,t)}throw r}}async function nf(e,{serverUrl:t,authorizationCode:r,iss:o,scope:a,resourceMetadataUrl:s,fetchFn:i,skipIssuerMetadataValidation:n,forceReauthorization:l}){let c,u,d,h,p,m={...p=e.clientMetadata,grant_types:p.grant_types??(void 0===e.redirectUrl?void 0:["authorization_code","refresh_token"]),application_type:p.application_type??function(e){for(let t of e??[]){let e;try{e=new URL(t)}catch{continue}if("http:"!==e.protocol&&"https:"!==e.protocol||nh(e.hostname))return"native"}return"web"}(p.redirect_uris)},f=await e.discoveryState?.(),y=s;if(!y&&f?.resourceMetadataUrl&&(y=new URL(f.resourceMetadataUrl)),f?.authorizationServerUrl){if(u=f.authorizationServerUrl,c=f.resourceMetadata,d=f.authorizationServerMetadata??await nw(u,{fetchFn:i,skipIssuerValidation:n}),!c)try{c=await n_(t,{resourceMetadataUrl:y},i)}catch(e){if(e instanceof TypeError)throw e}(d!==f.authorizationServerMetadata||c!==f.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:y?.toString(),resourceMetadata:c,authorizationServerMetadata:d})}else{let e=await nR(t,{resourceMetadataUrl:y,fetchFn:i,skipIssuerMetadataValidation:n});u=e.authorizationServerUrl,d=e.authorizationServerMetadata,c=e.resourceMetadata,h={authorizationServerUrl:String(u),resourceMetadataUrl:y?.toString(),resourceMetadata:c,authorizationServerMetadata:d}}let v=d?.issuer??String(u),g={issuer:v};if(await e.saveAuthorizationServerUrl?.(v),void 0!==r){let t=f?.authorizationServerMetadata?.issuer??f?.authorizationServerUrl;if(void 0===t){if(void 0!==e.saveDiscoveryState)throw new i7("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",v);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md \xa7SEP-2352.")}else if(!nt(t,v))throw new i7(t,v)}h&&await e.saveDiscoveryState?.(h);let _=await ny(t,e,c);_&&await e.saveResourceUrl?.(String(_));let S=function(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:a}=e,s=t||r?.scopes_supported?.join(" ")||a.scope;return s&&o?.scopes_supported?.includes("offline_access")&&!s.split(" ").includes("offline_access")&&a.grant_types?.includes("refresh_token")&&(s=`${s} offline_access`),s}({requestedScope:a,resourceMetadata:c,authServerMetadata:d,clientMetadata:e.clientMetadata}),b=await Promise.resolve(e.clientInformation(g)),$=ne(b,v,{canPersistStamp:void 0!==e.saveClientInformation});if(void 0===$&&b?.issuer&&void 0===e.saveClientInformation)throw new i7(b.issuer,v);if($&&void 0===$.issuer&&($={...$,issuer:v},await e.saveClientInformation?.($,g)),!$){if(void 0!==r)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=d?.client_id_metadata_document_supported===!0,o=e.clientMetadataUrl;if(o&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(o))throw new r2(r1.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${o}`);if(t&&o)$={client_id:o,issuer:v},await e.saveClientInformation?.($,g);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");$={...await nk(u,{metadata:d,clientMetadata:m,scope:S,fetchFn:i}),issuer:v},await e.saveClientInformation($,g)}}let w=!e.redirectUrl;if(void 0!==r||w){void 0!==r&&nn({iss:o,expectedIssuer:d?.issuer,issParameterSupported:ni(d)});let t=await nT(e,u,{metadata:d,resource:_,authorizationCode:r,iss:o,scope:S,fetchFn:i});return await e.saveTokens({...t,issuer:v},g),"AUTHORIZED"}let R=ne(await e.tokens(g),v);if(R&&void 0===R.issuer&&(R={...R,issuer:v},await e.saveTokens(R,g)),R?.refresh_token&&!l)try{let t=await nC(u,{metadata:d,clientInformation:$,refreshToken:R.refresh_token,resource:_,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens({...t,issuer:v},g),"AUTHORIZED"}catch(e){if(e instanceof i6||e instanceof r2&&e.code!==r1.ServerError)throw e}let P=e.state?await e.state():void 0,{authorizationUrl:E,codeVerifier:C}=await nP(u,{metadata:d,clientInformation:$,state:P,redirectUrl:e.redirectUrl,scope:S,resource:_});return await e.saveCodeVerifier(C),await e.redirectToAuthorization(E),"REDIRECT"}async function ny(e,t,r){let o,a=((o=new URL("string"==typeof e?e:e.href)).hash="",o);if(t.validateResourceURL)return await t.validateResourceURL(a,r?.resource);if(r){if(!function({requestedResource:e,configuredResource:t}){let r=new URL("string"==typeof e?e:e.href),o=new URL("string"==typeof t?t:t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let a=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return a.startsWith(s)}({requestedResource:a,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${a} (or origin)`);return new URL(r.resource)}}function nv(e){let t,r=e.headers.get("WWW-Authenticate");if(!r)return{};let[o,a]=r.split(" ");if(o?.toLowerCase()!=="bearer"||!a)return{};let s=ng(e,"resource_metadata")||void 0;if(s)try{t=new URL(s)}catch{}let i=ng(e,"scope")||void 0;return{resourceMetadataUrl:t,scope:i,error:ng(e,"error")||void 0,errorDescription:ng(e,"error_description")||void 0}}function ng(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),a=r.match(o);if(a){let e=a[1]||a[2];if(e)return e}return null}async function n_(e,t,r=fetch){let o=await n$(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||404===o.status)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return r_.parse(await o.json())}async function nS(e,t,r=fetch){try{return await r(e,{headers:t})}catch(e){throw e}}async function nb(e,t,r=fetch){return await nS(e,{"MCP-Protocol-Version":t},r)}async function n$(e,t,r,o){var a,s;let i,n=new URL(e),l=o?.protocolVersion??ri;o?.metadataUrl?i=new URL(o.metadataUrl):(i=new URL(function(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,n.pathname),o?.metadataServerUrl??n)).search=n.search;let c=await nb(i,l,r);return!o?.metadataUrl&&(a=c,s=n.pathname,!a||"/"!==s&&(a.status>=400&&a.status<500||502===a.status))&&(c=await nb(new URL(`/.well-known/${t}`,n),l,r)),c}async function nw(e,{fetchFn:t=fetch,protocolVersion:r=ri,skipIssuerValidation:o=!1}={}){let a={"MCP-Protocol-Version":r,Accept:"application/json"};for(let{url:r,type:s}of function(e){let t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"},{url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}(e)){let i=await nS(r,a,t);if(!i)continue;if(!i.ok){if(await i.text?.().catch(()=>{}),i.status>=400&&i.status<500||502===i.status)continue;throw Error(`HTTP ${i.status} trying to load ${"oauth"===s?"OAuth":"OpenID provider"} metadata from ${r}`)}let n="oauth"===s?ra.parse(await i.json()):_.parse(await i.json());if(!o){let t="string"==typeof e?e:e.href;if(!(n.issuer===t||t.endsWith("/")&&n.issuer===t.slice(0,-1)))throw new i5("metadata",t,n.issuer)}return n}}async function nR(e,t){let r,o;try{(r=await n_(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn)).authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch(e){if(e instanceof TypeError)throw e}o||(o=String(new URL("/",e)));let a=await nw(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:a,resourceMetadata:r}}async function nP(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:a,state:s,resource:i}){let n;if(t){if(n=new URL(t.authorization_endpoint),!t.response_types_supported.includes(nu))throw Error(`Incompatible auth server: does not support response type ${nu}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(nd))throw Error(`Incompatible auth server: does not support code challenge method ${nd}`)}else n=new URL("/authorize",e);let l=await iv(),c=l.code_verifier,u=l.code_challenge;return n.searchParams.set("response_type",nu),n.searchParams.set("client_id",r.client_id),n.searchParams.set("code_challenge",u),n.searchParams.set("code_challenge_method",nd),n.searchParams.set("redirect_uri",String(o)),s&&n.searchParams.set("state",s),a&&n.searchParams.set("scope",a),a?.split(" ").includes("offline_access")&&n.searchParams.append("prompt","consent"),i&&n.searchParams.set("resource",i.href),{authorizationUrl:n,codeVerifier:c}}async function nE(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:a,resource:s,fetchFn:i}){var n,l;let c,u=function(e){let t=new URL(String(e));if("https:"!==t.protocol&&!nh(t.hostname))throw new i6(t.href);return t}(t?.token_endpoint??new URL("/token",e)),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});s&&r.set("resource",s.href),a?await a(d,r,u,t):o&&function(e,t,r,o){let{client_id:a,client_secret:s}=t;switch(e){case"client_secret_basic":var i,n,l,c,u=a,d=s,h=r;if(!d)throw Error("client_secret_basic authentication requires a client_secret");let p=btoa(`${u}:${d}`);h.set("Authorization",`Basic ${p}`);return;case"client_secret_post":i=a,n=s,(l=o).set("client_id",i),n&&l.set("client_secret",n);return;case"none":c=a,o.set("client_id",c);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((n=o,l=t?.token_endpoint_auth_methods_supported??[],c=void 0!==n.client_secret,"token_endpoint_auth_method"in n&&n.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(n.token_endpoint_auth_method)&&(0===l.length||l.includes(n.token_endpoint_auth_method))?n.token_endpoint_auth_method:0===l.length?c?"client_secret_basic":"none":c&&l.includes("client_secret_basic")?"client_secret_basic":c&&l.includes("client_secret_post")?"client_secret_post":l.includes("none")?"none":c?"client_secret_post":"none"),o,d,r);let h=await (i??fetch)(u,{method:"POST",headers:d,body:r});if(!h.ok)throw await np(h);let p=await h.json();try{return rE.parse(p)}catch(e){if("object"==typeof p&&null!==p&&"error"in p)throw await np(JSON.stringify(p));throw e}}async function nC(e,{metadata:t,clientInformation:r,refreshToken:o,resource:a,addClientAuthentication:s,fetchFn:i}){return{refresh_token:o,...await nE(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),clientInformation:r,addClientAuthentication:s,resource:a,fetchFn:i})}}async function nT(e,t,{metadata:r,resource:o,authorizationCode:a,iss:s,scope:i,fetchFn:n}={}){let l;void 0!==a&&nn({iss:s,expectedIssuer:r?.issuer,issParameterSupported:ni(r)});let c=i??e.clientMetadata.scope;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){if(!a)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");l=new URLSearchParams({grant_type:"authorization_code",code:a,code_verifier:await e.codeVerifier(),redirect_uri:String(e.redirectUrl)})}let u=await e.clientInformation({issuer:r?.issuer??String(t)});return nE(t,{metadata:r,tokenRequestParams:l,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:n})}async function nk(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:a}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i={...r,...void 0===o?{}:{scope:o}},n=await (a??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok)throw new i3({status:n.status,body:await n.text(),submittedMetadata:i});return ei.parse(await n.json())}let nI=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var nx=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(nj(e))}set(e,t){let r=nj(e),o=nI.has(e.method),a=!this._entries.has(r);if(!o&&a&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let e of this._entries.keys())if(!nI.has(e.slice(0,e.indexOf("\0")))){this._entries.delete(e),this._cappedSize--;break}}let s=++this._stamp;return this._entries.set(r,{...t,stamp:s}),a&&!o&&this._cappedSize++,s}delete(e){this._entries.delete(nj(e))&&!nI.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,r=nI.has(e);for(let e of this._entries.keys())e.startsWith(t)&&(this._entries.delete(e),!r&&this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function nj(e){return`${e.method}\0${JSON.stringify([e.partition??"",e.params??""])}`}function nO(e,t){return void 0===t?e:`${e}\0${t}`}var nN=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",a=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=a}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,"public"===e?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),a=await this._store.get({...r,partition:o});if(void 0!==a)return a;let s=this._partitionFor("public");if(s===o)return;let i=await this._store.get({...r,partition:s});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(e){this._reportError(e)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(e){this._reportError(e)}}async evictKey(e,t){let r=nO(e,t),o=this._evictionGeneration.get(r);void 0!==o&&this._evictionGeneration.set(r,o+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let r=nO(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(nO(e,o?.params))??0)!==r)return;let a=o?.params??"",s=this._partitionFor("private"),i=this._partitionFor("public"),n=(o?.scope??"private")==="public"?i:s;try{await this._store.set({method:e,params:a,partition:n},{value:function(e){let t;try{t=JSON.stringify(e)}catch(e){throw TypeError(`cache value is not JSON-serializable: ${e instanceof Error?e.message:String(e)}`)}if("string"!=typeof t)throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(e){this._reportError(e)}if(i!==s)try{await this._store.delete({method:e,params:a,partition:n===s?i:s})}catch(e){this._reportError(e)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt!==void 0&&r.expiresAt>this.now())try{let e=JSON.parse(r.value);if("object"!=typeof e||null===e||Array.isArray(e))throw TypeError("cached document is not an object");return{value:e}}catch(r){this._reportError(r),await this._deleteBoth(e,t??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(void 0===t){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let e=this._decodeListTools(t),r=new Map;if(void 0!==e)for(let t of e.tools)r.set(t.name,t);this._toolIndex={stamp:t.stamp,byName:r}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(void 0===r){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let e=this._decodeListTools(r)??{tools:[]},o=new Map;for(let r of e.tools){let e=t(r);void 0!==e&&o.set(r.name,e)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:o}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(e=>null!==e&&"object"==typeof e))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(e){this._reportError(e);return}}};let nq=Symbol.for("mcp.authSeamEscape");function nM(e){if("object"==typeof e&&null!==e||"function"==typeof e)try{Object.defineProperty(e,nq,{value:!0,configurable:!0})}catch{}return e}let nA=new Set([-32001,-32020,-32021]);function nL(e,t){let{code:r,message:o,data:a}=e;if(-32022===r){let e=function(e){if("object"!=typeof e||null===e)return;let t=e.supported;if(Array.isArray(t)&&0!==t.length&&t.every(e=>"string"==typeof e))return t}(a);if(void 0===e)return{kind:"legacy"};let r=new oT({supported:e,requested:function(e){if("object"!=typeof e||null===e)return;let t=e.requested;return"string"==typeof t?t:void 0}(a)??t.requestedVersion},o),s=r8(e),i=t.clientModernVersions.find(e=>s.includes(e));return void 0!==i?{kind:"corrective",version:i,error:r}:s.length>0?{kind:"error",error:r}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:r}}return nA.has(r),{kind:"legacy"}}function nU(e,t){var r,o;return"browser"===t.environment&&((r=e)instanceof TypeError||r instanceof Error&&"TypeError"===r.name)?{kind:"legacy"}:{kind:"error",error:new r4(r9.EraNegotiationFailed,`Version negotiation probe failed: ${(o=e)instanceof Error?o.message:String(o)}`,{cause:e})}}function nV(){let e=globalThis;return void 0!==e.window&&void 0!==e.document?"browser":"node"}function nz(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var nD=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(e){this._transport=e,this._savedOnMessage=e.onmessage,this._savedOnError=e.onerror,this._savedOnClose=e.onclose}static async open(t){let r=new e(t);t.onmessage=e=>{let t=r._pending;if(void 0!==t&&(oX(e)||oQ(e))&&e.id===t.id){r._pending=void 0,oX(e)?t.resolve({kind:"response",result:e.result}):t.resolve({kind:"response",error:e.error});return}},t.onerror=e=>{r._savedOnError?.(e)},t.onclose=()=>{let e=r._pending;void 0!==e&&(r._pending=void 0,e.resolve({kind:"closed"})),r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(e){throw r.detach(),e}return r}async exchange(e,t){let r=`server-discover-probe-${++this._probeCounter}`;return new Promise(o=>{let a=!1,s=e=>{a||(a=!0,clearTimeout(i),this._pending?.id===r&&(this._pending=void 0),o(e))},i=setTimeout(()=>s({kind:"timeout"}),t);this._pending={id:r,resolve:s},this._transport.send(e(r)).catch(e=>s({kind:"send-error",error:e}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&void 0!==this._savedOnClose){let e=this._savedOnClose,t=this._transport,r=!1,o=()=>{if(!r){r=!0;return}e()};t.onclose=o,nH.set(t,()=>{t.onclose===o&&(t.onclose=e)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let e=this._transport,t=e.start,r=!0;e.start=async function(){if(r){r=!1,e.start=t;return}return t.call(e)}}};let nH=new WeakMap;function nF(e){let t=nH.get(e);nH.delete(e),t?.()}async function nG(e,t){let r,o=e.probe.timeoutMs??t.defaultTimeoutMs,a=Math.max(0,e.probe.maxRetries??0),s="pin"===e.kind?[e.version]:e.modernVersions,i="auto"===e.kind&&e.fallbackAvailable,n=await nD.open(t.transport),l=async()=>{let r=s[0],l=!1,c=a;for(;;){let a=await n.exchange(e=>{var o,a,s;return o=r,a=t.clientInfo,s=t.capabilities,{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:oG(o).outboundEnvelope({protocolVersion:o,clientInfo:a,clientCapabilities:s})}}},o);if("timeout"===a.kind&&c>0){c--;continue}let u=function(e,t){switch(e.kind){case"response":return void 0===e.error?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let t=e.error;if(("object"==typeof t&&null!==t||"function"==typeof t)&&!0===t[nq]||t instanceof ns||t instanceof Error&&"UnauthorizedError"===t.name)return{kind:"auth-required",error:t};if(t instanceof r5){let e=t.data?.text;return{kind:"http-error",status:t.data.status,body:"string"==typeof e?e:void 0,statusText:t.data.statusText}}return{kind:"network-error",error:t}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}(a,o),d=function(e,t){switch(e.kind){case"result":return function(e,t){let r=oG(oF).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,a=t.clientModernVersions.find(e=>o.includes(e));return void 0!==a?{kind:"modern",version:a,discover:r.value}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new oT({supported:[...o],requested:t.requestedVersion})}}(e.result,t);case"rpc-error":return nL(e,t);case"http-error":return function(e,t){if(401===e.status||403===e.status){let t=403===e.status;return{kind:"error",error:new r5(t?r9.ClientHttpForbidden:r9.ClientHttpAuthentication,`Version negotiation failed: ${t?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new r5(r9.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=function(e){let t;if(void 0===e||""===e)return;try{t=JSON.parse(e)}catch{return}if("object"!=typeof t||null===t)return;let r=t.error;if("object"!=typeof r||null===r)return;let{code:o,message:a,data:s}=r;if("number"==typeof o)return{code:o,message:"string"==typeof a?a:"",data:s}}(e.body);return void 0!==r?nL(r,t):{kind:"legacy"}}(e,t);case"network-error":return nU(e.error,t);case"auth-required":return{kind:"error",error:e.error};case"closed":if("stdio"===t.transportKind)return{kind:"legacy"};return nU(Error("Connection closed during the version negotiation probe"),t);case"timeout":if("stdio"===t.transportKind)return{kind:"legacy"};return{kind:"error",error:new r4(r9.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}(u,{clientModernVersions:s,requestedVersion:r,fallbackAvailable:i,environment:t.environment,transportKind:t.transportKind});switch(d.kind){case"modern":return{era:"modern",version:d.version,discover:d.discover};case"corrective":if(l)throw d.error;l=!0,r=d.version;continue;case"legacy":{let r="closed"===u.kind?"the connection closed during the server/discover probe":void 0;if("pin"===e.kind)throw new r4(r9.EraNegotiationFailed,void 0===r?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${r} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new r4(r9.EraNegotiationFailed,void 0===r?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${r} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(void 0!==r&&!0!==t.disposableProbe)throw new r4(r9.EraNegotiationFailed,`Version negotiation failed: ${r} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw d.error}}};try{r=await l()}catch(e){throw n.detach(),e}return n.release(),r}async function nK(e,t,r,o){let a,s,i=new t.constructor({...r,stderr:"ignore"}),n=t.close,l=!1,c=new Promise((e,t)=>{a=()=>t(nW())});t.close=async function(){return l=!0,a?.(),n.call(t)};try{let t=nG(e,{...o,transport:i,transportKind:"stdio",disposableProbe:!0});t.catch(()=>{}),s=await Promise.race([t,c])}finally{await nJ(i),t.close=n}if(l)throw nW();return s}function nW(){return new r4(r9.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function nJ(e){try{let t=e._dispose;await ("function"==typeof t?t.call(e):e.close())}catch{}}function nB(e){let t=e._meta?.[tL];return ay.Implementation(t)?t:void 0}let nZ={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var nX=class extends a${_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new r4(r9.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}for(let e of(this._listenState.clear(),this._listChangedDebounceTimers.values()))clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){var r;super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new id,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=(r=t?.inputRequired,{autoFulfill:r?.autoFulfill??!0,maxRounds:r?.maxRounds??10}),this._cache=new nN(t?.responseCacheStore??new nx,t?.responseCacheStore!==void 0,e=>this._reportStoreError(e),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??64,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=r3&&eN.safeParse(e).success)return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?function(e,t,r,o){let{codec:a,request:s,options:i,flowStartedAt:n}=o,l={inputRequests:r.inputRequests,...void 0!==r.requestState&&{requestState:r.requestState}};return ah({config:t,method:s.method,originalParams:s.params,firstPayload:l,flowStartedAt:n,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:{dispatchInputRequest:(t,r,o)=>aE(e,a,t,r,o),retry:(e,t)=>o.retry(e,{...i?.signal!==void 0&&{signal:i.signal},...i?.onprogress!==void 0&&{onprogress:i.onprogress},...i?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:i.resetTimeoutOnProgress},...i?.headers!==void 0&&{headers:i.headers},...void 0!==t.timeout&&{timeout:t.timeout},...void 0!==t.maxTotalTimeout&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0})}})}({getRequestHandler:e=>this._getRequestHandler(e),buildContext:e=>this.buildContext(e,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new r4(r9.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let r={...e};for(let e in t){let o=t[e];if(void 0===o)continue;let a=r[e];r[e]=aw(a)&&aw(o)?{...a,...o}:o}return r}(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){return"elicitation/create"===e?async(e,r)=>{let o=oG(this._negotiatedProtocolVersion),a=o.validateRequest("elicitation/create",e);if(a.ok||"not-in-era"!==a.reason||(a=o.validateInputRequest("elicitation/create",e)),!a.ok)throw new oP("not-in-era"===a.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===a.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${a.message}`);let{params:s}=a.value;s.mode=s.mode??"form";let{supportsFormMode:i,supportsUrlMode:n}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===s.mode&&!i)throw new oP(oR.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===s.mode&&!n)throw new oP(oR.InvalidParams,"Client does not support URL-mode elicitation requests");let l=await t(e,r),c=o.validateResult("elicitation/create",l);if(c.ok||"not-in-era"!==c.reason||(c=o.validateInputResponse("elicitation/create",l)),!c.ok)throw new oP("not-in-era"===c.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===c.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${c.message}`);let u=c.value,d="form"===s.mode?s.requestedSchema:void 0;if("form"===s.mode&&"accept"===u.action&&u.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,r){if(t&&null!==r&&"object"==typeof r){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let o=t.properties;for(let t of Object.keys(o)){let a=o[t];void 0===r[t]&&Object.prototype.hasOwnProperty.call(a,"default")&&(r[t]=a.default),void 0!==r[t]&&e(a,r[t])}}if(Array.isArray(t.anyOf))for(let o of t.anyOf)"boolean"!=typeof o&&e(o,r);if(Array.isArray(t.oneOf))for(let o of t.oneOf)"boolean"!=typeof o&&e(o,r)}}(d,u.content)}catch{}return u}:"sampling/createMessage"===e?async(e,r)=>{let o=oG(this._negotiatedProtocolVersion),a=o.validateRequest("sampling/createMessage",e);if(a.ok||"not-in-era"!==a.reason||(a=o.validateInputRequest("sampling/createMessage",e)),!a.ok)throw new oP("not-in-era"===a.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===a.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${a.message}`);let{params:s}=a.value,i=await t(e,r),n=!!(s.tools||s.toolChoice),l=o.samplingResultVariant(n,i);if(l.ok||"not-in-era"!==l.reason||(l=o.validateInputResponse("sampling/createMessage",i)),!l.ok)throw new oP("not-in-era"===l.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===l.reason?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${l.message}`);return l.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new r4(r9.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,function(e){if("object"==typeof e&&null!==e&&("legacy"===e.kind&&!("supportedVersions"in e)&&!("discover"in e)||"modern"===e.kind&&b.safeParse(e.discover).success))return e;throw new r4(r9.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}(t.prior),t);let r=function(e,t){let r=e?.mode??"legacy";if("legacy"===r)return{kind:"legacy"};let o=e?.probe??{};if("object"==typeof r){if(!(r.pin>=r3))throw TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let a=t?r8(t):[];return{kind:"auto",modernVersions:a.length>0?a:[...r6],fallbackAvailable:!t||r7(t).length>0,probe:o}}(this._versionNegotiation,this._supportedProtocolVersionsOption);return"legacy"!==r.kind?this._connectNegotiated(e,r,t):this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),void 0!==e.sessionId){let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion?.(t);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=r7(this._supportedProtocolVersions);try{let o=r[0];if(void 0===o)throw new r4(r9.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let a=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(void 0===a)throw Error(`Server sent invalid initialize result: ${a}`);if(!r.includes(a.protocolVersion))throw Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=a.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(e){throw this.close(),e}}async _connectNegotiated(e,t,r){let o;if(void 0!==e.sessionId){await super.connect(e);let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion&&e.setProtocolVersion(t);return}this._resetConnectionState();try{let a=nz(e),s={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:nV(),defaultTimeoutMs:r?.timeout??6e4},i="stdio"===a?function(e){let t=Object.getPrototypeOf(e);if(null===t||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return"object"==typeof r&&null!==r&&"string"==typeof r.command?r:void 0}(e):void 0;o=void 0===i?await nG(t,{...s,transport:e,transportKind:a}):await nK(t,e,i,s)}catch(t){throw await e.close().catch(()=>{}),nF(e),t}if(nF(e),await super.connect(e),"legacy"===o.era)return void await this._legacyHandshake(e,r);if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=nB(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion&&e.setProtocolVersion(o.version),this._listChangedConfig){let e=this._listChangedConfig,t=this._serverCapabilities,o={...e.tools&&t?.tools?.listChanged&&{tools:e.tools},...e.prompts&&t?.prompts?.listChanged&&{prompts:e.prompts},...e.resources&&t?.resources?.listChanged&&{resources:e.resources}},a=!0;try{this._setupListChangedHandlers(o)}catch(e){a=!1,this.onerror?.(e instanceof Error?e:Error(String(e)))}let s=a?{...o.tools&&{toolsListChanged:!0},...o.prompts&&{promptsListChanged:!0},...o.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(s).length>0){let e=new AbortController,t=()=>e.abort(r?.signal?.reason);r?.signal?.aborted&&t(),r?.signal?.addEventListener("abort",t);try{this._autoOpenedSubscription=await this.listen(s,{timeout:r?.timeout,signal:e.signal})}catch(e){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),e;this.onerror?.(e instanceof Error?e:Error(String(e)))}finally{r?.signal?.removeEventListener("abort",t)}}}}async _connectFromPrior(e,t,r){if("legacy"===t.kind)return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let a=this._supportedProtocolVersionsOption,s=(a&&r8(a).length>0?r8(a):r6).find(e=>o.supportedVersions.includes(e));if(void 0===s)throw new r4(r9.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=nB(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=s,e.setProtocolVersion?.(s),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return void 0!==t?`${t.name}@${t.version}`:e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return e>=r3?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new r4(r9.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new r4(r9.CapabilityNotSupported,`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(!this._serverCapabilities?.resources)throw new r4(r9.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new r4(r9.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new r4(r9.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new r4(r9.CapabilityNotSupported,`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw new r4(r9.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new r4(r9.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new r4(r9.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new r4(r9.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`)}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},b,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);return void 0!==r?r:this._listAllPages("prompts/list",e,t,(e,t)=>e.prompts.push(...t.prompts))}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);return void 0!==r?r:this._listAllPages("resources/list",e,t,(e,t)=>e.resources.push(...t.resources))}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);return void 0!==r?r:this._listAllPages("resources/templates/list",e,t,(e,t)=>e.resourceTemplates.push(...t.resourceTemplates))}async _listAllPages(e,t,r,o,a){let s=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),n=await this.request({method:e,...t&&{params:{...t}}},r),l=n.nextCursor,c=new Set,u=1;for(;void 0!==l&&!c.has(l);){if(0!==this._listMaxPages&&u>=this._listMaxPages)throw new r4(r9.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});c.add(l);let a=await this.request({method:e,params:{...t,cursor:l}},r);o(n,a),l=a.nextCursor,u++}return delete n.nextCursor,a?.(n),s||await this._cache.write(e,n,i,this._freshness(n)),n}_freshness(e,t){let r="number"==typeof e.ttlMs?e.ttlMs:this._defaultCacheTtlMs,o="public"===e.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),864e5),scope:o,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch(e=>void this._reportStoreError(e));if(void 0!==o){if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof r4?e:new r4(r9.RequestTimeout,String(e))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(e){return{ok:!1,compileError:e}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return void 0===r?void 0:o4(r.inputSchema)}async readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(void 0!==r)return r;let o=this._cache.captureGeneration("resources/read",e.uri),a=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let r=this._freshness(a,e.uri);r.expiresAt>this._cache.now()?await this._cache.write("resources/read",a,o,r):t?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",e.uri)}return a}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){let r,o,a,s,i;if(void 0===this.transport)throw new r4(r9.NotConnected,"Not connected");let n=this._negotiatedProtocolVersion;if(void 0===n||!(n>=r3))throw new r4(r9.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${n??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:n});if(t?.signal?.aborted){let e=t.signal.reason;throw e instanceof r4?e:new r4(r9.RequestTimeout,String(e))}let l=new AbortController,c=`listen:${this._nextListenId++}`,u="opening",d=new Promise((e,t)=>{a=e,s=t}),h=new Promise(e=>{i=e}),p=e=>{if("closed"===u)return;let n="opening"===u;if(void 0!==r&&(clearTimeout(r),r=void 0),"ack"in e){u="open",a(e.ack);return}u="closed",void 0!==o&&t?.signal?.removeEventListener("abort",o),this._listenState.delete(c),l.abort(),i(e.cause),n&&s(e.error??new r4(r9.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},m=async()=>{l.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:c}}).catch(()=>{})},f=async()=>{"closed"!==u&&(p({cause:"local"}),await m())};this._listenState.set(c,{settle:p});let y=t?.timeout??6e4;if(r=setTimeout(()=>{p({cause:"remote",error:new r4(r9.RequestTimeout,"subscriptions/listen ack timed out",{timeout:y})}),m().catch(()=>{})},y),t?.signal){let e=t.signal;o=()=>{if("closed"===u)return;let t=e.reason;p({cause:"local",error:t instanceof Error?t:Error(String(t??"Aborted"))}),m().catch(()=>{})},e.addEventListener("abort",o,{once:!0})}let v={jsonrpc:"2.0",id:c,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}};try{await this.transport.send(v,{requestSignal:l.signal,onRequestStreamEnd:()=>p({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(e){p({cause:"remote",error:e instanceof Error?e:Error(String(e))})}return{honoredFilter:await d,close:f,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(nZ,e.method)?nZ[e.method]:void 0;if("notifications/resources/updated"===e.method){let t=e.params?.uri;"string"==typeof t&&this._cache.evictKey("resources/read",t)}else if(void 0!==r)for(let e of r)this._cache.evict(e);if("notifications/subscriptions/acknowledged"===e.method){let t=e.params?._meta?.[es],r="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==r){let t=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);r.settle({ack:t.ok?t.value.params.notifications:{}});return}}if("notifications/cancelled"===e.method){let t=e.params?.requestId,r="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==r)return void r.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")})}super._onnotification(e,t)}_onresponse(e){let t=e.id,r="string"==typeof t?this._listenState.get(t):void 0;void 0!==r?oQ(e)?r.settle({cause:"remote",error:oP.fromError(e.error.code,e.error.message,e.error.data)}):r.settle({cause:"graceful",error:new r4(r9.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new r4(r9.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r,o="modern"===this.getProtocolEra()&&"browser"!==nV(),a=async()=>{let r;if(!o)return t;try{r=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(e){this._reportStoreError(e)}if(!r?.valid||0===r.declarations.length)return t;let a=function(e,t){let r={};for(let o of e){let e=function(e,t){let r=e;for(let e of t){if(null===r||"object"!=typeof r)return;r=r[e]}return r}(t,o.path);if(null==e)continue;let a=function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e){if(!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}(e);void 0!==a&&(r[`Mcp-Param-${o.headerName}`]=o8(a))}return r}(r.declarations,e.arguments);return 0===Object.keys(a).length?t:{...t,headers:{...t?.headers,...a}}},s=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)):this._compileOutputValidator(t.toolDefinition),i=()=>{if(void 0===s||s.ok)return;let t=s.compileError,r=(t instanceof Error?t.message:String(t)).slice(0,200);throw new oP(oR.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${r}`)};i();try{r=await this.request({method:"tools/call",params:e},await a())}catch(c){let n=c instanceof oP&&-32020===c.code;if(!o||!n||t?.toolDefinition!==void 0)throw c;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,l).catch(e=>this._reportStoreError(e)),s=await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)),i(),r=await this.request({method:"tools/call",params:e},await a())}let n=void 0!==s&&s.ok?s.validator:void 0;if(n){if(void 0===r.structuredContent&&!r.isError)throw new oP(oR.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(void 0!==r.structuredContent&&!r.isError)try{let e=n(r.structuredContent);if(!e.valid)throw new oP(oR.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof oP)throw e;throw new oP(oR.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return r}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let r=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(r),r}let r=await this._serveFromCache("tools/list",void 0,t);return void 0!==r?r:this._listAllPages("tools/list",e,t,(e,t)=>e.tools.push(...t.tools),e=>this._excludeInvalidXMcpHeaderTools(e))}_excludeInvalidXMcpHeaderTools(e){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===nz(this.transport))return;let t=e.tools.filter(e=>{let t=o4(e.inputSchema);return!!t.valid||(console.warn(`[mcp-sdk] excluding tool '${e.name}' from tools/list: invalid x-mcp-header declaration — ${t.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,r,o){let a=ry(D,r);if(!a.success)throw Error(`Invalid ${e} listChanged options: ${a.error.message}`);if("function"!=typeof r.onChanged)throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=a.data,{onChanged:n}=r,l=async()=>{if(!s)return void n(null,null);try{n(null,await o())}catch(e){n(e instanceof Error?e:Error(String(e)),null)}},c=()=>{if(i){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let r=setTimeout(l,i);this._listChangedDebounceTimers.set(e,r)}else l()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}},nQ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(`SSE error: ${t}`),this.code=e,this.event=r,rY(this,new.target)}},nY=class{_eventSource;_endpoint;_abortController;_url;_resourceMetadataUrl;_scope;_eventSourceInit;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_protocolVersion;onclose;onerror;onmessage;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,nr(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=na(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ak(t?.fetch,t?.requestInit)}_last401Response;async _commonHeaders(){let e,t={};try{e=await this._authProvider?.token()}catch(e){throw nM(e)}e&&(t.Authorization=`Bearer ${e}`),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=aT(this._requestInit?.headers);return new Headers({...t,...r})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((t,r)=>{this._eventSource=new i2(this._url.href,{...this._eventSourceInit,fetch:async(t,r)=>{let o=await this._commonHeaders();o.set("Accept","text/event-stream");let a=await e(t,{...r,headers:o});if(401===a.status&&(this._last401Response=a,a.headers.has("www-authenticate"))){let{resourceMetadataUrl:e,scope:t}=nv(a);this._resourceMetadataUrl=e,this._scope=t}return a}}),this._abortController=new AbortController,this._eventSource.onerror=e=>{if(401===e.code&&this._authProvider){if(this._authProvider.onUnauthorized&&this._last401Response){let e=this._last401Response;this._last401Response=void 0,this._eventSource?.close(),this._authProvider.onUnauthorized({response:e,serverUrl:this._url,fetchFn:this._fetchWithInit}).then(()=>this._startOrAuth().then(t,r),e=>{nM(e),this.onerror?.(e),r(e)});return}let e=nM(new ns);r(e),this.onerror?.(e);return}let o=new nQ(e.code,e.message,e);r(o),this.onerror?.(o)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",e=>{try{if(this._endpoint=new URL(e.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(e){r(e),this.onerror?.(e),this.close();return}t()}),this._eventSource.onmessage=e=>{let t;try{t=e$.parse(JSON.parse(e.data))}catch(e){this.onerror?.(e);return}this.onmessage?.(t)}})}async start(){if(this._eventSource)throw Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e,t){if(!this._oauthProvider)throw new ns("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await nc(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await nm(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new ns("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){return this._send(e,!1)}async _send(e,t){if(!this._endpoint)throw new r4(r9.NotConnected,"Not connected");try{let r=await this._commonHeaders();r.set("content-type","application/json");let o={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},a=await (this._fetch??fetch)(this._endpoint,o);if(!a.ok){if(401===a.status&&this._authProvider){if(a.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=nv(a);this._resourceMetadataUrl=e,this._scope=t}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:a,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw nM(e)}return await a.text?.().catch(()=>{}),this._send(e,!0)}if(await a.text?.().catch(()=>{}),t)throw nM(new r5(r9.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:a.statusText}));throw nM(new ns)}let r=await a.text?.().catch(()=>null);throw Error(`Error POSTing to endpoint (HTTP ${a.status}): ${r}`)}await a.text?.().catch(()=>{})}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}};let n0={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},n1=new Set(["authorization","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function n2(e,t){if("function"==typeof AbortSignal.any)return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",a),t.removeEventListener("abort",s)};function a(){o(),r.abort(e.reason)}function s(){o(),r.abort(t.reason)}return e.addEventListener("abort",a,{once:!0}),t.addEventListener("abort",s,{once:!0}),r.signal}var n9=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,nr(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=na(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ak(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??n0,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??1)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(e){throw nM(e)}}async _stepUpAuthorizeInner(e,t){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new i8({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new r5(r9.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});e.resourceMetadataUrl&&(this._resourceMetadataUrl=e.resourceMetadataUrl);let r=await this._oauthProvider.tokens(),o=nl(this._scope,r?.scope,e.scope);this._scope=o;let a=function(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let t of e.split(/\s+/))if(t&&!r.has(t))return!0;return!1}(o,r?.scope);return nm(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:a,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let e,t={};try{e=await this._authProvider?.token()}catch(e){throw nM(e)}e&&(t.Authorization=`Bearer ${e}`),this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=aT(this._requestInit?.headers);return new Headers({...t,...r})}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!eN.safeParse(t).success)return;let r=t.params?._meta?.[f];if("string"!=typeof r)return;e.set("mcp-protocol-version",r),e.set("mcp-method",t.method);let o=t.params,a="resources/read"===t.method?"string"==typeof o?.uri?o.uri:void 0:"string"==typeof o?.name?o.name:void 0;void 0!==a&&e.set("mcp-name",o8(a))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!eN.safeParse(e).success)return!1;let t=e.params?._meta?.[f];return"string"==typeof t&&t>=r3}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:a}=e,s=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0;try{let s=await this._commonHeaders(),i=[...s.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"text/event-stream"];s.set("accept",[...new Set(i)].join(", ")),o&&s.set("last-event-id",o);let n=this._abortController?.signal,l=void 0!==a&&void 0!==n?n2(n,a):a??n,c=await (this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:s,signal:l});if(!c.ok){if(401===c.status&&this._authProvider){if(c.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=nv(c);this._resourceMetadataUrl=e,this._scope=nl(this._scope,t)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:c,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw nM(e)}return await c.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}if(await c.text?.().catch(()=>{}),t)throw nM(new r5(r9.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:c.statusText}));throw nM(new ns)}if(403===c.status){let{resourceMetadataUrl:o,scope:a,error:s,errorDescription:i}=nv(c);if("insufficient_scope"===s){let s=await c.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:a,resourceMetadataUrl:o,errorDescription:i,statusText:c.statusText,text:s},r)!=="AUTHORIZED")throw nM(new ns);return this._startOrAuthSse(e,t,r+1)}}if(await c.text?.().catch(()=>{}),405===c.status)return void e.onRequestStreamEnd?.();throw new r5(r9.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${c.statusText}`,{status:c.status,statusText:c.statusText})}this._handleSseStream(c.body,e,!0)}catch(e){throw s()||this.onerror?.(e),e}}_getNextReconnectionDelay(e){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),a=()=>{this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted||this._startOrAuthSse(e).catch(r=>{if(!(this._abortController?.signal.aborted||e.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`));try{this._scheduleReconnection(e,t+1)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}})};if(this._reconnectionScheduler){let e=this._reconnectionScheduler(a,o,t);this._cancelReconnection="function"==typeof e?e:void 0}else{let e=setTimeout(a,o);this._cancelReconnection=()=>clearTimeout(e)}}_handleSseStream(e,t,r){let o;if(!e)return void t.onRequestStreamEnd?.();let{onresumptiontoken:a,replayMessageId:s,requestSignal:i,onRequestStreamEnd:n}=t,l=()=>this._abortController?.signal.aborted===!0||i?.aborted===!0,c=!1,u=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new i9({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:r}=await t.read();if(r)break;if((e.id&&(o=e.id,c=!0,a?.(e.id)),e.data)&&(!e.event||"message"===e.event))try{let t=e$.parse(JSON.parse(e.data));(oX(t)||oQ(t))&&(u=!0,void 0!==s&&(t.id=s)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||c)&&!u&&this._abortController&&!l()?this._scheduleReconnection({resumptionToken:o,onresumptiontoken:a,replayMessageId:s,requestSignal:i,onRequestStreamEnd:n},0):l()||n?.()}catch(e){if(l())return;if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(r||c)&&!u&&this._abortController&&!l())try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:a,replayMessageId:s,requestSignal:i,onRequestStreamEnd:n},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`)),n?.()}else n?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new ns("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await nc(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await nm(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new ns("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let{resumptionToken:a,onresumptiontoken:s}=t||{};if(a)return void this._startOrAuthSse({resumptionToken:a,replayMessageId:eN.safeParse(e).success?e.id:void 0,requestSignal:t?.requestSignal}).catch(e=>this.onerror?.(e));let i=await this._commonHeaders();this._applyBodyDerivedHeaders(i,e);let n=Array.isArray(e)?e.some(e=>u.safeParse(e).success):u.safeParse(e).success;if(n&&i.delete("mcp-session-id"),t?.headers!==void 0)for(let[e,r]of Object.entries(t.headers))n1.has(e.toLowerCase())||i.set(e,r);i.set("content-type","application/json");let l=[...i.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"application/json","text/event-stream"];i.set("accept",[...new Set(l)].join(", "));let c=this._abortController?.signal,d=t?.requestSignal!==void 0&&void 0!==c?n2(c,t.requestSignal):t?.requestSignal??c,h={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:d},p=await (this._fetch??fetch)(this._url,h);if(n&&p.ok&&(this._sessionId=p.headers.get("mcp-session-id")||void 0),!p.ok){if(401===p.status&&this._authProvider){if(p.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=nv(p);this._resourceMetadataUrl=e,this._scope=nl(this._scope,t)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:p,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw nM(e)}return await p.text?.().catch(()=>{}),this._send(e,t,!0,o)}if(await p.text?.().catch(()=>{}),r)throw nM(new r5(r9.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:p.statusText}));throw nM(new ns)}let a=await p.text?.().catch(()=>null);if(403===p.status){let{resourceMetadataUrl:s,scope:i,error:n,errorDescription:l}=nv(p);if("insufficient_scope"===n){if(await this._stepUpAuthorize({scope:i,resourceMetadataUrl:s,errorDescription:l,statusText:p.statusText,text:a},o)!=="AUTHORIZED")throw nM(new ns);return this._send(e,t,r,o+1)}}if(400===p.status&&"string"==typeof a&&this._isModernEnvelopedRequest(e))try{let t=e$.parse(JSON.parse(a)),r=(Array.isArray(e)?e:[e]).filter(e=>eN.safeParse(e).success);if(oQ(t)&&r.some(e=>e.id===t.id))return void this.onmessage?.(t)}catch{}throw new r5(r9.ClientHttpNotImplemented,`Error POSTing to endpoint: ${a}`,{status:p.status,statusText:p.statusText,text:a})}if(202===p.status){await p.text?.().catch(()=>{}),eY.safeParse(e).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let m=(Array.isArray(e)?e:[e]).some(e=>"method"in e&&"id"in e&&void 0!==e.id),f=p.headers.get("content-type"),y=function(e){if(e)try{return aC.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(""===t||e.slice(t.length).includes(","))return;return t}}(f);if(m)if("text/event-stream"===y)this._handleSseStream(p.body,{onresumptiontoken:s,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if("application/json"===y){let e=await p.json();for(let t of Array.isArray(e)?e.map(e=>e$.parse(e)):[e$.parse(e)])this.onmessage?.(t)}else throw await p.text?.().catch(()=>{}),new r4(r9.ClientHttpUnexpectedContent,`Unexpected content type: ${f}`,{contentType:f});else await p.text?.().catch(()=>{})}catch(e){throw t?.requestSignal?.aborted!==!0&&this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await (this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&405!==r.status)throw new r5(r9.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};let n4=["application/json","text/event-stream"];function n5(e){let t=lo(e.tool_name);if(!t)throw Error("MCP 工具名称为空");return{name:t,arguments:la(e.arguments)??la(rA(lo(e.arguments_json)))??{}}}function n3(e){var t;let r=function(e){if(!rL(e))return e;let{_response_meta:t,...r}=e;return r}(e);if(!r||"object"!=typeof r){let e=String(r??"");return{content:e,raw_result_text:e,raw_mcp_result_json:e}}if("string"==typeof r.content||"raw_mcp_result_json"in r||"raw_result_text"in r||"structured"in r){let e="string"==typeof r.content?r.content:JSON.stringify(r.content??""),t=r.raw_mcp_result_json||r.raw_result_text||e;return{...r,content:e,raw_result_text:r.raw_result_text||t,raw_mcp_result_json:r.raw_mcp_result_json||t,structured:r.structured??r.structuredContent,is_error:r.is_error??r.isError}}let o=JSON.stringify(r);return{content:o,structured:r.structuredContent,raw_result_text:o,raw_mcp_result_json:o,is_error:!0===r.isError,miniapp:(t=r,Array.isArray(t?.content)&&t?.structuredContent&&"object"==typeof t.structuredContent)?{is_mini_app:!0,mcp_channel:"flow_miniapp"}:void 0}}function n6(e){let t=new URL(e);return("/"===t.pathname||""===t.pathname)&&(t.pathname="/mcp"),t.toString()}function n7(e){return new URL(e).pathname.replace(/\/+$/,"").toLowerCase().endsWith("/sse")}function n8(e){let t=new URL(e);return`${t.hostname}_${t.port||t.protocol.replace(":","")}${t.pathname.replace(/[^A-Za-z0-9_-]/g,"_")}`}function le(e){let t=rL(e)?e.id:null;return"string"==typeof t||"number"==typeof t&&Number.isFinite(t)?t:null}function lt(e){return rM(e,"method")}function lr(e){let t=rL(e)?e.params:void 0;return rM(t,"name")??rM(t,"uri")}function lo(e){return"string"==typeof e?e:""}function la(e){return rL(e)?e:void 0}function ls(e){let t=e instanceof Error&&e.name?e.name:"MCPRequestError";if(e instanceof r5)return`${t},HTTP ${e.data.status}`;if(e instanceof oP)return`${t},错误码 ${e.code}`;let r=e instanceof Error?e.message:String(e),o=r.match(/\bHTTP\s+(\d{3})\b/i)?.[1],a=r.match(/错误码\s+(-?\d+)/)?.[1];return o?`${t},HTTP ${o}`:a?`${t},错误码 ${a}`:t}let li=l("node:async_hooks"),ln=(rU={type:"object"},n=((void 0)??(i??=new id)).getValidator(rU),{"~standard":{version:1,vendor:"mcp",jsonSchema:{input:()=>rU,output:()=>rU},validate:e=>{let t=n(e);return t.valid?{value:t.data}:{issues:[{message:t.errorMessage}]}}}});class ll{url;options;protocol;transport;lifetime=new AbortController;requests=new li.AsyncLocalStorage;client;ready;constructor(e,t={}){this.url=e,this.options=t,this.protocol=t.protocol??(n7(e)?"sse":"streamable");let r={requestInit:{headers:t.headers},fetch:this.fetch.bind(this)};this.transport="sse"===this.protocol?new nY(new URL(e),r):new n9(new URL(e),{...r,sessionId:t.sessionID,protocolVersion:t.protocolVersion}),"sse"===this.protocol&&(this.transport.onerror=e=>{(e instanceof nQ||e instanceof SyntaxError||"ZodError"===e.name)&&this.close()})}get sessionID(){return this.transport instanceof n9?this.transport.sessionId:void 0}get protocolVersion(){return this.transport instanceof n9?this.transport.protocolVersion:"2024-11-05"}async initialize(e){try{return await this.connect(e),await this.listTools()}catch(e){throw this.close(),e}}connect(e={name:"dbx-cli",version:"0.1.0"},t={}){return this.client??=new nX(e,{supportedProtocolVersions:"sse"===this.protocol?["2024-11-05"]:["2025-11-25","2025-06-18","2025-03-26","2024-11-05"]}),this.ready??=this.run(t,e=>this.client.connect(this.transport,e)).catch(e=>{throw this.close(),e})}async listTools(){return await this.connect(),(await this.run({},e=>this.client.listTools({},e))).tools}async callTool(e,t={}){return await this.connect(),this.run(t,t=>this.client.request({method:"tools/call",params:e},ln,t)).catch(e=>{if(t.signal?.throwIfAborted(),this.lifetime.signal.throwIfAborted(),e instanceof Error&&"TimeoutError"===e.name)throw e;throw Error(`MCP 请求失败(${ls(e)})`)})}async forward(e,t={}){if("streamable"===this.protocol)return this.run(t,async({signal:r})=>{var o;let a,s,i,n,l,c=await fetch(this.url,{method:"POST",headers:((a=new Headers((o={sessionID:this.sessionID,protocolVersion:this.protocolVersion,headers:{...this.options.headers,...t.headers}}).headers)).set("Content-Type","application/json"),i=new Set((s=(a.get("Accept")??"").split(",").map(e=>e.trim()).filter(Boolean)).map(e=>e.split(";")[0].trim().toLowerCase())),a.set("Accept",[...s,...n4.filter(e=>!i.has(e))].join(", ")),(n=lt(e))&&a.set("Mcp-Method",n),(l=lr(e))&&a.set("Mcp-Name",l),o.protocolVersion&&a.set("MCP-Protocol-Version",o.protocolVersion),o.sessionID&&a.set("Mcp-Session-Id",o.sessionID),a),body:JSON.stringify(e),signal:r}),u=await c.text();return{status:c.status,headers:c.headers,body:u?function(e,t,r){if(t?.toLowerCase().includes("text/event-stream")){var o;let t,a=(o=e,t=[],iS({onEvent({data:e}){e.trim()&&"[DONE]"!==e.trim()&&t.push(JSON.parse(e))}}).feed(`${o}
12
+ `&&o++}}return[t,r]}(`${s}${t}`);for(let e of r)u(e);s=o,i=!1},reset:function(e={}){s&&e.consume&&u(s),i=!0,n=void 0,l="",c="",s=""}}}class ib extends Event{constructor(e,t){var r,o;super(e),this.code=null!=(r=null==t?void 0:t.code)?r:void 0,this.message=null!=(o=null==t?void 0:t.message)?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,r){return r(i$(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(i$(this),t)}}function i$(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var iw,iR,iP,iE,iC,iT,ik,iI,ix,ij,iO,iN,iq,iM,iA,iL,iV,iU,iz,iD,iH,iF,iG,iK,iW,iJ,iB,iZ=e=>{throw TypeError(e)},iX=(e,t,r)=>t.has(e)||iZ("Cannot "+r),iQ=(e,t,r)=>(iX(e,t,"read from private field"),r?r.call(e):t.get(e)),iY=(e,t,r)=>t.has(e)?iZ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),i0=(e,t,r,o)=>(iX(e,t,"write to private field"),t.set(e,r),r),i1=(e,t,r)=>(iX(e,t,"access private method"),r);class i2 extends EventTarget{constructor(e,t){var r,o,a;super(),iY(this,iU),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,iY(this,iC),iY(this,iT),iY(this,ik),iY(this,iI),iY(this,ix),iY(this,ij),iY(this,iO),iY(this,iN,null),iY(this,iq),iY(this,iM),iY(this,iA,null),iY(this,iL,null),iY(this,iV,null),iY(this,iD,async e=>{var t;iQ(this,iM).reset();let{body:r,redirected:o,status:a,headers:s}=e;if(204===a){i1(this,iU,iW).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(o?i0(this,ik,new URL(e.url)):i0(this,ik,void 0),200!==a)return void i1(this,iU,iW).call(this,`Non-200 status code (${a})`,a);if(!(s.get("content-type")||"").startsWith("text/event-stream"))return void i1(this,iU,iW).call(this,'Invalid content type, expected "text/event-stream"',a);if(iQ(this,iC)===this.CLOSED)return;i0(this,iC,this.OPEN);let i=new Event("open");if(null==(t=iQ(this,iV))||t.call(this,i),this.dispatchEvent(i),"object"!=typeof r||!r||!("getReader"in r)){i1(this,iU,iW).call(this,"Invalid response body, expected a web ReadableStream",a),this.close();return}let n=new TextDecoder,l=r.getReader(),c=!0;do{let{done:e,value:t}=await l.read();t&&iQ(this,iM).feed(n.decode(t,{stream:!e})),e&&(c=!1,iQ(this,iM).reset(),i1(this,iU,iJ).call(this))}while(c)}),iY(this,iH,e=>{i0(this,iq,void 0),"AbortError"!==e.name&&"aborted"!==e.type&&i1(this,iU,iJ).call(this,function e(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(e).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${e(t.cause)}`:t.message:`${t}`}(e))}),iY(this,iG,e=>{"string"==typeof e.id&&i0(this,iN,e.id);let t=new MessageEvent(e.event||"message",{data:e.data,origin:iQ(this,ik)?iQ(this,ik).origin:iQ(this,iT).origin,lastEventId:e.id||""});iQ(this,iL)&&(!e.event||"message"===e.event)&&iQ(this,iL).call(this,t),this.dispatchEvent(t)}),iY(this,iK,e=>{i0(this,ij,e)}),iY(this,iB,()=>{i0(this,iO,void 0),iQ(this,iC)===this.CONNECTING&&i1(this,iU,iz).call(this)});try{if(e instanceof URL)i0(this,iT,e);else if("string"==typeof e){let t;i0(this,iT,new URL(e,(t="document"in globalThis?globalThis.document:void 0)&&"object"==typeof t&&"baseURI"in t&&"string"==typeof t.baseURI?t.baseURI:void 0))}else throw Error("Invalid URL")}catch{let e;throw a="An invalid or illegal string was specified","function"==typeof(e=globalThis.DOMException)?new e(a,"SyntaxError"):SyntaxError(a)}i0(this,iM,iS({onEvent:iQ(this,iG),onRetry:iQ(this,iK)})),i0(this,iC,this.CONNECTING),i0(this,ij,3e3),i0(this,ix,null!=(r=null==t?void 0:t.fetch)?r:globalThis.fetch),i0(this,iI,null!=(o=null==t?void 0:t.withCredentials)&&o),i1(this,iU,iz).call(this)}get readyState(){return iQ(this,iC)}get url(){return iQ(this,iT).href}get withCredentials(){return iQ(this,iI)}get onerror(){return iQ(this,iA)}set onerror(e){i0(this,iA,e)}get onmessage(){return iQ(this,iL)}set onmessage(e){i0(this,iL,e)}get onopen(){return iQ(this,iV)}set onopen(e){i0(this,iV,e)}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}close(){iQ(this,iO)&&clearTimeout(iQ(this,iO)),iQ(this,iC)!==this.CLOSED&&(iQ(this,iq)&&iQ(this,iq).abort(),i0(this,iC,this.CLOSED),i0(this,iq,void 0))}}iC=new WeakMap,iT=new WeakMap,ik=new WeakMap,iI=new WeakMap,ix=new WeakMap,ij=new WeakMap,iO=new WeakMap,iN=new WeakMap,iq=new WeakMap,iM=new WeakMap,iA=new WeakMap,iL=new WeakMap,iV=new WeakMap,iU=new WeakSet,iz=function(){i0(this,iC,this.CONNECTING),i0(this,iq,new AbortController),iQ(this,ix)(iQ(this,iT),i1(this,iU,iF).call(this)).then(iQ(this,iD)).catch(iQ(this,iH))},iD=new WeakMap,iH=new WeakMap,iF=function(){var e;let t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...iQ(this,iN)?{"Last-Event-ID":iQ(this,iN)}:void 0},cache:"no-store",signal:null==(e=iQ(this,iq))?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},iG=new WeakMap,iK=new WeakMap,iW=function(e,t){var r;iQ(this,iC)!==this.CLOSED&&i0(this,iC,this.CLOSED);let o=new ib("error",{code:t,message:e});null==(r=iQ(this,iA))||r.call(this,o),this.dispatchEvent(o)},iJ=function(e,t){var r;if(iQ(this,iC)===this.CLOSED)return;i0(this,iC,this.CONNECTING);let o=new ib("error",{code:t,message:e});null==(r=iQ(this,iA))||r.call(this,o),this.dispatchEvent(o),i0(this,iO,setTimeout(iQ(this,iB),iQ(this,ij)))},iB=new WeakMap,i2.CONNECTING=0,i2.OPEN=1,i2.CLOSED=2;class i9 extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let o;super({start(a){o=iS({onEvent:e=>{a.enqueue(e)},onError(t){"terminate"===e?a.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){o.feed(e)}})}}var i4=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e){super(e),this.name=new.target.name,rY(this,new.target)}},i5=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${"metadata"===e?"authorization server metadata (RFC 8414 \xa73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`),this.kind=e,this.expected=t,this.received=r}},i3=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},i6=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},i7=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},i8=class extends i4{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function ne(e,t,r){if(void 0!==e)return void 0===e.issuer?(r?.canPersistStamp!==!1&&console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field."),e):nt(e.issuer,t)?e:void 0}function nt(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}function nr(e){return null!=e&&"function"==typeof e.tokens&&"function"==typeof e.clientInformation}async function no(e,t,r){let{resourceMetadataUrl:o,scope:a}=nv(t.response);if(await nm(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:a,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new ns}function na(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async r=>no(e,r,t)}}var ns=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",rY(this,new.target)}};function ni(e){return e?.authorization_response_iss_parameter_supported===!0}function nn({iss:e,expectedIssuer:t,issParameterSupported:r}){if(void 0!==t){if(void 0===e){if(r)throw new i5("authorization_response",t,void 0);return}if(e!==t)throw new i5("authorization_response",t,e)}}function nl(...e){let t=new Set;for(let r of e)if(r)for(let e of r.split(/\s+/))e&&t.add(e);return t.size>0?[...t].join(" "):void 0}async function nc(e,t,r,o,a){if("string"==typeof e)return{authorizationCode:e,iss:t};let s=e.get("iss")??void 0,i=e.get("code");if(i)return{authorizationCode:i,iss:s};let n=(await r.discoveryState?.())?.authorizationServerMetadata;if(!n)try{n=(await nR(o,a)).authorizationServerMetadata}catch{n=void 0}if(!n)throw new ns("Authorization callback failed and the issuer could not be verified");nn({iss:s,expectedIssuer:n.issuer,issParameterSupported:ni(n)});let l=e.get("error");if(l)throw new r2(l,e.get("error_description")??l,e.get("error_uri")??void 0);throw new ns("Authorization callback contained neither `code` nor `error`")}let nu="code",nd="S256";function nh(e){return"localhost"===e||"127.0.0.1"===e||"[::1]"===e||"::1"===e}async function np(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let e=A.parse(JSON.parse(r));return r2.fromResponse(e)}catch(o){let e=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new r2(r1.ServerError,e)}}async function nm(e,t){try{return await nf(e,t)}catch(r){if(r instanceof r2){if(r.code===r1.InvalidClient||r.code===r1.UnauthorizedClient)return await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await nf(e,t);else if(r.code===r1.InvalidGrant)return await e.invalidateCredentials?.("tokens"),await nf(e,t)}throw r}}async function nf(e,{serverUrl:t,authorizationCode:r,iss:o,scope:a,resourceMetadataUrl:s,fetchFn:i,skipIssuerMetadataValidation:n,forceReauthorization:l}){let c,u,d,h,p,m={...p=e.clientMetadata,grant_types:p.grant_types??(void 0===e.redirectUrl?void 0:["authorization_code","refresh_token"]),application_type:p.application_type??function(e){for(let t of e??[]){let e;try{e=new URL(t)}catch{continue}if("http:"!==e.protocol&&"https:"!==e.protocol||nh(e.hostname))return"native"}return"web"}(p.redirect_uris)},f=await e.discoveryState?.(),y=s;if(!y&&f?.resourceMetadataUrl&&(y=new URL(f.resourceMetadataUrl)),f?.authorizationServerUrl){if(u=f.authorizationServerUrl,c=f.resourceMetadata,d=f.authorizationServerMetadata??await nw(u,{fetchFn:i,skipIssuerValidation:n}),!c)try{c=await n_(t,{resourceMetadataUrl:y},i)}catch(e){if(e instanceof TypeError)throw e}(d!==f.authorizationServerMetadata||c!==f.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:y?.toString(),resourceMetadata:c,authorizationServerMetadata:d})}else{let e=await nR(t,{resourceMetadataUrl:y,fetchFn:i,skipIssuerMetadataValidation:n});u=e.authorizationServerUrl,d=e.authorizationServerMetadata,c=e.resourceMetadata,h={authorizationServerUrl:String(u),resourceMetadataUrl:y?.toString(),resourceMetadata:c,authorizationServerMetadata:d}}let v=d?.issuer??String(u),g={issuer:v};if(await e.saveAuthorizationServerUrl?.(v),void 0!==r){let t=f?.authorizationServerMetadata?.issuer??f?.authorizationServerUrl;if(void 0===t){if(void 0!==e.saveDiscoveryState)throw new i7("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",v);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md \xa7SEP-2352.")}else if(!nt(t,v))throw new i7(t,v)}h&&await e.saveDiscoveryState?.(h);let _=await ny(t,e,c);_&&await e.saveResourceUrl?.(String(_));let S=function(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:a}=e,s=t||r?.scopes_supported?.join(" ")||a.scope;return s&&o?.scopes_supported?.includes("offline_access")&&!s.split(" ").includes("offline_access")&&a.grant_types?.includes("refresh_token")&&(s=`${s} offline_access`),s}({requestedScope:a,resourceMetadata:c,authServerMetadata:d,clientMetadata:e.clientMetadata}),b=await Promise.resolve(e.clientInformation(g)),$=ne(b,v,{canPersistStamp:void 0!==e.saveClientInformation});if(void 0===$&&b?.issuer&&void 0===e.saveClientInformation)throw new i7(b.issuer,v);if($&&void 0===$.issuer&&($={...$,issuer:v},await e.saveClientInformation?.($,g)),!$){if(void 0!==r)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=d?.client_id_metadata_document_supported===!0,o=e.clientMetadataUrl;if(o&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(o))throw new r2(r1.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${o}`);if(t&&o)$={client_id:o,issuer:v},await e.saveClientInformation?.($,g);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");$={...await nk(u,{metadata:d,clientMetadata:m,scope:S,fetchFn:i}),issuer:v},await e.saveClientInformation($,g)}}let w=!e.redirectUrl;if(void 0!==r||w){void 0!==r&&nn({iss:o,expectedIssuer:d?.issuer,issParameterSupported:ni(d)});let t=await nT(e,u,{metadata:d,resource:_,authorizationCode:r,iss:o,scope:S,fetchFn:i});return await e.saveTokens({...t,issuer:v},g),"AUTHORIZED"}let R=ne(await e.tokens(g),v);if(R&&void 0===R.issuer&&(R={...R,issuer:v},await e.saveTokens(R,g)),R?.refresh_token&&!l)try{let t=await nC(u,{metadata:d,clientInformation:$,refreshToken:R.refresh_token,resource:_,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens({...t,issuer:v},g),"AUTHORIZED"}catch(e){if(e instanceof i6||e instanceof r2&&e.code!==r1.ServerError)throw e}let P=e.state?await e.state():void 0,{authorizationUrl:E,codeVerifier:C}=await nP(u,{metadata:d,clientInformation:$,state:P,redirectUrl:e.redirectUrl,scope:S,resource:_});return await e.saveCodeVerifier(C),await e.redirectToAuthorization(E),"REDIRECT"}async function ny(e,t,r){let o,a=((o=new URL("string"==typeof e?e:e.href)).hash="",o);if(t.validateResourceURL)return await t.validateResourceURL(a,r?.resource);if(r){if(!function({requestedResource:e,configuredResource:t}){let r=new URL("string"==typeof e?e:e.href),o=new URL("string"==typeof t?t:t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let a=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return a.startsWith(s)}({requestedResource:a,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${a} (or origin)`);return new URL(r.resource)}}function nv(e){let t,r=e.headers.get("WWW-Authenticate");if(!r)return{};let[o,a]=r.split(" ");if(o?.toLowerCase()!=="bearer"||!a)return{};let s=ng(e,"resource_metadata")||void 0;if(s)try{t=new URL(s)}catch{}let i=ng(e,"scope")||void 0;return{resourceMetadataUrl:t,scope:i,error:ng(e,"error")||void 0,errorDescription:ng(e,"error_description")||void 0}}function ng(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),a=r.match(o);if(a){let e=a[1]||a[2];if(e)return e}return null}async function n_(e,t,r=fetch){let o=await n$(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||404===o.status)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return r$.parse(await o.json())}async function nS(e,t,r=fetch){try{return await r(e,{headers:t})}catch(e){throw e}}async function nb(e,t,r=fetch){return await nS(e,{"MCP-Protocol-Version":t},r)}async function n$(e,t,r,o){var a,s;let i,n=new URL(e),l=o?.protocolVersion??rc;o?.metadataUrl?i=new URL(o.metadataUrl):(i=new URL(function(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,n.pathname),o?.metadataServerUrl??n)).search=n.search;let c=await nb(i,l,r);return!o?.metadataUrl&&(a=c,s=n.pathname,!a||"/"!==s&&(a.status>=400&&a.status<500||502===a.status))&&(c=await nb(new URL(`/.well-known/${t}`,n),l,r)),c}async function nw(e,{fetchFn:t=fetch,protocolVersion:r=rc,skipIssuerValidation:o=!1}={}){let a={"MCP-Protocol-Version":r,Accept:"application/json"};for(let{url:r,type:s}of function(e){let t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"},{url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}(e)){let i=await nS(r,a,t);if(!i)continue;if(!i.ok){if(await i.text?.().catch(()=>{}),i.status>=400&&i.status<500||502===i.status)continue;throw Error(`HTTP ${i.status} trying to load ${"oauth"===s?"OAuth":"OpenID provider"} metadata from ${r}`)}let n="oauth"===s?rn.parse(await i.json()):$.parse(await i.json());if(!o){let t="string"==typeof e?e:e.href;if(!(n.issuer===t||t.endsWith("/")&&n.issuer===t.slice(0,-1)))throw new i5("metadata",t,n.issuer)}return n}}async function nR(e,t){let r,o;try{(r=await n_(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn)).authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch(e){if(e instanceof TypeError)throw e}o||(o=String(new URL("/",e)));let a=await nw(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:a,resourceMetadata:r}}async function nP(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:a,state:s,resource:i}){let n;if(t){if(n=new URL(t.authorization_endpoint),!t.response_types_supported.includes(nu))throw Error(`Incompatible auth server: does not support response type ${nu}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(nd))throw Error(`Incompatible auth server: does not support code challenge method ${nd}`)}else n=new URL("/authorize",e);let l=await iv(),c=l.code_verifier,u=l.code_challenge;return n.searchParams.set("response_type",nu),n.searchParams.set("client_id",r.client_id),n.searchParams.set("code_challenge",u),n.searchParams.set("code_challenge_method",nd),n.searchParams.set("redirect_uri",String(o)),s&&n.searchParams.set("state",s),a&&n.searchParams.set("scope",a),a?.split(" ").includes("offline_access")&&n.searchParams.append("prompt","consent"),i&&n.searchParams.set("resource",i.href),{authorizationUrl:n,codeVerifier:c}}async function nE(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:a,resource:s,fetchFn:i}){var n,l;let c,u=function(e){let t=new URL(String(e));if("https:"!==t.protocol&&!nh(t.hostname))throw new i6(t.href);return t}(t?.token_endpoint??new URL("/token",e)),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});s&&r.set("resource",s.href),a?await a(d,r,u,t):o&&function(e,t,r,o){let{client_id:a,client_secret:s}=t;switch(e){case"client_secret_basic":var i,n,l,c,u=a,d=s,h=r;if(!d)throw Error("client_secret_basic authentication requires a client_secret");let p=btoa(`${u}:${d}`);h.set("Authorization",`Basic ${p}`);return;case"client_secret_post":i=a,n=s,(l=o).set("client_id",i),n&&l.set("client_secret",n);return;case"none":c=a,o.set("client_id",c);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((n=o,l=t?.token_endpoint_auth_methods_supported??[],c=void 0!==n.client_secret,"token_endpoint_auth_method"in n&&n.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(n.token_endpoint_auth_method)&&(0===l.length||l.includes(n.token_endpoint_auth_method))?n.token_endpoint_auth_method:0===l.length?c?"client_secret_basic":"none":c&&l.includes("client_secret_basic")?"client_secret_basic":c&&l.includes("client_secret_post")?"client_secret_post":l.includes("none")?"none":c?"client_secret_post":"none"),o,d,r);let h=await (i??fetch)(u,{method:"POST",headers:d,body:r});if(!h.ok)throw await np(h);let p=await h.json();try{return rk.parse(p)}catch(e){if("object"==typeof p&&null!==p&&"error"in p)throw await np(JSON.stringify(p));throw e}}async function nC(e,{metadata:t,clientInformation:r,refreshToken:o,resource:a,addClientAuthentication:s,fetchFn:i}){return{refresh_token:o,...await nE(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),clientInformation:r,addClientAuthentication:s,resource:a,fetchFn:i})}}async function nT(e,t,{metadata:r,resource:o,authorizationCode:a,iss:s,scope:i,fetchFn:n}={}){let l;void 0!==a&&nn({iss:s,expectedIssuer:r?.issuer,issParameterSupported:ni(r)});let c=i??e.clientMetadata.scope;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){if(!a)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");l=new URLSearchParams({grant_type:"authorization_code",code:a,code_verifier:await e.codeVerifier(),redirect_uri:String(e.redirectUrl)})}let u=await e.clientInformation({issuer:r?.issuer??String(t)});return nE(t,{metadata:r,tokenRequestParams:l,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:n})}async function nk(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:a}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i={...r,...void 0===o?{}:{scope:o}},n=await (a??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok)throw new i3({status:n.status,body:await n.text(),submittedMetadata:i});return ec.parse(await n.json())}let nI=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);var nx=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(nj(e))}set(e,t){let r=nj(e),o=nI.has(e.method),a=!this._entries.has(r);if(!o&&a&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let e of this._entries.keys())if(!nI.has(e.slice(0,e.indexOf("\0")))){this._entries.delete(e),this._cappedSize--;break}}let s=++this._stamp;return this._entries.set(r,{...t,stamp:s}),a&&!o&&this._cappedSize++,s}delete(e){this._entries.delete(nj(e))&&!nI.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,r=nI.has(e);for(let e of this._entries.keys())e.startsWith(t)&&(this._entries.delete(e),!r&&this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function nj(e){return`${e.method}\0${JSON.stringify([e.partition??"",e.params??""])}`}function nO(e,t){return void 0===t?e:`${e}\0${t}`}var nN=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",a=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=a}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,"public"===e?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),a=await this._store.get({...r,partition:o});if(void 0!==a)return a;let s=this._partitionFor("public");if(s===o)return;let i=await this._store.get({...r,partition:s});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(e){this._reportError(e)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(e){this._reportError(e)}}async evictKey(e,t){let r=nO(e,t),o=this._evictionGeneration.get(r);void 0!==o&&this._evictionGeneration.set(r,o+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let r=nO(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(nO(e,o?.params))??0)!==r)return;let a=o?.params??"",s=this._partitionFor("private"),i=this._partitionFor("public"),n=(o?.scope??"private")==="public"?i:s;try{await this._store.set({method:e,params:a,partition:n},{value:function(e){let t;try{t=JSON.stringify(e)}catch(e){throw TypeError(`cache value is not JSON-serializable: ${e instanceof Error?e.message:String(e)}`)}if("string"!=typeof t)throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(e){this._reportError(e)}if(i!==s)try{await this._store.delete({method:e,params:a,partition:n===s?i:s})}catch(e){this._reportError(e)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt!==void 0&&r.expiresAt>this.now())try{let e=JSON.parse(r.value);if("object"!=typeof e||null===e||Array.isArray(e))throw TypeError("cached document is not an object");return{value:e}}catch(r){this._reportError(r),await this._deleteBoth(e,t??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(void 0===t){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let e=this._decodeListTools(t),r=new Map;if(void 0!==e)for(let t of e.tools)r.set(t.name,t);this._toolIndex={stamp:t.stamp,byName:r}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(void 0===r){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let e=this._decodeListTools(r)??{tools:[]},o=new Map;for(let r of e.tools){let e=t(r);void 0!==e&&o.set(r.name,e)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:o}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(e=>null!==e&&"object"==typeof e))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(e){this._reportError(e);return}}};let nq=Symbol.for("mcp.authSeamEscape");function nM(e){if("object"==typeof e&&null!==e||"function"==typeof e)try{Object.defineProperty(e,nq,{value:!0,configurable:!0})}catch{}return e}let nA=new Set([-32001,-32020,-32021]);function nL(e,t){let{code:r,message:o,data:a}=e;if(-32022===r){let e=function(e){if("object"!=typeof e||null===e)return;let t=e.supported;if(Array.isArray(t)&&0!==t.length&&t.every(e=>"string"==typeof e))return t}(a);if(void 0===e)return{kind:"legacy"};let r=new oT({supported:e,requested:function(e){if("object"!=typeof e||null===e)return;let t=e.requested;return"string"==typeof t?t:void 0}(a)??t.requestedVersion},o),s=r8(e),i=t.clientModernVersions.find(e=>s.includes(e));return void 0!==i?{kind:"corrective",version:i,error:r}:s.length>0?{kind:"error",error:r}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:r}}return nA.has(r),{kind:"legacy"}}function nV(e,t){var r,o;return"browser"===t.environment&&((r=e)instanceof TypeError||r instanceof Error&&"TypeError"===r.name)?{kind:"legacy"}:{kind:"error",error:new r4(r9.EraNegotiationFailed,`Version negotiation probe failed: ${(o=e)instanceof Error?o.message:String(o)}`,{cause:e})}}function nU(){let e=globalThis;return void 0!==e.window&&void 0!==e.document?"browser":"node"}function nz(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var nD=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(e){this._transport=e,this._savedOnMessage=e.onmessage,this._savedOnError=e.onerror,this._savedOnClose=e.onclose}static async open(t){let r=new e(t);t.onmessage=e=>{let t=r._pending;if(void 0!==t&&(oX(e)||oQ(e))&&e.id===t.id){r._pending=void 0,oX(e)?t.resolve({kind:"response",result:e.result}):t.resolve({kind:"response",error:e.error});return}},t.onerror=e=>{r._savedOnError?.(e)},t.onclose=()=>{let e=r._pending;void 0!==e&&(r._pending=void 0,e.resolve({kind:"closed"})),r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(e){throw r.detach(),e}return r}async exchange(e,t){let r=`server-discover-probe-${++this._probeCounter}`;return new Promise(o=>{let a=!1,s=e=>{a||(a=!0,clearTimeout(i),this._pending?.id===r&&(this._pending=void 0),o(e))},i=setTimeout(()=>s({kind:"timeout"}),t);this._pending={id:r,resolve:s},this._transport.send(e(r)).catch(e=>s({kind:"send-error",error:e}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&void 0!==this._savedOnClose){let e=this._savedOnClose,t=this._transport,r=!1,o=()=>{if(!r){r=!0;return}e()};t.onclose=o,nH.set(t,()=>{t.onclose===o&&(t.onclose=e)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let e=this._transport,t=e.start,r=!0;e.start=async function(){if(r){r=!1,e.start=t;return}return t.call(e)}}};let nH=new WeakMap;function nF(e){let t=nH.get(e);nH.delete(e),t?.()}async function nG(e,t){let r,o=e.probe.timeoutMs??t.defaultTimeoutMs,a=Math.max(0,e.probe.maxRetries??0),s="pin"===e.kind?[e.version]:e.modernVersions,i="auto"===e.kind&&e.fallbackAvailable,n=await nD.open(t.transport),l=async()=>{let r=s[0],l=!1,c=a;for(;;){let a=await n.exchange(e=>{var o,a,s;return o=r,a=t.clientInfo,s=t.capabilities,{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:oG(o).outboundEnvelope({protocolVersion:o,clientInfo:a,clientCapabilities:s})}}},o);if("timeout"===a.kind&&c>0){c--;continue}let u=function(e,t){switch(e.kind){case"response":return void 0===e.error?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let t=e.error;if(("object"==typeof t&&null!==t||"function"==typeof t)&&!0===t[nq]||t instanceof ns||t instanceof Error&&"UnauthorizedError"===t.name)return{kind:"auth-required",error:t};if(t instanceof r5){let e=t.data?.text;return{kind:"http-error",status:t.data.status,body:"string"==typeof e?e:void 0,statusText:t.data.statusText}}return{kind:"network-error",error:t}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}(a,o),d=function(e,t){switch(e.kind){case"result":return function(e,t){let r=oG(oF).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,a=t.clientModernVersions.find(e=>o.includes(e));return void 0!==a?{kind:"modern",version:a,discover:r.value}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new oT({supported:[...o],requested:t.requestedVersion})}}(e.result,t);case"rpc-error":return nL(e,t);case"http-error":return function(e,t){if(401===e.status||403===e.status){let t=403===e.status;return{kind:"error",error:new r5(t?r9.ClientHttpForbidden:r9.ClientHttpAuthentication,`Version negotiation failed: ${t?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new r5(r9.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=function(e){let t;if(void 0===e||""===e)return;try{t=JSON.parse(e)}catch{return}if("object"!=typeof t||null===t)return;let r=t.error;if("object"!=typeof r||null===r)return;let{code:o,message:a,data:s}=r;if("number"==typeof o)return{code:o,message:"string"==typeof a?a:"",data:s}}(e.body);return void 0!==r?nL(r,t):{kind:"legacy"}}(e,t);case"network-error":return nV(e.error,t);case"auth-required":return{kind:"error",error:e.error};case"closed":if("stdio"===t.transportKind)return{kind:"legacy"};return nV(Error("Connection closed during the version negotiation probe"),t);case"timeout":if("stdio"===t.transportKind)return{kind:"legacy"};return{kind:"error",error:new r4(r9.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}(u,{clientModernVersions:s,requestedVersion:r,fallbackAvailable:i,environment:t.environment,transportKind:t.transportKind});switch(d.kind){case"modern":return{era:"modern",version:d.version,discover:d.discover};case"corrective":if(l)throw d.error;l=!0,r=d.version;continue;case"legacy":{let r="closed"===u.kind?"the connection closed during the server/discover probe":void 0;if("pin"===e.kind)throw new r4(r9.EraNegotiationFailed,void 0===r?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${r} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new r4(r9.EraNegotiationFailed,void 0===r?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${r} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(void 0!==r&&!0!==t.disposableProbe)throw new r4(r9.EraNegotiationFailed,`Version negotiation failed: ${r} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw d.error}}};try{r=await l()}catch(e){throw n.detach(),e}return n.release(),r}async function nK(e,t,r,o){let a,s,i=new t.constructor({...r,stderr:"ignore"}),n=t.close,l=!1,c=new Promise((e,t)=>{a=()=>t(nW())});t.close=async function(){return l=!0,a?.(),n.call(t)};try{let t=nG(e,{...o,transport:i,transportKind:"stdio",disposableProbe:!0});t.catch(()=>{}),s=await Promise.race([t,c])}finally{await nJ(i),t.close=n}if(l)throw nW();return s}function nW(){return new r4(r9.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function nJ(e){try{let t=e._dispose;await ("function"==typeof t?t.call(e):e.close())}catch{}}function nB(e){let t=e._meta?.[tz];return ay.Implementation(t)?t:void 0}let nZ={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]};var nX=class extends a${_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new r4(r9.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}for(let e of(this._listenState.clear(),this._listChangedDebounceTimers.values()))clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){var r;super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new id,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=(r=t?.inputRequired,{autoFulfill:r?.autoFulfill??!0,maxRounds:r?.maxRounds??10}),this._cache=new nN(t?.responseCacheStore??new nx,t?.responseCacheStore!==void 0,e=>this._reportStoreError(e),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??64,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){if(void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=r3&&eA.safeParse(e).success)return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?function(e,t,r,o){let{codec:a,request:s,options:i,flowStartedAt:n}=o,l={inputRequests:r.inputRequests,...void 0!==r.requestState&&{requestState:r.requestState}};return ah({config:t,method:s.method,originalParams:s.params,firstPayload:l,flowStartedAt:n,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:{dispatchInputRequest:(t,r,o)=>aE(e,a,t,r,o),retry:(e,t)=>o.retry(e,{...i?.signal!==void 0&&{signal:i.signal},...i?.onprogress!==void 0&&{onprogress:i.onprogress},...i?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:i.resetTimeoutOnProgress},...i?.headers!==void 0&&{headers:i.headers},...void 0!==t.timeout&&{timeout:t.timeout},...void 0!==t.maxTotalTimeout&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0})}})}({getRequestHandler:e=>this._getRequestHandler(e),buildContext:e=>this.buildContext(e,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new r4(r9.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let r={...e};for(let e in t){let o=t[e];if(void 0===o)continue;let a=r[e];r[e]=aw(a)&&aw(o)?{...a,...o}:o}return r}(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){return"elicitation/create"===e?async(e,r)=>{let o=oG(this._negotiatedProtocolVersion),a=o.validateRequest("elicitation/create",e);if(a.ok||"not-in-era"!==a.reason||(a=o.validateInputRequest("elicitation/create",e)),!a.ok)throw new oP("not-in-era"===a.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===a.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${a.message}`);let{params:s}=a.value;s.mode=s.mode??"form";let{supportsFormMode:i,supportsUrlMode:n}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===s.mode&&!i)throw new oP(oR.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===s.mode&&!n)throw new oP(oR.InvalidParams,"Client does not support URL-mode elicitation requests");let l=await t(e,r),c=o.validateResult("elicitation/create",l);if(c.ok||"not-in-era"!==c.reason||(c=o.validateInputResponse("elicitation/create",l)),!c.ok)throw new oP("not-in-era"===c.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===c.reason?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${c.message}`);let u=c.value,d="form"===s.mode?s.requestedSchema:void 0;if("form"===s.mode&&"accept"===u.action&&u.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,r){if(t&&null!==r&&"object"==typeof r){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let o=t.properties;for(let t of Object.keys(o)){let a=o[t];void 0===r[t]&&Object.prototype.hasOwnProperty.call(a,"default")&&(r[t]=a.default),void 0!==r[t]&&e(a,r[t])}}if(Array.isArray(t.anyOf))for(let o of t.anyOf)"boolean"!=typeof o&&e(o,r);if(Array.isArray(t.oneOf))for(let o of t.oneOf)"boolean"!=typeof o&&e(o,r)}}(d,u.content)}catch{}return u}:"sampling/createMessage"===e?async(e,r)=>{let o=oG(this._negotiatedProtocolVersion),a=o.validateRequest("sampling/createMessage",e);if(a.ok||"not-in-era"!==a.reason||(a=o.validateInputRequest("sampling/createMessage",e)),!a.ok)throw new oP("not-in-era"===a.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===a.reason?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${a.message}`);let{params:s}=a.value,i=await t(e,r),n=!!(s.tools||s.toolChoice),l=o.samplingResultVariant(n,i);if(l.ok||"not-in-era"!==l.reason||(l=o.validateInputResponse("sampling/createMessage",i)),!l.ok)throw new oP("not-in-era"===l.reason?oR.InternalError:oR.InvalidParams,"not-in-era"===l.reason?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${l.message}`);return l.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new r4(r9.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,function(e){if("object"==typeof e&&null!==e&&("legacy"===e.kind&&!("supportedVersions"in e)&&!("discover"in e)||"modern"===e.kind&&R.safeParse(e.discover).success))return e;throw new r4(r9.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}(t.prior),t);let r=function(e,t){let r=e?.mode??"legacy";if("legacy"===r)return{kind:"legacy"};let o=e?.probe??{};if("object"==typeof r){if(!(r.pin>=r3))throw TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let a=t?r8(t):[];return{kind:"auto",modernVersions:a.length>0?a:[...r6],fallbackAvailable:!t||r7(t).length>0,probe:o}}(this._versionNegotiation,this._supportedProtocolVersionsOption);return"legacy"!==r.kind?this._connectNegotiated(e,r,t):this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),void 0!==e.sessionId){let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion?.(t);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=r7(this._supportedProtocolVersions);try{let o=r[0];if(void 0===o)throw new r4(r9.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let a=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(void 0===a)throw Error(`Server sent invalid initialize result: ${a}`);if(!r.includes(a.protocolVersion))throw Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=a.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(e){throw this.close(),e}}async _connectNegotiated(e,t,r){let o;if(void 0!==e.sessionId){await super.connect(e);let t=this._negotiatedProtocolVersion;void 0!==t&&e.setProtocolVersion&&e.setProtocolVersion(t);return}this._resetConnectionState();try{let a=nz(e),s={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:nU(),defaultTimeoutMs:r?.timeout??6e4},i="stdio"===a?function(e){let t=Object.getPrototypeOf(e);if(null===t||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return"object"==typeof r&&null!==r&&"string"==typeof r.command?r:void 0}(e):void 0;o=void 0===i?await nG(t,{...s,transport:e,transportKind:a}):await nK(t,e,i,s)}catch(t){throw await e.close().catch(()=>{}),nF(e),t}if(nF(e),await super.connect(e),"legacy"===o.era)return void await this._legacyHandshake(e,r);if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=nB(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion&&e.setProtocolVersion(o.version),this._listChangedConfig){let e=this._listChangedConfig,t=this._serverCapabilities,o={...e.tools&&t?.tools?.listChanged&&{tools:e.tools},...e.prompts&&t?.prompts?.listChanged&&{prompts:e.prompts},...e.resources&&t?.resources?.listChanged&&{resources:e.resources}},a=!0;try{this._setupListChangedHandlers(o)}catch(e){a=!1,this.onerror?.(e instanceof Error?e:Error(String(e)))}let s=a?{...o.tools&&{toolsListChanged:!0},...o.prompts&&{promptsListChanged:!0},...o.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(s).length>0){let e=new AbortController,t=()=>e.abort(r?.signal?.reason);r?.signal?.aborted&&t(),r?.signal?.addEventListener("abort",t);try{this._autoOpenedSubscription=await this.listen(s,{timeout:r?.timeout,signal:e.signal})}catch(e){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),e;this.onerror?.(e instanceof Error?e:Error(String(e)))}finally{r?.signal?.removeEventListener("abort",t)}}}}async _connectFromPrior(e,t,r){if("legacy"===t.kind)return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let a=this._supportedProtocolVersionsOption,s=(a&&r8(a).length>0?r8(a):r6).find(e=>o.supportedVersions.includes(e));if(void 0===s)throw new r4(r9.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=nB(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=s,e.setProtocolVersion?.(s),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return void 0!==t?`${t.name}@${t.version}`:e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(void 0!==e)return e>=r3?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new r4(r9.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new r4(r9.CapabilityNotSupported,`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(!this._serverCapabilities?.resources)throw new r4(r9.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new r4(r9.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new r4(r9.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new r4(r9.CapabilityNotSupported,`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw new r4(r9.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new r4(r9.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new r4(r9.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new r4(r9.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`)}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},R,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);return void 0!==r?r:this._listAllPages("prompts/list",e,t,(e,t)=>e.prompts.push(...t.prompts))}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);return void 0!==r?r:this._listAllPages("resources/list",e,t,(e,t)=>e.resources.push(...t.resources))}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);return void 0!==r?r:this._listAllPages("resources/templates/list",e,t,(e,t)=>e.resourceTemplates.push(...t.resourceTemplates))}async _listAllPages(e,t,r,o,a){let s=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),n=await this.request({method:e,...t&&{params:{...t}}},r),l=n.nextCursor,c=new Set,u=1;for(;void 0!==l&&!c.has(l);){if(0!==this._listMaxPages&&u>=this._listMaxPages)throw new r4(r9.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});c.add(l);let a=await this.request({method:e,params:{...t,cursor:l}},r);o(n,a),l=a.nextCursor,u++}return delete n.nextCursor,a?.(n),s||await this._cache.write(e,n,i,this._freshness(n)),n}_freshness(e,t){let r="number"==typeof e.ttlMs?e.ttlMs:this._defaultCacheTtlMs,o="public"===e.cacheScope?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),864e5),scope:o,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch(e=>void this._reportStoreError(e));if(void 0!==o){if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof r4?e:new r4(r9.RequestTimeout,String(e))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(e){return{ok:!1,compileError:e}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return void 0===r?void 0:o4(r.inputSchema)}async readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(void 0!==r)return r;let o=this._cache.captureGeneration("resources/read",e.uri),a=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let r=this._freshness(a,e.uri);r.expiresAt>this._cache.now()?await this._cache.write("resources/read",a,o,r):t?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",e.uri)}return a}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){let r,o,a,s,i;if(void 0===this.transport)throw new r4(r9.NotConnected,"Not connected");let n=this._negotiatedProtocolVersion;if(void 0===n||!(n>=r3))throw new r4(r9.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${n??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:n});if(t?.signal?.aborted){let e=t.signal.reason;throw e instanceof r4?e:new r4(r9.RequestTimeout,String(e))}let l=new AbortController,c=`listen:${this._nextListenId++}`,u="opening",d=new Promise((e,t)=>{a=e,s=t}),h=new Promise(e=>{i=e}),p=e=>{if("closed"===u)return;let n="opening"===u;if(void 0!==r&&(clearTimeout(r),r=void 0),"ack"in e){u="open",a(e.ack);return}u="closed",void 0!==o&&t?.signal?.removeEventListener("abort",o),this._listenState.delete(c),l.abort(),i(e.cause),n&&s(e.error??new r4(r9.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},m=async()=>{l.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:c}}).catch(()=>{})},f=async()=>{"closed"!==u&&(p({cause:"local"}),await m())};this._listenState.set(c,{settle:p});let y=t?.timeout??6e4;if(r=setTimeout(()=>{p({cause:"remote",error:new r4(r9.RequestTimeout,"subscriptions/listen ack timed out",{timeout:y})}),m().catch(()=>{})},y),t?.signal){let e=t.signal;o=()=>{if("closed"===u)return;let t=e.reason;p({cause:"local",error:t instanceof Error?t:Error(String(t??"Aborted"))}),m().catch(()=>{})},e.addEventListener("abort",o,{once:!0})}let v={jsonrpc:"2.0",id:c,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}};try{await this.transport.send(v,{requestSignal:l.signal,onRequestStreamEnd:()=>p({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(e){p({cause:"remote",error:e instanceof Error?e:Error(String(e))})}return{honoredFilter:await d,close:f,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(nZ,e.method)?nZ[e.method]:void 0;if("notifications/resources/updated"===e.method){let t=e.params?.uri;"string"==typeof t&&this._cache.evictKey("resources/read",t)}else if(void 0!==r)for(let e of r)this._cache.evict(e);if("notifications/subscriptions/acknowledged"===e.method){let t=e.params?._meta?.[el],r="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==r){let t=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);r.settle({ack:t.ok?t.value.params.notifications:{}});return}}if("notifications/cancelled"===e.method){let t=e.params?.requestId,r="string"==typeof t?this._listenState.get(t):void 0;if(void 0!==r)return void r.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")})}super._onnotification(e,t)}_onresponse(e){let t=e.id,r="string"==typeof t?this._listenState.get(t):void 0;void 0!==r?oQ(e)?r.settle({cause:"remote",error:oP.fromError(e.error.code,e.error.message,e.error.data)}):r.settle({cause:"graceful",error:new r4(r9.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")}):super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new r4(r9.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r,o="modern"===this.getProtocolEra()&&"browser"!==nU(),a=async()=>{let r;if(!o)return t;try{r=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(e){this._reportStoreError(e)}if(!r?.valid||0===r.declarations.length)return t;let a=function(e,t){let r={};for(let o of e){let e=function(e,t){let r=e;for(let e of t){if(null===r||"object"!=typeof r)return;r=r[e]}return r}(t,o.path);if(null==e)continue;let a=function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e){if(!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}(e);void 0!==a&&(r[`Mcp-Param-${o.headerName}`]=o8(a))}return r}(r.declarations,e.arguments);return 0===Object.keys(a).length?t:{...t,headers:{...t?.headers,...a}}},s=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)):this._compileOutputValidator(t.toolDefinition),i=()=>{if(void 0===s||s.ok)return;let t=s.compileError,r=(t instanceof Error?t.message:String(t)).slice(0,200);throw new oP(oR.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${r}`)};i();try{r=await this.request({method:"tools/call",params:e},await a())}catch(c){let n=c instanceof oP&&-32020===c.code;if(!o||!n||t?.toolDefinition!==void 0)throw c;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,l).catch(e=>this._reportStoreError(e)),s=await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)),i(),r=await this.request({method:"tools/call",params:e},await a())}let n=void 0!==s&&s.ok?s.validator:void 0;if(n){if(void 0===r.structuredContent&&!r.isError)throw new oP(oR.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(void 0!==r.structuredContent&&!r.isError)try{let e=n(r.structuredContent);if(!e.valid)throw new oP(oR.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof oP)throw e;throw new oP(oR.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return r}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let r=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(r),r}let r=await this._serveFromCache("tools/list",void 0,t);return void 0!==r?r:this._listAllPages("tools/list",e,t,(e,t)=>e.tools.push(...t.tools),e=>this._excludeInvalidXMcpHeaderTools(e))}_excludeInvalidXMcpHeaderTools(e){if("modern"!==this.getProtocolEra()||!this.transport||"stdio"===nz(this.transport))return;let t=e.tools.filter(e=>{let t=o4(e.inputSchema);return!!t.valid||(console.warn(`[mcp-sdk] excluding tool '${e.name}' from tools/list: invalid x-mcp-header declaration — ${t.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,r,o){let a=r_(G,r);if(!a.success)throw Error(`Invalid ${e} listChanged options: ${a.error.message}`);if("function"!=typeof r.onChanged)throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=a.data,{onChanged:n}=r,l=async()=>{if(!s)return void n(null,null);try{n(null,await o())}catch(e){n(e instanceof Error?e:Error(String(e)),null)}},c=()=>{if(i){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let r=setTimeout(l,i);this._listChangedDebounceTimers.set(e,r)}else l()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}},nQ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return r0(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r0(this,e)}constructor(e,t,r){super(`SSE error: ${t}`),this.code=e,this.event=r,rY(this,new.target)}},nY=class{_eventSource;_endpoint;_abortController;_url;_resourceMetadataUrl;_scope;_eventSourceInit;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_protocolVersion;onclose;onerror;onmessage;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,nr(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=na(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ak(t?.fetch,t?.requestInit)}_last401Response;async _commonHeaders(){let e,t={};try{e=await this._authProvider?.token()}catch(e){throw nM(e)}e&&(t.Authorization=`Bearer ${e}`),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=aT(this._requestInit?.headers);return new Headers({...t,...r})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((t,r)=>{this._eventSource=new i2(this._url.href,{...this._eventSourceInit,fetch:async(t,r)=>{let o=await this._commonHeaders();o.set("Accept","text/event-stream");let a=await e(t,{...r,headers:o});if(401===a.status&&(this._last401Response=a,a.headers.has("www-authenticate"))){let{resourceMetadataUrl:e,scope:t}=nv(a);this._resourceMetadataUrl=e,this._scope=t}return a}}),this._abortController=new AbortController,this._eventSource.onerror=e=>{if(401===e.code&&this._authProvider){if(this._authProvider.onUnauthorized&&this._last401Response){let e=this._last401Response;this._last401Response=void 0,this._eventSource?.close(),this._authProvider.onUnauthorized({response:e,serverUrl:this._url,fetchFn:this._fetchWithInit}).then(()=>this._startOrAuth().then(t,r),e=>{nM(e),this.onerror?.(e),r(e)});return}let e=nM(new ns);r(e),this.onerror?.(e);return}let o=new nQ(e.code,e.message,e);r(o),this.onerror?.(o)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",e=>{try{if(this._endpoint=new URL(e.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(e){r(e),this.onerror?.(e),this.close();return}t()}),this._eventSource.onmessage=e=>{let t;try{t=eP.parse(JSON.parse(e.data))}catch(e){this.onerror?.(e);return}this.onmessage?.(t)}})}async start(){if(this._eventSource)throw Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e,t){if(!this._oauthProvider)throw new ns("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await nc(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await nm(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new ns("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){return this._send(e,!1)}async _send(e,t){if(!this._endpoint)throw new r4(r9.NotConnected,"Not connected");try{let r=await this._commonHeaders();r.set("content-type","application/json");let o={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},a=await (this._fetch??fetch)(this._endpoint,o);if(!a.ok){if(401===a.status&&this._authProvider){if(a.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=nv(a);this._resourceMetadataUrl=e,this._scope=t}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:a,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw nM(e)}return await a.text?.().catch(()=>{}),this._send(e,!0)}if(await a.text?.().catch(()=>{}),t)throw nM(new r5(r9.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:a.statusText}));throw nM(new ns)}let r=await a.text?.().catch(()=>null);throw Error(`Error POSTing to endpoint (HTTP ${a.status}): ${r}`)}await a.text?.().catch(()=>{})}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}};let n0={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},n1=new Set(["authorization","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function n2(e,t){if("function"==typeof AbortSignal.any)return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",a),t.removeEventListener("abort",s)};function a(){o(),r.abort(e.reason)}function s(){o(),r.abort(t.reason)}return e.addEventListener("abort",a,{once:!0}),t.addEventListener("abort",s,{once:!0}),r.signal}var n9=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,nr(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=na(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ak(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??n0,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??1)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(e){throw nM(e)}}async _stepUpAuthorizeInner(e,t){if("throw"===this._onInsufficientScope||!this._oauthProvider)throw new i8({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new r5(r9.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});e.resourceMetadataUrl&&(this._resourceMetadataUrl=e.resourceMetadataUrl);let r=await this._oauthProvider.tokens(),o=nl(this._scope,r?.scope,e.scope);this._scope=o;let a=function(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let t of e.split(/\s+/))if(t&&!r.has(t))return!0;return!1}(o,r?.scope);return nm(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:a,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let e,t={};try{e=await this._authProvider?.token()}catch(e){throw nM(e)}e&&(t.Authorization=`Bearer ${e}`),this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=aT(this._requestInit?.headers);return new Headers({...t,...r})}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!eA.safeParse(t).success)return;let r=t.params?._meta?.[g];if("string"!=typeof r)return;e.set("mcp-protocol-version",r),e.set("mcp-method",t.method);let o=t.params,a="resources/read"===t.method?"string"==typeof o?.uri?o.uri:void 0:"string"==typeof o?.name?o.name:void 0;void 0!==a&&e.set("mcp-name",o8(a))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!eA.safeParse(e).success)return!1;let t=e.params?._meta?.[g];return"string"==typeof t&&t>=r3}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:a}=e,s=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0;try{let s=await this._commonHeaders(),i=[...s.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"text/event-stream"];s.set("accept",[...new Set(i)].join(", ")),o&&s.set("last-event-id",o);let n=this._abortController?.signal,l=void 0!==a&&void 0!==n?n2(n,a):a??n,c=await (this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:s,signal:l});if(!c.ok){if(401===c.status&&this._authProvider){if(c.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=nv(c);this._resourceMetadataUrl=e,this._scope=nl(this._scope,t)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:c,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw nM(e)}return await c.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}if(await c.text?.().catch(()=>{}),t)throw nM(new r5(r9.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:c.statusText}));throw nM(new ns)}if(403===c.status){let{resourceMetadataUrl:o,scope:a,error:s,errorDescription:i}=nv(c);if("insufficient_scope"===s){let s=await c.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:a,resourceMetadataUrl:o,errorDescription:i,statusText:c.statusText,text:s},r)!=="AUTHORIZED")throw nM(new ns);return this._startOrAuthSse(e,t,r+1)}}if(await c.text?.().catch(()=>{}),405===c.status)return void e.onRequestStreamEnd?.();throw new r5(r9.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${c.statusText}`,{status:c.status,statusText:c.statusText})}this._handleSseStream(c.body,e,!0)}catch(e){throw s()||this.onerror?.(e),e}}_getNextReconnectionDelay(e){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),a=()=>{this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted||this._startOrAuthSse(e).catch(r=>{if(!(this._abortController?.signal.aborted||e.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`));try{this._scheduleReconnection(e,t+1)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}})};if(this._reconnectionScheduler){let e=this._reconnectionScheduler(a,o,t);this._cancelReconnection="function"==typeof e?e:void 0}else{let e=setTimeout(a,o);this._cancelReconnection=()=>clearTimeout(e)}}_handleSseStream(e,t,r){let o;if(!e)return void t.onRequestStreamEnd?.();let{onresumptiontoken:a,replayMessageId:s,requestSignal:i,onRequestStreamEnd:n}=t,l=()=>this._abortController?.signal.aborted===!0||i?.aborted===!0,c=!1,u=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new i9({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:r}=await t.read();if(r)break;if((e.id&&(o=e.id,c=!0,a?.(e.id)),e.data)&&(!e.event||"message"===e.event))try{let t=eP.parse(JSON.parse(e.data));(oX(t)||oQ(t))&&(u=!0,void 0!==s&&(t.id=s)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||c)&&!u&&this._abortController&&!l()?this._scheduleReconnection({resumptionToken:o,onresumptiontoken:a,replayMessageId:s,requestSignal:i,onRequestStreamEnd:n},0):l()||n?.()}catch(e){if(l())return;if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(r||c)&&!u&&this._abortController&&!l())try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:a,replayMessageId:s,requestSignal:i,onRequestStreamEnd:n},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`)),n?.()}else n?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new ns("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await nc(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await nm(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new ns("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let{resumptionToken:a,onresumptiontoken:s}=t||{};if(a)return void this._startOrAuthSse({resumptionToken:a,replayMessageId:eA.safeParse(e).success?e.id:void 0,requestSignal:t?.requestSignal}).catch(e=>this.onerror?.(e));let i=await this._commonHeaders();this._applyBodyDerivedHeaders(i,e);let n=Array.isArray(e)?e.some(e=>p.safeParse(e).success):p.safeParse(e).success;if(n&&i.delete("mcp-session-id"),t?.headers!==void 0)for(let[e,r]of Object.entries(t.headers))n1.has(e.toLowerCase())||i.set(e,r);i.set("content-type","application/json");let l=[...i.get("accept")?.split(",").map(e=>e.trim().toLowerCase())??[],"application/json","text/event-stream"];i.set("accept",[...new Set(l)].join(", "));let c=this._abortController?.signal,u=t?.requestSignal!==void 0&&void 0!==c?n2(c,t.requestSignal):t?.requestSignal??c,d={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:u},h=await (this._fetch??fetch)(this._url,d);if(n&&h.ok&&(this._sessionId=h.headers.get("mcp-session-id")||void 0),!h.ok){if(401===h.status&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:e,scope:t}=nv(h);this._resourceMetadataUrl=e,this._scope=nl(this._scope,t)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw nM(e)}return await h.text?.().catch(()=>{}),this._send(e,t,!0,o)}if(await h.text?.().catch(()=>{}),r)throw nM(new r5(r9.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw nM(new ns)}let a=await h.text?.().catch(()=>null);if(403===h.status){let{resourceMetadataUrl:s,scope:i,error:n,errorDescription:l}=nv(h);if("insufficient_scope"===n){if(await this._stepUpAuthorize({scope:i,resourceMetadataUrl:s,errorDescription:l,statusText:h.statusText,text:a},o)!=="AUTHORIZED")throw nM(new ns);return this._send(e,t,r,o+1)}}if(400===h.status&&"string"==typeof a&&this._isModernEnvelopedRequest(e))try{let t=eP.parse(JSON.parse(a)),r=(Array.isArray(e)?e:[e]).filter(e=>eA.safeParse(e).success);if(oQ(t)&&r.some(e=>e.id===t.id))return void this.onmessage?.(t)}catch{}throw new r5(r9.ClientHttpNotImplemented,`Error POSTing to endpoint: ${a}`,{status:h.status,statusText:h.statusText,text:a})}if(202===h.status){await h.text?.().catch(()=>{}),e2.safeParse(e).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let m=(Array.isArray(e)?e:[e]).some(e=>"method"in e&&"id"in e&&void 0!==e.id),f=h.headers.get("content-type"),y=function(e){if(e)try{return aC.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(""===t||e.slice(t.length).includes(","))return;return t}}(f);if(m)if("text/event-stream"===y)this._handleSseStream(h.body,{onresumptiontoken:s,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if("application/json"===y){let e=await h.json();for(let t of Array.isArray(e)?e.map(e=>eP.parse(e)):[eP.parse(e)])this.onmessage?.(t)}else throw await h.text?.().catch(()=>{}),new r4(r9.ClientHttpUnexpectedContent,`Unexpected content type: ${f}`,{contentType:f});else await h.text?.().catch(()=>{})}catch(e){throw t?.requestSignal?.aborted!==!0&&this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await (this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&405!==r.status)throw new r5(r9.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};let n4=["application/json","text/event-stream"];function n5(e){let t=lo(e.tool_name);if(!t)throw Error("MCP 工具名称为空");return{name:t,arguments:la(e.arguments)??la(u(lo(e.arguments_json)))??{}}}function n3(e){var t;let r=function(e){if(!d(e))return e;let{_response_meta:t,...r}=e;return r}(e);if(!r||"object"!=typeof r){let e=String(r??"");return{content:e,raw_result_text:e,raw_mcp_result_json:e}}if("string"==typeof r.content||"raw_mcp_result_json"in r||"raw_result_text"in r||"structured"in r){let e="string"==typeof r.content?r.content:JSON.stringify(r.content??""),t=r.raw_mcp_result_json||r.raw_result_text||e;return{...r,content:e,raw_result_text:r.raw_result_text||t,raw_mcp_result_json:r.raw_mcp_result_json||t,structured:r.structured??r.structuredContent,is_error:r.is_error??r.isError}}let o=JSON.stringify(r);return{content:o,structured:r.structuredContent,raw_result_text:o,raw_mcp_result_json:o,is_error:!0===r.isError,miniapp:(t=r,Array.isArray(t?.content)&&t?.structuredContent&&"object"==typeof t.structuredContent)?{is_mini_app:!0,mcp_channel:"flow_miniapp"}:void 0}}function n6(e){let t=new URL(e);return("/"===t.pathname||""===t.pathname)&&(t.pathname="/mcp"),t.toString()}function n7(e){return new URL(e).pathname.replace(/\/+$/,"").toLowerCase().endsWith("/sse")}function n8(e){let t=new URL(e);return`${t.hostname}_${t.port||t.protocol.replace(":","")}${t.pathname.replace(/[^A-Za-z0-9_-]/g,"_")}`}function le(e){let t=d(e)?e.id:null;return"string"==typeof t||"number"==typeof t&&Number.isFinite(t)?t:null}function lt(e){return c(e,"method")}function lr(e){let t=d(e)?e.params:void 0;return c(t,"name")??c(t,"uri")}function lo(e){return"string"==typeof e?e:""}function la(e){return d(e)?e:void 0}function ls(e){let t=e instanceof Error&&e.name?e.name:"MCPRequestError";if(e instanceof r5)return`${t},HTTP ${e.data.status}`;if(e instanceof oP)return`${t},错误码 ${e.code}`;let r=e instanceof Error?e.message:String(e),o=r.match(/\bHTTP\s+(\d{3})\b/i)?.[1],a=r.match(/错误码\s+(-?\d+)/)?.[1];return o?`${t},HTTP ${o}`:a?`${t},错误码 ${a}`:t}let li=l("node:async_hooks"),ln=(rV={type:"object"},n=((void 0)??(i??=new id)).getValidator(rV),{"~standard":{version:1,vendor:"mcp",jsonSchema:{input:()=>rV,output:()=>rV},validate:e=>{let t=n(e);return t.valid?{value:t.data}:{issues:[{message:t.errorMessage}]}}}});class ll{url;options;protocol;transport;lifetime=new AbortController;requests=new li.AsyncLocalStorage;client;ready;constructor(e,t={}){this.url=e,this.options=t,this.protocol=t.protocol??(n7(e)?"sse":"streamable");let r={requestInit:{headers:t.headers},fetch:this.fetch.bind(this)};this.transport="sse"===this.protocol?new nY(new URL(e),r):new n9(new URL(e),{...r,sessionId:t.sessionID,protocolVersion:t.protocolVersion}),"sse"===this.protocol&&(this.transport.onerror=e=>{(e instanceof nQ||e instanceof SyntaxError||"ZodError"===e.name)&&this.close()})}get sessionID(){return this.transport instanceof n9?this.transport.sessionId:void 0}get protocolVersion(){return this.transport instanceof n9?this.transport.protocolVersion:"2024-11-05"}async initialize(e){try{return await this.connect(e),await this.listTools()}catch(e){throw this.close(),e}}connect(e={name:"dbx-cli",version:"0.1.0"},t={}){return this.client??=new nX(e,{supportedProtocolVersions:"sse"===this.protocol?["2024-11-05"]:["2025-11-25","2025-06-18","2025-03-26","2024-11-05"]}),this.ready??=this.run(t,e=>this.client.connect(this.transport,e)).catch(e=>{throw this.close(),e})}async listTools(){return await this.connect(),(await this.run({},e=>this.client.listTools({},e))).tools}async callTool(e,t={}){return await this.connect(),this.run(t,t=>this.client.request({method:"tools/call",params:e},ln,t)).catch(e=>{if(t.signal?.throwIfAborted(),this.lifetime.signal.throwIfAborted(),e instanceof Error&&"TimeoutError"===e.name)throw e;throw Error(`MCP 请求失败(${ls(e)})`)})}async forward(e,t={}){if("streamable"===this.protocol)return this.run(t,async({signal:r})=>{var o;let a,s,i,n,l,c=await fetch(this.url,{method:"POST",headers:((a=new Headers((o={sessionID:this.sessionID,protocolVersion:this.protocolVersion,headers:{...this.options.headers,...t.headers}}).headers)).set("Content-Type","application/json"),i=new Set((s=(a.get("Accept")??"").split(",").map(e=>e.trim()).filter(Boolean)).map(e=>e.split(";")[0].trim().toLowerCase())),a.set("Accept",[...s,...n4.filter(e=>!i.has(e))].join(", ")),(n=lt(e))&&a.set("Mcp-Method",n),(l=lr(e))&&a.set("Mcp-Name",l),o.protocolVersion&&a.set("MCP-Protocol-Version",o.protocolVersion),o.sessionID&&a.set("Mcp-Session-Id",o.sessionID),a),body:JSON.stringify(e),signal:r}),u=await c.text();return{status:c.status,headers:c.headers,body:u?function(e,t,r){if(t?.toLowerCase().includes("text/event-stream")){var o;let t,a=(o=e,t=[],iS({onEvent({data:e}){e.trim()&&"[DONE]"!==e.trim()&&t.push(JSON.parse(e))}}).feed(`${o}
13
13
 
14
- `),t).filter(oY),s=a.find(e=>null!==r&&e.id===r)??a.find(e=>"id"in e);if(!s)throw Error("MCP SSE 响应中没有 JSON-RPC 响应");return s}return JSON.parse(e)}(u,c.headers.get("content-type"),le(e)):null}});let r=e$.parse(e);await this.connect(void 0,t);let o=new Headers({"content-type":"application/json"});if(A.safeParse(r).success)return await this.run(t,()=>this.client.notification(r)),{status:200,headers:o,body:{}};if(!eN.safeParse(r).success)throw Error("MCP 转发消息必须是请求或通知");try{let e=await this.run(t,e=>this.client.request(r,ln,e));return{status:200,headers:o,body:{jsonrpc:"2.0",id:r.id,result:e}}}catch(e){if(!(e instanceof oP))throw e;return{status:200,headers:o,body:{jsonrpc:"2.0",id:r.id,error:{code:e.code,message:e.message,data:e.data}}}}}async run(e,t){this.lifetime.signal.throwIfAborted(),e.signal?.throwIfAborted();let r=new AbortController,o=e.timeoutMs??1e4,a=setTimeout(()=>r.abort(new DOMException(`MCP 请求超时(${o}ms)`,"TimeoutError")),o),s=AbortSignal.any([this.lifetime.signal,r.signal,...e.signal?[e.signal]:[]]),{promise:i,reject:n}=Promise.withResolvers(),l=()=>n(s.reason);s.addEventListener("abort",l,{once:!0});let c={...e,signal:s,posts:[]};try{return await this.requests.run(c,()=>Promise.race([t({signal:s,timeout:o,headers:e.headers}).then(async e=>(await Promise.all(c.posts),e)),i]))}catch(e){throw s.throwIfAborted(),e}finally{clearTimeout(a),s.removeEventListener("abort",l)}}async fetch(e,t={}){t={...t,method:t.method??"GET"};let r=this.requests.getStore(),o=AbortSignal.any([...t.signal?[t.signal]:[],..."DELETE"===t.method?[]:[this.lifetime.signal],..."GET"===t.method?[]:["DELETE"===t.method?AbortSignal.timeout(1e3):r?.signal??AbortSignal.timeout(1e4)]]),a=t.body?JSON.parse(String(t.body)):void 0,s=new Headers(t.headers);if("POST"===t.method){for(let[e,t]of Object.entries(r?.headers??{}))s.set(e,t);let e=lt(a),t=lr(a);e&&s.set("Mcp-Method",e),t&&s.set("Mcp-Name",t)}if("GET"===t.method){let r=await fetch(e,{...t,headers:s,signal:o});return r.body?new Response(r.body.pipeThrough(new TransformStream,{signal:o}),{status:r.status,headers:r.headers}):r}let i=(async()=>{let r=await fetch(e,{...t,headers:s,signal:o}),a="";return r.ok?a=await r.text():await r.body?.cancel(),new Response(a||null,{status:r.status,headers:r.headers})})();return i.catch(()=>void 0),r?.posts.push(i),i}async close(e=!1){this.lifetime.signal.aborted||(this.lifetime.abort(new DOMException("MCP 客户端已关闭","AbortError")),e&&this.transport instanceof n9&&await this.transport.terminateSession().catch(()=>void 0),await this.transport.close())}}export{ll as MCPTransport,n5 as buildMCPToolCallParams,n7 as isLegacySSEURL,le as jsonRPCID,ls as mcpErrorSummary,n8 as mcpServerID,n3 as normalizeMCPToolResult,n6 as normalizeStreamableURL};
14
+ `),t).filter(oY),s=a.find(e=>null!==r&&e.id===r)??a.find(e=>"id"in e);if(!s)throw Error("MCP SSE 响应中没有 JSON-RPC 响应");return s}return JSON.parse(e)}(u,c.headers.get("content-type"),le(e)):null}});let r=eP.parse(e);await this.connect(void 0,t);let o=new Headers({"content-type":"application/json"});if(U.safeParse(r).success)return await this.run(t,()=>this.client.notification(r)),{status:200,headers:o,body:{}};if(!eA.safeParse(r).success)throw Error("MCP 转发消息必须是请求或通知");try{let e=await this.run(t,e=>this.client.request(r,ln,e));return{status:200,headers:o,body:{jsonrpc:"2.0",id:r.id,result:e}}}catch(e){if(!(e instanceof oP))throw e;return{status:200,headers:o,body:{jsonrpc:"2.0",id:r.id,error:{code:e.code,message:e.message,data:e.data}}}}}async run(e,t){this.lifetime.signal.throwIfAborted(),e.signal?.throwIfAborted();let r=new AbortController,o=e.timeoutMs??1e4,a=setTimeout(()=>r.abort(new DOMException(`MCP 请求超时(${o}ms)`,"TimeoutError")),o),s=AbortSignal.any([this.lifetime.signal,r.signal,...e.signal?[e.signal]:[]]),{promise:i,reject:n}=Promise.withResolvers(),l=()=>n(s.reason);s.addEventListener("abort",l,{once:!0});let c={...e,signal:s,posts:[]};try{return await this.requests.run(c,()=>Promise.race([t({signal:s,timeout:o,headers:e.headers}).then(async e=>(await Promise.all(c.posts),e)),i]))}catch(e){throw s.throwIfAborted(),e}finally{clearTimeout(a),s.removeEventListener("abort",l)}}async fetch(e,t={}){t={...t,method:t.method??"GET"};let r=this.requests.getStore(),o=AbortSignal.any([...t.signal?[t.signal]:[],..."DELETE"===t.method?[]:[this.lifetime.signal],..."GET"===t.method?[]:["DELETE"===t.method?AbortSignal.timeout(1e3):r?.signal??AbortSignal.timeout(1e4)]]),a=t.body?JSON.parse(String(t.body)):void 0,s=new Headers(t.headers);if("POST"===t.method){for(let[e,t]of Object.entries(r?.headers??{}))s.set(e,t);let e=lt(a),t=lr(a);e&&s.set("Mcp-Method",e),t&&s.set("Mcp-Name",t)}if("GET"===t.method){let r=await fetch(e,{...t,headers:s,signal:o});return r.body?new Response(r.body.pipeThrough(new TransformStream,{signal:o}),{status:r.status,headers:r.headers}):r}let i=(async()=>{let r=await fetch(e,{...t,headers:s,signal:o}),a="";return r.ok?a=await r.text():await r.body?.cancel(),new Response(a||null,{status:r.status,headers:r.headers})})();return i.catch(()=>void 0),r?.posts.push(i),i}async close(e=!1){this.lifetime.signal.aborted||(this.lifetime.abort(new DOMException("MCP 客户端已关闭","AbortError")),e&&this.transport instanceof n9&&await this.transport.terminateSession().catch(()=>void 0),await this.transport.close())}}export{ll as MCPTransport,n5 as buildMCPToolCallParams,n7 as isLegacySSEURL,le as jsonRPCID,ls as mcpErrorSummary,n8 as mcpServerID,n3 as normalizeMCPToolResult,n6 as normalizeStreamableURL};