broods 0.52.2 → 0.52.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account.js +1 -1
- package/dist/{chunk-a8zhzzj7.js → chunk-1fn0c0fe.js} +2 -2
- package/dist/{chunk-pfvvdwms.js → chunk-5njt640x.js} +1 -1
- package/dist/chunk-e4ts6eg7.js +14 -0
- package/dist/chunk-fd02pxtq.js +0 -0
- package/dist/chunk-njamyfye.js +5 -0
- package/dist/{chunk-fkc1nb69.js → chunk-ynnv4vw7.js} +4 -4
- package/dist/chunk-zx8r5k20.js +58 -0
- package/dist/cli/index.js +48 -48
- package/dist/index.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-9th6spww.js +0 -65
- package/dist/chunk-ckqc09s3.js +0 -14
- package/dist/chunk-kc1md1rd.js +0 -1
- package/dist/chunk-yqbtb9cd.js +0 -5
- /package/dist/{chunk-5esx8msr.js → chunk-hkbecyy0.js} +0 -0
package/dist/chunk-ckqc09s3.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{q,w}from"./chunk-a8zhzzj7.js";import{le,de,oe,A,se,J,e,pe,Y,X,o,i,P,me,c,n,t,u,a,R,C,s,d,r,l,D,I}from"./chunk-9th6spww.js";var{create:Ll,defineProperty:ao,getOwnPropertyDescriptor:Dl,getOwnPropertyNames:Vl,getPrototypeOf:Ul}=Object,Hl=Object.prototype.hasOwnProperty,ue=(m,h)=>()=>(h||m((h={exports:{}}).exports,h),h.exports),xi=(m,h)=>{let p={};for(var f in m)ao(p,f,{get:m[f],enumerable:!0});if(h)ao(p,Symbol.toStringTag,{value:"Module"});return p},xl=(m,h,p,f)=>{if(h&&typeof h==="object"||typeof h==="function"){for(var g=Vl(h),v=0,y=g.length,_;v<y;v++)if(_=g[v],!Hl.call(m,_)&&_!==p)ao(m,_,{get:((S)=>h[S]).bind(null,_),enumerable:!(f=Dl(h,_))||f.enumerable})}return m},no=(m,h,p)=>(p=m!=null?Ll(Ul(m)):{},xl(h||!m||!m.__esModule?ao(p,"default",{value:m,enumerable:!0}):p,m));var Fl=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Fi=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Bl=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Jl=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Bi(m){return typeof m==="string"&&Fi.has(m.replace(/#$/,""))}function Ji(m,h){if(!("$schema"in m)||typeof m.$schema!=="string")return"2020-12";let p=m.$schema.replace(/#$/,"");if(Fl.has(p))return"2020-12";if(Fi.has(p))return"2019-09";if(Bl.has(p)||Jl.has(p))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${m.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${h}`)}var Gi={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var Ki;(function(m){})(Ki||(Ki={}));function Kl(m){return de(X,m)}var Wt="2025-11-25";var io=[Wt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],co="io.modelcontextprotocol/related-task",gt="io.modelcontextprotocol/protocolVersion",hr="io.modelcontextprotocol/clientInfo",mt="io.modelcontextprotocol/serverInfo",St="io.modelcontextprotocol/clientCapabilities",Yt="io.modelcontextprotocol/subscriptionId",Et="io.modelcontextprotocol/logLevel";var Xt="2.0";var $t=D(()=>a([e(),o(),i(),P(),s(e(),$t),n($t)])),Ae=s(e(),$t),$n=n($t),ns=a([e(),o().int()]),is=e(),lo=t({ttl:o().optional()}),uo=t({taskId:e()}),cs=u({progressToken:ns.optional(),[co]:uo.optional()}),Ke=t({_meta:cs.optional()}),Zt=Ke.extend({task:lo.optional()}),Le=t({method:e(),params:Ke.loose().optional()}),Xe=t({_meta:cs.optional()}),Ze=t({method:e(),params:Xe.loose().optional()}),ls=u({get[mt](){return gr.optional().catch(void 0)}}),De=u({_meta:ls.optional()}),Tt=a([e(),o().int()]),us=t({jsonrpc:r(Xt),id:Tt,...Le.shape}).strict(),ds=t({jsonrpc:r(Xt),...Ze.shape}).strict(),pr=t({jsonrpc:r(Xt),id:Tt,result:De}).strict(),fr=t({jsonrpc:r(Xt),id:Tt.optional(),error:t({code:o().int(),message:e(),data:c().optional()})}).strict(),ms=a([us,ds,pr,fr]),En=a([pr,fr]),hs=De.strict(),mo=Xe.extend({requestId:Tt.optional(),reason:e().optional()}),ps=Ze.extend({method:r("notifications/cancelled"),params:mo}),ho=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:d(["light","dark"]).optional()}),Pt=t({icons:n(ho).optional()}),ft=t({name:e(),title:e().optional()}),gr=ft.extend({...ft.shape,...Pt.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),Xl=C(t({applyDefaults:i().optional()}),Ae),Zl=I((m)=>{if(m&&typeof m==="object"&&!Array.isArray(m)&&Object.keys(m).length===0)return{form:{}};return m},C(t({form:Xl.optional(),url:Ae.optional()}),Ae.optional())),po=u({list:Ae.optional(),cancel:Ae.optional(),requests:u({sampling:u({createMessage:Ae.optional()}).optional(),elicitation:u({create:Ae.optional()}).optional()}).optional()}),fo=u({list:Ae.optional(),cancel:Ae.optional(),requests:u({tools:u({call:Ae.optional()}).optional()}).optional()}),go=t({experimental:s(e(),Ae).optional(),sampling:t({context:Ae.optional(),tools:Ae.optional()}).optional(),elicitation:Zl.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:po.optional(),extensions:s(e(),Ae).optional()}),So=Ke.extend({protocolVersion:e(),capabilities:go,clientInfo:gr}),yo=Le.extend({method:r("initialize"),params:So}),fs=t({experimental:s(e(),Ae).optional(),logging:Ae.optional(),completions:Ae.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:fo.optional(),extensions:s(e(),Ae).optional()}),vo=De.extend({protocolVersion:e(),capabilities:fs,serverInfo:gr,instructions:e().optional()}),_o=Ze.extend({method:r("notifications/initialized"),params:Xe.optional()}),bo=Le.extend({method:r("server/discover"),params:Ke.optional()}),Ro=De.extend({supportedVersions:n(e()),capabilities:fs,instructions:e().optional()}),gs=Le.extend({method:r("ping"),params:Ke.optional()}),zo=t({progress:o(),total:l(o()),message:l(e())}),wo=t({...Xe.shape,...zo.shape,progressToken:ns}),Ss=Ze.extend({method:r("notifications/progress"),params:wo}),$o=Ke.extend({cursor:is.optional()}),Ct=Le.extend({params:$o.optional()}),qt=De.extend({nextCursor:is.optional()}),ys=t({uri:e(),mimeType:l(e()),_meta:s(e(),c()).optional()}),vs=ys.extend({text:e()}),Tn=e().refine((m)=>{try{return atob(m),!0}catch{return!1}},{message:"Invalid Base64 string"}),_s=ys.extend({blob:Tn}),It=d(["user","assistant"]),yt=t({audience:n(It).optional(),priority:o().min(0).max(1).optional(),lastModified:A({offset:!0}).optional()}),bs=t({...ft.shape,...Pt.shape,uri:e(),description:l(e()),mimeType:l(e()),size:l(o()),annotations:yt.optional(),_meta:l(u({}))}),Eo=t({...ft.shape,...Pt.shape,uriTemplate:e(),description:l(e()),mimeType:l(e()),annotations:yt.optional(),_meta:l(u({}))}),To=Ct.extend({method:r("resources/list")}),Po=qt.extend({resources:n(bs)}),Co=Ct.extend({method:r("resources/templates/list")}),qo=qt.extend({resourceTemplates:n(Eo)}),Sr=Ke.extend({uri:e()}),Io=Sr,jo=Le.extend({method:r("resources/read"),params:Io}),ko=De.extend({contents:n(a([vs,_s]))}),Oo=Ze.extend({method:r("notifications/resources/list_changed"),params:Xe.optional()}),No=Sr,Mo=Le.extend({method:r("resources/subscribe"),params:No}),Ao=Sr,Lo=Le.extend({method:r("resources/unsubscribe"),params:Ao}),Rs=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:n(e()).optional()}),Do=Ke.extend({notifications:Rs}),Vo=Le.extend({method:r("subscriptions/listen"),params:Do}),Uo=Xe.extend({notifications:Rs}),Ho=Ze.extend({method:r("notifications/subscriptions/acknowledged"),params:Uo}),xo=ls.extend({[Yt]:Tt}),Fo=De.extend({_meta:xo}),Bo=Xe.extend({uri:e()}),Jo=Ze.extend({method:r("notifications/resources/updated"),params:Bo}),Ko=t({name:e(),description:l(e()),required:l(i())}),Go=t({...ft.shape,...Pt.shape,description:l(e()),arguments:l(n(Ko)),_meta:l(u({}))}),Wo=Ct.extend({method:r("prompts/list")}),Yo=qt.extend({prompts:n(Go)}),Xo=Ke.extend({name:e(),arguments:s(e(),e()).optional()}),Zo=Le.extend({method:r("prompts/get"),params:Xo}),yr=t({type:r("text"),text:e(),annotations:yt.optional(),_meta:s(e(),c()).optional()}),vr=t({type:r("image"),data:Tn,mimeType:e(),annotations:yt.optional(),_meta:s(e(),c()).optional()}),_r=t({type:r("audio"),data:Tn,mimeType:e(),annotations:yt.optional(),_meta:s(e(),c()).optional()}),Qo=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),c()),_meta:s(e(),c()).optional()}),ea=t({type:r("resource"),resource:a([vs,_s]),annotations:yt.optional(),_meta:s(e(),c()).optional()}),ta=bs.extend({type:r("resource_link")}),br=a([yr,vr,_r,ta,ea]),ra=t({role:It,content:br}),sa=De.extend({description:e().optional(),messages:n(ra)}),oa=Ze.extend({method:r("notifications/prompts/list_changed"),params:Xe.optional()}),aa=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),na=t({taskSupport:d(["required","optional","forbidden"]).optional()}),zs=t({...ft.shape,...Pt.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),$t).optional(),required:n(e()).optional()}).catchall(c()),outputSchema:u({$schema:e().optional()}).optional(),annotations:aa.optional(),execution:na.optional(),_meta:s(e(),c()).optional()}),ia=Ct.extend({method:r("tools/list")}),ca=qt.extend({tools:n(zs)}),ws=De.extend({content:n(br).default([]),structuredContent:c().optional(),isError:i().optional()}),Pn=ws.or(De.extend({toolResult:c()})),la=Zt.extend({name:e(),arguments:s(e(),c()).optional()}),ua=Le.extend({method:r("tools/call"),params:la}),da=Ze.extend({method:r("notifications/tools/list_changed"),params:Xe.optional()}),Cn=t({autoRefresh:i().default(!0),debounceMs:o().int().nonnegative().default(300)}),jt=d(["debug","info","notice","warning","error","critical","alert","emergency"]),ma=Ke.extend({level:jt}),ha=Le.extend({method:r("logging/setLevel"),params:ma}),pa=Xe.extend({level:jt,logger:e().optional(),data:c()}),fa=Ze.extend({method:r("notifications/message"),params:pa}),ga=t({name:e().optional()}),Sa=t({hints:n(ga).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),ya=t({mode:d(["auto","required","none"]).optional()}),va=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n(br),structuredContent:c().optional(),isError:i().optional(),_meta:s(e(),c()).optional()}),_a=R("type",[yr,vr,_r]),Gt=R("type",[yr,vr,_r,Qo,va]),ba=t({role:It,content:a([Gt,n(Gt)]),_meta:s(e(),c()).optional()}),Ra=Zt.extend({messages:n(ba),modelPreferences:Sa.optional(),systemPrompt:e().optional(),includeContext:d(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:Ae.optional(),tools:n(zs).optional(),toolChoice:ya.optional()}),za=Le.extend({method:r("sampling/createMessage"),params:Ra}),wa=De.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens"]).or(e())),role:It,content:_a}),$a=De.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:It,content:a([Gt,n(Gt)])}),$s=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),Rr=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:d(["email","uri","date","date-time"]).optional(),default:e().optional()}),zr=t({type:d(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Es=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),Ts=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),Ps=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),Ea=a([Es,Ts]),Cs=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),qs=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),Ta=a([Cs,qs]),Pa=a([Ps,Ea,Ta]),Is=a([Pa,$s,Rr,zr]),wr=Zt.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),Is),required:n(e()).optional()}).catchall(c())}),Ca=Zt.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),qa=a([wr,Ca]),Ia=Le.extend({method:r("elicitation/create"),params:qa}),ja=Xe.extend({elicitationId:e()}),ka=Ze.extend({method:r("notifications/elicitation/complete"),params:ja}),Oa=De.extend({action:d(["accept","decline","cancel"]),content:I((m)=>m===null?void 0:m,s(e(),a([e(),o(),i(),n(e())])).optional())}),Na=t({type:r("ref/resource"),uri:e()}),Ma=t({type:r("ref/prompt"),name:e()}),Aa=Ke.extend({ref:a([Ma,Na]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),La=Le.extend({method:r("completion/complete"),params:Aa}),Da=De.extend({completion:u({values:n(e()).max(100),total:l(o().int()),hasMore:l(i())})}),Va=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),c()).optional()}),Ua=Le.extend({method:r("roots/list"),params:Ke.optional()}),Ha=De.extend({roots:n(Va)}),xa=Ze.extend({method:r("notifications/roots/list_changed"),params:Xe.optional()}),qn=u({ttl:o().optional(),pollInterval:o().optional()}),Fa=d(["working","input_required","completed","failed","cancelled"]),kt=t({taskId:e(),status:Fa,ttl:a([o(),P()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:l(o()),statusMessage:l(e())}),In=De.extend({task:kt}),Ba=Xe.merge(kt),jn=Ze.extend({method:r("notifications/tasks/status"),params:Ba}),kn=Le.extend({method:r("tasks/get"),params:Ke.extend({taskId:e()})}),On=De.merge(kt),Nn=Le.extend({method:r("tasks/result"),params:Ke.extend({taskId:e()})}),Mn=De.loose(),An=Ct.extend({method:r("tasks/list")}),Ln=qt.extend({tasks:n(kt)}),Dn=Le.extend({method:r("tasks/cancel"),params:Ke.extend({taskId:e()})}),Vn=De.merge(kt),Un=a([gs,yo,bo,La,ha,Zo,Wo,To,Co,jo,Mo,Lo,Vo,ua,ia]),Hn=a([ps,Ss,_o,xa]),xn=a([hs,wa,$a,Oa,Ha]),Fn=a([gs,za,Ia,Ua]),Bn=a([ps,Ss,fa,Jo,Oo,da,oa,Ho,ka]),Jn=a([hs,vo,Ro,Da,sa,Yo,Po,qo,ko,ws,ca,Fo]),Je=Y().superRefine((m,h)=>{if(!URL.canParse(m))return h.addIssue({code:Gi.custom,message:"URL must be parseable",fatal:!0}),le}).refine((m)=>{let h=new URL(m);return h.protocol!=="javascript:"&&h.protocol!=="data:"&&h.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Kn=u({resource:e().url(),authorization_servers:n(Je).optional(),jwks_uri:e().url().optional(),scopes_supported:n(e()).optional(),bearer_methods_supported:n(e()).optional(),resource_signing_alg_values_supported:n(e()).optional(),resource_name:e().optional(),resource_documentation:e().optional(),resource_policy_uri:e().url().optional(),resource_tos_uri:e().url().optional(),tls_client_certificate_bound_access_tokens:i().optional(),authorization_details_types_supported:n(e()).optional(),dpop_signing_alg_values_supported:n(e()).optional(),dpop_bound_access_tokens_required:i().optional()}),Ja=u({issuer:e(),authorization_endpoint:Je,token_endpoint:Je,registration_endpoint:Je.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),service_documentation:Je.optional(),revocation_endpoint:Je.optional(),revocation_endpoint_auth_methods_supported:n(e()).optional(),revocation_endpoint_auth_signing_alg_values_supported:n(e()).optional(),introspection_endpoint:e().optional(),introspection_endpoint_auth_methods_supported:n(e()).optional(),introspection_endpoint_auth_signing_alg_values_supported:n(e()).optional(),code_challenge_methods_supported:n(e()).optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0),dpop_signing_alg_values_supported:n(e()).optional()}),Ka=u({issuer:e(),authorization_endpoint:Je,token_endpoint:Je,userinfo_endpoint:Je.optional(),jwks_uri:Je,registration_endpoint:Je.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),acr_values_supported:n(e()).optional(),subject_types_supported:n(e()),id_token_signing_alg_values_supported:n(e()),id_token_encryption_alg_values_supported:n(e()).optional(),id_token_encryption_enc_values_supported:n(e()).optional(),userinfo_signing_alg_values_supported:n(e()).optional(),userinfo_encryption_alg_values_supported:n(e()).optional(),userinfo_encryption_enc_values_supported:n(e()).optional(),request_object_signing_alg_values_supported:n(e()).optional(),request_object_encryption_alg_values_supported:n(e()).optional(),request_object_encryption_enc_values_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),display_values_supported:n(e()).optional(),claim_types_supported:n(e()).optional(),claims_supported:n(e()).optional(),service_documentation:e().optional(),claims_locales_supported:n(e()).optional(),ui_locales_supported:n(e()).optional(),claims_parameter_supported:i().optional(),request_parameter_supported:i().optional(),request_uri_parameter_supported:i().optional(),require_request_uri_registration:i().optional(),op_policy_uri:Je.optional(),op_tos_uri:Je.optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0)}),Gn=t({...Ka.shape,...Ja.pick({code_challenge_methods_supported:!0}).shape}),Wn=t({access_token:e(),id_token:e().optional(),token_type:e(),expires_in:Kl().optional(),scope:e().optional(),refresh_token:e().optional(),issuer:e().optional().catch(void 0)}).strip(),Yn=t({issued_token_type:r("urn:ietf:params:oauth:token-type:id-jag"),access_token:e(),token_type:e().optional(),expires_in:o().optional(),scope:e().optional()}).strip(),Xn=t({error:e(),error_description:e().optional(),error_uri:e().optional()}),wn=Je.optional().or(r("").transform(()=>{return})),Ga=t({redirect_uris:n(Je),token_endpoint_auth_method:e().optional(),grant_types:n(e()).optional(),response_types:n(e()).optional(),application_type:e().optional(),client_name:e().optional(),client_uri:Je.optional(),logo_uri:wn,scope:e().optional(),contacts:n(e()).optional(),tos_uri:wn,policy_uri:e().optional(),jwks_uri:Je.optional(),jwks:me().optional(),software_id:e().optional(),software_version:e().optional(),software_statement:e().optional()}).strip(),Wa=t({client_id:e(),client_secret:e().optional(),client_id_issued_at:o().optional(),client_secret_expires_at:o().optional(),issuer:e().optional().catch(void 0)}).strip(),Zn=Ga.merge(Wa),Qn=t({error:e(),error_description:e().optional()}).strip(),ei=t({token:e(),token_type_hint:e().optional()}).strip();var oi=Symbol.for("mcp.sdk.errorBrands");function ci(m,h){let p=new Set,f=h;while(typeof f==="function"){let g=f.mcpBrand;if(Object.prototype.hasOwnProperty.call(f,"mcpBrand")&&typeof g==="string")p.add(g);f=Object.getPrototypeOf(f)}if(p.size===0)return;Object.defineProperty(m,oi,{value:p,enumerable:!1,configurable:!0})}function Er(m,h){try{if(typeof h==="object"&&h!==null&&Object.prototype.hasOwnProperty.call(m,"mcpBrand")&&typeof m.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(h,oi)){let p=h[oi];if(p&&typeof p.has==="function"&&p.has(m.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(m,h)}var yc=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](h){return Er(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Er(this,h)}constructor(h,p,f){super(p);this.code=h,this.errorUri=f,this.name="OAuthError",ci(this,new.target)}toResponseObject(){let h={error:this.code,error_description:this.message};if(this.errorUri)h.error_uri=this.errorUri;return h}static fromResponse(h){return new m(h.error,h.error_description??h.error,h.error_uri)}},Pe=function(m){return m.NotConnected="NOT_CONNECTED",m.AlreadyConnected="ALREADY_CONNECTED",m.NotInitialized="NOT_INITIALIZED",m.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",m.RequestTimeout="REQUEST_TIMEOUT",m.ConnectionClosed="CONNECTION_CLOSED",m.SendFailed="SEND_FAILED",m.InvalidResult="INVALID_RESULT",m.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",m.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",m.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",m.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",m.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",m.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",m.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",m.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",m.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",m.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",m.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",m}({}),we=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](m){return Er(this,m)}static isInstance(m){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Er(this,m)}constructor(m,h,p,f){super(h,f);this.code=m,this.data=p,this.name="SdkError",ci(this,new.target)}},Ql=class extends we{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(m,h,p,f){super(m,h,p,f);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function oc(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function eu(m,h,p){return m==="elicitation"&&h==="form"&&p.form===void 0&&p.url===void 0}function vc(m){switch(m.method){case"elicitation/create":if(m.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let h=m.params;if(h!==void 0&&(h.tools!==void 0||h.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function sn(m,h){let p={};for(let[f,g]of Object.entries(m)){if(g===void 0)continue;let v=h===void 0?void 0:h[f];if(v===void 0){p[f]=g;continue}if(oc(g)&&oc(v)){let y={};for(let[_,S]of Object.entries(g))if(S!==void 0&&v[_]===void 0&&!eu(f,_,v))y[_]=S;if(Object.keys(y).length>0)p[f]=y}}return Object.keys(p).length>0?p:void 0}var _c="2026-07-28",Mt=[_c];function Pr(m){return m>=_c}function bc(m){return m.filter((h)=>!Pr(h))}function li(m){return m.filter((h)=>Pr(h))}function Rc(m){let h=m.structuredContent;if(h===void 0)return m;if(!(typeof h!=="object"||h===null||Array.isArray(h)))return m;if(m.content?.some((p)=>p.type==="text")??!1)return m;return{...m,content:[...m.content??[],{type:"text",text:JSON.stringify(h)}]}}var zc=["task","inputRequests","requestState"];function ui(m){if(m===null||typeof m!=="object"||Array.isArray(m)||m.content!==void 0||zc.some((h)=>(h in m)))return m;return{...m,content:[]}}function tu(){let m=D(()=>a([e(),o(),i(),P(),s(e(),m),n(m)])),h=s(e(),m),p=a([e(),o().int()]),f=e(),g=t({ttl:o().optional()}),v=t({taskId:e()}),y=u({progressToken:p.optional(),"io.modelcontextprotocol/related-task":v.optional()}),_=t({_meta:y.optional()}),S=_.extend({task:g.optional()}),z=t({method:e(),params:_.loose().optional()}),O=t({_meta:y.optional()}),k=t({method:e(),params:O.loose().optional()}),F=u({_meta:y.optional()}),B=a([e(),o().int()]),T=F.strict(),M=O.extend({requestId:B.optional(),reason:e().optional()}),N=k.extend({method:r("notifications/cancelled"),params:M}),b=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:d(["light","dark"]).optional()}),V=t({icons:n(b).optional()}),E=t({name:e(),title:e().optional()}),H=E.extend({...E.shape,...V.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),K=C(t({applyDefaults:i().optional()}),h),L=I((Ye)=>{if(Ye&&typeof Ye==="object"&&!Array.isArray(Ye)&&Object.keys(Ye).length===0)return{form:{}};return Ye},C(t({form:K.optional(),url:h.optional()}),h.optional())),j=u({list:h.optional(),cancel:h.optional(),requests:u({sampling:u({createMessage:h.optional()}).optional(),elicitation:u({create:h.optional()}).optional()}).optional()}),U=u({list:h.optional(),cancel:h.optional(),requests:u({tools:u({call:h.optional()}).optional()}).optional()}),Q=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:L.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:j.optional(),extensions:s(e(),h).optional()}),ne=_.extend({protocolVersion:e(),capabilities:Q,clientInfo:H}),ee=z.extend({method:r("initialize"),params:ne}),ie=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:U.optional(),extensions:s(e(),h).optional()}),Se=F.extend({protocolVersion:e(),capabilities:ie,serverInfo:H,instructions:e().optional()}),ye=k.extend({method:r("notifications/initialized"),params:O.optional()}),Ce=z.extend({method:r("ping"),params:_.optional()}),Ne=t({progress:o(),total:l(o()),message:l(e())}),je=t({...O.shape,...Ne.shape,progressToken:p}),He=k.extend({method:r("notifications/progress"),params:je}),qe=_.extend({cursor:f.optional()}),Z=z.extend({params:qe.optional()}),re=F.extend({nextCursor:f.optional()}),he=t({uri:e(),mimeType:l(e()),_meta:s(e(),c()).optional()}),x=he.extend({text:e()}),W=e().refine((Ye)=>{try{return atob(Ye),!0}catch{return!1}},{message:"Invalid Base64 string"}),te=he.extend({blob:W}),ge=d(["user","assistant"]),_e=t({audience:n(ge).optional(),priority:o().min(0).max(1).optional(),lastModified:A({offset:!0}).optional()}),Te=t({...E.shape,...V.shape,uri:e(),description:l(e()),mimeType:l(e()),size:l(o()),annotations:_e.optional(),_meta:l(u({}))}),ze=t({...E.shape,...V.shape,uriTemplate:e(),description:l(e()),mimeType:l(e()),annotations:_e.optional(),_meta:l(u({}))}),ke=Z.extend({method:r("resources/list")}),Qe=re.extend({resources:n(Te)}),G=Z.extend({method:r("resources/templates/list")}),ae=re.extend({resourceTemplates:n(ze)}),ce=_.extend({uri:e()}),be=ce,Re=z.extend({method:r("resources/read"),params:be}),Ee=F.extend({contents:n(a([x,te]))}),Ve=k.extend({method:r("notifications/resources/list_changed"),params:O.optional()}),Fe=ce,Ge=z.extend({method:r("resources/subscribe"),params:Fe}),xe=ce,Me=z.extend({method:r("resources/unsubscribe"),params:xe}),ot=O.extend({uri:e()}),Be=k.extend({method:r("notifications/resources/updated"),params:ot}),ht=t({name:e(),description:l(e()),required:l(i())}),it=t({...E.shape,...V.shape,description:l(e()),arguments:l(n(ht)),_meta:l(u({}))}),pt=Z.extend({method:r("prompts/list")}),_t=re.extend({prompts:n(it)}),bt=_.extend({name:e(),arguments:s(e(),e()).optional()}),Lt=z.extend({method:r("prompts/get"),params:bt}),Dt=t({type:r("text"),text:e(),annotations:_e.optional(),_meta:s(e(),c()).optional()}),Vt=t({type:r("image"),data:W,mimeType:e(),annotations:_e.optional(),_meta:s(e(),c()).optional()}),Ut=t({type:r("audio"),data:W,mimeType:e(),annotations:_e.optional(),_meta:s(e(),c()).optional()}),jr=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),c()),_meta:s(e(),c()).optional()}),Rt=t({type:r("resource"),resource:a([x,te]),annotations:_e.optional(),_meta:s(e(),c()).optional()}),kr=Te.extend({type:r("resource_link")}),at=a([Dt,Vt,Ut,kr,Rt]),rr=t({role:ge,content:at}),sr=F.extend({description:e().optional(),messages:n(rr)}),Ht=k.extend({method:r("notifications/prompts/list_changed"),params:O.optional()}),Or=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),or=t({taskSupport:d(["required","optional","forbidden"]).optional()}),xt=t({...E.shape,...V.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(c()),outputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(c()).optional(),annotations:Or.optional(),execution:or.optional(),_meta:s(e(),c()).optional()}),ar=Z.extend({method:r("tools/list")}),nr=re.extend({tools:n(xt)}),ir=F.extend({content:n(at),structuredContent:s(e(),c()).optional(),isError:i().optional()}),We=S.extend({name:e(),arguments:s(e(),c()).optional()}),Nr=z.extend({method:r("tools/call"),params:We}),xs=k.extend({method:r("notifications/tools/list_changed"),params:O.optional()}),cr=d(["debug","info","notice","warning","error","critical","alert","emergency"]),Mr=_.extend({level:cr}),Ar=z.extend({method:r("logging/setLevel"),params:Mr}),Lr=O.extend({level:cr,logger:e().optional(),data:c()}),Dr=k.extend({method:r("notifications/message"),params:Lr}),Vr=t({name:e().optional()}),Ur=t({hints:n(Vr).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Hr=t({mode:d(["auto","required","none"]).optional()}),Fs=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n(at),structuredContent:t({}).loose().optional(),isError:i().optional(),_meta:s(e(),c()).optional()}),xr=R("type",[Dt,Vt,Ut]),zt=R("type",[Dt,Vt,Ut,jr,Fs]),Fr=t({role:ge,content:a([zt,n(zt)]),_meta:s(e(),c()).optional()}),Br=S.extend({messages:n(Fr),modelPreferences:Ur.optional(),systemPrompt:e().optional(),includeContext:d(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(xt).optional(),toolChoice:Hr.optional()}),Jr=z.extend({method:r("sampling/createMessage"),params:Br}),Kr=F.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens"]).or(e())),role:ge,content:xr}),Gr=F.extend({model:e(),stopReason:l(d(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:ge,content:a([zt,n(zt)])}),Wr=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),Yr=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:d(["email","uri","date","date-time"]).optional(),default:e().optional()}),Xr=t({type:d(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Zr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),Qr=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),es=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),ts=a([Zr,Qr]),Ft=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),Bt=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),Bs=a([Ft,Bt]),Js=a([es,ts,Bs]),rt=a([Js,Wr,Yr,Xr]),st=S.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),rt),required:n(e()).optional()}).catchall(c())}),rs=S.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),ct=a([st,rs]),Ks=z.extend({method:r("elicitation/create"),params:ct}),Gs=O.extend({elicitationId:e()}),Ws=k.extend({method:r("notifications/elicitation/complete"),params:Gs}),Ys=F.extend({action:d(["accept","decline","cancel"]),content:I((Ye)=>Ye===null?void 0:Ye,s(e(),a([e(),o(),i(),n(e())])).optional())}),Xs=t({type:r("ref/resource"),uri:e()}),Zs=t({type:r("ref/prompt"),name:e()}),Qs=_.extend({ref:a([Zs,Xs]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),ss=z.extend({method:r("completion/complete"),params:Qs}),eo=F.extend({completion:u({values:n(e()).max(100),total:l(o().int()),hasMore:l(i())})}),to=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),c()).optional()}),lr=z.extend({method:r("roots/list"),params:_.optional()}),os=F.extend({roots:n(to)}),ro=k.extend({method:r("notifications/roots/list_changed"),params:O.optional()}),so=u({ttl:o().optional(),pollInterval:o().optional()}),as=d(["working","input_required","completed","failed","cancelled"]),wt=t({taskId:e(),status:as,ttl:a([o(),P()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:l(o()),statusMessage:l(e())}),tt=F.extend({task:wt}),oo=O.merge(wt),Jt=k.extend({method:r("notifications/tasks/status"),params:oo}),ur=z.extend({method:r("tasks/get"),params:_.extend({taskId:e()})}),dr=F.merge(wt),mr=z.extend({method:r("tasks/result"),params:_.extend({taskId:e()})}),zn=F.loose(),et=Z.extend({method:r("tasks/list")}),Ue=re.extend({tasks:n(wt)}),Kt=z.extend({method:r("tasks/cancel"),params:_.extend({taskId:e()})});return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:p,CursorSchema:f,TaskMetadataSchema:g,RelatedTaskMetadataSchema:v,RequestMetaSchema:y,BaseRequestParamsSchema:_,TaskAugmentedRequestParamsSchema:S,RequestSchema:z,NotificationsParamsSchema:O,NotificationSchema:k,ResultSchema:F,RequestIdSchema:B,EmptyResultSchema:T,CancelledNotificationParamsSchema:M,CancelledNotificationSchema:N,IconSchema:b,IconsSchema:V,BaseMetadataSchema:E,ImplementationSchema:H,ClientTasksCapabilitySchema:j,ServerTasksCapabilitySchema:U,ClientCapabilitiesSchema:Q,InitializeRequestParamsSchema:ne,InitializeRequestSchema:ee,ServerCapabilitiesSchema:ie,InitializeResultSchema:Se,InitializedNotificationSchema:ye,PingRequestSchema:Ce,ProgressSchema:Ne,ProgressNotificationParamsSchema:je,ProgressNotificationSchema:He,PaginatedRequestParamsSchema:qe,PaginatedRequestSchema:Z,PaginatedResultSchema:re,ResourceContentsSchema:he,TextResourceContentsSchema:x,BlobResourceContentsSchema:te,RoleSchema:ge,AnnotationsSchema:_e,ResourceSchema:Te,ResourceTemplateSchema:ze,ListResourcesRequestSchema:ke,ListResourcesResultSchema:Qe,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:ae,ResourceRequestParamsSchema:ce,ReadResourceRequestParamsSchema:be,ReadResourceRequestSchema:Re,ReadResourceResultSchema:Ee,ResourceListChangedNotificationSchema:Ve,SubscribeRequestParamsSchema:Fe,SubscribeRequestSchema:Ge,UnsubscribeRequestParamsSchema:xe,UnsubscribeRequestSchema:Me,ResourceUpdatedNotificationParamsSchema:ot,ResourceUpdatedNotificationSchema:Be,PromptArgumentSchema:ht,PromptSchema:it,ListPromptsRequestSchema:pt,ListPromptsResultSchema:_t,GetPromptRequestParamsSchema:bt,GetPromptRequestSchema:Lt,TextContentSchema:Dt,ImageContentSchema:Vt,AudioContentSchema:Ut,ToolUseContentSchema:jr,EmbeddedResourceSchema:Rt,ResourceLinkSchema:kr,ContentBlockSchema:at,PromptMessageSchema:rr,GetPromptResultSchema:sr,PromptListChangedNotificationSchema:Ht,ToolAnnotationsSchema:Or,ToolExecutionSchema:or,ToolSchema:xt,ListToolsRequestSchema:ar,ListToolsResultSchema:nr,CallToolResultSchema:ir,CallToolRequestParamsSchema:We,CallToolRequestSchema:Nr,ToolListChangedNotificationSchema:xs,LoggingLevelSchema:cr,SetLevelRequestParamsSchema:Mr,SetLevelRequestSchema:Ar,LoggingMessageNotificationParamsSchema:Lr,LoggingMessageNotificationSchema:Dr,ModelHintSchema:Vr,ModelPreferencesSchema:Ur,ToolChoiceSchema:Hr,ToolResultContentSchema:Fs,SamplingContentSchema:xr,SamplingMessageContentBlockSchema:zt,SamplingMessageSchema:Fr,CreateMessageRequestParamsSchema:Br,CreateMessageRequestSchema:Jr,CreateMessageResultSchema:Kr,CreateMessageResultWithToolsSchema:Gr,BooleanSchemaSchema:Wr,StringSchemaSchema:Yr,NumberSchemaSchema:Xr,UntitledSingleSelectEnumSchemaSchema:Zr,TitledSingleSelectEnumSchemaSchema:Qr,LegacyTitledEnumSchemaSchema:es,SingleSelectEnumSchemaSchema:ts,UntitledMultiSelectEnumSchemaSchema:Ft,TitledMultiSelectEnumSchemaSchema:Bt,MultiSelectEnumSchemaSchema:Bs,EnumSchemaSchema:Js,PrimitiveSchemaDefinitionSchema:rt,ElicitRequestFormParamsSchema:st,ElicitRequestURLParamsSchema:rs,ElicitRequestParamsSchema:ct,ElicitRequestSchema:Ks,ElicitationCompleteNotificationParamsSchema:Gs,ElicitationCompleteNotificationSchema:Ws,ElicitResultSchema:Ys,ResourceTemplateReferenceSchema:Xs,PromptReferenceSchema:Zs,CompleteRequestParamsSchema:Qs,CompleteRequestSchema:ss,CompleteResultSchema:eo,RootSchema:to,ListRootsRequestSchema:lr,ListRootsResultSchema:os,RootsListChangedNotificationSchema:ro,TaskCreationParamsSchema:so,TaskStatusSchema:as,TaskSchema:wt,CreateTaskResultSchema:tt,TaskStatusNotificationParamsSchema:oo,TaskStatusNotificationSchema:Jt,GetTaskRequestSchema:ur,GetTaskResultSchema:dr,GetTaskPayloadRequestSchema:mr,GetTaskPayloadResultSchema:zn,ListTasksRequestSchema:et,ListTasksResultSchema:Ue,CancelTaskRequestSchema:Kt,CancelTaskResultSchema:F.merge(wt),ClientRequestSchema:a([Ce,ee,ss,Ar,Lt,pt,ke,G,Re,Ge,Me,Nr,ar,ur,mr,et,Kt]),ClientNotificationSchema:a([N,He,ye,ro,Jt]),ClientResultSchema:a([T,Kr,Gr,Ys,os,dr,Ue,tt]),ServerRequestSchema:a([Ce,Jr,Ks,lr,ur,mr,et,Kt]),ServerNotificationSchema:a([N,He,Dr,Be,Ve,xs,Ht,Jt,Ws]),ServerResultSchema:a([T,Se,eo,sr,_t,Qe,ae,Ee,ir,nr,dr,Ue,tt]),CallToolResultWireSchema:c().superRefine((Ye,Al)=>{if(typeof Ye!=="object"||Ye===null||Array.isArray(Ye)||Ye.content!==void 0)return;for(let Hi of zc)if(Hi in Ye){Al.addIssue({code:"custom",message:`content is required when the body carries '${Hi}' — another result family cannot default into an empty tools/call success`});return}}).transform(ui).pipe(ir)}}var ru;function wc(){return ru??=tu()}function $c(m){return m.type!=="object"}var su=new Set(["const","enum","default","examples"]),ou=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function ac(m){return m!==void 0&&!(typeof m==="string"&&m.startsWith("#"))}function au(m){let h=typeof m.$schema==="string"?m.$schema:void 0;if(ac(m.$id))return{...h!==void 0&&{$schema:h},type:"object",properties:{result:m},required:["result"]};let p=Bi(m.$schema)&&m.$recursiveAnchor!==!0,f=(g,v)=>{if(Array.isArray(g))return g.map((S)=>f(S,!1));if(g===null||typeof g!=="object")return g;if(!v&&ac(g.$id))return g;let y={},_=!1;for(let[S,z]of Object.entries(g))if(v)y[S]=f(z,!1);else if((S==="$ref"||S==="$dynamicRef")&&typeof z==="string")y[S]=z==="#"?"#/properties/result":z.startsWith("#/")?`#/properties/result${z.slice(1)}`:z;else if(S==="$recursiveRef"&&z==="#"&&p)_=!0;else if(su.has(S))y[S]=z;else if(ou.has(S))y[S]=f(z,!0);else y[S]=f(z,!1);if(_)if("$ref"in y)y.allOf=[...Array.isArray(y.allOf)?y.allOf:[],{$ref:"#/properties/result"}];else y.$ref="#/properties/result";return y};return{...h!==void 0&&{$schema:h},type:"object",properties:{result:f(m,!1)},required:["result"]}}var Ec={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},Tc={"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},nu={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},Ya;function di(){if(Ya)return Ya;let m=wc();return Ya={requestSchemas:{ping:m.PingRequestSchema,initialize:m.InitializeRequestSchema,"completion/complete":m.CompleteRequestSchema,"logging/setLevel":m.SetLevelRequestSchema,"prompts/get":m.GetPromptRequestSchema,"prompts/list":m.ListPromptsRequestSchema,"resources/list":m.ListResourcesRequestSchema,"resources/templates/list":m.ListResourceTemplatesRequestSchema,"resources/read":m.ReadResourceRequestSchema,"resources/subscribe":m.SubscribeRequestSchema,"resources/unsubscribe":m.UnsubscribeRequestSchema,"tools/call":m.CallToolRequestSchema,"tools/list":m.ListToolsRequestSchema,"tasks/get":m.GetTaskRequestSchema,"tasks/result":m.GetTaskPayloadRequestSchema,"tasks/list":m.ListTasksRequestSchema,"tasks/cancel":m.CancelTaskRequestSchema,"sampling/createMessage":m.CreateMessageRequestSchema,"elicitation/create":m.ElicitRequestSchema,"roots/list":m.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":m.CancelledNotificationSchema,"notifications/progress":m.ProgressNotificationSchema,"notifications/initialized":m.InitializedNotificationSchema,"notifications/roots/list_changed":m.RootsListChangedNotificationSchema,"notifications/tasks/status":m.TaskStatusNotificationSchema,"notifications/message":m.LoggingMessageNotificationSchema,"notifications/resources/updated":m.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":m.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":m.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":m.PromptListChangedNotificationSchema,"notifications/elicitation/complete":m.ElicitationCompleteNotificationSchema},resultSchemas:{ping:m.EmptyResultSchema,initialize:m.InitializeResultSchema,"completion/complete":m.CompleteResultSchema,"logging/setLevel":m.EmptyResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"resources/subscribe":m.EmptyResultSchema,"resources/unsubscribe":m.EmptyResultSchema,"tools/call":m.CallToolResultWireSchema,"tools/list":m.ListToolsResultSchema,"sampling/createMessage":m.CreateMessageResultWithToolsSchema,"elicitation/create":m.ElicitResultSchema,"roots/list":m.ListRootsResultSchema}},Ya}function Pc(m){return Object.prototype.hasOwnProperty.call(Ec,m)}function Cc(m){return Object.prototype.hasOwnProperty.call(Tc,m)}function iu(m){return Object.prototype.hasOwnProperty.call(nu,m)}function cu(m){return iu(m)?di().resultSchemas[m]:void 0}function lu(m){return Pc(m)?di().requestSchemas[m]:void 0}function uu(m){return Cc(m)?di().notificationSchemas[m]:void 0}var Oh=Object.keys(Ec),Nh=Object.keys(Tc);function ai(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Xa(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let p=m.safeParse(h);return p.success?{ok:!0,value:p.data}:{ok:!1,reason:"invalid",message:String(p.error)}}var nc={ok:!1,reason:"not-in-era"};function ic(m){return ai(m)&&ai(m.outputSchema)&&$c(m.outputSchema)}function cc(m){return m}var mi={era:"2025-11-25",hasRequestMethod:Pc,hasNotificationMethod:Cc,validateRequest:(m,h)=>Xa(lu(m),h),validateResult:(m,h)=>Xa(cu(m),h),validateNotification:(m,h)=>Xa(uu(m),h),hasInputRequestMethod:()=>!1,validateInputRequest:()=>nc,validateInputResponse:()=>nc,samplingResultVariant:(m,h)=>{let p=wc();return Xa(m?p.CreateMessageResultWithToolsSchema:p.CreateMessageResultSchema,h)},outboundEnvelope:(m)=>{return},validateEnvelopeMeta:(m)=>[],projectCallToolResult(m,h){let p=Rc(m),f=p.structuredContent;if(f===void 0)return p;let g=typeof f!=="object"||f===null||Array.isArray(f),v=h!==void 0&&$c(h);if(!g&&!v)return p;return{...p,structuredContent:{result:f}}},decodeResult(m,h){if(ai(h)&&"resultType"in h){let p={...h};return delete p.resultType,{kind:"complete",result:cc(p)}}return{kind:"complete",result:cc(h)}},encodeResult(m,h){if(m!=="tools/list")return h;let p=h.tools;if(!Array.isArray(p)||!p.some((f)=>ic(f)))return h;return{...h,tools:p.map((f)=>ic(f)?{...f,outputSchema:au(f.outputSchema)}:f)}},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope:(m)=>{return}};function du(){let m=D(()=>a([e(),o(),i(),P(),s(e(),m),n(m)])),h=s(e(),m),p=a([e(),o().int()]),f=e(),g=a([e(),o().int()]),v=d(["user","assistant"]),y=d(["debug","info","notice","warning","error","critical","alert","emergency"]),_=e().refine((Ue)=>{try{return atob(Ue),!0}catch{return!1}},{message:"Invalid Base64 string"}),S=t({ttl:o().optional()}),z=t({taskId:e()}),O=u({progressToken:p.optional(),"io.modelcontextprotocol/related-task":z.optional()}),k=t({_meta:O.optional()}),F=k.extend({task:S.optional()}),B=t({_meta:O.optional()}),T=t({method:e(),params:B.loose().optional()}),M=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:d(["light","dark"]).optional()}),N=t({icons:n(M).optional()}),b=t({name:e(),title:e().optional()}),V=b.extend({...b.shape,...N.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),E=C(t({applyDefaults:i().optional()}),h),H=I((Ue)=>{if(Ue&&typeof Ue==="object"&&!Array.isArray(Ue)&&Object.keys(Ue).length===0)return{form:{}};return Ue},C(t({form:E.optional(),url:h.optional()}),h.optional())),K=u({list:h.optional(),cancel:h.optional(),requests:u({sampling:u({createMessage:h.optional()}).optional(),elicitation:u({create:h.optional()}).optional()}).optional()}),L=u({list:h.optional(),cancel:h.optional(),requests:u({tools:u({call:h.optional()}).optional()}).optional()}),j=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:H.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:K.optional(),extensions:s(e(),h).optional()}),U=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:L.optional(),extensions:s(e(),h).optional()}),Q=t({progress:o(),total:l(o()),message:l(e())}),ne=t({...B.shape,...Q.shape,progressToken:p}),ee=T.extend({method:r("notifications/progress"),params:ne}),ie=B.extend({level:y,logger:e().optional(),data:c()}),Se=T.extend({method:r("notifications/message"),params:ie}),ye=t({uri:e(),mimeType:l(e()),_meta:s(e(),c()).optional()}),Ce=ye.extend({text:e()}),Ne=ye.extend({blob:_}),je=t({audience:n(v).optional(),priority:o().min(0).max(1).optional(),lastModified:A({offset:!0}).optional()}),He=t({...b.shape,...N.shape,uri:e(),description:l(e()),mimeType:l(e()),size:l(o()),annotations:je.optional(),_meta:l(u({}))}),qe=t({...b.shape,...N.shape,uriTemplate:e(),description:l(e()),mimeType:l(e()),annotations:je.optional(),_meta:l(u({}))}),Z=T.extend({method:r("notifications/resources/list_changed"),params:B.optional()}),re=B.extend({uri:e()}),he=T.extend({method:r("notifications/resources/updated"),params:re}),x=t({name:e(),description:l(e()),required:l(i())}),W=t({...b.shape,...N.shape,description:l(e()),arguments:l(n(x)),_meta:l(u({}))}),te=T.extend({method:r("notifications/prompts/list_changed"),params:B.optional()}),ge=t({type:r("text"),text:e(),annotations:je.optional(),_meta:s(e(),c()).optional()}),_e=t({type:r("image"),data:_,mimeType:e(),annotations:je.optional(),_meta:s(e(),c()).optional()}),Te=t({type:r("audio"),data:_,mimeType:e(),annotations:je.optional(),_meta:s(e(),c()).optional()}),ze=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),c()),_meta:s(e(),c()).optional()}),ke=t({type:r("resource"),resource:a([Ce,Ne]),annotations:je.optional(),_meta:s(e(),c()).optional()}),Qe=He.extend({type:r("resource_link")}),G=a([ge,_e,Te,Qe,ke]),ae=t({role:v,content:G}),ce=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),be=T.extend({method:r("notifications/tools/list_changed"),params:B.optional()}),Re=t({name:e().optional()}),Ee=t({hints:n(Re).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Ve=t({mode:d(["auto","required","none"]).optional()}),Fe=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),Ge=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:d(["email","uri","date","date-time"]).optional(),default:e().optional()}),xe=t({type:d(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Me=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),ot=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),Be=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),ht=a([Me,ot]),it=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),pt=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),_t=a([it,pt]),bt=a([Be,ht,_t]),Lt=a([bt,Fe,Ge,xe]),Dt=F.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),Lt),required:n(e()).optional()}).catchall(c())}),Vt=t({type:r("ref/resource"),uri:e()}),Ut=t({type:r("ref/prompt"),name:e()}),jr=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),c()).optional()}),Rt=j.shape,kr=t({experimental:Rt.experimental,sampling:Rt.sampling,elicitation:Rt.elicitation,roots:Rt.roots,extensions:Rt.extensions}),at=U.shape,rr=t({experimental:at.experimental,logging:at.logging,completions:at.completions,prompts:at.prompts,resources:at.resources,tools:at.tools,extensions:at.extensions}),sr=u({progressToken:p.optional(),[gt]:e(),[hr]:V.optional(),[St]:kr,[Et]:y.optional()}),Ht=t({...b.shape,...N.shape,description:e().optional(),inputSchema:u({$schema:e().optional(),type:r("object")}),outputSchema:u({$schema:e().optional()}).optional(),annotations:ce.optional(),_meta:s(e(),c()).optional()}),Or=t({type:r("tool_result"),toolUseId:e(),content:n(G),structuredContent:c().optional(),isError:i().optional(),_meta:s(e(),c()).optional()}),or=a([ge,_e,Te,ze,Or]),xt=t({role:v,content:a([or,n(or)]),_meta:s(e(),c()).optional()}),ar=e(),nr=u({[mt]:V.optional().catch(void 0)}),ir=nr.optional();function We(Ue){return u({_meta:ir,resultType:ar.default("complete"),...Ue})}let Nr=We({}),xs=We({nextCursor:f.optional()}),cr=We({content:n(G),structuredContent:c().optional(),isError:i().optional()}),Mr=We({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),tools:n(Ht),nextCursor:f.optional()}),Ar=We({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),prompts:n(W),nextCursor:f.optional()}),Lr=We({description:e().optional(),messages:n(ae)}),Dr=We({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resources:n(He),nextCursor:f.optional()}),Vr=We({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resourceTemplates:n(qe),nextCursor:f.optional()}),Ur=We({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),contents:n(a([Ce,Ne]))}),Hr=We({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),Fs=We({ttlMs:o().int().min(0),cacheScope:d(["public","private"])}),xr=We({ttlMs:o().int().min(0).catch(0),cacheScope:d(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:rr,instructions:e().optional()}),zt=t({messages:n(xt),modelPreferences:Ee.optional(),systemPrompt:e().optional(),includeContext:d(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(Ht).optional(),toolChoice:Ve.optional()}),Fr=t({method:r("sampling/createMessage"),params:zt}),Br=t({method:r("roots/list"),params:t({_meta:s(e(),c()).optional()}).optional()}),Jr=t({...xt.shape,model:e(),stopReason:e().optional()}),Kr=t({roots:n(jr)}),Gr=t({action:d(["accept","decline","cancel"]),content:s(e(),a([e(),o(),i(),n(e())])).optional()}),Wr=t({mode:r("url"),message:e(),url:e().url()}),Yr=a([Dt,Wr]),Xr=t({method:r("elicitation/create"),params:Yr}),Zr=a([Fr,Br,Xr]),Qr=a([Jr,Kr,Gr]),es=s(e(),Zr),ts=s(e(),Qr),Ft=We({inputRequests:es.optional(),requestState:e().optional()}),Bt={inputResponses:ts.optional(),requestState:e().optional()},Bs=t({_meta:sr,...Bt}),Js=u({progressToken:p.optional()});function rt(Ue,Kt){return t({method:r(Ue),params:t({_meta:sr,...Kt})})}function st(Ue,Kt){return t({method:r(Ue),params:t({_meta:Js.optional(),...Kt}).optional()})}let rs={name:e(),arguments:s(e(),c()).optional(),...Bt},ct={cursor:f.optional()},Ks=rt("tools/call",rs),Gs=rt("tools/list",ct),Ws=rt("prompts/list",ct),Ys=rt("prompts/get",{name:e(),arguments:s(e(),e()).optional(),...Bt}),Xs=rt("resources/list",ct),Zs=rt("resources/templates/list",ct),Qs=rt("resources/read",{uri:e(),...Bt}),ss={ref:a([Ut,Vt]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()},eo=rt("completion/complete",ss),to=rt("server/discover",{}),lr=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:n(e()).optional()}),os={notifications:lr},ro=rt("subscriptions/listen",os),so=nr.extend({"io.modelcontextprotocol/subscriptionId":g}),as=u({_meta:so,resultType:ar.default("complete")}),wt={"tools/call":st("tools/call",rs),"tools/list":st("tools/list",ct),"prompts/get":st("prompts/get",{name:e(),arguments:s(e(),e()).optional()}),"prompts/list":st("prompts/list",ct),"resources/list":st("resources/list",ct),"resources/templates/list":st("resources/templates/list",ct),"resources/read":st("resources/read",{uri:e()}),"completion/complete":st("completion/complete",ss),"server/discover":st("server/discover",{}),"subscriptions/listen":st("subscriptions/listen",os)};function tt(Ue){return u({_meta:ir,...Ue})}let oo={"tools/call":tt({content:n(G),structuredContent:c().optional(),isError:i().optional()}),"tools/list":tt({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),tools:n(Ht),nextCursor:f.optional()}),"prompts/get":tt({description:e().optional(),messages:n(ae)}),"prompts/list":tt({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),prompts:n(W),nextCursor:f.optional()}),"resources/list":tt({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resources:n(He),nextCursor:f.optional()}),"resources/templates/list":tt({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),resourceTemplates:n(qe),nextCursor:f.optional()}),"resources/read":tt({ttlMs:o().int().min(0),cacheScope:d(["public","private"]),contents:n(a([Ce,Ne]))}),"completion/complete":tt({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),"server/discover":tt({ttlMs:o().int().min(0).catch(0),cacheScope:d(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:rr,instructions:e().optional()}),"subscriptions/listen":tt({})},Jt=u({"io.modelcontextprotocol/subscriptionId":g.optional()}),ur=t({method:r("notifications/subscriptions/acknowledged"),params:t({_meta:Jt.optional(),notifications:lr})}),dr=t({_meta:Jt.optional(),requestId:g,reason:e().optional()}),mr=t({method:r("notifications/cancelled"),params:dr}),zn={"notifications/cancelled":mr,"notifications/progress":ee,"notifications/message":Se,"notifications/resources/updated":he,"notifications/resources/list_changed":Z,"notifications/tools/list_changed":be,"notifications/prompts/list_changed":te,"notifications/subscriptions/acknowledged":ur},et=(Ue)=>t({jsonrpc:r("2.0"),id:a([e(),o().int()]),result:Ue}).strict();return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:p,CursorSchema:f,RequestIdSchema:g,RoleSchema:v,LoggingLevelSchema:y,TaskMetadataSchema:S,RelatedTaskMetadataSchema:z,RequestMetaSchema:O,BaseRequestParamsSchema:k,TaskAugmentedRequestParamsSchema:F,NotificationsParamsSchema:B,NotificationSchema:T,IconSchema:M,IconsSchema:N,BaseMetadataSchema:b,ImplementationSchema:V,ClientTasksCapabilitySchema:K,ServerTasksCapabilitySchema:L,ClientCapabilitiesSchema:j,ServerCapabilitiesSchema:U,ProgressSchema:Q,ProgressNotificationParamsSchema:ne,ProgressNotificationSchema:ee,LoggingMessageNotificationParamsSchema:ie,LoggingMessageNotificationSchema:Se,ResourceContentsSchema:ye,TextResourceContentsSchema:Ce,BlobResourceContentsSchema:Ne,AnnotationsSchema:je,ResourceSchema:He,ResourceTemplateSchema:qe,ResourceListChangedNotificationSchema:Z,ResourceUpdatedNotificationParamsSchema:re,ResourceUpdatedNotificationSchema:he,PromptArgumentSchema:x,PromptSchema:W,PromptListChangedNotificationSchema:te,TextContentSchema:ge,ImageContentSchema:_e,AudioContentSchema:Te,ToolUseContentSchema:ze,EmbeddedResourceSchema:ke,ResourceLinkSchema:Qe,ContentBlockSchema:G,PromptMessageSchema:ae,ToolAnnotationsSchema:ce,ToolListChangedNotificationSchema:be,ModelHintSchema:Re,ModelPreferencesSchema:Ee,ToolChoiceSchema:Ve,BooleanSchemaSchema:Fe,StringSchemaSchema:Ge,NumberSchemaSchema:xe,UntitledSingleSelectEnumSchemaSchema:Me,TitledSingleSelectEnumSchemaSchema:ot,LegacyTitledEnumSchemaSchema:Be,SingleSelectEnumSchemaSchema:ht,UntitledMultiSelectEnumSchemaSchema:it,TitledMultiSelectEnumSchemaSchema:pt,MultiSelectEnumSchemaSchema:_t,EnumSchemaSchema:bt,PrimitiveSchemaDefinitionSchema:Lt,ElicitRequestFormParamsSchema:Dt,ResourceTemplateReferenceSchema:Vt,PromptReferenceSchema:Ut,RootSchema:jr,ClientCapabilities2026Schema:kr,ServerCapabilities2026Schema:rr,RequestMetaEnvelopeSchema:sr,ToolSchema:Ht,ToolResultContentSchema:Or,SamplingMessageContentBlockSchema:or,SamplingMessageSchema:xt,ResultTypeSchema:ar,ResultMetaSchema:nr,ResultSchema:Nr,PaginatedResultSchema:xs,CallToolResultSchema:cr,ListToolsResultSchema:Mr,ListPromptsResultSchema:Ar,GetPromptResultSchema:Lr,ListResourcesResultSchema:Dr,ListResourceTemplatesResultSchema:Vr,ReadResourceResultSchema:Ur,CompleteResultSchema:Hr,CacheableResultSchema:Fs,DiscoverResultSchema:xr,CreateMessageRequestParamsSchema:zt,CreateMessageRequestSchema:Fr,ListRootsRequestSchema:Br,CreateMessageResultSchema:Jr,ListRootsResultSchema:Kr,ElicitResultSchema:Gr,ElicitRequestURLParamsSchema:Wr,ElicitRequestParamsSchema:Yr,ElicitRequestSchema:Xr,InputRequestSchema:Zr,InputResponseSchema:Qr,InputRequestsSchema:es,InputResponsesSchema:ts,InputRequiredResultSchema:Ft,InputResponseRequestParamsSchema:Bs,CallToolRequestSchema:Ks,ListToolsRequestSchema:Gs,ListPromptsRequestSchema:Ws,GetPromptRequestSchema:Ys,ListResourcesRequestSchema:Xs,ListResourceTemplatesRequestSchema:Zs,ReadResourceRequestSchema:Qs,CompleteRequestSchema:eo,DiscoverRequestSchema:to,SubscriptionFilterSchema:lr,SubscriptionsListenRequestSchema:ro,SubscriptionsListenResultMetaSchema:so,SubscriptionsListenResultSchema:as,dispatchRequestSchemas:wt,dispatchResultSchemas:oo,NotificationMetaSchema:Jt,SubscriptionsAcknowledgedNotificationSchema:ur,CancelledNotificationParamsSchema:dr,CancelledNotificationSchema:mr,notificationSchemas2026:zn,JSONRPCResultResponseSchema:et(Nr),CallToolResultResponseSchema:et(a([cr,Ft])),ListToolsResultResponseSchema:et(Mr),ListPromptsResultResponseSchema:et(Ar),GetPromptResultResponseSchema:et(a([Lr,Ft])),ListResourcesResultResponseSchema:et(Dr),ListResourceTemplatesResultResponseSchema:et(Vr),ReadResourceResultResponseSchema:et(a([Ur,Ft])),CompleteResultResponseSchema:et(Hr),DiscoverResultResponseSchema:et(xr),SubscriptionsListenResultResponseSchema:et(as)}}var mu;function Ot(){return mu??=du()}var hu=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function pu(m){return hu.includes(m)}var $r=Symbol("modelcontextprotocol.resultCacheHintFallback");function on(m,h){if(h===void 0)return m;let p=m[$r];if(p===void 0)return{...m,[$r]:h};let f={},g=p.ttlMs??h.ttlMs;if(g!==void 0)f.ttlMs=g;let v=p.cacheScope??h.cacheScope;if(v!==void 0)f.cacheScope=v;return{...m,[$r]:f}}function fu(m){return m[$r]}function hi(m){return typeof m==="number"&&Number.isSafeInteger(m)&&m>=0}function pi(m){return m==="public"||m==="private"}function fi(m,h){if(m.ttlMs!==void 0&&!hi(m.ttlMs))throw RangeError(`Invalid cache hint for ${h}: ttlMs must be a non-negative safe integer (got ${String(m.ttlMs)})`);if(m.cacheScope!==void 0&&!pi(m.cacheScope))throw RangeError(`Invalid cache hint for ${h}: cacheScope must be 'public' or 'private' (got ${String(m.cacheScope)})`)}var fe=function(m){return m[m.ParseError=-32700]="ParseError",m[m.InvalidRequest=-32600]="InvalidRequest",m[m.MethodNotFound=-32601]="MethodNotFound",m[m.InvalidParams=-32602]="InvalidParams",m[m.InternalError=-32603]="InternalError",m[m.ResourceNotFound=-32002]="ResourceNotFound",m[m.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",m[m.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",m[m.UrlElicitationRequired=-32042]="UrlElicitationRequired",m}({}),ve=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](h){return Er(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Er(this,h)}constructor(h,p,f){super(p);this.code=h,this.data=f,this.name="ProtocolError",ci(this,new.target)}static fromError(h,p,f){if(h===fe.UrlElicitationRequired&&f){let g=f;if(g.elicitations)return new qc(g.elicitations,p)}if(h===fe.UnsupportedProtocolVersion&&f){let g=f;if(Array.isArray(g.supported)&&typeof g.requested==="string")return new Cr({supported:g.supported,requested:g.requested},p)}if(h===fe.InvalidParams||h===fe.ResourceNotFound){let g=f;if(typeof g?.uri==="string"&&(h===fe.ResourceNotFound||Object.keys(g).length===1))return new an(g.uri,p)}if(h===fe.MissingRequiredClientCapability&&f){let g=f;if(g.requiredCapabilities!==null&&typeof g.requiredCapabilities==="object"&&!Array.isArray(g.requiredCapabilities))return new nn({requiredCapabilities:g.requiredCapabilities},p)}return new m(h,p,f)}},an=class extends ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(m,h=`Resource not found: ${m}`){super(fe.InvalidParams,h,{uri:m})}get uri(){return this.data.uri}},qc=class extends ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(m,h=`URL elicitation${m.length>1?"s":""} required`){super(fe.UrlElicitationRequired,h,{elicitations:m})}get elicitations(){return this.data?.elicitations??[]}},Cr=class extends ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(m,h=`Unsupported protocol version: ${m.requested}`){super(fe.UnsupportedProtocolVersion,h,m)}get supported(){return this.data.supported}get requested(){return this.data.requested}},nn=class extends ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(m,h=`Missing required client capabilities: ${Object.keys(m.requiredCapabilities).join(", ")}`){super(fe.MissingRequiredClientCapability,h,m)}get requiredCapabilities(){return this.data.requiredCapabilities}},gu=0,Su="private",yu=["tools/call","prompts/get","resources/read"];function vu(m,h){let p=h.resultType;if(p===void 0)return{...h,resultType:"complete"};if(p==="complete")return h;if(yu.includes(m))return h;throw new ve(fe.InternalError,`Handler for ${m} returned resultType '${String(p)}', but results of ${m} only support 'complete' on protocol revision 2026-07-28`)}function _u(m,h){let p=fu(h);if(h.resultType!=="complete"||!pu(m))return p===void 0?h:$u(h);let f=h,g=hi(f.ttlMs)?f.ttlMs:zu(p),v=pi(f.cacheScope)?f.cacheScope:wu(p),y={...f,ttlMs:g,cacheScope:v};return delete y[$r],y}function bu(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Ru(m,h){if(h===void 0)return m;let p=m._meta;if(p===void 0)return{...m,_meta:{[mt]:h}};if(!bu(p))return m;if(p[mt]!==void 0)return m;return{...m,_meta:{...p,[mt]:h}}}function zu(m){return m!==void 0&&hi(m.ttlMs)?m.ttlMs:gu}function wu(m){return m!==void 0&&pi(m.cacheScope)?m.cacheScope:Su}function $u(m){let h={...m};return delete h[$r],h}var Eu=["elicitation/create","sampling/createMessage","roots/list"],Za;function Ic(){if(Za)return Za;let m=Ot();return Za={request:{"elicitation/create":t({method:r("elicitation/create"),params:m.ElicitRequestParamsSchema}),"sampling/createMessage":t({method:r("sampling/createMessage"),params:m.CreateMessageRequestParamsSchema}),"roots/list":t({method:r("roots/list"),params:u({}).optional()})},response:{"elicitation/create":m.ElicitResultSchema,"sampling/createMessage":m.CreateMessageResultSchema,"roots/list":m.ListRootsResultSchema}},Za}function jc(m){return Eu.includes(m)}function ti(m){return jc(m)?Ic().request[m]:void 0}function Tu(m){return jc(m)?Ic().response[m]:void 0}var gi={"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},kc={"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 Oc(m){return Object.prototype.hasOwnProperty.call(gi,m)}function Nc(m){return Object.prototype.hasOwnProperty.call(kc,m)}function Pu(m){return Object.prototype.hasOwnProperty.call(gi,m)}function Cu(m){return Oc(m)?Ot().dispatchRequestSchemas[m]:void 0}function qu(m){return Pu(m)?Ot().dispatchResultSchemas[m]:void 0}function Iu(m){return Nc(m)?Ot().notificationSchemas2026[m]:void 0}var Mh=Object.keys(gi),Ah=Object.keys(kc);function Os(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function js(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let p=m.safeParse(h);return p.success?{ok:!0,value:p.data}:{ok:!1,reason:"invalid",message:String(p.error)}}var ju={ok:!1,reason:"not-in-era"},ku=[gt,St];function Ou(m,h){let p=h,f=!1,g=()=>{if(!f)p={...p},f=!0;return p},v=h.tools;if(m==="tools/list"&&Array.isArray(v)&&v.some((_)=>Os(_)&&("execution"in _)))g().tools=v.map((_)=>{if(!Os(_)||!("execution"in _))return _;let S={..._};return delete S.execution,S});let y=h.capabilities;if(Os(y)&&"tasks"in y){let _={...y};delete _.tasks,g().capabilities=_}return p}var Si={era:"2026-07-28",hasRequestMethod:Oc,hasNotificationMethod:Nc,hasInputRequestMethod:(m)=>ti(m)!==void 0,validateRequest:(m,h)=>js(Cu(m),h),validateResult:(m,h)=>js(qu(m),h),validateNotification:(m,h)=>js(Iu(m),h),validateInputRequest:(m,h)=>js(ti(m),h),validateInputResponse:(m,h)=>js(Tu(m),h),samplingResultVariant:()=>ju,outboundEnvelope(m){return{[gt]:m.protocolVersion,[hr]:m.clientInfo,[St]:m.clientCapabilities,...m.logLevel!==void 0&&{[Et]:m.logLevel}}},validateEnvelopeMeta(m){let h=[];for(let f of ku)if(!(f in m))h.push({key:f,problem:"missing"});let p=Ot().RequestMetaEnvelopeSchema.safeParse(m);if(!p.success)for(let f of p.error.issues){let g=f.path.map(String),v=g.length>0?g.join("."):"_meta";if(g.length===1&&h.some((y)=>y.key===v&&y.problem==="missing"))continue;h.push({key:v,problem:f.message})}return h},projectCallToolResult:(m)=>Rc(m),inputRequestSchema:ti,decodeResult(m,h){if(!Os(h))return{kind:"invalid",error:new we(Pe.InvalidResult,`Invalid result for ${m}: not an object`,{method:m})};let p=h.resultType;if(p===void 0)return{kind:"invalid",error:new we(Pe.InvalidResult,`Invalid result for ${m}: 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:m,violation:"missing-resultType"})};if(typeof p!=="string")return{kind:"invalid",error:new we(Pe.InvalidResult,`Invalid result for ${m}: non-string resultType`,{method:m,resultType:p})};if(p==="input_required"){let y=h.inputRequests,_=Os(y)?y:{},S=h.requestState,z=h._meta===void 0?void 0:Ot().ResultMetaSchema.safeParse(h._meta),O=z?.success?z.data:void 0;if(Object.keys(_).length===0&&typeof S!=="string")return{kind:"invalid",error:new we(Pe.InvalidResult,`Invalid result for ${m}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:m,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:_,...typeof S==="string"&&{requestState:S},...O!==void 0&&{_meta:O}}}if(p!=="complete")return{kind:"invalid",error:new we(Pe.UnsupportedResultType,`Unsupported result type '${p}' for ${m}`,{resultType:p,method:m})};let f=Nu(),g=Object.hasOwn(f,m)?f[m]:void 0;if(g!==void 0){let y=g.safeParse(h);if(!y.success)return{kind:"invalid",error:new we(Pe.InvalidResult,`Invalid result for ${m}: ${y.error}`,{method:m})}}let v={...h};return delete v.resultType,{kind:"complete",result:v}},encodeResult(m,h,p){return Ru(_u(m,vu(m,Ou(m,h))),p)},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope(m){if(m.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let h=Ot().RequestMetaEnvelopeSchema.safeParse(m.envelope);if(!h.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${h.error.issues.map((p)=>p.message).join("; ")}`}},Qa;function Nu(){if(Qa)return Qa;let m=Ot();return Qa={"tools/call":m.CallToolResultSchema,"tools/list":m.ListToolsResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"completion/complete":m.CompleteResultSchema,"server/discover":m.DiscoverResultSchema},Qa}var Ls="2026-07-28";function Nt(m){return m!==void 0&&Pr(m)?Si:mi}function lc(m){if(m.revision!==void 0)return Nt(m.revision).era;return m.era==="modern"?Si.era:mi.era}function ri(m){return Mc.some((h)=>h.hasRequestMethod(m))}function si(m){return Mc.some((h)=>h.hasNotificationMethod(m))}function uc(m){return m==="tasks/get"||m==="tasks/cancel"}var Mc=[mi,Si];function dc(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function er(m){if(!dc(m))return;let h=m._meta;return dc(h)?h:void 0}function cn(m){let h=er(m);return h!==void 0&> in h}function ln(m){let h=er(m)?.[gt];return typeof h==="string"?h:void 0}function un(m){return Nt(Ls).validateEnvelopeMeta(m)}var Mu=xi({AnnotationsSchema:()=>yt,AudioContentSchema:()=>_r,BaseMetadataSchema:()=>ft,BaseRequestParamsSchema:()=>Ke,BlobResourceContentsSchema:()=>_s,BooleanSchemaSchema:()=>$s,CallToolRequestParamsSchema:()=>la,CallToolRequestSchema:()=>ua,CallToolResultSchema:()=>ws,CancelTaskRequestSchema:()=>Dn,CancelTaskResultSchema:()=>Vn,CancelledNotificationParamsSchema:()=>mo,CancelledNotificationSchema:()=>ps,ClientCapabilitiesSchema:()=>go,ClientNotificationSchema:()=>Hn,ClientRequestSchema:()=>Un,ClientResultSchema:()=>xn,ClientTasksCapabilitySchema:()=>po,CompatibilityCallToolResultSchema:()=>Pn,CompleteRequestParamsSchema:()=>Aa,CompleteRequestSchema:()=>La,CompleteResultSchema:()=>Da,ContentBlockSchema:()=>br,CreateMessageRequestParamsSchema:()=>Ra,CreateMessageRequestSchema:()=>za,CreateMessageResultSchema:()=>wa,CreateMessageResultWithToolsSchema:()=>$a,CreateTaskResultSchema:()=>In,CursorSchema:()=>is,DiscoverRequestSchema:()=>bo,DiscoverResultSchema:()=>Ro,ElicitRequestFormParamsSchema:()=>wr,ElicitRequestParamsSchema:()=>qa,ElicitRequestSchema:()=>Ia,ElicitRequestURLParamsSchema:()=>Ca,ElicitResultSchema:()=>Oa,ElicitationCompleteNotificationParamsSchema:()=>ja,ElicitationCompleteNotificationSchema:()=>ka,EmbeddedResourceSchema:()=>ea,EmptyResultSchema:()=>hs,EnumSchemaSchema:()=>Pa,GetPromptRequestParamsSchema:()=>Xo,GetPromptRequestSchema:()=>Zo,GetPromptResultSchema:()=>sa,GetTaskPayloadRequestSchema:()=>Nn,GetTaskPayloadResultSchema:()=>Mn,GetTaskRequestSchema:()=>kn,GetTaskResultSchema:()=>On,IconSchema:()=>ho,IconsSchema:()=>Pt,ImageContentSchema:()=>vr,ImplementationSchema:()=>gr,InitializeRequestParamsSchema:()=>So,InitializeRequestSchema:()=>yo,InitializeResultSchema:()=>vo,InitializedNotificationSchema:()=>_o,JSONArraySchema:()=>$n,JSONObjectSchema:()=>Ae,JSONRPCErrorResponseSchema:()=>fr,JSONRPCMessageSchema:()=>ms,JSONRPCNotificationSchema:()=>ds,JSONRPCRequestSchema:()=>us,JSONRPCResponseSchema:()=>En,JSONRPCResultResponseSchema:()=>pr,JSONValueSchema:()=>$t,LegacyTitledEnumSchemaSchema:()=>Ps,ListChangedOptionsBaseSchema:()=>Cn,ListPromptsRequestSchema:()=>Wo,ListPromptsResultSchema:()=>Yo,ListResourceTemplatesRequestSchema:()=>Co,ListResourceTemplatesResultSchema:()=>qo,ListResourcesRequestSchema:()=>To,ListResourcesResultSchema:()=>Po,ListRootsRequestSchema:()=>Ua,ListRootsResultSchema:()=>Ha,ListTasksRequestSchema:()=>An,ListTasksResultSchema:()=>Ln,ListToolsRequestSchema:()=>ia,ListToolsResultSchema:()=>ca,LoggingLevelSchema:()=>jt,LoggingMessageNotificationParamsSchema:()=>pa,LoggingMessageNotificationSchema:()=>fa,ModelHintSchema:()=>ga,ModelPreferencesSchema:()=>Sa,MultiSelectEnumSchemaSchema:()=>Ta,NotificationSchema:()=>Ze,NotificationsParamsSchema:()=>Xe,NumberSchemaSchema:()=>zr,PaginatedRequestParamsSchema:()=>$o,PaginatedRequestSchema:()=>Ct,PaginatedResultSchema:()=>qt,PingRequestSchema:()=>gs,PrimitiveSchemaDefinitionSchema:()=>Is,ProgressNotificationParamsSchema:()=>wo,ProgressNotificationSchema:()=>Ss,ProgressSchema:()=>zo,ProgressTokenSchema:()=>ns,PromptArgumentSchema:()=>Ko,PromptListChangedNotificationSchema:()=>oa,PromptMessageSchema:()=>ra,PromptReferenceSchema:()=>Ma,PromptSchema:()=>Go,ReadResourceRequestParamsSchema:()=>Io,ReadResourceRequestSchema:()=>jo,ReadResourceResultSchema:()=>ko,RelatedTaskMetadataSchema:()=>uo,RequestIdSchema:()=>Tt,RequestMetaSchema:()=>cs,RequestSchema:()=>Le,ResourceContentsSchema:()=>ys,ResourceLinkSchema:()=>ta,ResourceListChangedNotificationSchema:()=>Oo,ResourceRequestParamsSchema:()=>Sr,ResourceSchema:()=>bs,ResourceTemplateReferenceSchema:()=>Na,ResourceTemplateSchema:()=>Eo,ResourceUpdatedNotificationParamsSchema:()=>Bo,ResourceUpdatedNotificationSchema:()=>Jo,ResultMetaObjectSchema:()=>ls,ResultSchema:()=>De,RoleSchema:()=>It,RootSchema:()=>Va,RootsListChangedNotificationSchema:()=>xa,SamplingContentSchema:()=>_a,SamplingMessageContentBlockSchema:()=>Gt,SamplingMessageSchema:()=>ba,ServerCapabilitiesSchema:()=>fs,ServerNotificationSchema:()=>Bn,ServerRequestSchema:()=>Fn,ServerResultSchema:()=>Jn,ServerTasksCapabilitySchema:()=>fo,SetLevelRequestParamsSchema:()=>ma,SetLevelRequestSchema:()=>ha,SingleSelectEnumSchemaSchema:()=>Ea,StringSchemaSchema:()=>Rr,SubscribeRequestParamsSchema:()=>No,SubscribeRequestSchema:()=>Mo,SubscriptionFilterSchema:()=>Rs,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Uo,SubscriptionsAcknowledgedNotificationSchema:()=>Ho,SubscriptionsListenRequestParamsSchema:()=>Do,SubscriptionsListenRequestSchema:()=>Vo,SubscriptionsListenResultMetaSchema:()=>xo,SubscriptionsListenResultSchema:()=>Fo,TaskAugmentedRequestParamsSchema:()=>Zt,TaskCreationParamsSchema:()=>qn,TaskMetadataSchema:()=>lo,TaskSchema:()=>kt,TaskStatusNotificationParamsSchema:()=>Ba,TaskStatusNotificationSchema:()=>jn,TaskStatusSchema:()=>Fa,TextContentSchema:()=>yr,TextResourceContentsSchema:()=>vs,TitledMultiSelectEnumSchemaSchema:()=>qs,TitledSingleSelectEnumSchemaSchema:()=>Ts,ToolAnnotationsSchema:()=>aa,ToolChoiceSchema:()=>ya,ToolExecutionSchema:()=>na,ToolListChangedNotificationSchema:()=>da,ToolResultContentSchema:()=>va,ToolSchema:()=>zs,ToolUseContentSchema:()=>Qo,UnsubscribeRequestParamsSchema:()=>Ao,UnsubscribeRequestSchema:()=>Lo,UntitledMultiSelectEnumSchemaSchema:()=>Cs,UntitledSingleSelectEnumSchemaSchema:()=>Es});var nt=(m)=>us.safeParse(m).success,At=(m)=>ds.safeParse(m).success,Ms=(m)=>pr.safeParse(m).success,dn=(m)=>fr.safeParse(m).success;var vt=(m)=>typeof m==="object"&&m!==null&&!Array.isArray(m)&&m.resultType==="input_required";function yi(m){if(m.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${m.params.ref.type}`)}function vi(m){if(m.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${m.params.ref.type}`)}var mc="x-mcp-header",Au=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Lu=new Set(["string","integer","boolean","number"]);function _i(m){let h=[],p=new Map,f=(v,y,_)=>{if(v===null||typeof v!=="object")return;let S=v;if(mc in S){if(!_||y.length===0)return`${en(y)}: 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=S[mc];if(typeof O!=="string"||O.length===0)return`${en(y)}: x-mcp-header MUST be a non-empty string`;if(!Au.test(O))return`${en(y)}: x-mcp-header '${O}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let k=typeof S.type==="string"?S.type:void 0;if(k===void 0||!Lu.has(k))return`${en(y)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${k??"<none>"}`;let F=O.toLowerCase(),B=p.get(F);if(B!==void 0)return`x-mcp-header '${O}' is not case-insensitively unique (also declared as '${B}')`;p.set(F,O),h.push({path:y,headerName:O,type:k})}let z=S.properties;if(z!==null&&typeof z==="object")for(let[O,k]of Object.entries(z)){let F=f(k,[...y,O],_);if(F!==void 0)return F}for(let O of Du){let k=S[O];if(k===void 0)continue;let F=Array.isArray(k)?k:k!==null&&typeof k==="object"&&Vu.has(O)?Object.values(k):[k];for(let B of F){let T=f(B,[...y,`<${O}>`],!1);if(T!==void 0)return T}}},g=f(m,[],!0);return g===void 0?{valid:!0,declarations:h}:{valid:!1,reason:g}}var Du=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Vu=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function en(m){return m.length===0?"<root>":m.join(".")}var rn=-32020,Lh=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[fe.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[rn,fe.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[fe.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[fe.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[fe.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[rn],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[fe.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[rn],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],Uu={[fe.ParseError]:400,[fe.InvalidRequest]:400,[fe.MethodNotFound]:404,[fe.UnsupportedProtocolVersion]:400,[fe.MissingRequiredClientCapability]:400,[rn]:400};function tn(m,h,p,f,g){return{kind:"reject",rung:m,cell:h,httpStatus:p,code:f.code,message:f.message,...f.data!==void 0&&{data:f.data},settled:g}}function bi(m){if(!cn(m))return!1;let h=ln(m);if(h===void 0||!Pr(h))return!1;let p=er(m);return p!==void 0&&un(p).length===0}function Ri(m,h){switch(m.reason){case"http-method":return tn("http-method","modern-only-method-not-allowed",405,new ve(-32000,"Method not allowed."),!0);case"batch":return tn("jsonrpc-shape","modern-only-batch-not-supported",400,new ve(fe.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return tn("jsonrpc-shape","modern-only-response-post",400,new ve(fe.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let p=m.requestedVersion;return tn("era-classification","modern-only-missing-envelope",400,p===void 0?new ve(fe.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...h]}):new Cr({supported:[...h],requested:p}),!0)}}}function mn(m,h){return J(m,h)}function ks(m){return new Set(m.flatMap((h)=>Object.keys(h.shape)))}function Tr(m){if(m==null)return!1;let h=typeof m;if(h!=="object"&&h!=="function")return!1;if(!("~standard"in m))return!1;return typeof m["~standard"]?.validate==="function"}var hc=!1,ni="draft-2020-12";function tr(m,h="input"){let p=m["~standard"],f;if(p.jsonSchema)f=p.jsonSchema[h]({target:ni});else if(p.vendor==="zod"){if(!("_zod"in m))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().");if(!hc)hc=!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.");f=oe(m,{target:ni,io:h})}else throw Error(`Schema library "${p.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(h==="output"){if(f.type!==void 0)return f;return Ac(f)?{type:"object",...f}:f}if(f.type!==void 0&&f.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(f.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...f}}function Ac(m){if("properties"in m||"patternProperties"in m||"additionalProperties"in m||"required"in m)return!0;for(let h of["oneOf","anyOf","allOf"]){let p=m[h];if(Array.isArray(p)&&p.length>0)return p.every((f)=>f!==null&&typeof f==="object"&&(f.type==="object"||Ac(f)))}return!1}function Hu(m){if(!m.path?.length)return m.message;return`${m.path.map((h)=>String(typeof h==="object"?h.key:h)).join(".")}: ${m.message}`}async function Qt(m,h){let p=await m["~standard"].validate(h);if(p.issues&&p.issues.length>0)return{success:!1,error:p.issues.map((f)=>Hu(f)).join(", ")};return{success:!0,data:p.value}}function xu(m){let h=oe(m,{target:ni,io:"input"});return typeof h.pattern==="string"?h.pattern:void 0}var Fu=/\\\.\\d\{(\d+)\}/;function Bu(m){let h=Fu.exec(m),p=[void 0,-1,0];if(h)p.push(Number(h[1]));return[!1,!0].flatMap((f)=>[!1,!0].flatMap((g)=>p.map((v)=>A({local:f,offset:g,precision:v}))))}function Ju(m,h){let p;switch(m){case"email":p=[pe()];break;case"uri":p=[Y()];break;case"date":p=[se()];break;case"date-time":p=Bu(h);break}return new Set(p.map((f)=>xu(f)).filter((f)=>f!==void 0))}function Ku(m,h,p){if(p!=="zod")return!0;return Ju(m,h).has(h)}function Lc(m){let h=tr(m,"input"),p=h.properties||{},f=h.required||[];return Object.entries(p).map(([g,v])=>({name:g,description:v?.description,required:f.includes(g)}))}function As(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Gu(m){try{return tr(m,"input")}catch(h){let p=h instanceof Error?h.message:String(h);throw new ve(fe.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${p}`)}}var Wu=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function zi(m){return Wu.has(m)||m.startsWith("x-")}var Yu=new Set(["$schema",...Object.keys(wr.shape.requestedSchema.shape)]),pc={string:ks([Rr,Es,Ts,Ps]),number:ks([zr]),integer:ks([zr]),boolean:ks([$s]),array:ks([Cs,qs])},Xu=new Set(Rr.shape.format.unwrap().options);function Zu(m,h,p,f){if(!As(m))return m;let g=typeof m.type==="string"&&Object.hasOwn(pc,m.type)?pc[m.type]:void 0;if(g===void 0)return m;let v={};for(let[y,_]of Object.entries(m))if(g.has(y)||zi(y))v[y]=_;else if(y==="pattern"&&m.type==="string"&&typeof m.format==="string"){if(!Xu.has(m.format))v[y]=_;else if(typeof _!=="string"||!Ku(m.format,_,p))f.push(`${h}.${y}`)}else f.push(`${h}.${y}`);return v}function Qu(m,h){let p={},f=[];for(let[g,v]of Object.entries(m))if(g==="properties"&&As(v))p[g]=Object.fromEntries(Object.entries(v).map(([y,_])=>[y,Zu(_,`properties.${y}`,h,f)]));else if(Yu.has(g))p[g]=v;else if(!zi(g))f.push(g);if(f.length>0)throw new ve(fe.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${f.join(", ")}`);return p}function ed(m,h){if(!As(m.properties))return h;let p=Object.entries(m.properties).filter(([,f])=>!mn(Is,f).success).map(([f])=>`properties.${f}`);return p.length>0?p.join(", "):h}function ii(m,h,p=""){if(Array.isArray(m)&&Array.isArray(h))return m.flatMap((f,g)=>ii(f,h[g],`${p}[${g}]`));if(!As(m)||!As(h))return[];return Object.entries(m).flatMap(([f,g])=>{let v=p?`${p}.${f}`:f;if(!Object.prototype.hasOwnProperty.call(h,f))return zi(f)?[]:[v];return ii(g,h[f],v)})}function td(m){if(!Tr(m.requestedSchema))return{...m,mode:"form",requestedSchema:m.requestedSchema};let h=m.requestedSchema["~standard"].vendor,p=Qu(Gu(m.requestedSchema),h),f=mn(wr.shape.requestedSchema,p);if(!f.success)throw new ve(fe.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${ed(p,f.error.message)}`);let g=ii(p,f.data);if(g.length>0)throw new ve(fe.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${g.join(", ")}`);let v=(f.data.required??[]).filter((y)=>!Object.prototype.hasOwnProperty.call(f.data.properties,y));if(v.length>0)throw new ve(fe.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${v.join(", ")}`);return{...m,mode:"form",requestedSchema:f.data}}function rd(m){let h=m.inputRequests!==void 0&&Object.keys(m.inputRequests).length>0,p=typeof m.requestState==="string";if(!h&&!p)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",...m.inputRequests!==void 0&&{inputRequests:m.inputRequests},...m.requestState!==void 0&&{requestState:m.requestState}}}var sd=Object.assign(rd,{elicit(m){try{return{method:"elicitation/create",params:td(m)}}catch(h){throw h instanceof ve?TypeError(h.message,{cause:h}):h}},elicitUrl(m){return{method:"elicitation/create",params:{...m,mode:"url"}}},createMessage(m){return{method:"sampling/createMessage",params:m}},listRoots(){return{method:"roots/list"}}});var Dc=250;function Vc(m,h){return`Multi-round-trip request '${m}' still required input after ${h} rounds (inputRequired.maxRounds)`}function Uc(m,h){return new Promise((p,f)=>{if(h?.aborted){f(h.reason instanceof we?h.reason:new we(Pe.RequestTimeout,String(h.reason)));return}let g=setTimeout(()=>{h?.removeEventListener("abort",v),p()},m),v=()=>{clearTimeout(g),f(h?.reason instanceof we?h.reason:new we(Pe.RequestTimeout,String(h?.reason)))};h?.addEventListener("abort",v,{once:!0})})}function Hc(m){let h=new AbortController,p=()=>h.abort(m?.reason);if(m?.addEventListener("abort",p,{once:!0}),m?.aborted)h.abort(m.reason);return{signal:h.signal,abort:(f)=>h.abort(f),dispose:()=>m?.removeEventListener("abort",p)}}var od=["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"],ad={IdJagTokenExchangeResponseSchema:Yn,OAuthClientInformationFullSchema:Zn,OAuthClientInformationSchema:Wa,OAuthClientMetadataSchema:Ga,OAuthClientRegistrationErrorSchema:Qn,OAuthErrorResponseSchema:Xn,OAuthMetadataSchema:Ja,OAuthProtectedResourceMetadataSchema:Kn,OAuthTokenRevocationRequestSchema:ei,OAuthTokensSchema:Wn,OpenIdProviderDiscoveryMetadataSchema:Gn,OpenIdProviderMetadataSchema:Ka},xc={},Fc={};function Bc(m,h){let p=m.slice(0,-6);xc[p]=h,Fc[p]=(f)=>h.safeParse(f).success}for(let m of od)Bc(m,Mu[m]);for(let[m,h]of Object.entries(ad))Bc(m,h);var nd=Object.freeze(xc),id=Object.freeze(Fc);function cd(m){switch(m){case"initialize":case"notifications/initialized":return Nt(void 0);case"server/discover":return Nt(Ls);default:return}}var Jc=60000,ld=[gt,hr,St,Et],ud=["inputResponses","requestState"];function fc(m,h){let p=m.params;if(!Ns(p))return{message:m,lifted:{}};let f=p._meta,g=Ns(f)?ld.filter((S)=>(S in f)):[],v=h==="request"?ud.filter((S)=>(S in p)):[];if(g.length===0&&v.length===0)return{message:m,lifted:{}};let y={},_={...p};if(g.length>0&&Ns(f)){let S={},z={...f};for(let O of g)S[O]=f[O],delete z[O];if(y.envelope=S,Object.keys(z).length>0)_._meta=z;else delete _._meta}for(let S of v){if(S==="inputResponses")y.inputResponses=_[S];if(S==="requestState")y.requestState=_[S];delete _[S]}return{message:{...m,params:_},lifted:y}}function gc(m,h){let p=m.validateResult(h,void 0);if(!p.ok&&p.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(f){let g=m.validateResult(h,f);if(g.ok)return{value:g.value};return{issues:[{message:g.reason==="invalid"?g.message:`not-in-era: ${h}`}]}}}}}function Ds(m){return()=>m}var dd=Ds(void 0);function wi(m,h){return{...m,mcpReq:{...m.mcpReq,requestState:Ds(h)}}}var Kc;function $i(m,h){Kc(m,h)}var Ei=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{Kc=(m,h)=>{m._negotiatedProtocolVersion=h}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(m){this._options=m,this._supportedProtocolVersions=m?.supportedProtocolVersions??io,this.setNotificationHandler("notifications/cancelled",(h)=>{this._oncancel(h)}),this.setNotificationHandler("notifications/progress",(h)=>{this._onprogress(h)}),this.setRequestHandler("ping",(h)=>({}))}_shouldDropInbound(m){}_outboundMetaEnvelope(){}_envelopeOutbound(m){let h=this._outboundMetaEnvelope();if(h===void 0)return m;let p=m.params??{};return{...m,params:{...p,_meta:{...h,...p._meta}}}}_resolveNonCompleteResult(m,h){return Promise.reject(new we(Pe.UnsupportedResultType,`Unsupported result type '${m.kind}' for ${h.request.method}`,{resultType:m.kind,method:h.request.method}))}_getRequestHandler(m){return this._requestHandlers.get(m)}async _oncancel(m){if(m.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(m.params.requestId)?.abort(m.params.reason)}_setupTimeout(m,h,p,f,g=!1){this._timeoutInfo.set(m,{timeoutId:setTimeout(f,h),startTime:Date.now(),timeout:h,maxTotalTimeout:p,resetTimeoutOnProgress:g,onTimeout:f})}_resetTimeout(m){let h=this._timeoutInfo.get(m);if(!h)return!1;let p=Date.now()-h.startTime;if(h.maxTotalTimeout&&p>=h.maxTotalTimeout)throw this._timeoutInfo.delete(m),new we(Pe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:h.maxTotalTimeout,totalElapsed:p});return clearTimeout(h.timeoutId),h.timeoutId=setTimeout(h.onTimeout,h.timeout),!0}_cleanupTimeout(m){let h=this._timeoutInfo.get(m);if(h)clearTimeout(h.timeoutId),this._timeoutInfo.delete(m)}async connect(m){this._transport=m;let h=this.transport?.onclose;this._transport.onclose=()=>{try{h?.()}finally{this._onclose()}};let p=this.transport?.onerror;this._transport.onerror=(g)=>{p?.(g),this._onerror(g)};let f=this._transport?.onmessage;this._transport.onmessage=(g,v)=>{if(f?.(g,v),Ms(g)||dn(g))this._onresponse(g);else if(nt(g))this._onrequest(g,v);else if(At(g))this._onnotification(g,v);else this._onerror(Error(`Unknown message type: ${JSON.stringify(g)}`))},m.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let m=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let f of this._timeoutInfo.values())clearTimeout(f.timeoutId);this._timeoutInfo.clear();let h=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let p=new we(Pe.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let f of m.values())f(p);for(let f of h.values())f.abort(p)}}_onerror(m){this.onerror?.(m)}_onnotification(m,h){let{message:p}=fc(m,"notification"),f=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop")return;if(h?.classification!==void 0){let y=lc(h.classification);if(y!==f.era){this._onerror(Error(`Era mismatch on inbound notification '${p.method}': classified as ${y} but this instance serves ${f.era}`));return}}if(si(p.method)&&!f.hasNotificationMethod(p.method))return;let g=this._notificationHandlers.get(p.method),v=this.fallbackNotificationHandler;if(g===void 0&&v===void 0)return;Promise.resolve().then(()=>g===void 0?v(p):g(p,f)).catch((y)=>this._onerror(Error(`Uncaught error in notification handler: ${y}`)))}_onrequest(m,h){let{message:p,lifted:f}=fc(m,"request"),g=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop"){this._onerror(Error(`Dropped inbound request '${m.method}': not servable on this connection's protocol era`));return}let v=this._transport,y=(M,N,b)=>{let V={jsonrpc:"2.0",id:p.id,error:{code:M,message:N,...b!==void 0&&{data:b}}};v?.send(V).catch((E)=>this._onerror(Error(`Failed to send an error response: ${E}`)))};if(h?.classification!==void 0){let M=lc(h.classification);if(M!==g.era){this._onerror(Error(`Era mismatch on inbound request '${p.method}': classified as ${M} but this instance serves ${g.era}`));let N=h.classification.revision??M;y(fe.UnsupportedProtocolVersion,`Unsupported protocol version: ${N}`,{supported:this._supportedProtocolVersions,requested:N});return}}if(ri(p.method)&&!g.hasRequestMethod(p.method)&&!(uc(p.method)&&this._customSchemaRequestMethods.has(p.method))){y(fe.MethodNotFound,"Method not found");return}let _=this._requestHandlers.get(p.method)??this.fallbackRequestHandler;if(_===void 0){y(fe.MethodNotFound,"Method not found");return}let S=g.checkInboundEnvelope(f);if(S!==void 0){y(fe.InvalidParams,S);return}let z=(M,N)=>this._notificationViaCodec(this._resolveOutboundCodec(M.method),M,{...N,relatedRequestId:p.id}),O=(M,N,b)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(M.method),M,N,{...b,relatedRequestId:p.id}),k=new AbortController;this._requestHandlerAbortControllers.set(p.id,k);let F=f.inputResponses===void 0?void 0:md(f.inputResponses),B={sessionId:v?.sessionId,mcpReq:{id:p.id,method:p.method,_meta:p.params?._meta,...f.envelope!==void 0&&{envelope:f.envelope},...F!==void 0&&{inputResponses:F.accepted},...F!==void 0&&F.droppedKeys.length>0&&{droppedInputResponseKeys:F.droppedKeys},requestState:f.requestState===void 0?dd:Ds(f.requestState),signal:k.signal,send:(M,N,b)=>{let V=this._resolveOutboundCodec(M.method);if(this._assertOutboundRequestInEra(V,M.method),Tr(N))return O(M,N,b);let E=gc(V,M.method);if(E===void 0)throw TypeError(`'${M.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return O(M,E,N)},notify:z},http:h?.authInfo?{authInfo:h.authInfo}:void 0},T=this.buildContext(B,h);Promise.resolve().then(()=>_(p,T)).then(async(M)=>{if(k.signal.aborted)return;let N;try{N=g.encodeResult(p.method,M,this._outboundServerInfo())}catch(V){this._onerror(Error(`Failed to encode result for ${p.method}: ${V}`)),y(fe.InternalError,"Internal error");return}let b={result:N,jsonrpc:"2.0",id:p.id};await v?.send(b)},async(M)=>{if(k.signal.aborted)return;let N=Number.isSafeInteger(M.code)?M.code:fe.InternalError,b={jsonrpc:"2.0",id:p.id,error:{code:g.encodeErrorCode(N),message:M.message??"Internal error",...M.data!==void 0&&{data:M.data}}};await v?.send(b)}).catch((M)=>this._onerror(Error(`Failed to send response: ${M}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(p.id)===k)this._requestHandlerAbortControllers.delete(p.id)})}_onprogress(m){let{progressToken:h,...p}=m.params,f=Number(h),g=this._progressHandlers.get(f);if(!g){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(m)}`));return}let v=this._responseHandlers.get(f),y=this._timeoutInfo.get(f);if(y&&v&&y.resetTimeoutOnProgress)try{this._resetTimeout(f)}catch(_){this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),v(_);return}g(p)}_onresponse(m){let h=Number(m.id),p=this._responseHandlers.get(h);if(p===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(m)}`));return}if(this._responseHandlers.delete(h),this._cleanupTimeout(h),this._progressHandlers.delete(h),Ms(m))p(m);else p(ve.fromError(m.error.code,m.error.message,m.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(m,h,p){let f=this._resolveOutboundCodec(m.method);if(Tr(h)){if(!uc(m.method))this._assertOutboundRequestInEra(f,m.method);return this._requestWithSchemaViaCodec(f,m,h,p)}this._assertOutboundRequestInEra(f,m.method);let g=gc(f,m.method);if(g===void 0)throw TypeError(`'${m.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(f,m,g,h)}_negotiatedWireCodec(){return Nt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(m){if(this._negotiatedProtocolVersion===void 0){let h=cd(m);if(h)return h}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(m,h){if(ri(h)&&!m.hasRequestMethod(h))throw new we(Pe.MethodNotSupportedByProtocolVersion,`Method '${h}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h,era:m.era})}_requestWithSchema(m,h,p){let f=this._resolveOutboundCodec(m.method);return this._assertOutboundRequestInEra(f,m.method),this._requestWithSchemaViaCodec(f,m,h,p)}_requestWithSchemaViaCodec(m,h,p,f){let{relatedRequestId:g,resumptionToken:v,onresumptiontoken:y,headers:_}=f??{},S=Date.now(),z,O;return new Promise((k,F)=>{let B=(L)=>{F(L)};if(!this._transport){B(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(h.method)}catch(L){B(L);return}if(f?.signal?.aborted){let L=f.signal.reason;throw L instanceof we?L:new we(Pe.RequestTimeout,String(L))}let T=m.era===Ls&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,M=this._requestMessageId++;O=M;let N={...h,jsonrpc:"2.0",id:M};if(f?.onprogress)this._progressHandlers.set(M,f.onprogress),N.params={...h.params,_meta:{...h.params?._meta,progressToken:M}};let b=this._envelopeOutbound(N),V=!1,E=(L)=>{if(V)return;if(this._progressHandlers.delete(M),T===void 0){if(h.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(L)}}),{relatedRequestId:g,resumptionToken:v,onresumptiontoken:y}).catch((j)=>this._onerror(Error(`Failed to send cancellation: ${j}`)))}else T.abort();F(L instanceof we?L:new we(Pe.RequestTimeout,String(L)))};this._responseHandlers.set(M,(L)=>{if(f?.signal?.aborted)return;if(V=!0,L instanceof Error)return F(L);let j;try{j=m.decodeResult(h.method,L.result)}catch(Q){return F(Q instanceof Error?Q:Error(String(Q)))}if(j.kind==="invalid")return F(j.error);if(j.kind==="input_required"){if(f?.allowInputRequired===!0)return k(hd(j));let Q={codec:m,request:h,resultSchema:p,options:f,flowStartedAt:S,retry:(ne,ee)=>this._requestWithSchemaViaCodec(m,ne===void 0?{method:h.method}:{method:h.method,params:ne},p,ee)};return k(this._resolveNonCompleteResult(j,Q))}let U=j.result;Qt(p,U).then((Q)=>{if(Q.success)k(Q.data);else F(new we(Pe.InvalidResult,`Invalid result for ${h.method}: ${Q.error}`))},F)}),z=()=>E(f?.signal?.reason),f?.signal?.addEventListener("abort",z,{once:!0});let H=f?.timeout??Jc,K=()=>E(new we(Pe.RequestTimeout,"Request timed out",{timeout:H}));this._setupTimeout(M,H,f?.maxTotalTimeout,K,f?.resetTimeoutOnProgress??!1),this._transport.send(b,{relatedRequestId:g,resumptionToken:v,onresumptiontoken:y,headers:_,requestSignal:T?.signal}).catch((L)=>{this._progressHandlers.delete(M),F(L)})}).finally(()=>{if(z)f?.signal?.removeEventListener("abort",z);if(O!==void 0)this._responseHandlers.delete(O),this._cleanupTimeout(O)})}async notification(m,h){return await this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,h)}async _notificationViaCodec(m,h,p){if(!this._transport)throw new we(Pe.NotConnected,"Not connected");if(si(h.method)&&!m.hasNotificationMethod(h.method))throw new we(Pe.MethodNotSupportedByProtocolVersion,`Notification '${h.method}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h.method,era:m.era});this.assertNotificationCapability(h.method);let f=this._envelopeOutbound({jsonrpc:"2.0",...h});if((this._options?.debouncedNotificationMethods??[]).includes(h.method)&&!h.params&&p?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(h.method))return;this._pendingDebouncedNotifications.add(h.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(h.method),!this._transport)return;this._transport?.send(f,p).catch((g)=>this._onerror(g))});return}await this._transport.send(f,p)}setRequestHandler(m,h,p){this.assertRequestHandlerCapability(m);let f;if(typeof h==="function"){if(!ri(m))throw TypeError(`'${m}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);f=(g,v)=>{let y=this._negotiatedWireCodec(),_=y.validateRequest(m,g);if(!_.ok&&_.reason==="not-in-era")_=y.validateInputRequest(m,g);if(!_.ok){if(_.reason==="not-in-era")throw new ve(fe.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(_.message)}return Promise.resolve(h(_.value,v))}}else if(p)f=async(g,v)=>{let y=await Qt(h.params,{...g.params});if(!y.success)throw new ve(fe.InvalidParams,`Invalid params for ${m}: ${y.error}`);return p(y.data,v)};else throw TypeError("setRequestHandler: handler is required");if(typeof h==="function")this._customSchemaRequestMethods.delete(m);else this._customSchemaRequestMethods.add(m);this._requestHandlers.set(m,this._wrapHandler(m,f))}_wrapHandler(m,h){return h}_outboundServerInfo(){}removeRequestHandler(m){this._requestHandlers.delete(m),this._customSchemaRequestMethods.delete(m)}assertCanSetRequestHandler(m){if(this._requestHandlers.has(m))throw Error(`A request handler for ${m} already exists, which would be overridden`)}setNotificationHandler(m,h,p){if(typeof h==="function"){if(!si(m))throw TypeError(`'${m}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(m,(f,g)=>{let v=g.validateNotification(m,f);if(!v.ok){if(v.reason==="not-in-era")throw new ve(fe.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(v.message)}return Promise.resolve(h(v.value))});return}if(!p)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(m,async(f)=>{let g=await Qt(h.params,{...f.params});if(!g.success)throw new ve(fe.InvalidParams,`Invalid params for notification ${m}: ${g.error}`);await p(g.data,f)})}removeNotificationHandler(m){this._notificationHandlers.delete(m)}};function Ns(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Ti(m,h){let p={...m};for(let f in h){let g=f,v=h[g];if(v===void 0)continue;let y=p[g];p[g]=Ns(y)&&Ns(v)?{...y,...v}:v}return p}function Sc(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function md(m){let h={},p=[];if(!Sc(m))return{accepted:h,droppedKeys:p};for(let[f,g]of Object.entries(m)){if(!Sc(g)||"method"in g||"result"in g){p.push(f);continue}h[f]=g}return{accepted:h,droppedKeys:p}}function hd(m){return{resultType:"input_required",inputRequests:m.inputRequests,...m.requestState!==void 0&&{requestState:m.requestState},...m._meta!==void 0&&{_meta:m._meta}}}/*!
|
|
2
|
-
* content-type
|
|
3
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/var pd=ue((m)=>{var h=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,p=/\\([\u000b\u0020-\u00ff])/g,f=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;m.parse=g;function g(_){if(!_)throw TypeError("argument string is required");var S=typeof _==="object"?v(_):_;if(typeof S!=="string")throw TypeError("argument string is required to be a string");var z=S.indexOf(";"),O=z!==-1?S.slice(0,z).trim():S.trim();if(!f.test(O))throw TypeError("invalid media type");var k=new y(O.toLowerCase());if(z!==-1){var F,B,T;h.lastIndex=z;while(B=h.exec(S)){if(B.index!==z)throw TypeError("invalid parameter format");if(z+=B[0].length,F=B[1].toLowerCase(),T=B[2],T.charCodeAt(0)===34){if(T=T.slice(1,-1),T.indexOf("\\")!==-1)T=T.replace(p,"$1")}k.parameters[F]=T}if(z!==S.length)throw TypeError("invalid parameter format")}return k}function v(_){var S;if(typeof _.getHeader==="function")S=_.getHeader("content-type");else if(typeof _.headers==="object")S=_.headers&&_.headers["content-type"];if(typeof S!=="string")throw TypeError("content-type header is missing from object");return S}function y(_){this.parameters=Object.create(null),this.type=_}}),Dh=no(pd(),1);var Gc=10485760,Pi=class{_buffer;_maxBufferSize;constructor(m){this._maxBufferSize=m?.maxBufferSize??Gc}append(m){if((this._buffer?.length??0)+m.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,m]):m}readMessage(){while(this._buffer){let m=this._buffer.indexOf(`
|
|
6
|
-
`);if(m===-1)return null;let h=this._buffer.toString("utf8",0,m).replace(/\r$/,"");this._buffer=this._buffer.subarray(m+1);try{return Wc(h)}catch(p){if(p instanceof SyntaxError)continue;throw p}}return null}clear(){this._buffer=void 0}};function Wc(m){return ms.parse(JSON.parse(m))}function Ci(m){return JSON.stringify(m)+`
|
|
7
|
-
`}var fd=/^[A-Za-z0-9._-]{1,128}$/;function gd(m){let h=[];if(m.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(m.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${m.length})`]};if(m.includes(" "))h.push("Tool name contains spaces, which may cause parsing issues");if(m.includes(","))h.push("Tool name contains commas, which may cause parsing issues");if(m.startsWith("-")||m.endsWith("-"))h.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(m.startsWith(".")||m.endsWith("."))h.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!fd.test(m)){let p=[...m].filter((f)=>!/[A-Za-z0-9._-]/.test(f)).filter((f,g,v)=>v.indexOf(f)===g);return h.push(`Tool name contains invalid characters: ${p.map((f)=>`"${f}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:h}}return{isValid:!0,warnings:h}}function Sd(m,h){if(h.length>0){console.warn(`Tool name validation warning for "${m}":`);for(let p of h)console.warn(` - ${p}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function qi(m){let h=gd(m);return Sd(m,h.warnings),h.isValid}function yd(m){return typeof m==="object"&&m!==null&&"_zod"in m}function vd(m){return typeof m==="object"&&m!==null&&!("_zod"in m)&&"_def"in m&&typeof m._def?.typeName==="string"}function _d(m){if(typeof m!=="object"||m===null)return!1;if(Tr(m))return!1;let h=Object.getPrototypeOf(m);if(h!==Object.prototype&&h!==null)return!1;return Object.values(m).every((p)=>yd(p))}function hn(m){if(m===void 0)return;if(_d(m))return t(m);if(typeof m==="object"&&m!==null&&!Tr(m)&&Object.values(m).some((h)=>vd(h)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!Tr(m))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return m}var pn=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.regexpCode=m.getEsmExportName=m.getProperty=m.safeStringify=m.stringify=m.strConcat=m.addCodeArg=m.str=m._=m.nil=m._Code=m.Name=m.IDENTIFIER=m._CodeOrName=void 0;var h=class{};m._CodeOrName=h,m.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var p=class extends h{constructor(b){super();if(!m.IDENTIFIER.test(b))throw Error("CodeGen: name must be a valid identifier");this.str=b}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};m.Name=p;var f=class extends h{constructor(b){super();this._items=typeof b==="string"?[b]:b}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let b=this._items[0];return b===""||b==='""'}get str(){var b;return(b=this._str)!==null&&b!==void 0?b:this._str=this._items.reduce((V,E)=>`${V}${E}`,"")}get names(){var b;return(b=this._names)!==null&&b!==void 0?b:this._names=this._items.reduce((V,E)=>{if(E instanceof p)V[E.str]=(V[E.str]||0)+1;return V},{})}};m._Code=f,m.nil=new f("");function g(b,...V){let E=[b[0]],H=0;while(H<V.length)_(E,V[H]),E.push(b[++H]);return new f(E)}m._=g;let v=new f("+");function y(b,...V){let E=[B(b[0])],H=0;while(H<V.length)E.push(v),_(E,V[H]),E.push(v,B(b[++H]));return S(E),new f(E)}m.str=y;function _(b,V){if(V instanceof f)b.push(...V._items);else if(V instanceof p)b.push(V);else b.push(k(V))}m.addCodeArg=_;function S(b){let V=1;while(V<b.length-1){if(b[V]===v){let E=z(b[V-1],b[V+1]);if(E!==void 0){b.splice(V-1,3,E);continue}b[V++]="+"}V++}}function z(b,V){if(V==='""')return b;if(b==='""')return V;if(typeof b=="string"){if(V instanceof p||b[b.length-1]!=='"')return;if(typeof V!="string")return`${b.slice(0,-1)}${V}"`;if(V[0]==='"')return b.slice(0,-1)+V.slice(1);return}if(typeof V=="string"&&V[0]==='"'&&!(b instanceof p))return`"${b}${V.slice(1)}`}function O(b,V){return V.emptyStr()?b:b.emptyStr()?V:y`${b}${V}`}m.strConcat=O;function k(b){return typeof b=="number"||typeof b=="boolean"||b===null?b:B(Array.isArray(b)?b.join(","):b)}function F(b){return new f(B(b))}m.stringify=F;function B(b){return JSON.stringify(b).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}m.safeStringify=B;function T(b){return typeof b=="string"&&m.IDENTIFIER.test(b)?new f(`.${b}`):g`[${b}]`}m.getProperty=T;function M(b){if(typeof b=="string"&&m.IDENTIFIER.test(b))return new f(`${b}`);throw Error(`CodeGen: invalid export name: ${b}, use explicit $id name mapping`)}m.getEsmExportName=M;function N(b){return new f(b.toString())}m.regexpCode=N}),Yc=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.ValueScope=m.ValueScopeName=m.Scope=m.varKinds=m.UsedValueState=void 0;let h=pn();var p=class extends Error{constructor(S){super(`CodeGen: "code" for ${S} not defined`);this.value=S.value}},f;(function(S){S[S.Started=0]="Started",S[S.Completed=1]="Completed"})(f||(m.UsedValueState=f={})),m.varKinds={const:new h.Name("const"),let:new h.Name("let"),var:new h.Name("var")};var g=class{constructor({prefixes:S,parent:z}={}){this._names={},this._prefixes=S,this._parent=z}toName(S){return S instanceof h.Name?S:this.name(S)}name(S){return new h.Name(this._newName(S))}_newName(S){let z=this._names[S]||this._nameGroup(S);return`${S}${z.index++}`}_nameGroup(S){var z,O;if(((O=(z=this._parent)===null||z===void 0?void 0:z._prefixes)===null||O===void 0?void 0:O.has(S))||this._prefixes&&!this._prefixes.has(S))throw Error(`CodeGen: prefix "${S}" is not allowed in this scope`);return this._names[S]={prefix:S,index:0}}};m.Scope=g;var v=class extends h.Name{constructor(S,z){super(z);this.prefix=S}setValue(S,{property:z,itemIndex:O}){this.value=S,this.scopePath=h._`.${new h.Name(z)}[${O}]`}};m.ValueScopeName=v;let y=h._`\n`;var _=class extends g{constructor(S){super(S);this._values={},this._scope=S.scope,this.opts={...S,_n:S.lines?y:h.nil}}get(){return this._scope}name(S){return new v(S,this._newName(S))}value(S,z){var O;if(z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let k=this.toName(S),{prefix:F}=k,B=(O=z.key)!==null&&O!==void 0?O:z.ref,T=this._values[F];if(T){let b=T.get(B);if(b)return b}else T=this._values[F]=new Map;T.set(B,k);let M=this._scope[F]||(this._scope[F]=[]),N=M.length;return M[N]=z.ref,k.setValue(z,{property:F,itemIndex:N}),k}getValue(S,z){let O=this._values[S];if(!O)return;return O.get(z)}scopeRefs(S,z=this._values){return this._reduceValues(z,(O)=>{if(O.scopePath===void 0)throw Error(`CodeGen: name "${O}" has no value`);return h._`${S}${O.scopePath}`})}scopeCode(S=this._values,z,O){return this._reduceValues(S,(k)=>{if(k.value===void 0)throw Error(`CodeGen: name "${k}" has no value`);return k.value.code},z,O)}_reduceValues(S,z,O={},k){let F=h.nil;for(let B in S){let T=S[B];if(!T)continue;let M=O[B]=O[B]||new Map;T.forEach((N)=>{if(M.has(N))return;M.set(N,f.Started);let b=z(N);if(b){let V=this.opts.es5?m.varKinds.var:m.varKinds.const;F=h._`${F}${V} ${N} = ${b};${this.opts._n}`}else if(b=k===null||k===void 0?void 0:k(N))F=h._`${F}${b}${this.opts._n}`;else throw new p(N);M.set(N,f.Completed)})}return F}};m.ValueScope=_}),$e=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.or=m.and=m.not=m.CodeGen=m.operators=m.varKinds=m.ValueScopeName=m.ValueScope=m.Scope=m.Name=m.regexpCode=m.stringify=m.getProperty=m.nil=m.strConcat=m.str=m._=void 0;let h=pn(),p=Yc();var f=pn();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(m,"strConcat",{enumerable:!0,get:function(){return f.strConcat}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(m,"getProperty",{enumerable:!0,get:function(){return f.getProperty}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(m,"regexpCode",{enumerable:!0,get:function(){return f.regexpCode}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return f.Name}});var g=Yc();Object.defineProperty(m,"Scope",{enumerable:!0,get:function(){return g.Scope}}),Object.defineProperty(m,"ValueScope",{enumerable:!0,get:function(){return g.ValueScope}}),Object.defineProperty(m,"ValueScopeName",{enumerable:!0,get:function(){return g.ValueScopeName}}),Object.defineProperty(m,"varKinds",{enumerable:!0,get:function(){return g.varKinds}}),m.operators={GT:new h._Code(">"),GTE:new h._Code(">="),LT:new h._Code("<"),LTE:new h._Code("<="),EQ:new h._Code("==="),NEQ:new h._Code("!=="),NOT:new h._Code("!"),OR:new h._Code("||"),AND:new h._Code("&&"),ADD:new h._Code("+")};var v=class{optimizeNodes(){return this}optimizeNames(x,W){return this}},y=class extends v{constructor(x,W,te){super();this.varKind=x,this.name=W,this.rhs=te}render({es5:x,_n:W}){let te=x?p.varKinds.var:this.varKind,ge=this.rhs===void 0?"":` = ${this.rhs}`;return`${te} ${this.name}${ge};`+W}optimizeNames(x,W){if(!x[this.name.str])return;if(this.rhs)this.rhs=ye(this.rhs,x,W);return this}get names(){return this.rhs instanceof h._CodeOrName?this.rhs.names:{}}},_=class extends v{constructor(x,W,te){super();this.lhs=x,this.rhs=W,this.sideEffects=te}render({_n:x}){return`${this.lhs} = ${this.rhs};`+x}optimizeNames(x,W){if(this.lhs instanceof h.Name&&!x[this.lhs.str]&&!this.sideEffects)return;return this.rhs=ye(this.rhs,x,W),this}get names(){return Se(this.lhs instanceof h.Name?{}:{...this.lhs.names},this.rhs)}},S=class extends _{constructor(x,W,te,ge){super(x,te,ge);this.op=W}render({_n:x}){return`${this.lhs} ${this.op}= ${this.rhs};`+x}},z=class extends v{constructor(x){super();this.label=x,this.names={}}render({_n:x}){return`${this.label}:`+x}},O=class extends v{constructor(x){super();this.label=x,this.names={}}render({_n:x}){return`break${this.label?` ${this.label}`:""};`+x}},k=class extends v{constructor(x){super();this.error=x}render({_n:x}){return`throw ${this.error};`+x}get names(){return this.error.names}},F=class extends v{constructor(x){super();this.code=x}render({_n:x}){return`${this.code};`+x}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(x,W){return this.code=ye(this.code,x,W),this}get names(){return this.code instanceof h._CodeOrName?this.code.names:{}}},B=class extends v{constructor(x=[]){super();this.nodes=x}render(x){return this.nodes.reduce((W,te)=>W+te.render(x),"")}optimizeNodes(){let{nodes:x}=this,W=x.length;while(W--){let te=x[W].optimizeNodes();if(Array.isArray(te))x.splice(W,1,...te);else if(te)x[W]=te;else x.splice(W,1)}return x.length>0?this:void 0}optimizeNames(x,W){let{nodes:te}=this,ge=te.length;while(ge--){let _e=te[ge];if(_e.optimizeNames(x,W))continue;Ce(x,_e.names),te.splice(ge,1)}return te.length>0?this:void 0}get names(){return this.nodes.reduce((x,W)=>ie(x,W.names),{})}},T=class extends B{render(x){return"{"+x._n+super.render(x)+"}"+x._n}},M=class extends B{},N=class extends T{};N.kind="else";var b=class x extends T{constructor(W,te){super(te);this.condition=W}render(W){let te=`if(${this.condition})`+super.render(W);if(this.else)te+="else "+this.else.render(W);return te}optimizeNodes(){super.optimizeNodes();let W=this.condition;if(W===!0)return this.nodes;let te=this.else;if(te){let ge=te.optimizeNodes();te=this.else=Array.isArray(ge)?new N(ge):ge}if(te){if(W===!1)return te instanceof x?te:te.nodes;if(this.nodes.length)return this;return new x(Ne(W),te instanceof x?[te]:te.nodes)}if(W===!1||!this.nodes.length)return;return this}optimizeNames(W,te){var ge;if(this.else=(ge=this.else)===null||ge===void 0?void 0:ge.optimizeNames(W,te),!(super.optimizeNames(W,te)||this.else))return;return this.condition=ye(this.condition,W,te),this}get names(){let W=super.names;if(Se(W,this.condition),this.else)ie(W,this.else.names);return W}};b.kind="if";var V=class extends T{};V.kind="for";var E=class extends V{constructor(x){super();this.iteration=x}render(x){return`for(${this.iteration})`+super.render(x)}optimizeNames(x,W){if(!super.optimizeNames(x,W))return;return this.iteration=ye(this.iteration,x,W),this}get names(){return ie(super.names,this.iteration.names)}},H=class extends V{constructor(x,W,te,ge){super();this.varKind=x,this.name=W,this.from=te,this.to=ge}render(x){let W=x.es5?p.varKinds.var:this.varKind,{name:te,from:ge,to:_e}=this;return`for(${W} ${te}=${ge}; ${te}<${_e}; ${te}++)`+super.render(x)}get names(){return Se(Se(super.names,this.from),this.to)}},K=class extends V{constructor(x,W,te,ge){super();this.loop=x,this.varKind=W,this.name=te,this.iterable=ge}render(x){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(x)}optimizeNames(x,W){if(!super.optimizeNames(x,W))return;return this.iterable=ye(this.iterable,x,W),this}get names(){return ie(super.names,this.iterable.names)}},L=class extends T{constructor(x,W,te){super();this.name=x,this.args=W,this.async=te}render(x){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(x)}};L.kind="func";var j=class extends B{render(x){return"return "+super.render(x)}};j.kind="return";var U=class extends T{render(x){let W="try"+super.render(x);if(this.catch)W+=this.catch.render(x);if(this.finally)W+=this.finally.render(x);return W}optimizeNodes(){var x,W;return super.optimizeNodes(),(x=this.catch)===null||x===void 0||x.optimizeNodes(),(W=this.finally)===null||W===void 0||W.optimizeNodes(),this}optimizeNames(x,W){var te,ge;return super.optimizeNames(x,W),(te=this.catch)===null||te===void 0||te.optimizeNames(x,W),(ge=this.finally)===null||ge===void 0||ge.optimizeNames(x,W),this}get names(){let x=super.names;if(this.catch)ie(x,this.catch.names);if(this.finally)ie(x,this.finally.names);return x}},Q=class extends T{constructor(x){super();this.error=x}render(x){return`catch(${this.error})`+super.render(x)}};Q.kind="catch";var ne=class extends T{render(x){return"finally"+super.render(x)}};ne.kind="finally";var ee=class{constructor(x,W={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...W,_n:W.lines?`
|
|
8
|
-
`:""},this._extScope=x,this._scope=new p.Scope({parent:x}),this._nodes=[new M]}toString(){return this._root.render(this.opts)}name(x){return this._scope.name(x)}scopeName(x){return this._extScope.name(x)}scopeValue(x,W){let te=this._extScope.value(x,W);return(this._values[te.prefix]||(this._values[te.prefix]=new Set)).add(te),te}getScopeValue(x,W){return this._extScope.getValue(x,W)}scopeRefs(x){return this._extScope.scopeRefs(x,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(x,W,te,ge){let _e=this._scope.toName(W);if(te!==void 0&&ge)this._constants[_e.str]=te;return this._leafNode(new y(x,_e,te)),_e}const(x,W,te){return this._def(p.varKinds.const,x,W,te)}let(x,W,te){return this._def(p.varKinds.let,x,W,te)}var(x,W,te){return this._def(p.varKinds.var,x,W,te)}assign(x,W,te){return this._leafNode(new _(x,W,te))}add(x,W){return this._leafNode(new S(x,m.operators.ADD,W))}code(x){if(typeof x=="function")x();else if(x!==h.nil)this._leafNode(new F(x));return this}object(...x){let W=["{"];for(let[te,ge]of x){if(W.length>1)W.push(",");if(W.push(te),te!==ge||this.opts.es5)W.push(":"),(0,h.addCodeArg)(W,ge)}return W.push("}"),new h._Code(W)}if(x,W,te){if(this._blockNode(new b(x)),W&&te)this.code(W).else().code(te).endIf();else if(W)this.code(W).endIf();else if(te)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(x){return this._elseNode(new b(x))}else(){return this._elseNode(new N)}endIf(){return this._endBlockNode(b,N)}_for(x,W){if(this._blockNode(x),W)this.code(W).endFor();return this}for(x,W){return this._for(new E(x),W)}forRange(x,W,te,ge,_e=this.opts.es5?p.varKinds.var:p.varKinds.let){let Te=this._scope.toName(x);return this._for(new H(_e,Te,W,te),()=>ge(Te))}forOf(x,W,te,ge=p.varKinds.const){let _e=this._scope.toName(x);if(this.opts.es5){let Te=W instanceof h.Name?W:this.var("_arr",W);return this.forRange("_i",0,h._`${Te}.length`,(ze)=>{this.var(_e,h._`${Te}[${ze}]`),te(_e)})}return this._for(new K("of",ge,_e,W),()=>te(_e))}forIn(x,W,te,ge=this.opts.es5?p.varKinds.var:p.varKinds.const){if(this.opts.ownProperties)return this.forOf(x,h._`Object.keys(${W})`,te);let _e=this._scope.toName(x);return this._for(new K("in",ge,_e,W),()=>te(_e))}endFor(){return this._endBlockNode(V)}label(x){return this._leafNode(new z(x))}break(x){return this._leafNode(new O(x))}return(x){let W=new j;if(this._blockNode(W),this.code(x),W.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(j)}try(x,W,te){if(!W&&!te)throw Error('CodeGen: "try" without "catch" and "finally"');let ge=new U;if(this._blockNode(ge),this.code(x),W){let _e=this.name("e");this._currNode=ge.catch=new Q(_e),W(_e)}if(te)this._currNode=ge.finally=new ne,this.code(te);return this._endBlockNode(Q,ne)}throw(x){return this._leafNode(new k(x))}block(x,W){if(this._blockStarts.push(this._nodes.length),x)this.code(x).endBlock(W);return this}endBlock(x){let W=this._blockStarts.pop();if(W===void 0)throw Error("CodeGen: not in self-balancing block");let te=this._nodes.length-W;if(te<0||x!==void 0&&te!==x)throw Error(`CodeGen: wrong number of nodes: ${te} vs ${x} expected`);return this._nodes.length=W,this}func(x,W=h.nil,te,ge){if(this._blockNode(new L(x,W,te)),ge)this.code(ge).endFunc();return this}endFunc(){return this._endBlockNode(L)}optimize(x=1){while(x-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(x){return this._currNode.nodes.push(x),this}_blockNode(x){this._currNode.nodes.push(x),this._nodes.push(x)}_endBlockNode(x,W){let te=this._currNode;if(te instanceof x||W&&te instanceof W)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${W?`${x.kind}/${W.kind}`:x.kind}"`)}_elseNode(x){let W=this._currNode;if(!(W instanceof b))throw Error('CodeGen: "else" without "if"');return this._currNode=W.else=x,this}get _root(){return this._nodes[0]}get _currNode(){let x=this._nodes;return x[x.length-1]}set _currNode(x){let W=this._nodes;W[W.length-1]=x}};m.CodeGen=ee;function ie(x,W){for(let te in W)x[te]=(x[te]||0)+(W[te]||0);return x}function Se(x,W){return W instanceof h._CodeOrName?ie(x,W.names):x}function ye(x,W,te){if(x instanceof h.Name)return ge(x);if(!_e(x))return x;return new h._Code(x._items.reduce((Te,ze)=>{if(ze instanceof h.Name)ze=ge(ze);if(ze instanceof h._Code)Te.push(...ze._items);else Te.push(ze);return Te},[]));function ge(Te){let ze=te[Te.str];if(ze===void 0||W[Te.str]!==1)return Te;return delete W[Te.str],ze}function _e(Te){return Te instanceof h._Code&&Te._items.some((ze)=>ze instanceof h.Name&&W[ze.str]===1&&te[ze.str]!==void 0)}}function Ce(x,W){for(let te in W)x[te]=(x[te]||0)-(W[te]||0)}function Ne(x){return typeof x=="boolean"||typeof x=="number"||x===null?!x:h._`!${he(x)}`}m.not=Ne;let je=re(m.operators.AND);function He(...x){return x.reduce(je)}m.and=He;let qe=re(m.operators.OR);function Z(...x){return x.reduce(qe)}m.or=Z;function re(x){return(W,te)=>W===h.nil?te:te===h.nil?W:h._`${he(W)} ${x} ${he(te)}`}function he(x){return x instanceof h.Name?x:h._`(${x})`}}),Ie=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.checkStrictMode=m.getErrorPath=m.Type=m.useFunc=m.setEvaluated=m.evaluatedPropsToName=m.mergeEvaluated=m.eachItem=m.unescapeJsonPointer=m.escapeJsonPointer=m.escapeFragment=m.unescapeFragment=m.schemaRefOrVal=m.schemaHasRulesButRef=m.schemaHasRules=m.checkUnknownRules=m.alwaysValidSchema=m.toHash=void 0;let h=$e(),p=pn();function f(L){let j={};for(let U of L)j[U]=!0;return j}m.toHash=f;function g(L,j){if(typeof j=="boolean")return j;if(Object.keys(j).length===0)return!0;return v(L,j),!y(j,L.self.RULES.all)}m.alwaysValidSchema=g;function v(L,j=L.schema){let{opts:U,self:Q}=L;if(!U.strictSchema)return;if(typeof j==="boolean")return;let ne=Q.RULES.keywords;for(let ee in j)if(!ne[ee])K(L,`unknown keyword: "${ee}"`)}m.checkUnknownRules=v;function y(L,j){if(typeof L=="boolean")return!L;for(let U in L)if(j[U])return!0;return!1}m.schemaHasRules=y;function _(L,j){if(typeof L=="boolean")return!L;for(let U in L)if(U!=="$ref"&&j.all[U])return!0;return!1}m.schemaHasRulesButRef=_;function S({topSchemaRef:L,schemaPath:j},U,Q,ne){if(!ne){if(typeof U=="number"||typeof U=="boolean")return U;if(typeof U=="string")return h._`${U}`}return h._`${L}${j}${(0,h.getProperty)(Q)}`}m.schemaRefOrVal=S;function z(L){return F(decodeURIComponent(L))}m.unescapeFragment=z;function O(L){return encodeURIComponent(k(L))}m.escapeFragment=O;function k(L){if(typeof L=="number")return`${L}`;return L.replace(/~/g,"~0").replace(/\//g,"~1")}m.escapeJsonPointer=k;function F(L){return L.replace(/~1/g,"/").replace(/~0/g,"~")}m.unescapeJsonPointer=F;function B(L,j){if(Array.isArray(L))for(let U of L)j(U);else j(L)}m.eachItem=B;function T({mergeNames:L,mergeToName:j,mergeValues:U,resultToName:Q}){return(ne,ee,ie,Se)=>{let ye=ie===void 0?ee:ie instanceof h.Name?(ee instanceof h.Name?L(ne,ee,ie):j(ne,ee,ie),ie):ee instanceof h.Name?(j(ne,ie,ee),ee):U(ee,ie);return Se===h.Name&&!(ye instanceof h.Name)?Q(ne,ye):ye}}m.mergeEvaluated={props:T({mergeNames:(L,j,U)=>L.if(h._`${U} !== true && ${j} !== undefined`,()=>{L.if(h._`${j} === true`,()=>L.assign(U,!0),()=>L.assign(U,h._`${U} || {}`).code(h._`Object.assign(${U}, ${j})`))}),mergeToName:(L,j,U)=>L.if(h._`${U} !== true`,()=>{if(j===!0)L.assign(U,!0);else L.assign(U,h._`${U} || {}`),N(L,U,j)}),mergeValues:(L,j)=>L===!0?!0:{...L,...j},resultToName:M}),items:T({mergeNames:(L,j,U)=>L.if(h._`${U} !== true && ${j} !== undefined`,()=>L.assign(U,h._`${j} === true ? true : ${U} > ${j} ? ${U} : ${j}`)),mergeToName:(L,j,U)=>L.if(h._`${U} !== true`,()=>L.assign(U,j===!0?!0:h._`${U} > ${j} ? ${U} : ${j}`)),mergeValues:(L,j)=>L===!0?!0:Math.max(L,j),resultToName:(L,j)=>L.var("items",j)})};function M(L,j){if(j===!0)return L.var("props",!0);let U=L.var("props",h._`{}`);if(j!==void 0)N(L,U,j);return U}m.evaluatedPropsToName=M;function N(L,j,U){Object.keys(U).forEach((Q)=>L.assign(h._`${j}${(0,h.getProperty)(Q)}`,!0))}m.setEvaluated=N;let b={};function V(L,j){return L.scopeValue("func",{ref:j,code:b[j.code]||(b[j.code]=new p._Code(j.code))})}m.useFunc=V;var E;(function(L){L[L.Num=0]="Num",L[L.Str=1]="Str"})(E||(m.Type=E={}));function H(L,j,U){if(L instanceof h.Name){let Q=j===E.Num;return U?Q?h._`"[" + ${L} + "]"`:h._`"['" + ${L} + "']"`:Q?h._`"/" + ${L}`:h._`"/" + ${L}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return U?(0,h.getProperty)(L).toString():"/"+k(L)}m.getErrorPath=H;function K(L,j,U=L.opts.strictSchema){if(!U)return;if(j=`strict mode: ${j}`,U===!0)throw Error(j);L.self.logger.warn(j)}m.checkStrictMode=K}),lt=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p={data:new h.Name("data"),valCxt:new h.Name("valCxt"),instancePath:new h.Name("instancePath"),parentData:new h.Name("parentData"),parentDataProperty:new h.Name("parentDataProperty"),rootData:new h.Name("rootData"),dynamicAnchors:new h.Name("dynamicAnchors"),vErrors:new h.Name("vErrors"),errors:new h.Name("errors"),this:new h.Name("this"),self:new h.Name("self"),scope:new h.Name("scope"),json:new h.Name("json"),jsonPos:new h.Name("jsonPos"),jsonLen:new h.Name("jsonLen"),jsonPart:new h.Name("jsonPart")};m.default=p}),gn=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.extendErrors=m.resetErrorsCount=m.reportExtraError=m.reportError=m.keyword$DataError=m.keywordError=void 0;let h=$e(),p=Ie(),f=lt();m.keywordError={message:({keyword:N})=>h.str`must pass "${N}" keyword validation`},m.keyword$DataError={message:({keyword:N,schemaType:b})=>b?h.str`"${N}" keyword must be ${b} ($data)`:h.str`"${N}" keyword is invalid ($data)`};function g(N,b=m.keywordError,V,E){let{it:H}=N,{gen:K,compositeRule:L,allErrors:j}=H,U=k(N,b,V);if(E!==null&&E!==void 0?E:L||j)S(K,U);else z(H,h._`[${U}]`)}m.reportError=g;function v(N,b=m.keywordError,V){let{it:E}=N,{gen:H,compositeRule:K,allErrors:L}=E;if(S(H,k(N,b,V)),!(K||L))z(E,f.default.vErrors)}m.reportExtraError=v;function y(N,b){N.assign(f.default.errors,b),N.if(h._`${f.default.vErrors} !== null`,()=>N.if(b,()=>N.assign(h._`${f.default.vErrors}.length`,b),()=>N.assign(f.default.vErrors,null)))}m.resetErrorsCount=y;function _({gen:N,keyword:b,schemaValue:V,data:E,errsCount:H,it:K}){if(H===void 0)throw Error("ajv implementation error");let L=N.name("err");N.forRange("i",H,f.default.errors,(j)=>{if(N.const(L,h._`${f.default.vErrors}[${j}]`),N.if(h._`${L}.instancePath === undefined`,()=>N.assign(h._`${L}.instancePath`,(0,h.strConcat)(f.default.instancePath,K.errorPath))),N.assign(h._`${L}.schemaPath`,h.str`${K.errSchemaPath}/${b}`),K.opts.verbose)N.assign(h._`${L}.schema`,V),N.assign(h._`${L}.data`,E)})}m.extendErrors=_;function S(N,b){let V=N.const("err",b);N.if(h._`${f.default.vErrors} === null`,()=>N.assign(f.default.vErrors,h._`[${V}]`),h._`${f.default.vErrors}.push(${V})`),N.code(h._`${f.default.errors}++`)}function z(N,b){let{gen:V,validateName:E,schemaEnv:H}=N;if(H.$async)V.throw(h._`new ${N.ValidationError}(${b})`);else V.assign(h._`${E}.errors`,b),V.return(!1)}let O={keyword:new h.Name("keyword"),schemaPath:new h.Name("schemaPath"),params:new h.Name("params"),propertyName:new h.Name("propertyName"),message:new h.Name("message"),schema:new h.Name("schema"),parentSchema:new h.Name("parentSchema")};function k(N,b,V){let{createErrors:E}=N.it;if(E===!1)return h._`{}`;return F(N,b,V)}function F(N,b,V={}){let{gen:E,it:H}=N,K=[B(H,V),T(N,V)];return M(N,b,K),E.object(...K)}function B({errorPath:N},{instancePath:b}){let V=b?h.str`${N}${(0,p.getErrorPath)(b,p.Type.Str)}`:N;return[f.default.instancePath,(0,h.strConcat)(f.default.instancePath,V)]}function T({keyword:N,it:{errSchemaPath:b}},{schemaPath:V,parentSchema:E}){let H=E?b:h.str`${b}/${N}`;if(V)H=h.str`${H}${(0,p.getErrorPath)(V,p.Type.Str)}`;return[O.schemaPath,H]}function M(N,{params:b,message:V},E){let{keyword:H,data:K,schemaValue:L,it:j}=N,{opts:U,propertyName:Q,topSchemaRef:ne,schemaPath:ee}=j;if(E.push([O.keyword,H],[O.params,typeof b=="function"?b(N):b||h._`{}`]),U.messages)E.push([O.message,typeof V=="function"?V(N):V]);if(U.verbose)E.push([O.schema,L],[O.parentSchema,h._`${ne}${ee}`],[f.default.data,K]);if(Q)E.push([O.propertyName,Q])}}),bd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.boolOrEmptySchema=m.topBoolOrEmptySchema=void 0;let h=gn(),p=$e(),f=lt(),g={message:"boolean schema is false"};function v(S){let{gen:z,schema:O,validateName:k}=S;if(O===!1)_(S,!1);else if(typeof O=="object"&&O.$async===!0)z.return(f.default.data);else z.assign(p._`${k}.errors`,null),z.return(!0)}m.topBoolOrEmptySchema=v;function y(S,z){let{gen:O,schema:k}=S;if(k===!1)O.var(z,!1),_(S);else O.var(z,!0)}m.boolOrEmptySchema=y;function _(S,z){let{gen:O,data:k}=S,F={gen:O,keyword:"false schema",data:k,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:S};(0,h.reportError)(F,g,void 0,z)}}),Xc=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.getRules=m.isJSONType=void 0;let h=new Set(["string","number","integer","boolean","null","object","array"]);function p(g){return typeof g=="string"&&h.has(g)}m.isJSONType=p;function f(){let g={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...g,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},g.number,g.string,g.array,g.object],post:{rules:[]},all:{},keywords:{}}}m.getRules=f}),Zc=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.shouldUseRule=m.shouldUseGroup=m.schemaHasRulesForType=void 0;function h({schema:g,self:v},y){let _=v.RULES.types[y];return _&&_!==!0&&p(g,_)}m.schemaHasRulesForType=h;function p(g,v){return v.rules.some((y)=>f(g,y))}m.shouldUseGroup=p;function f(g,v){var y;return g[v.keyword]!==void 0||((y=v.definition.implements)===null||y===void 0?void 0:y.some((_)=>g[_]!==void 0))}m.shouldUseRule=f}),fn=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.reportTypeError=m.checkDataTypes=m.checkDataType=m.coerceAndCheckDataType=m.getJSONTypes=m.getSchemaTypes=m.DataType=void 0;let h=Xc(),p=Zc(),f=gn(),g=$e(),v=Ie();var y;(function(E){E[E.Correct=0]="Correct",E[E.Wrong=1]="Wrong"})(y||(m.DataType=y={}));function _(E){let H=S(E.type);if(H.includes("null")){if(E.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!H.length&&E.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(E.nullable===!0)H.push("null")}return H}m.getSchemaTypes=_;function S(E){let H=Array.isArray(E)?E:E?[E]:[];if(H.every(h.isJSONType))return H;throw Error("type must be JSONType or JSONType[]: "+H.join(","))}m.getJSONTypes=S;function z(E,H){let{gen:K,data:L,opts:j}=E,U=k(H,j.coerceTypes),Q=H.length>0&&!(U.length===0&&H.length===1&&(0,p.schemaHasRulesForType)(E,H[0]));if(Q){let ne=M(H,L,j.strictNumbers,y.Wrong);K.if(ne,()=>{if(U.length)F(E,H,U);else b(E)})}return Q}m.coerceAndCheckDataType=z;let O=new Set(["string","number","integer","boolean","null"]);function k(E,H){return H?E.filter((K)=>O.has(K)||H==="array"&&K==="array"):[]}function F(E,H,K){let{gen:L,data:j,opts:U}=E,Q=L.let("dataType",g._`typeof ${j}`),ne=L.let("coerced",g._`undefined`);if(U.coerceTypes==="array")L.if(g._`${Q} == 'object' && Array.isArray(${j}) && ${j}.length == 1`,()=>L.assign(j,g._`${j}[0]`).assign(Q,g._`typeof ${j}`).if(M(H,j,U.strictNumbers),()=>L.assign(ne,j)));L.if(g._`${ne} !== undefined`);for(let ie of K)if(O.has(ie)||ie==="array"&&U.coerceTypes==="array")ee(ie);L.else(),b(E),L.endIf(),L.if(g._`${ne} !== undefined`,()=>{L.assign(j,ne),B(E,ne)});function ee(ie){switch(ie){case"string":L.elseIf(g._`${Q} == "number" || ${Q} == "boolean"`).assign(ne,g._`"" + ${j}`).elseIf(g._`${j} === null`).assign(ne,g._`""`);return;case"number":L.elseIf(g._`${Q} == "boolean" || ${j} === null
|
|
9
|
-
|| (${Q} == "string" && ${j} && ${j} == +${j})`).assign(ne,g._`+${j}`);return;case"integer":L.elseIf(g._`${Q} === "boolean" || ${j} === null
|
|
10
|
-
|| (${Q} === "string" && ${j} && ${j} == +${j} && !(${j} % 1))`).assign(ne,g._`+${j}`);return;case"boolean":L.elseIf(g._`${j} === "false" || ${j} === 0 || ${j} === null`).assign(ne,!1).elseIf(g._`${j} === "true" || ${j} === 1`).assign(ne,!0);return;case"null":L.elseIf(g._`${j} === "" || ${j} === 0 || ${j} === false`),L.assign(ne,null);return;case"array":L.elseIf(g._`${Q} === "string" || ${Q} === "number"
|
|
11
|
-
|| ${Q} === "boolean" || ${j} === null`).assign(ne,g._`[${j}]`)}}}function B({gen:E,parentData:H,parentDataProperty:K},L){E.if(g._`${H} !== undefined`,()=>E.assign(g._`${H}[${K}]`,L))}function T(E,H,K,L=y.Correct){let j=L===y.Correct?g.operators.EQ:g.operators.NEQ,U;switch(E){case"null":return g._`${H} ${j} null`;case"array":U=g._`Array.isArray(${H})`;break;case"object":U=g._`${H} && typeof ${H} == "object" && !Array.isArray(${H})`;break;case"integer":U=Q(g._`!(${H} % 1) && !isNaN(${H})`);break;case"number":U=Q();break;default:return g._`typeof ${H} ${j} ${E}`}return L===y.Correct?U:(0,g.not)(U);function Q(ne=g.nil){return(0,g.and)(g._`typeof ${H} == "number"`,ne,K?g._`isFinite(${H})`:g.nil)}}m.checkDataType=T;function M(E,H,K,L){if(E.length===1)return T(E[0],H,K,L);let j,U=(0,v.toHash)(E);if(U.array&&U.object){let Q=g._`typeof ${H} != "object"`;j=U.null?Q:g._`!${H} || ${Q}`,delete U.null,delete U.array,delete U.object}else j=g.nil;if(U.number)delete U.integer;for(let Q in U)j=(0,g.and)(j,T(Q,H,K,L));return j}m.checkDataTypes=M;let N={message:({schema:E})=>`must be ${E}`,params:({schema:E,schemaValue:H})=>typeof E=="string"?g._`{type: ${E}}`:g._`{type: ${H}}`};function b(E){let H=V(E);(0,f.reportError)(H,N)}m.reportTypeError=b;function V(E){let{gen:H,data:K,schema:L}=E,j=(0,v.schemaRefOrVal)(E,L,"type");return{gen:H,keyword:"type",data:K,schema:L.type,schemaCode:j,schemaValue:j,parentSchema:L,params:{},it:E}}}),Rd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.assignDefaults=void 0;let h=$e(),p=Ie();function f(v,y){let{properties:_,items:S}=v.schema;if(y==="object"&&_)for(let z in _)g(v,z,_[z].default);else if(y==="array"&&Array.isArray(S))S.forEach((z,O)=>g(v,O,z.default))}m.assignDefaults=f;function g(v,y,_){let{gen:S,compositeRule:z,data:O,opts:k}=v;if(_===void 0)return;let F=h._`${O}${(0,h.getProperty)(y)}`;if(z){(0,p.checkStrictMode)(v,`default is ignored for: ${F}`);return}let B=h._`${F} === undefined`;if(k.useDefaults==="empty")B=h._`${B} || ${F} === null || ${F} === ""`;S.if(B,h._`${F} = ${(0,h.stringify)(_)}`)}}),ut=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateUnion=m.validateArray=m.usePattern=m.callValidateCode=m.schemaProperties=m.allSchemaProperties=m.noPropertyInData=m.propertyInData=m.isOwnProperty=m.hasPropFunc=m.reportMissingProp=m.checkMissingProp=m.checkReportMissingProp=void 0;let h=$e(),p=Ie(),f=lt(),g=Ie();function v(E,H){let{gen:K,data:L,it:j}=E;K.if(k(K,L,H,j.opts.ownProperties),()=>{E.setParams({missingProperty:h._`${H}`},!0),E.error()})}m.checkReportMissingProp=v;function y({gen:E,data:H,it:{opts:K}},L,j){return(0,h.or)(...L.map((U)=>(0,h.and)(k(E,H,U,K.ownProperties),h._`${j} = ${U}`)))}m.checkMissingProp=y;function _(E,H){E.setParams({missingProperty:H},!0),E.error()}m.reportMissingProp=_;function S(E){return E.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:h._`Object.prototype.hasOwnProperty`})}m.hasPropFunc=S;function z(E,H,K){return h._`${S(E)}.call(${H}, ${K})`}m.isOwnProperty=z;function O(E,H,K,L){let j=h._`${H}${(0,h.getProperty)(K)} !== undefined`;return L?h._`${j} && ${z(E,H,K)}`:j}m.propertyInData=O;function k(E,H,K,L){let j=h._`${H}${(0,h.getProperty)(K)} === undefined`;return L?(0,h.or)(j,(0,h.not)(z(E,H,K))):j}m.noPropertyInData=k;function F(E){return E?Object.keys(E).filter((H)=>H!=="__proto__"):[]}m.allSchemaProperties=F;function B(E,H){return F(H).filter((K)=>!(0,p.alwaysValidSchema)(E,H[K]))}m.schemaProperties=B;function T({schemaCode:E,data:H,it:{gen:K,topSchemaRef:L,schemaPath:j,errorPath:U},it:Q},ne,ee,ie){let Se=ie?h._`${E}, ${H}, ${L}${j}`:H,ye=[[f.default.instancePath,(0,h.strConcat)(f.default.instancePath,U)],[f.default.parentData,Q.parentData],[f.default.parentDataProperty,Q.parentDataProperty],[f.default.rootData,f.default.rootData]];if(Q.opts.dynamicRef)ye.push([f.default.dynamicAnchors,f.default.dynamicAnchors]);let Ce=h._`${Se}, ${K.object(...ye)}`;return ee!==h.nil?h._`${ne}.call(${ee}, ${Ce})`:h._`${ne}(${Ce})`}m.callValidateCode=T;let M=h._`new RegExp`;function N({gen:E,it:{opts:H}},K){let L=H.unicodeRegExp?"u":"",{regExp:j}=H.code,U=j(K,L);return E.scopeValue("pattern",{key:U.toString(),ref:U,code:h._`${j.code==="new RegExp"?M:(0,g.useFunc)(E,j)}(${K}, ${L})`})}m.usePattern=N;function b(E){let{gen:H,data:K,keyword:L,it:j}=E,U=H.name("valid");if(j.allErrors){let ne=H.let("valid",!0);return Q(()=>H.assign(ne,!1)),ne}return H.var(U,!0),Q(()=>H.break()),U;function Q(ne){let ee=H.const("len",h._`${K}.length`);H.forRange("i",0,ee,(ie)=>{E.subschema({keyword:L,dataProp:ie,dataPropType:p.Type.Num},U),H.if((0,h.not)(U),ne)})}}m.validateArray=b;function V(E){let{gen:H,schema:K,keyword:L,it:j}=E;if(!Array.isArray(K))throw Error("ajv implementation error");if(K.some((ne)=>(0,p.alwaysValidSchema)(j,ne))&&!j.opts.unevaluated)return;let U=H.let("valid",!1),Q=H.name("_valid");H.block(()=>K.forEach((ne,ee)=>{let ie=E.subschema({keyword:L,schemaProp:ee,compositeRule:!0},Q);if(H.assign(U,h._`${U} || ${Q}`),!E.mergeValidEvaluated(ie,Q))H.if((0,h.not)(U))})),E.result(U,()=>E.reset(),()=>E.error(!0))}m.validateUnion=V}),zd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateKeywordUsage=m.validSchemaType=m.funcKeywordCode=m.macroKeywordCode=void 0;let h=$e(),p=lt(),f=ut(),g=gn();function v(B,T){let{gen:M,keyword:N,schema:b,parentSchema:V,it:E}=B,H=T.macro.call(E.self,b,V,E),K=O(M,N,H);if(E.opts.validateSchema!==!1)E.self.validateSchema(H,!0);let L=M.name("valid");B.subschema({schema:H,schemaPath:h.nil,errSchemaPath:`${E.errSchemaPath}/${N}`,topSchemaRef:K,compositeRule:!0},L),B.pass(L,()=>B.error(!0))}m.macroKeywordCode=v;function y(B,T){var M;let{gen:N,keyword:b,schema:V,parentSchema:E,$data:H,it:K}=B;z(K,T);let L=O(N,b,!H&&T.compile?T.compile.call(K.self,V,E,K):T.validate),j=N.let("valid");B.block$data(j,U),B.ok((M=T.valid)!==null&&M!==void 0?M:j);function U(){if(T.errors===!1){if(ee(),T.modifying)_(B);ie(()=>B.error())}else{let Se=T.async?Q():ne();if(T.modifying)_(B);ie(()=>S(B,Se))}}function Q(){let Se=N.let("ruleErrs",null);return N.try(()=>ee(h._`await `),(ye)=>N.assign(j,!1).if(h._`${ye} instanceof ${K.ValidationError}`,()=>N.assign(Se,h._`${ye}.errors`),()=>N.throw(ye))),Se}function ne(){let Se=h._`${L}.errors`;return N.assign(Se,null),ee(h.nil),Se}function ee(Se=T.async?h._`await `:h.nil){let ye=K.opts.passContext?p.default.this:p.default.self,Ce=!(("compile"in T)&&!H||T.schema===!1);N.assign(j,h._`${Se}${(0,f.callValidateCode)(B,L,ye,Ce)}`,T.modifying)}function ie(Se){var ye;N.if((0,h.not)((ye=T.valid)!==null&&ye!==void 0?ye:j),Se)}}m.funcKeywordCode=y;function _(B){let{gen:T,data:M,it:N}=B;T.if(N.parentData,()=>T.assign(M,h._`${N.parentData}[${N.parentDataProperty}]`))}function S(B,T){let{gen:M}=B;M.if(h._`Array.isArray(${T})`,()=>{M.assign(p.default.vErrors,h._`${p.default.vErrors} === null ? ${T} : ${p.default.vErrors}.concat(${T})`).assign(p.default.errors,h._`${p.default.vErrors}.length`),(0,g.extendErrors)(B)},()=>B.error())}function z({schemaEnv:B},T){if(T.async&&!B.$async)throw Error("async keyword in sync schema")}function O(B,T,M){if(M===void 0)throw Error(`keyword "${T}" failed to compile`);return B.scopeValue("keyword",typeof M=="function"?{ref:M}:{ref:M,code:(0,h.stringify)(M)})}function k(B,T,M=!1){return!T.length||T.some((N)=>N==="array"?Array.isArray(B):N==="object"?B&&typeof B=="object"&&!Array.isArray(B):typeof B==N||M&&typeof B>"u")}m.validSchemaType=k;function F({schema:B,opts:T,self:M,errSchemaPath:N},b,V){if(Array.isArray(b.keyword)?!b.keyword.includes(V):b.keyword!==V)throw Error("ajv implementation error");let E=b.dependencies;if(E===null||E===void 0?void 0:E.some((H)=>!Object.prototype.hasOwnProperty.call(B,H)))throw Error(`parent schema must have dependencies of ${V}: ${E.join(",")}`);if(b.validateSchema){if(!b.validateSchema(B[V])){let H=`keyword "${V}" value is invalid at path "${N}": `+M.errorsText(b.validateSchema.errors);if(T.validateSchema==="log")M.logger.error(H);else throw Error(H)}}}m.validateKeywordUsage=F}),wd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.extendSubschemaMode=m.extendSubschemaData=m.getSubschema=void 0;let h=$e(),p=Ie();function f(y,{keyword:_,schemaProp:S,schema:z,schemaPath:O,errSchemaPath:k,topSchemaRef:F}){if(_!==void 0&&z!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(_!==void 0){let B=y.schema[_];return S===void 0?{schema:B,schemaPath:h._`${y.schemaPath}${(0,h.getProperty)(_)}`,errSchemaPath:`${y.errSchemaPath}/${_}`}:{schema:B[S],schemaPath:h._`${y.schemaPath}${(0,h.getProperty)(_)}${(0,h.getProperty)(S)}`,errSchemaPath:`${y.errSchemaPath}/${_}/${(0,p.escapeFragment)(S)}`}}if(z!==void 0){if(O===void 0||k===void 0||F===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:z,schemaPath:O,topSchemaRef:F,errSchemaPath:k}}throw Error('either "keyword" or "schema" must be passed')}m.getSubschema=f;function g(y,_,{dataProp:S,dataPropType:z,data:O,dataTypes:k,propertyName:F}){if(O!==void 0&&S!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:B}=_;if(S!==void 0){let{errorPath:M,dataPathArr:N,opts:b}=_;T(B.let("data",h._`${_.data}${(0,h.getProperty)(S)}`,!0)),y.errorPath=h.str`${M}${(0,p.getErrorPath)(S,z,b.jsPropertySyntax)}`,y.parentDataProperty=h._`${S}`,y.dataPathArr=[...N,y.parentDataProperty]}if(O!==void 0){if(T(O instanceof h.Name?O:B.let("data",O,!0)),F!==void 0)y.propertyName=F}if(k)y.dataTypes=k;function T(M){y.data=M,y.dataLevel=_.dataLevel+1,y.dataTypes=[],_.definedProperties=new Set,y.parentData=_.data,y.dataNames=[..._.dataNames,M]}}m.extendSubschemaData=g;function v(y,{jtdDiscriminator:_,jtdMetadata:S,compositeRule:z,createErrors:O,allErrors:k}){if(z!==void 0)y.compositeRule=z;if(O!==void 0)y.createErrors=O;if(k!==void 0)y.allErrors=k;y.jtdDiscriminator=_,y.jtdMetadata=S}m.extendSubschemaMode=v}),Qc=ue((m,h)=>{h.exports=function p(f,g){if(f===g)return!0;if(f&&g&&typeof f=="object"&&typeof g=="object"){if(f.constructor!==g.constructor)return!1;var v,y,_;if(Array.isArray(f)){if(v=f.length,v!=g.length)return!1;for(y=v;y--!==0;)if(!p(f[y],g[y]))return!1;return!0}if(f.constructor===RegExp)return f.source===g.source&&f.flags===g.flags;if(f.valueOf!==Object.prototype.valueOf)return f.valueOf()===g.valueOf();if(f.toString!==Object.prototype.toString)return f.toString()===g.toString();if(_=Object.keys(f),v=_.length,v!==Object.keys(g).length)return!1;for(y=v;y--!==0;)if(!Object.prototype.hasOwnProperty.call(g,_[y]))return!1;for(y=v;y--!==0;){var S=_[y];if(!p(f[S],g[S]))return!1}return!0}return f!==f&&g!==g}}),$d=ue((m,h)=>{var p=h.exports=function(v,y,_){if(typeof y=="function")_=y,y={};_=y.cb||_;var S=typeof _=="function"?_:_.pre||function(){},z=_.post||function(){};f(y,S,z,v,"",v)};p.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},p.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},p.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},p.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};function f(v,y,_,S,z,O,k,F,B,T){if(S&&typeof S=="object"&&!Array.isArray(S)){y(S,z,O,k,F,B,T);for(var M in S){var N=S[M];if(Array.isArray(N)){if(M in p.arrayKeywords)for(var b=0;b<N.length;b++)f(v,y,_,N[b],z+"/"+M+"/"+b,O,z,M,S,b)}else if(M in p.propsKeywords){if(N&&typeof N=="object")for(var V in N)f(v,y,_,N[V],z+"/"+M+"/"+g(V),O,z,M,S,V)}else if(M in p.keywords||v.allKeys&&!(M in p.skipKeywords))f(v,y,_,N,z+"/"+M,O,z,M,S)}_(S,z,O,k,F,B,T)}}function g(v){return v.replace(/~/g,"~0").replace(/\//g,"~1")}}),Sn=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.getSchemaRefs=m.resolveUrl=m.normalizeId=m._getFullPath=m.getFullPath=m.inlineRef=void 0;let h=Ie(),p=Qc(),f=$d(),g=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function v(N,b=!0){if(typeof N=="boolean")return!0;if(b===!0)return!_(N);if(!b)return!1;return S(N)<=b}m.inlineRef=v;let y=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function _(N){for(let b in N){if(y.has(b))return!0;let V=N[b];if(Array.isArray(V)&&V.some(_))return!0;if(typeof V=="object"&&_(V))return!0}return!1}function S(N){let b=0;for(let V in N){if(V==="$ref")return 1/0;if(b++,g.has(V))continue;if(typeof N[V]=="object")(0,h.eachItem)(N[V],(E)=>b+=S(E));if(b===1/0)return 1/0}return b}function z(N,b="",V){if(V!==!1)b=F(b);return O(N,N.parse(b))}m.getFullPath=z;function O(N,b){return N.serialize(b).split("#")[0]+"#"}m._getFullPath=O;let k=/#\/?$/;function F(N){return N?N.replace(k,""):""}m.normalizeId=F;function B(N,b,V){return V=F(V),N.resolve(b,V)}m.resolveUrl=B;let T=/^[a-z_][-a-z0-9._]*$/i;function M(N,b){if(typeof N=="boolean")return{};let{schemaId:V,uriResolver:E}=this.opts,H=F(N[V]||b),K={"":H},L=z(E,H,!1),j={},U=new Set;return f(N,{allKeys:!0},(ee,ie,Se,ye)=>{if(ye===void 0)return;let Ce=L+ie,Ne=K[ye];if(typeof ee[V]=="string")Ne=je.call(this,ee[V]);He.call(this,ee.$anchor),He.call(this,ee.$dynamicAnchor),K[ie]=Ne;function je(qe){let Z=this.opts.uriResolver.resolve;if(qe=F(Ne?Z(Ne,qe):qe),U.has(qe))throw ne(qe);U.add(qe);let re=this.refs[qe];if(typeof re=="string")re=this.refs[re];if(typeof re=="object")Q(ee,re.schema,qe);else if(qe!==F(Ce))if(qe[0]==="#")Q(ee,j[qe],qe),j[qe]=ee;else this.refs[qe]=Ce;return qe}function He(qe){if(typeof qe=="string"){if(!T.test(qe))throw Error(`invalid anchor "${qe}"`);je.call(this,`#${qe}`)}}}),j;function Q(ee,ie,Se){if(ie!==void 0&&!p(ee,ie))throw ne(Se)}function ne(ee){return Error(`reference "${ee}" resolves to more than one schema`)}}m.getSchemaRefs=M}),qr=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.getData=m.KeywordCxt=m.validateFunctionCode=void 0;let h=bd(),p=fn(),f=Zc(),g=fn(),v=Rd(),y=zd(),_=wd(),S=$e(),z=lt(),O=Sn(),k=Ie(),F=gn();function B(G){if(L(G)){if(U(G),K(G)){b(G);return}}T(G,()=>(0,h.topBoolOrEmptySchema)(G))}m.validateFunctionCode=B;function T({gen:G,validateName:ae,schema:ce,schemaEnv:be,opts:Re},Ee){if(Re.code.es5)G.func(ae,S._`${z.default.data}, ${z.default.valCxt}`,be.$async,()=>{G.code(S._`"use strict"; ${E(ce,Re)}`),N(G,Re),G.code(Ee)});else G.func(ae,S._`${z.default.data}, ${M(Re)}`,be.$async,()=>G.code(E(ce,Re)).code(Ee))}function M(G){return S._`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${G.dynamicRef?S._`, ${z.default.dynamicAnchors}={}`:S.nil}}={}`}function N(G,ae){G.if(z.default.valCxt,()=>{if(G.var(z.default.instancePath,S._`${z.default.valCxt}.${z.default.instancePath}`),G.var(z.default.parentData,S._`${z.default.valCxt}.${z.default.parentData}`),G.var(z.default.parentDataProperty,S._`${z.default.valCxt}.${z.default.parentDataProperty}`),G.var(z.default.rootData,S._`${z.default.valCxt}.${z.default.rootData}`),ae.dynamicRef)G.var(z.default.dynamicAnchors,S._`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{if(G.var(z.default.instancePath,S._`""`),G.var(z.default.parentData,S._`undefined`),G.var(z.default.parentDataProperty,S._`undefined`),G.var(z.default.rootData,z.default.data),ae.dynamicRef)G.var(z.default.dynamicAnchors,S._`{}`)})}function b(G){let{schema:ae,opts:ce,gen:be}=G;T(G,()=>{if(ce.$comment&&ae.$comment)ye(G);if(ee(G),be.let(z.default.vErrors,null),be.let(z.default.errors,0),ce.unevaluated)V(G);Q(G),Ce(G)})}function V(G){let{gen:ae,validateName:ce}=G;G.evaluated=ae.const("evaluated",S._`${ce}.evaluated`),ae.if(S._`${G.evaluated}.dynamicProps`,()=>ae.assign(S._`${G.evaluated}.props`,S._`undefined`)),ae.if(S._`${G.evaluated}.dynamicItems`,()=>ae.assign(S._`${G.evaluated}.items`,S._`undefined`))}function E(G,ae){let ce=typeof G=="object"&&G[ae.schemaId];return ce&&(ae.code.source||ae.code.process)?S._`/*# sourceURL=${ce} */`:S.nil}function H(G,ae){if(L(G)){if(U(G),K(G)){j(G,ae);return}}(0,h.boolOrEmptySchema)(G,ae)}function K({schema:G,self:ae}){if(typeof G=="boolean")return!G;for(let ce in G)if(ae.RULES.all[ce])return!0;return!1}function L(G){return typeof G.schema!="boolean"}function j(G,ae){let{schema:ce,gen:be,opts:Re}=G;if(Re.$comment&&ce.$comment)ye(G);ie(G),Se(G);let Ee=be.const("_errs",z.default.errors);Q(G,Ee),be.var(ae,S._`${Ee} === ${z.default.errors}`)}function U(G){(0,k.checkUnknownRules)(G),ne(G)}function Q(G,ae){if(G.opts.jtd)return je(G,[],!1,ae);let ce=(0,p.getSchemaTypes)(G.schema);je(G,ce,!(0,p.coerceAndCheckDataType)(G,ce),ae)}function ne(G){let{schema:ae,errSchemaPath:ce,opts:be,self:Re}=G;if(ae.$ref&&be.ignoreKeywordsWithRef&&(0,k.schemaHasRulesButRef)(ae,Re.RULES))Re.logger.warn(`$ref: keywords ignored in schema at path "${ce}"`)}function ee(G){let{schema:ae,opts:ce}=G;if(ae.default!==void 0&&ce.useDefaults&&ce.strictSchema)(0,k.checkStrictMode)(G,"default is ignored in the schema root")}function ie(G){let ae=G.schema[G.opts.schemaId];if(ae)G.baseId=(0,O.resolveUrl)(G.opts.uriResolver,G.baseId,ae)}function Se(G){if(G.schema.$async&&!G.schemaEnv.$async)throw Error("async schema in sync schema")}function ye({gen:G,schemaEnv:ae,schema:ce,errSchemaPath:be,opts:Re}){let Ee=ce.$comment;if(Re.$comment===!0)G.code(S._`${z.default.self}.logger.log(${Ee})`);else if(typeof Re.$comment=="function"){let Ve=S.str`${be}/$comment`,Fe=G.scopeValue("root",{ref:ae.root});G.code(S._`${z.default.self}.opts.$comment(${Ee}, ${Ve}, ${Fe}.schema)`)}}function Ce(G){let{gen:ae,schemaEnv:ce,validateName:be,ValidationError:Re,opts:Ee}=G;if(ce.$async)ae.if(S._`${z.default.errors} === 0`,()=>ae.return(z.default.data),()=>ae.throw(S._`new ${Re}(${z.default.vErrors})`));else{if(ae.assign(S._`${be}.errors`,z.default.vErrors),Ee.unevaluated)Ne(G);ae.return(S._`${z.default.errors} === 0`)}}function Ne({gen:G,evaluated:ae,props:ce,items:be}){if(ce instanceof S.Name)G.assign(S._`${ae}.props`,ce);if(be instanceof S.Name)G.assign(S._`${ae}.items`,be)}function je(G,ae,ce,be){let{gen:Re,schema:Ee,data:Ve,allErrors:Fe,opts:Ge,self:xe}=G,{RULES:Me}=xe;if(Ee.$ref&&(Ge.ignoreKeywordsWithRef||!(0,k.schemaHasRulesButRef)(Ee,Me))){Re.block(()=>Te(G,"$ref",Me.all.$ref.definition));return}if(!Ge.jtd)qe(G,ae);Re.block(()=>{for(let Be of Me.rules)ot(Be);ot(Me.post)});function ot(Be){if(!(0,f.shouldUseGroup)(Ee,Be))return;if(Be.type){if(Re.if((0,g.checkDataType)(Be.type,Ve,Ge.strictNumbers)),He(G,Be),ae.length===1&&ae[0]===Be.type&&ce)Re.else(),(0,g.reportTypeError)(G);Re.endIf()}else He(G,Be);if(!Fe)Re.if(S._`${z.default.errors} === ${be||0}`)}}function He(G,ae){let{gen:ce,schema:be,opts:{useDefaults:Re}}=G;if(Re)(0,v.assignDefaults)(G,ae.type);ce.block(()=>{for(let Ee of ae.rules)if((0,f.shouldUseRule)(be,Ee))Te(G,Ee.keyword,Ee.definition,ae.type)})}function qe(G,ae){if(G.schemaEnv.meta||!G.opts.strictTypes)return;if(Z(G,ae),!G.opts.allowUnionTypes)re(G,ae);he(G,G.dataTypes)}function Z(G,ae){if(!ae.length)return;if(!G.dataTypes.length){G.dataTypes=ae;return}ae.forEach((ce)=>{if(!W(G.dataTypes,ce))ge(G,`type "${ce}" not allowed by context "${G.dataTypes.join(",")}"`)}),te(G,ae)}function re(G,ae){if(ae.length>1&&!(ae.length===2&&ae.includes("null")))ge(G,"use allowUnionTypes to allow union type keyword")}function he(G,ae){let ce=G.self.RULES.all;for(let be in ce){let Re=ce[be];if(typeof Re=="object"&&(0,f.shouldUseRule)(G.schema,Re)){let{type:Ee}=Re.definition;if(Ee.length&&!Ee.some((Ve)=>x(ae,Ve)))ge(G,`missing type "${Ee.join(",")}" for keyword "${be}"`)}}}function x(G,ae){return G.includes(ae)||ae==="number"&&G.includes("integer")}function W(G,ae){return G.includes(ae)||ae==="integer"&&G.includes("number")}function te(G,ae){let ce=[];for(let be of G.dataTypes)if(W(ae,be))ce.push(be);else if(ae.includes("integer")&&be==="number")ce.push("integer");G.dataTypes=ce}function ge(G,ae){let ce=G.schemaEnv.baseId+G.errSchemaPath;ae+=` at "${ce}" (strictTypes)`,(0,k.checkStrictMode)(G,ae,G.opts.strictTypes)}var _e=class{constructor(G,ae,ce){if((0,y.validateKeywordUsage)(G,ae,ce),this.gen=G.gen,this.allErrors=G.allErrors,this.keyword=ce,this.data=G.data,this.schema=G.schema[ce],this.$data=ae.$data&&G.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,k.schemaRefOrVal)(G,this.schema,ce,this.$data),this.schemaType=ae.schemaType,this.parentSchema=G.schema,this.params={},this.it=G,this.def=ae,this.$data)this.schemaCode=G.gen.const("vSchema",Qe(this.$data,G));else if(this.schemaCode=this.schemaValue,!(0,y.validSchemaType)(this.schema,ae.schemaType,ae.allowUndefined))throw Error(`${ce} value must be ${JSON.stringify(ae.schemaType)}`);if("code"in ae?ae.trackErrors:ae.errors!==!1)this.errsCount=G.gen.const("_errs",z.default.errors)}result(G,ae,ce){this.failResult((0,S.not)(G),ae,ce)}failResult(G,ae,ce){if(this.gen.if(G),ce)ce();else this.error();if(ae){if(this.gen.else(),ae(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(G,ae){this.failResult((0,S.not)(G),void 0,ae)}fail(G){if(G===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(G),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(G){if(!this.$data)return this.fail(G);let{schemaCode:ae}=this;this.fail(S._`${ae} !== undefined && (${(0,S.or)(this.invalid$data(),G)})`)}error(G,ae,ce){if(ae){this.setParams(ae),this._error(G,ce),this.setParams({});return}this._error(G,ce)}_error(G,ae){(G?F.reportExtraError:F.reportError)(this,this.def.error,ae)}$dataError(){(0,F.reportError)(this,this.def.$dataError||F.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,F.resetErrorsCount)(this.gen,this.errsCount)}ok(G){if(!this.allErrors)this.gen.if(G)}setParams(G,ae){if(ae)Object.assign(this.params,G);else this.params=G}block$data(G,ae,ce=S.nil){this.gen.block(()=>{this.check$data(G,ce),ae()})}check$data(G=S.nil,ae=S.nil){if(!this.$data)return;let{gen:ce,schemaCode:be,schemaType:Re,def:Ee}=this;if(ce.if((0,S.or)(S._`${be} === undefined`,ae)),G!==S.nil)ce.assign(G,!0);if(Re.length||Ee.validateSchema){if(ce.elseIf(this.invalid$data()),this.$dataError(),G!==S.nil)ce.assign(G,!1)}ce.else()}invalid$data(){let{gen:G,schemaCode:ae,schemaType:ce,def:be,it:Re}=this;return(0,S.or)(Ee(),Ve());function Ee(){if(ce.length){if(!(ae instanceof S.Name))throw Error("ajv implementation error");let Fe=Array.isArray(ce)?ce:[ce];return S._`${(0,g.checkDataTypes)(Fe,ae,Re.opts.strictNumbers,g.DataType.Wrong)}`}return S.nil}function Ve(){if(be.validateSchema){let Fe=G.scopeValue("validate$data",{ref:be.validateSchema});return S._`!${Fe}(${ae})`}return S.nil}}subschema(G,ae){let ce=(0,_.getSubschema)(this.it,G);(0,_.extendSubschemaData)(ce,this.it,G),(0,_.extendSubschemaMode)(ce,G);let be={...this.it,...ce,items:void 0,props:void 0};return H(be,ae),be}mergeEvaluated(G,ae){let{it:ce,gen:be}=this;if(!ce.opts.unevaluated)return;if(ce.props!==!0&&G.props!==void 0)ce.props=k.mergeEvaluated.props(be,G.props,ce.props,ae);if(ce.items!==!0&&G.items!==void 0)ce.items=k.mergeEvaluated.items(be,G.items,ce.items,ae)}mergeValidEvaluated(G,ae){let{it:ce,gen:be}=this;if(ce.opts.unevaluated&&(ce.props!==!0||ce.items!==!0))return be.if(ae,()=>this.mergeEvaluated(G,S.Name)),!0}};m.KeywordCxt=_e;function Te(G,ae,ce,be){let Re=new _e(G,ce,ae);if("code"in ce)ce.code(Re,be);else if(Re.$data&&ce.validate)(0,y.funcKeywordCode)(Re,ce);else if("macro"in ce)(0,y.macroKeywordCode)(Re,ce);else if(ce.compile||ce.validate)(0,y.funcKeywordCode)(Re,ce)}let ze=/^\/(?:[^~]|~0|~1)*$/,ke=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Qe(G,{dataLevel:ae,dataNames:ce,dataPathArr:be}){let Re,Ee;if(G==="")return z.default.rootData;if(G[0]==="/"){if(!ze.test(G))throw Error(`Invalid JSON-pointer: ${G}`);Re=G,Ee=z.default.rootData}else{let xe=ke.exec(G);if(!xe)throw Error(`Invalid JSON-pointer: ${G}`);let Me=+xe[1];if(Re=xe[2],Re==="#"){if(Me>=ae)throw Error(Ge("property/index",Me));return be[ae-Me]}if(Me>ae)throw Error(Ge("data",Me));if(Ee=ce[ae-Me],!Re)return Ee}let Ve=Ee,Fe=Re.split("/");for(let xe of Fe)if(xe)Ee=S._`${Ee}${(0,S.getProperty)((0,k.unescapeJsonPointer)(xe))}`,Ve=S._`${Ve} && ${Ee}`;return Ve;function Ge(xe,Me){return`Cannot access ${xe} ${Me} levels up, current level is ${ae}`}}m.getData=Qe}),Vs=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});var h=class extends Error{constructor(p){super("validation failed");this.errors=p,this.ajv=this.validation=!0}};m.default=h}),Ir=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Sn();var p=class extends Error{constructor(f,g,v,y){super(y||`can't resolve reference ${v} from id ${g}`);this.missingRef=(0,h.resolveUrl)(f,g,v),this.missingSchema=(0,h.normalizeId)((0,h.getFullPath)(f,this.missingRef))}};m.default=p}),yn=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.resolveSchema=m.getCompilingSchema=m.resolveRef=m.compileSchema=m.SchemaEnv=void 0;let h=$e(),p=Vs(),f=lt(),g=Sn(),v=Ie(),y=qr();var _=class{constructor(b){var V;this.refs={},this.dynamicAnchors={};let E;if(typeof b.schema=="object")E=b.schema;this.schema=b.schema,this.schemaId=b.schemaId,this.root=b.root||this,this.baseId=(V=b.baseId)!==null&&V!==void 0?V:(0,g.normalizeId)(E===null||E===void 0?void 0:E[b.schemaId||"$id"]),this.schemaPath=b.schemaPath,this.localRefs=b.localRefs,this.meta=b.meta,this.$async=E===null||E===void 0?void 0:E.$async,this.refs={}}};m.SchemaEnv=_;function S(b){let V=k.call(this,b);if(V)return V;let E=(0,g.getFullPath)(this.opts.uriResolver,b.root.baseId),{es5:H,lines:K}=this.opts.code,{ownProperties:L}=this.opts,j=new h.CodeGen(this.scope,{es5:H,lines:K,ownProperties:L}),U;if(b.$async)U=j.scopeValue("Error",{ref:p.default,code:h._`require("ajv/dist/runtime/validation_error").default`});let Q=j.scopeName("validate");b.validateName=Q;let ne={gen:j,allErrors:this.opts.allErrors,data:f.default.data,parentData:f.default.parentData,parentDataProperty:f.default.parentDataProperty,dataNames:[f.default.data],dataPathArr:[h.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:j.scopeValue("schema",this.opts.code.source===!0?{ref:b.schema,code:(0,h.stringify)(b.schema)}:{ref:b.schema}),validateName:Q,ValidationError:U,schema:b.schema,schemaEnv:b,rootId:E,baseId:b.baseId||E,schemaPath:h.nil,errSchemaPath:b.schemaPath||(this.opts.jtd?"":"#"),errorPath:h._`""`,opts:this.opts,self:this},ee;try{this._compilations.add(b),(0,y.validateFunctionCode)(ne),j.optimize(this.opts.code.optimize);let ie=j.toString();if(ee=`${j.scopeRefs(f.default.scope)}return ${ie}`,this.opts.code.process)ee=this.opts.code.process(ee,b);let Se=Function(`${f.default.self}`,`${f.default.scope}`,ee)(this,this.scope.get());if(this.scope.value(Q,{ref:Se}),Se.errors=null,Se.schema=b.schema,Se.schemaEnv=b,b.$async)Se.$async=!0;if(this.opts.code.source===!0)Se.source={validateName:Q,validateCode:ie,scopeValues:j._values};if(this.opts.unevaluated){let{props:ye,items:Ce}=ne;if(Se.evaluated={props:ye instanceof h.Name?void 0:ye,items:Ce instanceof h.Name?void 0:Ce,dynamicProps:ye instanceof h.Name,dynamicItems:Ce instanceof h.Name},Se.source)Se.source.evaluated=(0,h.stringify)(Se.evaluated)}return b.validate=Se,b}catch(ie){if(delete b.validate,delete b.validateName,ee)this.logger.error("Error compiling schema, function code:",ee);throw ie}finally{this._compilations.delete(b)}}m.compileSchema=S;function z(b,V,E){var H;E=(0,g.resolveUrl)(this.opts.uriResolver,V,E);let K=b.refs[E];if(K)return K;let L=B.call(this,b,E);if(L===void 0){let j=(H=b.localRefs)===null||H===void 0?void 0:H[E],{schemaId:U}=this.opts;if(j)L=new _({schema:j,schemaId:U,root:b,baseId:V})}if(L===void 0)return;return b.refs[E]=O.call(this,L)}m.resolveRef=z;function O(b){if((0,g.inlineRef)(b.schema,this.opts.inlineRefs))return b.schema;return b.validate?b:S.call(this,b)}function k(b){for(let V of this._compilations)if(F(V,b))return V}m.getCompilingSchema=k;function F(b,V){return b.schema===V.schema&&b.root===V.root&&b.baseId===V.baseId}function B(b,V){let E;while(typeof(E=this.refs[V])=="string")V=E;return E||this.schemas[V]||T.call(this,b,V)}function T(b,V){let E=this.opts.uriResolver.parse(V),H=(0,g._getFullPath)(this.opts.uriResolver,E),K=(0,g.getFullPath)(this.opts.uriResolver,b.baseId,void 0);if(Object.keys(b.schema).length>0&&H===K)return N.call(this,E,b);let L=(0,g.normalizeId)(H),j=this.refs[L]||this.schemas[L];if(typeof j=="string"){let U=T.call(this,b,j);if(typeof(U===null||U===void 0?void 0:U.schema)!=="object")return;return N.call(this,E,U)}if(typeof(j===null||j===void 0?void 0:j.schema)!=="object")return;if(!j.validate)S.call(this,j);if(L===(0,g.normalizeId)(V)){let{schema:U}=j,{schemaId:Q}=this.opts,ne=U[Q];if(ne)K=(0,g.resolveUrl)(this.opts.uriResolver,K,ne);return new _({schema:U,schemaId:Q,root:b,baseId:K})}return N.call(this,E,j)}m.resolveSchema=T;let M=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function N(b,{baseId:V,schema:E,root:H}){var K;if(((K=b.fragment)===null||K===void 0?void 0:K[0])!=="/")return;for(let U of b.fragment.slice(1).split("/")){if(typeof E==="boolean")return;let Q=E[(0,v.unescapeFragment)(U)];if(Q===void 0)return;E=Q;let ne=typeof E==="object"&&E[this.opts.schemaId];if(!M.has(U)&&ne)V=(0,g.resolveUrl)(this.opts.uriResolver,V,ne)}let L;if(typeof E!="boolean"&&E.$ref&&!(0,v.schemaHasRulesButRef)(E,this.RULES)){let U=(0,g.resolveUrl)(this.opts.uriResolver,V,E.$ref);L=T.call(this,H,U)}let{schemaId:j}=this.opts;if(L=L||new _({schema:E,schemaId:j,root:H,baseId:V}),L.schema!==L.root.schema)return L}}),Ed=ue((m,h)=>{h.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}}),el=ue((m,h)=>{let p=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),f=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 g(T){let M="",N=0,b=0;for(b=0;b<T.length;b++){if(N=T[b].charCodeAt(0),N===48)continue;if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=T[b];break}for(b+=1;b<T.length;b++){if(N=T[b].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=T[b]}return M}let v=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function y(T){return T.length=0,!0}function _(T,M,N){if(T.length){let b=g(T);if(b!=="")M.push(b);else return N.error=!0,!1;T.length=0}return!0}function S(T){let M=0,N={error:!1,address:"",zone:""},b=[],V=[],E=!1,H=!1,K=_;for(let L=0;L<T.length;L++){let j=T[L];if(j==="["||j==="]")continue;if(j===":"){if(E===!0)H=!0;if(!K(V,b,N))break;if(++M>7){N.error=!0;break}if(L>0&&T[L-1]===":")E=!0;b.push(":");continue}else if(j==="%"){if(!K(V,b,N))break;K=y}else{V.push(j);continue}}if(V.length)if(K===y)N.zone=V.join("");else if(H)b.push(V.join(""));else b.push(g(V));return N.address=b.join(""),N}function z(T){if(O(T,":")<2)return{host:T,isIPV6:!1};let M=S(T);if(!M.error){let{address:N,address:b}=M;if(M.zone)N+="%"+M.zone,b+="%25"+M.zone;return{host:N,isIPV6:!0,escapedHost:b}}else return{host:T,isIPV6:!1}}function O(T,M){let N=0;for(let b=0;b<T.length;b++)if(T[b]===M)N++;return N}function k(T){let M=T,N=[],b=-1,V=0;while(V=M.length){if(V===1)if(M===".")break;else if(M==="/"){N.push("/");break}else{N.push(M);break}else if(V===2){if(M[0]==="."){if(M[1]===".")break;else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."||M[1]==="/"){N.push("/");break}}}else if(V===3){if(M==="/.."){if(N.length!==0)N.pop();N.push("/");break}}if(M[0]==="."){if(M[1]==="."){if(M[2]==="/"){M=M.slice(3);continue}}else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."){if(M[2]==="/"){M=M.slice(2);continue}else if(M[2]==="."){if(M[3]==="/"){if(M=M.slice(3),N.length!==0)N.pop();continue}}}}if((b=M.indexOf("/",1))===-1){N.push(M);break}else N.push(M.slice(0,b)),M=M.slice(b)}return N.join("")}function F(T,M){let N=M!==!0?escape:unescape;if(T.scheme!==void 0)T.scheme=N(T.scheme);if(T.userinfo!==void 0)T.userinfo=N(T.userinfo);if(T.host!==void 0)T.host=N(T.host);if(T.path!==void 0)T.path=N(T.path);if(T.query!==void 0)T.query=N(T.query);if(T.fragment!==void 0)T.fragment=N(T.fragment);return T}function B(T){let M=[];if(T.userinfo!==void 0)M.push(T.userinfo),M.push("@");if(T.host!==void 0){let N=unescape(T.host);if(!f(N)){let b=z(N);if(b.isIPV6===!0)N=`[${b.escapedHost}]`;else N=T.host}M.push(N)}if(typeof T.port==="number"||typeof T.port==="string")M.push(":"),M.push(String(T.port));return M.length?M.join(""):void 0}h.exports={nonSimpleDomain:v,recomposeAuthority:B,normalizeComponentEncoding:F,removeDotSegments:k,isIPv4:f,isUUID:p,normalizeIPv6:z,stringArrayToHexStripped:g}}),Td=ue((m,h)=>{let{isUUID:p}=el(),f=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,g=["http","https","ws","wss","urn","urn:uuid"];function v(j){return g.indexOf(j)!==-1}function y(j){if(j.secure===!0)return!0;else if(j.secure===!1)return!1;else if(j.scheme)return j.scheme.length===3&&(j.scheme[0]==="w"||j.scheme[0]==="W")&&(j.scheme[1]==="s"||j.scheme[1]==="S")&&(j.scheme[2]==="s"||j.scheme[2]==="S");else return!1}function _(j){if(!j.host)j.error=j.error||"HTTP URIs must have a host.";return j}function S(j){let U=String(j.scheme).toLowerCase()==="https";if(j.port===(U?443:80)||j.port==="")j.port=void 0;if(!j.path)j.path="/";return j}function z(j){return j.secure=y(j),j.resourceName=(j.path||"/")+(j.query?"?"+j.query:""),j.path=void 0,j.query=void 0,j}function O(j){if(j.port===(y(j)?443:80)||j.port==="")j.port=void 0;if(typeof j.secure==="boolean")j.scheme=j.secure?"wss":"ws",j.secure=void 0;if(j.resourceName){let[U,Q]=j.resourceName.split("?");j.path=U&&U!=="/"?U:void 0,j.query=Q,j.resourceName=void 0}return j.fragment=void 0,j}function k(j,U){if(!j.path)return j.error="URN can not be parsed",j;let Q=j.path.match(f);if(Q){let ne=U.scheme||j.scheme||"urn";j.nid=Q[1].toLowerCase(),j.nss=Q[2];let ee=L(`${ne}:${U.nid||j.nid}`);if(j.path=void 0,ee)j=ee.parse(j,U)}else j.error=j.error||"URN can not be parsed.";return j}function F(j,U){if(j.nid===void 0)throw Error("URN without nid cannot be serialized");let Q=U.scheme||j.scheme||"urn",ne=j.nid.toLowerCase(),ee=L(`${Q}:${U.nid||ne}`);if(ee)j=ee.serialize(j,U);let ie=j,Se=j.nss;return ie.path=`${ne||U.nid}:${Se}`,U.skipEscape=!0,ie}function B(j,U){let Q=j;if(Q.uuid=Q.nss,Q.nss=void 0,!U.tolerant&&(!Q.uuid||!p(Q.uuid)))Q.error=Q.error||"UUID is not valid.";return Q}function T(j){let U=j;return U.nss=(j.uuid||"").toLowerCase(),U}let M={scheme:"http",domainHost:!0,parse:_,serialize:S},N={scheme:"https",domainHost:M.domainHost,parse:_,serialize:S},b={scheme:"ws",domainHost:!0,parse:z,serialize:O},V={scheme:"wss",domainHost:b.domainHost,parse:b.parse,serialize:b.serialize},K={http:M,https:N,ws:b,wss:V,urn:{scheme:"urn",parse:k,serialize:F,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:B,serialize:T,skipNormalize:!0}};Object.setPrototypeOf(K,null);function L(j){return j&&(K[j]||K[j.toLowerCase()])||void 0}h.exports={wsIsSecure:y,SCHEMES:K,isValidSchemeName:v,getSchemeHandler:L}}),Pd=ue((m,h)=>{let{normalizeIPv6:p,removeDotSegments:f,recomposeAuthority:g,normalizeComponentEncoding:v,isIPv4:y,nonSimpleDomain:_}=el(),{SCHEMES:S,getSchemeHandler:z}=Td();function O(V,E){if(typeof V==="string")V=T(N(V,E),E);else if(typeof V==="object")V=N(T(V,E),E);return V}function k(V,E,H){let K=H?Object.assign({scheme:"null"},H):{scheme:"null"},L=F(N(V,K),N(E,K),K,!0);return K.skipEscape=!0,T(L,K)}function F(V,E,H,K){let L={};if(!K)V=N(T(V,H),H),E=N(T(E,H),H);if(H=H||{},!H.tolerant&&E.scheme)L.scheme=E.scheme,L.userinfo=E.userinfo,L.host=E.host,L.port=E.port,L.path=f(E.path||""),L.query=E.query;else{if(E.userinfo!==void 0||E.host!==void 0||E.port!==void 0)L.userinfo=E.userinfo,L.host=E.host,L.port=E.port,L.path=f(E.path||""),L.query=E.query;else{if(!E.path)if(L.path=V.path,E.query!==void 0)L.query=E.query;else L.query=V.query;else{if(E.path[0]==="/")L.path=f(E.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)L.path="/"+E.path;else if(!V.path)L.path=E.path;else L.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+E.path;L.path=f(L.path)}L.query=E.query}L.userinfo=V.userinfo,L.host=V.host,L.port=V.port}L.scheme=V.scheme}return L.fragment=E.fragment,L}function B(V,E,H){if(typeof V==="string")V=unescape(V),V=T(v(N(V,H),!0),{...H,skipEscape:!0});else if(typeof V==="object")V=T(v(V,!0),{...H,skipEscape:!0});if(typeof E==="string")E=unescape(E),E=T(v(N(E,H),!0),{...H,skipEscape:!0});else if(typeof E==="object")E=T(v(E,!0),{...H,skipEscape:!0});return V.toLowerCase()===E.toLowerCase()}function T(V,E){let H={host:V.host,scheme:V.scheme,userinfo:V.userinfo,port:V.port,path:V.path,query:V.query,nid:V.nid,nss:V.nss,uuid:V.uuid,fragment:V.fragment,reference:V.reference,resourceName:V.resourceName,secure:V.secure,error:""},K=Object.assign({},E),L=[],j=z(K.scheme||H.scheme);if(j&&j.serialize)j.serialize(H,K);if(H.path!==void 0)if(!K.skipEscape){if(H.path=escape(H.path),H.scheme!==void 0)H.path=H.path.split("%3A").join(":")}else H.path=unescape(H.path);if(K.reference!=="suffix"&&H.scheme)L.push(H.scheme,":");let U=g(H);if(U!==void 0){if(K.reference!=="suffix")L.push("//");if(L.push(U),H.path&&H.path[0]!=="/")L.push("/")}if(H.path!==void 0){let Q=H.path;if(!K.absolutePath&&(!j||!j.absolutePath))Q=f(Q);if(U===void 0&&Q[0]==="/"&&Q[1]==="/")Q="/%2F"+Q.slice(2);L.push(Q)}if(H.query!==void 0)L.push("?",H.query);if(H.fragment!==void 0)L.push("#",H.fragment);return L.join("")}let M=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function N(V,E){let H=Object.assign({},E),K={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},L=!1;if(H.reference==="suffix")if(H.scheme)V=H.scheme+":"+V;else V="//"+V;let j=V.match(M);if(j){if(K.scheme=j[1],K.userinfo=j[3],K.host=j[4],K.port=parseInt(j[5],10),K.path=j[6]||"",K.query=j[7],K.fragment=j[8],isNaN(K.port))K.port=j[5];if(K.host)if(y(K.host)===!1){let Q=p(K.host);K.host=Q.host.toLowerCase(),L=Q.isIPV6}else L=!0;if(K.scheme===void 0&&K.userinfo===void 0&&K.host===void 0&&K.port===void 0&&K.query===void 0&&!K.path)K.reference="same-document";else if(K.scheme===void 0)K.reference="relative";else if(K.fragment===void 0)K.reference="absolute";else K.reference="uri";if(H.reference&&H.reference!=="suffix"&&H.reference!==K.reference)K.error=K.error||"URI is not a "+H.reference+" reference.";let U=z(H.scheme||K.scheme);if(!H.unicodeSupport&&(!U||!U.unicodeSupport)){if(K.host&&(H.domainHost||U&&U.domainHost)&&L===!1&&_(K.host))try{K.host=URL.domainToASCII(K.host.toLowerCase())}catch(Q){K.error=K.error||"Host's domain name can not be converted to ASCII: "+Q}}if(!U||U&&!U.skipNormalize){if(V.indexOf("%")!==-1){if(K.scheme!==void 0)K.scheme=unescape(K.scheme);if(K.host!==void 0)K.host=unescape(K.host)}if(K.path)K.path=escape(unescape(K.path));if(K.fragment)K.fragment=encodeURI(decodeURIComponent(K.fragment))}if(U&&U.parse)U.parse(K,H)}else K.error=K.error||"URI can not be parsed.";return K}let b={SCHEMES:S,normalize:O,resolve:k,resolveComponent:F,equal:B,serialize:T,parse:N};h.exports=b,h.exports.default=b,h.exports.fastUri=b}),Cd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Pd();h.code='require("ajv/dist/runtime/uri").default',m.default=h}),ji=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=void 0;var h=qr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var p=$e();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});let f=Vs(),g=Ir(),v=Xc(),y=yn(),_=$e(),S=Sn(),z=fn(),O=Ie(),k=Ed(),F=Cd(),B=(Z,re)=>new RegExp(Z,re);B.code="new RegExp";let T=["removeAdditional","useDefaults","coerceTypes"],M=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),N={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."},b={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},V=200;function E(Z){var re,he,x,W,te,ge,_e,Te,ze,ke,Qe,G,ae,ce,be,Re,Ee,Ve,Fe,Ge,xe,Me,ot,Be,ht;let it=Z.strict,pt=(re=Z.code)===null||re===void 0?void 0:re.optimize,_t=pt===!0||pt===void 0?1:pt||0,bt=(x=(he=Z.code)===null||he===void 0?void 0:he.regExp)!==null&&x!==void 0?x:B,Lt=(W=Z.uriResolver)!==null&&W!==void 0?W:F.default;return{strictSchema:(ge=(te=Z.strictSchema)!==null&&te!==void 0?te:it)!==null&&ge!==void 0?ge:!0,strictNumbers:(Te=(_e=Z.strictNumbers)!==null&&_e!==void 0?_e:it)!==null&&Te!==void 0?Te:!0,strictTypes:(ke=(ze=Z.strictTypes)!==null&&ze!==void 0?ze:it)!==null&&ke!==void 0?ke:"log",strictTuples:(G=(Qe=Z.strictTuples)!==null&&Qe!==void 0?Qe:it)!==null&&G!==void 0?G:"log",strictRequired:(ce=(ae=Z.strictRequired)!==null&&ae!==void 0?ae:it)!==null&&ce!==void 0?ce:!1,code:Z.code?{...Z.code,optimize:_t,regExp:bt}:{optimize:_t,regExp:bt},loopRequired:(be=Z.loopRequired)!==null&&be!==void 0?be:V,loopEnum:(Re=Z.loopEnum)!==null&&Re!==void 0?Re:V,meta:(Ee=Z.meta)!==null&&Ee!==void 0?Ee:!0,messages:(Ve=Z.messages)!==null&&Ve!==void 0?Ve:!0,inlineRefs:(Fe=Z.inlineRefs)!==null&&Fe!==void 0?Fe:!0,schemaId:(Ge=Z.schemaId)!==null&&Ge!==void 0?Ge:"$id",addUsedSchema:(xe=Z.addUsedSchema)!==null&&xe!==void 0?xe:!0,validateSchema:(Me=Z.validateSchema)!==null&&Me!==void 0?Me:!0,validateFormats:(ot=Z.validateFormats)!==null&&ot!==void 0?ot:!0,unicodeRegExp:(Be=Z.unicodeRegExp)!==null&&Be!==void 0?Be:!0,int32range:(ht=Z.int32range)!==null&&ht!==void 0?ht:!0,uriResolver:Lt}}var H=class{constructor(Z={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Z=this.opts={...Z,...E(Z)};let{es5:re,lines:he}=this.opts.code;this.scope=new _.ValueScope({scope:{},prefixes:M,es5:re,lines:he}),this.logger=ie(Z.logger);let x=Z.validateFormats;if(Z.validateFormats=!1,this.RULES=(0,v.getRules)(),K.call(this,N,Z,"NOT SUPPORTED"),K.call(this,b,Z,"DEPRECATED","warn"),this._metaOpts=ne.call(this),Z.formats)U.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Z.keywords)Q.call(this,Z.keywords);if(typeof Z.meta=="object")this.addMetaSchema(Z.meta);j.call(this),Z.validateFormats=x}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Z,meta:re,schemaId:he}=this.opts,x=k;if(he==="id")x={...k},x.id=x.$id,delete x.$id;if(re&&Z)this.addMetaSchema(x,x[he],!1)}defaultMeta(){let{meta:Z,schemaId:re}=this.opts;return this.opts.defaultMeta=typeof Z=="object"?Z[re]||Z:void 0}validate(Z,re){let he;if(typeof Z=="string"){if(he=this.getSchema(Z),!he)throw Error(`no schema with key or ref "${Z}"`)}else he=this.compile(Z);let x=he(re);if(!("$async"in he))this.errors=he.errors;return x}compile(Z,re){let he=this._addSchema(Z,re);return he.validate||this._compileSchemaEnv(he)}compileAsync(Z,re){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:he}=this.opts;return x.call(this,Z,re);async function x(ze,ke){await W.call(this,ze.$schema);let Qe=this._addSchema(ze,ke);return Qe.validate||te.call(this,Qe)}async function W(ze){if(ze&&!this.getSchema(ze))await x.call(this,{$ref:ze},!0)}async function te(ze){try{return this._compileSchemaEnv(ze)}catch(ke){if(!(ke instanceof g.default))throw ke;return ge.call(this,ke),await _e.call(this,ke.missingSchema),te.call(this,ze)}}function ge({missingSchema:ze,missingRef:ke}){if(this.refs[ze])throw Error(`AnySchema ${ze} is loaded but ${ke} cannot be resolved`)}async function _e(ze){let ke=await Te.call(this,ze);if(!this.refs[ze])await W.call(this,ke.$schema);if(!this.refs[ze])this.addSchema(ke,ze,re)}async function Te(ze){let ke=this._loading[ze];if(ke)return ke;try{return await(this._loading[ze]=he(ze))}finally{delete this._loading[ze]}}}addSchema(Z,re,he,x=this.opts.validateSchema){if(Array.isArray(Z)){for(let te of Z)this.addSchema(te,void 0,he,x);return this}let W;if(typeof Z==="object"){let{schemaId:te}=this.opts;if(W=Z[te],W!==void 0&&typeof W!="string")throw Error(`schema ${te} must be string`)}return re=(0,S.normalizeId)(re||W),this._checkUnique(re),this.schemas[re]=this._addSchema(Z,he,re,x,!0),this}addMetaSchema(Z,re,he=this.opts.validateSchema){return this.addSchema(Z,re,!0,he),this}validateSchema(Z,re){if(typeof Z=="boolean")return!0;let he;if(he=Z.$schema,he!==void 0&&typeof he!="string")throw Error("$schema must be a string");if(he=he||this.opts.defaultMeta||this.defaultMeta(),!he)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let x=this.validate(he,Z);if(!x&&re){let W="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(W);else throw Error(W)}return x}getSchema(Z){let re;while(typeof(re=L.call(this,Z))=="string")Z=re;if(re===void 0){let{schemaId:he}=this.opts,x=new y.SchemaEnv({schema:{},schemaId:he});if(re=y.resolveSchema.call(this,x,Z),!re)return;this.refs[Z]=re}return re.validate||this._compileSchemaEnv(re)}removeSchema(Z){if(Z instanceof RegExp)return this._removeAllSchemas(this.schemas,Z),this._removeAllSchemas(this.refs,Z),this;switch(typeof Z){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let re=L.call(this,Z);if(typeof re=="object")this._cache.delete(re.schema);return delete this.schemas[Z],delete this.refs[Z],this}case"object":{let re=Z;this._cache.delete(re);let he=Z[this.opts.schemaId];if(he)he=(0,S.normalizeId)(he),delete this.schemas[he],delete this.refs[he];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Z){for(let re of Z)this.addKeyword(re);return this}addKeyword(Z,re){let he;if(typeof Z=="string"){if(he=Z,typeof re=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),re.keyword=he}else if(typeof Z=="object"&&re===void 0){if(re=Z,he=re.keyword,Array.isArray(he)&&!he.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(ye.call(this,he,re),!re)return(0,O.eachItem)(he,(W)=>Ce.call(this,W)),this;je.call(this,re);let x={...re,type:(0,z.getJSONTypes)(re.type),schemaType:(0,z.getJSONTypes)(re.schemaType)};return(0,O.eachItem)(he,x.type.length===0?(W)=>Ce.call(this,W,x):(W)=>x.type.forEach((te)=>Ce.call(this,W,x,te))),this}getKeyword(Z){let re=this.RULES.all[Z];return typeof re=="object"?re.definition:!!re}removeKeyword(Z){let{RULES:re}=this;delete re.keywords[Z],delete re.all[Z];for(let he of re.rules){let x=he.rules.findIndex((W)=>W.keyword===Z);if(x>=0)he.rules.splice(x,1)}return this}addFormat(Z,re){if(typeof re=="string")re=new RegExp(re);return this.formats[Z]=re,this}errorsText(Z=this.errors,{separator:re=", ",dataVar:he="data"}={}){if(!Z||Z.length===0)return"No errors";return Z.map((x)=>`${he}${x.instancePath} ${x.message}`).reduce((x,W)=>x+re+W)}$dataMetaSchema(Z,re){let he=this.RULES.all;Z=JSON.parse(JSON.stringify(Z));for(let x of re){let W=x.split("/").slice(1),te=Z;for(let ge of W)te=te[ge];for(let ge in he){let _e=he[ge];if(typeof _e!="object")continue;let{$data:Te}=_e.definition,ze=te[ge];if(Te&&ze)te[ge]=qe(ze)}}return Z}_removeAllSchemas(Z,re){for(let he in Z){let x=Z[he];if(!re||re.test(he)){if(typeof x=="string")delete Z[he];else if(x&&!x.meta)this._cache.delete(x.schema),delete Z[he]}}}_addSchema(Z,re,he,x=this.opts.validateSchema,W=this.opts.addUsedSchema){let te,{schemaId:ge}=this.opts;if(typeof Z=="object")te=Z[ge];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Z!="boolean")throw Error("schema must be object or boolean");let _e=this._cache.get(Z);if(_e!==void 0)return _e;he=(0,S.normalizeId)(te||he);let Te=S.getSchemaRefs.call(this,Z,he);if(_e=new y.SchemaEnv({schema:Z,schemaId:ge,meta:re,baseId:he,localRefs:Te}),this._cache.set(_e.schema,_e),W&&!he.startsWith("#")){if(he)this._checkUnique(he);this.refs[he]=_e}if(x)this.validateSchema(Z,!0);return _e}_checkUnique(Z){if(this.schemas[Z]||this.refs[Z])throw Error(`schema with key or id "${Z}" already exists`)}_compileSchemaEnv(Z){if(Z.meta)this._compileMetaSchema(Z);else y.compileSchema.call(this,Z);if(!Z.validate)throw Error("ajv implementation error");return Z.validate}_compileMetaSchema(Z){let re=this.opts;this.opts=this._metaOpts;try{y.compileSchema.call(this,Z)}finally{this.opts=re}}};H.ValidationError=f.default,H.MissingRefError=g.default,m.default=H;function K(Z,re,he,x="error"){for(let W in Z){let te=W;if(te in re)this.logger[x](`${he}: option ${W}. ${Z[te]}`)}}function L(Z){return Z=(0,S.normalizeId)(Z),this.schemas[Z]||this.refs[Z]}function j(){let Z=this.opts.schemas;if(!Z)return;if(Array.isArray(Z))this.addSchema(Z);else for(let re in Z)this.addSchema(Z[re],re)}function U(){for(let Z in this.opts.formats){let re=this.opts.formats[Z];if(re)this.addFormat(Z,re)}}function Q(Z){if(Array.isArray(Z)){this.addVocabulary(Z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let re in Z){let he=Z[re];if(!he.keyword)he.keyword=re;this.addKeyword(he)}}function ne(){let Z={...this.opts};for(let re of T)delete Z[re];return Z}let ee={log(){},warn(){},error(){}};function ie(Z){if(Z===!1)return ee;if(Z===void 0)return console;if(Z.log&&Z.warn&&Z.error)return Z;throw Error("logger must implement log, warn and error methods")}let Se=/^[a-z_$][a-z0-9_$:-]*$/i;function ye(Z,re){let{RULES:he}=this;if((0,O.eachItem)(Z,(x)=>{if(he.keywords[x])throw Error(`Keyword ${x} is already defined`);if(!Se.test(x))throw Error(`Keyword ${x} has invalid name`)}),!re)return;if(re.$data&&!(("code"in re)||("validate"in re)))throw Error('$data keyword must have "code" or "validate" function')}function Ce(Z,re,he){var x;let W=re===null||re===void 0?void 0:re.post;if(he&&W)throw Error('keyword with "post" flag cannot have "type"');let{RULES:te}=this,ge=W?te.post:te.rules.find(({type:Te})=>Te===he);if(!ge)ge={type:he,rules:[]},te.rules.push(ge);if(te.keywords[Z]=!0,!re)return;let _e={keyword:Z,definition:{...re,type:(0,z.getJSONTypes)(re.type),schemaType:(0,z.getJSONTypes)(re.schemaType)}};if(re.before)Ne.call(this,ge,_e,re.before);else ge.rules.push(_e);te.all[Z]=_e,(x=re.implements)===null||x===void 0||x.forEach((Te)=>this.addKeyword(Te))}function Ne(Z,re,he){let x=Z.rules.findIndex((W)=>W.keyword===he);if(x>=0)Z.rules.splice(x,0,re);else Z.rules.push(re),this.logger.warn(`rule ${he} is not defined`)}function je(Z){let{metaSchema:re}=Z;if(re===void 0)return;if(Z.$data&&this.opts.$data)re=qe(re);Z.validateSchema=this.compile(re,!0)}let He={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function qe(Z){return{anyOf:[Z,He]}}});var qd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};m.default=h}),ki=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.callRef=m.getValidate=void 0;let h=Ir(),p=ut(),f=$e(),g=lt(),v=yn(),y=Ie(),_={keyword:"$ref",schemaType:"string",code(O){let{gen:k,schema:F,it:B}=O,{baseId:T,schemaEnv:M,validateName:N,opts:b,self:V}=B,{root:E}=M;if((F==="#"||F==="#/")&&T===E.baseId)return K();let H=v.resolveRef.call(V,E,T,F);if(H===void 0)throw new h.default(B.opts.uriResolver,T,F);if(H instanceof v.SchemaEnv)return L(H);return j(H);function K(){if(M===E)return z(O,N,M,M.$async);let U=k.scopeValue("root",{ref:E});return z(O,f._`${U}.validate`,E,E.$async)}function L(U){z(O,S(O,U),U,U.$async)}function j(U){let Q=k.scopeValue("schema",b.code.source===!0?{ref:U,code:(0,f.stringify)(U)}:{ref:U}),ne=k.name("valid"),ee=O.subschema({schema:U,dataTypes:[],schemaPath:f.nil,topSchemaRef:Q,errSchemaPath:F},ne);O.mergeEvaluated(ee),O.ok(ne)}}};function S(O,k){let{gen:F}=O;return k.validate?F.scopeValue("validate",{ref:k.validate}):f._`${F.scopeValue("wrapper",{ref:k})}.validate`}m.getValidate=S;function z(O,k,F,B){let{gen:T,it:M}=O,{allErrors:N,schemaEnv:b,opts:V}=M,E=V.passContext?g.default.this:f.nil;if(B)H();else K();function H(){if(!b.$async)throw Error("async schema referenced by sync schema");let U=T.let("valid");T.try(()=>{if(T.code(f._`await ${(0,p.callValidateCode)(O,k,E)}`),j(k),!N)T.assign(U,!0)},(Q)=>{if(T.if(f._`!(${Q} instanceof ${M.ValidationError})`,()=>T.throw(Q)),L(Q),!N)T.assign(U,!1)}),O.ok(U)}function K(){O.result((0,p.callValidateCode)(O,k,E),()=>j(k),()=>L(k))}function L(U){let Q=f._`${U}.errors`;T.assign(g.default.vErrors,f._`${g.default.vErrors} === null ? ${Q} : ${g.default.vErrors}.concat(${Q})`),T.assign(g.default.errors,f._`${g.default.vErrors}.length`)}function j(U){var Q;if(!M.opts.unevaluated)return;let ne=(Q=F===null||F===void 0?void 0:F.validate)===null||Q===void 0?void 0:Q.evaluated;if(M.props!==!0)if(ne&&!ne.dynamicProps){if(ne.props!==void 0)M.props=y.mergeEvaluated.props(T,ne.props,M.props)}else{let ee=T.var("props",f._`${U}.evaluated.props`);M.props=y.mergeEvaluated.props(T,ee,M.props,f.Name)}if(M.items!==!0)if(ne&&!ne.dynamicItems){if(ne.items!==void 0)M.items=y.mergeEvaluated.items(T,ne.items,M.items)}else{let ee=T.var("items",f._`${U}.evaluated.items`);M.items=y.mergeEvaluated.items(T,ee,M.items,f.Name)}}}m.callRef=z,m.default=_}),tl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qd(),p=ki(),f=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",h.default,p.default];m.default=f}),Id=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=h.operators,f={maximum:{okStr:"<=",ok:p.LTE,fail:p.GT},minimum:{okStr:">=",ok:p.GTE,fail:p.LT},exclusiveMaximum:{okStr:"<",ok:p.LT,fail:p.GTE},exclusiveMinimum:{okStr:">",ok:p.GT,fail:p.LTE}},g={keyword:Object.keys(f),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:v,schemaCode:y})=>h.str`must be ${f[v].okStr} ${y}`,params:({keyword:v,schemaCode:y})=>h._`{comparison: ${f[v].okStr}, limit: ${y}}`},code(v){let{keyword:y,data:_,schemaCode:S}=v;v.fail$data(h._`${_} ${f[y].fail} ${S} || isNaN(${_})`)}};m.default=g}),jd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:f})=>h.str`must be multiple of ${f}`,params:({schemaCode:f})=>h._`{multipleOf: ${f}}`},code(f){let{gen:g,data:v,schemaCode:y,it:_}=f,S=_.opts.multipleOfPrecision,z=g.let("res"),O=S?h._`Math.abs(Math.round(${z}) - ${z}) > 1e-${S}`:h._`${z} !== parseInt(${z})`;f.fail$data(h._`(${y} === 0 || (${z} = ${v}/${y}, ${O}))`)}};m.default=p}),kd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});function h(p){let f=p.length,g=0,v=0,y;while(v<f)if(g++,y=p.charCodeAt(v++),y>=55296&&y<=56319&&v<f){if(y=p.charCodeAt(v),(y&64512)===56320)v++}return g}m.default=h,h.code='require("ajv/dist/runtime/ucs2length").default'}),Od=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f=kd(),g={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:v,schemaCode:y}){let _=v==="maxLength"?"more":"fewer";return h.str`must NOT have ${_} than ${y} characters`},params:({schemaCode:v})=>h._`{limit: ${v}}`},code(v){let{keyword:y,data:_,schemaCode:S,it:z}=v,O=y==="maxLength"?h.operators.GT:h.operators.LT,k=z.opts.unicode===!1?h._`${_}.length`:h._`${(0,p.useFunc)(v.gen,f.default)}(${_})`;v.fail$data(h._`${k} ${O} ${S}`)}};m.default=g}),Nd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ut(),p=Ie(),f=$e(),g={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:v})=>f.str`must match pattern "${v}"`,params:({schemaCode:v})=>f._`{pattern: ${v}}`},code(v){let{gen:y,data:_,$data:S,schema:z,schemaCode:O,it:k}=v,F=k.opts.unicodeRegExp?"u":"";if(S){let{regExp:B}=k.opts.code,T=B.code==="new RegExp"?f._`new RegExp`:(0,p.useFunc)(y,B),M=y.let("valid");y.try(()=>y.assign(M,f._`${T}(${O}, ${F}).test(${_})`),()=>y.assign(M,!1)),v.fail$data(f._`!${M}`)}else{let B=(0,h.usePattern)(v,z);v.fail$data(f._`!${B}.test(${_})`)}}};m.default=g}),Md=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:f,schemaCode:g}){let v=f==="maxProperties"?"more":"fewer";return h.str`must NOT have ${v} than ${g} properties`},params:({schemaCode:f})=>h._`{limit: ${f}}`},code(f){let{keyword:g,data:v,schemaCode:y}=f,_=g==="maxProperties"?h.operators.GT:h.operators.LT;f.fail$data(h._`Object.keys(${v}).length ${_} ${y}`)}};m.default=p}),Ad=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ut(),p=$e(),f=Ie(),g={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:v}})=>p.str`must have required property '${v}'`,params:({params:{missingProperty:v}})=>p._`{missingProperty: ${v}}`},code(v){let{gen:y,schema:_,schemaCode:S,data:z,$data:O,it:k}=v,{opts:F}=k;if(!O&&_.length===0)return;let B=_.length>=F.loopRequired;if(k.allErrors)T();else M();if(F.strictRequired){let V=v.parentSchema.properties,{definedProperties:E}=v.it;for(let H of _)if((V===null||V===void 0?void 0:V[H])===void 0&&!E.has(H)){let K=`required property "${H}" is not defined at "${k.schemaEnv.baseId+k.errSchemaPath}" (strictRequired)`;(0,f.checkStrictMode)(k,K,k.opts.strictRequired)}}function T(){if(B||O)v.block$data(p.nil,N);else for(let V of _)(0,h.checkReportMissingProp)(v,V)}function M(){let V=y.let("missing");if(B||O){let E=y.let("valid",!0);v.block$data(E,()=>b(V,E)),v.ok(E)}else y.if((0,h.checkMissingProp)(v,_,V)),(0,h.reportMissingProp)(v,V),y.else()}function N(){y.forOf("prop",S,(V)=>{v.setParams({missingProperty:V}),y.if((0,h.noPropertyInData)(y,z,V,F.ownProperties),()=>v.error())})}function b(V,E){v.setParams({missingProperty:V}),y.forOf(V,S,()=>{y.assign(E,(0,h.propertyInData)(y,z,V,F.ownProperties)),y.if((0,p.not)(E),()=>{v.error(),y.break()})},p.nil)}}};m.default=g}),Ld=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:f,schemaCode:g}){let v=f==="maxItems"?"more":"fewer";return h.str`must NOT have ${v} than ${g} items`},params:({schemaCode:f})=>h._`{limit: ${f}}`},code(f){let{keyword:g,data:v,schemaCode:y}=f,_=g==="maxItems"?h.operators.GT:h.operators.LT;f.fail$data(h._`${v}.length ${_} ${y}`)}};m.default=p}),Oi=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Qc();h.code='require("ajv/dist/runtime/equal").default',m.default=h}),Dd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=fn(),p=$e(),f=Ie(),g=Oi(),v={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:y,j:_}})=>p.str`must NOT have duplicate items (items ## ${_} and ${y} are identical)`,params:({params:{i:y,j:_}})=>p._`{i: ${y}, j: ${_}}`},code(y){let{gen:_,data:S,$data:z,schema:O,parentSchema:k,schemaCode:F,it:B}=y;if(!z&&!O)return;let T=_.let("valid"),M=k.items?(0,h.getSchemaTypes)(k.items):[];y.block$data(T,N,p._`${F} === false`),y.ok(T);function N(){let H=_.let("i",p._`${S}.length`),K=_.let("j");y.setParams({i:H,j:K}),_.assign(T,!0),_.if(p._`${H} > 1`,()=>(b()?V:E)(H,K))}function b(){return M.length>0&&!M.some((H)=>H==="object"||H==="array")}function V(H,K){let L=_.name("item"),j=(0,h.checkDataTypes)(M,L,B.opts.strictNumbers,h.DataType.Wrong),U=_.const("indices",p._`{}`);_.for(p._`;${H}--;`,()=>{if(_.let(L,p._`${S}[${H}]`),_.if(j,p._`continue`),M.length>1)_.if(p._`typeof ${L} == "string"`,p._`${L} += "_"`);_.if(p._`typeof ${U}[${L}] == "number"`,()=>{_.assign(K,p._`${U}[${L}]`),y.error(),_.assign(T,!1).break()}).code(p._`${U}[${L}] = ${H}`)})}function E(H,K){let L=(0,f.useFunc)(_,g.default),j=_.name("outer");_.label(j).for(p._`;${H}--;`,()=>_.for(p._`${K} = ${H}; ${K}--;`,()=>_.if(p._`${L}(${S}[${H}], ${S}[${K}])`,()=>{y.error(),_.assign(T,!1).break(j)})))}}};m.default=v}),Vd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f=Oi(),g={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:v})=>h._`{allowedValue: ${v}}`},code(v){let{gen:y,data:_,$data:S,schemaCode:z,schema:O}=v;if(S||O&&typeof O=="object")v.fail$data(h._`!${(0,p.useFunc)(y,f.default)}(${_}, ${z})`);else v.fail(h._`${O} !== ${_}`)}};m.default=g}),Ud=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f=Oi(),g={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:v})=>h._`{allowedValues: ${v}}`},code(v){let{gen:y,data:_,$data:S,schema:z,schemaCode:O,it:k}=v;if(!S&&z.length===0)throw Error("enum must have non-empty array");let F=z.length>=k.opts.loopEnum,B,T=()=>B!==null&&B!==void 0?B:B=(0,p.useFunc)(y,f.default),M;if(F||S)M=y.let("valid"),v.block$data(M,N);else{if(!Array.isArray(z))throw Error("ajv implementation error");let V=y.const("vSchema",O);M=(0,h.or)(...z.map((E,H)=>b(V,H)))}v.pass(M);function N(){y.assign(M,!1),y.forOf("v",O,(V)=>y.if(h._`${T()}(${_}, ${V})`,()=>y.assign(M,!0).break()))}function b(V,E){let H=z[E];return typeof H==="object"&&H!==null?h._`${T()}(${_}, ${V}[${E}])`:h._`${_} === ${H}`}}};m.default=g}),rl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Id(),p=jd(),f=Od(),g=Nd(),v=Md(),y=Ad(),_=Ld(),S=Dd(),z=Vd(),O=Ud(),k=[h.default,p.default,f.default,g.default,v.default,y.default,_.default,S.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},z.default,O.default];m.default=k}),sl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateAdditionalItems=void 0;let h=$e(),p=Ie(),f={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:v}})=>h.str`must NOT have more than ${v} items`,params:({params:{len:v}})=>h._`{limit: ${v}}`},code(v){let{parentSchema:y,it:_}=v,{items:S}=y;if(!Array.isArray(S)){(0,p.checkStrictMode)(_,'"additionalItems" is ignored when "items" is not an array of schemas');return}g(v,S)}};function g(v,y){let{gen:_,schema:S,data:z,keyword:O,it:k}=v;k.items=!0;let F=_.const("len",h._`${z}.length`);if(S===!1)v.setParams({len:y.length}),v.pass(h._`${F} <= ${y.length}`);else if(typeof S=="object"&&!(0,p.alwaysValidSchema)(k,S)){let T=_.var("valid",h._`${F} <= ${y.length}`);_.if((0,h.not)(T),()=>B(T)),v.ok(T)}function B(T){_.forRange("i",y.length,F,(M)=>{if(v.subschema({keyword:O,dataProp:M,dataPropType:p.Type.Num},T),!k.allErrors)_.if((0,h.not)(T),()=>_.break())})}}m.validateAdditionalItems=g,m.default=f}),ol=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateTuple=void 0;let h=$e(),p=Ie(),f=ut(),g={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(y){let{schema:_,it:S}=y;if(Array.isArray(_))return v(y,"additionalItems",_);if(S.items=!0,(0,p.alwaysValidSchema)(S,_))return;y.ok((0,f.validateArray)(y))}};function v(y,_,S=y.schema){let{gen:z,parentSchema:O,data:k,keyword:F,it:B}=y;if(N(O),B.opts.unevaluated&&S.length&&B.items!==!0)B.items=p.mergeEvaluated.items(z,S.length,B.items);let T=z.name("valid"),M=z.const("len",h._`${k}.length`);S.forEach((b,V)=>{if((0,p.alwaysValidSchema)(B,b))return;z.if(h._`${M} > ${V}`,()=>y.subschema({keyword:F,schemaProp:V,dataProp:V},T)),y.ok(T)});function N(b){let{opts:V,errSchemaPath:E}=B,H=S.length,K=H===b.minItems&&(H===b.maxItems||b[_]===!1);if(V.strictTuples&&!K){let L=`"${F}" is ${H}-tuple, but minItems or maxItems/${_} are not specified or different at path "${E}"`;(0,p.checkStrictMode)(B,L,V.strictTuples)}}}m.validateTuple=v,m.default=g}),Hd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ol(),p={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(f)=>(0,h.validateTuple)(f,"items")};m.default=p}),xd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f=ut(),g=sl(),v={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:y}})=>h.str`must NOT have more than ${y} items`,params:({params:{len:y}})=>h._`{limit: ${y}}`},code(y){let{schema:_,parentSchema:S,it:z}=y,{prefixItems:O}=S;if(z.items=!0,(0,p.alwaysValidSchema)(z,_))return;if(O)(0,g.validateAdditionalItems)(y,O);else y.ok((0,f.validateArray)(y))}};m.default=v}),Fd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:g,max:v}})=>v===void 0?h.str`must contain at least ${g} valid item(s)`:h.str`must contain at least ${g} and no more than ${v} valid item(s)`,params:({params:{min:g,max:v}})=>v===void 0?h._`{minContains: ${g}}`:h._`{minContains: ${g}, maxContains: ${v}}`},code(g){let{gen:v,schema:y,parentSchema:_,data:S,it:z}=g,O,k,{minContains:F,maxContains:B}=_;if(z.opts.next)O=F===void 0?1:F,k=B;else O=1;let T=v.const("len",h._`${S}.length`);if(g.setParams({min:O,max:k}),k===void 0&&O===0){(0,p.checkStrictMode)(z,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(k!==void 0&&O>k){(0,p.checkStrictMode)(z,'"minContains" > "maxContains" is always invalid'),g.fail();return}if((0,p.alwaysValidSchema)(z,y)){let E=h._`${T} >= ${O}`;if(k!==void 0)E=h._`${E} && ${T} <= ${k}`;g.pass(E);return}z.items=!0;let M=v.name("valid");if(k===void 0&&O===1)b(M,()=>v.if(M,()=>v.break()));else if(O===0){if(v.let(M,!0),k!==void 0)v.if(h._`${S}.length > 0`,N)}else v.let(M,!1),N();g.result(M,()=>g.reset());function N(){let E=v.name("_valid"),H=v.let("count",0);b(E,()=>v.if(E,()=>V(H)))}function b(E,H){v.forRange("i",0,T,(K)=>{g.subschema({keyword:"contains",dataProp:K,dataPropType:p.Type.Num,compositeRule:!0},E),H()})}function V(E){if(v.code(h._`${E}++`),k===void 0)v.if(h._`${E} >= ${O}`,()=>v.assign(M,!0).break());else if(v.if(h._`${E} > ${k}`,()=>v.assign(M,!1).break()),O===1)v.assign(M,!0);else v.if(h._`${E} >= ${O}`,()=>v.assign(M,!0))}}};m.default=f}),Ni=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.validateSchemaDeps=m.validatePropertyDeps=m.error=void 0;let h=$e(),p=Ie(),f=ut();m.error={message:({params:{property:S,depsCount:z,deps:O}})=>{let k=z===1?"property":"properties";return h.str`must have ${k} ${O} when property ${S} is present`},params:({params:{property:S,depsCount:z,deps:O,missingProperty:k}})=>h._`{property: ${S},
|
|
12
|
-
missingProperty: ${k},
|
|
13
|
-
depsCount: ${z},
|
|
14
|
-
deps: ${O}}`};let g={keyword:"dependencies",type:"object",schemaType:"object",error:m.error,code(S){let[z,O]=v(S);y(S,z),_(S,O)}};function v({schema:S}){let z={},O={};for(let k in S){if(k==="__proto__")continue;let F=Array.isArray(S[k])?z:O;F[k]=S[k]}return[z,O]}function y(S,z=S.schema){let{gen:O,data:k,it:F}=S;if(Object.keys(z).length===0)return;let B=O.let("missing");for(let T in z){let M=z[T];if(M.length===0)continue;let N=(0,f.propertyInData)(O,k,T,F.opts.ownProperties);if(S.setParams({property:T,depsCount:M.length,deps:M.join(", ")}),F.allErrors)O.if(N,()=>{for(let b of M)(0,f.checkReportMissingProp)(S,b)});else O.if(h._`${N} && (${(0,f.checkMissingProp)(S,M,B)})`),(0,f.reportMissingProp)(S,B),O.else()}}m.validatePropertyDeps=y;function _(S,z=S.schema){let{gen:O,data:k,keyword:F,it:B}=S,T=O.name("valid");for(let M in z){if((0,p.alwaysValidSchema)(B,z[M]))continue;O.if((0,f.propertyInData)(O,k,M,B.opts.ownProperties),()=>{let N=S.subschema({keyword:F,schemaProp:M},T);S.mergeValidEvaluated(N,T)},()=>O.var(T,!0)),S.ok(T)}}m.validateSchemaDeps=_,m.default=g}),Bd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:g})=>h._`{propertyName: ${g.propertyName}}`},code(g){let{gen:v,schema:y,data:_,it:S}=g;if((0,p.alwaysValidSchema)(S,y))return;let z=v.name("valid");v.forIn("key",_,(O)=>{g.setParams({propertyName:O}),g.subschema({keyword:"propertyNames",data:O,dataTypes:["string"],propertyName:O,compositeRule:!0},z),v.if((0,h.not)(z),()=>{if(g.error(!0),!S.allErrors)v.break()})}),g.ok(z)}};m.default=f}),al=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ut(),p=$e(),f=lt(),g=Ie(),v={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:y})=>p._`{additionalProperty: ${y.additionalProperty}}`},code(y){let{gen:_,schema:S,parentSchema:z,data:O,errsCount:k,it:F}=y;if(!k)throw Error("ajv implementation error");let{allErrors:B,opts:T}=F;if(F.props=!0,T.removeAdditional!=="all"&&(0,g.alwaysValidSchema)(F,S))return;let M=(0,h.allSchemaProperties)(z.properties),N=(0,h.allSchemaProperties)(z.patternProperties);b(),y.ok(p._`${k} === ${f.default.errors}`);function b(){_.forIn("key",O,(L)=>{if(!M.length&&!N.length)H(L);else _.if(V(L),()=>H(L))})}function V(L){let j;if(M.length>8){let U=(0,g.schemaRefOrVal)(F,z.properties,"properties");j=(0,h.isOwnProperty)(_,U,L)}else if(M.length)j=(0,p.or)(...M.map((U)=>p._`${L} === ${U}`));else j=p.nil;if(N.length)j=(0,p.or)(j,...N.map((U)=>p._`${(0,h.usePattern)(y,U)}.test(${L})`));return(0,p.not)(j)}function E(L){_.code(p._`delete ${O}[${L}]`)}function H(L){if(T.removeAdditional==="all"||T.removeAdditional&&S===!1){E(L);return}if(S===!1){if(y.setParams({additionalProperty:L}),y.error(),!B)_.break();return}if(typeof S=="object"&&!(0,g.alwaysValidSchema)(F,S)){let j=_.name("valid");if(T.removeAdditional==="failing")K(L,j,!1),_.if((0,p.not)(j),()=>{y.reset(),E(L)});else if(K(L,j),!B)_.if((0,p.not)(j),()=>_.break())}}function K(L,j,U){let Q={keyword:"additionalProperties",dataProp:L,dataPropType:g.Type.Str};if(U===!1)Object.assign(Q,{compositeRule:!0,createErrors:!1,allErrors:!1});y.subschema(Q,j)}}};m.default=v}),Jd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=qr(),p=ut(),f=Ie(),g=al(),v={keyword:"properties",type:"object",schemaType:"object",code(y){let{gen:_,schema:S,parentSchema:z,data:O,it:k}=y;if(k.opts.removeAdditional==="all"&&z.additionalProperties===void 0)g.default.code(new h.KeywordCxt(k,g.default,"additionalProperties"));let F=(0,p.allSchemaProperties)(S);for(let b of F)k.definedProperties.add(b);if(k.opts.unevaluated&&F.length&&k.props!==!0)k.props=f.mergeEvaluated.props(_,(0,f.toHash)(F),k.props);let B=F.filter((b)=>!(0,f.alwaysValidSchema)(k,S[b]));if(B.length===0)return;let T=_.name("valid");for(let b of B){if(M(b))N(b);else{if(_.if((0,p.propertyInData)(_,O,b,k.opts.ownProperties)),N(b),!k.allErrors)_.else().var(T,!0);_.endIf()}y.it.definedProperties.add(b),y.ok(T)}function M(b){return k.opts.useDefaults&&!k.compositeRule&&S[b].default!==void 0}function N(b){y.subschema({keyword:"properties",schemaProp:b,dataProp:b},T)}}};m.default=v}),Kd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ut(),p=$e(),f=Ie(),g=Ie(),v={keyword:"patternProperties",type:"object",schemaType:"object",code(y){let{gen:_,schema:S,data:z,parentSchema:O,it:k}=y,{opts:F}=k,B=(0,h.allSchemaProperties)(S),T=B.filter((K)=>(0,f.alwaysValidSchema)(k,S[K]));if(B.length===0||T.length===B.length&&(!k.opts.unevaluated||k.props===!0))return;let M=F.strictSchema&&!F.allowMatchingProperties&&O.properties,N=_.name("valid");if(k.props!==!0&&!(k.props instanceof p.Name))k.props=(0,g.evaluatedPropsToName)(_,k.props);let{props:b}=k;V();function V(){for(let K of B){if(M)E(K);if(k.allErrors)H(K);else _.var(N,!0),H(K),_.if(N)}}function E(K){for(let L in M)if(new RegExp(K).test(L))(0,f.checkStrictMode)(k,`property ${L} matches pattern ${K} (use allowMatchingProperties)`)}function H(K){_.forIn("key",z,(L)=>{_.if(p._`${(0,h.usePattern)(y,K)}.test(${L})`,()=>{let j=T.includes(K);if(!j)y.subschema({keyword:"patternProperties",schemaProp:K,dataProp:L,dataPropType:g.Type.Str},N);if(k.opts.unevaluated&&b!==!0)_.assign(p._`${b}[${L}]`,!0);else if(!j&&!k.allErrors)_.if((0,p.not)(N),()=>_.break())})})}}};m.default=v}),Gd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ie(),p={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(f){let{gen:g,schema:v,it:y}=f;if((0,h.alwaysValidSchema)(y,v)){f.fail();return}let _=g.name("valid");f.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},_),f.failResult(_,()=>f.reset(),()=>f.error())},error:{message:"must NOT be valid"}};m.default=p}),Wd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ut().validateUnion,error:{message:"must match a schema in anyOf"}};m.default=h}),Yd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:g})=>h._`{passingSchemas: ${g.passing}}`},code(g){let{gen:v,schema:y,parentSchema:_,it:S}=g;if(!Array.isArray(y))throw Error("ajv implementation error");if(S.opts.discriminator&&_.discriminator)return;let z=y,O=v.let("valid",!1),k=v.let("passing",null),F=v.name("_valid");g.setParams({passing:k}),v.block(B),g.result(O,()=>g.reset(),()=>g.error(!0));function B(){z.forEach((T,M)=>{let N;if((0,p.alwaysValidSchema)(S,T))v.var(F,!0);else N=g.subschema({keyword:"oneOf",schemaProp:M,compositeRule:!0},F);if(M>0)v.if(h._`${F} && ${O}`).assign(O,!1).assign(k,h._`[${k}, ${M}]`).else();v.if(F,()=>{if(v.assign(O,!0),v.assign(k,M),N)g.mergeEvaluated(N,h.Name)})})}}};m.default=f}),Xd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ie(),p={keyword:"allOf",schemaType:"array",code(f){let{gen:g,schema:v,it:y}=f;if(!Array.isArray(v))throw Error("ajv implementation error");let _=g.name("valid");v.forEach((S,z)=>{if((0,h.alwaysValidSchema)(y,S))return;let O=f.subschema({keyword:"allOf",schemaProp:z},_);f.ok(_),f.mergeEvaluated(O)})}};m.default=p}),Zd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:v})=>h.str`must match "${v.ifClause}" schema`,params:({params:v})=>h._`{failingKeyword: ${v.ifClause}}`},code(v){let{gen:y,parentSchema:_,it:S}=v;if(_.then===void 0&&_.else===void 0)(0,p.checkStrictMode)(S,'"if" without "then" and "else" is ignored');let z=g(S,"then"),O=g(S,"else");if(!z&&!O)return;let k=y.let("valid",!0),F=y.name("_valid");if(B(),v.reset(),z&&O){let M=y.let("ifClause");v.setParams({ifClause:M}),y.if(F,T("then",M),T("else",M))}else if(z)y.if(F,T("then"));else y.if((0,h.not)(F),T("else"));v.pass(k,()=>v.error(!0));function B(){let M=v.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},F);v.mergeEvaluated(M)}function T(M,N){return()=>{let b=v.subschema({keyword:M},F);if(y.assign(k,F),v.mergeValidEvaluated(b,k),N)y.assign(N,h._`${M}`);else v.setParams({ifClause:M})}}}};function g(v,y){let _=v.schema[y];return _!==void 0&&!(0,p.alwaysValidSchema)(v,_)}m.default=f}),Qd=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ie(),p={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:f,parentSchema:g,it:v}){if(g.if===void 0)(0,h.checkStrictMode)(v,`"${f}" without "if" is ignored`)}};m.default=p}),nl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=sl(),p=Hd(),f=ol(),g=xd(),v=Fd(),y=Ni(),_=Bd(),S=al(),z=Jd(),O=Kd(),k=Gd(),F=Wd(),B=Yd(),T=Xd(),M=Zd(),N=Qd();function b(V=!1){let E=[k.default,F.default,B.default,T.default,M.default,N.default,_.default,S.default,y.default,z.default,O.default];if(V)E.push(p.default,g.default);else E.push(h.default,f.default);return E.push(v.default),E}m.default=b}),em=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:f})=>h.str`must match format "${f}"`,params:({schemaCode:f})=>h._`{format: ${f}}`},code(f,g){let{gen:v,data:y,$data:_,schema:S,schemaCode:z,it:O}=f,{opts:k,errSchemaPath:F,schemaEnv:B,self:T}=O;if(!k.validateFormats)return;if(_)M();else N();function M(){let b=v.scopeValue("formats",{ref:T.formats,code:k.code.formats}),V=v.const("fDef",h._`${b}[${z}]`),E=v.let("fType"),H=v.let("format");v.if(h._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>v.assign(E,h._`${V}.type || "string"`).assign(H,h._`${V}.validate`),()=>v.assign(E,h._`"string"`).assign(H,V)),f.fail$data((0,h.or)(K(),L()));function K(){if(k.strictSchema===!1)return h.nil;return h._`${z} && !${H}`}function L(){let j=B.$async?h._`(${V}.async ? await ${H}(${y}) : ${H}(${y}))`:h._`${H}(${y})`,U=h._`(typeof ${H} == "function" ? ${j} : ${H}.test(${y}))`;return h._`${H} && ${H} !== true && ${E} === ${g} && !${U}`}}function N(){let b=T.formats[S];if(!b){K();return}if(b===!0)return;let[V,E,H]=L(b);if(V===g)f.pass(j());function K(){if(k.strictSchema===!1){T.logger.warn(U());return}throw Error(U());function U(){return`unknown format "${S}" ignored in schema at path "${F}"`}}function L(U){let Q=U instanceof RegExp?(0,h.regexpCode)(U):k.code.formats?h._`${k.code.formats}${(0,h.getProperty)(S)}`:void 0,ne=v.scopeValue("formats",{key:S,ref:U,code:Q});if(typeof U=="object"&&!(U instanceof RegExp))return[U.type||"string",U.validate,h._`${ne}.validate`];return["string",U,ne]}function j(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!B.$async)throw Error("async format in sync schema");return h._`await ${H}(${y})`}return typeof E=="function"?h._`${H}(${y})`:h._`${H}.test(${y})`}}}};m.default=p}),il=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=[em().default];m.default=h}),cl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.contentVocabulary=m.metadataVocabulary=void 0,m.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],m.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),ll=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=tl(),p=rl(),f=nl(),g=il(),v=cl(),y=[h.default,p.default,(0,f.default)(),g.default,v.metadataVocabulary,v.contentVocabulary];m.default=y}),tm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.DiscrError=void 0;var h;(function(p){p.Tag="tag",p.Mapping="mapping"})(h||(m.DiscrError=h={}))}),Mi=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=tm(),f=yn(),g=Ir(),v=Ie(),y={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:_,tagName:S}})=>_===p.DiscrError.Tag?`tag "${S}" must be string`:`value of tag "${S}" must be in oneOf`,params:({params:{discrError:_,tag:S,tagName:z}})=>h._`{error: ${_}, tag: ${z}, tagValue: ${S}}`},code(_){let{gen:S,data:z,schema:O,parentSchema:k,it:F}=_,{oneOf:B}=k;if(!F.opts.discriminator)throw Error("discriminator: requires discriminator option");let T=O.propertyName;if(typeof T!="string")throw Error("discriminator: requires propertyName");if(O.mapping)throw Error("discriminator: mapping is not supported");if(!B)throw Error("discriminator: requires oneOf keyword");let M=S.let("valid",!1),N=S.const("tag",h._`${z}${(0,h.getProperty)(T)}`);S.if(h._`typeof ${N} == "string"`,()=>b(),()=>_.error(!1,{discrError:p.DiscrError.Tag,tag:N,tagName:T})),_.ok(M);function b(){let H=E();S.if(!1);for(let K in H)S.elseIf(h._`${N} === ${K}`),S.assign(M,V(H[K]));S.else(),_.error(!1,{discrError:p.DiscrError.Mapping,tag:N,tagName:T}),S.endIf()}function V(H){let K=S.name("valid"),L=_.subschema({keyword:"oneOf",schemaProp:H},K);return _.mergeEvaluated(L,h.Name),K}function E(){var H;let K={},L=U(k),j=!0;for(let ee=0;ee<B.length;ee++){let ie=B[ee];if((ie===null||ie===void 0?void 0:ie.$ref)&&!(0,v.schemaHasRulesButRef)(ie,F.self.RULES)){let ye=ie.$ref;if(ie=f.resolveRef.call(F.self,F.schemaEnv.root,F.baseId,ye),ie instanceof f.SchemaEnv)ie=ie.schema;if(ie===void 0)throw new g.default(F.opts.uriResolver,F.baseId,ye)}let Se=(H=ie===null||ie===void 0?void 0:ie.properties)===null||H===void 0?void 0:H[T];if(typeof Se!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${T}"`);j=j&&(L||U(ie)),Q(Se,ee)}if(!j)throw Error(`discriminator: "${T}" must be required`);return K;function U({required:ee}){return Array.isArray(ee)&&ee.includes(T)}function Q(ee,ie){if(ee.const)ne(ee.const,ie);else if(ee.enum)for(let Se of ee.enum)ne(Se,ie);else throw Error(`discriminator: "properties/${T}" must have "const" or "enum"`)}function ne(ee,ie){if(typeof ee!="string"||ee in K)throw Error(`discriminator: "${T}" values must be unique strings`);K[ee]=ie}}}};m.default=y}),rm=ue((m,h)=>{h.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}}),ul=ue((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.MissingRefError=m.ValidationError=m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=m.Ajv=void 0;let p=ji(),f=ll(),g=Mi(),v=rm(),y=["/properties"],_="http://json-schema.org/draft-07/schema";var S=class extends p.default{_addVocabularies(){if(super._addVocabularies(),f.default.forEach((B)=>this.addVocabulary(B)),this.opts.discriminator)this.addKeyword(g.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let B=this.opts.$data?this.$dataMetaSchema(v,y):v;this.addMetaSchema(B,_,!1),this.refs["http://json-schema.org/schema"]=_}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_)?_:void 0)}};m.Ajv=S,h.exports=m=S,h.exports.Ajv=S,Object.defineProperty(m,"__esModule",{value:!0}),m.default=S;var z=qr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return z.KeywordCxt}});var O=$e();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return O._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return O.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return O.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return O.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return O.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return O.CodeGen}});var k=Vs();Object.defineProperty(m,"ValidationError",{enumerable:!0,get:function(){return k.default}});var F=Ir();Object.defineProperty(m,"MissingRefError",{enumerable:!0,get:function(){return F.default}})}),dl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.dynamicAnchor=void 0;let h=$e(),p=lt(),f=yn(),g=ki(),v={keyword:"$dynamicAnchor",schemaType:"string",code:(S)=>y(S,S.schema)};function y(S,z){let{gen:O,it:k}=S;k.schemaEnv.root.dynamicAnchors[z]=!0;let F=h._`${p.default.dynamicAnchors}${(0,h.getProperty)(z)}`,B=k.errSchemaPath==="#"?k.validateName:_(S);O.if(h._`!${F}`,()=>O.assign(F,B))}m.dynamicAnchor=y;function _(S){let{schemaEnv:z,schema:O,self:k}=S.it,{root:F,baseId:B,localRefs:T,meta:M}=z.root,{schemaId:N}=k.opts,b=new f.SchemaEnv({schema:O,schemaId:N,root:F,baseId:B,localRefs:T,meta:M});return f.compileSchema.call(k,b),(0,g.getValidate)(S,b)}m.default=v}),ml=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.dynamicRef=void 0;let h=$e(),p=lt(),f=ki(),g={keyword:"$dynamicRef",schemaType:"string",code:(y)=>v(y,y.schema)};function v(y,_){let{gen:S,keyword:z,it:O}=y;if(_[0]!=="#")throw Error(`"${z}" only supports hash fragment reference`);let k=_.slice(1);if(O.allErrors)F();else{let T=S.let("valid",!1);F(T),y.ok(T)}function F(T){if(O.schemaEnv.root.dynamicAnchors[k]){let M=S.let("_v",h._`${p.default.dynamicAnchors}${(0,h.getProperty)(k)}`);S.if(M,B(M,T),B(O.validateName,T))}else B(O.validateName,T)()}function B(T,M){return M?()=>S.block(()=>{(0,f.callRef)(y,T),S.let(M,!0)}):()=>(0,f.callRef)(y,T)}}m.dynamicRef=v,m.default=g}),sm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=dl(),p=Ie(),f={keyword:"$recursiveAnchor",schemaType:"boolean",code(g){if(g.schema)(0,h.dynamicAnchor)(g,"");else(0,p.checkStrictMode)(g.it,"$recursiveAnchor: false is ignored")}};m.default=f}),om=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=ml(),p={keyword:"$recursiveRef",schemaType:"string",code:(f)=>(0,h.dynamicRef)(f,f.schema)};m.default=p}),hl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=dl(),p=ml(),f=sm(),g=om(),v=[h.default,p.default,f.default,g.default];m.default=v}),am=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ni(),p={keyword:"dependentRequired",type:"object",schemaType:"object",error:h.error,code:(f)=>(0,h.validatePropertyDeps)(f)};m.default=p}),nm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ni(),p={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(f)=>(0,h.validateSchemaDeps)(f)};m.default=p}),im=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=Ie(),p={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:f,parentSchema:g,it:v}){if(g.contains===void 0)(0,h.checkStrictMode)(v,`"${f}" without "contains" is ignored`)}};m.default=p}),pl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=am(),p=nm(),f=im(),g=[h.default,p.default,f.default];m.default=g}),cm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f=lt(),g={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:v})=>h._`{unevaluatedProperty: ${v.unevaluatedProperty}}`},code(v){let{gen:y,schema:_,data:S,errsCount:z,it:O}=v;if(!z)throw Error("ajv implementation error");let{allErrors:k,props:F}=O;if(F instanceof h.Name)y.if(h._`${F} !== true`,()=>y.forIn("key",S,(N)=>y.if(T(F,N),()=>B(N))));else if(F!==!0)y.forIn("key",S,(N)=>F===void 0?B(N):y.if(M(F,N),()=>B(N)));O.props=!0,v.ok(h._`${z} === ${f.default.errors}`);function B(N){if(_===!1){if(v.setParams({unevaluatedProperty:N}),v.error(),!k)y.break();return}if(!(0,p.alwaysValidSchema)(O,_)){let b=y.name("valid");if(v.subschema({keyword:"unevaluatedProperties",dataProp:N,dataPropType:p.Type.Str},b),!k)y.if((0,h.not)(b),()=>y.break())}}function T(N,b){return h._`!${N} || !${N}[${b}]`}function M(N,b){let V=[];for(let E in N)if(N[E]===!0)V.push(h._`${b} !== ${E}`);return(0,h.and)(...V)}}};m.default=g}),lm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=$e(),p=Ie(),f={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:g}})=>h.str`must NOT have more than ${g} items`,params:({params:{len:g}})=>h._`{limit: ${g}}`},code(g){let{gen:v,schema:y,data:_,it:S}=g,z=S.items||0;if(z===!0)return;let O=v.const("len",h._`${_}.length`);if(y===!1)g.setParams({len:z}),g.fail(h._`${O} > ${z}`);else if(typeof y=="object"&&!(0,p.alwaysValidSchema)(S,y)){let F=v.var("valid",h._`${O} <= ${z}`);v.if((0,h.not)(F),()=>k(F,z)),g.ok(F)}S.items=!0;function k(F,B){v.forRange("i",B,O,(T)=>{if(g.subschema({keyword:"unevaluatedItems",dataProp:T,dataPropType:p.Type.Num},F),!S.allErrors)v.if((0,h.not)(F),()=>v.break())})}}};m.default=f}),fl=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=cm(),p=lm(),f=[h.default,p.default];m.default=f}),um=ue((m,h)=>{h.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"}]}}}}}),dm=ue((m,h)=>{h.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:"#"}}}}}),mm=ue((m,h)=>{h.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:"#"}}}}),hm=ue((m,h)=>{h.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:{}}}}}),pm=ue((m,h)=>{h.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"}}}}),fm=ue((m,h)=>{h.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}}}}),gm=ue((m,h)=>{h.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:[]}}}}),Sm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=um(),p=dm(),f=mm(),g=hm(),v=pm(),y=fm(),_=gm(),S=["/properties"];function z(O){return[h,p,f,g,k(this,v),y,k(this,_)].forEach((F)=>this.addMetaSchema(F,void 0,!1)),this;function k(F,B){return O?F.$dataMetaSchema(B,S):B}}m.default=z}),ym=ue((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.MissingRefError=m.ValidationError=m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=m.Ajv2019=void 0;let p=ji(),f=ll(),g=hl(),v=pl(),y=fl(),_=Mi(),S=Sm(),z="https://json-schema.org/draft/2019-09/schema";var O=class extends p.default{constructor(M={}){super({...M,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(g.default),f.default.forEach((M)=>this.addVocabulary(M)),this.addVocabulary(v.default),this.addVocabulary(y.default),this.opts.discriminator)this.addKeyword(_.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:M,meta:N}=this.opts;if(!N)return;S.default.call(this,M),this.refs["http://json-schema.org/schema"]=z}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(z)?z:void 0)}};m.Ajv2019=O,h.exports=m=O,h.exports.Ajv2019=O,Object.defineProperty(m,"__esModule",{value:!0}),m.default=O;var k=qr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return k.KeywordCxt}});var F=$e();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return F._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return F.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return F.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return F.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return F.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return F.CodeGen}});var B=Vs();Object.defineProperty(m,"ValidationError",{enumerable:!0,get:function(){return B.default}});var T=Ir();Object.defineProperty(m,"MissingRefError",{enumerable:!0,get:function(){return T.default}})}),vm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=tl(),p=rl(),f=nl(),g=hl(),v=pl(),y=fl(),_=il(),S=cl(),z=[g.default,h.default,p.default,(0,f.default)(!0),_.default,S.metadataVocabulary,S.contentVocabulary,v.default,y.default];m.default=z}),_m=ue((m,h)=>{h.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}}}}),bm=ue((m,h)=>{h.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"}}}}}),Rm=ue((m,h)=>{h.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"}}}}),zm=ue((m,h)=>{h.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"}}}}),wm=ue((m,h)=>{h.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"}}}}),$m=ue((m,h)=>{h.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"}}}}),Em=ue((m,h)=>{h.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}}}}),Tm=ue((m,h)=>{h.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:[]}}}}),Pm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0});let h=_m(),p=bm(),f=Rm(),g=zm(),v=wm(),y=$m(),_=Em(),S=Tm(),z=["/properties"];function O(k){return[h,p,f,g,v,F(this,y),_,F(this,S)].forEach((B)=>this.addMetaSchema(B,void 0,!1)),this;function F(B,T){return k?B.$dataMetaSchema(T,z):T}}m.default=O}),Cm=ue((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.MissingRefError=m.ValidationError=m.CodeGen=m.Name=m.nil=m.stringify=m.str=m._=m.KeywordCxt=m.Ajv2020=void 0;let p=ji(),f=vm(),g=Mi(),v=Pm(),y="https://json-schema.org/draft/2020-12/schema";var _=class extends p.default{constructor(F={}){super({...F,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),f.default.forEach((F)=>this.addVocabulary(F)),this.opts.discriminator)this.addKeyword(g.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:F,meta:B}=this.opts;if(!B)return;v.default.call(this,F),this.refs["http://json-schema.org/schema"]=y}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(y)?y:void 0)}};m.Ajv2020=_,h.exports=m=_,h.exports.Ajv2020=_,Object.defineProperty(m,"__esModule",{value:!0}),m.default=_;var S=qr();Object.defineProperty(m,"KeywordCxt",{enumerable:!0,get:function(){return S.KeywordCxt}});var z=$e();Object.defineProperty(m,"_",{enumerable:!0,get:function(){return z._}}),Object.defineProperty(m,"str",{enumerable:!0,get:function(){return z.str}}),Object.defineProperty(m,"stringify",{enumerable:!0,get:function(){return z.stringify}}),Object.defineProperty(m,"nil",{enumerable:!0,get:function(){return z.nil}}),Object.defineProperty(m,"Name",{enumerable:!0,get:function(){return z.Name}}),Object.defineProperty(m,"CodeGen",{enumerable:!0,get:function(){return z.CodeGen}});var O=Vs();Object.defineProperty(m,"ValidationError",{enumerable:!0,get:function(){return O.default}});var k=Ir();Object.defineProperty(m,"MissingRefError",{enumerable:!0,get:function(){return k.default}})}),qm=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.formatNames=m.fastFormats=m.fullFormats=void 0;function h(ee,ie){return{validate:ee,compare:ie}}m.fullFormats={date:h(v,y),time:h(S(!0),z),"date-time":h(F(!0),B),"iso-time":h(S(),O),"iso-date-time":h(F(),T),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:b,"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:ne,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:E,int32:{type:"number",validate:L},int64:{type:"number",validate:j},float:{type:"number",validate:U},double:{type:"number",validate:U},password:!0,binary:!0},m.fastFormats={...m.fullFormats,date:h(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,y),time:h(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,z),"date-time":h(/^\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,B),"iso-time":h(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,O),"iso-date-time":h(/^\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,T),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},m.formatNames=Object.keys(m.fullFormats);function p(ee){return ee%4===0&&(ee%100!==0||ee%400===0)}let f=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,g=[0,31,28,31,30,31,30,31,31,30,31,30,31];function v(ee){let ie=f.exec(ee);if(!ie)return!1;let Se=+ie[1],ye=+ie[2],Ce=+ie[3];return ye>=1&&ye<=12&&Ce>=1&&Ce<=(ye===2&&p(Se)?29:g[ye])}function y(ee,ie){if(!(ee&&ie))return;if(ee>ie)return 1;if(ee<ie)return-1;return 0}let _=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function S(ee){return function(Se){let ye=_.exec(Se);if(!ye)return!1;let Ce=+ye[1],Ne=+ye[2],je=+ye[3],He=ye[4],qe=ye[5]==="-"?-1:1,Z=+(ye[6]||0),re=+(ye[7]||0);if(Z>23||re>59||ee&&!He)return!1;if(Ce<=23&&Ne<=59&&je<60)return!0;let he=Ne-re*qe,x=Ce-Z*qe-(he<0?1:0);return(x===23||x===-1)&&(he===59||he===-1)&&je<61}}function z(ee,ie){if(!(ee&&ie))return;let Se=new Date("2020-01-01T"+ee).valueOf(),ye=new Date("2020-01-01T"+ie).valueOf();if(!(Se&&ye))return;return Se-ye}function O(ee,ie){if(!(ee&&ie))return;let Se=_.exec(ee),ye=_.exec(ie);if(!(Se&&ye))return;if(ee=Se[1]+Se[2]+Se[3],ie=ye[1]+ye[2]+ye[3],ee>ie)return 1;if(ee<ie)return-1;return 0}let k=/t|\s/i;function F(ee){let ie=S(ee);return function(ye){let Ce=ye.split(k);return Ce.length===2&&v(Ce[0])&&ie(Ce[1])}}function B(ee,ie){if(!(ee&&ie))return;let Se=new Date(ee).valueOf(),ye=new Date(ie).valueOf();if(!(Se&&ye))return;return Se-ye}function T(ee,ie){if(!(ee&&ie))return;let[Se,ye]=ee.split(k),[Ce,Ne]=ie.split(k),je=y(Se,Ce);if(je===void 0)return;return je||z(ye,Ne)}let M=/\/|:/,N=/^(?:[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;function b(ee){return M.test(ee)&&N.test(ee)}let V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function E(ee){return V.lastIndex=0,V.test(ee)}let H=-2147483648,K=2147483647;function L(ee){return Number.isInteger(ee)&&ee<=K&&ee>=H}function j(ee){return Number.isInteger(ee)}function U(){return!0}let Q=/[^\\]\\Z/;function ne(ee){if(Q.test(ee))return!1;try{return new RegExp(ee),!0}catch(ie){return!1}}}),Im=ue((m)=>{Object.defineProperty(m,"__esModule",{value:!0}),m.formatLimitDefinition=void 0;let h=ul(),p=$e(),f=p.operators,g={formatMaximum:{okStr:"<=",ok:f.LTE,fail:f.GT},formatMinimum:{okStr:">=",ok:f.GTE,fail:f.LT},formatExclusiveMaximum:{okStr:"<",ok:f.LT,fail:f.GTE},formatExclusiveMinimum:{okStr:">",ok:f.GT,fail:f.LTE}},v={message:({keyword:_,schemaCode:S})=>p.str`should be ${g[_].okStr} ${S}`,params:({keyword:_,schemaCode:S})=>p._`{comparison: ${g[_].okStr}, limit: ${S}}`};m.formatLimitDefinition={keyword:Object.keys(g),type:"string",schemaType:"string",$data:!0,error:v,code(_){let{gen:S,data:z,schemaCode:O,keyword:k,it:F}=_,{opts:B,self:T}=F;if(!B.validateFormats)return;let M=new h.KeywordCxt(F,T.RULES.all.format.definition,"format");if(M.$data)N();else b();function N(){let E=S.scopeValue("formats",{ref:T.formats,code:B.code.formats}),H=S.const("fmt",p._`${E}[${M.schemaCode}]`);_.fail$data((0,p.or)(p._`typeof ${H} != "object"`,p._`${H} instanceof RegExp`,p._`typeof ${H}.compare != "function"`,V(H)))}function b(){let E=M.schema,H=T.formats[E];if(!H||H===!0)return;if(typeof H!="object"||H instanceof RegExp||typeof H.compare!="function")throw Error(`"${k}": format "${E}" does not define "compare" function`);let K=S.scopeValue("formats",{key:E,ref:H,code:B.code.formats?p._`${B.code.formats}${(0,p.getProperty)(E)}`:void 0});_.fail$data(V(K))}function V(E){return p._`${E}.compare(${z}, ${O}) ${g[k].fail} 0`}},dependencies:["format"]};let y=(_)=>(_.addKeyword(m.formatLimitDefinition),_);m.default=y}),jm=ue((m,h)=>{Object.defineProperty(m,"__esModule",{value:!0});let p=qm(),f=Im(),g=$e(),v=new g.Name("fullFormats"),y=new g.Name("fastFormats"),_=(z,O={keywords:!0})=>{if(Array.isArray(O))return S(z,O,p.fullFormats,v),z;let[k,F]=O.mode==="fast"?[p.fastFormats,y]:[p.fullFormats,v];if(S(z,O.formats||p.formatNames,k,F),O.keywords)(0,f.default)(z);return z};_.get=(z,O="full")=>{let k=(O==="fast"?p.fastFormats:p.fullFormats)[z];if(!k)throw Error(`Unknown format "${z}"`);return k};function S(z,O,k,F){var B,T;(B=(T=z.opts.code).formats)!==null&&B!==void 0||(T.formats=g._`require("ajv-formats/dist/formats").${F}`);for(let M of O)z.addFormat(M,k[M])}h.exports=m=_,Object.defineProperty(m,"__esModule",{value:!0}),m.default=_}),gl=ul(),km=ym(),Om=Cm(),Nm=no(jm(),1),Mm=Nm.default;function Ii(m){let h=new m({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Mm(h),h}var vn=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(m){this._userAjv=m!==void 0,this._ajv=m}get ajv(){return this._ajv??=Ii(Om.Ajv2020)}_engineFor(m){if(this._userAjv)return this.ajv;let h=Ji(m,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(h==="2020-12")return this.ajv;if(h==="2019-09")return this._ajv2019??=Ii(km.Ajv2019);return this._ajvDraft7??=Ii(gl.Ajv)}getValidator(m){let h=this._engineFor(m),p="$id"in m&&typeof m.$id==="string"?h.getSchema(m.$id)??h.compile(m):h.compile(m);return(f)=>p(f)?{valid:!0,data:f,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:h.errorsText(p.errors)}}},Xh=gl.Ajv;import Ai from"node:process";var $l=Symbol.for("mcp.completable");function Di(m){return!!m&&typeof m==="object"&&$l in m}function Dm(m){return m[$l]?.complete}function Vm(m,h){switch(h.kind){case"tools_list_changed":return m.toolsListChanged===!0;case"prompts_list_changed":return m.promptsListChanged===!0;case"resources_list_changed":return m.resourcesListChanged===!0;case"resource_updated":return m.resourceSubscriptions!==void 0&&m.resourceSubscriptions.includes(h.uri)}}function Um(m,h){let p={},f=(g)=>h===void 0||g===!0;if(m.toolsListChanged===!0&&f(h?.tools?.listChanged))p.toolsListChanged=!0;if(m.promptsListChanged===!0&&f(h?.prompts?.listChanged))p.promptsListChanged=!0;if(m.resourcesListChanged===!0&&f(h?.resources?.listChanged))p.resourcesListChanged=!0;if(m.resourceSubscriptions!==void 0&&m.resourceSubscriptions.length>0&&f(h?.resources?.subscribe))p.resourceSubscriptions=[...m.resourceSubscriptions];return p}var _n=1024;function Sl(m,h){return{method:m.method,params:{...m.params,_meta:{...m.params?._meta,[Yt]:h}}}}function Hm(m){let h=Nt(Ls).validateRequest("subscriptions/listen",m);return h.ok?h.value.params?.notifications:void 0}var xm=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),El=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(m=_n,h,p){this._maxSubscriptions=m,this._serverCapabilities=h,this._serverInfo=p}setServerCapabilities(m,h){if(this._serverCapabilities=m,h!==void 0)this._serverInfo=h}has(m){return this._subs.has(m)}serve(m){if(this._serverCapabilities===void 0)throw Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:m.id,error:{code:-32603,message:"Subscription limit reached"}};let h=Hm(m);if(h===void 0)return{jsonrpc:"2.0",id:m.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let p=Um(h,this._serverCapabilities);return this._subs.set(m.id,p),Sl({method:"notifications/subscriptions/acknowledged",params:{notifications:p}},m.id)}cancel(m){return this._subs.delete(m)}routeOutbound(m){if(!xm.has(m.method))return"passthrough";let h=m.params?.uri,p=typeof h==="string"?h:void 0,f=Fm(m.method,p),g=[];for(let[v,y]of this._subs)if(Vm(y,f))g.push(Sl({method:m.method,params:m.params??{}},v));return g}teardownAll(){let m=[];for(let h of this._subs.keys())m.push({jsonrpc:"2.0",id:h,result:{resultType:"complete",_meta:{[Yt]:h,...this._serverInfo!==void 0&&{[mt]:this._serverInfo}}}});return this._subs.clear(),m}};function Fm(m,h){switch(m){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:h??""}}}function Bm(m){return typeof m==="object"&&m!==null&&"setScopeChallengeResolver"in m&&typeof m.setScopeChallengeResolver==="function"}var Jm=8,Km=600000;function Gm(m){if(m?.maxRounds!==void 0&&(!Number.isInteger(m.maxRounds)||m.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${m.maxRounds})`);if(m?.roundTimeoutMs!==void 0&&(!Number.isFinite(m.roundTimeoutMs)||m.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${m.roundTimeoutMs})`);return{maxRounds:m?.maxRounds??Jm,roundTimeoutMs:m?.roundTimeoutMs??Km,legacyShim:m?.legacyShim??!0}}function Tl(m,h,p){if(p===null||typeof p!=="object"||typeof p.method!=="string")throw new ve(fe.InternalError,`Handler for ${m} returned an invalid input request '${h}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let f=p,g=vc(f);if(g===void 0)throw new ve(fe.InternalError,`Handler for ${m} returned an input request '${h}' of kind '${f.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:f,required:g}}function Wm(){let m=globalThis.crypto;if(m?.randomUUID!==void 0)return m.randomUUID();let h=new Uint8Array(16);m.getRandomValues(h),h[6]=h[6]&15|64,h[8]=h[8]&63|128;let p=[...h].map((f)=>f.toString(16).padStart(2,"0")).join("");return`${p.slice(0,8)}-${p.slice(8,12)}-${p.slice(12,16)}-${p.slice(16,20)}-${p.slice(20)}`}function Li(m,h){if(m==="tools/call")return{content:[{type:"text",text:h}],isError:!0};throw new ve(fe.InternalError,h)}var Ym=class{constructor(m){this._host=m}async fulfill(m,h,p,f,g){let{maxRounds:v,roundTimeoutMs:y}=this._host,_=f.mcpReq.signal,S=g,z=0;while(!0){if(z+=1,z>v)return Li(m,Vc(m,v));let O=S.inputRequests,k=O!=null&&Object.keys(O).length>0,F=typeof S.requestState==="string"?S.requestState:void 0;if(!k&&F===void 0)throw new ve(fe.InternalError,`Handler for ${m} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let B;if(k){let N=this._host.resolvedClientCapabilities(f),b=[];for(let[E,H]of Object.entries(O)){let{embedded:K,required:L}=Tl(m,E,H);if(K.method!=="roots/list"&&K.params===void 0)throw new ve(fe.InternalError,`Handler for ${m} returned an input request '${E}' of kind '${K.method}' without params`);if(sn(L,N)!==void 0)return Li(m,`Cannot request input '${E}' (${K.method}): the client on this 2025-era connection did not declare the required capability${N===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);b.push([E,K])}let V=Hc(_);try{let E={relatedRequestId:f.mcpReq.id,timeout:y,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:V.signal},H=await Promise.all(b.map(async([K,L])=>{try{return[K,await this._dispatchLeg(L,E)]}catch(j){throw V.abort(j),j}}));B=Object.fromEntries(H)}catch(E){if(_.aborted)throw E;return Li(m,`Fulfilling input required by '${m}' failed: ${E instanceof Error?E.message:String(E)}`)}finally{V.dispose()}}else await Uc(Dc,_);let T={...f,mcpReq:{...f.mcpReq,inputResponses:B,droppedInputResponseKeys:void 0,requestState:Ds(F)}};if(F!==void 0){let N=await this._host.verifyRequestState(F,T,m);if(N!==void 0)T=wi(T,N)}let M=await h(p,T);if(!vt(M))return M;S=M}}async _dispatchLeg(m,h){switch(m.method){case"elicitation/create":{let p=m.params;if(p.mode==="url"&&p.elicitationId===void 0)p={...p,elicitationId:Wm()};return await this._host.sendElicitation(p,h)}case"sampling/createMessage":return await this._host.sendSampling(m.params,h);case"roots/list":return await this._host.listRoots(m.params,h)}}},Xm=new Set(["tools/call","prompts/get","resources/read"]),Zm,Pl,Cl;function Vi(m,h){Pl(m,h)}function Ui(m){return Cl(m)}var ql=class extends Ei{_clientCapabilities;_clientVersion;static{Zm=(m,h)=>{if(h.clientCapabilities!==void 0)m._clientCapabilities=h.clientCapabilities;if(h.clientInfo!==void 0)m._clientVersion=h.clientInfo},Pl=(m,h)=>{let p=h.filter((f)=>!m._supportedProtocolVersions.includes(f));if(p.length>0)m._supportedProtocolVersions=[...m._supportedProtocolVersions,...p];m.setRequestHandler("server/discover",()=>m._ondiscover())},Cl=(m)=>m._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new Ym({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(m)=>this._inputRequestCapabilityView(m),verifyRequestState:(m,h,p)=>this._verifyRequestState(m,h,p),sendElicitation:(m,h)=>this._sendElicitationLeg(m,h,{validateAcceptedContent:!1}),sendSampling:(m,h)=>this.createMessage(m,h),listRoots:(m,h)=>this.listRoots(m,h)})}oninitialized;constructor(m,h){super(h);if(this._serverInfo=m,this._capabilities=h?.capabilities?{...h.capabilities}:{},this._instructions=h?.instructions,this._jsonSchemaValidator=h?.jsonSchemaValidator??new vn,this._requestStateVerify=h?.requestState?.verify,this._inputRequiredServing=Gm(h?.inputRequired),h?.cacheHints!==void 0){for(let[p,f]of Object.entries(h.cacheHints))if(f!==void 0)fi(f,`cacheHints['${p}']`);this._cacheHints=h.cacheHints}if(this.setRequestHandler("initialize",(p)=>this._oninitialize(p)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),li(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}async connect(m){if(this.transport!==void 0)throw new we(Pe.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(m)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(m,h)=>{let p=h.sessionId||h.http?.req?.headers.get("mcp-session-id")||void 0,{level:f}=m.params,g=mn(jt,f);if(g.success)this._loggingLevels.set(p,g.data);return{}})}buildContext(m,h){let p=m.http||h?.request||h?.closeSSEStream||h?.closeStandaloneSSEStream;return{...m,mcpReq:{...m.mcpReq,log:(f,g,v)=>{if(!this._capabilities.logging)return Promise.resolve();let y;if(this._servedModernEra()){if(y=m.mcpReq.envelope?.[Et],y===void 0)return Promise.resolve()}else y=this._loggingLevels.get(m.sessionId)??this._loggingLevels.get(void 0);if(y!==void 0&&this.LOG_LEVEL_SEVERITY.get(f)<this.LOG_LEVEL_SEVERITY.get(y))return Promise.resolve();return m.mcpReq.notify({method:"notifications/message",params:{level:f,data:g,logger:v}})},elicitInput:(f,g)=>this.elicitInput(f,g),requestSampling:(f,g)=>this.createMessage(f,g)},http:p?{...m.http,req:h?.request,closeSSE:h?.closeSSEStream,closeStandaloneSSE:h?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(jt.options.map((m,h)=>[m,h]));isMessageIgnored=(m,h)=>{let p=this._loggingLevels.get(h);return p?this.LOG_LEVEL_SEVERITY.get(m)<this.LOG_LEVEL_SEVERITY.get(p):!1};registerCapabilities(m){if(this.transport)throw new we(Pe.AlreadyConnected,"Cannot register capabilities after connecting to transport");let h=!!this._capabilities.logging;if(this._capabilities=Ti(this._capabilities,m),!h&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(m,h){if(m!=="tools/call"){let p=this._cacheHints?.[m],f=Xm.has(m);if(p===void 0&&!f)return async(g,v)=>{let y=await h(g,v);if(vt(y))throw new ve(fe.InternalError,`Handler for ${m} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return y};return async(g,v)=>{let y=f?await this._invokeInputRequiredCapableHandler(m,h,g,v):await h(g,v);if(vt(y)){if(!f)throw new ve(fe.InternalError,`Handler for ${m} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return y}return p===void 0?y:on(y,p)}}return async(p,f)=>{let g=Nt(this._negotiatedProtocolVersion),v=g.validateRequest("tools/call",p);if(!v.ok)throw new ve(v.reason==="not-in-era"?fe.InternalError:fe.InvalidParams,v.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${v.message}`);let y=await this._invokeInputRequiredCapableHandler("tools/call",h,p,f);if(vt(y))return y;let _=ui(y),S=g.validateResult("tools/call",_);if(!S.ok)throw new ve(S.reason==="not-in-era"?fe.InternalError:fe.InvalidParams,S.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${S.message}`);return S.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&Pr(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(m,h,p,f){let g=this._servedModernEra(),v=f.mcpReq.requestState();if(v!==void 0&&typeof v!=="string")throw new ve(fe.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let y=f;if(typeof v==="string"){let k=await this._verifyRequestState(v,f,m);if(k!==void 0)y=wi(f,k)}let _;try{_=await h(p,y)}catch(k){if(k instanceof ve&&k.code===fe.UrlElicitationRequired){if(!g)throw k;throw new ve(fe.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw k}if(!vt(_))return _;if(!g){if(!this._inputRequiredServing.legacyShim)throw new ve(fe.InternalError,`Handler for ${m} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??Wt}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(m,h,p,y,_)}let S=_.inputRequests,z=S!=null&&Object.keys(S).length>0,O=typeof _.requestState==="string";if(!z&&!O)throw new ve(fe.InternalError,`Handler for ${m} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(z){let k=this._inputRequestCapabilityView(f);for(let[F,B]of Object.entries(S)){let{embedded:T,required:M}=Tl(m,F,B),N=sn(M,k);if(N!==void 0)throw new nn({requiredCapabilities:N},`Cannot request input '${F}' (${T.method}): the request's client capabilities do not declare the required capability`)}}return _}async _verifyRequestState(m,h,p){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(m,h)}catch(f){throw this.onerror?.(Error(`requestState verification rejected ${p}: ${f instanceof Error?f.message:String(f)}`)),new ve(fe.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(m){return this._servedModernEra()?m.mcpReq.envelope?.[St]:this._clientCapabilities}_assertPushApiInServedEra(m){if(this._servedModernEra())throw new we(Pe.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${m}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:m,era:"2026-07-28"})}assertCapabilityForMethod(m){switch(m){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new we(Pe.CapabilityNotSupported,`Client does not support sampling (required for ${m})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new we(Pe.CapabilityNotSupported,`Client does not support elicitation (required for ${m})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new we(Pe.CapabilityNotSupported,`Client does not support listing roots (required for ${m})`);break;case"ping":break}}assertNotificationCapability(m){switch(m){case"notifications/message":if(!this._capabilities.logging)throw new we(Pe.CapabilityNotSupported,`Server does not support logging (required for ${m})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new we(Pe.CapabilityNotSupported,`Server does not support notifying about resources (required for ${m})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new we(Pe.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${m})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new we(Pe.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${m})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new we(Pe.CapabilityNotSupported,`Client does not support URL elicitation (required for ${m})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(m){switch(m){case"completion/complete":if(!this._capabilities.completions)throw new we(Pe.CapabilityNotSupported,`Server does not support completions (required for ${m})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new we(Pe.CapabilityNotSupported,`Server does not support logging (required for ${m})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new we(Pe.CapabilityNotSupported,`Server does not support prompts (required for ${m})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new we(Pe.CapabilityNotSupported,`Server does not support resources (required for ${m})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new we(Pe.CapabilityNotSupported,`Server does not support tools (required for ${m})`);break;case"ping":case"initialize":break}}async _oninitialize(m){let h=m.params.protocolVersion;this._clientCapabilities=m.params.capabilities,this._clientVersion=m.params.clientInfo;let p=bc(this._supportedProtocolVersions),f=p.includes(h)?h:p[0]??Wt;return this._negotiatedProtocolVersion=f,this.transport?.setProtocolVersion?.(f),{protocolVersion:f,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:li(this._supportedProtocolVersions),capabilities:Qm(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(m,h){return this._wireCodec().projectCallToolResult(m,h)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(m,h){if(this._assertPushApiInServedEra("sampling/createMessage"),(m.tools||m.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new we(Pe.CapabilityNotSupported,"Client does not support sampling tools capability.");if(m.messages.length>0){let v=m.messages.at(-1),y=Array.isArray(v.content)?v.content:[v.content],_=y.some((k)=>k.type==="tool_result"),S=m.messages.length>1?m.messages.at(-2):void 0,z=S?Array.isArray(S.content)?S.content:[S.content]:[],O=z.some((k)=>k.type==="tool_use");if(_){if(y.some((k)=>k.type!=="tool_result"))throw new ve(fe.InvalidParams,"The last message must contain only tool_result content if any is present");if(!O)throw new ve(fe.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(O){let k=new Set(z.filter((B)=>B.type==="tool_use").map((B)=>B.id)),F=new Set(y.filter((B)=>B.type==="tool_result").map((B)=>B.toolUseId));if(k.size!==F.size||![...k].every((B)=>F.has(B)))throw new ve(fe.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let p=Boolean(m.tools||m.toolChoice),f=await this.request({method:"sampling/createMessage",params:m},h),g=this._wireCodec().samplingResultVariant(p,f);if(!g.ok)throw new we(Pe.InvalidResult,`Invalid sampling/createMessage result: ${g.reason==="invalid"?g.message:g.reason}`);return g.value}async elicitInput(m,h){switch(this._assertPushApiInServedEra("elicitation/create"),m.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new we(Pe.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new we(Pe.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(m,h)}async _sendElicitationLeg(m,h,p){let f=m.mode??"form",g=p?.validateAcceptedContent??!0;switch(f){case"url":{let v=m;return this.request({method:"elicitation/create",params:v},h)}case"form":{let v=m.mode==="form"?m:{...m,mode:"form"},y=await this.request({method:"elicitation/create",params:v},h);if(g&&y.action==="accept"&&y.content&&v.requestedSchema)try{let _=this._jsonSchemaValidator.getValidator(v.requestedSchema)(y.content);if(!_.valid)throw new ve(fe.InvalidParams,`Elicitation response content does not match requested schema: ${_.errorMessage}`)}catch(_){if(_ instanceof ve)throw _;throw new ve(fe.InternalError,`Error validating elicitation response: ${_ instanceof Error?_.message:String(_)}`)}return y}}}createElicitationCompletionNotifier(m,h){if(!this._clientCapabilities?.elicitation?.url)throw new we(Pe.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:m}},h)}async listRoots(m,h){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:m},h)}async sendLoggingMessage(m,h){if(this._capabilities.logging&&!this.isMessageIgnored(m.level,h))return this.notification({method:"notifications/message",params:m})}async sendResourceUpdated(m){return this.notification({method:"notifications/resources/updated",params:m})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function Qm(m){return{...m}}function eh(m,h){let p=0,f=[m];while(f.length>0){let g=f.pop();if(g===null||typeof g!=="object")continue;if(Array.isArray(g))for(let v of g){if(++p>h)return p;if(v!==null&&typeof v==="object")f.push(v)}else for(let v in g){if(!Object.prototype.hasOwnProperty.call(g,v))continue;if(++p>h)return p;let y=g[v];if(y!==null&&typeof y==="object")f.push(y)}}return p}function th(m){if(m===void 0||m===1/0)return;if(typeof m!=="number"||Number.isNaN(m)||m<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(m)}`);return m}var Hs=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(m){let h=this._registeredTools[m];if(h===void 0||!h.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,m))return this._toolInputSchemaJson[m];if(h.inputSchema===void 0)return vl;try{let p=tr(h.inputSchema,"input");return this._toolInputSchemaJson[m]=p,p}catch{return}}constructor(m,h){if(this.server=new ql(m,h),this._maxToolInputElements=th(h?.maxToolInputElements),h?.capabilities?.tools)this.setToolRequestHandlers();if(h?.capabilities?.resources)this.setResourceRequestHandlers();if(h?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(m){if(Bm(m))m.setScopeChallengeResolver((h)=>this.resolveScopeChallenge(h));return await this.server.connect(m)}async close(){await this.server.close()}resolveScopeChallenge=(m)=>{switch(m.request.method){case"tools/call":{let h=m.request.params?.name;if(typeof h!=="string")return;let p=this._registeredTools[h];if(p===void 0||!p.enabled)return;return p.scopeChallenge?.(m)}case"resources/read":{let h=m.request.params?.uri;if(typeof h!=="string")return;let p;try{p=new URL(h)}catch{return}let f=this._registeredResources[p.toString()];if(f!==void 0)return f.enabled?f.scopeChallenge?.(m):void 0;for(let g of Object.values(this._registeredResourceTemplates))if(g.resourceTemplate.uriTemplate.match(p.toString()))return g.enabled?g.scopeChallenge?.(m):void 0;return}case"prompts/get":{let h=m.request.params?.name;if(typeof h!=="string")return;let p=this._registeredPrompts[h];if(p===void 0||!p.enabled)return;return p.scopeChallenge?.(m)}default:return}};_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,m])=>m.enabled).map(([m,h])=>{let p={name:m,title:h.title,description:h.description,inputSchema:h.inputSchema?rh(m,h.inputSchema):vl,annotations:h.annotations,icons:h.icons,execution:h.execution,_meta:h._meta};if(h.outputSchema)p.outputSchema=tr(h.outputSchema,"output");return p})})),this.server.setRequestHandler("tools/call",async(m,h)=>{let p=this._registeredTools[m.params.name];if(!p)throw new ve(fe.InvalidParams,`Tool ${m.params.name} not found`);if(!p.enabled)throw new ve(fe.InvalidParams,`Tool ${m.params.name} disabled`);try{let f=await this.validateToolInput(p,m.params.arguments,m.params.name),g=await this.executeToolHandler(p,f,h);if(await this.validateToolOutput(p,g,m.params.name),vt(g))return g;return this.server.projectCallToolResult(g,p.outputSchemaJson)}catch(f){if(f instanceof ve&&f.code===fe.UrlElicitationRequired)throw f;return this.createToolError(f instanceof Error?f.message:String(f))}}),this._toolHandlersInitialized=!0}createToolError(m){return{content:[{type:"text",text:m}],isError:!0}}async validateToolInput(m,h,p){if(this._maxToolInputElements!==void 0&&eh(h,this._maxToolInputElements)>this._maxToolInputElements)throw new ve(fe.InvalidParams,`Invalid arguments for tool ${p}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!m.inputSchema)return;let f=await Qt(m.inputSchema,h??{});if(!f.success)throw new ve(fe.InvalidParams,`Input validation error: Invalid arguments for tool ${p}: ${f.error}`);return f.data}async validateToolOutput(m,h,p){if(!m.outputSchema)return;if(vt(h))return;if(h.isError)return;if(h.structuredContent===void 0)throw new ve(fe.InvalidParams,`Output validation error: Tool ${p} has an output schema but no structured content was provided`);let f=await Qt(m.outputSchema,h.structuredContent);if(!f.success)throw new ve(fe.InvalidParams,`Output validation error: Invalid structured content for tool ${p}: ${f.error}`)}async executeToolHandler(m,h,p){return m.executor(h,p)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(m)=>{switch(m.params.ref.type){case"ref/prompt":return yi(m),this.handlePromptCompletion(m,m.params.ref);case"ref/resource":return vi(m),this.handleResourceCompletion(m,m.params.ref);default:throw new ve(fe.InvalidParams,`Invalid completion reference: ${m.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(m,h){let p=this._registeredPrompts[h.name];if(!p)throw new ve(fe.InvalidParams,`Prompt ${h.name} not found`);if(!p.enabled)throw new ve(fe.InvalidParams,`Prompt ${h.name} disabled`);if(!p.argsSchema)return Us;let f=wl(zl(p.argsSchema)?.[m.params.argument.name]);if(!Di(f))return Us;let g=Dm(f);if(!g)return Us;return Rl(await g(m.params.argument.value,m.params.context))}async handleResourceCompletion(m,h){let p=Object.values(this._registeredResourceTemplates).find((g)=>g.resourceTemplate.uriTemplate.toString()===h.uri);if(!p){if(this._registeredResources[h.uri])return Us;throw new ve(fe.InvalidParams,`Resource template ${m.params.ref.uri} not found`)}let f=p.resourceTemplate.completeCallback(m.params.argument.name);if(!f)return Us;return Rl(await f(m.params.argument.value,m.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(m,h)=>{let p=Object.entries(this._registeredResources).filter(([g,v])=>v.enabled).map(([g,v])=>({uri:g,name:v.name,...v.metadata})),f=[];for(let g of Object.values(this._registeredResourceTemplates)){if(!g.resourceTemplate.listCallback)continue;let v=await g.resourceTemplate.listCallback(h);for(let y of v.resources)f.push({...g.metadata,...y})}return{resources:[...p,...f]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([m,h])=>({name:m,uriTemplate:h.resourceTemplate.uriTemplate.toString(),...h.metadata}))})),this.server.setRequestHandler("resources/read",async(m,h)=>{let p;try{p=new URL(m.params.uri)}catch{throw new ve(fe.InvalidParams,`Resource URI ${m.params.uri} is invalid`,{uri:m.params.uri,reason:"invalid_uri"})}let f=this._registeredResources[p.toString()];if(f){if(!f.enabled)throw new ve(fe.InvalidParams,`Resource ${p} disabled`);return on(await f.readCallback(p,h),f.cacheHint)}for(let g of Object.values(this._registeredResourceTemplates)){let v=g.resourceTemplate.uriTemplate.match(p.toString());if(v){if(!g.enabled)throw new ve(fe.InvalidParams,`Resource template ${g.resourceTemplate.uriTemplate} disabled`);return on(await g.readCallback(p,v,h),g.cacheHint)}}throw new an(m.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,m])=>m.enabled).map(([m,h])=>({name:m,title:h.title,description:h.description,arguments:h.argsSchema?Lc(h.argsSchema):void 0,icons:h.icons,_meta:h._meta}))})),this.server.setRequestHandler("prompts/get",async(m,h)=>{let p=this._registeredPrompts[m.params.name];if(!p)throw new ve(fe.InvalidParams,`Prompt ${m.params.name} not found`);if(!p.enabled)throw new ve(fe.InvalidParams,`Prompt ${m.params.name} disabled`);return p.handler(m.params.arguments,h)}),this._promptHandlersInitialized=!0}registerResource(m,h,p,f){let{cacheHint:g,scopeChallenge:v,...y}=p,_=y;if(g!==void 0)fi(g,`resource ${m}`);if(typeof h==="string"){if(this._registeredResources[h])throw Error(`Resource ${h} is already registered`);let S=this._createRegisteredResource(m,p.title,h,_,v,f);if(g!==void 0)S.cacheHint=g;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),S}else{if(this._registeredResourceTemplates[m])throw Error(`Resource template ${m} is already registered`);let S=this._createRegisteredResourceTemplate(m,p.title,h,_,v,f);if(g!==void 0)S.cacheHint=g;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),S}}_createRegisteredResource(m,h,p,f,g,v){let y={name:m,title:h,metadata:f,readCallback:v,scopeChallenge:g,enabled:!0,disable:()=>y.update({enabled:!1}),enable:()=>y.update({enabled:!0}),remove:()=>y.update({uri:null}),update:(_)=>{if(_.uri!==void 0&&_.uri!==p){if(delete this._registeredResources[p],_.uri)this._registeredResources[_.uri]=y}if(_.name!==void 0)y.name=_.name;if(_.title!==void 0)y.title=_.title;if(_.metadata!==void 0)y.metadata=_.metadata;if(_.callback!==void 0)y.readCallback=_.callback;if(_.scopeChallenge!==void 0)y.scopeChallenge=_.scopeChallenge===null?void 0:_.scopeChallenge;if(_.enabled!==void 0)y.enabled=_.enabled;this.sendResourceListChanged()}};return this._registeredResources[p]=y,y}_createRegisteredResourceTemplate(m,h,p,f,g,v){let y={resourceTemplate:p,title:h,metadata:f,readCallback:v,scopeChallenge:g,enabled:!0,disable:()=>y.update({enabled:!1}),enable:()=>y.update({enabled:!0}),remove:()=>y.update({name:null}),update:(S)=>{if(S.name!==void 0&&S.name!==m){if(delete this._registeredResourceTemplates[m],S.name)this._registeredResourceTemplates[S.name]=y}if(S.title!==void 0)y.title=S.title;if(S.template!==void 0)y.resourceTemplate=S.template;if(S.metadata!==void 0)y.metadata=S.metadata;if(S.callback!==void 0)y.readCallback=S.callback;if(S.scopeChallenge!==void 0)y.scopeChallenge=S.scopeChallenge===null?void 0:S.scopeChallenge;if(S.enabled!==void 0)y.enabled=S.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[m]=y;let _=p.uriTemplate.variableNames;if(Array.isArray(_)&&_.some((S)=>!!p.completeCallback(S)))this.setCompletionRequestHandler();return y}_createRegisteredPrompt(m,h,p,f,g,v,y,_){let S=f,z=g,O={title:h,description:p,argsSchema:f,icons:v,scopeChallenge:y,_meta:_,handler:bl(m,f,g),enabled:!0,disable:()=>O.update({enabled:!1}),enable:()=>O.update({enabled:!0}),remove:()=>O.update({name:null}),update:(k)=>{if(k.name!==void 0&&k.name!==m){if(delete this._registeredPrompts[m],k.name)this._registeredPrompts[k.name]=O}if(k.title!==void 0)O.title=k.title;if(k.description!==void 0)O.description=k.description;if(k.icons!==void 0)O.icons=k.icons;if(k.scopeChallenge!==void 0)O.scopeChallenge=k.scopeChallenge===null?void 0:k.scopeChallenge;if(k._meta!==void 0)O._meta=k._meta;let F=!1;if(k.argsSchema!==void 0)O.argsSchema=k.argsSchema,S=k.argsSchema,F=!0;if(k.callback!==void 0)z=k.callback,F=!0;if(F)O.handler=bl(m,S,z);if(k.enabled!==void 0)O.enabled=k.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[m]=O,f){let k=zl(f);if(k){if(Object.values(k).some((F)=>Di(wl(F))))this.setCompletionRequestHandler()}}return O}_createRegisteredTool(m,h,p,f,g,v,y,_,S,z,O){qi(m);let k=O,F,B={title:h,description:p,inputSchema:f,outputSchema:g,get outputSchemaJson(){return F??=_l(B.outputSchema)},set outputSchemaJson(T){F=T},annotations:v,icons:y,execution:_,scopeChallenge:S,_meta:z,handler:O,executor:yl(f,O),enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(T)=>{if(T.name!==void 0&&T.name!==m){if(typeof T.name==="string")qi(T.name);if(delete this._registeredTools[m],delete this._toolInputSchemaJson[m],T.name)delete this._toolInputSchemaJson[T.name],this._registeredTools[T.name]=B,m=T.name}if(T.title!==void 0)B.title=T.title;if(T.description!==void 0)B.description=T.description;let M=!1;if(T.paramsSchema!==void 0)B.inputSchema=T.paramsSchema,delete this._toolInputSchemaJson[m],M=!0;if(T.callback!==void 0)B.handler=T.callback,k=T.callback,M=!0;if(M)B.executor=yl(B.inputSchema,k);if(T.outputSchema!==void 0)B.outputSchema=T.outputSchema,B.outputSchemaJson=_l(T.outputSchema);if(T.annotations!==void 0)B.annotations=T.annotations;if(T.icons!==void 0)B.icons=T.icons;if(T.scopeChallenge!==void 0)B.scopeChallenge=T.scopeChallenge===null?void 0:T.scopeChallenge;if(T._meta!==void 0)B._meta=T._meta;if(T.enabled!==void 0)B.enabled=T.enabled;this.sendToolListChanged()}};return this._registeredTools[m]=B,this.setToolRequestHandlers(),this.sendToolListChanged(),B}registerTool(m,h,p){if(this._registeredTools[m])throw Error(`Tool ${m} is already registered`);let{title:f,description:g,inputSchema:v,outputSchema:y,annotations:_,icons:S,scopeChallenge:z,_meta:O}=h;return this._createRegisteredTool(m,f,g,hn(v),hn(y),_,S,void 0,z,O,p)}registerPrompt(m,h,p){if(this._registeredPrompts[m])throw Error(`Prompt ${m} is already registered`);let{title:f,description:g,argsSchema:v,icons:y,scopeChallenge:_,_meta:S}=h,z=this._createRegisteredPrompt(m,f,g,hn(v),p,y,_,S);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),z}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(m,h){return this.server.sendLoggingMessage(m,h)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}};function yl(m,h){if(m){let f=h;return async(g,v)=>f(g,v)}let p=h;return async(f,g)=>p(g)}var vl={type:"object",properties:{}};function rh(m,h){let p=tr(h,"input"),f=_i(p);if(!f.valid)console.warn(`[mcp-sdk] tool '${m}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${f.reason}`);return p}function _l(m){if(m===void 0)return;try{return tr(m,"output")}catch{return}}function bl(m,h,p){if(h){let f=p;return async(g,v)=>{let y=await Qt(h,g??{});if(!y.success)throw new ve(fe.InvalidParams,`Invalid arguments for prompt ${m}: ${y.error}`);return f(y.data,v)}}else{let f=p;return async(g,v)=>f(v)}}function Rl(m){return{completion:{values:m.map(String).slice(0,100),total:m.length,hasMore:m.length>100}}}var Us={completion:{values:[],hasMore:!1}};function zl(m){let h=m;if(h.shape&&typeof h.shape==="object")return h.shape}function sh(m){return m?.type==="optional"}function wl(m){if(!sh(m))return m;return m.def?.innerType??m}var Il=Symbol("swallowsErrorsAfterClose"),oh=class{_readBuffer;_started=!1;_closed=!1;constructor(m=Ai.stdin,h=Ai.stdout,p){this._stdin=m,this._stdout=h,this._readBuffer=new Pi({maxBufferSize:p?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(m)=>{try{this._readBuffer.append(m),this.processReadBuffer()}catch(h){this.onerror?.(h),this.close().catch(()=>{})}};_onerror=(m)=>{this.onerror?.(m)};_onstdouterror=(m)=>{if(this._closed)return;this.onerror?.(m),this.close().catch(()=>{})};_onstdinclose=()=>{this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0;for(let m of this._stdout.listeners("error"))if(m[Il])this._stdout.off("error",m);if(this._stdin.readableEnded||this._stdin.destroyed)setImmediate(this._onstdinclose);this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdin.on("end",this._onstdinclose),this._stdin.on("close",this._onstdinclose),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){while(!0)try{let m=this._readBuffer.readMessage();if(m===null)break;this.onmessage?.(m)}catch(m){this.onerror?.(m)}}async close(){if(this._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.off("end",this._onstdinclose),this._stdin.off("close",this._onstdinclose),this._onstdouterror[Il]=!0,this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(m){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((h,p)=>{let f=Ci(m),g=!1,v=(_)=>{if(g)return;g=!0,this._stdout.off("error",v),this._stdout.off("drain",y),p(_)},y=()=>{if(g)return;g=!0,this._stdout.off("error",v),this._stdout.off("drain",y),h()};if(this._stdout.once("error",v),this._stdout.write(f)){if(g)return;g=!0,this._stdout.off("error",v),h()}else if(!g)this._stdout.once("drain",y)})}},jl=3000,ah=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(m,h,p){this._wire=m,this._onInstanceClose=h,this._outboundIntercept=p}async start(){}async send(m,h){if(Ms(m)||dn(m)){let{id:p}=m;if(p!==void 0)this._settle(p)}if(this._closed)return;if(this._outboundIntercept?.(m)==="handled")return;return this._wire.send(m,h)}setProtocolVersion=(m)=>{this._wire.setProtocolVersion?.(m)};deliver(m,h){if(this._closed)return;if(nt(m))this._pendingRequests.add(m.id);else if(At(m)&&m.method==="notifications/cancelled"){let p=m.params?.requestId;if(p!==void 0)this._settle(p)}this.onmessage?.(m,h)}async whenRequestsAnswered(m){if(this._closed||this._pendingRequests.size===0)return!0;return await new Promise((h)=>{let p=()=>{clearTimeout(f),h(!0)},f=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter((g)=>g!==p),h(!1)},m);this._drainWaiters.push(p)})}async close(){if(this._closed)return;this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}_settle(m){if(this._pendingRequests.delete(m),this._pendingRequests.size===0)this._releaseDrainWaiters()}_releaseDrainWaiters(){let m=this._drainWaiters;this._drainWaiters=[];for(let h of m)h()}};function nh(m){let h=m.params;if(m.method==="initialize"&&!bi(h)){let v=h!==null&&typeof h==="object"&&typeof h.protocolVersion==="string"?h.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...v!==void 0&&{requestedVersion:v}}}if(!cn(h))return{kind:"legacy",reason:"no-claim"};let p=er(h),f=(p===void 0?[]:un(p))[0];if(f!==void 0)return{kind:"invalid-envelope",issue:f};let g=ln(h);if(g===void 0||!Mt.includes(g))return{kind:"unsupported-revision",requested:g??"unknown"};return{kind:"modern",revision:g,classification:{era:"modern",revision:g}}}function kl(m,h={}){let p=h.legacy??"serve",f=h.transport??new oh,g={phase:"opening"},v,y=!1,_=()=>y||g.phase==="closed",S=(U)=>{try{h.onerror?.(U)}catch{}},z=(U,Q,ne,ee)=>f.send({jsonrpc:"2.0",id:U,error:{code:Q,message:ne,...ee!==void 0&&{data:ee}}}).catch((ie)=>S(dt(ie))),O=new El(h.maxSubscriptions??_n),k=(U)=>{if(!At(U))return;let Q=O.routeOutbound(U);if(Q==="passthrough")return;for(let ne of Q)f.send({jsonrpc:"2.0",...ne}).catch((ee)=>S(dt(ee)));return"handled"},F=async(U)=>{if(nt(U)&&U.method==="subscriptions/listen"){let Q=er(U.params),ne=cn(U.params)?(Q===void 0?[]:un(Q))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},ee=ln(U.params),ie;if(ne!==void 0)ie={jsonrpc:"2.0",id:U.id,error:{code:-32602,message:`Invalid _meta envelope: ${ne.key}: ${ne.problem}`}};else if(ee===void 0||!Mt.includes(ee)){let Se=new Cr({supported:[...Mt],requested:ee??"unknown"});ie={jsonrpc:"2.0",id:U.id,error:{code:Se.code,message:Se.message,data:Se.data}}}else ie=O.serve(U);return await f.send("error"in ie?ie:{jsonrpc:"2.0",method:ie.method,params:ie.params}).catch((Se)=>S(dt(Se))),!0}if(At(U)&&U.method==="notifications/cancelled"){let Q=U.params?.requestId;if(Q!==void 0&&O.cancel(Q))return!0}return!1},B=(U,Q,ne)=>{let ee=Ri({kind:"legacy",reason:Q,...ne!==void 0&&{requestedVersion:ne}},Mt);if(ee===void 0)return Promise.resolve();return S(Error(`Rejected 2025-era request on a modern-only stdio connection (${ee.cell}): ${ee.message}`)),z(U.id,ee.code,ee.message,ee.data)},T=(U)=>{if(y||U===v)return;L()},M=async(U,Q)=>{let ne=await m({era:U}),ee=ne instanceof Hs?ne.server:ne;if(U==="modern")$i(ee,Q),Vi(ee,Mt),O.setServerCapabilities(ee.getCapabilities(),Ui(ee));let ie=new ah(f,()=>T(ie),U==="modern"?k:void 0);return await ne.connect(ie),{product:ne,channel:ie}},N=(U)=>U.product.close().catch((Q)=>S(dt(Q))),b=async(U)=>{v=U.channel;try{if(!await U.channel.whenRequestsAnswered(jl))S(Error(`Discarded the probe instance with requests still unanswered after ${jl}ms; continuing with the fallback`));await U.product.close()}catch(Q){S(dt(Q))}finally{v=void 0}},V=async(U)=>{if(g.phase==="closed")return;if(g.phase==="pinned"){if(g.era==="modern"&&nt(U)&&U.method==="initialize"&&!bi(U.params)){await B(U,"initialize",U.params!==null&&typeof U.params==="object"&&typeof U.params.protocolVersion==="string"?U.params.protocolVersion:void 0);return}if(g.era==="modern"&&await F(U))return;if(_())return;g.instance.channel.deliver(U);return}if(!nt(U)&&!At(U)){S(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let Q=nh(U);switch(Q.kind){case"invalid-envelope":{let ne=`Invalid _meta envelope for protocol revision 2026-07-28: ${Q.issue.key}: ${Q.issue.problem}`;if(nt(U))await z(U.id,fe.InvalidParams,ne,{envelope:Q.issue});else S(Error(`Discarded a notification with a malformed envelope: ${ne}`));return}case"unsupported-revision":if(nt(U)){let ne=new Cr({supported:[...Mt],requested:Q.requested});S(ne),await z(U.id,ne.code,ne.message,ne.data)}else S(Error(`Discarded a notification claiming unsupported protocol revision ${Q.requested}`));return;case"modern":if(nt(U)&&U.method==="server/discover"){if(g.phase==="probe"){g.instance.channel.deliver(U,{classification:Q.classification});return}let ne=await M("modern",Q.revision);if(_()){await N(ne);return}g={phase:"probe",instance:ne},ne.channel.deliver(U,{classification:Q.classification});return}if(g.phase==="probe"){if(At(U)){g.instance.channel.deliver(U,{classification:Q.classification});return}g={phase:"pinned",era:"modern",instance:g.instance}}else{let ne=await M("modern",Q.revision);if(_()){await N(ne);return}g={phase:"pinned",era:"modern",instance:ne}}if(await F(U))return;if(_())return;g.instance.channel.deliver(U,{classification:Q.classification});return;case"legacy":{if(p==="reject"){if(nt(U))await B(U,Q.reason,Q.requestedVersion);return}if(g.phase==="probe"){if(await b(g.instance),_())return;g={phase:"opening"}}let ne=await M("legacy");if(_()){await N(ne);return}g={phase:"pinned",era:"legacy",instance:ne},g.instance.channel.deliver(U);return}}},E=[],H=!1,K=async()=>{if(H)return;H=!0;try{while(E.length>0){let U=E.shift();try{await V(U)}catch(Q){if(nt(U))await z(U.id,fe.InternalError,"Internal server error");S(dt(Q))}}}finally{H=!1}},L=async()=>{if(y||g.phase==="closed")return;y=!0;let U=g;g={phase:"closed"};for(let Q of O.teardownAll())await f.send(Q).catch((ne)=>S(dt(ne)));if(U.phase==="probe"||U.phase==="pinned")await U.instance.product.close().catch((Q)=>S(dt(Q)));await f.close().catch((Q)=>S(dt(Q)))};f.onmessage=(U)=>{E.push(U),K()},f.onerror=(U)=>{if(S(U),g.phase==="probe"||g.phase==="pinned")g.instance.channel.onerror?.(U)},f.onclose=()=>{if(y||g.phase==="closed")return;y=!0;let U=g;if(g={phase:"closed"},U.phase==="probe"||U.phase==="pinned")U.instance.product.close().catch((Q)=>S(dt(Q)))};let j=f.start().catch((U)=>{throw S(dt(U)),U});return j.catch(()=>{}),{close:async()=>{await j.catch(()=>{}),await L()}}}function dt(m){return m instanceof Error?m:Error(String(m))}var Ol={project:e().optional(),stage:e().optional()},ih={sandboxId:e().min(1),reservationKey:e().min(1)},bn=i().describe("Must be true, after the owner has agreed to this delete."),Nl="'********' keeps a stored secret and null deletes a field: never send a placeholder you did not read from a get.",ch=[{singular:"agent",plural:"agents",key:"agentId",createHint:"Needs name and config; a 409 returns the existing agentId.",deleteHint:"Deleting an agent also drops its runtime rows.",updateHint:Nl,list:(m)=>m.listAgents(),get:(m,h)=>m.getAgent(h),create:(m,h)=>m.createAgent(h),update:(m,h,p)=>m.updateAgent(h,p),remove:(m,h)=>m.deleteAgent(h)},{singular:"cron",plural:"crons",key:"cronId",createHint:"Needs name, agentId, scheduleExpression (rate/cron/at) and input or events.",list:(m)=>m.listCrons(),get:(m,h)=>m.getCron(h),create:(m,h)=>m.createCron(h),update:(m,h,p)=>m.updateCron(h,p),remove:(m,h)=>m.deleteCron(h)},{singular:"sandbox",plural:"sandboxes",key:"sandboxId",updateHint:Nl,list:(m)=>m.listSandboxes(),get:(m,h)=>m.getSandbox(h),create:(m,h)=>m.createSandbox(h),update:(m,h,p)=>m.updateSandbox(h,p),remove:(m,h)=>m.deleteSandbox(h)},{singular:"workspace",plural:"workspaces",key:"workspaceId",list:(m)=>m.listWorkspaces(),get:(m,h)=>m.getWorkspace(h),create:(m,h)=>m.createWorkspace(h),update:(m,h,p)=>m.updateWorkspace(h,p),remove:(m,h)=>m.deleteWorkspace(h)},{singular:"policy",plural:"policies",key:"policyId",createHint:"Agent-runtime policy document (tool.call, skill.load), not API credential scoping.",list:(m)=>m.listPolicies(),get:(m,h)=>m.getPolicy(h),create:(m,h)=>m.createPolicy(h),update:(m,h,p)=>m.updatePolicy(h,p),remove:(m,h)=>m.deletePolicy(h)},{singular:"role",plural:"roles",key:"roleId",createHint:"Needs name and a version-1 policy over the API namespace, e.g. agents:read. Account key only.",list:(m)=>m.listRoles(),get:(m,h)=>m.getRole(h),create:(m,h)=>m.createRole(h),update:(m,h,p)=>m.updateRole(h,p),remove:(m,h)=>m.deleteRole(h)},{singular:"channel",plural:"channels",key:"channelId",list:(m)=>m.listChannels(),get:(m,h)=>m.getChannel(h),create:(m,h)=>m.createChannel(h),update:(m,h,p)=>m.updateChannel(h,p),remove:(m,h)=>m.deleteChannel(h)},{singular:"skill",plural:"skills",key:"skillName",createHint:'source is "files" (base64), "json" or "github". The stored name comes from the SKILL.md frontmatter.',list:(m)=>m.listSkills(),get:(m,h)=>m.getSkill(h),create:(m,h)=>m.createSkill(h),remove:(m,h)=>m.deleteSkill(h)},{singular:"mcp",plural:"mcp",key:"serverId",scoped:!0,list:(m,h)=>m.listMcp(h),get:(m,h)=>m.getMcp(h),create:(m,h,p)=>m.createMcp(p,h),update:(m,h,p)=>m.updateMcp(h,p),remove:(m,h)=>m.deleteMcp(h)}];function Wf(m={}){let h=q()?new w({}):null;if(!h&&!m.cli)throw Error("broods mcp needs a credential: set BROODS_SESSION_TOKEN or BROODS_ACCOUNT_SECRET, or run `broods login`.");let p=new Hs({name:"broods",version:"1"},{capabilities:{tools:{}}});if(h){for(let f of ch)ph(p,h,f,m.scope??{});hh(p,h)}if(m.cli)dh(p,m.cli);if(m.allowDestructive)mh(p,h,m.cli??null);return p}function Yf(m,h){return kl(()=>m,{legacy:"reject",...h?{transport:h}:{}})}function Rn(m,h){if(!m)throw Error(`Refusing without confirm:true. ${h}`)}async function Oe(m){try{return uh(await m())}catch(h){return lh(h)}}function lh(m){return{content:[{type:"text",text:m instanceof Error?m.message:String(m)}],isError:!0}}function uh(m){return{content:[{type:"text",text:JSON.stringify(m??null,null,2)}]}}function Ml(m,h,p,f){if(!m.scoped)return;let g=p??h.project,v=f??h.stage;if(!g||!v)throw Error(`${m.plural} live in one stage, so this call needs both 'project' and 'stage'`);return{project:g,stage:v}}function dh(m,h){m.registerTool("list-orgs",{description:"Every organization this login can reach, with the current one marked.",inputSchema:{}},async()=>await Oe(async()=>{let p=await h.getOnboarding();return{currentOrgId:p.currentOrgId,orgs:p.orgs}})),m.registerTool("create-org",{description:"Create an organization and switch this login to it. Later calls act in the new org.",inputSchema:{name:e().min(1)}},async({name:p})=>await Oe(async()=>await h.createOnboardingOrg(p))),m.registerTool("select-org",{description:"Switch this login to another organization, by an orgId from list-orgs.",inputSchema:{orgId:e().min(1)}},async({orgId:p})=>await Oe(async()=>await h.selectOnboardingOrg(p))),m.registerTool("list-projects",{description:"Every project in the current org, empty ones last. Project names are not unique, so take the id from here.",inputSchema:{}},async()=>await Oe(async()=>await h.listProjects())),m.registerTool("list-stages",{description:"Every stage of one project, by project name.",inputSchema:{project:e().min(1)}},async({project:p})=>await Oe(async()=>await h.listStages(p))),m.registerTool("create-stage",{description:"Create a stage in a project, optionally cloning another stage's architecture and env vars. A project name that does not exist yet is created with it, which is the only way to make a project without deploying a manifest.",inputSchema:{project:e().min(1),name:e().min(1),from:e().optional().describe("Stage to clone architecture and env vars from.")}},async({project:p,name:f,from:g})=>await Oe(async()=>await h.createStage(p,f,g)))}function mh(m,h,p){if(h)m.registerTool("rotate-secret",{description:"Rotate the account key. The current key stops working immediately and the new one is shown once, so this breaks every deployment and CI job still holding the old one. Requires confirm:true.",inputSchema:{confirm:bn}},async({confirm:f})=>await Oe(async()=>(Rn(f,"Everything holding the current secret breaks the moment this runs."),await h.rotateSecret())));if(p)m.registerTool("delete-project",{description:"Delete a project and everything under it: stages, agents, canvas, env vars, crons and workspace files. Takes a projectId from list-projects and requires confirm:true.",inputSchema:{projectId:e().min(1),confirm:bn}},async({projectId:f,confirm:g})=>await Oe(async()=>(Rn(g,`Project '${f}' and everything under it goes away: name it, get the owner's agreement, then retry.`),await p.deleteProject(f))))}function hh(m,h){m.registerTool("list-cron-runs",{description:"Run history for one cron, newest first. Check this before telling anyone a cron fired.",inputSchema:{cronId:e().min(1),limit:o().int().positive().max(100).optional()}},async({cronId:f,limit:g})=>await Oe(async()=>await h.listCronRuns(f,g===void 0?{}:{limit:g})));let p=[["suspend-sandbox","Suspend a persistent sandbox reservation.",(f,g)=>h.suspendSandbox(f,g)],["resume-sandbox","Resume a suspended sandbox reservation.",(f,g)=>h.resumeSandbox(f,g)],["terminate-sandbox","Terminate a sandbox reservation and drop its live-instance row. Terminate only a sandbox you created, and never one holding state you did not put there.",(f,g)=>h.terminateSandbox(f,g)],["open-sandbox-terminal","Mint a short-lived sealed ticket for an interactive PTY session on a persistent sandbox.",(f,g)=>h.openSandboxTerminal(f,g)]];for(let[f,g,v]of p)m.registerTool(f,{description:g,inputSchema:ih},async({sandboxId:y,reservationKey:_})=>await Oe(async()=>await v(y,_)));m.registerTool("snapshot-sandbox",{description:"Snapshot a sandbox reservation into an image its provider's sandboxes can pin with `snapshot` (sandbox, lambda, daytona, e2b or vercel; lambda builds for a few minutes).",inputSchema:{sandboxId:e().min(1),reservationKey:e().min(1),name:e().min(1)}},async({sandboxId:f,reservationKey:g,name:v})=>await Oe(async()=>await h.snapshotSandbox(f,g,v))),m.registerTool("upload-skill",{description:"Replace one skill's bundle wholesale (PUT, not a merge) by skillName. 'body' is the same source shape create-skill takes.",inputSchema:{id:e().min(1).describe("The skillName."),body:s(e(),c())}},async({id:f,body:g})=>await Oe(async()=>await h.uploadSkill(f,g))),m.registerTool("list-env-vars",{description:"List environment variable names. Values are write-only: the plane never returns them, so there is no read.",inputSchema:{}},async()=>await Oe(async()=>await h.listEnvVars())),m.registerTool("set-env-var",{description:"Create or replace one write-only environment variable. Reference it from a config as ${NAME} rather than inlining the value.",inputSchema:{name:e().min(1),value:e()}},async({name:f,value:g})=>await Oe(async()=>(await h.setEnvVar(f,g),{name:f,stored:!0}))),m.registerTool("delete-env-var",{description:"Delete one environment variable.",inputSchema:{name:e().min(1),confirm:bn}},async({name:f,confirm:g})=>await Oe(async()=>(Rn(g,`Anything referencing \${${f}} breaks the moment this env var goes.`),{deleted:await h.deleteEnvVar(f),name:f}))),m.registerTool("assume-role",{description:"Exchange a role for a short-lived session token (default 1h, max 12h). Hand the returned token to whatever tool needs narrow access, as BROODS_SESSION_TOKEN. It is shown once and is not stored here.",inputSchema:{roleId:e().min(1),ttlSeconds:o().int().positive().max(43200).optional()}},async({roleId:f,ttlSeconds:g})=>await Oe(async()=>await h.assumeRole(f,g===void 0?{}:{ttlSeconds:g}))),m.registerTool("update-account",{description:"Rename this account or change its description. Everything else about an account is derived, not settable.",inputSchema:{username:e().optional(),description:e().nullable().optional()}},async({username:f,description:g})=>await Oe(async()=>await h.updateAccount({...f===void 0?{}:{username:f},...g===void 0?{}:{description:g}}))),m.registerTool("get-account",{description:"The account this server's credential resolves to. Run it first to confirm which tenant you are about to change.",inputSchema:{}},async()=>await Oe(async()=>await h.getAccount()))}function ph(m,h,p,f){let g=e().min(1).describe(`The ${p.key}.`),v=p.scoped?` ${p.plural} live in one stage, so this also takes 'project' and 'stage'.`:"",{list:y,get:_,create:S,update:z,remove:O}=p;if(y){let k=`List every ${p.singular} on the account.${v}`;if(p.scoped)m.registerTool(`list-${p.plural}`,{description:k,inputSchema:Ol},async({project:F,stage:B})=>await Oe(async()=>await y(h,Ml(p,f,F,B))));else m.registerTool(`list-${p.plural}`,{description:k,inputSchema:{}},async()=>await Oe(async()=>await y(h)))}if(_)m.registerTool(`get-${p.singular}`,{description:`Read one ${p.singular} by ${p.key}.`,inputSchema:{id:g}},async({id:k})=>await Oe(async()=>await _(h,k)));if(S){let k=`Create one ${p.singular}. 'body' is the request body the config plane documents.`+(p.createHint?` ${p.createHint}`:"")+v+" Prefer changing the broods/ manifest and deploying for anything the project already declares.",F=s(e(),c());if(p.scoped)m.registerTool(`create-${p.singular}`,{description:k,inputSchema:{body:F,...Ol}},async({body:B,project:T,stage:M})=>await Oe(async()=>await S(h,B,Ml(p,f,T,M))));else m.registerTool(`create-${p.singular}`,{description:k,inputSchema:{body:F}},async({body:B})=>await Oe(async()=>await S(h,B)))}if(z)m.registerTool(`update-${p.singular}`,{description:`Deep-merge a patch into one ${p.singular} and return the updated record, so there is no need to read it back.`+(p.updateHint?` ${p.updateHint}`:""),inputSchema:{id:g,body:s(e(),c())}},async({id:k,body:F})=>await Oe(async()=>await z(h,k,F)));if(O)m.registerTool(`delete-${p.singular}`,{description:`Delete one ${p.singular}. Requires confirm:true, and takes one ${p.key} per call: never loop this over a list.`+(p.deleteHint?` ${p.deleteHint}`:""),inputSchema:{id:g,confirm:bn}},async({id:k,confirm:F})=>await Oe(async()=>(Rn(F,`Deleting ${p.singular} '${k}' goes away for good: name it, get the owner's agreement, then retry.`),{deleted:await O(h,k),id:k})))}export{Wf as createBroodsMcpServer,Yf as serveBroodsMcp};
|