@kya-os/mcp-i
Version:
The TypeScript MCP framework with identity features built-in
7 lines ⢠941 kB
JavaScript
(()=>{var e,t={238:(e,t)=>{"use strict";function r(e,t){return t.rules.some(t=>n(e,t))}function n(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},n){const i=t.RULES.types[n];return i&&!0!==i&&r(e,i)},t.shouldUseGroup=r,t.shouldUseRule=n},314:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RUNTIME_AUDIT_META_KEY=t.RuntimeToolAuditInvocation=void 0,t.resolveRuntimeAuditAssurance=function(e){if(void 0===e)return{enabled:!1,profile:"AAP-0"};const t=e.trail.capabilities;return void 0===t?{enabled:!0,profile:"AAP-0"}:{enabled:!0,profile:t.profile,capabilities:t}},t.createHmacRuntimeAuditContextFactory=function(e){if(0===e.keyId.trim().length)throw new TypeError("Audit reference keyId must be non-empty");const t="string"==typeof e.secret?r.encode(e.secret):new Uint8Array(e.secret);if(t.byteLength<32)throw new TypeError("Audit reference secret must contain at least 32 bytes");const n=e.randomUUID??(()=>crypto.randomUUID());let a;const s=async(e,n)=>{a??=crypto.subtle.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);const i=await crypto.subtle.sign("HMAC",await a,r.encode(`${e}\0${n}`));return`sha256:${function(e){let t="";for(const r of e)t+=r.toString(16).padStart(2,"0");return t}(new Uint8Array(i))}`},c=async(e,t)=>`${e}:${(await s(`org.kya-os.audit.${e}.v1`,t)).slice(7)}`;return{async create(t){const r=t.session,a=i(r,"auditInvocationId")??n(),u=i(r,"auditCorrelationId")??a,d=i(r,"auditCausationId"),l=i(r,"id"),p=i(r,"clientDid")??i(r,"userDid"),[f,h,m,g]=await Promise.all([c("invocation",a),c("correlation",u),void 0===d?void 0:c("causation",d),void 0===l?void 0:s("org.kya-os.audit.session-ref.v1",l)]);return{invocationId:o(f),correlationId:o(h),...void 0===m?{}:{causationId:o(m)},...void 0===g?{}:{session:{ref:{kind:"keyed_commitment",value:g,keyId:o(e.keyId)}}},...p?.startsWith("did:")?{actor:{kind:"public_did",did:p}}:{}}}}},t.beginRuntimeToolAudit=async function(e,t){if(0===e.sourceId.trim().length)throw new TypeError("Audit sourceId must be non-empty");const r=e.trail.configuration?.sourceId;if(void 0!==r&&r!==e.sourceId)throw new TypeError(`Audit sourceId mismatch: runtime expects ${e.sourceId} but trail uses ${r}`);const n=new s(e,t.toolName,await e.context.create(t));return await n.started(),n},t.recordRuntimeConsentAudit=async function(e,t){if(0===e.sourceId.trim().length)throw new TypeError("Audit sourceId must be non-empty");const r=e.trail.configuration?.sourceId;if(void 0!==r&&r!==e.sourceId)throw new TypeError(`Audit sourceId mismatch: runtime expects ${e.sourceId} but trail uses ${r}`);const n=await e.context.create({toolName:t.phase.startsWith("credential_")?`credential.${t.phase.slice(11)}`:`consent.${t.phase}`,args:{},session:{id:t.sessionId,...void 0===t.userDid?{}:{userDid:t.userDid},...void 0===t.correlationId?{}:{auditCorrelationId:t.correlationId},...void 0===t.causationId?{}:{auditCausationId:t.causationId}}});return e.trail.record({eventId:a(n.invocationId,t.phase),eventType:{requested:"consent.requested",approved:"consent.approved",denied:"consent.denied",credential_required:"credential.required",credential_verified:"credential.verified",credential_failed:"credential.failed"}[t.phase],correlationId:o(n.correlationId),...void 0===n.causationId?{}:{causationId:o(n.causationId)},...void 0===n.session?{}:{session:n.session},...void 0===n.actor?{}:{actor:n.actor},...void 0===n.responsibleParty?{}:{responsibleParty:n.responsibleParty},action:{category:"consent"},outcome:t.outcome,...void 0===t.reasonCode?{}:{reason:{code:o(t.reasonCode)}},evidence:[],details:{family:"consent",phase:t.phase,...void 0===t.consentRef?{}:{consentRef:o(t.consentRef)}}})},t.recordRuntimeDelegationAudit=async function(e,t){if(0===e.sourceId.trim().length)throw new TypeError("Audit sourceId must be non-empty");const r=e.trail.configuration?.sourceId;if(void 0!==r&&r!==e.sourceId)throw new TypeError(`Audit sourceId mismatch: runtime expects ${e.sourceId} but trail uses ${r}`);const n=await e.context.create({toolName:`delegation.${t.phase}`,args:{},session:{id:t.sessionId,...void 0===t.userDid?{}:{userDid:t.userDid},...void 0===t.correlationId?{}:{auditCorrelationId:t.correlationId},...void 0===t.causationId?{}:{auditCausationId:t.causationId}}});return e.trail.record({eventId:a(n.invocationId,t.phase),eventType:{issued:"delegation.issued",verified:"delegation.verified",rejected:"delegation.rejected",revoked:"delegation.revoked",cascade_revoked:"delegation.cascade_revoked",outbound_attached:"delegation.outbound_attached"}[t.phase],correlationId:o(n.correlationId),...void 0===n.causationId?{}:{causationId:o(n.causationId)},...void 0===n.session?{}:{session:n.session},...void 0===n.actor?{}:{actor:n.actor},action:{category:"delegation"},outcome:t.outcome,...void 0===t.reasonCode?{}:{reason:{code:o(t.reasonCode)}},evidence:[],details:{family:"delegation",phase:t.phase,delegationRef:o(t.delegationRef),...void 0===t.parentRef?{}:{parentRef:o(t.parentRef)}}})},t.attachRuntimeAuditMetadata=function(e,r,n,i,o=!1){if(!u(e)||Array.isArray(e)){if(o)throw new Error("Required terminal audit delivery failed after tool execution");return e}const a=e,s=u(a._meta)?a._meta:{},d=u(s[t.RUNTIME_AUDIT_META_KEY])?s[t.RUNTIME_AUDIT_META_KEY]:{},l=o||i.some(e=>"failed"===e.status);return a._meta={...s,[t.RUNTIME_AUDIT_META_KEY]:{...d,status:l?"degraded":i.at(-1)?.status??"unknown",sourceId:r,invocationId:n,events:i.map(c),...o?{reason:"AUDIT_TERMINAL_DELIVERY_FAILED"}:{}}},o&&(a.isError=!0),e},t.terminalForToolResult=function(e){if(!u(e))return{phase:"completed",outcome:"succeeded"};const t=u(e.structuredContent)?e.structuredContent:void 0;if("consent_required"===t?.type)return{phase:"challenged",outcome:"challenged",reasonCode:"AUTHORIZATION_REQUIRED"};if(!0!==e.isError)return{phase:"completed",outcome:"succeeded"};const r=u(e._meta)?e._meta:void 0,n="string"==typeof r?.errorType?r.errorType:void 0;return"authorization_required"===n||"oauth_required"===n||u(r?.needs_authorization)?{phase:"challenged",outcome:"challenged",reasonCode:"AUTHORIZATION_REQUIRED"}:{phase:"failed",outcome:"failed",reasonCode:"HANDLER_ERROR_RESULT"}},t.terminalForToolError=function(e){const t=e instanceof Error?e.name:"UnknownError";return"DelegationRequiredError"===t||"OAuthRequiredError"===t||"AuthRequiredError"===t?{phase:"challenged",outcome:"challenged",reasonCode:"AUTHORIZATION_REQUIRED"}:{phase:"failed",outcome:"failed",reasonCode:"HANDLER_THROWN"}};const r=new TextEncoder,n=256;function i(e,t){const r=e?.[t];if("string"!=typeof r)return;const n=r.trim();return 0===n.length?void 0:n}function o(e){return e.slice(0,n)}function a(e,t){const r=`:${t}`;return`${e.slice(0,n-r.length)}${r}`}class s{config;toolName;context;terminalRecorded=!1;startedResult;constructor(e,t,r){this.config=e,this.toolName=t,this.context=r}async started(){const e=await this.config.trail.record({eventId:a(this.context.invocationId,"started"),eventType:"tool.call.started",...this.eventContext(),action:{category:"tool.call",...this.config.includeToolNames?{name:o(this.toolName)}:{}},outcome:"unknown",evidence:[],details:{family:"tool",phase:"started",attempt:this.context.attempt??"1",idempotencyRef:o(this.context.invocationId)}});return this.startedResult=e,e}async terminal(e){if(this.terminalRecorded)throw new Error(`Terminal audit event already recorded for ${this.context.invocationId}`);return this.terminalRecorded=!0,this.config.trail.record({eventId:a(this.context.invocationId,e.phase),eventType:`tool.call.${e.phase}`,...this.eventContext(),action:{category:"tool.call",...this.config.includeToolNames?{name:o(this.toolName)}:{}},outcome:e.outcome,...void 0===e.reasonCode?{}:{reason:{code:o(e.reasonCode)}},evidence:[],details:{family:"tool",phase:e.phase,attempt:this.context.attempt??"1",idempotencyRef:o(this.context.invocationId)}})}results(e){return void 0===this.startedResult?void 0===e?[]:[e]:void 0===e?[this.startedResult]:[this.startedResult,e]}eventContext(){return{correlationId:o(this.context.correlationId),...void 0===this.context.causationId?{}:{causationId:o(this.context.causationId)},...void 0===this.context.session?{}:{session:this.context.session},...void 0===this.context.actor?{}:{actor:this.context.actor},...void 0===this.context.responsibleParty?{}:{responsibleParty:this.context.responsibleParty},...void 0===this.context.authorization?{}:{authorization:this.context.authorization}}}}function c(e){return{eventId:e.event.eventId,eventType:e.event.eventType,status:e.status,...void 0===e.event.source.sourceSequence?{}:{sourceSequence:e.event.source.sourceSequence},..."recorded"!==e.status?{}:{receipt:{ledgerId:e.entry.core.ledgerId,ledgerEpochId:e.entry.core.ledgerEpochId,sequence:e.entry.core.sequence,entryDigest:e.entry.entryDigest}}}}function u(e){return"object"==typeof e&&null!==e}t.RuntimeToolAuditInvocation=s,t.RUNTIME_AUDIT_META_KEY="org.kya-os/audit"},609:e=>{"use strict";const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=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),n=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),i=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function a(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}const s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function c(e){return e.length=0,!0}function u(e,t,r){if(e.length){const n=a(e);if(""===n)return r.error=!0,!1;t.push(n),e.length=0}return!0}function d(e){if(function(e){let t=0;for(let r=0;r<e.length;r++)":"===e[r]&&t++;return t}(e)<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},n=[],i=[];let o=!1,s=!1,d=u;for(let a=0;a<e.length;a++){const u=e[a];if("["!==u&&"]"!==u)if(":"!==u)if("%"===u){if(!d(i,n,r))break;d=c}else i.push(u);else{if(!0===o&&(s=!0),!d(i,n,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(o=!0),n.push(":")}}return i.length&&(d===c?r.zone=i.join(""):s?n.push(i.join("")):n.push(a(i))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}const l={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},p=/[@/?#:]/g,f=/[@/?#]/g;function h(e,t){const r=t?f:p;return r.lastIndex=0,e.replace(r,e=>l[e])}e.exports={nonSimpleDomain:s,recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let n=unescape(e.host);if(!r(n)){const e=d(n);n=!0===e.isIPV6?`[${e.escapedHost}]`:h(n,!1)}t.push(n)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},reescapeHostDelimiters:h,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let o=0;o<e.length;o++){if("%"===e[o]&&o+2<e.length){const a=e.slice(o+1,o+3);if(n(a)){const e=a.toUpperCase(),n=String.fromCharCode(parseInt(e,16));t&&i(n)?r+=n:r+="%"+e,o+=2;continue}}r+=e[o]}return r},normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const o=e.slice(r+1,r+3);if(n(o)){const e=o.toUpperCase(),n=String.fromCharCode(parseInt(e,16));"."!==n&&i(n)?t+=n:t+="%"+e,r+=2;continue}}o(e[r])?t+=e[r]:t+=escape(e[r])}return t},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const i=e.slice(r+1,r+3);if(n(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e;const r=[];let n=-1,i=0;for(;i=t.length;){if(1===i){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===i){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===i&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(n=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:d,stringArrayToHexStripped:a}},689:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeProtectedHeader=function(e){let t;if("string"==typeof e){const r=e.split(".");3!==r.length&&5!==r.length||([t]=r)}else if("object"==typeof e&&e){if(!("protected"in e))throw new TypeError("Token does not contain a Protected Header");t=e.protected}try{if("string"!=typeof t||!t)throw new Error;const e=JSON.parse(i.decoder.decode((0,n.decode)(t)));if(!(0,o.default)(e))throw new Error;return e}catch{throw new TypeError("Invalid Token or Protected Header formatting")}};const n=r(7300),i=r(45935),o=r(71661)},1320:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoOpOAuthConfigCache=t.InMemoryOAuthConfigCache=void 0,t.InMemoryOAuthConfigCache=class{cache=new Map;async get(e){const t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.value:null}async set(e,t,r){if(r<=0)return;const n=Date.now()+r;this.cache.set(e,{value:t,expiresAt:n})}async clear(){this.cache.clear()}async delete(e){this.cache.delete(e)}},t.NoOpOAuthConfigCache=class{async get(e){return null}async set(e,t,r){}async clear(){}async delete(e){}}},3051:e=>{"use strict";e.exports=require("@kya-os/contracts/runtime")},3508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodeBase64=t.decodeBase64=void 0;const n=r(4573),i=r(45935);t.encode=e=>n.Buffer.from(e).toString("base64url"),t.decodeBase64=e=>new Uint8Array(n.Buffer.from(e,"base64")),t.encodeBase64=e=>n.Buffer.from(e).toString("base64"),t.decode=e=>new Uint8Array(n.Buffer.from(function(e){let t=e;return t instanceof Uint8Array&&(t=i.decoder.decode(t)),t}(e),"base64url"))},3826:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const n=r(38994),i=r(67218);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:o,schemaPath:a,errSchemaPath:s,topSchemaRef:c}){if(void 0!==t&&void 0!==o)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const o=e.schema[t];return void 0===r?{schema:o,schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[r],schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}${(0,n.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(r)}`}}if(void 0!==o){if(void 0===a||void 0===s||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:a,topSchemaRef:c,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:o,data:a,dataTypes:s,propertyName:c}){if(void 0!==a&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=t;if(void 0!==r){const{errorPath:a,dataPathArr:s,opts:c}=t;d(u.let("data",n._`${t.data}${(0,n.getProperty)(r)}`,!0)),e.errorPath=n.str`${a}${(0,i.getErrorPath)(r,o,c.jsPropertySyntax)}`,e.parentDataProperty=n._`${r}`,e.dataPathArr=[...s,e.parentDataProperty]}function d(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==a&&(d(a instanceof n.Name?a:u.let("data",a,!0)),void 0!==c&&(e.propertyName=c)),s&&(e.dataTypes=s)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){void 0!==n&&(e.compositeRule=n),void 0!==i&&(e.createErrors=i),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}},3842:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityProvider=t.NonceCacheProvider=t.StorageProvider=t.FetchProvider=t.ClockProvider=t.CryptoProvider=void 0,t.CryptoProvider=class{},t.ClockProvider=class{},t.FetchProvider=class{},t.StorageProvider=class{},t.NonceCacheProvider=class{},t.IdentityProvider=class{}},4220:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(89008);class i extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,n.resolveUrl)(e,t,r),this.missingSchema=(0,n.normalizeId)((0,n.getFullPath)(e,this.missingRef))}}t.default=i},4268:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598);let i;t.default=e=>(i||=new Set((0,n.getCiphers)()),i.has(e))},4283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cryptoRuntime=t.base64url=t.generateSecret=t.generateKeyPair=t.errors=t.decodeJwt=t.decodeProtectedHeader=t.importJWK=t.importX509=t.importPKCS8=t.importSPKI=t.exportJWK=t.exportSPKI=t.exportPKCS8=t.UnsecuredJWT=t.experimental_jwksCache=t.jwksCache=t.createRemoteJWKSet=t.createLocalJWKSet=t.EmbeddedJWK=t.calculateJwkThumbprintUri=t.calculateJwkThumbprint=t.EncryptJWT=t.SignJWT=t.GeneralSign=t.FlattenedSign=t.CompactSign=t.FlattenedEncrypt=t.CompactEncrypt=t.jwtDecrypt=t.jwtVerify=t.generalVerify=t.flattenedVerify=t.compactVerify=t.GeneralEncrypt=t.generalDecrypt=t.flattenedDecrypt=t.compactDecrypt=void 0;var n=r(58621);Object.defineProperty(t,"compactDecrypt",{enumerable:!0,get:function(){return n.compactDecrypt}});var i=r(70331);Object.defineProperty(t,"flattenedDecrypt",{enumerable:!0,get:function(){return i.flattenedDecrypt}});var o=r(54992);Object.defineProperty(t,"generalDecrypt",{enumerable:!0,get:function(){return o.generalDecrypt}});var a=r(74372);Object.defineProperty(t,"GeneralEncrypt",{enumerable:!0,get:function(){return a.GeneralEncrypt}});var s=r(39409);Object.defineProperty(t,"compactVerify",{enumerable:!0,get:function(){return s.compactVerify}});var c=r(55403);Object.defineProperty(t,"flattenedVerify",{enumerable:!0,get:function(){return c.flattenedVerify}});var u=r(14186);Object.defineProperty(t,"generalVerify",{enumerable:!0,get:function(){return u.generalVerify}});var d=r(12556);Object.defineProperty(t,"jwtVerify",{enumerable:!0,get:function(){return d.jwtVerify}});var l=r(60808);Object.defineProperty(t,"jwtDecrypt",{enumerable:!0,get:function(){return l.jwtDecrypt}});var p=r(30005);Object.defineProperty(t,"CompactEncrypt",{enumerable:!0,get:function(){return p.CompactEncrypt}});var f=r(92599);Object.defineProperty(t,"FlattenedEncrypt",{enumerable:!0,get:function(){return f.FlattenedEncrypt}});var h=r(15497);Object.defineProperty(t,"CompactSign",{enumerable:!0,get:function(){return h.CompactSign}});var m=r(30131);Object.defineProperty(t,"FlattenedSign",{enumerable:!0,get:function(){return m.FlattenedSign}});var g=r(61494);Object.defineProperty(t,"GeneralSign",{enumerable:!0,get:function(){return g.GeneralSign}});var v=r(71016);Object.defineProperty(t,"SignJWT",{enumerable:!0,get:function(){return v.SignJWT}});var y=r(31276);Object.defineProperty(t,"EncryptJWT",{enumerable:!0,get:function(){return y.EncryptJWT}});var _=r(33645);Object.defineProperty(t,"calculateJwkThumbprint",{enumerable:!0,get:function(){return _.calculateJwkThumbprint}}),Object.defineProperty(t,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return _.calculateJwkThumbprintUri}});var b=r(88660);Object.defineProperty(t,"EmbeddedJWK",{enumerable:!0,get:function(){return b.EmbeddedJWK}});var w=r(22562);Object.defineProperty(t,"createLocalJWKSet",{enumerable:!0,get:function(){return w.createLocalJWKSet}});var $=r(84559);Object.defineProperty(t,"createRemoteJWKSet",{enumerable:!0,get:function(){return $.createRemoteJWKSet}}),Object.defineProperty(t,"jwksCache",{enumerable:!0,get:function(){return $.jwksCache}}),Object.defineProperty(t,"experimental_jwksCache",{enumerable:!0,get:function(){return $.experimental_jwksCache}});var k=r(58459);Object.defineProperty(t,"UnsecuredJWT",{enumerable:!0,get:function(){return k.UnsecuredJWT}});var S=r(72545);Object.defineProperty(t,"exportPKCS8",{enumerable:!0,get:function(){return S.exportPKCS8}}),Object.defineProperty(t,"exportSPKI",{enumerable:!0,get:function(){return S.exportSPKI}}),Object.defineProperty(t,"exportJWK",{enumerable:!0,get:function(){return S.exportJWK}});var I=r(68846);Object.defineProperty(t,"importSPKI",{enumerable:!0,get:function(){return I.importSPKI}}),Object.defineProperty(t,"importPKCS8",{enumerable:!0,get:function(){return I.importPKCS8}}),Object.defineProperty(t,"importX509",{enumerable:!0,get:function(){return I.importX509}}),Object.defineProperty(t,"importJWK",{enumerable:!0,get:function(){return I.importJWK}});var P=r(689);Object.defineProperty(t,"decodeProtectedHeader",{enumerable:!0,get:function(){return P.decodeProtectedHeader}});var E=r(74218);Object.defineProperty(t,"decodeJwt",{enumerable:!0,get:function(){return E.decodeJwt}}),t.errors=r(39069);var x=r(14339);Object.defineProperty(t,"generateKeyPair",{enumerable:!0,get:function(){return x.generateKeyPair}});var O=r(88915);Object.defineProperty(t,"generateSecret",{enumerable:!0,get:function(){return O.generateSecret}}),t.base64url=r(7300);var T=r(55116);Object.defineProperty(t,"cryptoRuntime",{enumerable:!0,get:function(){return T.default}})},4319:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractCanonicalData=t.createProofResponse=t.ProofGenerator=void 0;var n=r(18554);Object.defineProperty(t,"ProofGenerator",{enumerable:!0,get:function(){return n.ProofGenerator}}),Object.defineProperty(t,"createProofResponse",{enumerable:!0,get:function(){return n.createProofResponse}}),Object.defineProperty(t,"extractCanonicalData",{enumerable:!0,get:function(){return n.extractCanonicalData}})},4573:e=>{"use strict";e.exports=require("node:buffer")},5153:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o=r(24954),a=r(30714),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,(0,i.alwaysValidSchema)(n,t)||(s?(0,a.validateAdditionalItems)(e,s):e.ok((0,o.validateArray)(e)))}};t.default=s},5368:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>n._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:r,parentSchema:o,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(a.opts.discriminator&&o.discriminator)return;const s=r,c=t.let("valid",!1),u=t.let("passing",null),d=t.name("_valid");e.setParams({passing:u}),t.block(function(){s.forEach((r,o)=>{let s;(0,i.alwaysValidSchema)(a,r)?t.var(d,!0):s=e.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},d),o>0&&t.if(n._`${d} && ${c}`).assign(c,!1).assign(u,n._`[${u}, ${o}]`).else(),t.if(d,()=>{t.assign(c,!0),t.assign(u,o),s&&e.mergeEvaluated(s,n.Name)})})}),e.result(c,()=>e.reset(),()=>e.error(!0))}};t.default=o},5727:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BatchDelegationService=void 0,t.BatchDelegationService=class{providerResolver;toolProtectionService;constructor(e,t){this.providerResolver=e,this.toolProtectionService=t}async groupToolsByProvider(e,t,r){const n=new Map;for(const i of e){const e=await this.toolProtectionService.checkToolProtection(i,r);if(!e?.requiresDelegation)continue;let o;try{o=await this.providerResolver.resolveProvider(e,t)}catch(e){console.warn(`[BatchDelegation] Could not resolve provider for tool "${i}", skipping`,e instanceof Error?e.message:String(e));continue}n.has(o)||n.set(o,{provider:o,tools:[],scopes:[],riskLevel:"medium"});const a=n.get(o);a.tools.push(i);const s=new Set([...a.scopes,...e.requiredScopes||[]]);if(a.scopes=Array.from(s),e.riskLevel){const t={low:1,medium:2,high:3,critical:4},r=t[a.riskLevel]||1;(t[e.riskLevel]||1)>r&&(a.riskLevel="critical"===e.riskLevel?"high":e.riskLevel)}}return n}async getToolsForProvider(e,t,r){return[]}}},5888:(e,t)=>{"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(o,a),time:r(c(!0),u),"date-time":r(p(!0),f),"iso-time":r(c(),d),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&g.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return v.lastIndex=0,v.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=y}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":r(/^\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,f),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":r(/^\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,h),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},t.formatNames=Object.keys(t.fullFormats);const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(e){const t=n.exec(e);if(!t)return!1;const r=+t[1],o=+t[2],a=+t[3];return o>=1&&o<=12&&a>=1&&a<=(2===o&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(r)?29:i[o])}function a(e,t){if(e&&t)return e>t?1:e<t?-1:0}const s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){const r=s.exec(t);if(!r)return!1;const n=+r[1],i=+r[2],o=+r[3],a=r[4],c="-"===r[5]?-1:1,u=+(r[6]||0),d=+(r[7]||0);if(u>23||d>59||e&&!a)return!1;if(n<=23&&i<=59&&o<60)return!0;const l=i-d*c,p=n-u*c-(l<0?1:0);return(23===p||-1===p)&&(59===l||-1===l)&&o<61}}function u(e,t){if(!e||!t)return;const r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();return r&&n?r-n:void 0}function d(e,t){if(!e||!t)return;const r=s.exec(e),n=s.exec(t);return r&&n?(e=r[1]+r[2]+r[3])>(t=n[1]+n[2]+n[3])?1:e<t?-1:0:void 0}const l=/t|\s/i;function p(e){const t=c(e);return function(e){const r=e.split(l);return 2===r.length&&o(r[0])&&t(r[1])}}function f(e,t){if(!e||!t)return;const r=new Date(e).valueOf(),n=new Date(t).valueOf();return r&&n?r-n:void 0}function h(e,t){if(!e||!t)return;const[r,n]=e.split(l),[i,o]=t.split(l),s=a(r,i);return void 0!==s?s||u(n,o):void 0}const m=/\/|:/,g=/^(?:[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,v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,y=-(2**31),_=2**31-1;function b(){return!0}const w=/[^\\]\\Z/},6013:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(67371);n.code='require("ajv/dist/runtime/equal").default',t.default=n},6093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wrap=async function(e,t,r,i){const a=e.slice(0,7),s=await(0,n.default)(a,r,t,i,new Uint8Array(0));return{encryptedKey:s.ciphertext,iv:(0,o.encode)(s.iv),tag:(0,o.encode)(s.tag)}},t.unwrap=async function(e,t,r,n,o){const a=e.slice(0,7);return(0,i.default)(a,t,r,n,o,new Uint8Array(0))};const n=r(19265),i=r(44089),o=r(3508)},6247:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=void 0;const n=r(3508);t.encode=n.encode,t.decode=n.decode},7318:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryStatusListStorage=void 0,t.MemoryStatusListStorage=class{statusLists=new Map;indexCounters=new Map;async getStatusList(e){return this.statusLists.get(e)||null}async setStatusList(e,t){this.statusLists.set(e,t)}async allocateIndex(e){const t=this.indexCounters.get(e)||0,r=t;return this.indexCounters.set(e,t+1),r}getIndexCount(e){return this.indexCounters.get(e)||0}clear(){this.statusLists.clear(),this.indexCounters.clear()}getAllStatusListIds(){return Array.from(this.statusLists.keys())}}},7456:e=>{"use strict";e.exports=JSON.parse('{"$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":true,"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":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"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":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"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":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"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":true}')},7661:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolContextBuilder=void 0;const n=r(38926),i=r(44645),o=r(73214);t.ToolContextBuilder=class{config;constructor(e){this.config={tokenResolver:e.tokenResolver,configService:e.configService,providerResolver:e.providerResolver,projectId:e.projectId,logger:e.logger||(()=>{})}}async buildContext(e,t,r,a,s,c){if(!s?.requiredScopes?.length||!t)return;let u;try{u=await this.resolveProvider(s)}catch(r){if(r instanceof i.ConsentOnlyModeError||r instanceof i.CredentialAuthModeError)throw this.config.logger("[ToolContextBuilder] Special auth mode detected, re-throwing",{toolName:e,errorType:r.name,message:r.message}),r;return void this.config.logger("[ToolContextBuilder] Provider not resolved",{toolName:e,userDid:t.substring(0,20)+"...",error:r instanceof Error?r.message:String(r)})}const d=await this.config.tokenResolver.resolveTokenDataFromDid(t,u,s.requiredScopes);if(!d){const i=s.authorization?.type??"oauth2";if(a&&(0,o.authTypeSatisfies)(c,i))return this.config.logger("[ToolContextBuilder] IDP token not found, but delegation exists - returning minimal context",{toolName:e,userDid:t.substring(0,20)+"...",provider:u,scopes:s.requiredScopes,note:"Tool can execute with delegation-only authorization"}),{provider:u,scopes:s.requiredScopes,userDid:t,sessionId:r,delegationToken:a};throw a&&(this.config.logger("[ToolContextBuilder] Delegation present but auth-type does not satisfy tool requirement - re-challenging",{toolName:e,userDid:t.substring(0,20)+"...",provider:u,requiredAuthType:i,delegationAuthorizationType:c??null}),(0,o.isUnsatisfiableAuthType)(i)&&this.config.logger("[ToolContextBuilder] MISCONFIGURATION: tool requires an authorization type no delegation mint can produce - this tool will re-challenge forever",{toolName:e,requiredAuthType:i,mintableAuthTypes:[...o.MINTABLE_AUTH_TYPES],hint:"Set the tool's authorization.type to one of the mintable types, or add mint support for the required type."})),this.config.logger("[ToolContextBuilder] Token not available, throwing OAuthRequiredError",{toolName:e,userDid:t.substring(0,20)+"...",provider:u,scopes:s.requiredScopes}),new n.OAuthRequiredError({toolName:e,requiredScopes:s.requiredScopes,provider:u,oauthUrl:"",userDid:t,sessionId:r})}const l=this.buildAuthHeaders(d),p={idpToken:d.access_token,idpHeaders:l,provider:u,scopes:s.requiredScopes,userDid:t,sessionId:r,delegationToken:a,userId:d.userId};return this.config.logger("[ToolContextBuilder] Context built successfully",{toolName:e,userDid:t.substring(0,20)+"...",provider:u,hasToken:!!d.access_token,hasUserId:!!d.userId,tokenUsage:d.tokenUsage,headerKeys:Object.keys(l)}),p}buildAuthHeaders(e){const t={},r=e.tokenUsage||"bearer",n=e.access_token;switch(r){case"cookie":e.cookieFormat?t.Cookie=e.cookieFormat.replace(/\{\{token\}\}/g,n):t.Cookie=n;break;case"bearer":default:t.Authorization=`Bearer ${n}`;break;case"header":t[e.tokenHeader||"X-Session-Token"]=n}return e.apiHeaders&&Object.assign(t,e.apiHeaders),t}async resolveProvider(e){try{const t=await this.config.providerResolver.resolveProvider(e,this.config.projectId);return this.config.logger("[ToolContextBuilder] Provider resolved",{provider:t}),t}catch(e){throw this.config.logger("[ToolContextBuilder] Provider resolution failed",{error:e instanceof Error?e.message:String(e),projectId:this.config.projectId}),e}}}},7918:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(57975),i=r(77598),o=r(84641),a=r(45935),s=r(3508),c=r(72425),u=r(78195),d=r(99135),l=r(60322),p=r(29994),f=r(71759),h=r(58242),m=(0,n.promisify)(i.pbkdf2);function g(e,t){if((0,p.default)(e))return e.export();if(e instanceof Uint8Array)return e;if((0,d.isCryptoKey)(e))return(0,l.checkEncCryptoKey)(e,t,"deriveBits","deriveKey"),i.KeyObject.from(e).export();throw new TypeError((0,f.default)(e,...h.types,"Uint8Array"))}t.encrypt=async(e,t,r,n=2048,i=(0,o.default)(new Uint8Array(16)))=>{(0,u.default)(i);const d=(0,a.p2s)(e,i),l=parseInt(e.slice(13,16),10)>>3,p=g(t,e),f=await m(p,d,n,l,`sha${e.slice(8,11)}`);return{encryptedKey:await(0,c.wrap)(e.slice(-6),f,r),p2c:n,p2s:(0,s.encode)(i)}},t.decrypt=async(e,t,r,n,i)=>{(0,u.default)(i);const o=(0,a.p2s)(e,i),s=parseInt(e.slice(13,16),10)>>3,d=g(t,e),l=await m(d,o,n,s,`sha${e.slice(8,11)}`);return(0,c.unwrap)(e.slice(-6),l,r)}},7980:(e,t,r)=>{"use strict";const{normalizeIPv6:n,removeDotSegments:i,recomposeAuthority:o,normalizePercentEncoding:a,normalizePathEncoding:s,escapePreservingEscapes:c,reescapeHostDelimiters:u,isIPv4:d,nonSimpleDomain:l}=r(609),{SCHEMES:p,getSchemeHandler:f}=r(84848);function h(e,t,r,n){const o={};return n||(e=b(m(e,r),r),t=b(m(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=i(t.path||""),o.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=i(t.path||""),o.query=t.query):(t.path?("/"===t.path[0]?o.path=i(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path:o.path="/"+t.path,o.path=i(o.path)),o.query=t.query):(o.path=e.path,void 0!==t.query?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function m(e,t){const r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),s=[],u=f(n.scheme||r.scheme);u&&u.serialize&&u.serialize(r,n),void 0!==r.path&&(n.skipEscape?r.path=a(r.path):(r.path=c(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==n.reference&&r.scheme&&s.push(r.scheme,":");const d=o(r);if(void 0!==d&&("suffix"!==n.reference&&s.push("//"),s.push(d),r.path&&"/"!==r.path[0]&&s.push("/")),void 0!==r.path){let e=r.path;n.absolutePath||u&&u.absolutePath||(e=i(e)),void 0===d&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),s.push(e)}return void 0!==r.query&&s.push("?",r.query),void 0!==r.fragment&&s.push("#",r.fragment),s.join("")}const g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,v=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,y=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function _(e,t){const r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let o=!1,a=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);const c=e.match(v);null!==c&&-1!==c[1].indexOf("\\")&&(i.error="URI authority must not contain a literal backslash.",o=!0);const p=e.match(y);if(null!==p){const e=p[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(i.error=i.error||"URI authority must not contain a literal backslash.",o=!0):e.length!==t.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",o=!0))}const h=e.match(g);if(h){i.scheme=h[1],i.userinfo=h[3],i.host=h[4],i.port=parseInt(h[5],10),i.path=h[6]||"",i.query=h[7],i.fragment=h[8],isNaN(i.port)&&(i.port=h[5]);const t=function(e,t){return void 0!==t[2]&&e.path&&"/"!==e.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof e.port&&(e.port<0||e.port>65535)?"URI port is malformed.":void 0}(i,h);if(void 0!==t&&(i.error=i.error||t,o=!0),i.host)if(!1===d(i.host)){const e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");const c=f(r.scheme||i.scheme);if(!(r.unicodeSupport||c&&c.unicodeSupport)&&i.host&&(r.domainHost||c&&c.domainHost)&&!1===a&&l(i.host))try{i.host=new URL("http://"+i.host).hostname}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}if((!c||c&&!c.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=u(unescape(i.host),a))),i.path&&(i.path=s(i.path)),i.fragment))try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}c&&c.parse&&c.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:o}}function b(e,t){return _(e,t).parsed}function w(e,t){const{parsed:r,malformedAuthorityOrPort:n}=_(e,t);return{normalized:n?e:m(r,t),malformedAuthorityOrPort:n}}function $(e,t){if("string"==typeof e){const{normalized:r,malformedAuthorityOrPort:n}=w(e,t);return n?void 0:r}if("object"==typeof e)return m(e,t)}const k={SCHEMES:p,normalize:function(e,t){return"string"==typeof e?e=function(e,t){return w(e,t).normalized}(e,t):"object"==typeof e&&(e=b(m(e,t),t)),e},resolve:function(e,t,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:o}=_(e,n),{parsed:a,malformedAuthorityOrPort:s}=_(t,n);if(o||s)throw new Error(i.error||a.error||"URI is malformed.");const c=h(i,a,n,!0);return n.skipEscape=!0,m(c,n)},resolveComponent:h,equal:function(e,t,r){const n=$(e,r),i=$(t,r);return void 0!==n&&void 0!==i&&n.toLowerCase()===i.toLowerCase()},serialize:m,parse:b};e.exports=k,e.exports.default=k,e.exports.fastUri=k},8102:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>n.str`must match "${e.ifClause}" schema`,params:({params:e})=>n._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:r,it:o}=e;void 0===r.then&&void 0===r.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const s=a(o,"then"),c=a(o,"else");if(!s&&!c)return;const u=t.let("valid",!0),d=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);e.mergeEvaluated(t)}(),e.reset(),s&&c){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(d,l("then",r),l("else",r))}else s?t.if(d,l("then")):t.if((0,n.not)(d),l("else"));function l(r,i){return()=>{const o=e.subschema({keyword:r},d);t.assign(u,d),e.mergeValidEvaluated(o,u),i?t.assign(i,n._`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}};function a(e,t){const r=e.schema[t];return void 0!==r&&!(0,i.alwaysValidSchema)(e,r)}t.default=o},8956:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default="node:crypto"},9066:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){let r,c,u,d;if(t instanceof n.KeyObject)r=t.asymmetricKeyType,c=t.asymmetricKeyDetails;else switch(u=!0,t.kty){case"RSA":r="rsa";break;case"EC":r="ec";break;case"OKP":if("Ed25519"===t.crv){r="ed25519";break}if("Ed448"===t.crv){r="ed448";break}throw new TypeError("Invalid key for this operation, its crv must be Ed25519 or Ed448");default:throw new TypeError("Invalid key for this operation, its kty must be RSA, OKP, or EC")}switch(e){case"Ed25519":if("ed25519"!==r)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519");break;case"EdDSA":if(!["ed25519","ed448"].includes(r))throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");break;case"RS256":case"RS384":case"RS512":if("rsa"!==r)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,a.default)(t,e);break;case"PS256":case"PS384":case"PS512":if("rsa-pss"===r){const{hashAlgorithm:t,mgf1HashAlgorithm:r,saltLength:n}=c,i=parseInt(e.slice(-3),10);if(void 0!==t&&(t!==`sha${i}`||r!==t))throw new TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(void 0!==n&&n>i>>3)throw new TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if("rsa"!==r)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");(0,a.default)(t,e),d={padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST};break;case"ES256":case"ES256K":case"ES384":case"ES512":{if("ec"!==r)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");const n=(0,i.default)(t),o=s.get(e);if(n!==o)throw new TypeError(`Invalid key curve for the algorithm, its curve must be ${o}, got ${n}`);d={dsaEncoding:"ieee-p1363"};break}default:throw new o.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}return u?{format:"jwk",key:t,...d}:d?{...d,key:t}:t};const n=r(77598),i=r(90862),o=r(39069),a=r(68423),s=new Map([["ES256","P-256"],["ES256K","secp256k1"],["ES384","P-384"],["ES512","P-521"]])},9443:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoService=void 0;const n=r(56497);t.CryptoService=class{cryptoProvider;constructor(e){this.cryptoProvider=e}async verifyEd25519(e,t,r){try{return!0===await this.cryptoProvider.verify(e,t,r)}catch(e){return console.error("[CryptoService] Ed25519 verification error:",e),!1}}parseJWS(e){const t=e.split(".");if(3!==t.length)throw new Error("Invalid JWS format: expected header.payload.signature");const[r,i,o]=t;let a,s,c;try{a=JSON.parse((0,n.base64urlDecodeToString)(r))}catch(e){throw new Error(`Invalid header base64: ${e instanceof Error?e.message:String(e)}`)}if(i)try{s=JSON.parse((0,n.base64urlDecodeToString)(i))}catch(e){throw new Error(`Invalid payload base64: ${e instanceof Error?e.message:String(e)}`)}try{c=(0,n.base64urlDecodeToBytes)(o)}catch(e){throw new Error(`Invalid signature base64: ${e instanceof Error?e.message:String(e)}`)}return{header:a,payload:s,signatureBytes:c,signingInput:`${r}.${i}`}}async verifyJWS(e,t,r){try{if(!this.isValidEd25519JWK(t))return console.error("[CryptoService] Invalid Ed25519 JWK format"),!1;if(r?.expectedKid&&t.kid!==r.expectedKid)return console.error("[CryptoService] Key ID mismatch"),!1;let i;try{i=this.parseJWS(e)}catch(t){if(void 0===r?.detachedPayload)return console.error("[CryptoService] Invalid JWS format:",t),!1;{const r=e.split(".");if(3!==r.length||""!==r[1])return console.error("[CryptoService] Invalid JWS format:",t),!1;try{const e=r[0],t=r[2];i={header:JSON.parse((0,n.base64urlDecodeToString)(e)),payload:void 0,signatureBytes:(0,n.base64urlDecodeToBytes)(t),signingInput:""}}catch{return console.error("[CryptoService] Invalid detached JWS format"),!1}}}const o=r?.alg||"EdDSA";if(i.header.alg!==o)return console.error(`[CryptoService] Unsupported algorithm: ${i.header.alg}, expected ${o}`),!1;let a,s,c;if(void 0!==r?.detachedPayload){const t=e.split(".")[0];let i;i=r.detachedPayload instanceof Uint8Array?(0,n.base64urlEncodeFromBytes)(r.detachedPayload):(0,n.base64urlEncodeFromBytes)((new TextEncoder).encode(r.detachedPayload)),a=`${t}.${i}`,s=(new TextEncoder).encode(a)}else{if(!i.signingInput)return console.error("[CryptoService] Missing signing input for compact JWS"),!1;a=i.signingInput,s=(new TextEncoder).encode(a)}try{c=this.jwkToBase64PublicKey(t)}catch(e){return console.error("[CryptoService] Failed to extract public key:",e),!1}return await this.verifyEd25519(s,i.signatureBytes,c)}catch(e){return console.error("[CryptoService] JWS verification error:",e),!1}}isValidEd25519JWK(e){return"object"==typeof e&&null!==e&&"kty"in e&&"OKP"===e.kty&&"crv"in e&&"Ed25519"===e.crv&&"x"in e&&"string"==typeof e.x&&e.x.length>0}jwkToBase64PublicKey(e){const t=(0,n.base64urlDecodeToBytes)(e.x);if(32!==t.length)throw new Error(`Invalid Ed25519 public key length: ${t.length}`);return(0,n.bytesToBase64)(t)}}},10114:e=>{"use strict";e.exports=JSON.parse('{"$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":false}')},10985:(e,t,r)=>{"use strict";r.d(t,{S:()=>i});var n="$";function i(e,t){var r="",i=t&&t.include,o=t&&t.exclude;o&&"string"==typeof o&&(o=[o]),i&&i.sort();var a=new WeakMap,s=t&&t.allowCircular,c=t&&t.filterUndefined,u=t&&t.undefinedInArrayToNull;return function e(t,d){if(null===t||"object"!=typeof t||null!=t.toJSON)r+=JSON.stringify(t);else if(Array.isArray(t)){if(void 0!==(p=a.get(t))&&d.startsWith(p)){if(!s)throw new Error("Circular reference detected");return void(r+='"[Circular:'+p+']"')}a.set(t,d),r+="[";var l=!1;t.forEach(function(t,n){l&&(r+=","),l=!0,u&&void 0===t&&(t=null),e(t,d+"["+n+"]")}),r+="]"}else{var p;if(void 0!==(p=a.get(t))&&d.startsWith(p)){if(!s)throw new Error("Circular reference detected");return void(r+='"[Circular:'+p+']"')}a.set(t,d),r+="{";var f=!1,h=function(n){o&&o.includes(n)||(f&&(r+=","),f=!0,r+=JSON.stringify(n),r+=":",e(t[n],d+"."+n))};if(d===n&&i)i.forEach(function(e){t.hasOwnProperty(e)&&h(e)});else{var m=Object.keys(t);c&&(m=m.filter(function(e){return void 0!==t[e]})),m.sort(),m.forEach(function(e){h(e)})}r+="}"}}(e,n),r}},11458:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OAuthConfigService=void 0;const n=r(1320);function i(e){if(!e||"object"!=typeof e)return;const t=e;return{clientSecretName:t.clientSecretName??t.client_secret_name,clientIdSecretName:t.clientIdSecretName??t.client_id_secret_name,apiKeySecretName:t.apiKeySecretName??t.api_key_secret_name,clientSecretVersion:t.clientSecretVersion??t.client_secret_version}}t.OAuthConfigService=class{config;constructor(e){this.config={baseUrl:e.baseUrl,apiKey:e.apiKey,fetchProvider:e.fetchProvider,cacheTtl:e.cacheTtl??3e5,logger:e.logger||(()=>{}),cache:e.cache||new n.InMemoryOAuthConfigCache}}async getOAuthConfig(e){const t=await this.config.cache.get(e);if(t)return this.config.logger("[OAuthConfigService] Cache hit",{projectId:e}),t;const r=`${this.config.baseUrl}/api/v1/bouncer/projects/${encodeURIComponent(e)}/providers`;this.config.logger("[OAuthConfigService] Fetching config from API",{projectId:e,url:r});try{const t=await this.config.fetchProvider.fetch(r,{method:"GET",headers:{Authorization:`Bearer ${this.config.apiKey}`,"Content-Type":"application/json"}});if(!t.ok){const e=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch OAuth config: ${t.status} ${t.statusText} - ${e}`)}const n=await t.json();if(!n.success||!n.data)throw new Error("Invalid API response: missing success or data field");const o=n.data.providers||{};if("object"!=typeof o||Array.isArray(o))throw new Error("Invalid API response: providers must be an object, not an array");const a={};for(const[e,t]of Object.entries(o)){const r=t;a[e]={clientId:r.clientId??r.client_id??"",clientSecret:r.clientSecret??r.client_secret??null,authorizationUrl:r.authorizationUrl??r.authorization_url??"",tokenUrl:r.tokenUrl??r.token_url??"",userInfoUrl:r.userInfoUrl??r.user_info_url,supportsPKCE:r.supportsPKCE??r.supports_pkce??!1,requiresClientSecret:r.requiresClientSecret??r.requires_client_secret??!0,scopes:r.scopes??[],defaultScopes:r.defaultScopes??r.default_scopes,proxyMode:r.proxyMode??r.proxy_mode??!1,customParams:r.customParams??r.custom_params,tokenEndpointAuthMethod:r.tokenEndpointAuthMethod??r.token_endpoint_auth_method,responseType:r.responseType??r.response_type,grantType:r.grantType??r.grant_type,metadata:i(r.metadata)}}const s=n.data.configuredProvider??n.data.configured_provider??null,c={providers:a,configuredProvider:s};return await this.config.cache.set(e,c,this.config.cacheTtl),this.config.logger("[OAuthConfigService] Config fetched and cached",{projectId:e,providerCount:Object.keys(a).length,providers:Object.keys(a),configuredProvider:s,expiresAt:new Date(Date.now()+this.config.cacheTtl).toISOString()}),c}catch(t){throw this.config.logger("[OAuthConfigService] API fetch failed",{projectId:e,error:t instanceof Error?t.message:String(t)}),t}}async clearCache(e){await this.config.cache.delete(e),this.config.logger("[OAuthConfigService] Cache cleared",{projectId:e})}async clearAllCache(){await this.config.cache.clear(),this.config.logger("[OAuthConfigService] All cache cleared")}}},11858:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(26419),i=r(38994),o=r(67218),a=r(6013),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:r,$data:s,schema:c,parentSchema:u,schemaCode:d,it:l}=e;if(!s&&!c)return;const p=t.let("valid"),f=u.items?(0,n.getSchemaTypes)(u.items):[];function h(o,a){const s=t.name("item"),c=(0,n.checkDataTypes)(f,s,l.opts.strictNumbers,n.DataType.Wrong),u=t.const("indices",i._`{}`);t.for(i._`;${o}--;`,()=>{t.let(s,i._`${r}[${o}]`),t.if(c,i._`continue`),f.length>1&&t.if(i._`typeof ${s} == "string"`,i._`${s} += "_"`),t.if(i._`typeof ${u}[${s}] == "number"`,()=>{t.assign(a,i._`${u}[${s}]`),e.error(),t.assign(p,!1).break()}).code(i._`${u}[${s}] = ${o}`)})}function m(n,s){const c=(0,o.useFunc)(t,a.default),u=t.name("outer");t.label(u).for(i._`;${n}--;`,()=>t.for(i._`${s} = ${n}; ${s}--;`,()=>t.if(i._`${c}(${r}[${n}], ${r}[${s}])`,()=>{e.error(),t.assign(p,!1).break(u)})))}e.block$data(p,function(){const n=t.let("i",i._`${r}.length`),o=t.let("j");e.setParams({i:n,j:o}),t.assign(p,!0),t.if(i._`${n} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?h:m)(n,o))},i._`${d} === false`),e.ok(p)}};t.default=s},12003:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(67218),i={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach((t,r)=>{if((0,n.alwaysValidSchema)(i,t))return;const a=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(a)})}};t.default=i},12189:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:i}=e,o="maxProperties"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`Object.keys(${r}).length ${o} ${i}`)}};t.default=i},12500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toNeedsAuthorization=function(e,t){return(0,n.createNeedsAuthorizationError)({message:`Authorization required for tool "${e.toolName}".`,authorizationUrl:e.consentUrl??"",resumeToken:e.resumeToken??"",expiresAt:t,scopes:e.requiredScopes})};const n=r(3051)},12556:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.jwtVerify=async function(e,t,r){const a=await(0,n.compactVerify)(e,t,r);if(a.protectedHeader.crit?.includes("b64")&&!1===a.protectedHeader.b64)throw new o.JWTInvalid("JWTs MUST NOT use unencoded payload");const s={payload:(0,i.default)(a.protectedHeader,a.payload,r),protectedHeader:a.protectedHeader};return"function"==typeof t?{...s,key:a.key}:s};const n=r(39409),i=r(52691),o=r(39069)},12930:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(37067),i=r(44708),o=r(78474),a=r(39069),s=r(45935);t.default=async(e,t,r)=>{let c;switch(e.protocol){case"https:":c=i.get;break;case"http:":c=n.get;break;default:throw new TypeError("Unsupported URL protocol.")}const{agent:u,headers:d}=r,l=c(e.href,{agent:u,timeout:t,headers:d}),[p]=await Promise.race([(0,o.once)(l,"response"),(0,o.once)(l,"timeout")]);if(!p)throw l.destroy(),new a.JWKSTimeout;if(200!==p.statusCode)throw new a.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");const f=[];for await(const e of p)f.push(e);try{return JSON.parse(s.decoder.decode((0,s.concat)(...f)))}catch{throw new a.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}}},14186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generalVerify=async function(e,t,r){if(!(0,o.default)(e))throw new i.JWSInvalid("General JWS must be an object");if(!Array.isArray(e.signatures)||!e.signatures.every(o.default))throw new i.JWSInvalid("JWS Signatures missing or incorrect type");for(const i of e.signatures)try{return await(0,n.flattenedVerify)({header:i.header,payload:e.payload,protected:i.protected,signature:i.signature},t,r)}catch{}throw new i.JWSSignatureVerificationFailed};const n=r(55403),i=r(39069),o=r(71661)},14339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateKeyPair=async function(e,t){return(0,n.generateKeyPair)(e,t)};const n=r(37329)},15141:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(t.DiscrError=r={}))},15497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompactSign=void 0;const n=r(30131);t.CompactSign=class{_flattened;constructor(e){this._flattened=new n.FlattenedSign(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const r=await this._flattened.sign(e,t);if(void 0===r.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}},15860:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const n=r(38994),i=r(67218),o=r(24954);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>{const i=1===t?"property":"properties";return n.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>n._`{property: ${e},
missingProperty: ${i},
depsCount: ${t},
deps: ${r}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e)"__proto__"!==n&&((Array.isArray(e[n])?t:r)[n]=e[n]);return[t,r]}(e);s(e,t),c(e,r)}};function s(e,t=e.schema){const{gen:r,data:i,it:a}=e;if(0===Object.keys(t).length)return;const s=r.let("missing");for(const c in t){const u=t[c];if(0===u.length)continue;const d=(0,o.propertyInData)(r,i,c,a.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),a.allErrors?r.if(d,()=>{for(const t of u)(0,o.checkReportMissingProp)(e,t)}):(r.if(n._`${d} && (${(0,o.checkMissingProp)(e,u,s)})`),(0,o.reportMissingProp)(e,s),r.else())}}function c(e,t=e.schema){const{gen:r,data:n,keyword:a,it:s}=e,c=r.name("valid");for(const u in t)(0,i.alwaysValidSchema)(s,t[u])||(r.if((0,o.propertyInData)(r,n,u,s.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:u},c);e.mergeValidEvaluated(t,c)},()=>r.var(c,!0)),e.ok(c))}t.validatePropertyDeps=s,t.validateSchemaDeps=c,t.default=a},16456:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionRegistrationService=void 0,t.createSessionRegistrationService=function(e){return e.apiUrl&&e.apiKey?new i({baseUrl:e.apiUrl,apiKey:e.apiKey,fetchProvider:e.fetchProvider,logger:e.logger}):(e.logger?.("[SessionRegistration] Missing required config - session registration disabled",{hasApiUrl:!!e.apiUrl,hasApiKey:!!e.apiKey}),null)};const n=r(82906);class i{config;constructor(e){this.config={baseUrl:e.baseUrl,apiKey:e.apiKey,fetchProvider:e.fetchProvider,logger:e.logger||(()=>{}),timeoutMs:e.timeoutMs??5e3}}async registerSession(e){const t=e.session_id;try{const r=n.registerSessionRequestSchema.safeParse(e);if(!r.success){const e=`Invalid session registration request: ${r.error.message}`;return this.config.logger("[SessionRegistration] Validation failed",{sessionId:t,error:e}),{success:!1,sessionId:t,error:e}}const i=`${this.config.baseUrl}${n.AGENTSHIELD_ENDPOINTS.SESSIONS}`;this.config.logger("[SessionRegistration] Registering session for dashboard visibility",{sessionId:t,agentDid:e.agent_did,clientName:e.client_info.name,url:i});const o=new AbortController,a=setTimeout(()=>o.abort(),this.config.timeoutMs);try{const r=await this.config.fetchProvider.fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.apiKey}`},body:JSON.stringify(e),signal:o.signal});if(clearTimeout(a),!r.ok){const e=await r.text().catch(()=>"Unknown error");return this.config.logger("[SessionRegistration] Registration failed",{sessionId:t,status:r.status,error:e}),{success:!1,sessionId:t,error:`HTTP ${r.status}: ${e}`}}const s=await r.json(),c=n.registerSessionResponseSchema.safeParse(s.data||s);return c.success?(this.config.logger("[SessionRegistration] Session now visible in AgentShield dashboard",{sessionId:t,registered:c.data.registered}),{success:!0,sessionId:t}):(this.config.logger("[SessionRegistration] Invalid response format",{sessionId:t,response:s}),{success:!0,sessionId:t})}finally{clearTimeout(a)}}catch(e){if(e instanceof Error&&"AbortError"===e.name)return this.config.logger("[SessionRegistration] Request timed out",{sessionId:t,timeoutMs:this.config.timeoutMs}),{success:!1,sessionId:t,error:"Request timed out"};const r=e instanceof Error?e.message:"Unknown error";return this.config.logger("[SessionRegistration] Unexpected error",{sessionId:t,error:r}),{success:!1,sessionId:t,error:r}}}registerSessionAsync(e){this.registerSession(e).catch(t=>{this.config.logger("[SessionRegistration] Background registration failed",{sessionId:e.session_id,error:t instanceof Error?t.message:"Unknown error"})})}}t.SessionRegistrationService=i},16928:e=>{"use strict";e.exports=require("path")},17080:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o=r(6013),a={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>n._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:a,schemaCode:s,schema:c}=e;a||c&&"object"==typeof c?e.fail$data(n._`!${(0,i.useFunc)(t,o.default)}(${r}, ${s})`):e.fail(n._`${c} !== ${r}`)}};t.default=a},17306:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598);t.default=(e,t)=>(0,n.createHash)(e).update(t).digest()},17759:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){switch(e){case"PS256":case"RS256":case"ES256":case"ES256K":return"sha256";case"PS384":case"RS384":case"ES384":return"sha384";case"PS512":case"RS512":case"ES512":return"sha512";case"Ed25519":case"EdDSA":return;default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};const n=r(39069)},18381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDid=i,t.getDidMethod=function(e){if(!i(e))return null;const t=e.match(/^did:([^:]+):/);return t?t[1]:null},t.normalizeDid=o,t.compareDids=function(e,t){return o(e)===o(t)},t.getServerDid=function(e){const t=e.identity.serverDid||e.identity.agentDid;if(!t)throw new Error("Server DID not configured");return t},t.extractAgentId=a,t.extractAgentSlug=function(e){return a(e)},t.generateDidKeyFromBytes=c,t.generateDidKeyFromBase64=function(e){return c(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))},t.didKeyFragment=function(e){return e.startsWith("did:key:")?e.slice(8):"keys-1"};const n=r(18722);function i(e){return"string"==typeof e&&e.startsWith("did:")}function o(e){return e.trim()}function a(e){const t=e.split(":");return t[t.length-1]}const s=new Uint8Array([237,1]);function c(e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),`did:key:z${(0,n.base58Encode)(t)}`}},18554:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProofGenerator=void 0,t.createProofResponse=async function(e,t,r,n,i,o={}){const s={data:t},c=new a(r,i),u=await c.generateProof(e,s,n,o);return s.meta={proof:u},s},t.extractCanonicalData=function(e,t){return{request:{method:e.method,...e.params?{params:e.params}:{}},response:t.data}};const n=r(4283),i=r(51708),o=r(9443);class a{identity;cryptoProvider;constructor(e,t){this.identity=e,this.cryptoProvider=t}async generateProof(e,t,r,n={}){const i=await this.generateCanonicalHashes(e,t),o={did:this.identity.did,kid:this.identity.kid,ts:Math.floor(Date.now()/1e3),nonce:r.nonce,audience:r.audience,sessionId:r.sessionId,requestHash:i.requestHash,responseHash:i.responseHash,...n};return{jws:await this.generateJWS(o),meta:o}}async generateCanonicalHashes(e,t){const r={method:e.method,...e.params?{params:e.params}:{}},n=t.data;return{requestHash:await this.generateSHA256Hash(r),responseHash:await this.generateSHA256Hash(n)}}async generateSHA256Hash(e){const t=this.canonicalizeJSON(e),r=(new TextEncoder).encode(t);return this.cryptoProvider.hash(r)}canonicalizeJSON(e){return(0,i.canonicalize)(e)}async generateJWS(e){try{const t=this.formatPrivateKeyAsPEM(this.identity.privateKey),r=await(0,n.importPKCS8)(t,"EdDSA"),i={aud:e.audience,sub:e.did,iss:e.did,did:e.did,kid:this.identity.kid,audience:e.audience,requestHash:e.requestHash,responseHash:e.responseHash,ts:e.ts,nonce:e.nonce,sessionId:e.sessionId,...e.scopeId&&{scopeId:e.scopeId},...e.delegationRef&&{delegationRef:e.delegationRef},...e.clientDid&&{clientDid:e.clientDid},...e.toolName&&{toolName:e.toolName},...e.submissionOutcome&&{outcome:e.submissionOutcome}};return await new n.SignJWT(i).setProtectedHeader({alg:"EdDSA",kid:this.identity.kid}).sign(r)}catch(e){throw new Error(`Failed to generate JWS: ${e instanceof Error?e.message:"Unknown error"}`)}}formatPrivateKeyAsPEM(e){const t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);const n=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),i=r.subarray(0,32),o=new Uint8Array(n.length+i.length);o.set(n),o.set(i,n.length);let a="";for(let e=0;e<o.length;e++)a+=String.fromCharCode(o[e]);const s=btoa(a);return"-----BEGIN PRIVATE KEY-----\n"+(s.match(/.{1,64}/g)?.join("\n")??s)+"\n-----END PRIVATE KEY-----"}async verifyProof(e,t,r){try{const n=await this.generateCanonicalHashes(t,r);if(e.meta.requestHash!==n.requestHash||e.meta.responseHash!==n.responseHash)return!1;const i=this.base64PublicKeyToJWK(this.identity.publicKey);return new o.CryptoService(this.cryptoProvider).verifyJWS(e.jws,i,{expectedKid:this.identity.kid,alg:"EdDSA"})}catch{return!1}}base64PublicKeyToJWK(e){const t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);if(32!==r.length)throw new Error(`Invalid Ed25519 public key length: ${r.length}`);let n="";for(let e=0;e<r.length;e++)n+=String.fromCharCode(r[e]);return{kty:"OKP",crv:"Ed25519",x:btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),kid:this.identity.kid}}}t.ProofGenerator=a},18610:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}},18722:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.base58Encode=function(e){if(0===e.length)return"";let t=BigInt(0);for(let r=0;r<e.length;r++)t=t*BigInt(256)+BigInt(e[r]);let n="";for(;t>0;)n=r[Number(t%BigInt(58))]+n,t/=BigInt(58);for(let t=0;t<e.length&&0===e[t];t++)n="1"+n;return n},t.base58Decode=function(e){if(0===e.length)return new Uint8Array(0);let t=BigInt(0);for(const r of e){const e=n.get(r);if(void 0===e)throw new Error(`Invalid base58 character: ${r}`);t=t*BigInt(58)+BigInt(e)}const r=[];for(;t>0;)r.unshift(Number(t%BigInt(256))),t/=BigInt(256);let i=0;for(const t of e){if("1"!==t)break;i++}const o=new Uint8Array(i+r.length);return o.set(r,i),o},t.isValidBase58=function(e){if(0===e.length)return!0;for(const t of e)if(!n.has(t))return!1;return!0};const r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",n=new Map;for(let e=0;e<r.length;e++)n.set(r[e],e)},18951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(7980);n.code='require("ajv/dist/runtime/uri").default',t.default=n},19265:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598),i=r(80384),o=r(90489),a=r(45935),s=r(81593),c=r(99135),u=r(60322),d=r(29994),l=r(71759),p=r(21444),f=r(39069),h=r(4268),m=r(58242);t.default=(e,t,r,g,v)=>{let y;if((0,c.isCryptoKey)(r))(0,u.checkEncCryptoKey)(r,e,"encrypt"),y=n.KeyObject.from(r);else{if(!(r instanceof Uint8Array||(0,d.default)(r)))throw new TypeError((0,l.default)(r,...m.types,"Uint8Array"));y=r}switch((0,o.default)(e,y),g?(0,i.default)(e,g):g=(0,p.default)(e),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,i,o){const c=parseInt(e.slice(1,4),10);(0,d.default)(r)&&(r=r.export());const u=r.subarray(c>>3),l=r.subarray(0,c>>3),p=`aes-${c}-cbc`;if(!(0,h.default)(p))throw new f.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const m=(0,n.createCipheriv)(p,u,i),g=(0,a.concat)(m.update(t),m.final()),v=parseInt(e.slice(-3),10);return{ciphertext:g,tag:(0,s.default)(o,i,g,v,l,c),iv:i}}(e,t,y,g,v);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,i,o){const a=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,h.default)(a))throw new f.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const s=(0,n.createCipheriv)(a,r,i,{authTagLength:16});o.byteLength&&s.setAAD(o,{plaintextLength:t.length});const c=s.update(t);return s.final(),{ciphertext:c,tag:s.getAuthTag(),iv:i}}(e,t,y,g,v);default:throw new f.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},20356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserDidManager=void 0;const n=r(18381);t.UserDidManager=class{config;sessionDidCache=new Map;sessionKeyPairCache=new Map;constructor(e){this.config=e}async getKeyPairForSession(e,t){if(this.sessionKeyPairCache.has(e))return this.sessionKeyPairCache.get(e);if(t?.provider&&t?.subject&&this.config.storage?.getKeyPairByOAuth)try{const r=await this.config.storage.getKeyPairByOAuth(t.provider,t.subject);if(r)return this.sessionKeyPairCache.set(e,r),r}catch(e){console.warn("[UserDidManager] OAuth key pair lookup failed:",e)}if(this.config.storage?.getKeyPair)try{const t=await this.config.storage.getKeyPair(e);if(t)return this.sessionKeyPairCache.set(e,t),t}catch(e){console.warn("[UserDidManager] Session key pair lookup failed:",e)}return null}async getOrCreateUserDid(e,t){if(this.sessionDidCache.has(e))return this.sessionDidCache.get(e);if(t&&t.provider&&t.subject&&this.config.storage?.getByOAuth)try{const r=await this.config.storage.getByOAuth(t.provider,t.subject);if(r){if(console.error("[UserDidManager] Found persistent user DID from OAuth mapping:",{provider:t.provider,userDid:r.substring(0,20)+"..."}),this.sessionDidCache.set(e,r),this.config.storage)try{await this.config.storage.set(e,r,1800)}catch(e){console.warn("[UserDidManager] Failed to cache persistent DID in session storage:",e)}return r}}catch(e){console.warn("[UserDidManager] OAuth lookup failed, falling back to session storage:",e)}if(this.config.storage)try{const r=await this.config.storage.get(e);if(r){if(this.sessionDidCache.set(e,r),t&&t.provider&&t.subject&&this.config.storage.setByOAuth)try{await this.config.storage.setByOAuth(t.provider,t.subject,r,7776e3),console.error("[UserDidManager] Created persistent OAuth mapping for existing user DID:",{provider:t.provider,userDid:r.substring(0,20)+"..."})}catch(e){console.warn("[UserDidManager] Failed to create OAuth mapping:",e)}return r}}catch(e){console.warn("[UserDidManager] Storage.get failed:",e)}return null}async setUserDidForSession(e,t,r){if(this.sessionDidCache.set(e,t),this.config.storage)try{await this.config.storage.set(e,t,1800)}catch(e){console.warn("[UserDidManager] Failed to store user DID in session storage:",e)}if(r?.provider&&r?.subject&&this.config.storage?.setByOAuth)try{await this.config.storage.setByOAuth(r.provider,r.subject,t,7776e3),console.error("[UserDidManager] Created OAuth ā DID mapping:",{provider:r.provider,userDid:t.substring(0,20)+"..."})}catch(e){console.warn("[UserDidManager] Failed to create OAuth mapping:",e)}}async generateUserDid(){return(await this.generateUserDidWithKeyPair()).did}async generateUserDidWithKeyPair(){this.config.useDidWeb&&this.config.didWebBaseUrl&&console.warn("[UserDidManager] did:web not yet implemented, using did:key");const e=await this.config.crypto.generateKeyPair(),t=this.base64ToBytes(e.publicKey),r=this.generateDidKeyFromPublicKey(t),i=`${r}#${(0,n.didKeyFragment)(r)}`;return{did:r,publicKey:e.publicKey,privateKey:e.privateKey,keyId:i}}generateDidKeyFromPublicKey(e){const t=new Uint8Array([237,1]),r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),`did:key:z${this.base58Encode(r)}`}base58Encode(e){let t=BigInt(0);for(let r=0;r<e.length;r++)t=t*BigInt(256)+BigInt(e[r]);let r="";for(;t>0;)r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"[Number(t%BigInt(58))]+r,t/=BigInt(58);for(let t=0;t<e.length&&0===e[t];t++)r="1"+r;return r}base64ToBytes(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=(4-t.length%4)%4;if(t+="=".repeat(r),"undefined"!=typeof Buffer)return new Uint8Array(Buffer.from(t,"base64"));{const e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r}}async getUserDid(e){if(this.sessionDidCache.has(e))return this.sessionDidCache.get(e);if(this.config.storage){const t=await this.config.storage.get(e);if(t)return this.sessionDidCache.set(e,t),t}return null}async clearUserDid(e){if(this.sessionDidCache.delete(e),this.config.storage)try{await this.config.storage.delete(e)}catch(e){console.warn("[UserDidManager] Storage.delete failed, continuing:",e)}}clearCache(){this.sessionDidCache.clear()}}},20860:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProofVerificationError=t.PROOF_VERIFICATION_ERROR_CODES=void 0,t.createProofVerificationError=function(e,t,n){return new r(e,t,n)},t.PROOF_VERIFICATION_ERROR_CODES={INVALID_PROOF_STRUCTURE:"INVALID_PROOF_STRUCTURE",MISSING_REQUIRED_FIELD:"MISSING_REQUIRED_FIELD",NONCE_REPLAY_DETECTED:"NONCE_REPLAY_DETECTED",TIMESTAMP_SKEW_EXCEEDED:"TIMESTAMP_SKEW_EXCEEDED",TIMESTAMP_INVALID:"TIMESTAMP_INVALID",INVALID_JWS_SIGNATURE:"INVALID_JWS_SIGNATURE",INVALID_JWS_FORMAT:"INVALID_JWS_FORMAT",INVALID_JWS_HEADER:"INVALID_JWS_HEADER",INVALID_JWS_PAYLOAD:"INVALID_JWS_PAYLOAD",INVALID_JWS_SIGNATURE_BASE64:"INVALID_JWS_SIGNATURE_BASE64",UNSUPPORTED_ALGORITHM:"UNSUPPORTED_ALGORITHM",INVALID_JWK_FORMAT:"INVALID_JWK_FORMAT",INVALID_JWK_KTY:"INVALID_JWK_KTY",INVALID_JWK_CRV:"INVALID_JWK_CRV",INVALID_JWK_X_FIELD:"INVALID_JWK_X_FIELD",INVALID_JWK_KEY_LENGTH:"INVALID_JWK_KEY_LENGTH",JWK_KID_MISMATCH:"JWK_KID_MISMATCH",DID_RESOLUTION_FAILED:"DID_RESOLUTION_FAILED",DID_DOCUMENT_NOT_FOUND:"DID_DOCUMENT_NOT_FOUND",VERIFICATION_METHOD_NOT_FOUND:"VERIFICATION_METHOD_NOT_FOUND",PUBLIC_KEY_NOT_FOUND:"PUBLIC_KEY_NOT_FOUND",UNSUPPORTED_DID_METHOD:"UNSUPPORTED_DID_METHOD",VERIFICATION_ERROR:"VERIFICATION_ERROR",INTERNAL_ERROR:"INTERNAL_ERROR"};class r extends Error{code;details;constructor(e,t,r){super(t),this.code=e,this.details=r,this.name="ProofVerificationError"}}t.ProofVerificationError=r},21070:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(24954).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=n},21444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=o;const n=r(39069),i=r(84641);function o(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.default=e=>(0,i.default)(new Uint8Array(o(e)>>3))},22562:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createLocalJWKSet=function(e){const t=new c(e),r=async(e,r)=>t.getKey(e,r);return Object.defineProperties(r,{jwks:{value:()=>s(t._jwks),enumerable:!0,configurable:!1,writable:!1}}),r};const n=r(68846),i=r(39069),o=r(71661);function a(e){return(0,o.default)(e)}function s(e){return"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}class c{_jwks;_cached=new WeakMap;constructor(e){if(!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(a)}(e))throw new i.JWKSInvalid("JSON Web Key Set malformed");this._jwks=s(e)}async getKey(e,t){const{alg:r,kid:n}={...e,...t?.header},o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new i.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=this._jwks.keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof n&&(t=n===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":t="Ed25519"===e.crv;break;case"EdDSA":t="Ed25519"===e.crv||"Ed448"===e.crv}return t}),{0:s,length:c}=a;if(0===c)throw new i.JWKSNoMatchingKey;if(1!==c){const e=new i.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(const e of a)try{yield await u(t,e,r)}catch{}},e}return u(this._cached,s,r)}}async function u(e,t,r){const o=e.get(t)||e.set(t,{}).get(t);if(void 0===o[r]){const e=await(0,n.importJWK)({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new i.JWKSInvalid("JSON Web Key Set members must be public keys");o[r]=e}return o[r]}},23252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(36023),i=r(24954),o=r(67218),a=r(88401),s={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:s,data:c,it:u}=e;"all"===u.opts.removeAdditional&&void 0===s.additionalProperties&&a.default.code(new n.KeywordCxt(u,a.default,"additionalProperties"));const d=(0,i.allSchemaProperties)(r);for(const e of d)u.definedProperties.add(e);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=o.mergeEvaluated.props(t,(0,o.toHash)(d),u.props));const l=d.filter(e=>!(0,o.alwaysValidSchema)(u,r[e]));if(0===l.length)return;const p=t.name("valid");for(const r of l)f(r)?h(r):(t.if((0,i.propertyInData)(t,c,r,u.opts.ownProperties)),h(r),u.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(p);function f(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==r[e].default}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}};t.default=s},23665:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const n=r(38994),i=r(67218),o=r(24954),a={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return s(e,"additionalItems",t);r.items=!0,(0,i.alwaysValidSchema)(r,t)||e.ok((0,o.validateArray)(e))}};function s(e,t,r=e.schema){const{gen:o,parentSchema:a,data:s,keyword:c,it:u}=e;!function(e){const{opts:n,errSchemaPath:o}=u,a=r.length,s=a===e.minItems&&(a===e.maxItems||!1===e[t]);if(n.strictTuples&&!s){const e=`"${c}" is ${a}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,i.checkStrictMode)(u,e,n.strictTuples)}}(a),u.opts.unevaluated&&r.length&&!0!==u.items&&(u.items=i.mergeEvaluated.items(o,r.length,u.items));const d=o.name("valid"),l=o.const("len",n._`${s}.length`);r.forEach((t,r)=>{(0,i.alwaysValidSchema)(u,t)||(o.if(n._`${l} > ${r}`,()=>e.subschema({keyword:c,schemaProp:r,dataProp:r},d)),e.ok(d))})}t.validateTuple=s,t.default=a},23967:e=>{function t(e){return Promise.resolve().then(()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=()=>[],t.resolve=t,t.id=23967,e.exports=t},24726:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=e=>Math.floor(e.getTime()/1e3)},24886:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CascadingRevocationManager=void 0,t.createCascadingRevocationManager=function(e,t){return new r(e,t)};class r{graph;statusList;constructor(e,t){this.graph=e,this.statusList=t}async revokeDelegation(e,t={}){const r=t.maxDepth||100,n=[],i=await this.graph.getNode(e);if(!i)throw new Error(`Delegation not found: ${e}`);const o=await this.graph.getDepth(e);if(o>r)throw new Error(`Delegation depth ${o} exceeds maximum ${r}`);const a=await this.revokeNode(i,!0,t.reason,t.dryRun);n.push(a),t.onRevoke&&await t.onRevoke(a);const s=await this.graph.getDescendants(e);for(const r of s){const i=await this.revokeNode(r,!1,`Cascaded from ${e}`,t.dryRun,e);n.push(i),t.onRevoke&&await t.onRevoke(i)}return n}async revokeNode(e,t,r,n,i){const o={delegationId:e.id,isRoot:t,parentId:i,timestamp:Date.now(),reason:r};if(n)return o;if(e.credentialStatusId){const t=this.parseCredentialStatus(e.credentialStatusId);t&&await this.statusList.updateStatus(t,!0)}return o}async restoreDelegation(e){const t=await this.graph.getNode(e);if(!t)throw new Error(`Delegation not found: ${e}`);const r={delegationId:t.id,isRoot:!0,timestamp:Date.now(),reason:"Restored"};if(t.credentialStatusId){const e=this.parseCredentialStatus(t.credentialStatusId);e&&await this.statusList.updateStatus(e,!1)}return r}async isRevoked(e){const t=await this.graph.getChain(e);for(const r of t.reverse())if(r.credentialStatusId){const t=this.parseCredentialStatus(r.credentialStatusId);if(t&&await this.statusList.checkStatus(t))return{revoked:!0,reason:r.id===e?"Directly revoked":"Ancestor revoked",revokedAncestor:r.id===e?void 0:r.id}}return{revoked:!1}}async getRevokedInSubtree(e){const t=await this.graph.getDescendants(e),r=[];(await this.isRevoked(e)).revoked&&r.push(e);for(const e of t)(await this.isRevoked(e.id)).revoked&&r.push(e.id);return r}parseCredentialStatus(e){const t=e.match(/^(.+)#(\d+)$/);if(!t)return null;const[,r,n]=t;return{id:e,type:"StatusList2021Entry",statusPurpose:"revocation",statusListIndex:parseInt(n,10).toString(),statusListCredential:r}}async validateDelegation(e){const t=await this.isRevoked(e);if(t.revoked)return{valid:!1,reason:t.revokedAncestor?`Ancestor ${t.revokedAncestor} is revoked`:"Delegation is revoked"};const r=await this.graph.validateChain(e);return r.valid?{valid:!0}:r}}t.CascadingRevocationManager=r},24904:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPIRuntimeBase=void 0;const n=r(95006),i=r(9443),o=r(47848),a=r(82906),s=r(20356),c=r(314),u=r(51713),d=e=>"object"==typeof e&&null!==e;class l{crypto;clock;fetch;storage;nonceCache;identity;config;cachedIdentity;sessions=new Map;lastProof;userDidManager;interceptedCalls=new Map;cryptoService;proofVerifier;accessControlService;_extAppsAvailable;constructor(e){this.config=e,this.crypto=e.cryptoProvider,this.clock=e.clockProvider,this.fetch=e.fetchProvider,this.storage=e.storageProvider,this.nonceCache=e.nonceCacheProvider,this.identity=e.identityProvider,this.cryptoService=new i.CryptoService(this.crypto)}async initialize(){this.cachedIdentity=await this.identity.getIdentity(),this.config.identity?.generateUserDids&&(this.userDidManager=new s.UserDidManager({crypto:this.crypto,storage:this.config.identity?.userDidStorage?{get:async e=>await this.storage.get(`userDid:${e}`),set:async(e,t,r)=>{await this.storage.set(`userDid:${e}`,t)},delete:async e=>await this.storage.delete(`userDid:${e}`)}:void 0,useDidWeb:"persistent"===this.config.identity?.userDidStorage}));const e=this.nonceCache;"function"==typeof e.initialize&&await e.initialize(),"development"===this.config.environment&&this.emitDiagnostic("runtime_initialized",{did:this.cachedIdentity.did,environment:this.config.environment||"development",userDidGeneration:this.config.identity?.generateUserDids?"enabled":"disabled"})}async getIdentity(){return this.cachedIdentity||(this.cachedIdentity=await this.identity.getIdentity()),this.cachedIdentity}async recordConsentAudit(e){if(void 0!==this.config.auditTrail)return(0,c.recordRuntimeConsentAudit)(this.config.auditTrail,e)}async recordDelegationAudit(e){if(void 0!==this.config.auditTrail)return(0,c.recordRuntimeDelegationAudit)(this.config.auditTrail,e)}async handleHandshake(e){const t=await this.getIdentity(),r=this.clock.now(),n=await this.generateSessionId();let i;if(this.userDidManager)try{const t=e.oauthIdentity;i=await this.userDidManager.getOrCreateUserDid(n,t)??void 0,"development"===this.config.environment&&(i?console.error("[MCP-I] Resolved existing user DID for session:",{userDid:i.substring(0,20)+"...",hasOAuth:!!t,provider:t?.provider}):console.error("[MCP-I] Session started anonymous (no userDid):",{sessionId:n.substring(0,8)+"...",hasOAuth:!!t}))}catch(e){console.warn("[MCP-I] Failed to resolve user DID:",e)}const o=e=>{if("string"!=typeof e)return;const t=e.trim();return t.length>0?t:void 0},a=o(e.clientProtocolVersion),s=e.clientCapabilities,u=e.clientInfo,d=u||"string"==typeof a||void 0!==s?{name:o(u?.name)??"unknown",title:o(u?.title),version:o(u?.version),platform:o(u?.platform),vendor:o(u?.vendor),persistentId:o(u?.persistentId),clientId:o(u?.clientId)??crypto.randomUUID(),protocolVersion:a,capabilities:s}:void 0,l={id:n,clientDid:e.clientDid||i,userDid:i,agentDid:e.agentDid,serverDid:t.did,audience:e.audience,createdAt:r,expiresAt:this.clock.calculateExpiry(60*(this.config.session?.ttlMinutes||30)),clientInfo:d,identityState:i?"authenticated":"anonymous",oauthIdentity:e.oauthIdentity??void 0};this.sessions.set(n,l);const p=(0,c.resolveRuntimeAuditAssurance)(this.config.auditTrail),f={sessionId:n,agentDid:t.did,timestamp:r,capabilities:["identity","proof",...p.enabled?["audit-trail"]:[]],auditAssurance:p,...i&&{userDid:i}},h=await this.signData(f);return{...f,signature:h}}async updateSessionIdentity(e,t,r){const n=this.sessions.get(e);if(!n)throw new Error(`Session not found: ${e}`);n.userDid=t,n.identityState="authenticated",r&&(n.oauthIdentity=r),this.sessions.set(e,n),this.userDidManager&&await this.userDidManager.setUserDidForSession(e,t,r),"development"===this.config.environment&&console.error("[MCP-I] Session identity updated (Phase 5):",{sessionId:e.substring(0,8)+"...",userDid:t.substring(0,20)+"...",provider:r?.provider,identityState:"authenticated"})}getSession(e){return this.sessions.get(e)}getConsentProvider(e){if(e.authorization){const t=e.authorization;if(("oauth"===t.type||"oauth2"===t.type||"password"===t.type||"idv"===t.type)&&t.provider)return t.provider}return e.oauthProvider}async processToolCall(e,t,r,n){const i=this.config.auditTrail?await(0,c.beginRuntimeToolAudit)(this.config.auditTrail,{toolName:e,args:t,session:n}):void 0;let o;try{o=await this.processToolCallInternal(e,t,r,n)}catch(e){if(i)try{await i.terminal((0,c.terminalForToolError)(e))}catch(e){console.error("[MCP-I] Failed to record terminal tool audit event",{error:e instanceof Error?e.message:String(e)})}throw e}if(!i||!this.config.auditTrail)return o;try{const e=await i.terminal((0,c.terminalForToolResult)(o));return(0,c.attachRuntimeAuditMetadata)(o,this.config.auditTrail.sourceId,i.context.invocationId,i.results(e))}catch(e){return console.error("[MCP-I] Failed to record successful tool audit terminal",{error:e instanceof Error?e.message:String(e)}),(0,c.attachRuntimeAuditMetadata)(o,this.config.auditTrail.sourceId,i.context.invocationId,i.results(),!0)}}async processToolCallInternal(e,t,r,i){if(this.config.toolProtectionService){const r=await this.getIdentity();"development"===this.config.environment&&console.error("[MCP-I] Checking tool protection:",{tool:e,agentDid:r.did.slice(0,20)+"...",hasDelegation:!(!i?.delegationToken&&!i?.consentProof)});const s=await this.config.toolProtectionService.checkToolProtection(e,r.did);if(s){if(!i?.delegationToken&&!i?.consentProof){const o={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},a=await this.generateResumeToken(o),c=this.buildConsentUrl(e,s.requiredScopes,i,a,void 0,this.getConsentProvider(s)),u=new n.DelegationRequiredError(e,s.requiredScopes,c,o,a);this.interceptedCalls.set(a,o),this.cleanupExpiredInterceptedCalls(),"development"===this.config.environment&&console.warn("[MCP-I] BLOCKED: Tool requires delegation but none provided",{tool:e,requiredScopes:s.requiredScopes,agentDid:r.did.slice(0,20)+"...",resumeToken:u.resumeToken,consentUrl:c});const l=i?.clientInfo,p=d(l?.capabilities)?l.capabilities:void 0,f=this.buildConsentUIResult(e,s.requiredScopes,i,a,i?.projectId||void 0,i?.serverOrigin||void 0,p);if(f)return f;throw u}const c=i?.delegationToken,u=i?.consentProof;if(!this.accessControlService){"development"===this.config.environment&&console.warn("[MCP-I] Delegation verifier unavailable - blocking protected tool",{tool:e,agentDid:r.did.slice(0,20)+"...",hasDelegationToken:!!c,hasConsentProof:!!u});const o={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},a=await this.generateResumeToken(o),d=this.buildConsentUrl(e,s.requiredScopes,i,a,void 0,this.getConsentProvider(s));throw this.interceptedCalls.set(a,o),this.cleanupExpiredInterceptedCalls(),new n.DelegationRequiredError(e,s.requiredScopes,d,o,a)}try{"development"===this.config.environment&&console.error("[MCP-I] š Verifying delegation token with AccessControlApiService",{tool:e,agentDid:r.did.slice(0,20)+"...",hasDelegationToken:!!c,hasConsentProof:!!u,requiredScopes:s.requiredScopes});const a={agent_did:r.did,scopes:s.requiredScopes};i?.userDid&&(a.user_did=i.userDid,"development"===this.config.environment&&console.error("[MCP-I] š Including user_did in verification request",{userDid:i.userDid.slice(0,20)+"..."})),c?a.delegation_token=c:u&&(a.credential_jwt=u),a.timestamp=this.clock.now(),(i?.clientDid||i?.clientId)&&(a.client_info={origin:i?.serverOrigin,user_agent:i?.userAgent});const d=await this.accessControlService.verifyDelegation(a,{delegationToken:c||void 0,credentialJwt:u||void 0});if(!d.data.valid){const o=d.data.reason||"Delegation token invalid or expired",a=d.data.error;"development"===this.config.environment&&console.error("[MCP-I] ā Delegation verification FAILED",{tool:e,agentDid:r.did.slice(0,20)+"...",reason:o,errorCode:a?.code,errorMessage:a?.message,requiredScopes:s.requiredScopes});const c={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},u=await this.generateResumeToken(c),l=this.buildConsentUrl(e,s.requiredScopes,i,u,void 0,this.getConsentProvider(s));throw this.interceptedCalls.set(u,c),this.cleanupExpiredInterceptedCalls(),new n.DelegationRequiredError(e,s.requiredScopes,l,c,u)}const l=d.data.credential,p=l?.user_identifier,f=l?.user_id,h=i?.userDid;if(p&&h){const o=p===h||f===h,a=p.startsWith("did:");if((a||f)&&!o){p.substring(0,20),h.substring(0,20),"development"===this.config.environment&&console.error("[MCP-I] š SECURITY: User identifier validation FAILED",{tool:e,agentDid:r.did.slice(0,20)+"...",delegationUserIdentifier:p.substring(0,20)+"...",delegationUserId:f?f.substring(0,20)+"...":"N/A",sessionUserDid:h.substring(0,20)+"...",sessionId:i?.id?.substring(0,20)+"...",reason:"user_identifier_mismatch",severity:"high"});const o={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},a=await this.generateResumeToken(o),c=this.buildConsentUrl(e,s.requiredScopes,i,a,void 0,this.getConsentProvider(s));throw this.interceptedCalls.set(a,o),this.cleanupExpiredInterceptedCalls(),new n.DelegationRequiredError(e,s.requiredScopes,c,o,a)}"development"===this.config.environment&&console.error("[MCP-I] ā
User identifier validation PASSED",{tool:e,agentDid:r.did.slice(0,20)+"...",userDid:h.substring(0,20)+"...",sessionId:i?.id?.substring(0,20)+"...",matchType:o?"direct":"trusted_agentshield_verification",delegationIdentifierFormat:a?"did":"email_or_other"})}else p&&!h&&"development"===this.config.environment&&console.warn("[MCP-I] ā ļø Delegation has user_identifier but session missing userDid",{tool:e,agentDid:r.did.slice(0,20)+"...",delegationUserIdentifier:p.substring(0,20)+"...",sessionId:i?.id?.substring(0,20)+"..."});const m=s.authorization,g=l?.authorization;if(m&&l){if(!g){"development"===this.config.environment&&console.error("[MCP-I] ā Tool requires authorization but credential missing auth data",{tool:e,agentDid:r.did.slice(0,20)+"...",toolAuth:m,note:"Credential exists but missing authorization metadata - rejecting for security"});const o={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},a=await this.generateResumeToken(o),c=this.buildConsentUrl(e,s.requiredScopes,i,a,void 0,this.getConsentProvider(s));throw this.interceptedCalls.set(a,o),this.cleanupExpiredInterceptedCalls(),new n.DelegationRequiredError(e,s.requiredScopes,c,o,a)}if(!(0,o.authorizationMatches)(g,m)){const o=m,a="string"==typeof o.provider?`:${o.provider}`:"",c="string"==typeof o.credentialType?`:${o.credentialType}`:"",u=`Authorization method mismatch: delegation has ${g.type}${g.provider?`:${g.provider}`:""}${g.credentialType?`:${g.credentialType}`:""} but tool requires ${m.type}${a}${c}`;"development"===this.config.environment&&console.error("[MCP-I] ā Authorization method validation FAILED",{tool:e,agentDid:r.did.slice(0,20)+"...",reason:u,delegationAuth:g,toolAuth:m});const d={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},l=await this.generateResumeToken(d),p=this.buildConsentUrl(e,s.requiredScopes,i,l,void 0,this.getConsentProvider(s));throw this.interceptedCalls.set(l,d),this.cleanupExpiredInterceptedCalls(),new n.DelegationRequiredError(e,s.requiredScopes,p,d,l)}"development"===this.config.environment&&console.error("[MCP-I] ā
Authorization method validation PASSED",{tool:e,agentDid:r.did.slice(0,20)+"...",authType:g.type,provider:g.provider||"N/A"})}"development"===this.config.environment&&console.error("[MCP-I] ā
Delegation verification SUCCEEDED",{tool:e,agentDid:r.did.slice(0,20)+"...",delegationId:d.data.delegation_id,credentialScopes:d.data.credential?.scopes,requiredScopes:s.requiredScopes})}catch(o){if(o instanceof n.DelegationRequiredError)throw o;if(o instanceof a.AgentShieldAPIError){"development"===this.config.environment&&console.error("[MCP-I] ā Delegation verification error (API failure)",{tool:e,agentDid:r.did.slice(0,20)+"...",errorCode:o.code,errorMessage:o.message,errorDetails:o.details});const a={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},c=await this.generateResumeToken(a),u=this.buildConsentUrl(e,s.requiredScopes,i,c,void 0,this.getConsentProvider(s));throw this.interceptedCalls.set(c,a),this.cleanupExpiredInterceptedCalls(),new n.DelegationRequiredError(e,s.requiredScopes,u,a,c)}"development"===this.config.environment&&console.error("[MCP-I] ā Unexpected error during delegation verification",{tool:e,agentDid:r.did.slice(0,20)+"...",error:o instanceof Error?o.message:String(o),errorStack:o instanceof Error?o.stack:void 0});const c={toolName:e,args:t,sessionId:i?.id||"unknown",timestamp:this.clock.now(),expiresAt:this.clock.calculateExpiry(1800)},u=await this.generateResumeToken(c),d=this.buildConsentUrl(e,s.requiredScopes,i,u,void 0,this.getConsentProvider(s));throw this.interceptedCalls.set(u,c),this.cleanupExpiredInterceptedCalls(),new n.DelegationRequiredError(e,s.requiredScopes,d,c,u)}}else"development"===this.config.environment&&console.error("[MCP-I] Tool protection check passed (no delegation required)",{tool:e,agentDid:r.did.slice(0,20)+"...",reason:"Tool not configured to require delegation"})}const s=await r(t),c=await this.createProof(s,i);return this.lastProof=c,"development"===this.config.environment&&this.emitDiagnostic("tool_executed",{tool:e,sessionId:i?.id,timestamp:this.clock.now()}),s}async resumeToolCall(e,t,r){const n=this.interceptedCalls.get(e);if(!n)throw new Error(`Invalid or expired resume token: ${e}`);if(this.clock.hasExpired(n.expiresAt))throw this.interceptedCalls.delete(e),new Error(`Resume token expired: ${e}`);const i=this.sessions.get(n.sessionId);if(!i)throw new Error(`Session not found for intercepted call: ${n.sessionId}`);const o={...i,delegationToken:r},a=await this.processToolCall(n.toolName,n.args,t,o);return this.interceptedCalls.delete(e),a}async generateResumeToken(e){const t=await this.crypto.randomBytes(16);return`resume_${this.bytesToHex(t)}`}cleanupExpiredInterceptedCalls(){this.clock.now();for(const[e,t]of this.interceptedCalls.entries())this.clock.hasExpired(t.expiresAt)&&this.interceptedCalls.delete(e)}static CONSENT_UI_RESOURCE_URI="ui://kya-os-consent/authorize";hasUICapability(e){if(!e)return console.error("[MCP-I] hasUICapability: no clientCapabilities provided"),!1;try{const{getUiCapability:t,RESOURCE_MIME_TYPE:n}=r(81080),i=t(e),o=i?.mimeTypes?.includes(n)??!1;return console.error("[MCP-I] hasUICapability check:",{hasUI:o,uiCap:i?JSON.stringify(i):"null",capabilityKeys:Object.keys(e)}),o}catch{return console.error("[MCP-I] hasUICapability: ext-apps not available"),!1}}setExtAppsAvailable(e){this._extAppsAvailable=e}isExtAppsAvailable(){return!0===this._extAppsAvailable&&!0===this.config.inlineConsent}buildConsentUIResult(e,t,r,n,i,o,a,s="consent-only",c){if(this.hasUICapability(a),!this.isExtAppsAvailable())return null;const u=this.buildConsentUrl(e,t,r,n,i);return{content:[{type:"text",text:`Authorization required for tool "${e}". Please approve in the consent form below, or open this link to authorize in your browser: ${u}`}],structuredContent:{type:"consent_required",authMode:s,tool:e,scopes:t,agentDid:r?.agentDid||"",agentName:r?.agentName||"",sessionId:r?.id||"",projectId:i||"",resumeToken:n||"",serverUrl:o||"",consentUrl:u,...c?{provider:c}:{}},_meta:{ui:{resourceUri:l.CONSENT_UI_RESOURCE_URI},"ui/resourceUri":l.CONSENT_UI_RESOURCE_URI}}}buildConsentUrl(e,t,r,n,i,o){const a=new URLSearchParams({tool:e,scopes:t.join(","),session_id:r?.id||"",agent_did:r?.agentDid||""}),s=r?.agentName;return s&&a.set("agent_name",s),i&&a.set("project_id",i),n&&a.set("resume_token",n),o&&a.set("provider",o),`https://kya.vouched.id/bouncer/consent?${a.toString()}`}async issueNonce(e){const t=await this.generateNonce(),r=this.sessions.get(e),n=r?.agentDid||(await this.getIdentity()).did;return await this.nonceCache.add(t,300,n),t}async createProof(e,t){const r=await this.getIdentity(),n=this.clock.now();let i;if(t?.nonce)i=t.nonce;else{i=await this.generateNonce();const e=t?.agentDid||r.did;await this.nonceCache.add(i,300,e)}const o={data:e,timestamp:n,nonce:i,did:r.did,sessionId:t?.id,audience:t?.audience},a=await this.signData(o);return{timestamp:n,nonce:i,did:r.did,signature:a,algorithm:"Ed25519",sessionId:t?.id,audience:t?.audience}}async verifyProof(e,t){if(!(e&&"object"==typeof e&&"jws"in e&&"meta"in e))return this.verifyProofLegacy(e,d(t)?t:{});{const r=e,n=d(t)?t:void 0;if(!this.proofVerifier)return console.warn("[MCPIRuntimeBase] ProofVerifier not available, using fallback verification"),this.verifyProofLegacy(e,d(t)?t:{});try{const e=await this.fetch.resolveDID(r.meta.did),t=this.extractPublicKeyJwk(e,r.meta.kid);if(!t)return console.error("[MCPIRuntimeBase] Failed to extract public key JWK"),!1;const i=await this.proofVerifier.verifyProof(r,t);if(i.valid&&n){const e=this.proofVerifier.buildCanonicalPayload(r.meta);n.canonicalPayload=e}return i.valid}catch(e){return console.error("[MCPIRuntimeBase] Proof verification failed:",e),!1}}}async verifyProofLegacy(e,t){try{const r="string"==typeof t.nonce?t.nonce:void 0,n="string"==typeof t.did?t.did:void 0,i="number"==typeof t.timestamp?t.timestamp:void 0,o="string"==typeof t.signature?t.signature:void 0,a="string"==typeof t.sessionId?t.sessionId:void 0;if(!(r&&n&&i&&o))return!1;if(await this.nonceCache.has(r,n))return!1;if(!this.clock.isWithinSkew(i,this.config.session?.timestampSkewSeconds||300))return!1;const s=await this.fetch.resolveDID(n),c=this.extractPublicKey(s),u={data:e,timestamp:i,nonce:r,did:n,sessionId:a},d=(new TextEncoder).encode(JSON.stringify(u)),l=this.base64ToBytes(o),p=await this.crypto.verify(d,l,c);if(p){const e=60*(this.config.session?.ttlMinutes||30);await this.nonceCache.add(r,e,n)}return p}catch(e){return console.error("Proof verification failed:",e),!1}}async verifyProofJWS(e,t,r){if(!this.cryptoService)return console.error("[MCPIRuntimeBase] CryptoService not initialized"),!1;try{const n=void 0!==r?{detachedPayload:r}:void 0;return await this.cryptoService.verifyJWS(e,t,n)}catch(e){return console.error("[MCPIRuntimeBase] JWS verification failed:",e),!1}}async getCurrentSession(){for(const[e,t]of this.sessions)if(!this.clock.hasExpired(t.expiresAt))return t;return null}getLastProof(){return this.lastProof}createWellKnownHandler(e){return async t=>{const r=await this.getIdentity();if("/.well-known/did.json"===t){const e=this.createDIDDocument(r);return{status:200,headers:{"Content-Type":"application/did+json","Cache-Control":"production"===this.config.environment?"public, max-age=300":"no-store"},body:JSON.stringify(e,null,2)}}if("/.well-known/agent.json"===t){const t={id:r.did,capabilities:{"mcp-i":["handshake","signing","verification"]}};return(e?.serviceName||e?.serviceEndpoint)&&(t.metadata={...e?.serviceName&&{name:e.serviceName},...e?.serviceEndpoint&&{serviceEndpoint:e.serviceEndpoint}}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"production"===this.config.environment?"public, max-age=300":"no-store"},body:JSON.stringify(t,null,2)}}if(t===u.LEGACY_WELL_KNOWN_IDENTITY_PATH||t===u.WELL_KNOWN_IDENTITY_PATH)return(0,u.recordWireForm)("well_known",t===u.WELL_KNOWN_IDENTITY_PATH?"new":"old"),{did:r.did,publicKey:r.publicKey,serviceName:e?.serviceName||"MCP-I Service",serviceEndpoint:e?.serviceEndpoint||"https://example.com",timestamp:this.clock.now()};if("/.well-known/mcp.json"===t||"/.well-known/mcp/server-card.json"===t){const t=e?.serviceName||"mcp-i-server",n={$schema:"https://static.modelcontextprotocol.io/schemas/mcp-server-card/v1.json",version:"1.0",protocolVersion:e?.protocolVersion||"2025-06-18",serverInfo:{name:t,title:e?.serviceTitle||e?.serviceName||"MCP-I Server",version:e?.serverVersion||"1.0.0"},description:e?.description||"MCP-I enabled server with cryptographic identity",...e?.iconUrl&&{iconUrl:e.iconUrl},...e?.documentationUrl&&{documentationUrl:e.documentationUrl},transport:{type:"streamable-http",endpoint:"/mcp"},capabilities:{tools:{listChanged:!0}},...e?.requiresAuth&&{authentication:{required:!0,schemes:e.authSchemes||["oauth2"]}},...e?.instructions&&{instructions:e.instructions},tools:"dynamic",_meta:{...e?.metadata,"mcp-i":{agentDid:r.did,publicKey:r.publicKey,generatedAt:this.clock.now()}}};return{status:200,headers:{"Content-Type":"application/json","Cache-Control":"production"===this.config.environment?"public, max-age=3600":"no-store","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Content-Type"},body:JSON.stringify(n,null,2)}}if("/.well-known/mcp-client-config.json"===t){const t=e?.serviceEndpoint||"https://example.com",n=e?.serviceName||"mcp-i-server",i=`${t}/mcp`,o={[n]:{url:i,transport:"sse"}},a=Buffer.from(JSON.stringify(o)).toString("base64"),s=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(n)}&config=${encodeURIComponent(a)}`,c={claudeDesktop:{mcpServers:{[n]:{url:i,transport:"sse"}}},cursor:{mcpServers:{[n]:{url:i,transport:"sse"}}},cursorDeepLink:s,_meta:{serverName:n,serverUrl:t,mcpEndpoint:i,agentDid:r.did,generatedAt:this.clock.now(),instructions:"Copy the appropriate config section to your client configuration file."}};return{status:200,headers:{"Content-Type":"application/json","Cache-Control":"production"===this.config.environment?"public, max-age=300":"no-store"},body:JSON.stringify(c,null,2)}}return null}}createDebugEndpoint(){return"production"===this.config.environment?null:async()=>{const e=await this.getIdentity(),t=await this.getCurrentSession();return{identity:{did:e.did,publicKey:e.publicKey},session:t,config:{environment:this.config.environment,timestampSkewSeconds:this.config.session?.timestampSkewSeconds,sessionTtlMinutes:this.config.session?.ttlMinutes},timestamp:this.clock.now()}}}async rotateKeys(){const e=this.cachedIdentity?.did,t=await this.identity.rotateKeys();return this.cachedIdentity=t,"development"===this.config.environment&&this.emitDiagnostic("keys_rotated",{oldDid:e,newDid:t.did,timestamp:this.clock.now()}),t}async signData(e){const t=await this.getIdentity(),r=(new TextEncoder).encode(JSON.stringify(e)),n=await this.crypto.sign(r,t.privateKey);return this.bytesToBase64(n)}async generateNonce(){const e=await this.crypto.randomBytes(32);return this.bytesToBase64(e)}async generateSessionId(){const e=await this.crypto.randomBytes(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=this.bytesToHex(e),r=`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`;return`${u.SESSION_ID_PREFIX}${r}`}emitDiagnostic(e,t){"development"===this.config.environment&&console.error("[MCP-I diagnostic]",JSON.stringify({event:e,data:t,timestamp:this.clock.now()}))}createDIDDocument(e){return{"@context":["https://www.w3.org/ns/did/v1"],id:e.did,verificationMethod:[{id:`${e.did}#key-1`,type:"Ed25519VerificationKey2020",controller:e.did,publicKeyBase64:e.publicKey}],authentication:[`${e.did}#key-1`],assertionMethod:[`${e.did}#key-1`]}}extractPublicKey(e){const t=d(e)?e.verificationMethod:void 0,r=Array.isArray(t)?t[0]:void 0;if(r?.publicKeyBase64)return String(r.publicKeyBase64);if(r?.publicKeyMultibase)return String(r.publicKeyMultibase);throw new Error("Public key not found in DID document")}extractPublicKeyJwk(e,t){const r=d(e)?e.verificationMethod:void 0,n=Array.isArray(r)?r:[],i=n.find(e=>{const r="string"==typeof e.type?e.type:void 0,n="string"==typeof e.id?e.id:void 0,i="Ed25519VerificationKey2020"===r||"JsonWebKey2020"===r,o=!t||n===t||n?.endsWith(`#${t}`);return i&&o})||n[0];if(i&&d(i.publicKeyJwk)){const e=i.publicKeyJwk;if("OKP"===e.kty&&"Ed25519"===e.crv)return e}return i?.publicKeyMultibase?(console.warn("[MCPIRuntimeBase] Multibase to JWK conversion not fully implemented"),null):null}bytesToBase64(e){return Buffer.from(e).toString("base64")}base64ToBytes(e){return new Uint8Array(Buffer.from(e,"base64"))}bytesToHex(e){return Buffer.from(e).toString("hex")}}t.MCPIRuntimeBase=l},24954:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const n=r(38994),i=r(67218),o=r(86660),a=r(67218);function s(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}function c(e,t,r){return n._`${s(e)}.call(${t}, ${r})`}function u(e,t,r,i){const o=n._`${t}${(0,n.getProperty)(r)} === undefined`;return i?(0,n.or)(o,(0,n.not)(c(e,t,r))):o}function d(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}t.checkReportMissingProp=function(e,t){const{gen:r,data:i,it:o}=e;r.if(u(r,i,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:n._`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},i,o){return(0,n.or)(...i.map(i=>(0,n.and)(u(e,t,i,r.ownProperties),n._`${o} = ${i}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=s,t.isOwnProperty=c,t.propertyInData=function(e,t,r,i){const o=n._`${t}${(0,n.getProperty)(r)} !== undefined`;return i?n._`${o} && ${c(e,t,r)}`:o},t.noPropertyInData=u,t.allSchemaProperties=d,t.schemaProperties=function(e,t){return d(t).filter(r=>!(0,i.alwaysValidSchema)(e,t[r]))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:a,errorPath:s},it:c},u,d,l){const p=l?n._`${e}, ${t}, ${i}${a}`:t,f=[[o.default.instancePath,(0,n.strConcat)(o.default.instancePath,s)],[o.default.parentData,c.parentData],[o.default.parentDataProperty,c.parentDataProperty],[o.default.rootData,o.default.rootData]];c.opts.dynamicRef&&f.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);const h=n._`${p}, ${r.object(...f)}`;return d!==n.nil?n._`${u}.call(${d}, ${h})`:n._`${u}(${h})`};const l=n._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){const i=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,i);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:n._`${"new RegExp"===o.code?l:(0,a.useFunc)(e,o)}(${r}, ${i})`})},t.validateArray=function(e){const{gen:t,data:r,keyword:o,it:a}=e,s=t.name("valid");if(a.allErrors){const e=t.let("valid",!0);return c(()=>t.assign(e,!1)),e}return t.var(s,!0),c(()=>t.break()),s;function c(a){const c=t.const("len",n._`${r}.length`);t.forRange("i",0,c,r=>{e.subschema({keyword:o,dataProp:r,dataPropType:i.Type.Num},s),t.if((0,n.not)(s),a)})}},t.validateUnion=function(e){const{gen:t,schema:r,keyword:o,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(e=>(0,i.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const s=t.let("valid",!1),c=t.name("_valid");t.block(()=>r.forEach((r,i)=>{const a=e.subschema({keyword:o,schemaProp:i,compositeRule:!0},c);t.assign(s,n._`${s} || ${c}`),e.mergeValidEvaluated(a,c)||t.if((0,n.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}},25532:(e,t)=>{"use strict";function r(e){const t=e.length;let r,n=0,i=0;for(;i<t;)n++,r=e.charCodeAt(i++),r>=55296&&r<=56319&&i<t&&(r=e.charCodeAt(i),56320==(64512&r)&&i++);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},26027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createCapabilityVerifier=t.createCombinedDidResolver=t.createVcJwtSignatureVerifier=t.DEFAULT_TRUSTED_ISSUERS=t.validateLevel2=t.verifyCapabilities=void 0;var n=r(41586);Object.defineProperty(t,"verifyCapabilities",{enumerable:!0,get:function(){return n.verifyCapabilities}}),Object.defineProperty(t,"validateLevel2",{enumerable:!0,get:function(){return n.validateLevel2}}),Object.defineProperty(t,"DEFAULT_TRUSTED_ISSUERS",{enumerable:!0,get:function(){return n.DEFAULT_TRUSTED_ISSUERS}});var i=r(78919);Object.defineProperty(t,"createVcJwtSignatureVerifier",{enumerable:!0,get:function(){return i.createVcJwtSignatureVerifier}}),Object.defineProperty(t,"createCombinedDidResolver",{enumerable:!0,get:function(){return i.createCombinedDidResolver}});var o=r(55750);Object.defineProperty(t,"createCapabilityVerifier",{enumerable:!0,get:function(){return o.createCapabilityVerifier}})},26419:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const n=r(6247),i=r(238),o=r(28425),a=r(38994),s=r(67218);var c;function u(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(c||(t.DataType=c={})),t.getSchemaTypes=function(e){const t=u(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=u,t.coerceAndCheckDataType=function(e,t){const{gen:r,data:n,opts:o}=e,s=function(e,t){return t?e.filter(e=>d.has(e)||"array"===t&&"array"===e):[]}(t,o.coerceTypes),u=t.length>0&&!(0===s.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(u){const i=p(t,n,o.strictNumbers,c.Wrong);r.if(i,()=>{s.length?function(e,t,r){const{gen:n,data:i,opts:o}=e,s=n.let("dataType",a._`typeof ${i}`),c=n.let("coerced",a._`undefined`);"array"===o.coerceTypes&&n.if(a._`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,a._`${i}[0]`).assign(s,a._`typeof ${i}`).if(p(t,i,o.strictNumbers),()=>n.assign(c,i))),n.if(a._`${c} !== undefined`);for(const e of r)(d.has(e)||"array"===e&&"array"===o.coerceTypes)&&u(e);function u(e){switch(e){case"string":return void n.elseIf(a._`${s} == "number" || ${s} == "boolean"`).assign(c,a._`"" + ${i}`).elseIf(a._`${i} === null`).assign(c,a._`""`);case"number":return void n.elseIf(a._`${s} == "boolean" || ${i} === null
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(c,a._`+${i}`);case"integer":return void n.elseIf(a._`${s} === "boolean" || ${i} === null
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,a._`+${i}`);case"boolean":return void n.elseIf(a._`${i} === "false" || ${i} === 0 || ${i} === null`).assign(c,!1).elseIf(a._`${i} === "true" || ${i} === 1`).assign(c,!0);case"null":return n.elseIf(a._`${i} === "" || ${i} === 0 || ${i} === false`),void n.assign(c,null);case"array":n.elseIf(a._`${s} === "string" || ${s} === "number"
|| ${s} === "boolean" || ${i} === null`).assign(c,a._`[${i}]`)}}n.else(),h(e),n.endIf(),n.if(a._`${c} !== undefined`,()=>{n.assign(i,c),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(a._`${t} !== undefined`,()=>e.assign(a._`${t}[${r}]`,n))}(e,c)})}(e,t,s):h(e)})}return u};const d=new Set(["string","number","integer","boolean","null"]);function l(e,t,r,n=c.Correct){const i=n===c.Correct?a.operators.EQ:a.operators.NEQ;let o;switch(e){case"null":return a._`${t} ${i} null`;case"array":o=a._`Array.isArray(${t})`;break;case"object":o=a._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(a._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return a._`typeof ${t} ${i} ${e}`}return n===c.Correct?o:(0,a.not)(o);function s(e=a.nil){return(0,a.and)(a._`typeof ${t} == "number"`,e,r?a._`isFinite(${t})`:a.nil)}}function p(e,t,r,n){if(1===e.length)return l(e[0],t,r,n);let i;const o=(0,s.toHash)(e);if(o.array&&o.object){const e=a._`typeof ${t} != "object"`;i=o.null?e:a._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else i=a.nil;o.number&&delete o.integer;for(const e in o)i=(0,a.and)(i,l(e,t,r,n));return i}t.checkDataType=l,t.checkDataTypes=p;const f={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?a._`{type: ${e}}`:a._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:r,schema:n}=e,i=(0,s.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}(e);(0,o.reportError)(t,f)}t.reportTypeError=h},26904:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OAuthTokenRetrievalService=void 0,t.OAuthTokenRetrievalService=class{config;constructor(e){this.config={...e,logger:e.logger||(()=>{}),retryConfig:{maxRetries:3,retryDelay:1e3,retryBackoff:2,...e.retryConfig}}}async retrieveTokens(e,t){const r=`${this.config.baseUrl}/api/v1/bouncer/delegations/${e}/tokens`;this.config.logger("[OAuthTokenRetrievalService] Retrieving OAuth tokens",{delegationId:e,endpoint:r});let n=null,i=0;for(;i<=this.config.retryConfig.maxRetries;)try{const n=await this.config.fetchProvider(r,{method:"GET",headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!n.ok){const t=await n.json().catch(()=>({}));if(404===n.status||401===n.status)return this.config.logger("[OAuthTokenRetrievalService] Tokens unavailable",{status:n.status,delegationId:e,error:t}),null;const r=t.error?.message||t.error||t.message||`HTTP ${n.status}`;throw new Error(`Token retrieval failed: ${r}`)}const i=await n.json();if(!i.success)return this.config.logger("[OAuthTokenRetrievalService] Token retrieval error response",{delegationId:e,error:i.error}),null;const o=this.mapToIdpTokens(i.data);return this.config.logger("[OAuthTokenRetrievalService] OAuth tokens retrieved successfully",{delegationId:e,expiresAt:new Date(o.expires_at).toISOString(),hasRefreshToken:!!o.refresh_token}),o}catch(t){if(n=t instanceof Error?t:new Error(String(t)),!(i<this.config.retryConfig.maxRetries))return this.config.logger("[OAuthTokenRetrievalService] Max retries exceeded",{delegationId:e,error:n.message,attempts:i+1}),null;{const e=this.config.retryConfig.retryDelay*Math.pow(this.config.retryConfig.retryBackoff,i);this.config.logger("[OAuthTokenRetrievalService] Retry attempt failed, retrying",{attempt:i+1,maxRetries:this.config.retryConfig.maxRetries,delay:e,error:n.message}),await new Promise(t=>setTimeout(t,e)),i++}}return null}mapToIdpTokens(e){let t;return t=e.oauth_expires_at?new Date(e.oauth_expires_at).getTime():e.oauth_expires_in?Date.now()+1e3*e.oauth_expires_in:Date.now()+36e5,{access_token:e.oauth_access_token,refresh_token:e.oauth_refresh_token||void 0,expires_in:e.oauth_expires_in||void 0,expires_at:t,token_type:e.oauth_token_type||"Bearer",scope:e.oauth_scope||void 0}}}},27464:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598),i=r(3508),o=r(39069),a=r(99135),s=r(29994),c=r(71759),u=r(58242);t.default=e=>{let t;if((0,a.isCryptoKey)(e)){if(!e.extractable)throw new TypeError("CryptoKey is not extractable");t=n.KeyObject.from(e)}else{if(!(0,s.default)(e)){if(e instanceof Uint8Array)return{kty:"oct",k:(0,i.encode)(e)};throw new TypeError((0,c.default)(e,...u.types,"Uint8Array"))}t=e}if("secret"!==t.type&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(t.asymmetricKeyType))throw new o.JOSENotSupported("Unsupported key asymmetricKeyType");return t.export({format:"jwk"})}},28261:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class i extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const r=[e[0]];let n=0;for(;n<t.length;)c(r,t[n]),r.push(e[++n]);return new i(r)}t._Code=i,t.nil=new i(""),t._=o;const a=new i("+");function s(e,...t){const r=[d(e[0])];let n=0;for(;n<t.length;)r.push(a),c(r,t[n]),r.push(a,d(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===a){const r=u(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new i(r)}function c(e,t){var r;t instanceof i?e.push(...t._items):t instanceof n?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:d(Array.isArray(r)?r.join(","):r))}function u(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof n||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof n?void 0:`"${e}${t.slice(1)}`}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=s,t.addCodeArg=c,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${e}${t}`},t.stringify=function(e){return new i(d(e))},t.safeStringify=d,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},28425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const n=r(38994),i=r(67218),o=r(86660);function a(e,t){const r=e.const("err",t);e.if(n._`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,n._`[${r}]`),n._`${o.default.vErrors}.push(${r})`),e.code(n._`${o.default.errors}++`)}function s(e,t){const{gen:r,validateName:i,schemaEnv:o}=e;o.$async?r.throw(n._`new ${e.ValidationError}(${t})`):(r.assign(n._`${i}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>n.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?n.str`"${e}" keyword must be ${t} ($data)`:n.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,i,o){const{it:c}=e,{gen:d,compositeRule:l,allErrors:p}=c,f=u(e,r,i);(null!=o?o:l||p)?a(d,f):s(c,n._`[${f}]`)},t.reportExtraError=function(e,r=t.keywordError,n){const{it:i}=e,{gen:c,compositeRule:d,allErrors:l}=i;a(c,u(e,r,n)),d||l||s(i,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if(n._`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(n._`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:i,errsCount:a,it:s}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,o.default.errors,a=>{e.const(c,n._`${o.default.vErrors}[${a}]`),e.if(n._`${c}.instancePath === undefined`,()=>e.assign(n._`${c}.instancePath`,(0,n.strConcat)(o.default.instancePath,s.errorPath))),e.assign(n._`${c}.schemaPath`,n.str`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign(n._`${c}.schema`,r),e.assign(n._`${c}.data`,i))})};const c={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function u(e,t,r){const{createErrors:i}=e.it;return!1===i?n._`{}`:function(e,t,r={}){const{gen:i,it:a}=e,s=[d(a,r),l(e,r)];return function(e,{params:t,message:r},i){const{keyword:a,data:s,schemaValue:u,it:d}=e,{opts:l,propertyName:p,topSchemaRef:f,schemaPath:h}=d;i.push([c.keyword,a],[c.params,"function"==typeof t?t(e):t||n._`{}`]),l.messages&&i.push([c.message,"function"==typeof r?r(e):r]),l.verbose&&i.push([c.schema,u],[c.parentSchema,n._`${f}${h}`],[o.default.data,s]),p&&i.push([c.propertyName,p])}(e,t,s),i.object(...s)}(e,t,r)}function d({errorPath:e},{instancePath:t}){const r=t?n.str`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[o.default.instancePath,(0,n.strConcat)(o.default.instancePath,r)]}function l({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let a=o?t:n.str`${t}/${e}`;return r&&(a=n.str`${a}${(0,i.getErrorPath)(r,i.Type.Str)}`),[c.schemaPath,a]}},28825:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const n=r(51967),i=r(83959),o=r(29376),a=r(7456),s=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends n.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(a,s):a;this.addMetaSchema(e,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}t.Ajv=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var d=r(36023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var l=r(38994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var p=r(74383);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=r(4220);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})},29376:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(15141),o=r(91688),a=r(4220),s=r(67218),c={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>n._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:c,parentSchema:u,it:d}=e,{oneOf:l}=u;if(!d.opts.discriminator)throw new Error("discriminator: requires discriminator option");const p=c.propertyName;if("string"!=typeof p)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=t.let("valid",!1),h=t.const("tag",n._`${r}${(0,n.getProperty)(p)}`);function m(r){const i=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},i);return e.mergeEvaluated(o,n.Name),i}t.if(n._`typeof ${h} == "string"`,()=>function(){const r=function(){var e;const t={},r=i(u);let n=!0;for(let t=0;t<l.length;t++){let u=l[t];if((null==u?void 0:u.$ref)&&!(0,s.schemaHasRulesButRef)(u,d.self.RULES)){const e=u.$ref;if(u=o.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e),u instanceof o.SchemaEnv&&(u=u.schema),void 0===u)throw new a.default(d.opts.uriResolver,d.baseId,e)}const f=null===(e=null==u?void 0:u.properties)||void 0===e?void 0:e[p];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);n=n&&(r||i(u)),c(f,t)}if(!n)throw new Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function c(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(n._`${h} === ${e}`),t.assign(f,m(r[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:h,tagName:p}),t.endIf()}(),()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:h,tagName:p})),e.ok(f)}};t.default=c},29820:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const n=r(38994),i=r(86660),o=r(24954),a=r(28425);function s(e){const{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,n._`${i.parentData}[${i.parentDataProperty}]`))}function c(e,t,r){if(void 0===r)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,n.stringify)(r)})}t.macroKeywordCode=function(e,t){const{gen:r,keyword:i,schema:o,parentSchema:a,it:s}=e,u=t.macro.call(s.self,o,a,s),d=c(r,i,u);!1!==s.opts.validateSchema&&s.self.validateSchema(u,!0);const l=r.name("valid");e.subschema({schema:u,schemaPath:n.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:d,compositeRule:!0},l),e.pass(l,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;const{gen:u,keyword:d,schema:l,parentSchema:p,$data:f,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(h,t);const m=!f&&t.compile?t.compile.call(h.self,l,p,h):t.validate,g=c(u,d,m),v=u.let("valid");function y(r=(t.async?n._`await `:n.nil)){const a=h.opts.passContext?i.default.this:i.default.self,s=!("compile"in t&&!f||!1===t.schema);u.assign(v,n._`${r}${(0,o.callValidateCode)(e,g,a,s)}`,t.modifying)}function _(e){var r;u.if((0,n.not)(null!==(r=t.valid)&&void 0!==r?r:v),e)}e.block$data(v,function(){if(!1===t.errors)y(),t.modifying&&s(e),_(()=>e.error());else{const r=t.async?function(){const e=u.let("ruleErrs",null);return u.try(()=>y(n._`await `),t=>u.assign(v,!1).if(n._`${t} instanceof ${h.ValidationError}`,()=>u.assign(e,n._`${t}.errors`),()=>u.throw(t))),e}():function(){const e=n._`${g}.errors`;return u.assign(e,null),y(n.nil),e}();t.modifying&&s(e),_(()=>function(e,t){const{gen:r}=e;r.if(n._`Array.isArray(${t})`,()=>{r.assign(i.default.vErrors,n._`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,n._`${i.default.vErrors}.length`),(0,a.extendErrors)(e)},()=>e.error())}(e,r))}}),e.ok(null!==(r=t.valid)&&void 0!==r?r:v)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");const a=i.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},29994:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(57975);t.default=e=>n.types.isKeyObject(e)},30005:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompactEncrypt=void 0;const n=r(92599);t.CompactEncrypt=class{_flattened;constructor(e){this._flattened=new n.FlattenedEncrypt(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){const r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}},30131:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedSign=void 0;const n=r(3508),i=r(80903),o=r(91146),a=r(39069),s=r(45935),c=r(89666),u=r(82880);t.FlattenedSign=class{_payload;_protectedHeader;_unprotectedHeader;constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new a.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,o.default)(this._protectedHeader,this._unprotectedHeader))throw new a.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader};let d=!0;if((0,u.default)(a.JWSInvalid,new Map([["b64",!0]]),t?.crit,this._protectedHeader,r).has("b64")&&(d=this._protectedHeader.b64,"boolean"!=typeof d))throw new a.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:l}=r;if("string"!=typeof l||!l)throw new a.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,c.checkKeyTypeWithJwk)(l,e,"sign");let p,f=this._payload;d&&(f=s.encoder.encode((0,n.encode)(f))),p=this._protectedHeader?s.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):s.encoder.encode("");const h=(0,s.concat)(p,s.encoder.encode("."),f),m=await(0,i.default)(l,e,h),g={signature:(0,n.encode)(m),payload:""};return d&&(g.payload=s.decoder.decode(f)),this._unprotectedHeader&&(g.header=this._unprotectedHeader),this._protectedHeader&&(g.protected=s.decoder.decode(p)),g}}},30659:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(68997),i=r(89190),o=r(94280),a=r(78805),s=r(12189),c=r(33138),u=r(48870),d=r(11858),l=r(17080),p=r(65358),f=[n.default,i.default,o.default,a.default,s.default,c.default,u.default,d.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,p.default];t.default=f},30714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const n=r(38994),i=r(67218),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?a(e,n):(0,i.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function a(e,t){const{gen:r,schema:o,data:a,keyword:s,it:c}=e;c.items=!0;const u=r.const("len",n._`${a}.length`);if(!1===o)e.setParams({len:t.length}),e.pass(n._`${u} <= ${t.length}`);else if("object"==typeof o&&!(0,i.alwaysValidSchema)(c,o)){const o=r.var("valid",n._`${u} <= ${t.length}`);r.if((0,n.not)(o),()=>function(o){r.forRange("i",t.length,u,t=>{e.subschema({keyword:s,dataProp:t,dataPropType:i.Type.Num},o),c.allErrors||r.if((0,n.not)(o),()=>r.break())})}(o)),e.ok(o)}}t.validateAdditionalItems=a,t.default=o},30765:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.didWebToUrl=i,t.createDidWebResolver=function(e={}){const t=e.timeoutMs??n,r=e.fetch??(e=>fetch(e,{signal:AbortSignal.timeout(t)}));return{resolve:async e=>{const n=i(e);if(!n)return null;let o,a;try{o=await async function(e,t){let r;const n=new Promise((e,n)=>{r=setTimeout(()=>n(new Error(`did:web fetch timed out after ${t}ms`)),t)});try{return await Promise.race([e,n])}finally{r&&clearTimeout(r)}}(r(n),t)}catch{return null}if(!o.ok)return null;try{a=await o.json()}catch{return null}return"object"==typeof(s=a)&&null!==s&&"string"==typeof s.id?a:null;var s}}};const r="did:web:",n=5e3;function i(e){if(!e.startsWith(r))return null;const t=e.slice(r.length);if(0===t.length)return null;const n=t.split(":");let i,o;try{i=decodeURIComponent(n[0]),o=n.slice(1).map(e=>decodeURIComponent(e))}catch{return null}return 0===i.length||o.some(e=>0===e.length)?null:`https://${i}${0===o.length?"/.well-known/did.json":`/${o.join("/")}/did.json`}`}},30845:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationCredentialIssuer=void 0,t.createDelegationIssuer=function(e,t){return new o(e,t)};const n=r(62408),i=r(63969);class o{identity;signingFunction;constructor(e,t){this.identity=e,this.signingFunction=t}async issueDelegationCredential(e,t={}){let r=(0,n.wrapDelegationAsVC)(e,{id:t.id,issuanceDate:t.issuanceDate,expirationDate:t.expirationDate,credentialStatus:t.credentialStatus});if(t.additionalContexts&&t.additionalContexts.length>0){const e=r["@context"];r={...r,"@context":[...e,...t.additionalContexts]}}const i=this.canonicalizeVC(r),o=await this.signingFunction(i,this.identity.getDid(),this.identity.getKeyId());return{...r,proof:o}}async createAndIssueDelegation(e,t={}){const r=Date.now(),n={id:e.id,issuerDid:e.issuerDid,subjectDid:e.subjectDid,controller:e.controller,vcId:t.id||`urn:uuid:${e.id}`,parentId:e.parentId,constraints:e.constraints,signature:"",status:e.status||"active",createdAt:r,metadata:e.metadata};return this.issueDelegationCredential(n,t)}canonicalizeVC(e){return(0,i.canonicalizeJSON)(e)}getIssuerDid(){return this.identity.getDid()}getIssuerKeyId(){return this.identity.getKeyId()}}t.DelegationCredentialIssuer=o},30930:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const n=r(4220),i=r(24954),o=r(38994),a=r(86660),s=r(91688),c=r(67218),u={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:i}=e,{baseId:a,schemaEnv:c,validateName:u,opts:p,self:f}=i,{root:h}=c;if(("#"===r||"#/"===r)&&a===h.baseId)return function(){if(c===h)return l(e,u,c,c.$async);const r=t.scopeValue("root",{ref:h});return l(e,o._`${r}.validate`,h,h.$async)}();const m=s.resolveRef.call(f,h,a,r);if(void 0===m)throw new n.default(i.opts.uriResolver,a,r);return m instanceof s.SchemaEnv?function(t){const r=d(e,t);l(e,r,t,t.$async)}(m):function(n){const i=t.scopeValue("schema",!0===p.code.source?{ref:n,code:(0,o.stringify)(n)}:{ref:n}),a=t.name("valid"),s=e.subschema({schema:n,dataTypes:[],schemaPath:o.nil,topSchemaRef:i,errSchemaPath:r},a);e.mergeEvaluated(s),e.ok(a)}(m)}};function d(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):o._`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,r,n){const{gen:s,it:u}=e,{allErrors:d,schemaEnv:l,opts:p}=u,f=p.passContext?a.default.this:o.nil;function h(e){const t=o._`${e}.errors`;s.assign(a.default.vErrors,o._`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`),s.assign(a.default.errors,o._`${a.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(n&&!n.dynamicProps)void 0!==n.props&&(u.props=c.mergeEvaluated.props(s,n.props,u.props));else{const t=s.var("props",o._`${e}.evaluated.props`);u.props=c.mergeEvaluated.props(s,t,u.props,o.Name)}if(!0!==u.items)if(n&&!n.dynamicItems)void 0!==n.items&&(u.items=c.mergeEvaluated.items(s,n.items,u.items));else{const t=s.var("items",o._`${e}.evaluated.items`);u.items=c.mergeEvaluated.items(s,t,u.items,o.Name)}}n?function(){if(!l.$async)throw new Error("async schema referenced by sync schema");const r=s.let("valid");s.try(()=>{s.code(o._`await ${(0,i.callValidateCode)(e,t,f)}`),m(t),d||s.assign(r,!0)},e=>{s.if(o._`!(${e} instanceof ${u.ValidationError})`,()=>s.throw(e)),h(e),d||s.assign(r,!1)}),e.ok(r)}():e.result((0,i.callValidateCode)(e,t,f),()=>m(t),()=>h(t))}t.getValidate=d,t.callRef=l,t.default=u},31276:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncryptJWT=void 0;const n=r(30005),i=r(45935),o=r(59333);class a extends o.ProduceJWT{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){const r=new n.CompactEncrypt(i.encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),r.setProtectedHeader(this._protectedHeader),this._iv&&r.setInitializationVector(this._iv),this._cek&&r.setContentEncryptionKey(this._cek),this._keyManagementParameters&&r.setKeyManagementParameters(this._keyManagementParameters),r.encrypt(e,t)}}t.EncryptJWT=a},32139:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={}},32692:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?n.str`must contain at least ${e} valid item(s)`:n.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?n._`{minContains: ${e}}`:n._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:o,data:a,it:s}=e;let c,u;const{minContains:d,maxContains:l}=o;s.opts.next?(c=void 0===d?1:d,u=l):c=1;const p=t.const("len",n._`${a}.length`);if(e.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,i.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,i.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,i.alwaysValidSchema)(s,r)){let t=n._`${p} >= ${c}`;return void 0!==u&&(t=n._`${t} && ${p} <= ${u}`),void e.pass(t)}s.items=!0;const f=t.name("valid");function h(){const e=t.name("_valid"),r=t.let("count",0);m(e,()=>t.if(e,()=>function(e){t.code(n._`${e}++`),void 0===u?t.if(n._`${e} >= ${c}`,()=>t.assign(f,!0).break()):(t.if(n._`${e} > ${u}`,()=>t.assign(f,!1).break()),1===c?t.assign(f,!0):t.if(n._`${e} >= ${c}`,()=>t.assign(f,!0)))}(r)))}function m(r,n){t.forRange("i",0,p,t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:i.Type.Num,compositeRule:!0},r),n()})}void 0===u&&1===c?m(f,()=>t.if(f,()=>t.break())):0===c?(t.let(f,!0),void 0!==u&&t.if(n._`${a}.length > 0`,h)):(t.let(f,!1),h()),e.result(f,()=>e.reset())}};t.default=o},33138:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(24954),i=r(38994),o=r(67218),a={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:a,data:s,$data:c,it:u}=e,{opts:d}=u;if(!c&&0===r.length)return;const l=r.length>=d.loopRequired;if(u.allErrors?function(){if(l||c)e.block$data(i.nil,p);else for(const t of r)(0,n.checkReportMissingProp)(e,t)}():function(){const o=t.let("missing");if(l||c){const r=t.let("valid",!0);e.block$data(r,()=>function(r,o){e.setParams({missingProperty:r}),t.forOf(r,a,()=>{t.assign(o,(0,n.propertyInData)(t,s,r,d.ownProperties)),t.if((0,i.not)(o),()=>{e.error(),t.break()})},i.nil)}(o,r)),e.ok(r)}else t.if((0,n.checkMissingProp)(e,r,o)),(0,n.reportMissingProp)(e,o),t.else()}(),d.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(u,t,u.opts.strictRequired)}}function p(){t.forOf("prop",a,r=>{e.setParams({missingProperty:r}),t.if((0,n.noPropertyInData)(t,s,r,d.ownProperties),()=>e.error())})}}};t.default=a},33330:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=r},33645:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateJwkThumbprint=u,t.calculateJwkThumbprintUri=async function(e,t){t??="sha256";const r=await u(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`};const n=r(17306),i=r(3508),o=r(39069),a=r(45935),s=r(71661),c=(e,t)=>{if("string"!=typeof e||!e)throw new o.JWKInvalid(`${t} missing or invalid`)};async function u(e,t){if(!(0,s.default)(e))throw new TypeError("JWK must be an object");if(t??="sha256","sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let r;switch(e.kty){case"EC":c(e.crv,'"crv" (Curve) Parameter'),c(e.x,'"x" (X Coordinate) Parameter'),c(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":c(e.crv,'"crv" (Subtype of Key Pair) Parameter'),c(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":c(e.e,'"e" (Exponent) Parameter'),c(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":c(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new o.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}const u=a.encoder.encode(JSON.stringify(r));return(0,i.encode)(await(0,n.default)(t,u))}},34119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598),i=r(57975),o=r(17759),a=r(9066),s=r(80903),c=r(47532),u=(0,i.promisify)(n.verify);t.default=async(e,t,r,i)=>{const d=(0,c.default)(e,t,"verify");if(e.startsWith("HS")){const t=await(0,s.default)(e,d,i),o=r;try{return n.timingSafeEqual(o,t)}catch{return!1}}const l=(0,o.default)(e),p=(0,a.default)(e,d);try{return await u(l,i,p,r)}catch{return!1}}},34270:(e,t)=>{"use strict";function r(e){return`agent:${e}:delegation`}function n(e,t,r){return r?`delegation:user:${e}:agent:${t}:project:${r}`:`delegation:user:${e}:agent:${t}`}function i(e){return`session:${e}`}function o(e,t){return`userDid:oauth:${e}:${t}`}function a(e,t){return`oauth:${e}:${t}`}function s(e){return`verified:${e}`}function c(e){return`nonce:${e}`}Object.defineProperty(t,"__esModule",{value:!0}),t.STORAGE_KEYS=void 0,t.legacyDelegationKey=r,t.compositeDelegationKey=n,t.sessionKey=i,t.userDidKey=o,t.oauthIdentityKey=a,t.verificationCacheKey=s,t.nonceKey=c,t.migrateDelegationKeys=async function(e,t={}){const r={migrated:0,failed:0,migrations:[],errors:[]};try{const i=(await e.list("agent:")).filter(e=>e.match(/^agent:[^:]+:delegation$/));console.error(`Found ${i.length} legacy delegation keys to migrate`);for(const o of i)try{const i=o.match(/^agent:([^:]+):delegation$/);if(!i){r.errors.push({key:o,error:"Invalid legacy key format"}),r.failed++;continue}const a=i[1],s=await e.get(o);if(!s)continue;let c,u=null;const d=await e.list("session:");for(const t of d){const r=await e.get(t);if(r)try{const e=JSON.parse(r);if(e.userDid&&e.agentDid===a){u=e.userDid;const r=t.match(/^session:(.+)$/);r&&(c=r[1]);break}}catch{}}if(t.resolveUserDid){const e=await t.resolveUserDid(a,c);e&&(u=e)}if(!u){r.errors.push({key:o,error:"Cannot resolve userDid - skipping migration"}),r.failed++;continue}const l=n(u,a);t.dryRun?(r.migrations.push({oldKey:o,newKey:l}),r.migrated++):(await e.set(l,s),r.migrations.push({oldKey:o,newKey:l}),r.migrated++,t.deleteOldKeys&&await e.delete(o))}catch(e){r.errors.push({key:o,error:e instanceof Error?e.message:String(e)}),r.failed++}}catch(e){r.errors.push({key:"migration",error:e instanceof Error?e.message:String(e)})}return r},t.STORAGE_KEYS={userDid:o,oauthIdentity:a,delegation:n,session:i,legacyDelegation:r,verificationCache:s,nonce:c}},34313:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProviderValidator=t.ProviderValidationError=void 0;const r=["response_type","client_id","redirect_uri","scope","state","code_challenge","code_challenge_method"];class n extends Error{field;constructor(e,t){super(e),this.field=t,this.name="ProviderValidationError"}}t.ProviderValidationError=n,t.ProviderValidator=class{validate(e,t){if(!e.clientId||0===e.clientId.trim().length)throw new n(`Provider "${t}" must have a clientId`,"clientId");if(!e.authorizationUrl||0===e.authorizationUrl.trim().length)throw new n(`Provider "${t}" must have an authorizationUrl`,"authorizationUrl");if(!e.tokenUrl||0===e.tokenUrl.trim().length)throw new n(`Provider "${t}" must have a tokenUrl`,"tokenUrl");if(this.validateUrl(e.authorizationUrl,t,"authorizationUrl"),this.validateUrl(e.tokenUrl,t,"tokenUrl"),e.userInfoUrl&&this.validateUrl(e.userInfoUrl,t,"userInfoUrl"),e.proxyMode&&!e.requiresClientSecret)throw new n(`Provider "${t}" with proxyMode=true must have requiresClientSecret=true`,"proxyMode");e.customParams&&this.validateCustomParams(e.customParams,t)}validateUrl(e,t,r){try{const i=new URL(e);if("http:"!==i.protocol&&"https:"!==i.protocol)throw new n(`Provider "${t}" ${r} must use HTTP or HTTPS protocol`,r)}catch(e){if(e instanceof n)throw e;throw new n(`Provider "${t}" ${r} is not a valid URL: ${e instanceof Error?e.message:String(e)}`,r)}}validateCustomParams(e,t){for(const[i,o]of Object.entries(e)){const e=i.toLowerCase();if(r.includes(e))throw new n(`Provider "${t}" custom parameter "${i}" conflicts with reserved OAuth parameter. Reserved parameters: ${r.join(", ")}`,`customParams.${i}`);if(!o||0===o.trim().length)throw new n(`Provider "${t}" custom parameter "${i}" has empty value`,`customParams.${i}`)}}async testProvider(e,t){try{const r=await t(e.authorizationUrl,{method:"HEAD",signal:AbortSignal.timeout(5e3)});return r.ok||405===r.status}catch(e){return!1}}}},36023:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const n=r(40564),i=r(26419),o=r(238),a=r(26419),s=r(76593),c=r(29820),u=r(3826),d=r(38994),l=r(86660),p=r(89008),f=r(67218),h=r(28425);function m({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,d._`${l.default.data}, ${l.default.valCxt}`,n.$async,()=>{e.code(d._`"use strict"; ${g(r,i)}`),function(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,d._`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,d._`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,d._`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,d._`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,d._`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,d._`""`),e.var(l.default.parentData,d._`undefined`),e.var(l.default.parentDataProperty,d._`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,d._`{}`)})}(e,i),e.code(o)}):e.func(t,d._`${l.default.data}, ${function(e){return d._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?d._`, ${l.default.dynamicAnchors}={}`:d.nil}}={}`}(i)}`,n.$async,()=>e.code(g(r,i)).code(o))}function g(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?d._`/*# sourceURL=${r} */`:d.nil}function v({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function _(e){(0,f.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return $(e,[],!1,t);const r=(0,i.getSchemaTypes)(e.schema);$(e,r,!(0,i.coerceAndCheckDataType)(e,r),t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){const o=r.$comment;if(!0===i.$comment)e.code(d._`${l.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){const r=d.str`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(d._`${l.default.self}.opts.$comment(${o}, ${r}, ${i}.schema)`)}}function $(e,t,r,n){const{gen:i,schema:s,data:c,allErrors:u,opts:p,self:h}=e,{RULES:m}=h;function g(f){(0,o.shouldUseGroup)(s,f)&&(f.type?(i.if((0,a.checkDataType)(f.type,c,p.strictNumbers)),k(e,f),1===t.length&&t[0]===f.type&&r&&(i.else(),(0,a.reportTypeError)(e)),i.endIf()):k(e,f),u||i.if(d._`${l.default.errors} === ${n||0}`))}!s.$ref||!p.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(s,m)?(p.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach(t=>{S(e.dataTypes,t)||I(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const n of e.dataTypes)S(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&I(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const r=e.self.RULES.all;for(const n in r){const i=r[n];if("object"==typeof i&&(0,o.shouldUseRule)(e.schema,i)){const{type:r}=i.definition;r.length&&!r.some(e=>{return n=e,(r=t).includes(n)||"number"===n&&r.includes("integer");var r,n})&&I(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes))}(e,t),i.block(()=>{for(const e of m.rules)g(e);g(m.post)})):i.block(()=>E(e,"$ref",m.all.$ref.definition))}function k(e,t){const{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,s.assignDefaults)(e,t.type),r.block(()=>{for(const r of t.rules)(0,o.shouldUseRule)(n,r)&&E(e,r.keyword,r.definition,t.type)})}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function I(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){y(e)&&(_(e),v(e))?function(e){const{schema:t,opts:r,gen:n}=e;m(e,()=>{r.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(l.default.vErrors,null),n.let(l.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",d._`${r}.evaluated`),t.if(d._`${e.evaluated}.dynamicProps`,()=>t.assign(d._`${e.evaluated}.props`,d._`undefined`)),t.if(d._`${e.evaluated}.dynamicItems`,()=>t.assign(d._`${e.evaluated}.items`,d._`undefined`))}(e),b(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if(d._`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw(d._`new ${i}(${l.default.vErrors})`)):(t.assign(d._`${n}.errors`,l.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof d.Name&&e.assign(d._`${t}.props`,r),n instanceof d.Name&&e.assign(d._`${t}.items`,n)}(e),t.return(d._`${l.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,n.topBoolOrEmptySchema)(e))};class P{constructor(e,t,r){if((0,c.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",T(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",l.default.errors))}result(e,t,r){this.failResult((0,d.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,d.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(d._`${t} !== undefined && (${(0,d.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=d.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=d.nil,t=d.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:i,def:o}=this;r.if((0,d.or)(d._`${n} === undefined`,t)),e!==d.nil&&r.assign(e,!0),(i.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==d.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:i}=this;return(0,d.or)(function(){if(r.length){if(!(t instanceof d.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return d._`${(0,a.checkDataTypes)(e,t,i.opts.strictNumbers,a.DataType.Wrong)}`}return d.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return d._`!${r}(${t})`}return d.nil}())}subschema(e,t){const r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);const i={...this.it,...r,items:void 0,props:void 0};return function(e,t){y(e)&&(_(e),v(e))?function(e,t){const{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&w(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,p.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=n.const("_errs",l.default.errors);b(e,o),n.var(t,d._`${o} === ${l.default.errors}`)}(e,t):(0,n.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=f.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=f.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,d.Name)),!0}}function E(e,t,r,n){const i=new P(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,c.funcKeywordCode)(i,r):"macro"in r?(0,c.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,c.funcKeywordCode)(i,r)}t.KeywordCxt=P;const x=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(""===e)return l.default.rootData;if("/"===e[0]){if(!x.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=l.default.rootData}else{const a=O.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const s=+a[1];if(i=a[2],"#"===i){if(s>=t)throw new Error(c("property/index",s));return n[t-s]}if(s>t)throw new Error(c("data",s));if(o=r[t-s],!i)return o}let a=o;const s=i.split("/");for(const e of s)e&&(o=d._`${o}${(0,d.getProperty)((0,f.unescapeJsonPointer)(e))}`,a=d._`${a} && ${o}`);return a;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=T},36796:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryResumeTokenStore=void 0,t.generateResumeToken=o,t.verifyOrHints=async function(e,t,r,n){const o=Date.now();let s,c;if(r.debug&&i.logger.debug(`[AuthHandshake] Verifying ${e} for scopes: ${t.join(", ")}`),r.kta&&void 0!==r.bouncer.minReputationScore)try{if(s=await async function(e,t){const r=t.apiUrl.replace(/\/$/,""),n={"Content-Type":"application/json"};let i;if(t.apiKey&&(n["X-API-Key"]=t.apiKey),i="argus"===t.apiFormat?await fetch(`${r}/v1/reputation/${encodeURIComponent(e)}`,{method:"POST",headers:n,body:JSON.stringify({include_details:!1})}):await fetch(`${r}/api/v1/reputation/${encodeURIComponent(e)}`,{method:"GET",headers:n}),!i.ok){if(404===i.status)return{agentDid:e,score:50,totalInteractions:0,successRate:0,riskLevel:"unknown",updatedAt:Date.now()};throw new Error(`KTA API error: ${i.status} ${i.statusText}`)}const o=await i.json(),a=o.score??50,s=(o.level??o.riskLevel??"unknown").toLowerCase(),c="low"===s||"medium"===s||"high"===s?s:"unknown";return{agentDid:o.agent_did??o.agentDid??e,score:a,totalInteractions:o.totalInteractions??0,successRate:o.successRate??0,riskLevel:c,updatedAt:o.calculatedAt?new Date(o.calculatedAt).getTime():o.updatedAt??Date.now()}}(e,r.kta),r.debug&&i.logger.debug(`[AuthHandshake] Reputation score: ${s.score}`),s.score<r.bouncer.minReputationScore)return r.debug&&i.logger.debug(`[AuthHandshake] Reputation ${s.score} < ${r.bouncer.minReputationScore}, requiring authorization`),{authorized:!1,authError:await a(e,t,r,"Agent reputation score below threshold"),reputation:s,reason:"Low reputation score"}}catch(e){i.logger.warn("[AuthHandshake] Failed to check reputation:",e)}try{c=await r.delegationVerifier.verify(e,t)}catch(n){i.logger.error("[AuthHandshake] Delegation verification failed:",n);const o=`Delegation verification error: ${n instanceof Error?n.message:"Unknown error"}`;return{authorized:!1,authError:await a(e,t,r,o),reason:o}}return c.valid&&c.delegation?(r.debug&&i.logger.debug(`[AuthHandshake] Delegation valid, authorized (${Date.now()-o}ms)`),{authorized:!0,delegation:c.delegation,credential:c.credential,reputation:s,reason:"Valid delegation found"}):(r.debug&&i.logger.debug(`[AuthHandshake] No delegation found, returning needs_authorization (${Date.now()-o}ms)`),{authorized:!1,authError:await a(e,t,r,c.reason??"No valid delegation found"),reputation:s,reason:c.reason??"No delegation"})},t.hasSensitiveScopes=function(e){const t=["write","delete","admin","payment","transfer","execute","modify"];return e.some(e=>t.some(t=>e.toLowerCase().includes(t)))};const n=r(3051),i=r(76140);function o(e="rt"){if("undefined"!=typeof crypto&&crypto.getRandomValues){const t=new Uint8Array(16);crypto.getRandomValues(t);let r="";for(let e=0;e<t.length;e++)r+=t[e].toString(16).padStart(2,"0");return`${e}_${r}`}if("undefined"!=typeof crypto&&crypto.randomUUID)return`${e}_${crypto.randomUUID().replace(/-/g,"")}`;throw new Error("CSPRNG unavailable: cannot mint resume token")}async function a(e,t,r,i){const o=await r.resumeTokenStore.create(e,t,{requestedAt:Date.now()}),a=Date.now()+(r.bouncer.resumeTokenTtl??6e5),s=new URL(r.bouncer.authorizationUrl);s.searchParams.set("agent_did",e),s.searchParams.set("scopes",t.join(",")),s.searchParams.set("resume_token",o);const c={title:"Authorization Required",hint:["link","qr"],authorizationCode:o.substring(0,8).toUpperCase(),qrUrl:`https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl=${encodeURIComponent(s.toString())}`};return(0,n.createNeedsAuthorizationError)({message:i,authorizationUrl:s.toString(),resumeToken:o,expiresAt:a,scopes:t,display:c})}t.MemoryResumeTokenStore=class{tokens=new Map;ttl;constructor(e=6e5){this.ttl=e}async create(e,t,r){const n=o("rt"),i=Date.now();return this.tokens.set(n,{agentDid:e,scopes:t,createdAt:i,expiresAt:i+this.ttl,metadata:r,fulfilled:!1}),n}async get(e){const t=this.tokens.get(e);return t?Date.now()>t.expiresAt?(this.tokens.delete(e),null):t.fulfilled?null:{agentDid:t.agentDid,scopes:t.scopes,createdAt:t.createdAt,expiresAt:t.expiresAt,metadata:t.metadata}:null}async fulfill(e){const t=this.tokens.get(e);t&&(t.fulfilled=!0)}clear(){this.tokens.clear()}}},37067:e=>{"use strict";e.exports=require("node:http")},37249:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationErrorFormatter=void 0,t.createDelegationErrorFormatter=function(e){return new n(e)};const r={message:'Authorization required for "{toolName}".\n\nAuthorization URL: {consentUrl}\n\nShare this URL with the user so they can authorize in their browser, then retry.',noUrlMessage:'Authorization required for "{toolName}" but no consent URL is available.\n\nPlease contact the administrator to configure delegation for this tool.',oauthMessage:'Authorization required for "{toolName}".\n\nSign in with {provider}: {oauthUrl}\n\nShare this URL with the user so they can sign in with {provider}, then retry.',noOAuthUrlMessage:'Authorization required for "{toolName}" but no {provider} URL is available.\n\nPlease contact the administrator to configure OAuth for this tool.',supportsMarkdown:!0};class n{config;constructor(e){this.config=e}setConfig(e){this.config=e}format(e){const{toolName:t,consentUrl:n,scopes:i,clientId:o}=e,a=this.getTemplate(o),s=this.buildUrl(n,a);let c;if(s){const e=a.message??r.message;c=this.interpolate(e,{toolName:t,consentUrl:s,scopes:i?.join(", ")??""}),!1===a.supportsMarkdown&&(c=this.stripMarkdownLinks(c))}else{const e=a.noUrlMessage??r.noUrlMessage;c=this.interpolate(e,{toolName:t,consentUrl:"",scopes:i?.join(", ")??""})}return{message:c,consentUrl:s}}formatOAuth(e){const{toolName:t,oauthUrl:n,provider:i="OAuth",scopes:o,clientId:a}=e,s=this.getTemplate(a),c=this.buildUrl(n,s);let u;if(c){const e=s.oauthMessage??r.oauthMessage;u=this.interpolate(e,{toolName:t,oauthUrl:c,provider:i,scopes:o?.join(", ")??""}),!1===s.supportsMarkdown&&(u=this.stripMarkdownLinks(u))}else{const e=s.noOAuthUrlMessage??r.noOAuthUrlMessage;u=this.interpolate(e,{toolName:t,oauthUrl:"",provider:i,scopes:o?.join(", ")??""})}return{message:u,oauthUrl:c}}getTemplate(e){const t=this.config?.default??{};return e&&this.config?.clients?.[e]?{...r,...t,...this.config.clients[e]}:{...r,...t}}buildUrl(e,t){if(e){if(!t.extraParams||0===Object.keys(t.extraParams).length)return e;try{const r=new URL(e);for(const[e,n]of Object.entries(t.extraParams))r.searchParams.set(e,n);return r.toString()}catch{return e}}}interpolate(e,t){let r=e;for(const[e,n]of Object.entries(t))r=r.replace(new RegExp(`\\{${e}\\}`,"g"),()=>n);return r}stripMarkdownLinks(e){return e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1: $2")}}t.DelegationErrorFormatter=n},37329:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateSecret=async function(e,t){let r;switch(e){case"HS256":case"HS384":case"HS512":case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128KW":case"A192KW":case"A256KW":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new a.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return(0,n.createSecretKey)((0,o.default)(new Uint8Array(r>>3)))},t.generateKeyPair=async function(e,t){switch(e){case"RS256":case"RS384":case"RS512":case"PS256":case"PS384":case"PS512":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":case"RSA1_5":{const e=t?.modulusLength??2048;if("number"!=typeof e||e<2048)throw new a.JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return await s("rsa",{modulusLength:e,publicExponent:65537})}case"ES256":return s("ec",{namedCurve:"P-256"});case"ES256K":return s("ec",{namedCurve:"secp256k1"});case"ES384":return s("ec",{namedCurve:"P-384"});case"ES512":return s("ec",{namedCurve:"P-521"});case"Ed25519":return s("ed25519");case"EdDSA":switch(t?.crv){case void 0:case"Ed25519":return s("ed25519");case"Ed448":return s("ed448");default:throw new a.JOSENotSupported("Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448")}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const e=t?.crv??"P-256";switch(e){case void 0:case"P-256":case"P-384":case"P-521":return s("ec",{namedCurve:e});case"X25519":return s("x25519");case"X448":return s("x448");default:throw new a.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}}default:throw new a.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}};const n=r(77598),i=r(57975),o=r(84641),a=r(39069),s=(0,i.promisify)(n.generateKeyPair)},38563:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=[r(40424).default];t.default=n},38926:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OAuthRequiredError=void 0;class r extends Error{toolName;requiredScopes;provider;oauthUrl;resumeToken;userDid;sessionId;authType;constructor(e){const{toolName:t,requiredScopes:r,provider:n,oauthUrl:i}=e;super(`OAuth required for tool "${t}" with provider "${n}". Required scopes: ${r.join(", ")}`),this.name="OAuthRequiredError",this.toolName=t,this.requiredScopes=r,this.provider=n,this.oauthUrl=i,this.resumeToken=e.resumeToken,this.userDid=e.userDid,this.sessionId=e.sessionId,this.authType=e.authType}}t.OAuthRequiredError=r},38994:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const n=r(28261),i=r(44490);var o=r(28261);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var a=r(44490);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),t.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class c extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const r=e?i.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=A(this.rhs,e,t)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class u extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof n.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=A(this.rhs,e,t),this}get names(){return T(this.lhs instanceof n.Name?{}:{...this.lhs.names},this.rhs)}}class d extends u{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class f extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=A(this.code,e,t),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class m extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const i=r[n];i.optimizeNames(e,t)||(C(e,i.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>O(e,t.names),{})}}class g extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends m{}class y extends g{}y.kind="else";class _ extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(j(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=A(this.condition,e,t),this}get names(){const e=super.names;return T(e,this.condition),this.else&&O(e,this.else.names),e}}_.kind="if";class b extends g{}b.kind="for";class w extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=A(this.iteration,e,t),this}get names(){return O(super.names,this.iteration.names)}}class $ extends b{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?i.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){const e=T(super.names,this.from);return T(e,this.to)}}class k extends b{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=A(this.iterable,e,t),this}get names(){return O(super.names,this.iterable.names)}}class S extends g{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class I extends m{render(e){return"return "+super.render(e)}}I.kind="return";class P extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&O(e,this.catch.names),this.finally&&O(e,this.finally.names),e}}class E extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}E.kind="catch";class x extends g{render(e){return"finally"+super.render(e)}}function O(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,t){return t instanceof n._CodeOrName?O(e,t.names):e}function A(e,t,r){return e instanceof n.Name?o(e):(i=e)instanceof n._Code&&i._items.some(e=>e instanceof n.Name&&1===t[e.str]&&void 0!==r[e.str])?new n._Code(e._items.reduce((e,t)=>(t instanceof n.Name&&(t=o(t)),t instanceof n._Code?e.push(...t._items):e.push(t),e),[])):e;var i;function o(e){const n=r[e.str];return void 0===n||1!==t[e.str]?e:(delete t[e.str],n)}}function C(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function j(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:n._`!${R(e)}`}x.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const i=this._scope.toName(t);return void 0!==r&&n&&(this._constants[i.str]=r),this._leafNode(new c(e,i,r)),i}const(e,t,r){return this._def(i.varKinds.const,e,t,r)}let(e,t,r){return this._def(i.varKinds.let,e,t,r)}var(e,t,r){return this._def(i.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new d(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==n.nil&&this._leafNode(new h(e)),this}object(...e){const t=["{"];for(const[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0,n.addCodeArg)(t,i));return t.push("}"),new n._Code(t)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(_,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,n,o=(this.opts.es5?i.varKinds.var:i.varKinds.let)){const a=this._scope.toName(e);return this._for(new $(o,a,t,r),()=>n(a))}forOf(e,t,r,o=i.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=t instanceof n.Name?t:this.var("_arr",t);return this.forRange("_i",0,n._`${e}.length`,t=>{this.var(a,n._`${e}[${t}]`),r(a)})}return this._for(new k("of",o,a,t),()=>r(a))}forIn(e,t,r,o=(this.opts.es5?i.varKinds.var:i.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,n._`Object.keys(${t})`,r);const a=this._scope.toName(e);return this._for(new k("in",o,a,t),()=>r(a))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new p(e))}return(e){const t=new I;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(I)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new P;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new E(e),t(e)}return r&&(this._currNode=n.finally=new x,this.code(r)),this._endBlockNode(E,x)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=n.nil,r,i){return this._blockNode(new S(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=j;const D=N(t.operators.AND);t.and=function(...e){return e.reduce(D)};const z=N(t.operators.OR);function N(e){return(t,r)=>t===n.nil?r:r===n.nil?t:n._`${R(t)} ${e} ${R(r)}`}function R(e){return e instanceof n.Name?e:n._`(${e})`}t.or=function(...e){return e.reduce(z)}},39069:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JWSSignatureVerificationFailed=t.JWKSTimeout=t.JWKSMultipleMatchingKeys=t.JWKSNoMatchingKey=t.JWKSInvalid=t.JWKInvalid=t.JWTInvalid=t.JWSInvalid=t.JWEInvalid=t.JWEDecryptionFailed=t.JOSENotSupported=t.JOSEAlgNotAllowed=t.JWTExpired=t.JWTClaimValidationFailed=t.JOSEError=void 0;class r extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}t.JOSEError=r,t.JWTClaimValidationFailed=class extends r{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}},t.JWTExpired=class extends r{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}},t.JOSEAlgNotAllowed=class extends r{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},t.JOSENotSupported=class extends r{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},t.JWEDecryptionFailed=class extends r{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}},t.JWEInvalid=class extends r{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"},t.JWSInvalid=class extends r{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"},t.JWTInvalid=class extends r{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"},t.JWKInvalid=class extends r{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"},t.JWKSInvalid=class extends r{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"},t.JWKSNoMatchingKey=class extends r{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t)}};class n extends r{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}t.JWKSMultipleMatchingKeys=n,t.JWKSTimeout=class extends r{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",t){super(e,t)}},t.JWSSignatureVerificationFailed=class extends r{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}},39409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compactVerify=async function(e,t,r){if(e instanceof Uint8Array&&(e=o.decoder.decode(e)),"string"!=typeof e)throw new i.JWSInvalid("Compact JWS must be a string or Uint8Array");const{0:a,1:s,2:c,length:u}=e.split(".");if(3!==u)throw new i.JWSInvalid("Invalid Compact JWS");const d=await(0,n.flattenedVerify)({payload:s,protected:a,signature:c},t,r),l={payload:d.payload,protectedHeader:d.protectedHeader};return"function"==typeof t?{...l,key:d.key}:l};const n=r(55403),i=r(39069),o=r(45935)},39940:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProofVerifier=void 0;const n=r(20860),i=r(52864);t.ProofVerifier=class{config;fetch;difVerifier;constructor(e){this.config=e,this.fetch=e.fetchProvider}getDifVerifier(){return this.difVerifier||(this.difVerifier=(0,i.loadDifCore)().then(e=>{const t={cryptoProvider:this.config.cryptoProvider,clockProvider:this.config.clockProvider,nonceCacheProvider:this.config.nonceCacheProvider,fetchProvider:this.config.fetchProvider,timestampSkewSeconds:this.config.timestampSkewSeconds??300,nonceTtlSeconds:this.config.nonceTtlSeconds??300};return new e.ProofVerifier(t)})),this.difVerifier}async verifyProof(e,t){const r=await this.getDifVerifier(),n=this.buildCanonicalPayload(e.meta);return r.verifyProofDetached(e,n,t)}async verifyProofDetached(e,t,r){return(await this.getDifVerifier()).verifyProofDetached(e,t,r)}async fetchPublicKeyFromDID(e,t){try{const r=await this.fetch.resolveDID(e);if(!r)throw new n.ProofVerificationError(n.PROOF_VERIFICATION_ERROR_CODES.DID_DOCUMENT_NOT_FOUND,`DID document not found: ${e}`,{did:e});if(!r.verificationMethod||0===r.verificationMethod.length)throw new n.ProofVerificationError(n.PROOF_VERIFICATION_ERROR_CODES.VERIFICATION_METHOD_NOT_FOUND,`No verification methods found in DID document: ${e}`,{did:e});let i;if(t){const o=t.startsWith("#")?t:`#${t}`;if(i=r.verificationMethod.find(t=>t.id===o||t.id===`${e}${o}`),!i)throw new n.ProofVerificationError(n.PROOF_VERIFICATION_ERROR_CODES.VERIFICATION_METHOD_NOT_FOUND,`Verification method not found for kid: ${t}`,{did:e,kid:t,availableKids:r.verificationMethod.map(e=>e.id)})}else i=r.verificationMethod[0];if(!i?.publicKeyJwk)throw new n.ProofVerificationError(n.PROOF_VERIFICATION_ERROR_CODES.PUBLIC_KEY_NOT_FOUND,"Public key JWK not found in verification method",{did:e,kid:t,verificationMethodId:i?.id});const o=i.publicKeyJwk;if("OKP"!==o.kty||"Ed25519"!==o.crv||!o.x)throw new n.ProofVerificationError(n.PROOF_VERIFICATION_ERROR_CODES.INVALID_JWK_FORMAT,`Unsupported key type or curve: kty=${o.kty}, crv=${o.crv}`,{did:e,kid:t,jwk:{kty:o.kty,crv:o.crv}});return o}catch(r){if(r instanceof n.ProofVerificationError)throw r;throw console.error("[ProofVerifier] Failed to fetch public key from DID:",r),new n.ProofVerificationError(n.PROOF_VERIFICATION_ERROR_CODES.DID_RESOLUTION_FAILED,`DID resolution failed: ${r instanceof Error?r.message:String(r)}`,{did:e,kid:t,originalError:r instanceof Error?r.message:String(r)})}}buildCanonicalPayload(e){const t={aud:e.audience,sub:e.did,iss:e.did,did:e.did,kid:e.kid,audience:e.audience,requestHash:e.requestHash,responseHash:e.responseHash,ts:e.ts,nonce:e.nonce,sessionId:e.sessionId,...e.scopeId&&{scopeId:e.scopeId},...e.delegationRef&&{delegationRef:e.delegationRef},...e.clientDid&&{clientDid:e.clientDid},...e.toolName&&{toolName:e.toolName},...e.submissionOutcome&&{outcome:e.submissionOutcome}};return JSON.stringify(t)}}},40424:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>n.str`must match format "${e}"`,params:({schemaCode:e})=>n._`{format: ${e}}`},code(e,t){const{gen:r,data:i,$data:o,schema:a,schemaCode:s,it:c}=e,{opts:u,errSchemaPath:d,schemaEnv:l,self:p}=c;u.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:p.formats,code:u.code.formats}),a=r.const("fDef",n._`${o}[${s}]`),c=r.let("fType"),d=r.let("format");r.if(n._`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>r.assign(c,n._`${a}.type || "string"`).assign(d,n._`${a}.validate`),()=>r.assign(c,n._`"string"`).assign(d,a)),e.fail$data((0,n.or)(!1===u.strictSchema?n.nil:n._`${s} && !${d}`,function(){const e=l.$async?n._`(${a}.async ? await ${d}(${i}) : ${d}(${i}))`:n._`${d}(${i})`,r=n._`(typeof ${d} == "function" ? ${e} : ${d}.test(${i}))`;return n._`${d} && ${d} !== true && ${c} === ${t} && !${r}`}()))}():function(){const o=p.formats[a];if(!o)return void function(){if(!1!==u.strictSchema)throw new Error(e());function e(){return`unknown format "${a}" ignored in schema at path "${d}"`}p.logger.warn(e())}();if(!0===o)return;const[s,c,f]=function(e){const t=e instanceof RegExp?(0,n.regexpCode)(e):u.code.formats?n._`${u.code.formats}${(0,n.getProperty)(a)}`:void 0,i=r.scopeValue("formats",{key:a,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,n._`${i}.validate`]}(o);s===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!l.$async)throw new Error("async format in sync schema");return n._`await ${f}(${i})`}return"function"==typeof c?n._`${f}(${i})`:n._`${f}.test(${i})`}())}())}};t.default=i},40554:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(72425),i=r(50550),o=r(7918),a=r(80338),s=r(3508),c=r(32139),u=r(94726),d=r(39069),l=r(72545),p=r(89666),f=r(6093);t.default=async function(e,t,r,h,m={}){let g,v,y;switch((0,p.default)(e,r,"encrypt"),r=await(c.default.normalizePublicKey?.(r,e))||r,e){case"dir":y=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!i.ecdhAllowed(r))throw new d.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:o,apv:a}=m;let{epk:c}=m;c||=(await i.generateEpk(r)).privateKey;const{x:p,y:f,crv:_,kty:b}=await(0,l.exportJWK)(c),w=await i.deriveKey(r,c,"ECDH-ES"===e?t:e,"ECDH-ES"===e?(0,u.bitLength)(t):parseInt(e.slice(-5,-2),10),o,a);if(v={epk:{x:p,crv:_,kty:b}},"EC"===b&&(v.epk.y=f),o&&(v.apu=(0,s.encode)(o)),a&&(v.apv=(0,s.encode)(a)),"ECDH-ES"===e){y=w;break}y=h||(0,u.default)(t);const $=e.slice(-6);g=await(0,n.wrap)($,w,y);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":y=h||(0,u.default)(t),g=await(0,a.encrypt)(e,r,y);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{y=h||(0,u.default)(t);const{p2c:n,p2s:i}=m;({encryptedKey:g,...v}=await(0,o.encrypt)(e,r,y,n,i));break}case"A128KW":case"A192KW":case"A256KW":y=h||(0,u.default)(t),g=await(0,n.wrap)(e,r,y);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{y=h||(0,u.default)(t);const{iv:n}=m;({encryptedKey:g,...v}=await(0,f.wrap)(e,r,y,n));break}default:throw new d.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:y,encryptedKey:g,parameters:v}}},40564:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const n=r(28425),i=r(38994),o=r(86660),a={message:"boolean schema is false"};function s(e,t){const{gen:r,data:i}=e,o={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,n.reportError)(o,a,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:r,validateName:n}=e;!1===r?s(e,!1):"object"==typeof r&&!0===r.$async?t.return(o.default.data):(t.assign(i._`${n}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),s(e)):r.var(t,!0)}},41082:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.ProviderValidator=t.CredentialAuthModeError=t.ConsentOnlyModeError=t.ProviderResolver=t.OAuthProviderRegistry=t.MINTABLE_AUTH_TYPES=t.isUnsatisfiableAuthType=t.normalizeAuthType=t.authTypeSatisfies=t.ToolContextBuilder=t.defaultSecretResolver=t.OAuthService=t.OAuthConfigService=t.createSessionRegistrationService=t.SessionRegistrationService=t.authorizationMatches=t.AccessControlApiService=t.ProofVerifier=t.CryptoService=t.PolicyService=t.ToolProtectionService=t.terminalForToolResult=t.terminalForToolError=t.recordRuntimeDelegationAudit=t.recordRuntimeConsentAudit=t.createHmacRuntimeAuditContextFactory=t.beginRuntimeToolAudit=t.attachRuntimeAuditMetadata=t.RuntimeToolAuditInvocation=t.toNeedsAuthorization=t.normalizeInternalToolName=t.isInternalToolName=t.recordWireForm=t.LEGACY_WELL_KNOWN_IDENTITY_PATH=t.WELL_KNOWN_IDENTITY_PATH=t.LEGACY_INTERNAL_TOOL_PREFIX=t.INTERNAL_TOOL_PREFIX=t.LEGACY_SESSION_ID_PREFIX=t.SESSION_ID_PREFIX=t.CONSENT_UI_RESOURCE_URI=t.MCPIRuntimeBase=t.MemoryIdentityProvider=t.MemoryNonceCacheProvider=t.MemoryStorageProvider=t.IdentityProvider=t.NonceCacheProvider=t.StorageProvider=t.FetchProvider=t.ClockProvider=t.CryptoProvider=void 0,t.createHandshakeRequest=t.SessionManager=t.extractCanonicalData=t.createProofResponse=t.ProofGenerator=t.createDefaultConsoleLogger=t.logger=t.IdpTokenResolver=t.UserDidManager=t.isPolicyEnabled=t.hasMergedPolicy=t.extractPolicy=t.getPolicy=t.hasMergedToolProtections=t.extractToolProtections=t.getToolProtection=t.fetchRemoteConfig=t.bytesToBase64=t.base64urlDecodeToString=t.base64urlDecodeToBytes=t.base64urlEncodeFromString=t.base64urlEncodeFromBytes=t.getSchemaStats=t.getCriticalSchemas=t.getSchemaById=t.getSchemasByCategory=t.getAllSchemas=t.SCHEMA_REGISTRY=t.createSchemaVerifier=t.SchemaVerifier=t.isValidBase58=t.base58Decode=t.base58Encode=t.createDelegationErrorFormatter=t.DelegationErrorFormatter=t.OAuthRequiredError=t.DelegationRequiredError=t.NoOpToolProtectionCache=t.InMemoryToolProtectionCache=t.createProofVerificationError=t.PROOF_VERIFICATION_ERROR_CODES=t.ProofVerificationError=t.migrateLegacyKeys=t.StorageKeyHelpers=t.createStorageProviders=t.NoOpOAuthConfigCache=t.InMemoryOAuthConfigCache=t.BatchDelegationService=t.OAuthTokenRetrievalService=t.ProviderValidationError=void 0,t.generateResumeToken=t.MemoryResumeTokenStore=t.hasSensitiveScopes=t.verifyOrHints=t.validateHandshakeFormat=void 0;var o=r(3842);Object.defineProperty(t,"CryptoProvider",{enumerable:!0,get:function(){return o.CryptoProvider}}),Object.defineProperty(t,"ClockProvider",{enumerable:!0,get:function(){return o.ClockProvider}}),Object.defineProperty(t,"FetchProvider",{enumerable:!0,get:function(){return o.FetchProvider}}),Object.defineProperty(t,"StorageProvider",{enumerable:!0,get:function(){return o.StorageProvider}}),Object.defineProperty(t,"NonceCacheProvider",{enumerable:!0,get:function(){return o.NonceCacheProvider}}),Object.defineProperty(t,"IdentityProvider",{enumerable:!0,get:function(){return o.IdentityProvider}});var a=r(52884);Object.defineProperty(t,"MemoryStorageProvider",{enumerable:!0,get:function(){return a.MemoryStorageProvider}}),Object.defineProperty(t,"MemoryNonceCacheProvider",{enumerable:!0,get:function(){return a.MemoryNonceCacheProvider}}),Object.defineProperty(t,"MemoryIdentityProvider",{enumerable:!0,get:function(){return a.MemoryIdentityProvider}});var s=r(24904);Object.defineProperty(t,"MCPIRuntimeBase",{enumerable:!0,get:function(){return s.MCPIRuntimeBase}});var c=r(72199);Object.defineProperty(t,"CONSENT_UI_RESOURCE_URI",{enumerable:!0,get:function(){return c.CONSENT_UI_RESOURCE_URI}});var u=r(51713);Object.defineProperty(t,"SESSION_ID_PREFIX",{enumerable:!0,get:function(){return u.SESSION_ID_PREFIX}}),Object.defineProperty(t,"LEGACY_SESSION_ID_PREFIX",{enumerable:!0,get:function(){return u.LEGACY_SESSION_ID_PREFIX}}),Object.defineProperty(t,"INTERNAL_TOOL_PREFIX",{enumerable:!0,get:function(){return u.INTERNAL_TOOL_PREFIX}}),Object.defineProperty(t,"LEGACY_INTERNAL_TOOL_PREFIX",{enumerable:!0,get:function(){return u.LEGACY_INTERNAL_TOOL_PREFIX}}),Object.defineProperty(t,"WELL_KNOWN_IDENTITY_PATH",{enumerable:!0,get:function(){return u.WELL_KNOWN_IDENTITY_PATH}}),Object.defineProperty(t,"LEGACY_WELL_KNOWN_IDENTITY_PATH",{enumerable:!0,get:function(){return u.LEGACY_WELL_KNOWN_IDENTITY_PATH}}),Object.defineProperty(t,"recordWireForm",{enumerable:!0,get:function(){return u.recordWireForm}}),Object.defineProperty(t,"isInternalToolName",{enumerable:!0,get:function(){return u.isInternalToolName}}),Object.defineProperty(t,"normalizeInternalToolName",{enumerable:!0,get:function(){return u.normalizeInternalToolName}});var d=r(12500);Object.defineProperty(t,"toNeedsAuthorization",{enumerable:!0,get:function(){return d.toNeedsAuthorization}});var l=r(314);Object.defineProperty(t,"RuntimeToolAuditInvocation",{enumerable:!0,get:function(){return l.RuntimeToolAuditInvocation}}),Object.defineProperty(t,"attachRuntimeAuditMetadata",{enumerable:!0,get:function(){return l.attachRuntimeAuditMetadata}}),Object.defineProperty(t,"beginRuntimeToolAudit",{enumerable:!0,get:function(){return l.beginRuntimeToolAudit}}),Object.defineProperty(t,"createHmacRuntimeAuditContextFactory",{enumerable:!0,get:function(){return l.createHmacRuntimeAuditContextFactory}}),Object.defineProperty(t,"recordRuntimeConsentAudit",{enumerable:!0,get:function(){return l.recordRuntimeConsentAudit}}),Object.defineProperty(t,"recordRuntimeDelegationAudit",{enumerable:!0,get:function(){return l.recordRuntimeDelegationAudit}}),Object.defineProperty(t,"terminalForToolError",{enumerable:!0,get:function(){return l.terminalForToolError}}),Object.defineProperty(t,"terminalForToolResult",{enumerable:!0,get:function(){return l.terminalForToolResult}}),i(r(42612),t);var p=r(94284);Object.defineProperty(t,"ToolProtectionService",{enumerable:!0,get:function(){return p.ToolProtectionService}});var f=r(43612);Object.defineProperty(t,"PolicyService",{enumerable:!0,get:function(){return f.PolicyService}});var h=r(9443);Object.defineProperty(t,"CryptoService",{enumerable:!0,get:function(){return h.CryptoService}});var m=r(39940);Object.defineProperty(t,"ProofVerifier",{enumerable:!0,get:function(){return m.ProofVerifier}});var g=r(47848);Object.defineProperty(t,"AccessControlApiService",{enumerable:!0,get:function(){return g.AccessControlApiService}}),Object.defineProperty(t,"authorizationMatches",{enumerable:!0,get:function(){return g.authorizationMatches}});var v=r(16456);Object.defineProperty(t,"SessionRegistrationService",{enumerable:!0,get:function(){return v.SessionRegistrationService}}),Object.defineProperty(t,"createSessionRegistrationService",{enumerable:!0,get:function(){return v.createSessionRegistrationService}});var y=r(11458);Object.defineProperty(t,"OAuthConfigService",{enumerable:!0,get:function(){return y.OAuthConfigService}});var _=r(51606);Object.defineProperty(t,"OAuthService",{enumerable:!0,get:function(){return _.OAuthService}}),Object.defineProperty(t,"defaultSecretResolver",{enumerable:!0,get:function(){return _.defaultSecretResolver}});var b=r(7661);Object.defineProperty(t,"ToolContextBuilder",{enumerable:!0,get:function(){return b.ToolContextBuilder}});var w=r(73214);Object.defineProperty(t,"authTypeSatisfies",{enumerable:!0,get:function(){return w.authTypeSatisfies}}),Object.defineProperty(t,"normalizeAuthType",{enumerable:!0,get:function(){return w.normalizeAuthType}}),Object.defineProperty(t,"isUnsatisfiableAuthType",{enumerable:!0,get:function(){return w.isUnsatisfiableAuthType}}),Object.defineProperty(t,"MINTABLE_AUTH_TYPES",{enumerable:!0,get:function(){return w.MINTABLE_AUTH_TYPES}});var $=r(53898);Object.defineProperty(t,"OAuthProviderRegistry",{enumerable:!0,get:function(){return $.OAuthProviderRegistry}});var k=r(44645);Object.defineProperty(t,"ProviderResolver",{enumerable:!0,get:function(){return k.ProviderResolver}}),Object.defineProperty(t,"ConsentOnlyModeError",{enumerable:!0,get:function(){return k.ConsentOnlyModeError}}),Object.defineProperty(t,"CredentialAuthModeError",{enumerable:!0,get:function(){return k.CredentialAuthModeError}});var S=r(34313);Object.defineProperty(t,"ProviderValidator",{enumerable:!0,get:function(){return S.ProviderValidator}}),Object.defineProperty(t,"ProviderValidationError",{enumerable:!0,get:function(){return S.ProviderValidationError}});var I=r(26904);Object.defineProperty(t,"OAuthTokenRetrievalService",{enumerable:!0,get:function(){return I.OAuthTokenRetrievalService}});var P=r(5727);Object.defineProperty(t,"BatchDelegationService",{enumerable:!0,get:function(){return P.BatchDelegationService}});var E=r(1320);Object.defineProperty(t,"InMemoryOAuthConfigCache",{enumerable:!0,get:function(){return E.InMemoryOAuthConfigCache}}),Object.defineProperty(t,"NoOpOAuthConfigCache",{enumerable:!0,get:function(){return E.NoOpOAuthConfigCache}});var x=r(86443);Object.defineProperty(t,"createStorageProviders",{enumerable:!0,get:function(){return x.createStorageProviders}}),Object.defineProperty(t,"StorageKeyHelpers",{enumerable:!0,get:function(){return x.StorageKeyHelpers}}),Object.defineProperty(t,"migrateLegacyKeys",{enumerable:!0,get:function(){return x.migrateLegacyKeys}});var O=r(20860);Object.defineProperty(t,"ProofVerificationError",{enumerable:!0,get:function(){return O.ProofVerificationError}}),Object.defineProperty(t,"PROOF_VERIFICATION_ERROR_CODES",{enumerable:!0,get:function(){return O.PROOF_VERIFICATION_ERROR_CODES}}),Object.defineProperty(t,"createProofVerificationError",{enumerable:!0,get:function(){return O.createProofVerificationError}});var T=r(60422);Object.defineProperty(t,"InMemoryToolProtectionCache",{enumerable:!0,get:function(){return T.InMemoryToolProtectionCache}}),Object.defineProperty(t,"NoOpToolProtectionCache",{enumerable:!0,get:function(){return T.NoOpToolProtectionCache}});var A=r(95006);Object.defineProperty(t,"DelegationRequiredError",{enumerable:!0,get:function(){return A.DelegationRequiredError}});var C=r(38926);Object.defineProperty(t,"OAuthRequiredError",{enumerable:!0,get:function(){return C.OAuthRequiredError}});var j=r(37249);Object.defineProperty(t,"DelegationErrorFormatter",{enumerable:!0,get:function(){return j.DelegationErrorFormatter}}),Object.defineProperty(t,"createDelegationErrorFormatter",{enumerable:!0,get:function(){return j.createDelegationErrorFormatter}});var D=r(18722);Object.defineProperty(t,"base58Encode",{enumerable:!0,get:function(){return D.base58Encode}}),Object.defineProperty(t,"base58Decode",{enumerable:!0,get:function(){return D.base58Decode}}),Object.defineProperty(t,"isValidBase58",{enumerable:!0,get:function(){return D.isValidBase58}});var z=r(61940);Object.defineProperty(t,"SchemaVerifier",{enumerable:!0,get:function(){return z.SchemaVerifier}}),Object.defineProperty(t,"createSchemaVerifier",{enumerable:!0,get:function(){return z.createSchemaVerifier}});var N=r(44597);Object.defineProperty(t,"SCHEMA_REGISTRY",{enumerable:!0,get:function(){return N.SCHEMA_REGISTRY}}),Object.defineProperty(t,"getAllSchemas",{enumerable:!0,get:function(){return N.getAllSchemas}}),Object.defineProperty(t,"getSchemasByCategory",{enumerable:!0,get:function(){return N.getSchemasByCategory}}),Object.defineProperty(t,"getSchemaById",{enumerable:!0,get:function(){return N.getSchemaById}}),Object.defineProperty(t,"getCriticalSchemas",{enumerable:!0,get:function(){return N.getCriticalSchemas}}),Object.defineProperty(t,"getSchemaStats",{enumerable:!0,get:function(){return N.getSchemaStats}});var R=r(56497);Object.defineProperty(t,"base64urlEncodeFromBytes",{enumerable:!0,get:function(){return R.base64urlEncodeFromBytes}}),Object.defineProperty(t,"base64urlEncodeFromString",{enumerable:!0,get:function(){return R.base64urlEncodeFromString}}),Object.defineProperty(t,"base64urlDecodeToBytes",{enumerable:!0,get:function(){return R.base64urlDecodeToBytes}}),Object.defineProperty(t,"base64urlDecodeToString",{enumerable:!0,get:function(){return R.base64urlDecodeToString}}),Object.defineProperty(t,"bytesToBase64",{enumerable:!0,get:function(){return R.bytesToBase64}}),i(r(96114),t);var U=r(52150);Object.defineProperty(t,"fetchRemoteConfig",{enumerable:!0,get:function(){return U.fetchRemoteConfig}}),Object.defineProperty(t,"getToolProtection",{enumerable:!0,get:function(){return U.getToolProtection}}),Object.defineProperty(t,"extractToolProtections",{enumerable:!0,get:function(){return U.extractToolProtections}}),Object.defineProperty(t,"hasMergedToolProtections",{enumerable:!0,get:function(){return U.hasMergedToolProtections}}),Object.defineProperty(t,"getPolicy",{enumerable:!0,get:function(){return U.getPolicy}}),Object.defineProperty(t,"extractPolicy",{enumerable:!0,get:function(){return U.extractPolicy}}),Object.defineProperty(t,"hasMergedPolicy",{enumerable:!0,get:function(){return U.hasMergedPolicy}}),Object.defineProperty(t,"isPolicyEnabled",{enumerable:!0,get:function(){return U.isPolicyEnabled}});var M=r(20356);Object.defineProperty(t,"UserDidManager",{enumerable:!0,get:function(){return M.UserDidManager}});var K=r(49041);Object.defineProperty(t,"IdpTokenResolver",{enumerable:!0,get:function(){return K.IdpTokenResolver}});var Z=r(76140);Object.defineProperty(t,"logger",{enumerable:!0,get:function(){return Z.logger}}),Object.defineProperty(t,"createDefaultConsoleLogger",{enumerable:!0,get:function(){return Z.createDefaultConsoleLogger}});var J=r(4319);Object.defineProperty(t,"ProofGenerator",{enumerable:!0,get:function(){return J.ProofGenerator}}),Object.defineProperty(t,"createProofResponse",{enumerable:!0,get:function(){return J.createProofResponse}}),Object.defineProperty(t,"extractCanonicalData",{enumerable:!0,get:function(){return J.extractCanonicalData}});var L=r(81605);Object.defineProperty(t,"SessionManager",{enumerable:!0,get:function(){return L.SessionManager}}),Object.defineProperty(t,"createHandshakeRequest",{enumerable:!0,get:function(){return L.createHandshakeRequest}}),Object.defineProperty(t,"validateHandshakeFormat",{enumerable:!0,get:function(){return L.validateHandshakeFormat}});var W=r(97829);Object.defineProperty(t,"verifyOrHints",{enumerable:!0,get:function(){return W.verifyOrHints}}),Object.defineProperty(t,"hasSensitiveScopes",{enumerable:!0,get:function(){return W.hasSensitiveScopes}}),Object.defineProperty(t,"MemoryResumeTokenStore",{enumerable:!0,get:function(){return W.MemoryResumeTokenStore}}),Object.defineProperty(t,"generateResumeToken",{enumerable:!0,get:function(){return W.generateResumeToken}})},41586:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateLevel2=t.DEFAULT_TRUSTED_ISSUERS=void 0,t.verifyCapabilities=i;const n=r(63969);async function i(e,r){const n={valid:[],invalid:[],warnings:[]};if(!Array.isArray(e))return n.warnings.push("capabilities is not an array ā no capabilities validated"),n;if(e.length>0&&e.every(e=>"string"==typeof e))return n.valid.push(...e),n.warnings.push("Level 1 self-declared ā no attestation verified"),n;const i=new Set(r.trustedIssuers??t.DEFAULT_TRUSTED_ISSUERS),a=(r.now?.()??new Date).getTime();r.signatureVerifier||n.warnings.push("No signatureVerifier provided ā VC signatures accepted without cryptographic verification");for(const t of e){if("string"==typeof t){n.invalid.push({capability:t,reasons:["capability declared as bare string with no attestations"]});continue}if(!c(t)){"object"==typeof t&&null!==t&&"string"==typeof t.name?n.invalid.push({capability:t.name,reasons:["capability has invalid or missing attestations array"]}):n.warnings.push(`Skipping capability entry of unrecognized shape: ${u(t)}`);continue}const e=await o(t,{agentDid:r.agentDid,trustedIssuers:i,now:a,signatureVerifier:r.signatureVerifier});e.valid?n.valid.push(t.name):n.invalid.push({capability:t.name,reasons:e.reasons})}return n}async function o(e,t){const r=[];if(!Array.isArray(e.attestations)||0===e.attestations.length)return{valid:!1,reasons:["no attestations attached"]};for(let n=0;n<e.attestations.length;n++){const i=`attestation[${n}]`,o=a(e.attestations[n]);if(!o.ok){r.push(`${i}: ${o.reason}`);continue}const{vc:c,rawJwt:u}=o,d=s(c);if(!d){r.push(`${i}: VC missing issuer`);continue}if(!t.trustedIssuers.has(d)){r.push(`${i}: issuer ${d} not in trusted registry`);continue}if(c.credentialSubject?.id!==t.agentDid){r.push(`${i}: credentialSubject.id ${c.credentialSubject?.id??"(missing)"} does not match agent DID ${t.agentDid}`);continue}if(c.credentialSubject?.capability!==e.name){r.push(`${i}: credentialSubject.capability ${c.credentialSubject?.capability??"(missing)"} does not match declared capability ${e.name}`);continue}const l=c.validUntil?Date.parse(c.validUntil):NaN;if(c.validUntil&&!Number.isNaN(l)){if(!(l<=t.now)){if(c.validFrom){const e=Date.parse(c.validFrom);if(Number.isNaN(e)){r.push(`${i}: unparseable validFrom`);continue}if(e>t.now){r.push(`${i}: VC not yet valid (validFrom ${c.validFrom})`);continue}}if(t.signatureVerifier){let e;try{e=await t.signatureVerifier(c,u)}catch(e){const t=e instanceof Error?e.message:String(e);r.push(`${i}: signature verifier threw: ${t}`);continue}if(!e.valid){r.push(`${i}: signature invalid${e.reason?` (${e.reason})`:""}`);continue}}return{valid:!0,reasons:[]}}r.push(`${i}: VC expired (validUntil ${c.validUntil})`)}else r.push(`${i}: VC missing or unparseable validUntil`)}return{valid:!1,reasons:r}}function a(e){if(null===e||"object"!=typeof e)return{ok:!1,reason:"attestation entry is not an object"};const t=e.vc;if("string"==typeof t){const e=(0,n.parseVCJWT)(t);if(!e)return{ok:!1,reason:"VC JWT could not be parsed"};const r=e.payload.vc;if(!r||"object"!=typeof r)return{ok:!1,reason:"VC JWT payload missing vc claim"};const i={...r};if(i.issuer||"string"!=typeof e.payload.iss||(i.issuer=e.payload.iss),"string"==typeof e.payload.sub&&i.credentialSubject&&"object"==typeof i.credentialSubject&&!i.credentialSubject.id&&(i.credentialSubject={...i.credentialSubject,id:e.payload.sub}),!i.validUntil&&"number"==typeof e.payload.exp){const t=new Date(1e3*e.payload.exp);Number.isNaN(t.getTime())||(i.validUntil=t.toISOString())}if(!i.validFrom&&"number"==typeof e.payload.nbf){const t=new Date(1e3*e.payload.nbf);Number.isNaN(t.getTime())||(i.validFrom=t.toISOString())}return{ok:!0,vc:i,rawJwt:t}}return t&&"object"==typeof t?{ok:!0,vc:t,rawJwt:void 0}:{ok:!1,reason:"attestation.vc missing or invalid type"}}function s(e){return"string"==typeof e.issuer?e.issuer:e.issuer&&"object"==typeof e.issuer&&"string"==typeof e.issuer.id?e.issuer.id:void 0}function c(e){return"object"==typeof e&&null!==e&&"string"==typeof e.name&&Array.isArray(e.attestations)}function u(e){try{return JSON.stringify(e)}catch{return String(e)}}t.DEFAULT_TRUSTED_ISSUERS=["did:web:knowthat.ai"],t.validateLevel2=i},42612:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(52511),t),i(r(56497),t),i(r(34270),t),i(r(18381),t)},43612:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PolicyService=void 0;const n=r(62408);class i{config;policy;constructor(e,t){this.policy=e??structuredClone(n.DEFAULT_POLICY_CONFIG),this.config=t??{}}setPolicy(e){this.policy=e}getPolicy(){return this.policy}isEnabled(){return this.policy.enabled??!0}evaluate(e){if(!this.isEnabled())return{action:"allow",reason:"Policy enforcement disabled",matchType:"default"};const t=this.checkAllowList(e);if(t)return this.config.debug&&console.error("[PolicyService] Allow list match",{context:this.sanitizeContext(e),match:t}),{action:"allow",reason:`Allowed: ${t.reason??"On allow list"}`,matchType:"allow-list"};const r=this.checkDenyList(e);if(r)return this.config.debug&&console.error("[PolicyService] Deny list match",{context:this.sanitizeContext(e),match:r}),{action:"block",reason:r.reason??"On deny list",matchType:"deny-list"};const n=this.checkThresholds(e);if(n)return this.config.debug&&console.error("[PolicyService] Threshold match",{context:this.sanitizeContext(e),result:n}),n;const i=this.evaluateRules(e);return i?(this.config.debug&&console.error("[PolicyService] Rule match",{context:this.sanitizeContext(e),result:i}),i):{action:this.policy.defaultAction??"allow",reason:"No matching rules, using default action",matchType:"default",redirectUrl:"redirect"===this.policy.defaultAction?this.policy.redirectUrl:void 0}}checkAllowList(e){if(!this.policy.allowList?.length)return null;for(const t of this.policy.allowList)if(this.matchesListEntry(e,t))return t;return null}checkDenyList(e){if(!this.policy.denyList?.length)return null;for(const t of this.policy.denyList)if(!1!==t.active&&!(t.expiresAt&&new Date(t.expiresAt)<new Date)&&this.matchesListEntry(e,t))return t;return null}matchesListEntry(e,t){return!!(t.clientDid&&e.clientDid===t.clientDid||t.agentDid&&e.agentDid===t.agentDid||t.clientName&&e.agentName?.toLowerCase()===t.clientName.toLowerCase()||t.agentType&&e.agentType===t.agentType)}checkThresholds(e){const t=this.policy.thresholds;return t?t.trustSignedRequests&&e.signatureVerified||void 0!==e.reputationScore&&e.reputationScore>=t.trustedReputationThreshold?null:void 0!==e.confidence&&e.confidence>=t.confidenceThreshold?{action:t.confidenceAction,reason:`Detection confidence (${e.confidence}) exceeds threshold (${t.confidenceThreshold})`,matchType:"threshold",redirectUrl:"redirect"===t.confidenceAction?this.policy.redirectUrl:void 0}:t.minReputationScore>0&&void 0!==e.reputationScore&&e.reputationScore<t.minReputationScore?{action:t.lowReputationAction,reason:`Reputation score (${e.reputationScore}) below minimum (${t.minReputationScore})`,matchType:"threshold",redirectUrl:"redirect"===t.lowReputationAction?this.policy.redirectUrl:void 0}:null:null}evaluateRules(e){const t=this.policy.rules;if(!t?.length)return null;const r=[...t].filter(e=>!1!==e.enabled).sort((e,t)=>(e.priority??100)-(t.priority??100));for(const t of r)if(this.matchesRule(e,t))return{action:t.action,reason:t.description??t.name,ruleId:t.id,ruleName:t.name,redirectUrl:"redirect"===t.action?t.redirectUrl:void 0,message:t.message,matchType:"rule"};return null}matchesRule(e,t){return t.conditions.every(t=>this.matchesCondition(e,t))}matchesCondition(e,t){const r=this.getContextValue(e,t.field),n=t.value;if(null==r)return"notEquals"===t.operator||"notIn"===t.operator||"notContains"===t.operator;switch(t.operator){case"equals":return this.compareEqual(r,n,t.caseInsensitive);case"notEquals":return!this.compareEqual(r,n,t.caseInsensitive);case"contains":return"string"==typeof r&&"string"==typeof n&&(t.caseInsensitive?r.toLowerCase().includes(n.toLowerCase()):r.includes(n));case"notContains":return"string"!=typeof r||"string"!=typeof n||(t.caseInsensitive?!r.toLowerCase().includes(n.toLowerCase()):!r.includes(n));case"startsWith":return"string"==typeof r&&"string"==typeof n&&(t.caseInsensitive?r.toLowerCase().startsWith(n.toLowerCase()):r.startsWith(n));case"endsWith":return"string"==typeof r&&"string"==typeof n&&(t.caseInsensitive?r.toLowerCase().endsWith(n.toLowerCase()):r.endsWith(n));case"greaterThan":return"number"==typeof r&&"number"==typeof n&&r>n;case"lessThan":return"number"==typeof r&&"number"==typeof n&&r<n;case"greaterThanOrEquals":return"number"==typeof r&&"number"==typeof n&&r>=n;case"lessThanOrEquals":return"number"==typeof r&&"number"==typeof n&&r<=n;case"matches":if("string"!=typeof r||"string"!=typeof n)return!1;try{const e=t.caseInsensitive?"i":"";return new RegExp(n,e).test(r)}catch{return!1}case"in":return!!Array.isArray(n)&&n.some(e=>this.compareEqual(r,e,t.caseInsensitive));case"notIn":return!Array.isArray(n)||!n.some(e=>this.compareEqual(r,e,t.caseInsensitive));default:return!1}}getContextValue(e,t){switch(t){case"agentType":return e.agentType;case"agentName":return e.agentName;case"agentVendor":return e.agentVendor;case"clientDid":return e.clientDid;case"agentDid":return e.agentDid;case"confidence":return e.confidence;case"reputationScore":return e.reputationScore;case"riskLevel":return e.riskLevel;case"path":return e.path;case"method":return e.method;case"origin":return e.origin;case"userAgent":return e.userAgent;case"signatureVerified":return e.signatureVerified;case"isAuthenticated":return e.isAuthenticated;case"hasValidDelegation":return e.hasValidDelegation;default:return}}compareEqual(e,t,r){return"string"==typeof e&&"string"==typeof t&&r?e.toLowerCase()===t.toLowerCase():e===t}sanitizeContext(e){return{agentType:e.agentType,agentName:e.agentName,agentVendor:e.agentVendor,clientDid:e.clientDid?`${e.clientDid.slice(0,20)}...`:void 0,agentDid:e.agentDid?`${e.agentDid.slice(0,20)}...`:void 0,confidence:e.confidence,reputationScore:e.reputationScore,riskLevel:e.riskLevel,path:e.path,method:e.method,signatureVerified:e.signatureVerified,isAuthenticated:e.isAuthenticated,hasValidDelegation:e.hasValidDelegation}}}t.PolicyService=i,t.default=i},44089:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598),i=r(80384),o=r(90489),a=r(45935),s=r(39069),c=r(73553),u=r(81593),d=r(99135),l=r(60322),p=r(29994),f=r(71759),h=r(4268),m=r(58242);t.default=(e,t,r,g,v,y)=>{let _;if((0,d.isCryptoKey)(t))(0,l.checkEncCryptoKey)(t,e,"decrypt"),_=n.KeyObject.from(t);else{if(!(t instanceof Uint8Array||(0,p.default)(t)))throw new TypeError((0,f.default)(t,...m.types,"Uint8Array"));_=t}if(!g)throw new s.JWEInvalid("JWE Initialization Vector missing");if(!v)throw new s.JWEInvalid("JWE Authentication Tag missing");switch((0,o.default)(e,_),(0,i.default)(e,g),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,i,o,d){const l=parseInt(e.slice(1,4),10);(0,p.default)(t)&&(t=t.export());const f=t.subarray(l>>3),m=t.subarray(0,l>>3),g=parseInt(e.slice(-3),10),v=`aes-${l}-cbc`;if(!(0,h.default)(v))throw new s.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const y=(0,u.default)(d,i,r,g,m,l);let _,b;try{_=(0,c.default)(o,y)}catch{}if(!_)throw new s.JWEDecryptionFailed;try{const e=(0,n.createDecipheriv)(v,f,i);b=(0,a.concat)(e.update(r),e.final())}catch{}if(!b)throw new s.JWEDecryptionFailed;return b}(e,_,r,g,v,y);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,i,o,a){const c=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,h.default)(c))throw new s.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);try{const e=(0,n.createDecipheriv)(c,t,i,{authTagLength:16});e.setAuthTag(o),a.byteLength&&e.setAAD(a,{plaintextLength:r.length});const s=e.update(r);return e.final(),s}catch{throw new s.JWEDecryptionFailed}}(e,_,r,g,v,y);default:throw new s.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}}},44490:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const n=r(28261);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o||(t.UsedValueState=o={})),t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class a{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=a;class s extends n.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=n._`.${new n.Name(t)}[${r}]`}}t.ValueScopeName=s;const c=n._`\n`;t.ValueScope=class extends a{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:n.nil}}get(){return this._scope}name(e){return new s(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:i}=n,o=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[i];if(a){const e=a.get(o);if(e)return e}else a=this._values[i]=new Map;a.set(o,n);const s=this._scope[i]||(this._scope[i]=[]),c=s.length;return s[c]=t.ref,n.setValue(t,{property:i,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return n._`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,a={},s){let c=n.nil;for(const u in e){const d=e[u];if(!d)continue;const l=a[u]=a[u]||new Map;d.forEach(e=>{if(l.has(e))return;l.set(e,o.Started);let a=r(e);if(a){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;c=n._`${c}${r} ${e} = ${a};${this.opts._n}`}else{if(!(a=null==s?void 0:s(e)))throw new i(e);c=n._`${c}${a}${this.opts._n}`}l.set(e,o.Completed)})}return c}}},44558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryDelegationGraphStorage=void 0,t.MemoryDelegationGraphStorage=class{nodes=new Map;async getNode(e){return this.nodes.get(e)||null}async setNode(e){this.nodes.set(e.id,e)}async getChildren(e){const t=this.nodes.get(e);return t?t.children.map(e=>this.nodes.get(e)).filter(e=>void 0!==e):[]}async getChain(e){const t=[];let r=e;for(;r;){const e=this.nodes.get(r);if(!e)break;t.unshift(e),r=e.parentId}return t}async getDescendants(e){const t=[],r=[e],n=new Set;for(;r.length>0;){const e=r.shift();if(n.has(e))continue;n.add(e);const i=this.nodes.get(e);if(i)for(const e of i.children)if(!n.has(e)){r.push(e);const n=this.nodes.get(e);n&&t.push(n)}}return t}async deleteNode(e){this.nodes.delete(e)}clear(){this.nodes.clear()}getAllNodeIds(){return Array.from(this.nodes.keys())}getStats(){const e=Array.from(this.nodes.values()),t=e.filter(e=>null===e.parentId).length,r=e.filter(e=>0===e.children.length).length;let n=0;for(const t of e){const e=this.getChainSync(t.id);n=Math.max(n,e.length-1)}return{totalNodes:e.length,rootNodes:t,leafNodes:r,maxDepth:n}}getChainSync(e){const t=[];let r=e;for(;r;){const e=this.nodes.get(r);if(!e)break;t.unshift(e),r=e.parentId}return t}}},44597:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCHEMA_REGISTRY=void 0,t.getAllSchemas=function(){return t.SCHEMA_REGISTRY},t.getSchemasByCategory=function(e){const r={vc:["verifiable-credential","verifiable-presentation","statuslist2021-credential","statuslist2021-credential-subject"],delegation:["delegation-credential","delegation-record","delegation-constraints","delegation-chain","delegation-creation-request","delegation-verification-result"],handshake:["handshake-request","session-context","nonce-cache-config","nonce-cache-entry"],proof:["detached-proof","proof-meta","proof","proof-w3c","audit-record","canonical-hashes"],registry:["registration-input","registration-result","agent-status","claim-token","delegation-request","delegation-response","registry-delegation","mirror-status","receipt"],runtime:["authorization-display","needs-authorization-error","runtime-error"],cli:["register-output"],tlkrc:["rotation-chain","rotation-event"],verifier:["verify-page"],"well-known":["well-known-agent"]}[e]||[];return t.SCHEMA_REGISTRY.filter(e=>r.includes(e.id))},t.getSchemaById=function(e){return t.SCHEMA_REGISTRY.find(t=>t.id===e)},t.getCriticalSchemas=function(){const e=["verifiable-credential","statuslist2021-credential","delegation-credential","delegation-record","delegation-constraints","detached-proof","proof-meta","handshake-request","session-context","audit-record"];return t.SCHEMA_REGISTRY.filter(t=>e.includes(t.id))},t.getSchemaStats=function(){const e={},n={};for(const i of t.SCHEMA_REGISTRY){const t=i.url.replace(r+"/","").split("/")[0]||"unknown";e[t]=(e[t]||0)+1,n[i.version]=(n[i.version]||0)+1}return{total:t.SCHEMA_REGISTRY.length,byCategory:e,byVersion:n}};const r="https://schema.modelcontextprotocol-identity.io/xmcp-i";t.SCHEMA_REGISTRY=[{id:"verifiable-credential",url:`${r}/vc/verifiable-credential.v1.0.0.json`,version:"1.0.0",type:"VerifiableCredential",description:"W3C Verifiable Credential Data Model"},{id:"verifiable-presentation",url:`${r}/vc/verifiable-presentation.v1.0.0.json`,version:"1.0.0",type:"VerifiablePresentation",description:"W3C Verifiable Presentation"},{id:"statuslist2021-credential",url:`${r}/vc/statuslist-2021-credential.v1.0.0.json`,version:"1.0.0",type:"StatusList2021Credential",description:"StatusList2021 Credential for efficient revocation"},{id:"statuslist2021-credential-subject",url:`${r}/vc/statuslist-2021-credential-subject.v1.0.0.json`,version:"1.0.0",type:"StatusList2021CredentialSubject",description:"StatusList2021 Credential Subject"},{id:"delegation-credential",url:`${r}/credentials/delegation/v1.0.0.json`,version:"1.0.0",type:"DelegationCredential",description:"W3C VC-based delegation credential"},{id:"delegation-record",url:`${r}/delegation/delegation-record.v1.0.0.json`,version:"1.0.0",type:"DelegationRecord",description:"Internal delegation record"},{id:"delegation-constraints",url:`${r}/delegation/constraints.v1.0.0.json`,version:"1.0.0",type:"DelegationConstraints",description:"CRISP constraints for delegations"},{id:"delegation-chain",url:`${r}/delegation/delegation-chain.v1.0.0.json`,version:"1.0.0",type:"DelegationChain",description:"Delegation chain for hierarchy tracking"},{id:"delegation-creation-request",url:`${r}/delegation/delegation-creation-request.v1.0.0.json`,version:"1.0.0",type:"DelegationCreationRequest",description:"Request to create a delegation"},{id:"delegation-verification-result",url:`${r}/delegation/delegation-verification-result.v1.0.0.json`,version:"1.0.0",type:"DelegationVerificationResult",description:"Result of delegation verification"},{id:"handshake-request",url:`${r}/handshake/handshake-request.v1.0.0.json`,version:"1.0.0",type:"HandshakeRequest",description:"MCP-I handshake request"},{id:"session-context",url:`${r}/handshake/session-context.v1.0.0.json`,version:"1.0.0",type:"SessionContext",description:"MCP-I session context"},{id:"nonce-cache-config",url:`${r}/handshake/nonce-cache-config.v1.0.0.json`,version:"1.0.0",type:"NonceCacheConfig",description:"Nonce cache configuration"},{id:"nonce-cache-entry",url:`${r}/handshake/nonce-cache-entry.v1.0.0.json`,version:"1.0.0",type:"NonceCacheEntry",description:"Nonce cache entry for replay protection"},{id:"detached-proof",url:`${r}/proof/detached-proof.v1.0.0.json`,version:"1.0.0",type:"DetachedProof",description:"MCP-I detached proof with JWS"},{id:"proof-meta",url:`${r}/proof/proof-meta.v1.0.0.json`,version:"1.0.0",type:"ProofMeta",description:"Metadata for MCP-I proofs"},{id:"proof",url:`${r}/proof/v1.0.0.json`,version:"1.0.0",type:"Proof",description:"Generic proof structure"},{id:"proof-w3c",url:`${r}/proof/w3c/v1.0.0.json`,version:"1.0.0",type:"W3CProof",description:"W3C-compliant proof"},{id:"audit-record",url:`${r}/proof/audit-record.v1.0.0.json`,version:"1.0.0",type:"AuditRecord",description:"Audit trail record"},{id:"canonical-hashes",url:`${r}/proof/canonical-hashes.v1.0.0.json`,version:"1.0.0",type:"CanonicalHashes",description:"Canonical hashes for proof generation"},{id:"registration-input",url:`${r}/registry/registration-input.v1.0.0.json`,version:"1.0.0",type:"RegistrationInput",description:"Agent registration input"},{id:"registration-result",url:`${r}/registry/registration-result.v1.0.0.json`,version:"1.0.0",type:"RegistrationResult",description:"Agent registration result"},{id:"agent-status",url:`${r}/registry/agent-status.v1.0.0.json`,version:"1.0.0",type:"AgentStatus",description:"Agent status information"},{id:"claim-token",url:`${r}/registry/claim-token.v1.0.0.json`,version:"1.0.0",type:"ClaimToken",description:"Token for claiming agent ownership"},{id:"delegation-request",url:`${r}/registry/delegation-request.v1.0.0.json`,version:"1.0.0",type:"DelegationRequest",description:"Registry delegation request"},{id:"delegation-response",url:`${r}/registry/delegation-response.v1.0.0.json`,version:"1.0.0",type:"DelegationResponse",description:"Registry delegation response"},{id:"registry-delegation",url:`${r}/registry/delegation.v1.0.0.json`,version:"1.0.0",type:"RegistryDelegation",description:"Registry delegation object"},{id:"mirror-status",url:`${r}/registry/mirror-status.v1.0.0.json`,version:"1.0.0",type:"MirrorStatus",description:"Registry mirror status"},{id:"receipt",url:`${r}/registry/receipt.v1.0.0.json`,version:"1.0.0",type:"Receipt",description:"Registry receipt"},{id:"authorization-display",url:`${r}/runtime/authorization-display.v1.0.0.json`,version:"1.0.0",type:"AuthorizationDisplay",description:"Authorization display information"},{id:"needs-authorization-error",url:`${r}/runtime/needs-authorization-error.v1.0.0.json`,version:"1.0.0",type:"NeedsAuthorizationError",description:"Error indicating authorization is needed"},{id:"runtime-error",url:`${r}/runtime/runtime-error.v1.0.0.json`,version:"1.0.0",type:"RuntimeError",description:"Generic runtime error"},{id:"register-output",url:`${r}/cli/register-output/v1.0.0.json`,version:"1.0.0",type:"RegisterOutput",description:"CLI registration output"},{id:"rotation-chain",url:`${r}/tlkrc/rotation-chain.v1.0.0.json`,version:"1.0.0",type:"RotationChain",description:"Key rotation chain"},{id:"rotation-event",url:`${r}/tlkrc/rotation-event.v1.0.0.json`,version:"1.0.0",type:"RotationEvent",description:"Key rotation event"},{id:"verify-page",url:`${r}/verifier/verify-page/v1.0.0.json`,version:"1.0.0",type:"VerifyPage",description:"Verifier page response"},{id:"well-known-agent",url:`${r}/well-known/agent/v1.0.0.json`,version:"1.0.0",type:"WellKnownAgent",description:"Agent well-known metadata"}]},44618:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},44645:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProviderResolver=t.CredentialAuthModeError=t.ConsentOnlyModeError=void 0;class r extends Error{toolProtection;constructor(e){super("Tool is configured for consent-only mode (no OAuth provider required)"),this.toolProtection=e,this.name="ConsentOnlyModeError"}}t.ConsentOnlyModeError=r;class n extends Error{toolProtection;provider;constructor(e,t){super(`Tool requires credential authentication with provider "${t}"`),this.toolProtection=e,this.name="CredentialAuthModeError",this.provider=t}}t.CredentialAuthModeError=n,t.ProviderResolver=class{registry;configService;constructor(e,t){this.registry=e,this.configService=t}isConsentOnlyMode(e){return"none"===e.authorization?.type}isCredentialAuthMode(e){return"password"===e.authorization?.type?{isCredential:!0,provider:e.authorization.provider||"credentials"}:{isCredential:!1}}async resolveProvider(e,t){if(this.isConsentOnlyMode(e))throw console.error("[ProviderResolver] Tool is consent-only mode (authorization.type=none), skipping OAuth resolution"),new r(e);const i=this.isCredentialAuthMode(e);if(i.isCredential)throw console.error(`[ProviderResolver] Tool requires credential auth (authorization.type=password), provider="${i.provider}"`),new n(e,i.provider);if(e.oauthProvider){if(0===this.registry.getProviderNames().length&&await this.registry.loadFromAgentShield(t),!this.registry.hasProvider(e.oauthProvider))throw new Error(`Provider "${e.oauthProvider}" not configured for project "${t}". Add provider in project settings.`);return e.oauthProvider}const o=this.inferProviderFromScopes(e.requiredScopes||[]);if(o&&(0===this.registry.getProviderNames().length&&await this.registry.loadFromAgentShield(t),this.registry.hasProvider(o)))return console.error(`[ProviderResolver] Inferred provider "${o}" from scopes`),o;await this.registry.loadFromAgentShield(t);const a=this.registry.getConfiguredProvider();if(a&&this.registry.hasProvider(a))return console.warn(`[ProviderResolver] Tool does not specify oauthProvider. Using project-configured provider "${a}" as fallback. Consider explicitly setting oauthProvider in tool protection config.`),a;throw new Error(`Tool requires OAuth but no provider is configured for project "${t}". Configure an OAuth provider in AgentShield dashboard.`)}inferProviderFromScopes(e){if(!e||0===e.length)return null;const t=e.map(e=>e.split(":")[0].toLowerCase()),r={github:"github",google:"google",gmail:"google",calendar:"google",microsoft:"microsoft",outlook:"microsoft",slack:"slack",auth0:"auth0",okta:"okta"},n=new Set(t.map(e=>r[e]).filter(Boolean));return 1===n.size?Array.from(n)[0]:null}}},44708:e=>{"use strict";e.exports=require("node:https")},45380:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isJWK=i,t.isPrivateJWK=function(e){return"oct"!==e.kty&&"string"==typeof e.d},t.isPublicJWK=function(e){return"oct"!==e.kty&&void 0===e.d},t.isSecretJWK=function(e){return i(e)&&"oct"===e.kty&&"string"==typeof e.k};const n=r(71661);function i(e){return(0,n.default)(e)&&"string"==typeof e.kty}},45935:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decoder=t.encoder=void 0,t.concat=o,t.p2s=function(e,r){return o(t.encoder.encode(e),new Uint8Array([0]),r)},t.uint64be=function(e){const t=Math.floor(e/i),r=e%i,n=new Uint8Array(8);return a(n,t,0),a(n,r,4),n},t.uint32be=s,t.lengthAndInput=function(e){return o(s(e.length),e)},t.concatKdf=async function(e,t,r){const i=Math.ceil((t>>3)/32),o=new Uint8Array(32*i);for(let t=0;t<i;t++){const i=new Uint8Array(4+e.length+r.length);i.set(s(t+1)),i.set(e,4),i.set(r,4+e.length),o.set(await(0,n.default)("sha256",i),32*t)}return o.slice(0,t>>3)};const n=r(17306);t.encoder=new TextEncoder,t.decoder=new TextDecoder;const i=2**32;function o(...e){const t=e.reduce((e,{length:t})=>e+t,0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}function a(e,t,r){if(t<0||t>=i)throw new RangeError(`value must be >= 0 and <= ${i-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function s(e){const t=new Uint8Array(4);return a(t,e),t}},46398:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(24954),i=r(38994),o=r(67218),a=r(67218),s={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:s,parentSchema:c,it:u}=e,{opts:d}=u,l=(0,n.allSchemaProperties)(r),p=l.filter(e=>(0,o.alwaysValidSchema)(u,r[e]));if(0===l.length||p.length===l.length&&(!u.opts.unevaluated||!0===u.props))return;const f=d.strictSchema&&!d.allowMatchingProperties&&c.properties,h=t.name("valid");!0===u.props||u.props instanceof i.Name||(u.props=(0,a.evaluatedPropsToName)(t,u.props));const{props:m}=u;function g(e){for(const t in f)new RegExp(e).test(t)&&(0,o.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){t.forIn("key",s,o=>{t.if(i._`${(0,n.usePattern)(e,r)}.test(${o})`,()=>{const n=p.includes(r);n||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:o,dataPropType:a.Type.Str},h),u.opts.unevaluated&&!0!==m?t.assign(i._`${m}[${o}]`,!0):n||u.allErrors||t.if((0,i.not)(h),()=>t.break())})})}!function(){for(const e of l)f&&g(e),u.allErrors?v(e):(t.var(h,!0),v(e),t.if(h))}()}};t.default=s},46610:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BitstringManager=void 0,t.isIndexSet=async function(e,t,n){const i=r.base64urlDecode(e),o=await n.decompress(i),a=Math.floor(t/8),s=t%8;return!(a>=o.length)&&!!(o[a]&1<<s)};class r{compressor;decompressor;bits;size;constructor(e,t,r){this.compressor=t,this.decompressor=r,this.size=e;const n=Math.ceil(e/8);this.bits=new Uint8Array(n)}setBit(e,t){if(e<0||e>=this.size)throw new Error(`Bit index ${e} out of range (0-${this.size-1})`);const r=Math.floor(e/8),n=e%8;t?this.bits[r]|=1<<n:this.bits[r]&=~(1<<n)}getBit(e){if(e<0||e>=this.size)throw new Error(`Bit index ${e} out of range (0-${this.size-1})`);const t=Math.floor(e/8),r=e%8;return!!(this.bits[t]&1<<r)}getSetBits(){const e=[];for(let t=0;t<this.size;t++)this.getBit(t)&&e.push(t);return e}async encode(){const e=await this.compressor.compress(this.bits);return this.base64urlEncode(e)}static async decode(e,t,n){const i=r.base64urlDecode(e),o=await n.decompress(i),a=8*o.length,s=new r(a,t,n);return s.bits=o,s}getRawBits(){return this.bits}getSize(){return this.size}base64urlEncode(e){return this.bytesToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static base64urlDecode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4!=0;)t+="=";return r.base64ToBytes(t)}bytesToBase64(e){const t=Array.from(e).map(e=>String.fromCharCode(e)).join("");return btoa(t)}static base64ToBytes(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=(4-t.length%4)%4;t+="=".repeat(r);const n=atob(t),i=new Uint8Array(n.length);for(let e=0;e<n.length;e++)i[e]=n.charCodeAt(e);return i}static fromSetBits(e,t,n,i){const o=new r(e,n,i);for(const e of t)o.setBit(e,!0);return o}}t.BitstringManager=r},46682:e=>{function t(e){return Promise.resolve().then(()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=()=>[],t.resolve=t,t.id=46682,e.exports=t},47532:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError((0,a.default)(t,...s.types));return(0,n.createSecretKey)(t)}if(t instanceof n.KeyObject)return t;if((0,i.isCryptoKey)(t))return(0,o.checkSigCryptoKey)(t,e,r),n.KeyObject.from(t);if(c.isJWK(t))return e.startsWith("HS")?(0,n.createSecretKey)(Buffer.from(t.k,"base64url")):t;throw new TypeError((0,a.default)(t,...s.types,"Uint8Array","JSON Web Key"))};const n=r(77598),i=r(99135),o=r(60322),a=r(71759),s=r(58242),c=r(45380)},47848:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccessControlApiService=void 0,t.authorizationMatches=function(e,t){return!t||(!("credential"!==e.type||"oauth"!==t.type||!e.credentialType||!t.provider||e.credentialType!==t.provider)||e.type===t.type&&("oauth"===e.type?!t.provider||e.provider===t.provider:"verifiable_credential"!==e.type||(!t.credentialType||e.credentialType===t.credentialType)))};const n=r(82906),i=r(82906);function o(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,15)}`}t.AccessControlApiService=class{config;metrics;constructor(e){const t=e.retryConfig||{};this.config={retryConfig:{maxRetries:t.maxRetries??3,initialDelayMs:t.initialDelayMs??100,maxDelayMs:t.maxDelayMs??5e3},logger:e.logger||(()=>{}),baseUrl:e.baseUrl,apiKey:e.apiKey,fetchProvider:e.fetchProvider,sleepProvider:e.sleepProvider||(e=>new Promise(t=>setTimeout(t,e)))},this.metrics={successCount:0,errorCount:0,retryCount:0}}async fetchConfig(e){return this.retryWithBackoff(async()=>{const t=o(),r=`${this.config.baseUrl}/api/v1/bouncer/config?agent_did=${encodeURIComponent(e.agentDid)}`;this.config.logger(`[AccessControl] Fetching config for agent: ${e.agentDid}`,{correlationId:t,url:r});const a=await this.config.fetchProvider.fetch(r,{method:"GET",headers:{Authorization:`Bearer ${this.config.apiKey}`,"Content-Type":"application/json","X-Request-ID":t}}),s=await a.text(),c=this.parseResponseJSON(a,s);a.ok||this.handleErrorResponse(a,c);const u=n.toolProtectionConfigAPIResponseSchema.safeParse(c);if(!u.success)throw new i.AgentShieldAPIError("invalid_response","Response validation failed",{zodErrors:u.error.errors});return this.config.logger("[AccessControl] Config fetched successfully",{correlationId:t,agentDid:e.agentDid}),u.data})}async verifyDelegation(e,t){return this.retryWithBackoff(async()=>{const r=o(),a=`${this.config.baseUrl}/api/v1/bouncer/delegations/verify`,s={agent_did:e.agent_did};void 0!==e.scopes&&(s.scopes=e.scopes),void 0!==e.user_did&&(s.user_did=e.user_did),void 0!==e.credential_jwt?s.credential_jwt=e.credential_jwt:t?.credentialJwt&&(s.credential_jwt=t.credentialJwt),void 0!==e.delegation_token?s.delegation_token=e.delegation_token:t?.delegationToken&&(s.delegation_token=t.delegationToken),void 0!==e.timestamp&&(s.timestamp=e.timestamp),e.client_info&&(s.client_info=e.client_info);const c=Object.fromEntries(Object.entries(s).filter(([e,t])=>void 0!==t)),u=n.verifyDelegationRequestSchema.safeParse(c);if(!u.success&&(!u.error.errors.find(e=>e.path.includes("scopes")&&"Required"===e.message)||"scopes"in c))throw this.config.logger("[AccessControl] Validation failed:",{errors:u.error.errors,requestBody:s}),new i.AgentShieldAPIError("validation_error","Request validation failed",{zodErrors:u.error.errors});this.config.logger(`[AccessControl] Verifying delegation for agent: ${e.agent_did}`,{correlationId:r,url:a,hasScopes:(e.scopes?.length||0)>0});const d=await this.config.fetchProvider.fetch(a,{method:"POST",headers:{Authorization:`Bearer ${this.config.apiKey}`,"Content-Type":"application/json","X-Request-ID":r},body:JSON.stringify(c)}),l=await d.text(),p=this.parseResponseJSON(d,l);d.ok||this.handleErrorResponse(d,p);const f=n.verifyDelegationAPIResponseSchema.safeParse(p);if(!f.success)throw new i.AgentShieldAPIError("invalid_response","Response validation failed",{zodErrors:f.error.errors});return this.config.logger("[AccessControl] Delegation verified",{correlationId:r,agentDid:e.agent_did,valid:f.data.data.valid}),f.data})}async submitProofs(e){return this.retryWithBackoff(async()=>{const t=n.proofSubmissionRequestSchema.safeParse(e);if(!t.success){const r=JSON.stringify(t.error.errors,null,2);throw this.config.logger("[AccessControl] Proof submission validation failed:",{errors:t.error.errors,request:JSON.stringify(e,null,2)}),new i.AgentShieldAPIError("validation_error",`Request validation failed: ${r}`,{zodErrors:t.error.errors})}const r=t.data,a=o(),s=`${this.config.baseUrl}/api/v1/bouncer/proofs`;this.config.logger(`[AccessControl] Submitting ${e.proofs.length} proof(s)`,{correlationId:a,url:s,sessionId:e.session_id,delegationId:e.delegation_id});const c=await this.config.fetchProvider.fetch(s,{method:"POST",headers:{Authorization:`Bearer ${this.config.apiKey}`,"Content-Type":"application/json","X-Request-ID":a},body:JSON.stringify(r)}),u=await c.text();console.error("[AccessControl] š RAW API RESPONSE (before parsing):",{correlationId:a,status:c.status,statusText:c.statusText,headers:Object.fromEntries(c.headers.entries()),responseTextLength:u.length,responseTextPreview:u.substring(0,500),fullResponseText:u});const d=this.parseResponseJSON(c,u);if(console.error("[AccessControl] š PARSED RESPONSE DATA:",{correlationId:a,status:c.status,responseDataType:typeof d,responseDataKeys:Object.keys(d||{}),responseData:JSON.stringify(d,null,2)}),!c.ok){const t=d;if(t.error){const r=t.error.code||"api_error";if("all_proofs_rejected"===r&&400===c.status){const r=t.error.details,o={success:!1,accepted:0,rejected:r?.rejected||e.proofs.length,outcomes:{success:0,failed:0,blocked:0,error:r?.rejected||e.proofs.length},errors:r?.errors},a=n.proofSubmissionResponseSchema.safeParse(o);if(a.success)return a.data;throw new i.AgentShieldAPIError("invalid_response","Error response validation failed",{zodErrors:a.error.errors})}const o={...t.error.details||{},status:c.status};throw new i.AgentShieldAPIError(r,t.error.message||`API error: ${c.status}`,o)}let r="api_error";throw 400===c.status?r="validation_error":404===c.status&&(r=c.statusText.includes("delegation")?"delegation_not_found":"session_not_found"),new i.AgentShieldAPIError(r,`API request failed: ${c.status} ${c.statusText}`,{status:c.status,responseData:d})}const l=d,p={correlationId:a,hasSuccess:void 0!==l.success,hasData:void 0!==l.data,responseType:typeof d,responseKeys:Object.keys(d||{}),responseData:JSON.stringify(d,null,2).substring(0,2e3)};if(this.config.logger("[AccessControl] Raw response received",p),console.error("[AccessControl] Raw response received:",JSON.stringify(d,null,2)),void 0!==l.success&&l.data){let e;try{const t=l.data,r=JSON.parse(JSON.stringify(t));if("object"!=typeof r||null===r)throw new i.AgentShieldAPIError("invalid_response","Response data is not an object after cloning",{originalType:typeof t,clonedType:typeof r,clonedValue:r});e=r}catch(e){if(e instanceof i.AgentShieldAPIError)throw e;throw new i.AgentShieldAPIError("invalid_response","Failed to clone response data",{error:e instanceof Error?e.message:String(e),dataType:typeof l.data})}console.error("[AccessControl] š DATA OBJECT STRUCTURE (after deep clone):",{correlationId:a,dataKeys:Object.keys(e),hasAccepted:"accepted"in e,hasRejected:"rejected"in e,hasOutcomes:"outcomes"in e,hasErrors:"errors"in e,acceptedType:typeof e.accepted,acceptedValue:e.accepted,rejectedType:typeof e.rejected,rejectedValue:e.rejected,outcomesType:typeof e.outcomes,outcomesValue:e.outcomes,errorsType:typeof e.errors,errorsIsArray:Array.isArray(e.errors),fullData:JSON.stringify(e,null,2)});const t={success:!0===l.success,accepted:e.accepted,rejected:e.rejected};if("outcomes"in e&&void 0!==e.outcomes&&(t.outcomes=e.outcomes),"errors"in e&&void 0!==e.errors&&(t.errors=e.errors),console.error("[AccessControl] š VALIDATING DATA WITH SUCCESS:",{correlationId:a,dataWithSuccessKeys:Object.keys(t),hasSuccess:"success"in t,successValue:t.success,hasAccepted:"accepted"in t,acceptedValue:t.accepted,hasRejected:"rejected"in t,rejectedValue:t.rejected,hasOutcomes:"outcomes"in t,outcomesValue:t.outcomes,fullDataWithSuccess:JSON.stringify(t,null,2)}),"number"!=typeof t.accepted||"number"!=typeof t.rejected)throw console.error("[AccessControl] ā MISSING REQUIRED FIELDS AFTER CONSTRUCTION:",{correlationId:a,hasAccepted:"accepted"in t,acceptedType:typeof t.accepted,acceptedValue:t.accepted,hasRejected:"rejected"in t,rejectedType:typeof t.rejected,rejectedValue:t.rejected,dataWithSuccessKeys:Object.keys(t),fullDataWithSuccess:JSON.stringify(t,null,2),dataToValidateKeys:Object.keys(e),fullDataToValidate:JSON.stringify(e,null,2),originalResponseData:JSON.stringify(d,null,2)}),new i.AgentShieldAPIError("invalid_response","Response data missing required fields (accepted/rejected)",{responseData:d,dataToValidate:e,dataWithSuccess:t});const r=n.proofSubmissionResponseSchema.safeParse(t);if(r.success)return this.config.logger("[AccessControl] Proofs submitted successfully (wrapped)",{correlationId:a,accepted:r.data.accepted,rejected:r.data.rejected}),r.data;{const n={correlationId:a,zodErrors:r.error.errors,zodErrorDetails:JSON.stringify(r.error.errors,null,2),dataToValidate:JSON.stringify(e,null,2).substring(0,2e3),dataWithSuccess:JSON.stringify(t,null,2).substring(0,2e3),dataKeys:Object.keys(e),dataWithSuccessKeys:Object.keys(t),originalResponse:JSON.stringify(d,null,2).substring(0,2e3)};throw this.config.logger("[AccessControl] Wrapped response validation failed",n),console.error("[AccessControl] Wrapped response validation failed",n),console.error("[AccessControl] Original wrapped response:",JSON.stringify(d,null,2)),console.error(`[AccessControl] ā ZOD VALIDATION FAILED - ${r.error.errors.length} error(s):`),r.error.errors.forEach((e,t)=>{const r={path:e.path.join(".")||"(root)",message:e.message,code:e.code};"received"in e&&(r.received=e.received),"expected"in e&&(r.expected=e.expected),"input"in e&&(r.input=e.input),console.error(`[AccessControl] Error ${t+1}:`,JSON.stringify(r,null,2))}),console.error("[AccessControl] ā Full ZOD errors JSON:",JSON.stringify(r.error.errors,null,2)),new i.AgentShieldAPIError("invalid_response","Response validation failed",{zodErrors:r.error.errors,responseData:d})}}const f=n.proofSubmissionResponseSchema.safeParse(d);if(!f.success){const e={correlationId:a,zodErrors:f.error.errors,zodErrorDetails:JSON.stringify(f.error.errors,null,2),responseData:JSON.stringify(d,null,2),responseDataType:typeof d,responseKeys:Object.keys(d||{}),httpStatus:c.status,httpStatusText:c.statusText};throw this.config.logger("[AccessControl] Response validation failed",e),console.error("[AccessControl] Response validation failed",{zodErrors:f.error.errors,responseData:d}),console.error("[AccessControl] Response validation failed",e),console.error(`[AccessControl] ā ZOD VALIDATION FAILED (direct) - ${f.error.errors.length} error(s):`),f.error.errors.forEach((e,t)=>{const r={path:e.path.join(".")||"(root)",message:e.message,code:e.code};"received"in e&&(r.received=e.received),"expected"in e&&(r.expected=e.expected),"input"in e&&(r.input=e.input),console.error(`[AccessControl] Error ${t+1}:`,r)}),console.error("[AccessControl] ā Full ZOD errors JSON:",JSON.stringify(f.error.errors,null,2)),console.error("[AccessControl] ā ACTUAL RESPONSE DATA:",JSON.stringify(d,null,2)),new i.AgentShieldAPIError("invalid_response","Response validation failed",{zodErrors:f.error.errors,responseData:d})}return this.config.logger("[AccessControl] Proofs submitted successfully",{correlationId:a,accepted:f.data.accepted,rejected:f.data.rejected}),f.data})}getMetrics(){return{...this.metrics}}resetMetrics(){this.metrics={successCount:0,errorCount:0,retryCount:0}}async retryWithBackoff(e,t=0){try{const t=await e();return this.metrics.successCount++,t}catch(r){const n=this.isRetryableError(r),{maxRetries:i,initialDelayMs:o,maxDelayMs:a}=this.config.retryConfig;if(n&&t<i){const r=Math.min(o*Math.pow(2,t),a);return this.metrics.retryCount++,this.config.logger(`Retrying after ${r}ms (attempt ${t+1}/${i})`),await this.sleep(r),this.retryWithBackoff(e,t+1)}throw this.metrics.errorCount++,r}}isRetryableError(e){if(e instanceof TypeError&&e.message.includes("fetch"))return!0;if(e instanceof i.AgentShieldAPIError){if("server_error"===e.code)return!0;const t=e.details?.status;if(t&&t>=500&&t<600)return!0;if(429===t)return!0}if(e instanceof Error){const t=e.message.toLowerCase();if(t.includes("timeout")||t.includes("timed out"))return!0}return!1}sleep(e){return this.config.sleepProvider(e)}parseResponseJSON(e,t){try{return JSON.parse(t)}catch(r){if(!e.ok){const r=this.mapStatusToErrorCode(e.status);throw new i.AgentShieldAPIError(r,`API request failed: ${e.status} ${e.statusText}`,{status:e.status,responseText:t.substring(0,500)})}throw new i.AgentShieldAPIError("invalid_response",`Failed to parse response: ${r instanceof Error?r.message:String(r)}`,{responseText:t.substring(0,500)})}}mapStatusToErrorCode(e,t=""){return 400===e?"validation_error":401===e||403===e?"authentication_failed":404===e?"config_not_found":e>=500?"server_error":"api_error"}handleErrorResponse(e,t){const r=t;if(r.error){const t=r.error.code||"api_error",n={...r.error.details||{},status:e.status};throw new i.AgentShieldAPIError(t,r.error.message||`API error: ${e.status}`,n)}const n=this.mapStatusToErrorCode(e.status,e.statusText);throw new i.AgentShieldAPIError(n,`API request failed: ${e.status} ${e.statusText}`,{status:e.status,responseData:t})}}},48870:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:i}=e,o="maxItems"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`${r}.length ${o} ${i}`)}};t.default=i},49041:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdpTokenResolver=void 0,t.IdpTokenResolver=class{config;constructor(e){this.config={tokenStorage:e.tokenStorage,oauthService:e.oauthService,logger:e.logger||(()=>{})}}async resolveTokenFromDid(e,t,r){const n=await this.resolveTokenDataFromDid(e,t,r);return n?.access_token??null}async resolveTokenDataFromDid(e,t,r){const n=await this.config.tokenStorage.getToken(e,t,r);if(!n)return this.config.logger("[IdpTokenResolver] Token not found",{userDid:e.substring(0,20)+"...",provider:t,scopes:r}),null;const i=Date.now();if(n.expires_at<i){if(this.config.logger("[IdpTokenResolver] Token expired, attempting refresh",{userDid:e.substring(0,20)+"...",provider:t,expiresAt:new Date(n.expires_at).toISOString(),hasRefreshToken:!!n.refresh_token}),n.refresh_token){const i=await this.config.oauthService.refreshToken(t,n.refresh_token);if(i){const o={...i,tokenUsage:n.tokenUsage,tokenHeader:n.tokenHeader,cookieFormat:n.cookieFormat,apiHeaders:n.apiHeaders};return await this.config.tokenStorage.storeToken(e,t,r,o),this.config.logger("[IdpTokenResolver] Token refreshed successfully",{userDid:e.substring(0,20)+"...",provider:t,expiresAt:new Date(i.expires_at).toISOString()}),o}return this.config.logger("[IdpTokenResolver] Token refresh failed",{userDid:e.substring(0,20)+"...",provider:t}),null}return this.config.logger("[IdpTokenResolver] Token expired and no refresh token",{userDid:e.substring(0,20)+"...",provider:t}),null}return this.config.logger("[IdpTokenResolver] Token resolved successfully",{userDid:e.substring(0,20)+"...",provider:t,expiresAt:new Date(n.expires_at).toISOString(),tokenUsage:n.tokenUsage}),n}}},50205:e=>{"use strict";var t=e.exports=function(e,t,n){"function"==typeof t&&(n=t,t={}),r(t,"function"==typeof(n=t.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function r(e,i,o,a,s,c,u,d,l,p){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var f in i(a,s,c,u,d,l,p),a){var h=a[f];if(Array.isArray(h)){if(f in t.arrayKeywords)for(var m=0;m<h.length;m++)r(e,i,o,h[m],s+"/"+f+"/"+m,c,s,f,a,m)}else if(f in t.propsKeywords){if(h&&"object"==typeof h)for(var g in h)r(e,i,o,h[g],s+"/"+f+"/"+n(g),c,s,f,a,g)}else(f in t.keywords||e.allKeys&&!(f in t.skipKeywords))&&r(e,i,o,h,s+"/"+f,c,s,f,a)}o(a,s,c,u,d,l,p)}}function n(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.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}},50550:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhAllowed=void 0,t.deriveKey=async function(e,t,r,i,o=new Uint8Array(0),s=new Uint8Array(0)){let f,h;if((0,c.isCryptoKey)(e))(0,u.checkEncCryptoKey)(e,"ECDH"),f=n.KeyObject.from(e);else{if(!(0,d.default)(e))throw new TypeError((0,l.default)(e,...p.types));f=e}if((0,c.isCryptoKey)(t))(0,u.checkEncCryptoKey)(t,"ECDH","deriveBits"),h=n.KeyObject.from(t);else{if(!(0,d.default)(t))throw new TypeError((0,l.default)(t,...p.types));h=t}const m=(0,a.concat)((0,a.lengthAndInput)(a.encoder.encode(r)),(0,a.lengthAndInput)(o),(0,a.lengthAndInput)(s),(0,a.uint32be)(i)),g=(0,n.diffieHellman)({privateKey:h,publicKey:f});return(0,a.concatKdf)(g,i,m)},t.generateEpk=async function(e){let t;if((0,c.isCryptoKey)(e))t=n.KeyObject.from(e);else{if(!(0,d.default)(e))throw new TypeError((0,l.default)(e,...p.types));t=e}switch(t.asymmetricKeyType){case"x25519":return f("x25519");case"x448":return f("x448");case"ec":{const e=(0,o.default)(t);return f("ec",{namedCurve:e})}default:throw new s.JOSENotSupported("Invalid or unsupported EPK")}};const n=r(77598),i=r(57975),o=r(90862),a=r(45935),s=r(39069),c=r(99135),u=r(60322),d=r(29994),l=r(71759),p=r(58242),f=(0,i.promisify)(n.generateKeyPair);t.ecdhAllowed=e=>["P-256","P-384","P-521","X25519","X448"].includes((0,o.default)(e))},51606:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OAuthService=t.defaultSecretResolver=void 0,t.defaultSecretResolver={async resolveSecret(e){if("undefined"!=typeof process&&process.env)return process.env[e]}},t.OAuthService=class{config;constructor(e){this.config={configService:e.configService,fetchProvider:e.fetchProvider,agentShieldApiUrl:e.agentShieldApiUrl,agentShieldApiKey:e.agentShieldApiKey,projectId:e.projectId,logger:e.logger||(()=>{}),secretResolver:e.secretResolver||t.defaultSecretResolver}}async resolveClientSecret(e){if(e.metadata?.clientSecretName){const t=e.metadata.clientSecretName;this.config.logger("[OAuthService] Resolving client secret by name",{secretName:t,version:e.metadata.clientSecretVersion});const r=await this.config.secretResolver.resolveSecret(t);if(r)return this.config.logger("[OAuthService] Client secret resolved successfully",{secretName:t}),r;this.config.logger("[OAuthService] Client secret not found in secure storage",{secretName:t})}if(e.clientSecret)return this.config.logger("[OAuthService] DEPRECATED: Using legacy clientSecret field - migrate to metadata.clientSecretName for better security",{telemetry:{event:"oauth.deprecated_client_secret_used",hasMetadata:!!e.metadata,hasSecretName:!!e.metadata?.clientSecretName}}),e.clientSecret}async exchangeToken(e,t,r,n){const i=(await this.config.configService.getOAuthConfig(this.config.projectId)).providers[e];if(!i)throw new Error(`Provider "${e}" not configured for project "${this.config.projectId}"`);if(i.supportsPKCE&&!i.proxyMode){if(!r)throw new Error(`Provider "${e}" requires PKCE code_verifier for token exchange`);return this.exchangeTokenPKCE(i,t,r,n||"")}if(i.proxyMode)return this.exchangeTokenProxy(i,t,r,n||"");throw new Error(`Provider "${e}" configuration is invalid: must support PKCE or use proxy mode`)}async exchangeTokenPKCE(e,t,r,n){const i=await this.resolveClientSecret(e);this.config.logger("[OAuthService] Exchanging token with PKCE",{provider:e.authorizationUrl,tokenUrl:e.tokenUrl,hasClientSecret:!!i,resolvedViaSecretName:!!e.metadata?.clientSecretName});const o={grant_type:"authorization_code",code:t,redirect_uri:n,client_id:e.clientId,code_verifier:r};i&&(o.client_secret=i);const a=await this.config.fetchProvider.fetch(e.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(o).toString()});if(!a.ok){const t=await a.text().catch(()=>"Unknown error");let r;try{r=JSON.parse(t)}catch{r={error:t}}const n=r.error_description||r.error||t;throw this.config.logger("[OAuthService] Token exchange failed",{status:a.status,error:n,provider:e.tokenUrl}),new Error(`Token exchange failed: ${n} (${a.status})`)}const s=await a.json();if(s.error)throw this.config.logger("[OAuthService] Token exchange returned error (200 status)",{error:s.error,errorDescription:s.error_description,errorUri:s.error_uri,provider:e.tokenUrl,responseKeys:Object.keys(s)}),new Error(`Token exchange failed: ${s.error_description||s.error}`);if(!s.access_token)throw this.config.logger("[OAuthService] Token response missing access_token",{responseKeys:Object.keys(s),provider:e.tokenUrl}),new Error("Token response missing access_token");const c=s.expires_in||3600,u=Date.now()+1e3*c,d={access_token:s.access_token,refresh_token:s.refresh_token,expires_in:c,expires_at:u,token_type:s.token_type||"Bearer",scope:s.scope};return this.config.logger("[OAuthService] Token exchange successful",{provider:e.tokenUrl,expiresAt:new Date(u).toISOString(),hasRefreshToken:!!d.refresh_token}),d}async exchangeTokenProxy(e,t,r,n){const i=`${this.config.agentShieldApiUrl}/api/v1/oauth/token`;this.config.logger("[OAuthService] Exchanging token via proxy",{proxyUrl:i,provider:e.authorizationUrl,hasCodeVerifier:!!r,supportsPKCE:e.supportsPKCE});const o={grant_type:"authorization_code",code:t,redirect_uri:n||"",provider:e.authorizationUrl,project_id:this.config.projectId};e.supportsPKCE&&r&&(o.code_verifier=r);const a=await this.config.fetchProvider.fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.agentShieldApiKey}`},body:JSON.stringify(o)});if(!a.ok){const e=await a.text().catch(()=>"Unknown error");let t;try{t=JSON.parse(e)}catch{t={error:e}}const r=t.error_description||t.error||e;throw this.config.logger("[OAuthService] Proxy token exchange failed",{status:a.status,error:r,proxyUrl:i}),new Error(`Proxy token exchange failed: ${r} (${a.status})`)}const s=await a.json(),c=s.data||s;if(!c.access_token)throw new Error("Proxy token response missing access_token");const u=c.expires_in||3600,d=Date.now()+1e3*u,l={access_token:c.access_token,refresh_token:c.refresh_token,expires_in:u,expires_at:d,token_type:c.token_type||"Bearer",scope:c.scope};return this.config.logger("[OAuthService] Proxy token exchange successful",{proxyUrl:i,expiresAt:new Date(d).toISOString(),hasRefreshToken:!!l.refresh_token}),l}async refreshToken(e,t){const r=(await this.config.configService.getOAuthConfig(this.config.projectId)).providers[e];return r?r.supportsPKCE&&!r.proxyMode?this.refreshTokenPKCE(r,t):r.proxyMode?this.refreshTokenProxy(r,t):null:(this.config.logger("[OAuthService] Provider not found for refresh",{provider:e}),null)}async refreshTokenPKCE(e,t){this.config.logger("[OAuthService] Refreshing token with PKCE",{provider:e.tokenUrl});try{const r=await this.config.fetchProvider.fetch(e.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t,client_id:e.clientId}).toString()});if(!r.ok)return this.config.logger("[OAuthService] Token refresh failed",{status:r.status,provider:e.tokenUrl}),null;const n=await r.json();if(!n.access_token)return this.config.logger("[OAuthService] Token refresh response missing access_token"),null;const i=n.expires_in||3600,o=Date.now()+1e3*i,a={access_token:n.access_token,refresh_token:n.refresh_token||t,expires_in:i,expires_at:o,token_type:n.token_type||"Bearer",scope:n.scope};return this.config.logger("[OAuthService] Token refresh successful",{provider:e.tokenUrl,expiresAt:new Date(o).toISOString()}),a}catch(t){return this.config.logger("[OAuthService] Token refresh error",{error:t instanceof Error?t.message:String(t),provider:e.tokenUrl}),null}}async refreshTokenProxy(e,t){const r=`${this.config.agentShieldApiUrl}/api/v1/oauth/token`;this.config.logger("[OAuthService] Refreshing token via proxy",{proxyUrl:r,provider:e.authorizationUrl});try{const n=await this.config.fetchProvider.fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.config.agentShieldApiKey}`},body:JSON.stringify({grant_type:"refresh_token",refresh_token:t,provider:e.authorizationUrl,project_id:this.config.projectId})});if(!n.ok)return this.config.logger("[OAuthService] Proxy token refresh failed",{status:n.status,proxyUrl:r}),null;const i=await n.json(),o=i.data||i;if(!o.access_token)return this.config.logger("[OAuthService] Proxy token refresh response missing access_token"),null;const a=o.expires_in||3600,s=Date.now()+1e3*a,c={access_token:o.access_token,refresh_token:o.refresh_token||t,expires_in:a,expires_at:s,token_type:o.token_type||"Bearer",scope:o.scope};return this.config.logger("[OAuthService] Proxy token refresh successful",{proxyUrl:r,expiresAt:new Date(s).toISOString()}),c}catch(e){return this.config.logger("[OAuthService] Proxy token refresh error",{error:e instanceof Error?e.message:String(e),proxyUrl:r}),null}}}},51708:(e,t,r)=>{"use strict";r.r(t),r.d(t,{canonicalize:()=>n.d,canonicalizeEx:()=>o});var n=r(77753),i=r(10985);function o(e,t){return(0,i.S)(e,t)}},51713:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LEGACY_WELL_KNOWN_IDENTITY_PATH=t.WELL_KNOWN_IDENTITY_PATH=t.LEGACY_INTERNAL_TOOL_PREFIX=t.INTERNAL_TOOL_PREFIX=t.LEGACY_SESSION_ID_PREFIX=t.SESSION_ID_PREFIX=void 0,t.recordWireForm=function(e,t,r){n.logger.info("[wire-format] dual-accept boundary",{telemetry:{event:"wire_form",boundary:e,form:t,...r}})},t.isInternalToolName=function(e){return e.startsWith(t.INTERNAL_TOOL_PREFIX)||e.startsWith(t.LEGACY_INTERNAL_TOOL_PREFIX)},t.normalizeInternalToolName=function(e){return e.startsWith(t.LEGACY_INTERNAL_TOOL_PREFIX)?t.INTERNAL_TOOL_PREFIX+e.slice(t.LEGACY_INTERNAL_TOOL_PREFIX.length):e};const n=r(76140);t.SESSION_ID_PREFIX="kyaos_",t.LEGACY_SESSION_ID_PREFIX="mcpi_",t.INTERNAL_TOOL_PREFIX="_kyaos_",t.LEGACY_INTERNAL_TOOL_PREFIX="_mcpi_",t.WELL_KNOWN_IDENTITY_PATH="/.well-known/kya-os-identity",t.LEGACY_WELL_KNOWN_IDENTITY_PATH="/.well-known/mcp-identity"},51967:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var n=r(36023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return n.KeywordCxt}});var i=r(38994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});const o=r(74383),a=r(4220),s=r(6247),c=r(91688),u=r(38994),d=r(89008),l=r(26419),p=r(67218),f=r(10114),h=r(18951),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";const g=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function b(e){var t,r,n,i,o,a,s,c,u,d,l,p,f,g,v,y,_,b,w,$,k,S,I,P,E;const x=e.strict,O=null===(t=e.code)||void 0===t?void 0:t.optimize,T=!0===O||void 0===O?1:O||0,A=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:m,C=null!==(i=e.uriResolver)&&void 0!==i?i:h.default;return{strictSchema:null===(a=null!==(o=e.strictSchema)&&void 0!==o?o:x)||void 0===a||a,strictNumbers:null===(c=null!==(s=e.strictNumbers)&&void 0!==s?s:x)||void 0===c||c,strictTypes:null!==(d=null!==(u=e.strictTypes)&&void 0!==u?u:x)&&void 0!==d?d:"log",strictTuples:null!==(p=null!==(l=e.strictTuples)&&void 0!==l?l:x)&&void 0!==p?p:"log",strictRequired:null!==(g=null!==(f=e.strictRequired)&&void 0!==f?f:x)&&void 0!==g&&g,code:e.code?{...e.code,optimize:T,regExp:A}:{optimize:T,regExp:A},loopRequired:null!==(v=e.loopRequired)&&void 0!==v?v:200,loopEnum:null!==(y=e.loopEnum)&&void 0!==y?y:200,meta:null===(_=e.meta)||void 0===_||_,messages:null===(b=e.messages)||void 0===b||b,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==($=e.schemaId)&&void 0!==$?$:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(S=e.validateSchema)||void 0===S||S,validateFormats:null===(I=e.validateFormats)||void 0===I||I,unicodeRegExp:null===(P=e.unicodeRegExp)||void 0===P||P,int32range:null===(E=e.int32range)||void 0===E||E,uriResolver:C}}class w{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:v,es5:t,lines:r}),this.logger=function(e){if(!1===e)return x;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),$.call(this,y,e,"NOT SUPPORTED"),$.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=E.call(this),e.formats&&I.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&P.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),S.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=f;"id"===r&&(n={...f},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await i.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,d.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=k.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new c.SchemaEnv({schema:{},schemaId:r});if(t=c.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=k.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,d.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(T.call(this,r,t),!t)return(0,p.eachItem)(r,e=>A.call(this,e)),this;j.call(this,t);const n={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,p.eachItem)(r,0===n.type.length?e=>A.call(this,e,n):e=>n.type.forEach(t=>A.call(this,e,n,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,o=i[e];n&&o&&(i[e]=z(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o;const{schemaId:a}=this.opts;if("object"==typeof e)o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let s=this._cache.get(e);if(void 0!==s)return s;r=(0,d.normalizeId)(o||r);const u=d.getSchemaRefs.call(this,e,r);return s=new c.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:u}),this._cache.set(s.schema,s),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=s),n&&this.validateSchema(e,!0),s}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):c.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,e)}finally{this.opts=t}}}function $(e,t,r,n="error"){for(const i in e){const o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function k(e){return e=(0,d.normalizeId)(e),this.schemas[e]||this.refs[e]}function S(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function I(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function P(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function E(){const e={...this.opts};for(const t of g)delete e[t];return e}w.ValidationError=o.default,w.MissingRefError=a.default,t.default=w;const x={log(){},warn(){},error(){}},O=/^[a-z_$][a-z0-9_$:-]*$/i;function T(e,t){const{RULES:r}=this;if((0,p.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!O.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function A(e,t,r){var n;const i=null==t?void 0:t.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let a=i?o.post:o.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;const s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?C.call(this,a,s,t.before):a.rules.push(s),o.all[e]=s,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function C(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=z(t)),e.validateSchema=this.compile(t,!0))}const D={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function z(e){return{anyOf:[e,D]}}},51997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(23665),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,n.validateTuple)(e,"items")};t.default=i},52150:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fetchRemoteConfig=async function(e,t){const{apiUrl:r,apiKey:i,projectId:o,agentDid:a,cacheTtl:s=3e5,fetchProvider:c}=e,u=o?`config:project:${o}`:a?`config:agent:${a}`:null;if(t&&u)try{const e=await t.get(u);if(e)try{const t=JSON.parse(e);if(t.expiresAt>Date.now())return t.config}catch{}}catch(e){console.warn("[RemoteConfig] Cache read failed:",e)}try{if(!o)return console.error("[RemoteConfig] projectId is required for user-scoped delegation. Agent-only scoping has been deprecated due to security concerns (cross-user delegation leakage). Please configure AGENTSHIELD_PROJECT_ID environment variable."),null;const e=`${r}${n.AGENTSHIELD_ENDPOINTS.CONFIG(o)}`,a=await c(e,{headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"}});if(!a.ok)return console.warn(`[RemoteConfig] API returned ${a.status}: ${a.statusText}`),null;const d=await a.json(),l=d.config||d.data?.config||(d.success?d.data:null);if(!l)return console.warn("[RemoteConfig] No config found in API response"),null;if(t&&u)try{await t.set(u,JSON.stringify({config:l,expiresAt:Date.now()+s}),s)}catch(e){console.warn("[RemoteConfig] Cache write failed:",e)}return l}catch(e){return console.warn("[RemoteConfig] Failed to fetch config:",e),null}},t.getToolProtection=function(e,t){const r=e?.toolProtection?.tools;if(!r)return null;let n=r[t];return!n&&r["*"]&&(n=r["*"]),n&&n.requiresDelegation?n:null},t.extractToolProtections=function(e){return e?.toolProtection?.tools?e.toolProtection.tools:{}},t.hasMergedToolProtections=function(e){if(!e||"object"!=typeof e)return!1;const t=e;return void 0!==t.toolProtection&&"object"==typeof t.toolProtection&&null!==t.toolProtection&&"tools"in t.toolProtection&&"object"==typeof t.toolProtection.tools&&null!==t.toolProtection.tools},t.getPolicy=o,t.extractPolicy=function(e){return e?.policy?e.policy:structuredClone(i.DEFAULT_POLICY_CONFIG)},t.hasMergedPolicy=function(e){if(!e||"object"!=typeof e)return!1;const t=e;return void 0!==t.policy&&"object"==typeof t.policy&&null!==t.policy},t.isPolicyEnabled=function(e){const t=o(e);return t?.enabled??!0};const n=r(82906),i=r(62408);function o(e){return e?.policy?e.policy:null}},52511:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OAUTH_CORS_HEADERS=t.PREFLIGHT_CORS_HEADERS=t.MCP_CORS_HEADERS=t.WELL_KNOWN_CORS_HEADERS=void 0,t.mergeCORSHeaders=function(e,r=t.WELL_KNOWN_CORS_HEADERS){return{...e,...r}},t.applyCORSHeaders=function(e,r=t.MCP_CORS_HEADERS){Object.entries(r).forEach(([t,r])=>{void 0!==r&&e.setHeader(t,r)})},t.WELL_KNOWN_CORS_HEADERS={"Access-Control-Allow-Origin":"*",Vary:"Origin"},t.MCP_CORS_HEADERS={"Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"mcp-session-id",Vary:"Origin"},t.PREFLIGHT_CORS_HEADERS={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Authorization, mcp-session-id, mcp-protocol-version",Vary:"Origin"},t.OAUTH_CORS_HEADERS={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Authorization, Accept, mcp-protocol-version","Access-Control-Expose-Headers":"Content-Type",Vary:"Origin"}},52691:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(39069),i=r(45935),o=r(24726),a=r(87925),s=r(71661),c=e=>e.toLowerCase().replace(/^application\//,"");t.default=(e,t,r={})=>{let u;try{u=JSON.parse(i.decoder.decode(t))}catch{}if(!(0,s.default)(u))throw new n.JWTInvalid("JWT Claims Set must be a top-level JSON object");const{typ:d}=r;if(d&&("string"!=typeof e.typ||c(e.typ)!==c(d)))throw new n.JWTClaimValidationFailed('unexpected "typ" JWT header value',u,"typ","check_failed");const{requiredClaims:l=[],issuer:p,subject:f,audience:h,maxTokenAge:m}=r,g=[...l];void 0!==m&&g.push("iat"),void 0!==h&&g.push("aud"),void 0!==f&&g.push("sub"),void 0!==p&&g.push("iss");for(const e of new Set(g.reverse()))if(!(e in u))throw new n.JWTClaimValidationFailed(`missing required "${e}" claim`,u,e,"missing");if(p&&!(Array.isArray(p)?p:[p]).includes(u.iss))throw new n.JWTClaimValidationFailed('unexpected "iss" claim value',u,"iss","check_failed");if(f&&u.sub!==f)throw new n.JWTClaimValidationFailed('unexpected "sub" claim value',u,"sub","check_failed");if(h&&(y="string"==typeof h?[h]:h,!("string"==typeof(v=u.aud)?y.includes(v):Array.isArray(v)&&y.some(Set.prototype.has.bind(new Set(v))))))throw new n.JWTClaimValidationFailed('unexpected "aud" claim value',u,"aud","check_failed");var v,y;let _;switch(typeof r.clockTolerance){case"string":_=(0,a.default)(r.clockTolerance);break;case"number":_=r.clockTolerance;break;case"undefined":_=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:b}=r,w=(0,o.default)(b||new Date);if((void 0!==u.iat||m)&&"number"!=typeof u.iat)throw new n.JWTClaimValidationFailed('"iat" claim must be a number',u,"iat","invalid");if(void 0!==u.nbf){if("number"!=typeof u.nbf)throw new n.JWTClaimValidationFailed('"nbf" claim must be a number',u,"nbf","invalid");if(u.nbf>w+_)throw new n.JWTClaimValidationFailed('"nbf" claim timestamp check failed',u,"nbf","check_failed")}if(void 0!==u.exp){if("number"!=typeof u.exp)throw new n.JWTClaimValidationFailed('"exp" claim must be a number',u,"exp","invalid");if(u.exp<=w-_)throw new n.JWTExpired('"exp" claim timestamp check failed',u,"exp","check_failed")}if(m){const e=w-u.iat;if(e-_>("number"==typeof m?m:(0,a.default)(m)))throw new n.JWTExpired('"iat" claim timestamp check failed (too far in the past)',u,"iat","check_failed");if(e<0-_)throw new n.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',u,"iat","check_failed")}return u}},52864:(e,t,r)=>{"use strict";let n;Object.defineProperty(t,"__esModule",{value:!0}),t.loadDifCore=function(){return n??=r.e(160).then(r.bind(r,34160))}},52884:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryIdentityProvider=t.MemoryNonceCacheProvider=t.MemoryStorageProvider=void 0;const n=r(3842);class i extends n.StorageProvider{store=new Map;async get(e){return this.store.get(e)??null}async set(e,t){this.store.set(e,t)}async delete(e){this.store.delete(e)}async exists(e){return this.store.has(e)}async list(e){const t=Array.from(this.store.keys());return e?t.filter(t=>t.startsWith(e)):t}}t.MemoryStorageProvider=i;class o extends n.NonceCacheProvider{nonces=new Map;async has(e,t){const r=t?`nonce:${t}:${e}`:`nonce:${e}`,n=this.nonces.get(r);return!(!n||Date.now()>n&&(this.nonces.delete(r),1))}async add(e,t,r){const n=r?`nonce:${r}:${e}`:`nonce:${e}`,i=Date.now()+1e3*t;this.nonces.set(n,i)}async cleanup(){const e=Date.now();for(const[t,r]of this.nonces)e>r&&this.nonces.delete(t)}async destroy(){this.nonces.clear()}}t.MemoryNonceCacheProvider=o;class a extends n.IdentityProvider{identity;cryptoProvider;constructor(e){super(),this.cryptoProvider=e}async getIdentity(){return this.identity||(this.identity=await this.generateIdentity()),this.identity}async saveIdentity(e){this.identity=e}async rotateKeys(){return this.identity=await this.generateIdentity(),this.identity}async deleteIdentity(){this.identity=void 0}async generateIdentity(){if(!this.cryptoProvider)throw new Error("Crypto provider required for identity generation");const e=await this.cryptoProvider.generateKeyPair(),t=this.generateDIDFromPublicKey(e.publicKey);return{did:t,kid:`${t}#key-1`,privateKey:e.privateKey,publicKey:e.publicKey,createdAt:(new Date).toISOString(),type:"development"}}generateDIDFromPublicKey(e){return`did:key:z${Buffer.from(e,"base64").toString("base64url").substring(0,32)}`}}t.MemoryIdentityProvider=a},53898:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OAuthProviderRegistry=void 0,t.OAuthProviderRegistry=class{configService;validator;providers=new Map;_configuredProvider=null;constructor(e,t){this.configService=e,this.validator=t}async loadFromAgentShield(e){const t=await this.configService.getOAuthConfig(e);this.providers.clear(),this._configuredProvider=t.configuredProvider||null;for(const[e,r]of Object.entries(t.providers))this.providers.set(e,r)}getConfiguredProvider(){return this._configuredProvider}getProvider(e){return this.providers.get(e)||null}getAllProviders(){return Array.from(this.providers.values())}hasProvider(e){return this.providers.has(e)}getProviderNames(){return Array.from(this.providers.keys())}registerCustomProvider(e,t){this.validator&&this.validator.validate(t,e),this.providers.set(e,t)}getProviderWithParams(e){return this.getProvider(e)||null}}},54992:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generalDecrypt=async function(e,t,r){if(!(0,o.default)(e))throw new i.JWEInvalid("General JWE must be an object");if(!Array.isArray(e.recipients)||!e.recipients.every(o.default))throw new i.JWEInvalid("JWE Recipients missing or incorrect type");if(!e.recipients.length)throw new i.JWEInvalid("JWE Recipients has no members");for(const i of e.recipients)try{return await(0,n.flattenedDecrypt)({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:i.encrypted_key,header:i.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,r)}catch{}throw new i.JWEDecryptionFailed};const n=r(70331),i=r(39069),o=r(71661)},55116:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8956);t.default=n.default},55403:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedVerify=async function(e,t,r){if(!(0,c.default)(e))throw new o.JWSInvalid("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new o.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new o.JWSInvalid("JWS Protected Header incorrect type");if(void 0===e.payload)throw new o.JWSInvalid("JWS Payload missing");if("string"!=typeof e.signature)throw new o.JWSInvalid("JWS Signature missing or incorrect type");if(void 0!==e.header&&!(0,c.default)(e.header))throw new o.JWSInvalid("JWS Unprotected Header incorrect type");let h={};if(e.protected)try{const t=(0,n.decode)(e.protected);h=JSON.parse(a.decoder.decode(t))}catch{throw new o.JWSInvalid("JWS Protected Header is invalid")}if(!(0,s.default)(h,e.header))throw new o.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const m={...h,...e.header};let g=!0;if((0,d.default)(o.JWSInvalid,new Map([["b64",!0]]),r?.crit,h,m).has("b64")&&(g=h.b64,"boolean"!=typeof g))throw new o.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:v}=m;if("string"!=typeof v||!v)throw new o.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');const y=r&&(0,l.default)("algorithms",r.algorithms);if(y&&!y.has(v))throw new o.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');if(g){if("string"!=typeof e.payload)throw new o.JWSInvalid("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new o.JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let _=!1;"function"==typeof t?(t=await t(h,e),_=!0,(0,u.checkKeyTypeWithJwk)(v,t,"verify"),(0,p.isJWK)(t)&&(t=await(0,f.importJWK)(t,v))):(0,u.checkKeyTypeWithJwk)(v,t,"verify");const b=(0,a.concat)(a.encoder.encode(e.protected??""),a.encoder.encode("."),"string"==typeof e.payload?a.encoder.encode(e.payload):e.payload);let w,$;try{w=(0,n.decode)(e.signature)}catch{throw new o.JWSInvalid("Failed to base64url decode the signature")}if(!await(0,i.default)(v,t,w,b))throw new o.JWSSignatureVerificationFailed;if(g)try{$=(0,n.decode)(e.payload)}catch{throw new o.JWSInvalid("Failed to base64url decode the payload")}else $="string"==typeof e.payload?a.encoder.encode(e.payload):e.payload;const k={payload:$};return void 0!==e.protected&&(k.protectedHeader=h),void 0!==e.header&&(k.unprotectedHeader=e.header),_?{...k,key:t}:k};const n=r(3508),i=r(34119),o=r(39069),a=r(45935),s=r(91146),c=r(71661),u=r(89666),d=r(82880),l=r(18610),p=r(45380),f=r(68846)},55750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createCapabilityVerifier=function(e={}){const t=e.signatureVerifier??(0,i.createVcJwtSignatureVerifier)({didResolver:e.didResolver});return async(e,r)=>{const i=Array.isArray(e)?e:[],o=[],a=[];for(const e of i)"string"==typeof e?o.push(e):a.push(e);const s=await(0,n.verifyCapabilities)(a,{agentDid:r.subjectDid,trustedIssuers:[...r.trustedIssuers],signatureVerifier:t}),c=s.valid,u=new Set(c);return{verified:c,unverified:Array.from(new Set([...o,...s.invalid.map(e=>e.capability)])).filter(e=>!u.has(e))}}};const n=r(41586),i=r(78919)},55921:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationGraphManager=void 0,t.createDelegationGraph=function(e){return new r(e)};class r{storage;constructor(e){this.storage=e}async registerDelegation(e){const t={id:e.id,parentId:e.parentId,children:[],issuerDid:e.issuerDid,subjectDid:e.subjectDid,credentialStatusId:e.credentialStatusId};return await this.storage.setNode(t),e.parentId&&await this.addChildToParent(e.parentId,e.id),t}async addChildToParent(e,t){const r=await this.storage.getNode(e);if(!r)throw new Error(`Parent delegation not found: ${e}`);r.children.includes(t)||(r.children.push(t),await this.storage.setNode(r))}async getNode(e){return this.storage.getNode(e)}async getChildren(e){return this.storage.getChildren(e)}async getDescendants(e){return this.storage.getDescendants(e)}async getChain(e){return this.storage.getChain(e)}async isAncestor(e,t){return(await this.getChain(t)).some(t=>t.id===e)}async getDepth(e){return(await this.getChain(e)).length-1}async validateChain(e){const t=await this.getChain(e);if(0===t.length)return{valid:!1,reason:"Delegation not found"};for(let e=1;e<t.length;e++){const r=t[e-1],n=t[e];if(n.issuerDid!==r.subjectDid)return{valid:!1,reason:`Invalid chain: ${n.id} issued by ${n.issuerDid} but parent ${r.id} subject is ${r.subjectDid}`};if(n.parentId!==r.id)return{valid:!1,reason:`Invalid chain: ${n.id} parentId=${n.parentId} but actual parent is ${r.id}`}}return{valid:!0}}async removeDelegation(e){const t=await this.storage.getNode(e);if(t){if(t.parentId){const r=await this.storage.getNode(t.parentId);r&&(r.children=r.children.filter(t=>t!==e),await this.storage.setNode(r))}await this.storage.deleteNode(e)}}}t.DelegationGraphManager=r},56497:(e,t)=>{"use strict";function r(e){const t=e.length%4;return 0===t?e:e+"=".repeat((4-t)%4)}Object.defineProperty(t,"__esModule",{value:!0}),t.base64urlDecodeToString=function(e){const t=r(e).replace(/-/g,"+").replace(/_/g,"/");if("undefined"!=typeof Buffer){if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw new Error("Invalid base64url string: contains invalid characters");try{return Buffer.from(t,"base64").toString("utf-8")}catch(e){throw new Error(`Invalid base64url string: ${e instanceof Error?e.message:String(e)}`)}}if("undefined"!=typeof atob)try{const e=atob(t);if("undefined"!=typeof TextDecoder){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return(new TextDecoder).decode(t)}return e}catch(e){throw new Error(`Invalid base64url string: ${e instanceof Error?e.message:String(e)}`)}throw new Error("Neither Buffer nor atob is available")},t.base64urlDecodeToBytes=function(e){const t=r(e).replace(/-/g,"+").replace(/_/g,"/");if("undefined"!=typeof atob)try{const e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r}catch(e){throw new Error(`Invalid base64url string: ${e instanceof Error?e.message:String(e)}`)}return new Uint8Array(Buffer.from(t,"base64"))},t.base64urlEncodeFromString=function(e){if("undefined"!=typeof Buffer)return Buffer.from(e,"utf-8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");if("undefined"!=typeof btoa)try{const t=(new TextEncoder).encode(e),r=Array.from(t).map(e=>String.fromCharCode(e)).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}catch{return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}throw new Error("Neither Buffer nor btoa is available")},t.base64urlEncodeFromBytes=function(e){if("undefined"!=typeof btoa){const t=Array.from(e).map(e=>String.fromCharCode(e)).join("");return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}return Buffer.from(e).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},t.bytesToBase64=function(e){if("undefined"!=typeof btoa){const t=Array.from(e).map(e=>String.fromCharCode(e)).join("");return btoa(t)}return Buffer.from(e).toString("base64")},t.base64ToBytes=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=(4-t.length%4)%4;if(t+="=".repeat(r),"undefined"!=typeof atob){const e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r}return new Uint8Array(Buffer.from(t,"base64"))}},57975:e=>{"use strict";e.exports=require("node:util")},58242:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0;const n=r(99135),i=r(29994);t.default=e=>(0,i.default)(e)||(0,n.isCryptoKey)(e);const o=["KeyObject"];t.types=o,(globalThis.CryptoKey||n.default?.CryptoKey)&&o.push("CryptoKey")},58459:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsecuredJWT=void 0;const n=r(3508),i=r(45935),o=r(39069),a=r(52691),s=r(59333);class c extends s.ProduceJWT{encode(){return`${n.encode(JSON.stringify({alg:"none"}))}.${n.encode(JSON.stringify(this._payload))}.`}static decode(e,t){if("string"!=typeof e)throw new o.JWTInvalid("Unsecured JWT must be a string");const{0:r,1:s,2:c,length:u}=e.split(".");if(3!==u||""!==c)throw new o.JWTInvalid("Invalid Unsecured JWT");let d;try{if(d=JSON.parse(i.decoder.decode(n.decode(r))),"none"!==d.alg)throw new Error}catch{throw new o.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,a.default)(d,n.decode(s),t),header:d}}}t.UnsecuredJWT=c},58621:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compactDecrypt=async function(e,t,r){if(e instanceof Uint8Array&&(e=o.decoder.decode(e)),"string"!=typeof e)throw new i.JWEInvalid("Compact JWE must be a string or Uint8Array");const{0:a,1:s,2:c,3:u,4:d,length:l}=e.split(".");if(5!==l)throw new i.JWEInvalid("Invalid Compact JWE");const p=await(0,n.flattenedDecrypt)({ciphertext:u,iv:c||void 0,protected:a,tag:d||void 0,encrypted_key:s||void 0},t,r),f={plaintext:p.plaintext,protectedHeader:p.protectedHeader};return"function"==typeof t?{...f,key:p.key}:f};const n=r(70331),i=r(39069),o=r(45935)},59035:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const n=r(28825),i=r(38994),o=i.operators,a={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:e,schemaCode:t})=>i.str`should be ${a[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>i._`{comparison: ${a[e].okStr}, limit: ${t}}`};t.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:s,code(e){const{gen:t,data:r,schemaCode:o,keyword:s,it:c}=e,{opts:u,self:d}=c;if(!u.validateFormats)return;const l=new n.KeywordCxt(c,d.RULES.all.format.definition,"format");function p(e){return i._`${e}.compare(${r}, ${o}) ${a[s].fail} 0`}l.$data?function(){const r=t.scopeValue("formats",{ref:d.formats,code:u.code.formats}),n=t.const("fmt",i._`${r}[${l.schemaCode}]`);e.fail$data((0,i.or)(i._`typeof ${n} != "object"`,i._`${n} instanceof RegExp`,i._`typeof ${n}.compare != "function"`,p(n)))}():function(){const r=l.schema,n=d.formats[r];if(!n||!0===n)return;if("object"!=typeof n||n instanceof RegExp||"function"!=typeof n.compare)throw new Error(`"${s}": format "${r}" does not define "compare" function`);const o=t.scopeValue("formats",{key:r,ref:n,code:u.code.formats?i._`${u.code.formats}${(0,i.getProperty)(r)}`:void 0});e.fail$data(p(o))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},59333:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProduceJWT=void 0;const n=r(24726),i=r(71661),o=r(87925);function a(e,t){if(!Number.isFinite(t))throw new TypeError(`Invalid ${e} input`);return t}t.ProduceJWT=class{_payload;constructor(e={}){if(!(0,i.default)(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return"number"==typeof e?this._payload={...this._payload,nbf:a("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:a("setNotBefore",(0,n.default)(e))}:this._payload={...this._payload,nbf:(0,n.default)(new Date)+(0,o.default)(e)},this}setExpirationTime(e){return"number"==typeof e?this._payload={...this._payload,exp:a("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:a("setExpirationTime",(0,n.default)(e))}:this._payload={...this._payload,exp:(0,n.default)(new Date)+(0,o.default)(e)},this}setIssuedAt(e){return void 0===e?this._payload={...this._payload,iat:(0,n.default)(new Date)}:e instanceof Date?this._payload={...this._payload,iat:a("setIssuedAt",(0,n.default)(e))}:this._payload="string"==typeof e?{...this._payload,iat:a("setIssuedAt",(0,n.default)(new Date)+(0,o.default)(e))}:{...this._payload,iat:a("setIssuedAt",e)},this}}},59768:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){switch(e){case"HS256":return"sha256";case"HS384":return"sha384";case"HS512":return"sha512";default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};const n=r(39069)},60322:(e,t)=>{"use strict";function r(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function n(e,t){return e.name===t}function i(e){return parseInt(e.name.slice(4),10)}function o(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.checkSigCryptoKey=function(e,t,...a){switch(t){case"HS256":case"HS384":case"HS512":{if(!n(e.algorithm,"HMAC"))throw r("HMAC");const o=parseInt(t.slice(2),10);if(i(e.algorithm.hash)!==o)throw r(`SHA-${o}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!n(e.algorithm,"RSASSA-PKCS1-v1_5"))throw r("RSASSA-PKCS1-v1_5");const o=parseInt(t.slice(2),10);if(i(e.algorithm.hash)!==o)throw r(`SHA-${o}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!n(e.algorithm,"RSA-PSS"))throw r("RSA-PSS");const o=parseInt(t.slice(2),10);if(i(e.algorithm.hash)!==o)throw r(`SHA-${o}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw r("Ed25519 or Ed448");break;case"Ed25519":if(!n(e.algorithm,"Ed25519"))throw r("Ed25519");break;case"ES256":case"ES384":case"ES512":{if(!n(e.algorithm,"ECDSA"))throw r("ECDSA");const i=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==i)throw r(i,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}o(e,a)},t.checkEncCryptoKey=function(e,t,...a){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!n(e.algorithm,"AES-GCM"))throw r("AES-GCM");const i=parseInt(t.slice(1,4),10);if(e.algorithm.length!==i)throw r(i,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!n(e.algorithm,"AES-KW"))throw r("AES-KW");const i=parseInt(t.slice(1,4),10);if(e.algorithm.length!==i)throw r(i,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw r("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!n(e.algorithm,"PBKDF2"))throw r("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!n(e.algorithm,"RSA-OAEP"))throw r("RSA-OAEP");const o=parseInt(t.slice(9),10)||1;if(i(e.algorithm.hash)!==o)throw r(`SHA-${o}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}o(e,a)}},60422:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoOpToolProtectionCache=t.InMemoryToolProtectionCache=void 0,t.InMemoryToolProtectionCache=class{cache=new Map;async get(e){const t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.value:null}async set(e,t,r){if(r<=0)return;const n=Date.now()+r;this.cache.set(e,{value:t,expiresAt:n})}async clear(){this.cache.clear()}async delete(e){this.cache.delete(e)}cleanup(){const e=Date.now();for(const[t,r]of this.cache.entries())e>r.expiresAt&&this.cache.delete(t)}getStale(e){const t=this.cache.get(e);return t?t.value:null}getExpiresAt(e){const t=this.cache.get(e);return t?t.expiresAt:null}},t.NoOpToolProtectionCache=class{async get(e){return null}async set(e,t,r){}async clear(){}async delete(e){}}},60808:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.jwtDecrypt=async function(e,t,r){const a=await(0,n.compactDecrypt)(e,t,r),s=(0,i.default)(a.protectedHeader,a.plaintext,r),{protectedHeader:c}=a;if(void 0!==c.iss&&c.iss!==s.iss)throw new o.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',s,"iss","mismatch");if(void 0!==c.sub&&c.sub!==s.sub)throw new o.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',s,"sub","mismatch");if(void 0!==c.aud&&JSON.stringify(c.aud)!==JSON.stringify(s.aud))throw new o.JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',s,"aud","mismatch");const u={payload:s,protectedHeader:c};return"function"==typeof t?{...u,key:a.key}:u};const n=r(58621),i=r(52691),o=r(39069)},61494:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralSign=void 0;const n=r(30131),i=r(39069);class o{parent;protectedHeader;unprotectedHeader;options;key;constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setProtectedHeader(e){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}}t.GeneralSign=class{_payload;_signatures=[];constructor(e){this._payload=e}addSignature(e,t){const r=new o(this,e,t);return this._signatures.push(r),r}async sign(){if(!this._signatures.length)throw new i.JWSInvalid("at least one signature must be added");const e={signatures:[],payload:""};for(let t=0;t<this._signatures.length;t++){const r=this._signatures[t],o=new n.FlattenedSign(this._payload);o.setProtectedHeader(r.protectedHeader),o.setUnprotectedHeader(r.unprotectedHeader);const{payload:a,...s}=await o.sign(r.key,r.options);if(0===t)e.payload=a;else if(e.payload!==a)throw new i.JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(s)}return e}}},61940:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SchemaVerifier=void 0,t.createSchemaVerifier=function(e){return new r(e)};class r{schemasBaseUrl="https://schema.modelcontextprotocol-identity.io";schemaCache=new Map;constructor(e){e?.schemasBaseUrl&&(this.schemasBaseUrl=e.schemasBaseUrl)}async verifySchema(e,t){const r=[],n=[],i=[];let o;try{o=await this.fetchSchema(e.url)}catch(t){return{schema:e,compliant:!1,compliancePercentage:0,fields:[],issues:[`Failed to fetch schema: ${t instanceof Error?t.message:"Unknown error"}`],warnings:[],timestamp:Date.now()}}const a=this.resolveRef(o,o),s=this.validateAgainstSchema(t,a,o,"");r.push(...s.fields);for(const e of r)"fail"===e.status?n.push(`${e.fieldPath}: ${e.reason}`):"warning"===e.status&&i.push(`${e.fieldPath}: ${e.reason}`);const c=r.filter(e=>e.required),u=c.filter(e=>"pass"===e.status).length,d=c.length>0?u/c.length*100:100;return{schema:e,compliant:0===n.length&&d>=95,compliancePercentage:d,fields:r,issues:n,warnings:i,timestamp:Date.now()}}async verifyAll(e,t){const r=[],n=[];for(const i of e){const e=t.get(i.id);if(!e){n.push(`No implementation found for schema: ${i.id}`);continue}const o=await this.verifySchema(i,e);r.push(o),o.compliant||n.push(`${i.id}: ${o.issues.join(", ")}`)}const i=r.filter(e=>e.compliant).length,o=e.length>0?i/e.length*100:0;return{totalSchemas:e.length,compliantSchemas:i,overallCompliance:o,schemaReports:r,criticalIssues:n,timestamp:Date.now()}}validateAgainstSchema(e,t,r,n){const i=[];if((t=this.resolveRef(t,r)).oneOf||t.anyOf||t.allOf)return this.validateUnion(e,t,r,n);if("object"===t.type&&t.properties){const o=t.required||[];for(const[a,s]of Object.entries(t.properties)){const t=n?`${n}.${a}`:a,c=e?.[a],u=o.includes(a),d=this.checkField(t,c,s,r,u);if(i.push(d),void 0!==c&&"object"===s.type){const e=this.validateAgainstSchema(c,s,r,t);i.push(...e.fields)}}}if("array"===t.type&&e&&Array.isArray(e)){const o=this.validateArray(e,t,r,n);i.push(...o.fields)}return{fields:i}}validateUnion(e,t,r,n){const i=[];if(t.anyOf||t.oneOf){const o=t.anyOf||t.oneOf;let a=!1;for(const t of o){const o=this.resolveRef(t,r);try{if(this.matchesSchema(e,o,r)){const t=this.validateAgainstSchema(e,o,r,n);i.push(...t.fields),a=!0;break}}catch(e){continue}}!a&&n&&i.push({fieldPath:n,present:void 0!==e,expectedType:"oneOf/anyOf options",actualType:typeof e,typeMatches:!1,required:!0,status:"fail",reason:"Value does not match any of the schema options"})}if(t.allOf)for(const o of t.allOf){const t=this.resolveRef(o,r),a=this.validateAgainstSchema(e,t,r,n);i.push(...a.fields)}return{fields:i}}matchesSchema(e,t,r){if((t=this.resolveRef(t,r)).type){const r=Array.isArray(e)?"array":typeof e;if("integer"===t.type&&"number"===r){if(!Number.isInteger(e))return!1}else if(t.type!==r)return!1}if(void 0!==t.const&&e!==t.const)return!1;if(t.enum&&!t.enum.includes(e))return!1;if(t.pattern&&"string"==typeof e&&!new RegExp(t.pattern).test(e))return!1;if("object"===t.type&&t.required)for(const r of t.required)if(!(r in e))return!1;return!0}validateArray(e,t,r,n){const i=[];if(void 0!==t.minItems&&e.length<t.minItems&&i.push({fieldPath:`${n}.length`,present:!0,expectedType:`array with minItems: ${t.minItems}`,actualType:`array with length: ${e.length}`,typeMatches:!1,required:!0,status:"fail",reason:`Array length ${e.length} is less than minItems ${t.minItems}`}),Array.isArray(t.items)){for(let o=0;o<t.items.length;o++){const a=t.items[o],s=e[o],c=`${n}[${o}]`;if(void 0!==s){const e=this.resolveRef(a,r),t=this.validateAgainstSchema(s,e,r,c);i.push(...t.fields)}}if(void 0!==t.additionalItems&&e.length>t.items.length)for(let o=t.items.length;o<e.length;o++){const a=e[o],s=`${n}[${o}]`,c=this.validateAgainstSchema(a,t.additionalItems,r,s);i.push(...c.fields)}}else if(t.items)for(let o=0;o<e.length;o++){const a=e[o],s=`${n}[${o}]`,c=this.resolveRef(t.items,r),u=this.validateAgainstSchema(a,c,r,s);i.push(...u.fields)}if(t.contains){const o=this.resolveRef(t.contains,r);e.some(e=>this.matchesSchema(e,o,r))||i.push({fieldPath:`${n}.contains`,present:!0,expectedType:"array containing matching item",actualType:"array without matching item",typeMatches:!1,required:!0,status:"fail",reason:'Array does not contain any item matching the "contains" schema'})}return{fields:i}}checkField(e,t,r,n,i){r=this.resolveRef(r,n);const o=void 0!==t,a=this.getActualType(t);let s="unknown";return r.type?s=r.type:r.anyOf?s="anyOf":r.oneOf?s="oneOf":r.allOf&&(s="allOf"),i&&!o?{fieldPath:e,present:o,expectedType:s,actualType:a,typeMatches:!1,required:i,status:"fail",reason:"Required field missing"}:i||o?this.matchesSchema(t,r,n)?{fieldPath:e,present:o,expectedType:s,actualType:a,typeMatches:!0,required:i,status:"pass"}:{fieldPath:e,present:o,expectedType:s,actualType:a,typeMatches:!1,required:i,status:"fail",reason:"Type/value mismatch"}:{fieldPath:e,present:o,expectedType:s,actualType:a,typeMatches:!0,required:i,status:"pass"}}getActualType(e){return null===e?"null":Array.isArray(e)?"array":"number"==typeof e&&Number.isInteger(e)?"integer":typeof e}resolveRef(e,t){if(!e.$ref)return e;const r=e.$ref;if(r.startsWith("#/definitions/")){const e=r.substring(14);if(t.definitions&&t.definitions[e])return t.definitions[e]}if(r.startsWith("#/$defs/")){const e=r.substring(8);if(t.$defs&&t.$defs[e])return t.$defs[e]}return"#"===r?t:e}async fetchSchema(e){if(this.schemaCache.has(e))return this.schemaCache.get(e);try{const t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const r=await t.json();return this.schemaCache.set(e,r),r}catch(t){if(t instanceof Error)throw new Error(`Failed to fetch schema from ${e}: ${t.message}`);throw new Error(`Failed to fetch schema from ${e}: Unknown error`)}}generateReport(e){const t=[];t.push(`\n${"=".repeat(80)}`),t.push(`SCHEMA COMPLIANCE REPORT: ${e.schema.id}`),t.push(`${"=".repeat(80)}\n`),t.push(`Schema: ${e.schema.type} v${e.schema.version}`),t.push(`URL: ${e.schema.url}`),t.push("Status: "+(e.compliant?"ā
COMPLIANT":"ā NON-COMPLIANT")),t.push(`Compliance: ${e.compliancePercentage.toFixed(1)}%\n`),e.issues.length>0&&(t.push(`\nšØ ISSUES (${e.issues.length}):`),e.issues.forEach((e,r)=>{t.push(` ${r+1}. ${e}`)})),e.warnings.length>0&&(t.push(`\nā ļø WARNINGS (${e.warnings.length}):`),e.warnings.forEach((e,r)=>{t.push(` ${r+1}. ${e}`)})),t.push("\nš FIELD DETAILS:\n");const r=e.fields.filter(e=>e.required),n=r.filter(e=>"pass"===e.status).length,i=r.filter(e=>"fail"===e.status).length,o=e.fields.filter(e=>"warning"===e.status).length;return t.push(` ā
Pass: ${n}/${r.length} required fields`),t.push(` ā Fail: ${i}/${r.length} required fields`),t.push(` ā ļø Warn: ${o} optional fields`),t.push(` š Total: ${e.fields.length} fields checked\n`),t.push(`${"=".repeat(80)}\n`),t.join("\n")}generateFullReport(e){const t=[];return t.push(`\n${"=".repeat(80)}`),t.push("FULL SCHEMA COMPLIANCE REPORT"),t.push(`${"=".repeat(80)}\n`),t.push(`Total Schemas: ${e.totalSchemas}`),t.push(`Compliant: ${e.compliantSchemas}`),t.push("Non-Compliant: "+(e.totalSchemas-e.compliantSchemas)),t.push(`Overall Compliance: ${e.overallCompliance.toFixed(1)}%\n`),e.criticalIssues.length>0&&(t.push(`\nšØ CRITICAL ISSUES (${e.criticalIssues.length}):`),e.criticalIssues.slice(0,10).forEach((e,r)=>{t.push(` ${r+1}. ${e}`)}),e.criticalIssues.length>10&&t.push(` ... and ${e.criticalIssues.length-10} more issues`)),t.push("\nš SCHEMA BREAKDOWN:\n"),e.schemaReports.forEach(e=>{const r=e.compliant?"ā
":"ā",n=e.compliancePercentage.toFixed(1);t.push(` ${r} ${e.schema.id}: ${n}%`)}),t.push(`\n${"=".repeat(80)}\n`),t.join("\n")}}t.SchemaVerifier=r},62408:e=>{"use strict";e.exports=require("@kya-os/contracts")},63146:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEd25519DidKey=c,t.extractPublicKeyFromDidKey=u,t.publicKeyToJwk=d,t.createDidKeyResolver=function(){return{resolve:async e=>{if(!c(e))return null;const t=u(e);if(!t)return null;const r=d(t),n=e.replace("did:key:",""),o=(0,i.didKeyFragment)(e);return{id:e,verificationMethod:[{id:`${e}#${o}`,type:"Ed25519VerificationKey2020",controller:e,publicKeyJwk:r,publicKeyMultibase:n}],authentication:[`${e}#${o}`],assertionMethod:[`${e}#${o}`]}}}},t.resolveDidKeySync=function(e){if(!c(e))return null;const t=u(e);if(!t)return null;const r=d(t),n=e.replace("did:key:",""),o=(0,i.didKeyFragment)(e);return{id:e,verificationMethod:[{id:`${e}#${o}`,type:"Ed25519VerificationKey2020",controller:e,publicKeyJwk:r,publicKeyMultibase:n}],authentication:[`${e}#${o}`],assertionMethod:[`${e}#${o}`]}};const n=r(69459),i=r(75306),o=r(98448),a=new Uint8Array([237,1]),s=32;function c(e){return e.startsWith("did:key:z6Mk")}function u(e){if(!e.startsWith("did:key:z"))return null;try{const t=e.replace("did:key:","").slice(1),r=(0,n.base58Decode)(t);return r.length<a.length+s||r[0]!==a[0]||r[1]!==a[1]?null:r.slice(a.length)}catch{return null}}function d(e){return{kty:"OKP",crv:"Ed25519",x:(0,o.base64urlEncodeFromBytes)(e)}}},63969:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canonicalizeJSON=function e(t){if(null===t)return"null";if("boolean"==typeof t)return t.toString();if("number"==typeof t){if(!isFinite(t))throw new Error("Cannot canonicalize non-finite number");return JSON.stringify(t)}if("string"==typeof t)return JSON.stringify(t);if(Array.isArray(t))return"["+t.map(t=>e(t)).join(",")+"]";if("object"==typeof t)return"{"+Object.keys(t).sort().map(r=>{const n=e(t[r]);return JSON.stringify(r)+":"+n}).join(",")+"}";throw new Error("Cannot canonicalize type: "+typeof t)},t.createUnsignedVCJWT=function(e,t={}){const r={alg:"EdDSA",typ:"JWT"};t.keyId&&(r.kid=t.keyId);const i="string"==typeof e.issuer?e.issuer:e.issuer?.id,o=e.credentialSubject?.id;let a,s;e.expirationDate&&"string"==typeof e.expirationDate&&(a=Math.floor(new Date(e.expirationDate).getTime()/1e3)),e.issuanceDate&&"string"==typeof e.issuanceDate&&(s=Math.floor(new Date(e.issuanceDate).getTime()/1e3));const c={...e};delete c.proof;const u={iss:i,vc:c};o&&(u.sub=o),a&&(u.exp=a),s&&(u.iat=s),e.id&&"string"==typeof e.id&&(u.jti=e.id);const d=(0,n.base64urlEncodeFromString)(JSON.stringify(r)),l=(0,n.base64urlEncodeFromString)(JSON.stringify(u));return{header:r,payload:u,encodedHeader:d,encodedPayload:l,signingInput:`${d}.${l}`}},t.completeVCJWT=function(e,t){return`${e}.${t}`},t.parseVCJWT=function(e){const t=e.split(".");if(3!==t.length)return null;try{const e=i(t[0]),r=i(t[1]);return{header:JSON.parse(e),payload:JSON.parse(r),signature:t[2],signingInput:`${t[0]}.${t[1]}`}}catch{return null}};const n=r(98448);function i(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/");return"undefined"!=typeof atob?atob(t):Buffer.from(t,"base64").toString("utf-8")}},65358:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o=r(6013),a={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>n._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:a,schema:s,schemaCode:c,it:u}=e;if(!a&&0===s.length)throw new Error("enum must have non-empty array");const d=s.length>=u.opts.loopEnum;let l;const p=()=>null!=l?l:l=(0,i.useFunc)(t,o.default);let f;if(d||a)f=t.let("valid"),e.block$data(f,function(){t.assign(f,!1),t.forOf("v",c,e=>t.if(n._`${p()}(${r}, ${e})`,()=>t.assign(f,!0).break()))});else{if(!Array.isArray(s))throw new Error("ajv implementation error");const e=t.const("vSchema",c);f=(0,n.or)(...s.map((t,i)=>function(e,t){const i=s[t];return"object"==typeof i&&null!==i?n._`${p()}(${r}, ${e}[${t}])`:n._`${r} === ${i}`}(e,i)))}e.pass(f)}};t.default=a},66766:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598);t.default=e=>e.d?(0,n.createPrivateKey)({format:"jwk",key:e}):(0,n.createPublicKey)({format:"jwk",key:e})},67218:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const n=r(38994),i=r(28261);function o(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const i=n.RULES.keywords;for(const r in t)i[r]||h(e,`unknown keyword: "${r}"`)}function a(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function s(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(o,a,s,c)=>{const u=void 0===s?a:s instanceof n.Name?(a instanceof n.Name?e(o,a,s):t(o,a,s),s):a instanceof n.Name?(t(o,s,a),a):r(a,s);return c!==n.Name||u instanceof n.Name?u:i(o,u)}}function d(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",n._`{}`);return void 0!==t&&l(e,r,t),r}function l(e,t,r){Object.keys(r).forEach(r=>e.assign(n._`${t}${(0,n.getProperty)(r)}`,!0))}t.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!a(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=a,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,i,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return n._`${r}`}return n._`${e}${t}${(0,n.getProperty)(i)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(s(e))},t.escapeJsonPointer=s,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},t.mergeEvaluated={props:u({mergeNames:(e,t,r)=>e.if(n._`${r} !== true && ${t} !== undefined`,()=>{e.if(n._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,n._`${r} || {}`).code(n._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(n._`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,n._`${r} || {}`),l(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:d}),items:u({mergeNames:(e,t,r)=>e.if(n._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,n._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(n._`${r} !== true`,()=>e.assign(r,!0===t||n._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=d,t.setEvaluated=l;const p={};var f;function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:p[t.code]||(p[t.code]=new i._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(f||(t.Type=f={})),t.getErrorPath=function(e,t,r){if(e instanceof n.Name){const i=t===f.Num;return r?i?n._`"[" + ${e} + "]"`:n._`"['" + ${e} + "']"`:i?n._`"/" + ${e}`:n._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,n.getProperty)(e).toString():"/"+s(e)},t.checkStrictMode=h},67371:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!==i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!==i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!==i--;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}},68423:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598);t.default=(e,t)=>{let r;try{r=e instanceof n.KeyObject?e.asymmetricKeyDetails?.modulusLength:Buffer.from(e.n,"base64url").byteLength<<3}catch{}if("number"!=typeof r||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}},68681:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildDelegationProofJWT=async function(e){const{agentDid:t,userDid:r,delegationId:i,delegationChain:o,scopes:a,privateKeyJwk:s,kid:c,targetHostname:u}=e,d=await(0,n.importJWK)(s,"EdDSA"),l=Math.floor(Date.now()/1e3),p=l+60;return await new n.SignJWT({delegation_id:i,delegation_chain:o,scope:a.join(",")}).setProtectedHeader({alg:"EdDSA",kid:c}).setIssuer(t).setSubject(r).setJti(crypto.randomUUID()).setAudience(u).setIssuedAt(l).setExpirationTime(p).sign(d)},t.buildChainString=function(e){return e.id||e.vcId?e.vcId?`${e.vcId}>${e.id}`:e.id:""};const n=r(4283)},68846:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.importSPKI=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return(0,i.fromSPKI)(e,t,r)},t.importX509=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');return(0,i.fromX509)(e,t,r)},t.importPKCS8=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,i.fromPKCS8)(e,t,r)},t.importJWK=async function(e,t){if(!(0,s.default)(e))throw new TypeError("JWK must be an object");switch(t||=e.alg,e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return(0,n.decode)(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new a.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,o.default)({...e,alg:t});default:throw new a.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}};const n=r(3508),i=r(85251),o=r(66766),a=r(39069),s=r(71661)},68997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=n.operators,o={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},a={message:({keyword:e,schemaCode:t})=>n.str`must be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>n._`{comparison: ${o[e].okStr}, limit: ${t}}`},s={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:a,code(e){const{keyword:t,data:r,schemaCode:i}=e;e.fail$data(n._`${r} ${o[t].fail} ${i} || isNaN(${r})`)}};t.default=s},69459:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(18722),t)},70331:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flattenedDecrypt=async function(e,t,r){if(!(0,s.default)(e))throw new o.JWEInvalid("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new o.JWEInvalid("JOSE Header missing");if(void 0!==e.iv&&"string"!=typeof e.iv)throw new o.JWEInvalid("JWE Initialization Vector incorrect type");if("string"!=typeof e.ciphertext)throw new o.JWEInvalid("JWE Ciphertext missing or incorrect type");if(void 0!==e.tag&&"string"!=typeof e.tag)throw new o.JWEInvalid("JWE Authentication Tag incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new o.JWEInvalid("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new o.JWEInvalid("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new o.JWEInvalid("JWE AAD incorrect type");if(void 0!==e.header&&!(0,s.default)(e.header))throw new o.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!(0,s.default)(e.unprotected))throw new o.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let f;if(e.protected)try{const t=(0,n.decode)(e.protected);f=JSON.parse(u.decoder.decode(t))}catch{throw new o.JWEInvalid("JWE Protected Header is invalid")}if(!(0,a.default)(f,e.header,e.unprotected))throw new o.JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const h={...f,...e.header,...e.unprotected};if((0,l.default)(o.JWEInvalid,new Map,r?.crit,f,h),void 0!==h.zip)throw new o.JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');const{alg:m,enc:g}=h;if("string"!=typeof m||!m)throw new o.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof g||!g)throw new o.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");const v=r&&(0,p.default)("keyManagementAlgorithms",r.keyManagementAlgorithms),y=r&&(0,p.default)("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(v&&!v.has(m)||!v&&m.startsWith("PBES2"))throw new o.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');if(y&&!y.has(g))throw new o.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter value not allowed');let _;if(void 0!==e.encrypted_key)try{_=(0,n.decode)(e.encrypted_key)}catch{throw new o.JWEInvalid("Failed to base64url decode the encrypted_key")}let b,w,$,k=!1;"function"==typeof t&&(t=await t(f,e),k=!0);try{b=await(0,c.default)(m,t,_,h,r)}catch(e){if(e instanceof TypeError||e instanceof o.JWEInvalid||e instanceof o.JOSENotSupported)throw e;b=(0,d.default)(g)}if(void 0!==e.iv)try{w=(0,n.decode)(e.iv)}catch{throw new o.JWEInvalid("Failed to base64url decode the iv")}if(void 0!==e.tag)try{$=(0,n.decode)(e.tag)}catch{throw new o.JWEInvalid("Failed to base64url decode the tag")}const S=u.encoder.encode(e.protected??"");let I,P;I=void 0!==e.aad?(0,u.concat)(S,u.encoder.encode("."),u.encoder.encode(e.aad)):S;try{P=(0,n.decode)(e.ciphertext)}catch{throw new o.JWEInvalid("Failed to base64url decode the ciphertext")}const E={plaintext:await(0,i.default)(g,b,P,w,$,I)};if(void 0!==e.protected&&(E.protectedHeader=f),void 0!==e.aad)try{E.additionalAuthenticatedData=(0,n.decode)(e.aad)}catch{throw new o.JWEInvalid("Failed to base64url decode the aad")}return void 0!==e.unprotected&&(E.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(E.unprotectedHeader=e.header),k?{...E,key:t}:E};const n=r(3508),i=r(44089),o=r(39069),a=r(91146),s=r(71661),c=r(95538),u=r(45935),d=r(94726),l=r(82880),p=r(18610)},71016:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SignJWT=void 0;const n=r(15497),i=r(39069),o=r(45935),a=r(59333);class s extends a.ProduceJWT{_protectedHeader;setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){const r=new n.CompactSign(o.encoder.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new i.JWTInvalid("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}}t.SignJWT=s},71458:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unprotected=void 0,t.unprotected=Symbol()},71661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}},71759:(e,t)=>{"use strict";function r(e,t,...r){if((r=r.filter(Boolean)).length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}Object.defineProperty(t,"__esModule",{value:!0}),t.withAlg=function(e,t,...n){return r(`Key for the ${e} algorithm must be `,t,...n)},t.default=(e,...t)=>r("Key must be ",e,...t)},71871:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(67218),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,n.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};t.default=i},72199:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONSENT_UI_RESOURCE_URI=void 0,t.CONSENT_UI_RESOURCE_URI="ui://kya-os-consent/authorize"},72425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;const n=r(4573),i=r(77598),o=r(39069),a=r(45935),s=r(99135),c=r(60322),u=r(29994),d=r(71759),l=r(4268),p=r(58242);function f(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function h(e,t,r){if((0,u.default)(e))return e;if(e instanceof Uint8Array)return(0,i.createSecretKey)(e);if((0,s.isCryptoKey)(e))return(0,c.checkEncCryptoKey)(e,t,r),i.KeyObject.from(e);throw new TypeError((0,d.default)(e,...p.types,"Uint8Array"))}t.wrap=(e,t,r)=>{const s=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,l.default)(s))throw new o.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=h(t,e,"wrapKey");f(c,e);const u=(0,i.createCipheriv)(s,c,n.Buffer.alloc(8,166));return(0,a.concat)(u.update(r),u.final())},t.unwrap=(e,t,r)=>{const s=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,l.default)(s))throw new o.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const c=h(t,e,"unwrapKey");f(c,e);const u=(0,i.createDecipheriv)(s,c,n.Buffer.alloc(8,166));return(0,a.concat)(u.update(r),u.final())}},72545:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exportSPKI=async function(e){return(0,n.toSPKI)(e)},t.exportPKCS8=async function(e){return(0,i.toPKCS8)(e)},t.exportJWK=async function(e){return(0,o.default)(e)};const n=r(85251),i=r(85251),o=r(27464)},73214:(e,t)=>{"use strict";function r(e){if(null==e)return;const t=e.trim().toLowerCase();return""!==t?"oauth"===t?"oauth2":"credential"===t?"verifiable_credential":t:void 0}Object.defineProperty(t,"__esModule",{value:!0}),t.MINTABLE_AUTH_TYPES=void 0,t.normalizeAuthType=r,t.authTypeSatisfies=function(e,t){const n=r(e);if(void 0===n)return!1;const i=r(t);return void 0!==i&&n===i},t.isUnsatisfiableAuthType=function(e){const n=r(e);return void 0!==n&&!t.MINTABLE_AUTH_TYPES.has(n)},t.MINTABLE_AUTH_TYPES=new Set(["password","oauth2","none"])},73553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598).timingSafeEqual;t.default=n},74218:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJwt=function(e){if("string"!=typeof e)throw new a.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:r}=e.split(".");if(5===r)throw new a.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(3!==r)throw new a.JWTInvalid("Invalid JWT");if(!t)throw new a.JWTInvalid("JWTs must contain a payload");let s,c;try{s=(0,n.decode)(t)}catch{throw new a.JWTInvalid("Failed to base64url decode the payload")}try{c=JSON.parse(i.decoder.decode(s))}catch{throw new a.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,o.default)(c))throw new a.JWTInvalid("Invalid JWT Claims Set");return c};const n=r(7300),i=r(45935),o=r(71661),a=r(39069)},74372:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GeneralEncrypt=void 0;const n=r(92599),i=r(71458),o=r(39069),a=r(94726),s=r(91146),c=r(40554),u=r(3508),d=r(82880);class l{parent;unprotectedHeader;key;options;constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}}t.GeneralEncrypt=class{_plaintext;_recipients=[];_protectedHeader;_unprotectedHeader;_aad;constructor(e){this._plaintext=e}addRecipient(e,t){const r=new l(this,e,{crit:t?.crit});return this._recipients.push(r),r}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(){if(!this._recipients.length)throw new o.JWEInvalid("at least one recipient must be added");if(1===this._recipients.length){const[e]=this._recipients,t=await new n.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options}),r={ciphertext:t.ciphertext,iv:t.iv,recipients:[{}],tag:t.tag};return t.aad&&(r.aad=t.aad),t.protected&&(r.protected=t.protected),t.unprotected&&(r.unprotected=t.unprotected),t.encrypted_key&&(r.recipients[0].encrypted_key=t.encrypted_key),t.header&&(r.recipients[0].header=t.header),r}let e;for(let t=0;t<this._recipients.length;t++){const r=this._recipients[t];if(!(0,s.default)(this._protectedHeader,this._unprotectedHeader,r.unprotectedHeader))throw new o.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader,...r.unprotectedHeader},{alg:i}=n;if("string"!=typeof i||!i)throw new o.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===i||"ECDH-ES"===i)throw new o.JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof n.enc||!n.enc)throw new o.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(e){if(e!==n.enc)throw new o.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else e=n.enc;if((0,d.default)(o.JWEInvalid,new Map,r.options.crit,this._protectedHeader,n),void 0!==n.zip)throw new o.JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.')}const t=(0,a.default)(e),r={ciphertext:"",iv:"",recipients:[],tag:""};for(let o=0;o<this._recipients.length;o++){const a=this._recipients[o],s={};r.recipients.push(s);const d={...this._protectedHeader,...this._unprotectedHeader,...a.unprotectedHeader}.alg.startsWith("PBES2")?2048+o:void 0;if(0===o){const e=await new n.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(t).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(a.unprotectedHeader).setKeyManagementParameters({p2c:d}).encrypt(a.key,{...a.options,[i.unprotected]:!0});r.ciphertext=e.ciphertext,r.iv=e.iv,r.tag=e.tag,e.aad&&(r.aad=e.aad),e.protected&&(r.protected=e.protected),e.unprotected&&(r.unprotected=e.unprotected),s.encrypted_key=e.encrypted_key,e.header&&(s.header=e.header);continue}const{encryptedKey:l,parameters:p}=await(0,c.default)(a.unprotectedHeader?.alg||this._protectedHeader?.alg||this._unprotectedHeader?.alg,e,a.key,t,{p2c:d});s.encrypted_key=(0,u.encode)(l),(a.unprotectedHeader||p)&&(s.header={...a.unprotectedHeader,...p})}return r}}},74383:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=r},74630:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=void 0,t.createHandshakeRequest=function(e){return{nonce:a.generateNonce(),audience:e,timestamp:Math.floor(Date.now()/1e3)}},t.validateHandshakeFormat=function(e){return"object"==typeof e&&null!==e&&"string"==typeof e.nonce&&e.nonce.length>0&&"string"==typeof e.audience&&e.audience.length>0&&"number"==typeof e.timestamp&&e.timestamp>0&&Number.isInteger(e.timestamp)};const n=r(52884),i=r(76140),o=r(51713);class a{config;cryptoProvider;sessions=new Map;constructor(e,t={}){this.cryptoProvider=e,this.config={timestampSkewSeconds:t.timestampSkewSeconds??120,sessionTtlMinutes:t.sessionTtlMinutes??30,nonceCache:t.nonceCache??new n.MemoryNonceCacheProvider,...void 0!==t.absoluteSessionLifetime&&{absoluteSessionLifetime:t.absoluteSessionLifetime},...void 0!==t.serverDid&&{serverDid:t.serverDid}},this.config.nonceCache instanceof n.MemoryNonceCacheProvider&&i.logger.warn("[SessionManager] Using MemoryNonceCacheProvider ā not suitable for multi-instance deployments. Use Redis, DynamoDB, or Cloudflare KV for production.")}setServerDid(e){this.config.serverDid=e}async validateHandshake(e){try{const t=Math.floor(Date.now()/1e3),r=Math.abs(t-e.timestamp);if(r>this.config.timestampSkewSeconds)return{success:!1,error:{code:"XMCP_I_EHANDSHAKE",message:`Timestamp outside acceptable range (±${this.config.timestampSkewSeconds}s)`,remediation:`Check NTP sync on client and server. Current server time: ${t}, received: ${e.timestamp}, diff: ${r}s. Adjust timestampSkewSeconds if needed.`}};if(await this.config.nonceCache.has(e.nonce,e.agentDid))return{success:!1,error:{code:"XMCP_I_EHANDSHAKE",message:"Nonce already used (replay attack prevention)",remediation:"Generate a new unique nonce for each request"}};const n=60*this.config.sessionTtlMinutes+60;await this.config.nonceCache.add(e.nonce,n,e.agentDid);const i=await this.generateSessionId(),o=await this.buildClientInfo(e),a={sessionId:i,audience:e.audience,nonce:e.nonce,timestamp:e.timestamp,createdAt:t,lastActivity:t,ttlMinutes:this.config.sessionTtlMinutes,identityState:"anonymous",agentDid:e.agentDid,...this.config.serverDid&&{serverDid:this.config.serverDid},...o&&{clientInfo:o}};return this.sessions.set(i,a),{success:!0,session:a}}catch(e){return{success:!1,error:{code:"XMCP_I_EHANDSHAKE",message:`Handshake validation failed: ${e instanceof Error?e.message:"Unknown error"}`}}}}async getSession(e){e.startsWith(o.LEGACY_SESSION_ID_PREFIX)&&(0,o.recordWireForm)("session_id","old");const t=this.sessions.get(e);if(!t)return null;const r=Math.floor(Date.now()/1e3);return r-t.lastActivity>60*t.ttlMinutes||void 0!==this.config.absoluteSessionLifetime&&r-t.createdAt>60*this.config.absoluteSessionLifetime?(this.sessions.delete(e),null):(t.lastActivity=r,this.sessions.set(e,t),t)}async generateSessionId(){const e=await this.cryptoProvider.randomBytes(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join(""),r=`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`;return`${o.SESSION_ID_PREFIX}${r}`}async generateClientId(){const e=await this.cryptoProvider.randomBytes(6);return`client_${Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")}`}normalizeClientInfoString(e){if("string"!=typeof e)return;const t=e.trim();return t.length>0?t:void 0}async buildClientInfo(e){if(!e.clientInfo&&"string"!=typeof e.clientProtocolVersion&&void 0===e.clientCapabilities)return;const t=e.clientInfo;return{name:this.normalizeClientInfoString(t?.name)??"unknown",title:this.normalizeClientInfoString(t?.title),version:this.normalizeClientInfoString(t?.version),platform:this.normalizeClientInfoString(t?.platform),vendor:this.normalizeClientInfoString(t?.vendor),persistentId:this.normalizeClientInfoString(t?.persistentId),clientId:this.normalizeClientInfoString(t?.clientId)??await this.generateClientId(),protocolVersion:this.normalizeClientInfoString(e.clientProtocolVersion),capabilities:e.clientCapabilities}}static generateNonce(){const e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async cleanup(){const e=Math.floor(Date.now()/1e3);for(const[t,r]of this.sessions.entries()){let n=e-r.lastActivity>60*r.ttlMinutes;n||void 0===this.config.absoluteSessionLifetime||(n=e-r.createdAt>60*this.config.absoluteSessionLifetime),n&&this.sessions.delete(t)}await this.config.nonceCache.cleanup()}getStats(){return{activeSessions:this.sessions.size,config:{timestampSkewSeconds:this.config.timestampSkewSeconds,sessionTtlMinutes:this.config.sessionTtlMinutes,absoluteSessionLifetime:this.config.absoluteSessionLifetime,cacheType:this.config.nonceCache.constructor.name}}}clearSessions(){this.sessions.clear()}}t.SessionManager=a},74650:e=>{function t(e){return Promise.resolve().then(()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=()=>[],t.resolve=t,t.id=74650,e.exports=t},75306:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(18381),t)},76140:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDefaultConsoleLogger=t.logger=void 0;var n=r(95202);Object.defineProperty(t,"logger",{enumerable:!0,get:function(){return n.logger}}),Object.defineProperty(t,"createDefaultConsoleLogger",{enumerable:!0,get:function(){return n.createDefaultConsoleLogger}})},76593:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const n=r(38994),i=r(67218);function o(e,t,r){const{gen:o,compositeRule:a,data:s,opts:c}=e;if(void 0===r)return;const u=n._`${s}${(0,n.getProperty)(t)}`;if(a)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let d=n._`${u} === undefined`;"empty"===c.useDefaults&&(d=n._`${d} || ${u} === null || ${u} === ""`),o.if(d,n._`${u} = ${(0,n.stringify)(r)}`)}t.assignDefaults=function(e,t){const{properties:r,items:n}=e.schema;if("object"===t&&r)for(const t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(n)&&n.forEach((t,r)=>o(e,r,t.default))}},77460:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationCredentialVerifier=void 0,t.createDelegationVerifier=function(e){return new i(e)};const n=r(62408);class i{didResolver;statusListResolver;signatureVerifier;cache=new Map;cacheTtl;constructor(e){this.didResolver=e?.didResolver,this.statusListResolver=e?.statusListResolver,this.signatureVerifier=e?.signatureVerifier,this.cacheTtl=e?.cacheTtl||6e4}async verifyDelegationCredential(e,t={}){const r=Date.now();if(!t.skipCache){const t=this.getFromCache(e.id||"");if(t)return{...t,cached:!0}}const n=Date.now(),i=this.validateBasicProperties(e),o=Date.now()-n;if(!i.valid)return{valid:!1,reason:i.reason,stage:"basic",metrics:{basicCheckMs:o,totalMs:Date.now()-r},checks:{basicValid:!1}};const a=t.skipSignature?Promise.resolve({valid:!0,durationMs:0}):this.verifySignature(e,t.didResolver||this.didResolver),s=!t.skipStatus&&e.credentialStatus?this.checkCredentialStatus(e.credentialStatus,t.statusListResolver||this.statusListResolver):Promise.resolve({valid:!0,durationMs:0}),[c,u]=await Promise.all([a,s]),d=c.durationMs||0,l=u.durationMs||0,p=i.valid&&c.valid&&u.valid,f={valid:p,reason:p?void 0:c.reason||u.reason||"Unknown failure",stage:"complete",metrics:{basicCheckMs:o,signatureCheckMs:d,statusCheckMs:l,totalMs:Date.now()-r},checks:{basicValid:i.valid,signatureValid:c.valid,statusValid:u.valid}};return f.valid&&e.id&&this.setInCache(e.id,f),f}validateBasicProperties(e){const t=(0,n.validateDelegationCredential)(e);if(!t.success)return{valid:!1,reason:`Schema validation failed: ${t.error.message}`};if((0,n.isDelegationCredentialExpired)(e))return{valid:!1,reason:"Delegation credential expired"};if((0,n.isDelegationCredentialNotYetValid)(e))return{valid:!1,reason:"Delegation credential not yet valid"};const r=e.credentialSubject.delegation;return"revoked"===r.status?{valid:!1,reason:"Delegation status is revoked"}:"expired"===r.status?{valid:!1,reason:"Delegation status is expired"}:r.issuerDid&&r.subjectDid?e.proof?{valid:!0}:{valid:!1,reason:"Missing proof"}:{valid:!1,reason:"Missing issuer or subject DID"}}async verifySignature(e,t){const r=Date.now();try{const n="string"==typeof e.issuer?e.issuer:e.issuer.id;if(!t||!this.signatureVerifier)return{valid:!0,reason:"No DID resolver or signature verifier available, skipping signature verification",durationMs:Date.now()-r};const i=await t.resolve(n);if(!i)return{valid:!1,reason:`Could not resolve issuer DID: ${n}`,durationMs:Date.now()-r};if(!e.proof)return{valid:!1,reason:"Proof is missing",durationMs:Date.now()-r};const o=e.proof.verificationMethod;if(!o)return{valid:!1,reason:"Proof missing verificationMethod",durationMs:Date.now()-r};const a=this.findVerificationMethod(i,o);if(!a)return{valid:!1,reason:`Verification method ${o} not found`,durationMs:Date.now()-r};const s=a.publicKeyJwk;if(!s)return{valid:!1,reason:"Verification method missing publicKeyJwk",durationMs:Date.now()-r};const c=await this.signatureVerifier(e,s);return{valid:c.valid,reason:c.reason,durationMs:Date.now()-r}}catch(e){return{valid:!1,reason:`Signature verification error: ${e instanceof Error?e.message:"Unknown error"}`,durationMs:Date.now()-r}}}async checkCredentialStatus(e,t){const r=Date.now();try{return t?await t.checkStatus(e)?{valid:!1,reason:`Credential revoked via StatusList2021 (${e.statusPurpose})`,durationMs:Date.now()-r}:{valid:!0,durationMs:Date.now()-r}:{valid:!0,reason:"No status list resolver available, skipping status check",durationMs:Date.now()-r}}catch(e){return{valid:!1,reason:`Status check error: ${e instanceof Error?e.message:"Unknown error"}`,durationMs:Date.now()-r}}}findVerificationMethod(e,t){return e.verificationMethod?.find(e=>e.id===t)}getFromCache(e){const t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.result:null}setInCache(e,t){this.cache.set(e,{result:t,expiresAt:Date.now()+this.cacheTtl})}clearCache(){this.cache.clear()}clearCacheEntry(e){this.cache.delete(e)}}t.DelegationCredentialVerifier=i},77598:e=>{"use strict";e.exports=require("node:crypto")},77753:(e,t,r)=>{"use strict";r.d(t,{d:()=>i});var n=r(10985);function i(e,t){return(0,n.S)(e,{allowCircular:t,filterUndefined:!0,undefinedInArrayToNull:!0})}},78195:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new n.JWEInvalid("PBES2 Salt Input must be 8 or more octets")};const n=r(39069)},78474:e=>{"use strict";e.exports=require("node:events")},78805:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(24954),i=r(67218),o=r(38994),a={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>o.str`must match pattern "${e}"`,params:({schemaCode:e})=>o._`{pattern: ${e}}`},code(e){const{gen:t,data:r,$data:a,schema:s,schemaCode:c,it:u}=e,d=u.opts.unicodeRegExp?"u":"";if(a){const{regExp:n}=u.opts.code,a="new RegExp"===n.code?o._`new RegExp`:(0,i.useFunc)(t,n),s=t.let("valid");t.try(()=>t.assign(s,o._`${a}(${c}, ${d}).test(${r})`),()=>t.assign(s,!1)),e.fail$data(o._`!${s}`)}else{const t=(0,n.usePattern)(e,s);e.fail$data(o._`!${t}.test(${r})`)}}};t.default=a},78919:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createCombinedDidResolver=a,t.createVcJwtSignatureVerifier=function(e={}){const t=e.didResolver??a({fetch:e.fetch});return async(e,r)=>{if(void 0===r)return{valid:!1,reason:"no compact JWS"};const i=function(e){const t=e.issuer;return"string"==typeof t?t:t&&"object"==typeof t&&"string"==typeof t.id?t.id:void 0}(e);if(!i)return{valid:!1,reason:"VC missing issuer"};let o,a;try{o=(0,n.decodeProtectedHeader)(r).kid}catch{return{valid:!1,reason:"malformed JWS protected header"}}try{a=await t.resolve(i)}catch(e){return{valid:!1,reason:`issuer resolution failed: ${c(e)}`}}if(!a)return{valid:!1,reason:`could not resolve issuer ${i}`};const u=function(e,t){const r=e.verificationMethod??[];if(t){const e=r.find(e=>e.id===t);if(e)return e;const n=s(t);return r.find(e=>s(e.id)===n)}return r.find(e=>e.publicKeyJwk)}(a,o);if(!u?.publicKeyJwk)return{valid:!1,reason:o?`no verification method matching kid ${o}`:"no verification method with a publicKeyJwk"};try{const e=await(0,n.importJWK)(u.publicKeyJwk,"EdDSA");return await(0,n.compactVerify)(r,e),{valid:!0}}catch(e){return{valid:!1,reason:`signature verification failed: ${c(e)}`}}}};const n=r(4283),i=r(63146),o=r(30765);function a(e={}){const t=(0,i.createDidKeyResolver)(),r=(0,o.createDidWebResolver)({fetch:e.fetch});return{resolve:async e=>e.startsWith("did:key:")?t.resolve(e):e.startsWith("did:web:")?r.resolve(e):null}}function s(e){const t=e.indexOf("#");return t>=0?e.slice(t+1):e}function c(e){return e instanceof Error?e.message:String(e)}},80338:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const n=r(77598),i=r(57975),o=r(68423),a=r(99135),s=r(60322),c=r(29994),u=r(71759),d=r(58242),l=(e,t)=>{if("rsa"!==e.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,o.default)(e,t)},p=(0,i.deprecate)(()=>n.constants.RSA_PKCS1_PADDING,'The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.'),f=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return n.constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return p();default:return}},h=e=>{switch(e){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}};function m(e,t,...r){if((0,c.default)(e))return e;if((0,a.isCryptoKey)(e))return(0,s.checkEncCryptoKey)(e,t,...r),n.KeyObject.from(e);throw new TypeError((0,u.default)(e,...d.types))}t.encrypt=(e,t,r)=>{const i=f(e),o=h(e),a=m(t,e,"wrapKey","encrypt");return l(a,e),(0,n.publicEncrypt)({key:a,oaepHash:o,padding:i},r)},t.decrypt=(e,t,r)=>{const i=f(e),o=h(e),a=m(t,e,"unwrapKey","decrypt");return l(a,e),(0,n.privateDecrypt)({key:a,oaepHash:o,padding:i},r)}},80374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>n._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:r,data:o,it:a}=e;if((0,i.alwaysValidSchema)(a,r))return;const s=t.name("valid");t.forIn("key",o,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),t.if((0,n.not)(s),()=>{e.error(!0),a.allErrors||t.break()})}),e.ok(s)}};t.default=o},80384:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(39069),i=r(21444);t.default=(e,t)=>{if(t.length<<3!==(0,i.bitLength)(e))throw new n.JWEInvalid("Invalid Initialization Vector length")}},80903:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(77598),i=r(57975),o=r(17759),a=r(59768),s=r(9066),c=r(47532),u=(0,i.promisify)(n.sign);t.default=async(e,t,r)=>{const i=(0,c.default)(e,t,"sign");if(e.startsWith("HS")){const t=n.createHmac((0,a.default)(e),i);return t.update(r),t.digest()}return u((0,o.default)(e),r,(0,s.default)(e,i))}},81080:(e,t,r)=>{"use strict";function n(e,t,r){function n(r,n){var i;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(i=r._zod).traits??(i.traits=new Set),r._zod.traits.add(e),t(r,n);for(const e in a.prototype)e in r||Object.defineProperty(r,e,{value:a.prototype[e].bind(r)});r._zod.constr=a,r._zod.def=n}const i=r?.Parent??Object;class o extends i{}function a(e){var t;const i=r?.Parent?new o:this;n(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}r.r(t),r.d(t,{EXTENSION_ID:()=>Db,RESOURCE_MIME_TYPE:()=>Ab,RESOURCE_URI_META_KEY:()=>Tb,getUiCapability:()=>zb,registerAppResource:()=>jb,registerAppTool:()=>Cb}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class i extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const o={};function a(e){return e&&Object.assign(o,e),o}function s(e,t){return"bigint"==typeof t?t.toString():t}function c(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function u(e){return null==e}function d(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function l(e,t,r){Object.defineProperty(e,t,{get(){{const n=r();return e[t]=n,n}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function p(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function f(e){return JSON.stringify(e)}const h=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function m(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const g=c(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function v(e){if(!1===m(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!1!==m(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}const y=new Set(["string","number","symbol"]);function _(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function w(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}new Set(["string","number","bigint","boolean","symbol","undefined"]);const $={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function k(e,t=0){for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function S(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function I(e){return"string"==typeof e?e:e?.message}function P(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const i=I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function E(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function x(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const O=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,s,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},T=n("$ZodError",O),A=n("$ZodError",O,{Parent:Error}),C=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new i;if(c.issues.length){const t=new(o?.Err??e)(c.issues.map(e=>P(e,s,a())));throw h(t,o?.callee),t}return c.value},j=e=>async(t,r,n,i)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>P(e,o,a())));throw h(t,i?.callee),t}return s.value},D=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new i;return s.issues.length?{success:!1,error:new(e??T)(s.issues.map(e=>P(e,o,a())))}:{success:!0,data:s.value}},z=D(A),N=e=>async(t,r,n)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>P(e,i,a())))}:{success:!0,data:o.value}},R=N(A),U=/^[cC][^\s-]{8,}$/,M=/^[0-9a-z]+$/,K=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z=/^[0-9a-vA-V]{20}$/,J=/^[A-Za-z0-9]{27}$/,L=/^[a-zA-Z0-9_-]{21}$/,W=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,F=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,V=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,H=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,B=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,G=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Y=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,X=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Q=/^[A-Za-z0-9_-]*$/,ee=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,te=/^\+(?:[0-9]){6,14}[0-9]$/,re="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ne=new RegExp(`^${re}$`);function ie(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const oe=/^\d+$/,ae=/^-?\d+(?:\.\d+)?/i,se=/true|false/i,ce=/null/i,ue=/^[^A-Z]*$/,de=/^[^a-z]*$/,le=n("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pe={number:"number",bigint:"bigint",object:"date"},fe=n("$ZodCheckLessThan",(e,t)=>{le.init(e,t);const r=pe[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),he=n("$ZodCheckGreaterThan",(e,t)=>{le.init(e,t);const r=pe[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),me=n("$ZodCheckMultipleOf",(e,t)=>{le.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ge=n("$ZodCheckNumberFormat",(e,t)=>{le.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[i,o]=$[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=o,r&&(n.pattern=oe)}),e._zod.check=a=>{const s=a.value;if(r){if(!Number.isInteger(s))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}))}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inst:e})}}),ve=n("$ZodCheckMaxLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const i=E(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ye=n("$ZodCheckMinLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const i=E(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),_e=n("$ZodCheckLengthEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,i=n.length;if(i===t.length)return;const o=E(n),a=i>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),be=n("$ZodCheckStringFormat",(e,t)=>{var r,n;le.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),we=n("$ZodCheckRegex",(e,t)=>{be.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),$e=n("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ue),be.init(e,t)}),ke=n("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=de),be.init(e,t)}),Se=n("$ZodCheckIncludes",(e,t)=>{le.init(e,t);const r=_(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Ie=n("$ZodCheckStartsWith",(e,t)=>{le.init(e,t);const r=new RegExp(`^${_(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Pe=n("$ZodCheckEndsWith",(e,t)=>{le.init(e,t);const r=new RegExp(`.*${_(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Ee=n("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class xe{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args,r=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,r.join("\n"))}}const Oe={major:4,minor:0,patch:0},Te=n("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Oe;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,o=k(e);for(const a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,s=a._zod.check(e);if(s instanceof Promise&&!1===r?.async)throw new i;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(o||(o=k(e,t)))});else{if(e.issues.length===t)continue;o||(o=k(e,t))}}return n?n.then(()=>e):e};e._zod.run=(r,o)=>{const a=e._zod.parse(r,o);if(a instanceof Promise){if(!1===o.async)throw new i;return a.then(e=>t(e,n,o))}return t(a,n,o)}}e["~standard"]={validate:t=>{try{const r=z(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return R(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Ae=n("$ZodString",(e,t)=>{var r;Te.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ce=n("$ZodStringFormat",(e,t)=>{be.init(e,t),Ae.init(e,t)}),je=n("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=F),Ce.init(e,t)}),De=n("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=V(e))}else t.pattern??(t.pattern=V());Ce.init(e,t)}),ze=n("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=H),Ce.init(e,t)}),Ne=n("$ZodURL",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{try{const n=r.value,i=new URL(n),o=i.href;return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ee.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(!n.endsWith("/")&&o.endsWith("/")?r.value=o.slice(0,-1):r.value=o)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Re=n("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ce.init(e,t)}),Ue=n("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=L),Ce.init(e,t)}),Me=n("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=U),Ce.init(e,t)}),Ke=n("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=M),Ce.init(e,t)}),Ze=n("$ZodULID",(e,t)=>{t.pattern??(t.pattern=K),Ce.init(e,t)}),Je=n("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Z),Ce.init(e,t)}),Le=n("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=J),Ce.init(e,t)}),We=n("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ie({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${re}T(?:${n})$`)}(t)),Ce.init(e,t)}),Fe=n("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ne),Ce.init(e,t)}),Ve=n("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ie(t)}$`)),Ce.init(e,t)}),He=n("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=W),Ce.init(e,t)}),qe=n("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=q),Ce.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Be=n("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=B),Ce.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ge=n("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=G),Ce.init(e,t)}),Ye=n("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Y),Ce.init(e,t),e._zod.check=r=>{const[n,i]=r.value.split("/");try{if(!i)throw new Error;const e=Number(i);if(`${e}`!==i)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Xe(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Qe=n("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=X),Ce.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Xe(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),et=n("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Q),Ce.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{(function(e){if(!Q.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Xe(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),tt=n("$ZodE164",(e,t)=>{t.pattern??(t.pattern=te),Ce.init(e,t)}),rt=n("$ZodJWT",(e,t)=>{Ce.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const i=JSON.parse(atob(n));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),nt=n("$ZodNumber",(e,t)=>{Te.init(e,t),e._zod.pattern=e._zod.bag.pattern??ae,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}const i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),it=n("$ZodNumber",(e,t)=>{ge.init(e,t),nt.init(e,t)}),ot=n("$ZodBoolean",(e,t)=>{Te.init(e,t),e._zod.pattern=se,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(e){}const i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),at=n("$ZodNull",(e,t)=>{Te.init(e,t),e._zod.pattern=ce,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{const n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),st=n("$ZodUnknown",(e,t)=>{Te.init(e,t),e._zod.parse=e=>e}),ct=n("$ZodNever",(e,t)=>{Te.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function ut(e,t,r){e.issues.length&&t.issues.push(...S(r,e.issues)),t.value[r]=e.value}const dt=n("$ZodArray",(e,t)=>{Te.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const a=i[e],s=t.element._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(t=>ut(t,r,e))):ut(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function lt(e,t,r){e.issues.length&&t.issues.push(...S(r,e.issues)),t.value[r]=e.value}function pt(e,t,r,n){e.issues.length?void 0===n[r]?t.value[r]=r in n?void 0:e.value:t.issues.push(...S(r,e.issues)):void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}const ft=n("$ZodObject",(e,t)=>{Te.init(e,t);const r=c(()=>{const e=Object.keys(t.shape);for(const r of e)if(!(t.shape[r]instanceof Te))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=t.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}});let n;l(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const i=m,a=!o.jitless,s=a&&g.value,u=t.catchall;let d;e._zod.parse=(o,c)=>{d??(d=r.value);const l=o.value;if(!i(l))return o.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),o;const p=[];if(a&&s&&!1===c?.async&&!0!==c.jitless)n||(n=(e=>{const t=new xe(["shape","payload","ctx"]),n=r.value,i=e=>{const t=f(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let a=0;for(const e of n.keys)o[e]="key_"+a++;t.write("const newResult = {}");for(const e of n.keys)if(n.optionalKeys.has(e)){const r=o[e];t.write(`const ${r} = ${i(e)};`);const n=f(e);t.write(`\n if (${r}.issues.length) {\n if (input[${n}] === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${r}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}],\n }))\n );\n }\n } else if (${r}.value === undefined) {\n if (${n} in input) newResult[${n}] = undefined;\n } else {\n newResult[${n}] = ${r}.value;\n }\n `)}else{const r=o[e];t.write(`const ${r} = ${i(e)};`),t.write(`\n if (${r}.issues.length) payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${f(e)}, ...iss.path] : [${f(e)}]\n })));`),t.write(`newResult[${f(e)}] = ${r}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),o=n(o,c);else{o.value={};const e=d.shape;for(const t of d.keys){const r=e[t],n=r._zod.run({value:l[t],issues:[]},c),i="optional"===r._zod.optin&&"optional"===r._zod.optout;n instanceof Promise?p.push(n.then(e=>i?pt(e,o,t,l):lt(e,o,t))):i?pt(n,o,t,l):lt(n,o,t)}}if(!u)return p.length?Promise.all(p).then(()=>o):o;const h=[],m=d.keySet,g=u._zod,v=g.def.type;for(const e of Object.keys(l)){if(m.has(e))continue;if("never"===v){h.push(e);continue}const t=g.run({value:l[e],issues:[]},c);t instanceof Promise?p.push(t.then(t=>lt(t,o,e))):lt(t,o,e)}return h.length&&o.issues.push({code:"unrecognized_keys",keys:h,input:l,inst:e}),p.length?Promise.all(p).then(()=>o):o}});function ht(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>P(e,n,a())))}),t}const mt=n("$ZodUnion",(e,t)=>{Te.init(e,t),l(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),l(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),l(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),l(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>d(e.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let i=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},n);if(t instanceof Promise)o.push(t),i=!0;else{if(0===t.issues.length)return t;o.push(t)}}return i?Promise.all(o).then(t=>ht(t,r,e,n)):ht(o,r,e,n)}}),gt=n("$ZodDiscriminatedUnion",(e,t)=>{mt.init(e,t);const r=e._zod.parse;l(e._zod,"propValues",()=>{const e={};for(const r of t.options){const n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[t,r]of Object.entries(n)){e[t]||(e[t]=new Set);for(const n of r)e[t].add(n)}}return e});const n=c(()=>{const e=t.options,r=new Map;for(const n of e){const e=n._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(r.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,o)=>{const a=i.value;if(!m(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;const s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[t.discriminator],inst:e}),i)}}),vt=n("$ZodIntersection",(e,t)=>{Te.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,i=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,r])=>_t(e,t,r)):_t(e,i,o)}});function yt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(v(e)&&v(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};for(const r of n){const n=yt(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i[r]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const i=yt(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function _t(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),k(e))return e;const n=yt(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const bt=n("$ZodRecord",(e,t)=>{Te.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!v(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const o=[];if(t.keyType._zod.values){const a=t.keyType._zod.values;r.value={};for(const e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const a=t.valueType._zod.run({value:i[e],issues:[]},n);a instanceof Promise?o.push(a.then(t=>{t.issues.length&&r.issues.push(...S(e,t.issues)),r.value[e]=t.value})):(a.issues.length&&r.issues.push(...S(e,a.issues)),r.value[e]=a.value)}let s;for(const e in i)a.has(e)||(s=s??[],s.push(e));s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else{r.value={};for(const s of Reflect.ownKeys(i)){if("__proto__"===s)continue;const c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:c.issues.map(e=>P(e,n,a())),input:s,path:[s],inst:e}),r.value[c.value]=c.value;continue}const u=t.valueType._zod.run({value:i[s],issues:[]},n);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...S(s,e.issues)),r.value[c.value]=e.value})):(u.issues.length&&r.issues.push(...S(s,u.issues)),r.value[c.value]=u.value)}}return o.length?Promise.all(o).then(()=>r):r}}),wt=n("$ZodEnum",(e,t)=>{Te.init(e,t);const r=function(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(e=>y.has(typeof e)).map(e=>"string"==typeof e?_(e):e.toString()).join("|")})$`),e._zod.parse=(t,n)=>{const i=t.value;return e._zod.values.has(i)||t.issues.push({code:"invalid_value",values:r,input:i,inst:e}),t}}),$t=n("$ZodLiteral",(e,t)=>{Te.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?_(e):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(r,n)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),kt=n("$ZodTransform",(e,t)=>{Te.init(e,t),e._zod.parse=(e,r)=>{const n=t.transform(e.value,e);if(r.async)return(n instanceof Promise?n:Promise.resolve(n)).then(t=>(e.value=t,e));if(n instanceof Promise)throw new i;return e.value=n,e}}),St=n("$ZodOptional",(e,t)=>{Te.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),l(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>"optional"===t.innerType._zod.optin?t.innerType._zod.run(e,r):void 0===e.value?e:t.innerType._zod.run(e,r)}),It=n("$ZodNullable",(e,t)=>{Te.init(e,t),l(e._zod,"optin",()=>t.innerType._zod.optin),l(e._zod,"optout",()=>t.innerType._zod.optout),l(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)}|null)$`):void 0}),l(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Pt=n("$ZodDefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",l(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Et(e,t)):Et(n,t)}});function Et(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const xt=n("$ZodPrefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",l(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Ot=n("$ZodNonOptional",(e,t)=>{Te.init(e,t),l(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>Tt(t,e)):Tt(i,e)}});function Tt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const At=n("$ZodCatch",(e,t)=>{Te.init(e,t),e._zod.optin="optional",l(e._zod,"optout",()=>t.innerType._zod.optout),l(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>P(e,r,a()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>P(e,r,a()))},input:e.value}),e.issues=[]),e)}}),Ct=n("$ZodPipe",(e,t)=>{Te.init(e,t),l(e._zod,"values",()=>t.in._zod.values),l(e._zod,"optin",()=>t.in._zod.optin),l(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(e,r)=>{const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>jt(e,t,r)):jt(n,t,r)}});function jt(e,t,r){return k(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const Dt=n("$ZodReadonly",(e,t)=>{Te.init(e,t),l(e._zod,"propValues",()=>t.innerType._zod.propValues),l(e._zod,"values",()=>t.innerType._zod.values),l(e._zod,"optin",()=>t.innerType._zod.optin),l(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(zt):zt(n)}});function zt(e){return e.value=Object.freeze(e.value),e}const Nt=n("$ZodCustom",(e,t)=>{le.init(e,t),Te.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>Rt(t,r,n,e));Rt(i,r,n,e)}});function Rt(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(x(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class Ut{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Mt(){return new Ut}const Kt=Mt();function Zt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Jt(e,t){return new fe({check:"less_than",...w(t),value:e,inclusive:!1})}function Lt(e,t){return new fe({check:"less_than",...w(t),value:e,inclusive:!0})}function Wt(e,t){return new he({check:"greater_than",...w(t),value:e,inclusive:!1})}function Ft(e,t){return new he({check:"greater_than",...w(t),value:e,inclusive:!0})}function Vt(e,t){return new me({check:"multiple_of",...w(t),value:e})}function Ht(e,t){return new ve({check:"max_length",...w(t),maximum:e})}function qt(e,t){return new ye({check:"min_length",...w(t),minimum:e})}function Bt(e,t){return new _e({check:"length_equals",...w(t),length:e})}function Gt(e){return new Ee({check:"overwrite",tx:e})}const Yt=n("ZodISODateTime",(e,t)=>{We.init(e,t),pr.init(e,t)});function Xt(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}(Yt,e)}const Qt=n("ZodISODate",(e,t)=>{Fe.init(e,t),pr.init(e,t)});const er=n("ZodISOTime",(e,t)=>{Ve.init(e,t),pr.init(e,t)});const tr=n("ZodISODuration",(e,t)=>{He.init(e,t),pr.init(e,t)});const rr=(e,t)=>{T.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const r=t||function(e){return e.message},n={_errors:[]},i=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>i({issues:e}));else if("invalid_key"===t.code)i({issues:t.issues});else if("invalid_element"===t.code)i({issues:t.issues});else if(0===t.path.length)n._errors.push(r(t));else{let e=n,i=0;for(;i<t.path.length;){const n=t.path[i];i===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(r(t))):e[n]=e[n]||{_errors:[]},e=e[n],i++}}};return i(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},nr=(n("ZodError",rr),n("ZodError",rr,{Parent:Error})),ir=C(nr),or=j(nr),ar=D(nr),sr=N(nr),cr=n("ZodType",(e,t)=>(Te.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,r)=>b(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>ir(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>ar(e,t,r),e.parseAsync=async(t,r)=>or(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>sr(e,t,r),e.spa=e.safeParseAsync,e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}(bn,e,t)}(t,r)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new le({check:"custom"});return t._zod.check=e,t}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(x(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(x(n))}},e(r.value,r)));return t}(t)),e.overwrite=t=>e.check(Gt(t)),e.optional=()=>dn(e),e.nullable=()=>pn(e),e.nullish=()=>dn(pn(e)),e.nonoptional=t=>function(e,t){return new mn({type:"nonoptional",innerType:e,...w(t)})}(e,t),e.array=()=>Wr(e),e.or=t=>Br([e,t]),e.and=t=>Qr(e,t),e.transform=t=>yn(e,cn(t)),e.default=t=>{return r=t,new fn({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():r}});var r},e.prefault=t=>{return r=t,new hn({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():r}});var r},e.catch=t=>{return new gn({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>yn(e,t),e.readonly=()=>new _n({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Kt.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Kt.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Kt.get(e);const r=e.clone();return Kt.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ur=n("_ZodString",(e,t)=>{Ae.init(e,t),cr.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new we({check:"string_format",format:"regex",...w(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Se({check:"string_format",format:"includes",...w(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ie({check:"string_format",format:"starts_with",...w(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Pe({check:"string_format",format:"ends_with",...w(t),suffix:e})}(...t)),e.min=(...t)=>e.check(qt(...t)),e.max=(...t)=>e.check(Ht(...t)),e.length=(...t)=>e.check(Bt(...t)),e.nonempty=(...t)=>e.check(qt(1,...t)),e.lowercase=t=>e.check(function(e){return new $e({check:"string_format",format:"lowercase",...w(e)})}(t)),e.uppercase=t=>e.check(function(e){return new ke({check:"string_format",format:"uppercase",...w(e)})}(t)),e.trim=()=>e.check(Gt(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Gt(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Gt(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Gt(e=>e.toUpperCase()))}),dr=n("ZodString",(e,t)=>{Ae.init(e,t),ur.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}(fr,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}(gr,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}(Ar,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}(vr,t)),e.guid=t=>e.check(Zt(hr,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}(mr,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}(mr,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}(mr,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}(mr,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}(yr,t)),e.guid=t=>e.check(Zt(hr,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}(_r,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}(br,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}(wr,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}(xr,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}(Or,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}($r,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}(kr,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}(Sr,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}(Ir,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}(Pr,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}(Er,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}(Tr,t)),e.datetime=t=>e.check(Xt(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}(Qt,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}(er,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}(tr,e)}(t))});function lr(e){return function(e,t){return new e({type:"string",...w(t)})}(dr,e)}const pr=n("ZodStringFormat",(e,t)=>{Ce.init(e,t),ur.init(e,t)}),fr=n("ZodEmail",(e,t)=>{ze.init(e,t),pr.init(e,t)}),hr=n("ZodGUID",(e,t)=>{je.init(e,t),pr.init(e,t)}),mr=n("ZodUUID",(e,t)=>{De.init(e,t),pr.init(e,t)}),gr=n("ZodURL",(e,t)=>{Ne.init(e,t),pr.init(e,t)}),vr=n("ZodEmoji",(e,t)=>{Re.init(e,t),pr.init(e,t)}),yr=n("ZodNanoID",(e,t)=>{Ue.init(e,t),pr.init(e,t)}),_r=n("ZodCUID",(e,t)=>{Me.init(e,t),pr.init(e,t)}),br=n("ZodCUID2",(e,t)=>{Ke.init(e,t),pr.init(e,t)}),wr=n("ZodULID",(e,t)=>{Ze.init(e,t),pr.init(e,t)}),$r=n("ZodXID",(e,t)=>{Je.init(e,t),pr.init(e,t)}),kr=n("ZodKSUID",(e,t)=>{Le.init(e,t),pr.init(e,t)}),Sr=n("ZodIPv4",(e,t)=>{qe.init(e,t),pr.init(e,t)}),Ir=n("ZodIPv6",(e,t)=>{Be.init(e,t),pr.init(e,t)}),Pr=n("ZodCIDRv4",(e,t)=>{Ge.init(e,t),pr.init(e,t)}),Er=n("ZodCIDRv6",(e,t)=>{Ye.init(e,t),pr.init(e,t)}),xr=n("ZodBase64",(e,t)=>{Qe.init(e,t),pr.init(e,t)}),Or=n("ZodBase64URL",(e,t)=>{et.init(e,t),pr.init(e,t)}),Tr=n("ZodE164",(e,t)=>{tt.init(e,t),pr.init(e,t)}),Ar=n("ZodJWT",(e,t)=>{rt.init(e,t),pr.init(e,t)}),Cr=n("ZodNumber",(e,t)=>{nt.init(e,t),cr.init(e,t),e.gt=(t,r)=>e.check(Wt(t,r)),e.gte=(t,r)=>e.check(Ft(t,r)),e.min=(t,r)=>e.check(Ft(t,r)),e.lt=(t,r)=>e.check(Jt(t,r)),e.lte=(t,r)=>e.check(Lt(t,r)),e.max=(t,r)=>e.check(Lt(t,r)),e.int=t=>e.check(zr(t)),e.safe=t=>e.check(zr(t)),e.positive=t=>e.check(Wt(0,t)),e.nonnegative=t=>e.check(Ft(0,t)),e.negative=t=>e.check(Jt(0,t)),e.nonpositive=t=>e.check(Lt(0,t)),e.multipleOf=(t,r)=>e.check(Vt(t,r)),e.step=(t,r)=>e.check(Vt(t,r)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function jr(e){return function(e,t){return new e({type:"number",checks:[],...w(t)})}(Cr,e)}const Dr=n("ZodNumberFormat",(e,t)=>{it.init(e,t),Cr.init(e,t)});function zr(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}(Dr,e)}const Nr=n("ZodBoolean",(e,t)=>{ot.init(e,t),cr.init(e,t)});function Rr(e){return function(e,t){return new e({type:"boolean",...w(t)})}(Nr,e)}const Ur=n("ZodNull",(e,t)=>{at.init(e,t),cr.init(e,t)});function Mr(e){return function(e,t){return new e({type:"null",...w(t)})}(Ur,e)}const Kr=n("ZodUnknown",(e,t)=>{st.init(e,t),cr.init(e,t)});function Zr(){return new Kr({type:"unknown"})}const Jr=n("ZodNever",(e,t)=>{ct.init(e,t),cr.init(e,t)});const Lr=n("ZodArray",(e,t)=>{dt.init(e,t),cr.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(qt(t,r)),e.nonempty=t=>e.check(qt(1,t)),e.max=(t,r)=>e.check(Ht(t,r)),e.length=(t,r)=>e.check(Bt(t,r)),e.unwrap=()=>e.element});function Wr(e,t){return function(e,t,r){return new e({type:"array",element:t,...w(r)})}(Lr,e,t)}const Fr=n("ZodObject",(e,t)=>{ft.init(e,t),cr.init(e,t),l(e,"shape",()=>t.shape),e.keyof=()=>nn(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Zr()}),e.loose=()=>e.clone({...e._zod.def,catchall:Zr()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:function(e,t){return new e({type:"never",...w(t)})}(Jr,t)});var t},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!v(t))throw new Error("Invalid input to extend: expected a plain object");const r={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return p(this,"shape",r),r},checks:[]};return b(e,r)}(e,t),e.merge=t=>function(e,t){return b(e,{...e._zod.def,get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return p(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}(e,t),e.pick=t=>function(e,t){const r={},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(r[e]=n.shape[e])}return b(e,{...e._zod.def,shape:r,checks:[]})}(e,t),e.omit=t=>function(e,t){const r={...e._zod.def.shape},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return b(e,{...e._zod.def,shape:r,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return b(t,{...t._zod.def,shape:i,checks:[]})}(un,e,t[0]),e.required=(...t)=>function(e,t,r){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return b(t,{...t._zod.def,shape:i,checks:[]})}(mn,e,t[0])});function Vr(e,t){const r={type:"object",get shape(){return p(this,"shape",{...e}),this.shape},...w(t)};return new Fr(r)}function Hr(e,t){return new Fr({type:"object",get shape(){return p(this,"shape",{...e}),this.shape},catchall:Zr(),...w(t)})}const qr=n("ZodUnion",(e,t)=>{mt.init(e,t),cr.init(e,t),e.options=t.options});function Br(e,t){return new qr({type:"union",options:e,...w(t)})}const Gr=n("ZodDiscriminatedUnion",(e,t)=>{qr.init(e,t),gt.init(e,t)});function Yr(e,t,r){return new Gr({type:"union",options:t,discriminator:e,...w(r)})}const Xr=n("ZodIntersection",(e,t)=>{vt.init(e,t),cr.init(e,t)});function Qr(e,t){return new Xr({type:"intersection",left:e,right:t})}const en=n("ZodRecord",(e,t)=>{bt.init(e,t),cr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function tn(e,t,r){return new en({type:"record",keyType:e,valueType:t,...w(r)})}const rn=n("ZodEnum",(e,t)=>{wt.init(e,t),cr.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const i={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);i[n]=t.entries[n]}return new rn({...t,checks:[],...w(n),entries:i})},e.exclude=(e,n)=>{const i={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new rn({...t,checks:[],...w(n),entries:i})}});function nn(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new rn({type:"enum",entries:r,...w(t)})}const on=n("ZodLiteral",(e,t)=>{$t.init(e,t),cr.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function an(e,t){return new on({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}const sn=n("ZodTransform",(e,t)=>{kt.init(e,t),cr.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=n=>{if("string"==typeof n)r.issues.push(x(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),r.issues.push(x(t))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function cn(e){return new sn({type:"transform",transform:e})}const un=n("ZodOptional",(e,t)=>{St.init(e,t),cr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dn(e){return new un({type:"optional",innerType:e})}const ln=n("ZodNullable",(e,t)=>{It.init(e,t),cr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pn(e){return new ln({type:"nullable",innerType:e})}const fn=n("ZodDefault",(e,t)=>{Pt.init(e,t),cr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),hn=n("ZodPrefault",(e,t)=>{xt.init(e,t),cr.init(e,t),e.unwrap=()=>e._zod.def.innerType}),mn=n("ZodNonOptional",(e,t)=>{Ot.init(e,t),cr.init(e,t),e.unwrap=()=>e._zod.def.innerType}),gn=n("ZodCatch",(e,t)=>{At.init(e,t),cr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),vn=n("ZodPipe",(e,t)=>{Ct.init(e,t),cr.init(e,t),e.in=t.in,e.out=t.out});function yn(e,t){return new vn({type:"pipe",in:e,out:t})}const _n=n("ZodReadonly",(e,t)=>{Dt.init(e,t),cr.init(e,t)}),bn=n("ZodCustom",(e,t)=>{Nt.init(e,t),cr.init(e,t)});function wn(e,t){return yn(cn(e),t)}const $n="io.modelcontextprotocol/related-task",kn="2.0",Sn=function(e,t){const r=w(undefined);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}(bn,(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),void 0),In=Br([lr(),jr().int()]),Pn=lr(),En=(Hr({ttl:Br([jr(),Mr()]).optional(),pollInterval:jr().optional()}),Vr({ttl:jr().optional()})),xn=Vr({taskId:lr()}),On=Hr({progressToken:In.optional(),[$n]:xn.optional()}),Tn=Vr({_meta:On.optional()}),An=Tn.extend({task:En.optional()}),Cn=Vr({method:lr(),params:Tn.loose().optional()}),jn=Vr({_meta:On.optional()}),Dn=Vr({method:lr(),params:jn.loose().optional()}),zn=Hr({_meta:On.optional()}),Nn=Br([lr(),jr().int()]),Rn=Vr({jsonrpc:an(kn),id:Nn,...Cn.shape}).strict(),Un=Vr({jsonrpc:an(kn),...Dn.shape}).strict(),Mn=Vr({jsonrpc:an(kn),id:Nn,result:zn}).strict();var Kn;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"}(Kn||(Kn={}));const Zn=Vr({jsonrpc:an(kn),id:Nn.optional(),error:Vr({code:jr().int(),message:lr(),data:Zr().optional()})}).strict(),Jn=(Br([Rn,Un,Mn,Zn]),Br([Mn,Zn]),zn.strict()),Ln=jn.extend({requestId:Nn.optional(),reason:lr().optional()}),Wn=Dn.extend({method:an("notifications/cancelled"),params:Ln}),Fn=Vr({src:lr(),mimeType:lr().optional(),sizes:Wr(lr()).optional(),theme:nn(["light","dark"]).optional()}),Vn=Vr({icons:Wr(Fn).optional()}),Hn=Vr({name:lr(),title:lr().optional()}),qn=Hn.extend({...Hn.shape,...Vn.shape,version:lr(),websiteUrl:lr().optional(),description:lr().optional()}),Bn=Qr(Vr({applyDefaults:Rr().optional()}),tn(lr(),Zr())),Gn=wn(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,Qr(Vr({form:Bn.optional(),url:Sn.optional()}),tn(lr(),Zr()).optional())),Yn=Hr({list:Sn.optional(),cancel:Sn.optional(),requests:Hr({sampling:Hr({createMessage:Sn.optional()}).optional(),elicitation:Hr({create:Sn.optional()}).optional()}).optional()}),Xn=Hr({list:Sn.optional(),cancel:Sn.optional(),requests:Hr({tools:Hr({call:Sn.optional()}).optional()}).optional()}),Qn=Vr({experimental:tn(lr(),Sn).optional(),sampling:Vr({context:Sn.optional(),tools:Sn.optional()}).optional(),elicitation:Gn.optional(),roots:Vr({listChanged:Rr().optional()}).optional(),tasks:Yn.optional()}),ei=Tn.extend({protocolVersion:lr(),capabilities:Qn,clientInfo:qn}),ti=Cn.extend({method:an("initialize"),params:ei}),ri=Vr({experimental:tn(lr(),Sn).optional(),logging:Sn.optional(),completions:Sn.optional(),prompts:Vr({listChanged:Rr().optional()}).optional(),resources:Vr({subscribe:Rr().optional(),listChanged:Rr().optional()}).optional(),tools:Vr({listChanged:Rr().optional()}).optional(),tasks:Xn.optional()}),ni=zn.extend({protocolVersion:lr(),capabilities:ri,serverInfo:qn,instructions:lr().optional()}),ii=Dn.extend({method:an("notifications/initialized"),params:jn.optional()}),oi=Cn.extend({method:an("ping"),params:Tn.optional()}),ai=Vr({progress:jr(),total:dn(jr()),message:dn(lr())}),si=Vr({...jn.shape,...ai.shape,progressToken:In}),ci=Dn.extend({method:an("notifications/progress"),params:si}),ui=Tn.extend({cursor:Pn.optional()}),di=Cn.extend({params:ui.optional()}),li=zn.extend({nextCursor:Pn.optional()}),pi=nn(["working","input_required","completed","failed","cancelled"]),fi=Vr({taskId:lr(),status:pi,ttl:Br([jr(),Mr()]),createdAt:lr(),lastUpdatedAt:lr(),pollInterval:dn(jr()),statusMessage:dn(lr())}),hi=zn.extend({task:fi}),mi=jn.merge(fi),gi=Dn.extend({method:an("notifications/tasks/status"),params:mi}),vi=Cn.extend({method:an("tasks/get"),params:Tn.extend({taskId:lr()})}),yi=zn.merge(fi),_i=Cn.extend({method:an("tasks/result"),params:Tn.extend({taskId:lr()})}),bi=(zn.loose(),di.extend({method:an("tasks/list")})),wi=li.extend({tasks:Wr(fi)}),$i=Cn.extend({method:an("tasks/cancel"),params:Tn.extend({taskId:lr()})}),ki=(zn.merge(fi),Vr({uri:lr(),mimeType:dn(lr()),_meta:tn(lr(),Zr()).optional()})),Si=ki.extend({text:lr()}),Ii=lr().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Pi=ki.extend({blob:Ii}),Ei=nn(["user","assistant"]),xi=Vr({audience:Wr(Ei).optional(),priority:jr().min(0).max(1).optional(),lastModified:Xt({offset:!0}).optional()}),Oi=Vr({...Hn.shape,...Vn.shape,uri:lr(),description:dn(lr()),mimeType:dn(lr()),annotations:xi.optional(),_meta:dn(Hr({}))}),Ti=Vr({...Hn.shape,...Vn.shape,uriTemplate:lr(),description:dn(lr()),mimeType:dn(lr()),annotations:xi.optional(),_meta:dn(Hr({}))}),Ai=di.extend({method:an("resources/list")}),Ci=li.extend({resources:Wr(Oi)}),ji=di.extend({method:an("resources/templates/list")}),Di=li.extend({resourceTemplates:Wr(Ti)}),zi=Tn.extend({uri:lr()}),Ni=zi,Ri=Cn.extend({method:an("resources/read"),params:Ni}),Ui=zn.extend({contents:Wr(Br([Si,Pi]))}),Mi=Dn.extend({method:an("notifications/resources/list_changed"),params:jn.optional()}),Ki=zi,Zi=Cn.extend({method:an("resources/subscribe"),params:Ki}),Ji=zi,Li=Cn.extend({method:an("resources/unsubscribe"),params:Ji}),Wi=jn.extend({uri:lr()}),Fi=Dn.extend({method:an("notifications/resources/updated"),params:Wi}),Vi=Vr({name:lr(),description:dn(lr()),required:dn(Rr())}),Hi=Vr({...Hn.shape,...Vn.shape,description:dn(lr()),arguments:dn(Wr(Vi)),_meta:dn(Hr({}))}),qi=di.extend({method:an("prompts/list")}),Bi=li.extend({prompts:Wr(Hi)}),Gi=Tn.extend({name:lr(),arguments:tn(lr(),lr()).optional()}),Yi=Cn.extend({method:an("prompts/get"),params:Gi}),Xi=Vr({type:an("text"),text:lr(),annotations:xi.optional(),_meta:tn(lr(),Zr()).optional()}),Qi=Vr({type:an("image"),data:Ii,mimeType:lr(),annotations:xi.optional(),_meta:tn(lr(),Zr()).optional()}),eo=Vr({type:an("audio"),data:Ii,mimeType:lr(),annotations:xi.optional(),_meta:tn(lr(),Zr()).optional()}),to=Vr({type:an("tool_use"),name:lr(),id:lr(),input:tn(lr(),Zr()),_meta:tn(lr(),Zr()).optional()}),ro=Vr({type:an("resource"),resource:Br([Si,Pi]),annotations:xi.optional(),_meta:tn(lr(),Zr()).optional()}),no=Br([Xi,Qi,eo,Oi.extend({type:an("resource_link")}),ro]),io=Vr({role:Ei,content:no}),oo=zn.extend({description:lr().optional(),messages:Wr(io)}),ao=Dn.extend({method:an("notifications/prompts/list_changed"),params:jn.optional()}),so=Vr({title:lr().optional(),readOnlyHint:Rr().optional(),destructiveHint:Rr().optional(),idempotentHint:Rr().optional(),openWorldHint:Rr().optional()}),co=Vr({taskSupport:nn(["required","optional","forbidden"]).optional()}),uo=Vr({...Hn.shape,...Vn.shape,description:lr().optional(),inputSchema:Vr({type:an("object"),properties:tn(lr(),Sn).optional(),required:Wr(lr()).optional()}).catchall(Zr()),outputSchema:Vr({type:an("object"),properties:tn(lr(),Sn).optional(),required:Wr(lr()).optional()}).catchall(Zr()).optional(),annotations:so.optional(),execution:co.optional(),_meta:tn(lr(),Zr()).optional()}),lo=di.extend({method:an("tools/list")}),po=li.extend({tools:Wr(uo)}),fo=zn.extend({content:Wr(no).default([]),structuredContent:tn(lr(),Zr()).optional(),isError:Rr().optional()}),ho=(fo.or(zn.extend({toolResult:Zr()})),An.extend({name:lr(),arguments:tn(lr(),Zr()).optional()})),mo=Cn.extend({method:an("tools/call"),params:ho}),go=Dn.extend({method:an("notifications/tools/list_changed"),params:jn.optional()}),vo=(Vr({autoRefresh:Rr().default(!0),debounceMs:jr().int().nonnegative().default(300)}),nn(["debug","info","notice","warning","error","critical","alert","emergency"])),yo=Tn.extend({level:vo}),_o=Cn.extend({method:an("logging/setLevel"),params:yo}),bo=jn.extend({level:vo,logger:lr().optional(),data:Zr()}),wo=Dn.extend({method:an("notifications/message"),params:bo}),$o=Vr({name:lr().optional()}),ko=Vr({hints:Wr($o).optional(),costPriority:jr().min(0).max(1).optional(),speedPriority:jr().min(0).max(1).optional(),intelligencePriority:jr().min(0).max(1).optional()}),So=Vr({mode:nn(["auto","required","none"]).optional()}),Io=Vr({type:an("tool_result"),toolUseId:lr().describe("The unique identifier for the corresponding tool call."),content:Wr(no).default([]),structuredContent:Vr({}).loose().optional(),isError:Rr().optional(),_meta:tn(lr(),Zr()).optional()}),Po=Yr("type",[Xi,Qi,eo]),Eo=Yr("type",[Xi,Qi,eo,to,Io]),xo=Vr({role:Ei,content:Br([Eo,Wr(Eo)]),_meta:tn(lr(),Zr()).optional()}),Oo=An.extend({messages:Wr(xo),modelPreferences:ko.optional(),systemPrompt:lr().optional(),includeContext:nn(["none","thisServer","allServers"]).optional(),temperature:jr().optional(),maxTokens:jr().int(),stopSequences:Wr(lr()).optional(),metadata:Sn.optional(),tools:Wr(uo).optional(),toolChoice:So.optional()}),To=Cn.extend({method:an("sampling/createMessage"),params:Oo}),Ao=zn.extend({model:lr(),stopReason:dn(nn(["endTurn","stopSequence","maxTokens"]).or(lr())),role:Ei,content:Po}),Co=zn.extend({model:lr(),stopReason:dn(nn(["endTurn","stopSequence","maxTokens","toolUse"]).or(lr())),role:Ei,content:Br([Eo,Wr(Eo)])}),jo=Vr({type:an("boolean"),title:lr().optional(),description:lr().optional(),default:Rr().optional()}),Do=Vr({type:an("string"),title:lr().optional(),description:lr().optional(),minLength:jr().optional(),maxLength:jr().optional(),format:nn(["email","uri","date","date-time"]).optional(),default:lr().optional()}),zo=Vr({type:nn(["number","integer"]),title:lr().optional(),description:lr().optional(),minimum:jr().optional(),maximum:jr().optional(),default:jr().optional()}),No=Vr({type:an("string"),title:lr().optional(),description:lr().optional(),enum:Wr(lr()),default:lr().optional()}),Ro=Vr({type:an("string"),title:lr().optional(),description:lr().optional(),oneOf:Wr(Vr({const:lr(),title:lr()})),default:lr().optional()}),Uo=Vr({type:an("string"),title:lr().optional(),description:lr().optional(),enum:Wr(lr()),enumNames:Wr(lr()).optional(),default:lr().optional()}),Mo=Br([No,Ro]),Ko=Br([Vr({type:an("array"),title:lr().optional(),description:lr().optional(),minItems:jr().optional(),maxItems:jr().optional(),items:Vr({type:an("string"),enum:Wr(lr())}),default:Wr(lr()).optional()}),Vr({type:an("array"),title:lr().optional(),description:lr().optional(),minItems:jr().optional(),maxItems:jr().optional(),items:Vr({anyOf:Wr(Vr({const:lr(),title:lr()}))}),default:Wr(lr()).optional()})]),Zo=Br([Uo,Mo,Ko]),Jo=Br([Zo,jo,Do,zo]),Lo=Br([An.extend({mode:an("form").optional(),message:lr(),requestedSchema:Vr({type:an("object"),properties:tn(lr(),Jo),required:Wr(lr()).optional()})}),An.extend({mode:an("url"),message:lr(),elicitationId:lr(),url:lr().url()})]),Wo=Cn.extend({method:an("elicitation/create"),params:Lo}),Fo=jn.extend({elicitationId:lr()}),Vo=Dn.extend({method:an("notifications/elicitation/complete"),params:Fo}),Ho=zn.extend({action:nn(["accept","decline","cancel"]),content:wn(e=>null===e?void 0:e,tn(lr(),Br([lr(),jr(),Rr(),Wr(lr())])).optional())}),qo=Vr({type:an("ref/resource"),uri:lr()}),Bo=Vr({type:an("ref/prompt"),name:lr()}),Go=Tn.extend({ref:Br([Bo,qo]),argument:Vr({name:lr(),value:lr()}),context:Vr({arguments:tn(lr(),lr()).optional()}).optional()}),Yo=Cn.extend({method:an("completion/complete"),params:Go}),Xo=zn.extend({completion:Hr({values:Wr(lr()).max(100),total:dn(jr().int()),hasMore:dn(Rr())})}),Qo=Vr({uri:lr().startsWith("file://"),name:lr().optional(),_meta:tn(lr(),Zr()).optional()}),ea=Cn.extend({method:an("roots/list"),params:Tn.optional()}),ta=zn.extend({roots:Wr(Qo)}),ra=Dn.extend({method:an("notifications/roots/list_changed"),params:jn.optional()});Br([oi,ti,Yo,_o,Yi,qi,Ai,ji,Ri,Zi,Li,mo,lo,vi,_i,bi,$i]),Br([Wn,ci,ii,ra,gi]),Br([Jn,Ao,Co,Ho,ta,yi,wi,hi]),Br([oi,To,Wo,ea,vi,_i,bi,$i]),Br([Wn,ci,wo,Fi,Mi,go,ao,gi,Vo]),Br([Jn,ni,Xo,oo,Bi,Ci,Di,Ui,fo,po,yi,wi,hi]),Error,Symbol("Let zodToJsonSchema decide on which parser to use");var na=Object.defineProperty,ia=(e,t)=>{for(var r in t)na(e,r,{get:t[r],enumerable:!0,configurable:!0,set:e=>t[r]=()=>e})},oa={};ia(oa,{xor:()=>Jy,xid:()=>Ov,void:()=>Oy,uuidv7:()=>hv,uuidv6:()=>fv,uuidv4:()=>pv,uuid:()=>lv,util:()=>ha,url:()=>gv,uppercase:()=>Lh,unknown:()=>Iy,union:()=>Ky,undefined:()=>_y,ulid:()=>Ev,uint64:()=>my,uint32:()=>cy,tuple:()=>qy,trim:()=>Yh,treeifyError:()=>Os,transform:()=>l_,toUpperCase:()=>Qh,toLowerCase:()=>Xh,toJSONSchema:()=>Pg,templateLiteral:()=>U_,symbol:()=>vy,superRefine:()=>B_,success:()=>P_,stringbool:()=>Q_,stringFormat:()=>Yv,string:()=>iv,strictObject:()=>Ry,startsWith:()=>Fh,slugify:()=>em,size:()=>Rh,setErrorMap:()=>ib,set:()=>r_,safeParseAsync:()=>Vg,safeParse:()=>Fg,safeEncodeAsync:()=>Qg,safeEncode:()=>Yg,safeDecodeAsync:()=>ev,safeDecode:()=>Xg,registry:()=>If,regexes:()=>rc,regex:()=>Zh,refine:()=>q_,record:()=>Gy,readonly:()=>N_,property:()=>Hh,promise:()=>J_,prettifyError:()=>As,preprocess:()=>tb,prefault:()=>$_,positive:()=>Th,pipe:()=>C_,partialRecord:()=>Yy,parseAsync:()=>Wg,parse:()=>Lg,overwrite:()=>Bh,optional:()=>f_,object:()=>Ny,number:()=>ry,nullish:()=>y_,nullable:()=>v_,null:()=>wy,normalize:()=>Gh,nonpositive:()=>Ch,nonoptional:()=>S_,nonnegative:()=>jh,never:()=>Ey,negative:()=>Ah,nativeEnum:()=>o_,nanoid:()=>wv,nan:()=>T_,multipleOf:()=>Dh,minSize:()=>Nh,minLength:()=>Mh,mime:()=>qh,meta:()=>Y_,maxSize:()=>zh,maxLength:()=>Uh,map:()=>e_,mac:()=>zv,lte:()=>Eh,lt:()=>Ph,lowercase:()=>Jh,looseRecord:()=>Xy,looseObject:()=>Uy,locales:()=>Il,literal:()=>s_,length:()=>Kh,lazy:()=>K_,ksuid:()=>Av,keyof:()=>Dy,jwt:()=>Bv,json:()=>eb,iso:()=>Ag,ipv6:()=>Rv,ipv4:()=>jv,intersection:()=>Vy,int64:()=>hy,int32:()=>sy,int:()=>iy,instanceof:()=>X_,includes:()=>Wh,httpUrl:()=>vv,hostname:()=>Xv,hex:()=>Qv,hash:()=>ey,guid:()=>uv,gte:()=>Oh,gt:()=>xh,globalRegistry:()=>Pf,getErrorMap:()=>ob,function:()=>W_,fromJSONSchema:()=>db,formatError:()=>xs,float64:()=>ay,float32:()=>oy,flattenError:()=>Es,file:()=>u_,exactOptional:()=>m_,enum:()=>i_,endsWith:()=>Vh,encodeAsync:()=>Bg,encode:()=>Hg,emoji:()=>_v,email:()=>sv,e164:()=>Hv,discriminatedUnion:()=>Wy,describe:()=>G_,decodeAsync:()=>Gg,decode:()=>qg,date:()=>Ay,custom:()=>H_,cuid2:()=>Iv,cuid:()=>kv,core:()=>aa,config:()=>fa,coerce:()=>lb,codec:()=>D_,clone:()=>qa,cidrv6:()=>Zv,cidrv4:()=>Mv,check:()=>V_,catch:()=>x_,boolean:()=>dy,bigint:()=>py,base64url:()=>Fv,base64:()=>Lv,array:()=>jy,any:()=>ky,_function:()=>W_,_default:()=>b_,_ZodString:()=>rv,ZodXor:()=>Zy,ZodXID:()=>xv,ZodVoid:()=>xy,ZodUnknown:()=>Sy,ZodUnion:()=>My,ZodUndefined:()=>yy,ZodUUID:()=>dv,ZodURL:()=>mv,ZodULID:()=>Pv,ZodType:()=>tv,ZodTuple:()=>Hy,ZodTransform:()=>d_,ZodTemplateLiteral:()=>R_,ZodSymbol:()=>gy,ZodSuccess:()=>I_,ZodStringFormat:()=>ov,ZodString:()=>nv,ZodSet:()=>t_,ZodRecord:()=>By,ZodRealError:()=>Jg,ZodReadonly:()=>z_,ZodPromise:()=>Z_,ZodPrefault:()=>w_,ZodPipe:()=>A_,ZodOptional:()=>p_,ZodObject:()=>zy,ZodNumberFormat:()=>ny,ZodNumber:()=>ty,ZodNullable:()=>g_,ZodNull:()=>by,ZodNonOptional:()=>k_,ZodNever:()=>Py,ZodNanoID:()=>bv,ZodNaN:()=>O_,ZodMap:()=>Qy,ZodMAC:()=>Dv,ZodLiteral:()=>a_,ZodLazy:()=>M_,ZodKSUID:()=>Tv,ZodJWT:()=>qv,ZodIssueCode:()=>nb,ZodIntersection:()=>Fy,ZodISOTime:()=>Ng,ZodISODuration:()=>Ug,ZodISODateTime:()=>Cg,ZodISODate:()=>Dg,ZodIPv6:()=>Nv,ZodIPv4:()=>Cv,ZodGUID:()=>cv,ZodFunction:()=>L_,ZodFirstPartyTypeKind:()=>rb,ZodFile:()=>c_,ZodExactOptional:()=>h_,ZodError:()=>Zg,ZodEnum:()=>n_,ZodEmoji:()=>yv,ZodEmail:()=>av,ZodE164:()=>Vv,ZodDiscriminatedUnion:()=>Ly,ZodDefault:()=>__,ZodDate:()=>Ty,ZodCustomStringFormat:()=>Gv,ZodCustom:()=>F_,ZodCodec:()=>j_,ZodCatch:()=>E_,ZodCUID2:()=>Sv,ZodCUID:()=>$v,ZodCIDRv6:()=>Kv,ZodCIDRv4:()=>Uv,ZodBoolean:()=>uy,ZodBigIntFormat:()=>fy,ZodBigInt:()=>ly,ZodBase64URL:()=>Wv,ZodBase64:()=>Jv,ZodArray:()=>Cy,ZodAny:()=>$y,TimePrecision:()=>Xf,NEVER:()=>sa,$output:()=>$f,$input:()=>kf,$brand:()=>ua});var aa={};ia(aa,{version:()=>Ru,util:()=>ha,treeifyError:()=>Os,toJSONSchema:()=>Pg,toDotPath:()=>Ts,safeParseAsync:()=>Ms,safeParse:()=>Rs,safeEncodeAsync:()=>Qs,safeEncode:()=>Bs,safeDecodeAsync:()=>tc,safeDecode:()=>Ys,registry:()=>If,regexes:()=>rc,process:()=>zm,prettifyError:()=>As,parseAsync:()=>zs,parse:()=>js,meta:()=>Am,locales:()=>Il,isValidJWT:()=>pd,isValidBase64URL:()=>ud,isValidBase64:()=>sd,initializeContext:()=>Dm,globalRegistry:()=>Pf,globalConfig:()=>pa,formatError:()=>xs,flattenError:()=>Es,finalize:()=>Rm,extractDefs:()=>Nm,encodeAsync:()=>Fs,encode:()=>Zs,describe:()=>Tm,decodeAsync:()=>Hs,decode:()=>Ls,createToJSONSchemaMethod:()=>Mm,createStandardJSONSchemaMethod:()=>Km,config:()=>fa,clone:()=>qa,_xor:()=>nm,_xid:()=>Zf,_void:()=>$h,_uuidv7:()=>Df,_uuidv6:()=>jf,_uuidv4:()=>Cf,_uuid:()=>Af,_url:()=>zf,_uppercase:()=>Lh,_unknown:()=>bh,_union:()=>rm,_undefined:()=>vh,_ulid:()=>Kf,_uint64:()=>mh,_uint32:()=>uh,_tuple:()=>am,_trim:()=>Yh,_transform:()=>hm,_toUpperCase:()=>Qh,_toLowerCase:()=>Xh,_templateLiteral:()=>km,_symbol:()=>gh,_superRefine:()=>xm,_success:()=>_m,_stringbool:()=>Cm,_stringFormat:()=>jm,_string:()=>Ef,_startsWith:()=>Fh,_slugify:()=>em,_size:()=>Rh,_set:()=>um,_safeParseAsync:()=>Us,_safeParse:()=>Ns,_safeEncodeAsync:()=>Xs,_safeEncode:()=>qs,_safeDecodeAsync:()=>ec,_safeDecode:()=>Gs,_regex:()=>Zh,_refine:()=>Em,_record:()=>sm,_readonly:()=>$m,_property:()=>Hh,_promise:()=>Im,_positive:()=>Th,_pipe:()=>wm,_parseAsync:()=>Ds,_parse:()=>Cs,_overwrite:()=>Bh,_optional:()=>mm,_number:()=>nh,_nullable:()=>gm,_null:()=>yh,_normalize:()=>Gh,_nonpositive:()=>Ch,_nonoptional:()=>ym,_nonnegative:()=>jh,_never:()=>wh,_negative:()=>Ah,_nativeEnum:()=>lm,_nanoid:()=>Rf,_nan:()=>Ih,_multipleOf:()=>Dh,_minSize:()=>Nh,_minLength:()=>Mh,_min:()=>Oh,_mime:()=>qh,_maxSize:()=>zh,_maxLength:()=>Uh,_max:()=>Eh,_map:()=>cm,_mac:()=>Ff,_lte:()=>Eh,_lt:()=>Ph,_lowercase:()=>Jh,_literal:()=>pm,_length:()=>Kh,_lazy:()=>Sm,_ksuid:()=>Jf,_jwt:()=>Yf,_isoTime:()=>th,_isoDuration:()=>rh,_isoDateTime:()=>Qf,_isoDate:()=>eh,_ipv6:()=>Wf,_ipv4:()=>Lf,_intersection:()=>om,_int64:()=>hh,_int32:()=>ch,_int:()=>oh,_includes:()=>Wh,_guid:()=>Tf,_gte:()=>Oh,_gt:()=>xh,_float64:()=>sh,_float32:()=>ah,_file:()=>fm,_enum:()=>dm,_endsWith:()=>Vh,_encodeAsync:()=>Ws,_encode:()=>Ks,_emoji:()=>Nf,_email:()=>Of,_e164:()=>Gf,_discriminatedUnion:()=>im,_default:()=>vm,_decodeAsync:()=>Vs,_decode:()=>Js,_date:()=>kh,_custom:()=>Pm,_cuid2:()=>Mf,_cuid:()=>Uf,_coercedString:()=>xf,_coercedNumber:()=>ih,_coercedDate:()=>Sh,_coercedBoolean:()=>lh,_coercedBigint:()=>fh,_cidrv6:()=>Hf,_cidrv4:()=>Vf,_check:()=>Om,_catch:()=>bm,_boolean:()=>dh,_bigint:()=>ph,_base64url:()=>Bf,_base64:()=>qf,_array:()=>tm,_any:()=>_h,TimePrecision:()=>Xf,NEVER:()=>sa,JSONSchemaGenerator:()=>Eg,JSONSchema:()=>xg,Doc:()=>Nu,$output:()=>$f,$input:()=>kf,$constructor:()=>ca,$brand:()=>ua,$ZodXor:()=>Ud,$ZodXID:()=>Gu,$ZodVoid:()=>Pd,$ZodUnknown:()=>Sd,$ZodUnion:()=>Nd,$ZodUndefined:()=>wd,$ZodUUID:()=>Ju,$ZodURL:()=>Wu,$ZodULID:()=>Bu,$ZodType:()=>Uu,$ZodTuple:()=>Ld,$ZodTransform:()=>Qd,$ZodTemplateLiteral:()=>_l,$ZodSymbol:()=>bd,$ZodSuccess:()=>ul,$ZodStringFormat:()=>Ku,$ZodString:()=>Mu,$ZodSet:()=>qd,$ZodRegistry:()=>Sf,$ZodRecord:()=>Fd,$ZodRealError:()=>Ps,$ZodReadonly:()=>vl,$ZodPromise:()=>wl,$ZodPrefault:()=>al,$ZodPipe:()=>pl,$ZodOptional:()=>tl,$ZodObjectJIT:()=>Dd,$ZodObject:()=>jd,$ZodNumberFormat:()=>gd,$ZodNumber:()=>md,$ZodNullable:()=>nl,$ZodNull:()=>$d,$ZodNonOptional:()=>sl,$ZodNever:()=>Id,$ZodNanoID:()=>Vu,$ZodNaN:()=>ll,$ZodMap:()=>Vd,$ZodMAC:()=>id,$ZodLiteral:()=>Yd,$ZodLazy:()=>$l,$ZodKSUID:()=>Yu,$ZodJWT:()=>fd,$ZodIntersection:()=>Kd,$ZodISOTime:()=>ed,$ZodISODuration:()=>td,$ZodISODateTime:()=>Xu,$ZodISODate:()=>Qu,$ZodIPv6:()=>nd,$ZodIPv4:()=>rd,$ZodGUID:()=>Zu,$ZodFunction:()=>bl,$ZodFile:()=>Xd,$ZodExactOptional:()=>rl,$ZodError:()=>Is,$ZodEnum:()=>Gd,$ZodEncodeError:()=>la,$ZodEmoji:()=>Fu,$ZodEmail:()=>Lu,$ZodE164:()=>ld,$ZodDiscriminatedUnion:()=>Md,$ZodDefault:()=>il,$ZodDate:()=>Ed,$ZodCustomStringFormat:()=>hd,$ZodCustom:()=>kl,$ZodCodec:()=>hl,$ZodCheckUpperCase:()=>xu,$ZodCheckStringFormat:()=>Iu,$ZodCheckStartsWith:()=>Tu,$ZodCheckSizeEquals:()=>wu,$ZodCheckRegex:()=>Pu,$ZodCheckProperty:()=>ju,$ZodCheckOverwrite:()=>zu,$ZodCheckNumberFormat:()=>vu,$ZodCheckMultipleOf:()=>gu,$ZodCheckMinSize:()=>bu,$ZodCheckMinLength:()=>ku,$ZodCheckMimeType:()=>Du,$ZodCheckMaxSize:()=>_u,$ZodCheckMaxLength:()=>$u,$ZodCheckLowerCase:()=>Eu,$ZodCheckLessThan:()=>hu,$ZodCheckLengthEquals:()=>Su,$ZodCheckIncludes:()=>Ou,$ZodCheckGreaterThan:()=>mu,$ZodCheckEndsWith:()=>Au,$ZodCheckBigIntFormat:()=>yu,$ZodCheck:()=>pu,$ZodCatch:()=>dl,$ZodCUID2:()=>qu,$ZodCUID:()=>Hu,$ZodCIDRv6:()=>ad,$ZodCIDRv4:()=>od,$ZodBoolean:()=>vd,$ZodBigIntFormat:()=>_d,$ZodBigInt:()=>yd,$ZodBase64URL:()=>dd,$ZodBase64:()=>cd,$ZodAsyncError:()=>da,$ZodArray:()=>Od,$ZodAny:()=>kd});var sa=Object.freeze({status:"aborted"});function ca(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:a,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=a.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){let t=o[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class o extends i{}function a(e){var t;let i=r?.Parent?new o:this;n(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var ua=Symbol("zod_brand");class da extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class la extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}var pa={};function fa(e){return e&&Object.assign(pa,e),pa}var ha={};function ma(e){return e}function ga(e){return e}function va(e){}function ya(e){throw Error("Unexpected value in exhaustive check")}function _a(e){}function ba(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function wa(e,t="|"){return e.map(e=>Ya(e)).join(t)}function $a(e,t){return"bigint"==typeof t?t.toString():t}function ka(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Sa(e){return null==e}function Ia(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Pa(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(n)){let e=n.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let o=r>i?r:i;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}ia(ha,{unwrapMessage:()=>ds,uint8ArrayToHex:()=>$s,uint8ArrayToBase64url:()=>bs,uint8ArrayToBase64:()=>ys,stringifyPrimitive:()=>Ya,slugify:()=>Ra,shallowClone:()=>Ja,safeExtend:()=>is,required:()=>ss,randomString:()=>za,propertyKeyTypes:()=>Fa,promiseAllObject:()=>Da,primitiveTypes:()=>Va,prefixIssues:()=>us,pick:()=>ts,partial:()=>as,parsedType:()=>hs,optionalKeys:()=>Xa,omit:()=>rs,objectClone:()=>Oa,numKeys:()=>La,nullish:()=>Sa,normalizeParams:()=>Ba,mergeDefs:()=>Aa,merge:()=>os,jsonStringifyReplacer:()=>$a,joinValues:()=>wa,issue:()=>ms,isPlainObject:()=>Za,isObject:()=>Ma,hexToUint8Array:()=>ws,getSizableOrigin:()=>ps,getParsedType:()=>Wa,getLengthableOrigin:()=>fs,getEnumValues:()=>ba,getElementAtPath:()=>ja,floatSafeRemainder:()=>Pa,finalizeIssue:()=>ls,extend:()=>ns,escapeRegex:()=>Ha,esc:()=>Na,defineLazy:()=>xa,createTransparentProxy:()=>Ga,cloneDef:()=>Ca,clone:()=>qa,cleanRegex:()=>Ia,cleanEnum:()=>gs,captureStackTrace:()=>Ua,cached:()=>ka,base64urlToUint8Array:()=>_s,base64ToUint8Array:()=>vs,assignProp:()=>Ta,assertNotEqual:()=>ga,assertNever:()=>ya,assertIs:()=>va,assertEqual:()=>ma,assert:()=>_a,allowsEval:()=>Ka,aborted:()=>cs,NUMBER_FORMAT_RANGES:()=>Qa,Class:()=>ks,BIGINT_FORMAT_RANGES:()=>es});var Ea=Symbol("evaluating");function xa(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Ea)return void 0===n&&(n=Ea,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Oa(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ta(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Aa(...e){let t={};for(let r of e){let e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function Ca(e){return Aa(e._zod.def)}function ja(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function Da(e){let t=Object.keys(e),r=t.map(t=>e[t]);return Promise.all(r).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})}function za(e=10){let t="";for(let r=0;r<e;r++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(26*Math.random())];return t}function Na(e){return JSON.stringify(e)}function Ra(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ua="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ma(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var Ka=ka(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Za(e){if(!1===Ma(e))return!1;let t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;let r=t.prototype;return!1!==Ma(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Ja(e){return Za(e)?{...e}:Array.isArray(e)?[...e]:e}function La(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Wa=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":null===e?"null":e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw Error(`Unknown data type: ${t}`)}},Fa=new Set(["string","number","symbol"]),Va=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ha(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qa(e,t,r){let n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Ba(e){let t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function Ga(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,o)=>(t??(t=e()),Reflect.set(t,n,i,o)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})}function Ya(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function Xa(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}var Qa={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},es={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ts(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");return qa(e,Aa(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return Ta(this,"shape",e),e},checks:[]}))}function rs(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=Aa(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return Ta(this,"shape",n),n},checks:[]});return qa(e,i)}function ns(e,t){if(!Za(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Aa(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return Ta(this,"shape",r),r}});return qa(e,n)}function is(e,t){if(!Za(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=Aa(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return Ta(this,"shape",r),r}});return qa(e,r)}function os(e,t){let r=Aa(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Ta(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return qa(e,r)}function as(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=Aa(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return Ta(this,"shape",i),i},checks:[]});return qa(t,i)}function ss(e,t,r){let n=Aa(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return Ta(this,"shape",i),i}});return qa(t,n)}function cs(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function us(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function ds(e){return"string"==typeof e?e:e?.message}function ls(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=ds(e.inst?._zod.def?.error?.(e))??ds(t?.error?.(e))??ds(r.customError?.(e))??ds(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function ps(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function fs(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function hs(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}function ms(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function gs(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function vs(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function ys(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function _s(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return vs(t+"=".repeat((4-t.length%4)%4))}function bs(e){return ys(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ws(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r}function $s(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")}class ks{constructor(...e){}}var Ss=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,$a,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Is=ca("$ZodError",Ss),Ps=ca("$ZodError",Ss,{Parent:Error});function Es(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function xs(e,t=e=>e.message){let r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>n({issues:e}));else if("invalid_key"===i.code)n({issues:i.issues});else if("invalid_element"===i.code)n({issues:i.issues});else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n!==i.path.length-1?e[r]=e[r]||{_errors:[]}:(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))),e=e[r],n++}}};return n(e),r}function Os(e,t=e=>e.message){let r={errors:[]},n=(e,i=[])=>{var o,a;for(let s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>n({issues:e},s.path));else if("invalid_key"===s.code)n({issues:s.issues},s.path);else if("invalid_element"===s.code)n({issues:s.issues},s.path);else{let e=[...i,...s.path];if(0===e.length){r.errors.push(t(s));continue}let n=r,c=0;for(;c<e.length;){let r=e[c],i=c===e.length-1;"string"==typeof r?(n.properties??(n.properties={}),(o=n.properties)[r]??(o[r]={errors:[]}),n=n.properties[r]):(n.items??(n.items=[]),(a=n.items)[r]??(a[r]={errors:[]}),n=n.items[r]),i&&n.errors.push(t(s)),c++}}};return n(e),r}function Ts(e){let t=[],r=e.map(e=>"object"==typeof e?e.key:e);for(let e of r)"number"==typeof e?t.push(`[${e}]`):"symbol"==typeof e?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push("."),t.push(e));return t.join("")}function As(e){let t=[],r=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of r)t.push(`ā ${e.message}`),e.path?.length&&t.push(` ā at ${Ts(e.path)}`);return t.join("\n")}var Cs=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new da;if(a.issues.length){let t=new(i?.Err??e)(a.issues.map(e=>ls(e,o,fa())));throw Ua(t,i?.callee),t}return a.value},js=Cs(Ps),Ds=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let t=new(i?.Err??e)(a.issues.map(e=>ls(e,o,fa())));throw Ua(t,i?.callee),t}return a.value},zs=Ds(Ps),Ns=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new da;return o.issues.length?{success:!1,error:new(e??Is)(o.issues.map(e=>ls(e,i,fa())))}:{success:!0,data:o.value}},Rs=Ns(Ps),Us=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>ls(e,i,fa())))}:{success:!0,data:o.value}},Ms=Us(Ps),Ks=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Cs(e)(t,r,i)},Zs=Ks(Ps),Js=e=>(t,r,n)=>Cs(e)(t,r,n),Ls=Js(Ps),Ws=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ds(e)(t,r,i)},Fs=Ws(Ps),Vs=e=>async(t,r,n)=>Ds(e)(t,r,n),Hs=Vs(Ps),qs=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ns(e)(t,r,i)},Bs=qs(Ps),Gs=e=>(t,r,n)=>Ns(e)(t,r,n),Ys=Gs(Ps),Xs=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Us(e)(t,r,i)},Qs=Xs(Ps),ec=e=>async(t,r,n)=>Us(e)(t,r,n),tc=ec(Ps),rc={};ia(rc,{xid:()=>ac,uuid7:()=>mc,uuid6:()=>hc,uuid4:()=>fc,uuid:()=>pc,uppercase:()=>Hc,unicodeEmail:()=>_c,undefined:()=>Fc,ulid:()=>oc,time:()=>Rc,string:()=>Mc,sha512_hex:()=>uu,sha512_base64url:()=>lu,sha512_base64:()=>du,sha384_hex:()=>au,sha384_base64url:()=>cu,sha384_base64:()=>su,sha256_hex:()=>nu,sha256_base64url:()=>ou,sha256_base64:()=>iu,sha1_hex:()=>eu,sha1_base64url:()=>ru,sha1_base64:()=>tu,rfc5322Email:()=>yc,number:()=>Jc,null:()=>Wc,nanoid:()=>cc,md5_hex:()=>Yc,md5_base64url:()=>Qc,md5_base64:()=>Xc,mac:()=>Pc,lowercase:()=>Vc,ksuid:()=>sc,ipv6:()=>Ic,ipv4:()=>Sc,integer:()=>Zc,idnEmail:()=>bc,html5Email:()=>vc,hostname:()=>Ac,hex:()=>qc,guid:()=>lc,extendedDuration:()=>dc,emoji:()=>kc,email:()=>gc,e164:()=>jc,duration:()=>uc,domain:()=>Cc,datetime:()=>Uc,date:()=>zc,cuid2:()=>ic,cuid:()=>nc,cidrv6:()=>xc,cidrv4:()=>Ec,browserEmail:()=>wc,boolean:()=>Lc,bigint:()=>Kc,base64url:()=>Tc,base64:()=>Oc});var nc=/^[cC][^\s-]{8,}$/,ic=/^[0-9a-z]+$/,oc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ac=/^[0-9a-vA-V]{20}$/,sc=/^[A-Za-z0-9]{27}$/,cc=/^[a-zA-Z0-9_-]{21}$/,uc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,dc=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,lc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,pc=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,fc=pc(4),hc=pc(6),mc=pc(7),gc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vc=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yc=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,_c=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,bc=_c,wc=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$c="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function kc(){return new RegExp($c,"u")}var Sc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ic=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Pc=e=>{let t=Ha(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Ec=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,xc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Oc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tc=/^[A-Za-z0-9_-]*$/,Ac=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Cc=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,jc=/^\+[1-9]\d{6,14}$/,Dc="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",zc=new RegExp(`^${Dc}$`);function Nc(e){return"number"==typeof e.precision?-1===e.precision?"(?:[01]\\d|2[0-3]):[0-5]\\d":0===e.precision?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Rc(e){return new RegExp(`^${Nc(e)}$`)}function Uc(e){let t=Nc({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Dc}T(?:${n})$`)}var Mc=e=>new RegExp(`^${e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*"}$`),Kc=/^-?\d+n?$/,Zc=/^-?\d+$/,Jc=/^-?\d+(?:\.\d+)?$/,Lc=/^(?:true|false)$/i,Wc=/^null$/i,Fc=/^undefined$/i,Vc=/^[^A-Z]*$/,Hc=/^[^a-z]*$/,qc=/^[0-9a-fA-F]*$/;function Bc(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Gc(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Yc=/^[0-9a-fA-F]{32}$/,Xc=Bc(22,"=="),Qc=Gc(22),eu=/^[0-9a-fA-F]{40}$/,tu=Bc(27,"="),ru=Gc(27),nu=/^[0-9a-fA-F]{64}$/,iu=Bc(43,"="),ou=Gc(43),au=/^[0-9a-fA-F]{96}$/,su=Bc(64,""),cu=Gc(64),uu=/^[0-9a-fA-F]{128}$/,du=Bc(86,"=="),lu=Gc(86),pu=ca("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),fu={number:"number",bigint:"bigint",object:"date"},hu=ca("$ZodCheckLessThan",(e,t)=>{pu.init(e,t);let r=fu[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mu=ca("$ZodCheckGreaterThan",(e,t)=>{pu.init(e,t);let r=fu[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gu=ca("$ZodCheckMultipleOf",(e,t)=>{pu.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value!==BigInt(0):0!==Pa(r.value,t.value))&&r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),vu=ca("$ZodCheckNumberFormat",(e,t)=>{pu.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Qa[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=o,r&&(n.pattern=Zc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),yu=ca("$ZodCheckBigIntFormat",(e,t)=>{pu.init(e,t);let[r,n]=es[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),_u=ca("$ZodCheckMaxSize",(e,t)=>{var r;pu.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sa(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:ps(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),bu=ca("$ZodCheckMinSize",(e,t)=>{var r;pu.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sa(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:ps(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),wu=ca("$ZodCheckSizeEquals",(e,t)=>{var r;pu.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sa(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let o=i>t.size;r.issues.push({origin:ps(n),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),$u=ca("$ZodCheckMaxLength",(e,t)=>{var r;pu.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sa(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=fs(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ku=ca("$ZodCheckMinLength",(e,t)=>{var r;pu.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sa(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=fs(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Su=ca("$ZodCheckLengthEquals",(e,t)=>{var r;pu.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!Sa(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let o=fs(n),a=i>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Iu=ca("$ZodCheckStringFormat",(e,t)=>{var r,n;pu.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Pu=ca("$ZodCheckRegex",(e,t)=>{Iu.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Eu=ca("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Vc),Iu.init(e,t)}),xu=ca("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Hc),Iu.init(e,t)}),Ou=ca("$ZodCheckIncludes",(e,t)=>{pu.init(e,t);let r=Ha(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Tu=ca("$ZodCheckStartsWith",(e,t)=>{pu.init(e,t);let r=new RegExp(`^${Ha(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Au=ca("$ZodCheckEndsWith",(e,t)=>{pu.init(e,t);let r=new RegExp(`.*${Ha(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Cu(e,t,r){e.issues.length&&t.issues.push(...us(r,e.issues))}var ju=ca("$ZodCheckProperty",(e,t)=>{pu.init(e,t),e._zod.check=e=>{let r=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(r=>Cu(r,e,t.property));Cu(r,e,t.property)}}),Du=ca("$ZodCheckMimeType",(e,t)=>{pu.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),zu=ca("$ZodCheckOverwrite",(e,t)=>{pu.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Nu{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(let e of n)this.content.push(e)}compile(){let e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}var Ru={major:4,minor:3,patch:5},Uu=ca("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ru;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let t of n)for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=cs(e);for(let o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,a=o._zod.check(e);if(a instanceof Promise&&!1===r?.async)throw new da;if(n||a instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(i||(i=cs(e,t)))});else{if(e.issues.length===t)continue;i||(i=cs(e,t))}}return n?n.then(()=>e):e},r=(r,i,o)=>{if(cs(r))return r.aborted=!0,r;let a=t(i,n,o);if(a instanceof Promise){if(!1===o.async)throw new da;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){let t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,o)):r(t,i,o)}let a=e._zod.parse(i,o);if(a instanceof Promise){if(!1===o.async)throw new da;return a.then(e=>t(e,n,o))}return t(a,n,o)}}xa(e,"~standard",()=>({validate:t=>{try{let r=Rs(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Ms(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Mu=ca("$ZodString",(e,t)=>{Uu.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Mc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ku=ca("$ZodStringFormat",(e,t)=>{Iu.init(e,t),Mu.init(e,t)}),Zu=ca("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lc),Ku.init(e,t)}),Ju=ca("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=pc(e))}else t.pattern??(t.pattern=pc());Ku.init(e,t)}),Lu=ca("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=gc),Ku.init(e,t)}),Wu=ca("$ZodURL",(e,t)=>{Ku.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=i.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Fu=ca("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=kc()),Ku.init(e,t)}),Vu=ca("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=cc),Ku.init(e,t)}),Hu=ca("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=nc),Ku.init(e,t)}),qu=ca("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ic),Ku.init(e,t)}),Bu=ca("$ZodULID",(e,t)=>{t.pattern??(t.pattern=oc),Ku.init(e,t)}),Gu=ca("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ac),Ku.init(e,t)}),Yu=ca("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=sc),Ku.init(e,t)}),Xu=ca("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Uc(t)),Ku.init(e,t)}),Qu=ca("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zc),Ku.init(e,t)}),ed=ca("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Rc(t)),Ku.init(e,t)}),td=ca("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=uc),Ku.init(e,t)}),rd=ca("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Sc),Ku.init(e,t),e._zod.bag.format="ipv4"}),nd=ca("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ic),Ku.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),id=ca("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Pc(t.delimiter)),Ku.init(e,t),e._zod.bag.format="mac"}),od=ca("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ec),Ku.init(e,t)}),ad=ca("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=xc),Ku.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t)throw Error();if(r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function sd(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var cd=ca("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Oc),Ku.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{sd(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function ud(e){if(!Tc.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return sd(t.padEnd(4*Math.ceil(t.length/4),"="))}var dd=ca("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Tc),Ku.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{ud(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ld=ca("$ZodE164",(e,t)=>{t.pattern??(t.pattern=jc),Ku.init(e,t)});function pd(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var fd=ca("$ZodJWT",(e,t)=>{Ku.init(e,t),e._zod.check=r=>{pd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),hd=ca("$ZodCustomStringFormat",(e,t)=>{Ku.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),md=ca("$ZodNumber",(e,t)=>{Uu.init(e,t),e._zod.pattern=e._zod.bag.pattern??Jc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),gd=ca("$ZodNumberFormat",(e,t)=>{vu.init(e,t),md.init(e,t)}),vd=ca("$ZodBoolean",(e,t)=>{Uu.init(e,t),e._zod.pattern=Lc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),yd=ca("$ZodBigInt",(e,t)=>{Uu.init(e,t),e._zod.pattern=Kc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),_d=ca("$ZodBigIntFormat",(e,t)=>{yu.init(e,t),yd.init(e,t)}),bd=ca("$ZodSymbol",(e,t)=>{Uu.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return"symbol"==typeof n||t.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),t}}),wd=ca("$ZodUndefined",(e,t)=>{Uu.init(e,t),e._zod.pattern=Fc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,r)=>{let n=t.value;return typeof n>"u"||t.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),t}}),$d=ca("$ZodNull",(e,t)=>{Uu.init(e,t),e._zod.pattern=Wc,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),kd=ca("$ZodAny",(e,t)=>{Uu.init(e,t),e._zod.parse=e=>e}),Sd=ca("$ZodUnknown",(e,t)=>{Uu.init(e,t),e._zod.parse=e=>e}),Id=ca("$ZodNever",(e,t)=>{Uu.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),Pd=ca("$ZodVoid",(e,t)=>{Uu.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return typeof n>"u"||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}}),Ed=ca("$ZodDate",(e,t)=>{Uu.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function xd(e,t,r){e.issues.length&&t.issues.push(...us(r,e.issues)),t.value[r]=e.value}var Od=ca("$ZodArray",(e,t)=>{Uu.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let e=0;e<i.length;e++){let a=i[e],s=t.element._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(t=>xd(t,r,e))):xd(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function Td(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...us(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Ad(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=Xa(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Cd(e,t,r,n,i,o){let a=[],s=i.keySet,c=i.catchall._zod,u=c.def.type,d="optional"===c.optout;for(let i in t){if(s.has(i))continue;if("never"===u){a.push(i);continue}let o=c.run({value:t[i],issues:[]},n);o instanceof Promise?e.push(o.then(e=>Td(e,r,i,t,d))):Td(o,r,i,t,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var jd=ca("$ZodObject",(e,t)=>{if(Uu.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let r=ka(()=>Ad(t));xa(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(let e of n.values)r[t].add(e)}}return r});let n,i=Ma,o=t.catchall;e._zod.parse=(t,a)=>{n??(n=r.value);let s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};let c=[],u=n.shape;for(let e of n.keys){let r=u[e],n="optional"===r._zod.optout,i=r._zod.run({value:s[e],issues:[]},a);i instanceof Promise?c.push(i.then(r=>Td(r,t,e,s,n))):Td(i,t,e,s,n)}return o?Cd(c,s,t,a,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),Dd=ca("$ZodObjectJIT",(e,t)=>{jd.init(e,t);let r,n,i=e._zod.parse,o=ka(()=>Ad(t)),a=Ma,s=!pa.jitless,c=s&&Ka.value,u=t.catchall;e._zod.parse=(d,l)=>{n??(n=o.value);let p=d.value;return a(p)?s&&c&&!1===l?.async&&!0!==l.jitless?(r||(r=(e=>{let t=new Nu(["shape","payload","ctx"]),r=o.value,n=e=>{let t=Na(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),a=0;for(let e of r.keys)i[e]="key_"+a++;t.write("const newResult = {};");for(let o of r.keys){let r=i[o],a=Na(o),s="optional"===e[o]?._zod?.optout;t.write(`const ${r} = ${n(o)};`),s?t.write(`\n if (${r}.issues.length) {\n if (${a} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=r(d,l),u?Cd([],p,d,l,n,e):d):i(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function zd(e,t,r,n){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!cs(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>ls(e,n,fa())))}),t)}var Nd=ca("$ZodUnion",(e,t)=>{Uu.init(e,t),xa(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),xa(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),xa(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),xa(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>Ia(e.source)).join("|")})$`)}});let r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},o);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then(t=>zd(t,i,e,o)):zd(s,i,e,o)}});function Rd(e,t,r,n){let i=e.filter(e=>0===e.issues.length);return 1===i.length?(t.value=i[0].value,t):(0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>ls(e,n,fa())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var Ud=ca("$ZodXor",(e,t)=>{Nd.init(e,t),t.inclusive=!1;let r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},o);t instanceof Promise?(s.push(t),a=!0):s.push(t)}return a?Promise.all(s).then(t=>Rd(t,i,e,o)):Rd(s,i,e,o)}}),Md=ca("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Nd.init(e,t);let r=e._zod.parse;xa(e._zod,"propValues",()=>{let e={};for(let r of t.options){let n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(n)){e[t]||(e[t]=new Set);for(let n of r)e[t].add(n)}}return e});let n=ka(()=>{let e=t.options,r=new Map;for(let n of e){let e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,o)=>{let a=i.value;if(!Ma(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),Kd=ca("$ZodIntersection",(e,t)=>{Uu.init(e,t),e._zod.parse=(e,r)=>{let n=e.value,i=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,r])=>Jd(e,t,r)):Jd(e,i,o)}});function Zd(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Za(e)&&Za(t)){let r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};for(let r of n){let n=Zd(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i[r]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=Zd(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Jd(e,t,r){let n,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code){n??(n=r);for(let e of r.keys)i.has(e)||i.set(e,{}),i.get(e).l=!0}else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let o=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&n&&e.issues.push({...n,keys:o}),cs(e))return e;let a=Zd(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Ld=ca("$ZodTuple",(e,t)=>{Uu.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(e=>"optional"!==e._zod.optin),c=-1===s?0:r.length-s;if(!t.rest){let t=o.length>r.length,i=o.length<c-1;if(t||i)return n.issues.push({...t?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:o,inst:e,origin:"array"}),n}let u=-1;for(let e of r){if(u++,u>=o.length&&u>=c)continue;let t=e._zod.run({value:o[u],issues:[]},i);t instanceof Promise?a.push(t.then(e=>Wd(e,n,u))):Wd(t,n,u)}if(t.rest){let e=o.slice(r.length);for(let r of e){u++;let e=t.rest._zod.run({value:r,issues:[]},i);e instanceof Promise?a.push(e.then(e=>Wd(e,n,u))):Wd(e,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Wd(e,t,r){e.issues.length&&t.issues.push(...us(r,e.issues)),t.value[r]=e.value}var Fd=ca("$ZodRecord",(e,t)=>{Uu.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Za(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let o=[],a=t.keyType._zod.values;if(a){r.value={};let s,c=new Set;for(let e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){c.add("number"==typeof e?e.toString():e);let a=t.valueType._zod.run({value:i[e],issues:[]},n);a instanceof Promise?o.push(a.then(t=>{t.issues.length&&r.issues.push(...us(e,t.issues)),r.value[e]=t.value})):(a.issues.length&&r.issues.push(...us(e,a.issues)),r.value[e]=a.value)}for(let e in i)c.has(e)||(s=s??[],s.push(e));s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else{r.value={};for(let a of Reflect.ownKeys(i)){if("__proto__"===a)continue;let s=t.keyType._zod.run({value:a,issues:[]},n);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof a&&Jc.test(a)&&s.issues.length&&s.issues.some(e=>"invalid_type"===e.code&&"number"===e.expected)){let e=t.keyType._zod.run({value:Number(a),issues:[]},n);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[a]=i[a]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>ls(e,n,fa())),input:a,path:[a],inst:e});continue}let c=t.valueType._zod.run({value:i[a],issues:[]},n);c instanceof Promise?o.push(c.then(e=>{e.issues.length&&r.issues.push(...us(a,e.issues)),r.value[s.value]=e.value})):(c.issues.length&&r.issues.push(...us(a,c.issues)),r.value[s.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Vd=ca("$ZodMap",(e,t)=>{Uu.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let o=[];r.value=new Map;for(let[a,s]of i){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?o.push(Promise.all([c,u]).then(([t,o])=>{Hd(t,o,r,a,i,e,n)})):Hd(c,u,r,a,i,e,n)}return o.length?Promise.all(o).then(()=>r):r}});function Hd(e,t,r,n,i,o,a){e.issues.length&&(Fa.has(typeof n)?r.issues.push(...us(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(e=>ls(e,a,fa()))})),t.issues.length&&(Fa.has(typeof n)?r.issues.push(...us(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map(e=>ls(e,a,fa()))})),r.value.set(e.value,t.value)}var qd=ca("$ZodSet",(e,t)=>{Uu.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},n);i instanceof Promise?o.push(i.then(e=>Bd(e,r))):Bd(i,r)}return o.length?Promise.all(o).then(()=>r):r}});function Bd(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Gd=ca("$ZodEnum",(e,t)=>{Uu.init(e,t);let r=ba(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Fa.has(typeof e)).map(e=>"string"==typeof e?Ha(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),Yd=ca("$ZodLiteral",(e,t)=>{if(Uu.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?Ha(e):e?Ha(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Xd=ca("$ZodFile",(e,t)=>{Uu.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return n instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),t}}),Qd=ca("$ZodTransform",(e,t)=>{Uu.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new la(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r));if(i instanceof Promise)throw new da;return r.value=i,r}});function el(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}var tl=ca("$ZodOptional",(e,t)=>{Uu.init(e,t),e._zod.optin="optional",e._zod.optout="optional",xa(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),xa(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ia(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>el(t,e.value)):el(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),rl=ca("$ZodExactOptional",(e,t)=>{tl.init(e,t),xa(e._zod,"values",()=>t.innerType._zod.values),xa(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),nl=ca("$ZodNullable",(e,t)=>{Uu.init(e,t),xa(e._zod,"optin",()=>t.innerType._zod.optin),xa(e._zod,"optout",()=>t.innerType._zod.optout),xa(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ia(e.source)}|null)$`):void 0}),xa(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),il=ca("$ZodDefault",(e,t)=>{Uu.init(e,t),e._zod.optin="optional",xa(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>ol(e,t)):ol(n,t)}});function ol(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var al=ca("$ZodPrefault",(e,t)=>{Uu.init(e,t),e._zod.optin="optional",xa(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),sl=ca("$ZodNonOptional",(e,t)=>{Uu.init(e,t),xa(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>cl(t,e)):cl(i,e)}});function cl(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ul=ca("$ZodSuccess",(e,t)=>{Uu.init(e,t),e._zod.parse=(e,r)=>{if("backward"===r.direction)throw new la("ZodSuccess");let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===n.issues.length,e)}}),dl=ca("$ZodCatch",(e,t)=>{Uu.init(e,t),xa(e._zod,"optin",()=>t.innerType._zod.optin),xa(e._zod,"optout",()=>t.innerType._zod.optout),xa(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>ls(e,r,fa()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>ls(e,r,fa()))},input:e.value}),e.issues=[]),e)}}),ll=ca("$ZodNaN",(e,t)=>{Uu.init(e,t),e._zod.parse=(t,r)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)}),pl=ca("$ZodPipe",(e,t)=>{Uu.init(e,t),xa(e._zod,"values",()=>t.in._zod.values),xa(e._zod,"optin",()=>t.in._zod.optin),xa(e._zod,"optout",()=>t.out._zod.optout),xa(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>fl(e,t.in,r)):fl(n,t.in,r)}let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>fl(e,t.out,r)):fl(n,t.out,r)}});function fl(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var hl=ca("$ZodCodec",(e,t)=>{Uu.init(e,t),xa(e._zod,"values",()=>t.in._zod.values),xa(e._zod,"optin",()=>t.in._zod.optin),xa(e._zod,"optout",()=>t.out._zod.optout),xa(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("forward"===(r.direction||"forward")){let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>ml(e,t,r)):ml(n,t,r)}{let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>ml(e,t,r)):ml(n,t,r)}}});function ml(e,t,r){if(e.issues.length)return e.aborted=!0,e;if("forward"===(r.direction||"forward")){let n=t.transform(e.value,e);return n instanceof Promise?n.then(n=>gl(e,n,t.out,r)):gl(e,n,t.out,r)}{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(n=>gl(e,n,t.in,r)):gl(e,n,t.in,r)}}function gl(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var vl=ca("$ZodReadonly",(e,t)=>{Uu.init(e,t),xa(e._zod,"propValues",()=>t.innerType._zod.propValues),xa(e._zod,"values",()=>t.innerType._zod.values),xa(e._zod,"optin",()=>t.innerType?._zod?.optin),xa(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(yl):yl(n)}});function yl(e){return e.value=Object.freeze(e.value),e}var _l=ca("$ZodTemplateLiteral",(e,t)=>{Uu.init(e,t);let r=[];for(let e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let n=t.startsWith("^")?1:0,i=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(n,i))}else{if(null!==e&&!Va.has(typeof e))throw Error(`Invalid template literal part: ${e}`);r.push(Ha(`${e}`))}e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(r,n)=>"string"!=typeof r.value?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),bl=ca("$ZodFunction",(e,t)=>(Uu.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw Error("implement() must be called with a function");return function(...r){let n=e._def.input?js(e._def.input,r):r,i=Reflect.apply(t,this,n);return e._def.output?js(e._def.output,i):i}},e.implementAsync=t=>{if("function"!=typeof t)throw Error("implementAsync() must be called with a function");return async function(...r){let n=e._def.input?await zs(e._def.input,r):r,i=await Reflect.apply(t,this,n);return e._def.output?await zs(e._def.output,i):i}},e._zod.parse=(t,r)=>"function"!=typeof t.value?(t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t):(e._def.output&&"promise"===e._def.output._zod.def.type?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t),e.input=(...t)=>{let r=e.constructor;return Array.isArray(t[0])?new r({type:"function",input:new Ld({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}):new r({type:"function",input:t[0],output:e._def.output})},e.output=t=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),wl=ca("$ZodPromise",(e,t)=>{Uu.init(e,t),e._zod.parse=(e,r)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},r))}),$l=ca("$ZodLazy",(e,t)=>{Uu.init(e,t),xa(e._zod,"innerType",()=>t.getter()),xa(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),xa(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),xa(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),xa(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),kl=ca("$ZodCustom",(e,t)=>{pu.init(e,t),Uu.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>Sl(t,r,n,e));Sl(i,r,n,e)}});function Sl(e,t,r,n){if(!e){let e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(ms(e))}}var Il={};ia(Il,{zhTW:()=>yf,zhCN:()=>gf,yo:()=>bf,vi:()=>hf,uz:()=>pf,ur:()=>df,uk:()=>sf,ua:()=>cf,tr:()=>of,th:()=>rf,ta:()=>ef,sv:()=>Xp,sl:()=>Gp,ru:()=>qp,pt:()=>Fp,ps:()=>Zp,pl:()=>Lp,ota:()=>Mp,no:()=>Rp,nl:()=>zp,ms:()=>jp,mk:()=>Ap,lt:()=>Op,ko:()=>Ip,km:()=>$p,kh:()=>kp,ka:()=>bp,ja:()=>yp,it:()=>gp,is:()=>hp,id:()=>pp,hy:()=>dp,hu:()=>ap,he:()=>ip,frCA:()=>rp,fr:()=>ep,fi:()=>Xl,fa:()=>Gl,es:()=>ql,eo:()=>Vl,en:()=>Wl,de:()=>Jl,da:()=>Kl,cs:()=>Ul,ca:()=>Nl,bg:()=>Dl,be:()=>Cl,az:()=>Ol,ar:()=>El});var Pl=()=>{let e={string:{unit:"ŲŲ±Ł",verb:"أ٠ŁŲŁŁ"},file:{unit:"ŲØŲ§ŁŲŖ",verb:"أ٠ŁŲŁŁ"},array:{unit:"Ų¹ŁŲµŲ±",verb:"أ٠ŁŲŁŁ"},set:{unit:"Ų¹ŁŲµŲ±",verb:"أ٠ŁŲŁŁ"}};function t(t){return e[t]??null}let r={regex:"Ł
ŲÆŲ®Ł",email:"ŲØŲ±ŁŲÆ Ų„ŁŁŲŖŲ±ŁŁŁ",url:"Ų±Ų§ŲØŲ·",emoji:"Ų„ŁŁ
ŁŲ¬Ł",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ŲŖŲ§Ų±ŁŲ® ŁŁŁŲŖ ŲØŁ
Ų¹ŁŲ§Ų± ISO",date:"ŲŖŲ§Ų±ŁŲ® ŲØŁ
Ų¹ŁŲ§Ų± ISO",time:"ŁŁŲŖ ŲØŁ
Ų¹ŁŲ§Ų± ISO",duration:"Ł
ŲÆŲ© ŲØŁ
Ų¹ŁŲ§Ų± ISO",ipv4:"Ų¹ŁŁŲ§Ł IPv4",ipv6:"Ų¹ŁŁŲ§Ł IPv6",cidrv4:"Ł
ŲÆŁ Ų¹ŁŲ§ŁŁŁ ŲØŲµŁŲŗŲ© IPv4",cidrv6:"Ł
ŲÆŁ Ų¹ŁŲ§ŁŁŁ ŲØŲµŁŲŗŲ© IPv6",base64:"ŁŁŲµ ŲØŲŖŲ±Ł
ŁŲ² base64-encoded",base64url:"ŁŁŲµ ŲØŲŖŲ±Ł
ŁŲ² base64url-encoded",json_string:"ŁŁŲµ Ų¹ŁŁ ŁŁŲ¦Ų© JSON",e164:"Ų±ŁŁ
ŁŲ§ŲŖŁ ŲØŁ
Ų¹ŁŲ§Ų± E.164",jwt:"JWT",template_literal:"Ł
ŲÆŲ®Ł"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Ł
ŲÆŲ®ŁŲ§ŲŖ ŲŗŁŲ± Ł
ŁŲØŁŁŲ©: ŁŁŲŖŲ±Ų¶ Ų„ŲÆŲ®Ų§Ł instanceof ${e.expected}Ų ŁŁŁŁ ŲŖŁ
Ų„ŲÆŲ®Ų§Ł ${i}`:`Ł
ŲÆŲ®ŁŲ§ŲŖ ŲŗŁŲ± Ł
ŁŲØŁŁŲ©: ŁŁŲŖŲ±Ų¶ Ų„ŲÆŲ®Ų§Ł ${t}Ų ŁŁŁŁ ŲŖŁ
Ų„ŲÆŲ®Ų§Ł ${i}`}case"invalid_value":return 1===e.values.length?`Ł
ŲÆŲ®ŁŲ§ŲŖ ŲŗŁŲ± Ł
ŁŲØŁŁŲ©: ŁŁŲŖŲ±Ų¶ Ų„ŲÆŲ®Ų§Ł ${Ya(e.values[0])}`:`Ų§Ų®ŲŖŁŲ§Ų± ŲŗŁŲ± Ł
ŁŲØŁŁ: ŁŲŖŁŁŲ¹ Ų§ŁŲŖŁŲ§Ų” Ų£ŲŲÆ ŁŲ°Ł Ų§ŁŲ®ŁŲ§Ų±Ų§ŲŖ: ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?` Ų£ŁŲØŲ± Ł
Ł Ų§ŁŁŲ§Ų²Ł
: ŁŁŲŖŲ±Ų¶ Ų£Ł ŲŖŁŁŁ ${e.origin??"Ų§ŁŁŁŁ
Ų©"} ${r} ${e.maximum.toString()} ${n.unit??"Ų¹ŁŲµŲ±"}`:`Ų£ŁŲØŲ± Ł
Ł Ų§ŁŁŲ§Ų²Ł
: ŁŁŲŖŲ±Ų¶ Ų£Ł ŲŖŁŁŁ ${e.origin??"Ų§ŁŁŁŁ
Ų©"} ${r} ${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Ų£ŲµŲŗŲ± Ł
Ł Ų§ŁŁŲ§Ų²Ł
: ŁŁŲŖŲ±Ų¶ ŁŁ ${e.origin} Ų£Ł ŁŁŁŁ ${r} ${e.minimum.toString()} ${n.unit}`:`Ų£ŲµŲŗŲ± Ł
Ł Ų§ŁŁŲ§Ų²Ł
: ŁŁŲŖŲ±Ų¶ ŁŁ ${e.origin} Ų£Ł ŁŁŁŁ ${r} ${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ŁŁŲµ ŲŗŁŲ± Ł
ŁŲØŁŁ: ŁŲ¬ŲØ Ų£Ł ŁŲØŲÆŲ£ ŲØŁ "${e.prefix}"`:"ends_with"===t.format?`ŁŁŲµ ŲŗŁŲ± Ł
ŁŲØŁŁ: ŁŲ¬ŲØ Ų£Ł ŁŁŲŖŁŁ ŲØŁ "${t.suffix}"`:"includes"===t.format?`ŁŁŲµ ŲŗŁŲ± Ł
ŁŲØŁŁ: ŁŲ¬ŲØ Ų£Ł ŁŲŖŲ¶Ł
ŁŁŁ "${t.includes}"`:"regex"===t.format?`ŁŁŲµ ŲŗŁŲ± Ł
ŁŲØŁŁ: ŁŲ¬ŲØ Ų£Ł ŁŲ·Ų§ŲØŁ Ų§ŁŁŁ
Ų· ${t.pattern}`:`${r[t.format]??e.format} ŲŗŁŲ± Ł
ŁŲØŁŁ`}case"not_multiple_of":return`Ų±ŁŁ
ŲŗŁŲ± Ł
ŁŲØŁŁ: ŁŲ¬ŲØ Ų£Ł ŁŁŁŁ Ł
Ł Ł
Ų¶Ų§Ų¹ŁŲ§ŲŖ ${e.divisor}`;case"unrecognized_keys":return`Ł
Ų¹Ų±Ł${e.keys.length>1?"Ų§ŲŖ":""} ŲŗŲ±ŁŲØ${e.keys.length>1?"Ų©":""}: ${wa(e.keys,"Ų ")}`;case"invalid_key":return`Ł
عر٠غŁŲ± Ł
ŁŲØŁŁ ŁŁ ${e.origin}`;case"invalid_union":default:return"Ł
دخ٠غŁŲ± Ł
ŁŲØŁŁ";case"invalid_element":return`Ł
دخ٠غŁŲ± Ł
ŁŲØŁŁ ŁŁ ${e.origin}`}}};function El(){return{localeError:Pl()}}var xl=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(t){return e[t]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`YanlıŠdÉyÉr: gƶzlÉnilÉn instanceof ${e.expected}, daxil olan ${i}`:`YanlıŠdÉyÉr: gƶzlÉnilÉn ${t}, daxil olan ${i}`}case"invalid_value":return 1===e.values.length?`YanlıŠdÉyÉr: gƶzlÉnilÉn ${Ya(e.values[0])}`:`YanlıŠseƧim: aÅaÄıdakılardan biri olmalıdır: ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Ćox bƶyük: gƶzlÉnilÉn ${e.origin??"dÉyÉr"} ${r}${e.maximum.toString()} ${n.unit??"element"}`:`Ćox bƶyük: gƶzlÉnilÉn ${e.origin??"dÉyÉr"} ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Ćox kiƧik: gƶzlÉnilÉn ${e.origin} ${r}${e.minimum.toString()} ${n.unit}`:`Ćox kiƧik: gƶzlÉnilÉn ${e.origin} ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`YanlıŠmÉtn: "${t.prefix}" ilÉ baÅlamalıdır`:"ends_with"===t.format?`YanlıŠmÉtn: "${t.suffix}" ilÉ bitmÉlidir`:"includes"===t.format?`YanlıŠmÉtn: "${t.includes}" daxil olmalıdır`:"regex"===t.format?`YanlıŠmÉtn: ${t.pattern} Åablonuna uyÄun olmalıdır`:`YanlıŠ${r[t.format]??e.format}`}case"not_multiple_of":return`YanlıŠÉdÉd: ${e.divisor} ilÉ bƶlünÉ bilÉn olmalıdır`;case"unrecognized_keys":return`Tanınmayan aƧar${e.keys.length>1?"lar":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`${e.origin} daxilindÉ yanlıŠaƧar`;case"invalid_union":default:return"YanlıŠdÉyÉr";case"invalid_element":return`${e.origin} daxilindÉ yanlıŠdÉyÉr`}}};function Ol(){return{localeError:xl()}}function Tl(e,t,r,n){let i=Math.abs(e),o=i%10,a=i%100;return a>=11&&a<=19?n:1===o?t:o>=2&&o<=4?r:n}var Al=()=>{let e={string:{unit:{one:"ŃŃŠ¼Š²Š°Š»",few:"ŃŃŠ¼Š²Š°Š»Ń",many:"ŃŃŠ¼Š²Š°Š»Š°Ń"},verb:"меŃŃ"},array:{unit:{one:"ŃŠ»ŠµŠ¼ŠµŠ½Ń",few:"ŃŠ»ŠµŠ¼ŠµŠ½ŃŃ",many:"ŃŠ»ŠµŠ¼ŠµŠ½ŃаŃ"},verb:"меŃŃ"},set:{unit:{one:"ŃŠ»ŠµŠ¼ŠµŠ½Ń",few:"ŃŠ»ŠµŠ¼ŠµŠ½ŃŃ",many:"ŃŠ»ŠµŠ¼ŠµŠ½ŃаŃ"},verb:"меŃŃ"},file:{unit:{one:"байŃ",few:"байŃŃ",many:"Š±Š°Š¹ŃŠ°Ń"},verb:"меŃŃ"}};function t(t){return e[t]??null}let r={regex:"ŃŠ²Š¾Š“",email:"email Š°Š“ŃŠ°Ń",url:"URL",emoji:"ŃŠ¼Š¾Š“Š·Ń",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO Š“Š°ŃŠ° Ń ŃŠ°Ń",date:"ISO Š“Š°ŃŠ°",time:"ISO ŃŠ°Ń",duration:"ISO ŠæŃŠ°ŃŃŠ³Š»Š°ŃŃŃ",ipv4:"IPv4 Š°Š“ŃŠ°Ń",ipv6:"IPv6 Š°Š“ŃŠ°Ń",cidrv4:"IPv4 Š“ŃŃŠæŠ°Š·Š¾Š½",cidrv6:"IPv6 Š“ŃŃŠæŠ°Š·Š¾Š½",base64:"ŃŠ°Š“ок Ń ŃŠ°ŃŠ¼Š°ŃŠµ base64",base64url:"ŃŠ°Š“ок Ń ŃŠ°ŃŠ¼Š°ŃŠµ base64url",json_string:"JSON ŃŠ°Š“ок",e164:"Š½ŃŠ¼Š°Ń E.164",jwt:"JWT",template_literal:"ŃŠ²Š¾Š“"},n={nan:"NaN",number:"Š»ŃŠŗ",array:"маŃŃŃ"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ²Š¾Š“: ŃŠ°ŠŗŠ°ŃŃŃ instanceof ${e.expected}, аŃŃŃŠ¼Š°Š½Š° ${i}`:`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ²Š¾Š“: ŃŠ°ŠŗŠ°ŃŃŃ ${t}, аŃŃŃŠ¼Š°Š½Š° ${i}`}case"invalid_value":return 1===e.values.length?`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ²Š¾Š“: ŃŠ°ŠŗŠ°Š»Š°ŃŃ ${Ya(e.values[0])}`:`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ваŃŃŃŠ½Ń: ŃŠ°ŠŗŠ°ŃŃŃ Š°Š“Š·ŃŠ½ Š· ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);if(n){let t=Tl(Number(e.maximum),n.unit.one,n.unit.few,n.unit.many);return`ŠŠ°Š½Š°Š“ŃŠ° Š²ŃŠ»ŃŠŗŃ: ŃŠ°ŠŗŠ°Š»Š°ŃŃ, ŃŃŠ¾ ${e.origin??"знаŃŃŠ½Š½Šµ"} ŠæŠ°Š²ŃŠ½Š½Š° ${n.verb} ${r}${e.maximum.toString()} ${t}`}return`ŠŠ°Š½Š°Š“ŃŠ° Š²ŃŠ»ŃŠŗŃ: ŃŠ°ŠŗŠ°Š»Š°ŃŃ, ŃŃŠ¾ ${e.origin??"знаŃŃŠ½Š½Šµ"} ŠæŠ°Š²ŃŠ½Š½Š° бŃŃŃ ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);if(n){let t=Tl(Number(e.minimum),n.unit.one,n.unit.few,n.unit.many);return`ŠŠ°Š½Š°Š“ŃŠ° малŃ: ŃŠ°ŠŗŠ°Š»Š°ŃŃ, ŃŃŠ¾ ${e.origin} ŠæŠ°Š²ŃŠ½Š½Š° ${n.verb} ${r}${e.minimum.toString()} ${t}`}return`ŠŠ°Š½Š°Š“ŃŠ° малŃ: ŃŠ°ŠŗŠ°Š»Š°ŃŃ, ŃŃŠ¾ ${e.origin} ŠæŠ°Š²ŃŠ½Š½Š° бŃŃŃ ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ°Š“ок: ŠæŠ°Š²ŃŠ½ŠµŠ½ паŃŃŠ½Š°ŃŃŠ° Š· "${t.prefix}"`:"ends_with"===t.format?`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ°Š“ок: ŠæŠ°Š²ŃŠ½ŠµŠ½ Š·Š°ŠŗŠ°Š½ŃŠ²Š°ŃŃŠ° на "${t.suffix}"`:"includes"===t.format?`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ°Š“ок: ŠæŠ°Š²ŃŠ½ŠµŠ½ змŃŃŃŠ°ŃŃ "${t.includes}"`:"regex"===t.format?`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ°Š“ок: ŠæŠ°Š²ŃŠ½ŠµŠ½ Š°Š“ŠæŠ°Š²ŃŠ“аŃŃ ŃŠ°Š±Š»Š¾Š½Ń ${t.pattern}`:`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ${r[t.format]??e.format}`}case"not_multiple_of":return`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń Š»ŃŠŗ: ŠæŠ°Š²ŃŠ½ŠµŠ½ бŃŃŃ ŠŗŃŠ°ŃŠ½ŃŠ¼ ${e.divisor}`;case"unrecognized_keys":return`ŠŠµŃŠ°ŃŠæŠ°Š·Š½Š°Š½Ń ${e.keys.length>1?"ŠŗŠ»ŃŃŃ":"ŠŗŠ»ŃŃ"}: ${wa(e.keys,", ")}`;case"invalid_key":return`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŠŗŠ»ŃŃ Ń ${e.origin}`;case"invalid_union":default:return"ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Ń ŃŠ²Š¾Š“";case"invalid_element":return`ŠŃŠæŃŠ°Š²ŃŠ»ŃŠ½Š°Šµ знаŃŃŠ½Š½Šµ Ń ${e.origin}`}}};function Cl(){return{localeError:Al()}}var jl=()=>{let e={string:{unit:"ŃŠøŠ¼Š²Š¾Š»Š°",verb:"Га ŃŃŠ“ŃŃŠ¶Š°"},file:{unit:"Š±Š°Š¹ŃŠ°",verb:"Га ŃŃŠ“ŃŃŠ¶Š°"},array:{unit:"ŠµŠ»ŠµŠ¼ŠµŠ½ŃŠ°",verb:"Га ŃŃŠ“ŃŃŠ¶Š°"},set:{unit:"ŠµŠ»ŠµŠ¼ŠµŠ½ŃŠ°",verb:"Га ŃŃŠ“ŃŃŠ¶Š°"}};function t(t){return e[t]??null}let r={regex:"вŃ
оГ",email:"имейл Š°Š“ŃŠµŃ",url:"URL",emoji:"емоГжи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO Š²ŃŠµŠ¼Šµ",date:"ISO Š“Š°ŃŠ°",time:"ISO Š²ŃŠµŠ¼Šµ",duration:"ISO ŠæŃŠ¾Š“ŃŠ»Š¶ŠøŃелноŃŃ",ipv4:"IPv4 Š°Š“ŃŠµŃ",ipv6:"IPv6 Š°Š“ŃŠµŃ",cidrv4:"IPv4 Гиапазон",cidrv6:"IPv6 Гиапазон",base64:"base64-ŠŗŠ¾Š“ŠøŃŠ°Š½ низ",base64url:"base64url-ŠŗŠ¾Š“ŠøŃŠ°Š½ низ",json_string:"JSON низ",e164:"E.164 номеŃ",jwt:"JWT",template_literal:"вŃ
оГ"},n={nan:"NaN",number:"ŃŠøŃло",array:"Š¼Š°ŃŠøŠ²"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŠŠµŠ²Š°Š»ŠøŠ“ен вŃ
оГ: Š¾ŃŠ°ŠŗŠ²Š°Š½ instanceof ${e.expected}, полŃŃŠµŠ½ ${i}`:`ŠŠµŠ²Š°Š»ŠøŠ“ен вŃ
оГ: Š¾ŃŠ°ŠŗŠ²Š°Š½ ${t}, полŃŃŠµŠ½ ${i}`}case"invalid_value":return 1===e.values.length?`ŠŠµŠ²Š°Š»ŠøŠ“ен вŃ
оГ: Š¾ŃŠ°ŠŗŠ²Š°Š½ ${Ya(e.values[0])}`:`ŠŠµŠ²Š°Š»ŠøŠ“на Š¾ŠæŃŠøŃ: Š¾ŃŠ°ŠŗŠ²Š°Š½Š¾ еГно Š¾Ń ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ТвŃŃŠ“е Š³Š¾Š»Ńмо: Š¾ŃŠ°ŠŗŠ²Š° ŃŠµ ${e.origin??"ŃŃŠ¾Š¹Š½Š¾ŃŃ"} Га ŃŃŠ“ŃŃŠ¶Š° ${r}${e.maximum.toString()} ${n.unit??"ŠµŠ»ŠµŠ¼ŠµŠ½ŃŠ°"}`:`ТвŃŃŠ“е Š³Š¾Š»Ńмо: Š¾ŃŠ°ŠŗŠ²Š° ŃŠµ ${e.origin??"ŃŃŠ¾Š¹Š½Š¾ŃŃ"} Га Š±ŃŠ“е ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ТвŃŃŠ“е малко: Š¾ŃŠ°ŠŗŠ²Š° ŃŠµ ${e.origin} Га ŃŃŠ“ŃŃŠ¶Š° ${r}${e.minimum.toString()} ${n.unit}`:`ТвŃŃŠ“е малко: Š¾ŃŠ°ŠŗŠ²Š° ŃŠµ ${e.origin} Га Š±ŃŠ“е ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;if("starts_with"===t.format)return`ŠŠµŠ²Š°Š»ŠøŠ“ен низ: ŃŃŃŠ±Š²Š° Га Š·Š°ŠæŠ¾Ńва Ń "${t.prefix}"`;if("ends_with"===t.format)return`ŠŠµŠ²Š°Š»ŠøŠ“ен низ: ŃŃŃŠ±Š²Š° Га завŃŃŃŠ²Š° Ń "${t.suffix}"`;if("includes"===t.format)return`ŠŠµŠ²Š°Š»ŠøŠ“ен низ: ŃŃŃŠ±Š²Š° Га вклŃŃŠ²Š° "${t.includes}"`;if("regex"===t.format)return`ŠŠµŠ²Š°Š»ŠøŠ“ен низ: ŃŃŃŠ±Š²Š° Га ŃŃŠ²ŠæŠ°Š“а Ń ${t.pattern}`;let n="ŠŠµŠ²Š°Š»ŠøŠ“ен";return"emoji"===t.format&&(n="ŠŠµŠ²Š°Š»ŠøŠ“но"),"datetime"===t.format&&(n="ŠŠµŠ²Š°Š»ŠøŠ“но"),"date"===t.format&&(n="ŠŠµŠ²Š°Š»ŠøŠ“на"),"time"===t.format&&(n="ŠŠµŠ²Š°Š»ŠøŠ“но"),"duration"===t.format&&(n="ŠŠµŠ²Š°Š»ŠøŠ“на"),`${n} ${r[t.format]??e.format}`}case"not_multiple_of":return`ŠŠµŠ²Š°Š»ŠøŠ“но ŃŠøŃло: ŃŃŃŠ±Š²Š° Га Š±ŃŠ“е ŠŗŃаŃно на ${e.divisor}`;case"unrecognized_keys":return`ŠŠµŃазпознаŃ${e.keys.length>1?"Šø":""} ŠŗŠ»ŃŃ${e.keys.length>1?"ове":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`ŠŠµŠ²Š°Š»ŠøŠ“ен ŠŗŠ»ŃŃ Š² ${e.origin}`;case"invalid_union":default:return"ŠŠµŠ²Š°Š»ŠøŠ“ен вŃ
оГ";case"invalid_element":return`ŠŠµŠ²Š°Š»ŠøŠ“на ŃŃŠ¾Š¹Š½Š¾ŃŃ Š² ${e.origin}`}}};function Dl(){return{localeError:jl()}}var zl=()=>{let e={string:{unit:"carĆ cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(t){return e[t]??null}let r={regex:"entrada",email:"adreƧa electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreƧa IPv4",ipv6:"adreƧa IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"nĆŗmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Tipus invĆ lid: s'esperava instanceof ${e.expected}, s'ha rebut ${i}`:`Tipus invĆ lid: s'esperava ${t}, s'ha rebut ${i}`}case"invalid_value":return 1===e.values.length?`Valor invĆ lid: s'esperava ${Ya(e.values[0])}`:`Opció invĆ lida: s'esperava una de ${wa(e.values," o ")}`;case"too_big":{let r=e.inclusive?"com a mĆ xim":"menys de",n=t(e.origin);return n?`Massa gran: s'esperava que ${e.origin??"el valor"} continguĆ©s ${r} ${e.maximum.toString()} ${n.unit??"elements"}`:`Massa gran: s'esperava que ${e.origin??"el valor"} fos ${r} ${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?"com a mĆnim":"mĆ©s de",n=t(e.origin);return n?`Massa petit: s'esperava que ${e.origin} continguĆ©s ${r} ${e.minimum.toString()} ${n.unit}`:`Massa petit: s'esperava que ${e.origin} fos ${r} ${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Format invĆ lid: ha de comenƧar amb "${t.prefix}"`:"ends_with"===t.format?`Format invĆ lid: ha d'acabar amb "${t.suffix}"`:"includes"===t.format?`Format invĆ lid: ha d'incloure "${t.includes}"`:"regex"===t.format?`Format invĆ lid: ha de coincidir amb el patró ${t.pattern}`:`Format invĆ lid per a ${r[t.format]??e.format}`}case"not_multiple_of":return`NĆŗmero invĆ lid: ha de ser mĆŗltiple de ${e.divisor}`;case"unrecognized_keys":return`Clau${e.keys.length>1?"s":""} no reconeguda${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`Clau invĆ lida a ${e.origin}`;case"invalid_union":default:return"Entrada invĆ lida";case"invalid_element":return`Element invĆ lid a ${e.origin}`}}};function Nl(){return{localeError:zl()}}var Rl=()=>{let e={string:{unit:"znakÅÆ",verb:"mĆt"},file:{unit:"bajtÅÆ",verb:"mĆt"},array:{unit:"prvkÅÆ",verb:"mĆt"},set:{unit:"prvkÅÆ",verb:"mĆt"}};function t(t){return e[t]??null}let r={regex:"regulĆ”rnĆ výraz",email:"e-mailovĆ” adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a Äas ve formĆ”tu ISO",date:"datum ve formĆ”tu ISO",time:"Äas ve formĆ”tu ISO",duration:"doba trvĆ”nĆ ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"ÅetÄzec zakódovaný ve formĆ”tu base64",base64url:"ÅetÄzec zakódovaný ve formĆ”tu base64url",json_string:"ÅetÄzec ve formĆ”tu JSON",e164:"ÄĆslo E.164",jwt:"JWT",template_literal:"vstup"},n={nan:"NaN",number:"ÄĆslo",string:"ÅetÄzec",function:"funkce",array:"pole"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Neplatný vstup: oÄekĆ”vĆ”no instanceof ${e.expected}, obdrženo ${i}`:`Neplatný vstup: oÄekĆ”vĆ”no ${t}, obdrženo ${i}`}case"invalid_value":return 1===e.values.length?`Neplatný vstup: oÄekĆ”vĆ”no ${Ya(e.values[0])}`:`NeplatnĆ” možnost: oÄekĆ”vĆ”na jedna z hodnot ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Hodnota je pÅĆliÅ” velkĆ”: ${e.origin??"hodnota"} musĆ mĆt ${r}${e.maximum.toString()} ${n.unit??"prvkÅÆ"}`:`Hodnota je pÅĆliÅ” velkĆ”: ${e.origin??"hodnota"} musĆ být ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Hodnota je pÅĆliÅ” malĆ”: ${e.origin??"hodnota"} musĆ mĆt ${r}${e.minimum.toString()} ${n.unit??"prvkÅÆ"}`:`Hodnota je pÅĆliÅ” malĆ”: ${e.origin??"hodnota"} musĆ být ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Neplatný ÅetÄzec: musĆ zaÄĆnat na "${t.prefix}"`:"ends_with"===t.format?`Neplatný ÅetÄzec: musĆ konÄit na "${t.suffix}"`:"includes"===t.format?`Neplatný ÅetÄzec: musĆ obsahovat "${t.includes}"`:"regex"===t.format?`Neplatný ÅetÄzec: musĆ odpovĆdat vzoru ${t.pattern}`:`Neplatný formĆ”t ${r[t.format]??e.format}`}case"not_multiple_of":return`NeplatnĆ© ÄĆslo: musĆ být nĆ”sobkem ${e.divisor}`;case"unrecognized_keys":return`NeznĆ”mĆ© klĆÄe: ${wa(e.keys,", ")}`;case"invalid_key":return`Neplatný klĆÄ v ${e.origin}`;case"invalid_union":default:return"Neplatný vstup";case"invalid_element":return`NeplatnĆ” hodnota v ${e.origin}`}}};function Ul(){return{localeError:Rl()}}var Ml=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(t){return e[t]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslƦt",date:"ISO-dato",time:"ISO-klokkeslƦt",duration:"ISO-varighed",ipv4:"IPv4-omrĆ„de",ipv6:"IPv6-omrĆ„de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sƦt",file:"fil"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Ugyldigt input: forventede instanceof ${e.expected}, fik ${i}`:`Ugyldigt input: forventede ${t}, fik ${i}`}case"invalid_value":return 1===e.values.length?`Ugyldig vƦrdi: forventede ${Ya(e.values[0])}`:`Ugyldigt valg: forventede en af fĆølgende ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",i=t(e.origin),o=n[e.origin]??e.origin;return i?`For stor: forventede ${o??"value"} ${i.verb} ${r} ${e.maximum.toString()} ${i.unit??"elementer"}`:`For stor: forventede ${o??"value"} havde ${r} ${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",i=t(e.origin),o=n[e.origin]??e.origin;return i?`For lille: forventede ${o} ${i.verb} ${r} ${e.minimum.toString()} ${i.unit}`:`For lille: forventede ${o} havde ${r} ${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Ugyldig streng: skal starte med "${t.prefix}"`:"ends_with"===t.format?`Ugyldig streng: skal ende med "${t.suffix}"`:"includes"===t.format?`Ugyldig streng: skal indeholde "${t.includes}"`:"regex"===t.format?`Ugyldig streng: skal matche mĆønsteret ${t.pattern}`:`Ugyldig ${r[t.format]??e.format}`}case"not_multiple_of":return`Ugyldigt tal: skal vƦre deleligt med ${e.divisor}`;case"unrecognized_keys":return`${e.keys.length>1?"Ukendte nĆøgler":"Ukendt nĆøgle"}: ${wa(e.keys,", ")}`;case"invalid_key":return`Ugyldig nĆøgle i ${e.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig vƦrdi i ${e.origin}`;default:return"Ugyldigt input"}}};function Kl(){return{localeError:Ml()}}var Zl=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(t){return e[t]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},n={nan:"NaN",number:"Zahl",array:"Array"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Ungültige Eingabe: erwartet instanceof ${e.expected}, erhalten ${i}`:`Ungültige Eingabe: erwartet ${t}, erhalten ${i}`}case"invalid_value":return 1===e.values.length?`Ungültige Eingabe: erwartet ${Ya(e.values[0])}`:`Ungültige Option: erwartet eine von ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Zu groĆ: erwartet, dass ${e.origin??"Wert"} ${r}${e.maximum.toString()} ${n.unit??"Elemente"} hat`:`Zu groĆ: erwartet, dass ${e.origin??"Wert"} ${r}${e.maximum.toString()} ist`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Zu klein: erwartet, dass ${e.origin} ${r}${e.minimum.toString()} ${n.unit} hat`:`Zu klein: erwartet, dass ${e.origin} ${r}${e.minimum.toString()} ist`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Ungültiger String: muss mit "${t.prefix}" beginnen`:"ends_with"===t.format?`Ungültiger String: muss mit "${t.suffix}" enden`:"includes"===t.format?`Ungültiger String: muss "${t.includes}" enthalten`:"regex"===t.format?`Ungültiger String: muss dem Muster ${t.pattern} entsprechen`:`Ungültig: ${r[t.format]??e.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${e.divisor} sein`;case"unrecognized_keys":return`${e.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${wa(e.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${e.origin}`;case"invalid_union":default:return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${e.origin}`}}};function Jl(){return{localeError:Zl()}}var Ll=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input);return`Invalid input: expected ${t}, received ${n[r]??r}`}case"invalid_value":return 1===e.values.length?`Invalid input: expected ${Ya(e.values[0])}`:`Invalid option: expected one of ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Too big: expected ${e.origin??"value"} to have ${r}${e.maximum.toString()} ${n.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Too small: expected ${e.origin} to have ${r}${e.minimum.toString()} ${n.unit}`:`Too small: expected ${e.origin} to be ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}}};function Wl(){return{localeError:Ll()}}var Fl=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(t){return e[t]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoÄio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daÅro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},n={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Nevalida enigo: atendiÄis instanceof ${e.expected}, riceviÄis ${i}`:`Nevalida enigo: atendiÄis ${t}, riceviÄis ${i}`}case"invalid_value":return 1===e.values.length?`Nevalida enigo: atendiÄis ${Ya(e.values[0])}`:`Nevalida opcio: atendiÄis unu el ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Tro granda: atendiÄis ke ${e.origin??"valoro"} havu ${r}${e.maximum.toString()} ${n.unit??"elementojn"}`:`Tro granda: atendiÄis ke ${e.origin??"valoro"} havu ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Tro malgranda: atendiÄis ke ${e.origin} havu ${r}${e.minimum.toString()} ${n.unit}`:`Tro malgranda: atendiÄis ke ${e.origin} estu ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Nevalida karaktraro: devas komenciÄi per "${t.prefix}"`:"ends_with"===t.format?`Nevalida karaktraro: devas finiÄi per "${t.suffix}"`:"includes"===t.format?`Nevalida karaktraro: devas inkluzivi "${t.includes}"`:"regex"===t.format?`Nevalida karaktraro: devas kongrui kun la modelo ${t.pattern}`:`Nevalida ${r[t.format]??e.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${e.divisor}`;case"unrecognized_keys":return`Nekonata${e.keys.length>1?"j":""} Ålosilo${e.keys.length>1?"j":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`Nevalida Ålosilo en ${e.origin}`;case"invalid_union":default:return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${e.origin}`}}};function Vl(){return{localeError:Fl()}}var Hl=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(t){return e[t]??null}let r={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"nĆŗmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",string:"texto",number:"nĆŗmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"nĆŗmero grande",symbol:"sĆmbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacĆo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Entrada invĆ”lida: se esperaba instanceof ${e.expected}, recibido ${i}`:`Entrada invĆ”lida: se esperaba ${t}, recibido ${i}`}case"invalid_value":return 1===e.values.length?`Entrada invĆ”lida: se esperaba ${Ya(e.values[0])}`:`Opción invĆ”lida: se esperaba una de ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",i=t(e.origin),o=n[e.origin]??e.origin;return i?`Demasiado grande: se esperaba que ${o??"valor"} tuviera ${r}${e.maximum.toString()} ${i.unit??"elementos"}`:`Demasiado grande: se esperaba que ${o??"valor"} fuera ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",i=t(e.origin),o=n[e.origin]??e.origin;return i?`Demasiado pequeƱo: se esperaba que ${o} tuviera ${r}${e.minimum.toString()} ${i.unit}`:`Demasiado pequeƱo: se esperaba que ${o} fuera ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Cadena invĆ”lida: debe comenzar con "${t.prefix}"`:"ends_with"===t.format?`Cadena invĆ”lida: debe terminar en "${t.suffix}"`:"includes"===t.format?`Cadena invĆ”lida: debe incluir "${t.includes}"`:"regex"===t.format?`Cadena invĆ”lida: debe coincidir con el patrón ${t.pattern}`:`InvĆ”lido ${r[t.format]??e.format}`}case"not_multiple_of":return`NĆŗmero invĆ”lido: debe ser mĆŗltiplo de ${e.divisor}`;case"unrecognized_keys":return`Llave${e.keys.length>1?"s":""} desconocida${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`Llave invĆ”lida en ${n[e.origin]??e.origin}`;case"invalid_union":default:return"Entrada invĆ”lida";case"invalid_element":return`Valor invĆ”lido en ${n[e.origin]??e.origin}`}}};function ql(){return{localeError:Hl()}}var Bl=()=>{let e={string:{unit:"کاراکتر",verb:"ŲÆŲ§Ų“ŲŖŁ ŲØŲ§Ų“ŲÆ"},file:{unit:"ŲØŲ§ŪŲŖ",verb:"ŲÆŲ§Ų“ŲŖŁ ŲØŲ§Ų“ŲÆ"},array:{unit:"Ų¢ŪŲŖŁ
",verb:"ŲÆŲ§Ų“ŲŖŁ ŲØŲ§Ų“ŲÆ"},set:{unit:"Ų¢ŪŲŖŁ
",verb:"ŲÆŲ§Ų“ŲŖŁ ŲØŲ§Ų“ŲÆ"}};function t(t){return e[t]??null}let r={regex:"ŁŲ±ŁŲÆŪ",email:"Ų¢ŲÆŲ±Ų³ Ų§ŪŁ
ŪŁ",url:"URL",emoji:"Ų§ŪŁ
ŁŲ¬Ū",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ŲŖŲ§Ų±ŪŲ® Ł Ų²Ł
Ų§Ł Ų§ŪŲ²Ł",date:"ŲŖŲ§Ų±ŪŲ® Ų§ŪŲ²Ł",time:"Ų²Ł
Ų§Ł Ų§ŪŲ²Ł",duration:"Ł
ŲÆŲŖ Ų²Ł
Ų§Ł Ų§ŪŲ²Ł",ipv4:"IPv4 Ų¢ŲÆŲ±Ų³",ipv6:"IPv6 Ų¢ŲÆŲ±Ų³",cidrv4:"IPv4 ŲÆŲ§Ł
ŁŁ",cidrv6:"IPv6 ŲÆŲ§Ł
ŁŁ",base64:"base64-encoded Ų±Ų“ŲŖŁ",base64url:"base64url-encoded Ų±Ų“ŲŖŁ",json_string:"JSON Ų±Ų“ŲŖŁ",e164:"E.164 Ų¹ŲÆŲÆ",jwt:"JWT",template_literal:"ŁŲ±ŁŲÆŪ"},n={nan:"NaN",number:"Ų¹ŲÆŲÆ",array:"Ų¢Ų±Ų§ŪŁ"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŁŲ±ŁŲÆŪ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: Ł
ŪāŲØŲ§ŪŲ³ŲŖ instanceof ${e.expected} Ł
ŪāŲØŁŲÆŲ ${i} ŲÆŲ±ŪŲ§ŁŲŖ Ų“ŲÆ`:`ŁŲ±ŁŲÆŪ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: Ł
ŪāŲØŲ§ŪŲ³ŲŖ ${t} Ł
ŪāŲØŁŲÆŲ ${i} ŲÆŲ±ŪŲ§ŁŲŖ Ų“ŲÆ`}case"invalid_value":return 1===e.values.length?`ŁŲ±ŁŲÆŪ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: Ł
ŪāŲØŲ§ŪŲ³ŲŖ ${Ya(e.values[0])} Ł
ŪāŲØŁŲÆ`:`ŚÆŲ²ŪŁŁ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: Ł
ŪāŲØŲ§ŪŲ³ŲŖ ŪŚ©Ū Ų§Ų² ${wa(e.values,"|")} Ł
ŪāŲØŁŲÆ`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Ų®ŪŁŪ ŲØŲ²Ų±ŚÆ: ${e.origin??"Ł
ŁŲÆŲ§Ų±"} ŲØŲ§ŪŲÆ ${r}${e.maximum.toString()} ${n.unit??"Ų¹ŁŲµŲ±"} ŲØŲ§Ų“ŲÆ`:`Ų®ŪŁŪ ŲØŲ²Ų±ŚÆ: ${e.origin??"Ł
ŁŲÆŲ§Ų±"} ŲØŲ§ŪŲÆ ${r}${e.maximum.toString()} ŲØŲ§Ų“ŲÆ`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Ų®ŪŁŪ Ś©ŁŚŚ©: ${e.origin} ŲØŲ§ŪŲÆ ${r}${e.minimum.toString()} ${n.unit} ŲØŲ§Ų“ŲÆ`:`Ų®ŪŁŪ Ś©ŁŚŚ©: ${e.origin} ŲØŲ§ŪŲÆ ${r}${e.minimum.toString()} ŲØŲ§Ų“ŲÆ`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Ų±Ų“ŲŖŁ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: ŲØŲ§ŪŲÆ ŲØŲ§ "${t.prefix}" Ų“Ų±ŁŲ¹ Ų“ŁŲÆ`:"ends_with"===t.format?`Ų±Ų“ŲŖŁ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: ŲØŲ§ŪŲÆ ŲØŲ§ "${t.suffix}" ŲŖŁ
Ų§Ł
Ų“ŁŲÆ`:"includes"===t.format?`Ų±Ų“ŲŖŁ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: ŲØŲ§ŪŲÆ Ų“Ų§Ł
Ł "${t.includes}" ŲØŲ§Ų“ŲÆ`:"regex"===t.format?`Ų±Ų“ŲŖŁ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: ŲØŲ§ŪŲÆ ŲØŲ§ Ų§ŁŚÆŁŪ ${t.pattern} Ł
Ų·Ų§ŲØŁŲŖ ŲÆŲ§Ų“ŲŖŁ ŲØŲ§Ų“ŲÆ`:`${r[t.format]??e.format} ŁŲ§Ł
Ų¹ŲŖŲØŲ±`}case"not_multiple_of":return`Ų¹ŲÆŲÆ ŁŲ§Ł
Ų¹ŲŖŲØŲ±: ŲØŲ§ŪŲÆ Ł
Ų¶Ų±ŲØ ${e.divisor} ŲØŲ§Ų“ŲÆ`;case"unrecognized_keys":return`Ś©ŁŪŲÆ${e.keys.length>1?"ŁŲ§Ū":""} ŁŲ§Ų“ŁŲ§Ų³: ${wa(e.keys,", ")}`;case"invalid_key":return`Ś©ŁŪŲÆ ŁŲ§Ų“ŁŲ§Ų³ ŲÆŲ± ${e.origin}`;case"invalid_union":default:return"ŁŲ±ŁŲÆŪ ŁŲ§Ł
Ų¹ŲŖŲØŲ±";case"invalid_element":return`Ł
ŁŲÆŲ§Ų± ŁŲ§Ł
Ų¹ŲŖŲØŲ± ŲÆŲ± ${e.origin}`}}};function Gl(){return{localeError:Bl()}}var Yl=()=>{let e={string:{unit:"merkkiƤ",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"pƤivƤmƤƤrƤn"}};function t(t){return e[t]??null}let r={regex:"sƤƤnnƶllinen lauseke",email:"sƤhkƶpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-pƤivƤmƤƤrƤ",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Virheellinen tyyppi: odotettiin instanceof ${e.expected}, oli ${i}`:`Virheellinen tyyppi: odotettiin ${t}, oli ${i}`}case"invalid_value":return 1===e.values.length?`Virheellinen syƶte: tƤytyy olla ${Ya(e.values[0])}`:`Virheellinen valinta: tƤytyy olla yksi seuraavista: ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Liian suuri: ${n.subject} tƤytyy olla ${r}${e.maximum.toString()} ${n.unit}`.trim():`Liian suuri: arvon tƤytyy olla ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Liian pieni: ${n.subject} tƤytyy olla ${r}${e.minimum.toString()} ${n.unit}`.trim():`Liian pieni: arvon tƤytyy olla ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Virheellinen syƶte: tƤytyy alkaa "${t.prefix}"`:"ends_with"===t.format?`Virheellinen syƶte: tƤytyy loppua "${t.suffix}"`:"includes"===t.format?`Virheellinen syƶte: tƤytyy sisƤltƤƤ "${t.includes}"`:"regex"===t.format?`Virheellinen syƶte: tƤytyy vastata sƤƤnnƶllistƤ lauseketta ${t.pattern}`:`Virheellinen ${r[t.format]??e.format}`}case"not_multiple_of":return`Virheellinen luku: tƤytyy olla luvun ${e.divisor} monikerta`;case"unrecognized_keys":return`${e.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${wa(e.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syƶte"}}};function Xl(){return{localeError:Yl()}}var Ql=()=>{let e={string:{unit:"caractĆØres",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"Ć©lĆ©ments",verb:"avoir"},set:{unit:"Ć©lĆ©ments",verb:"avoir"}};function t(t){return e[t]??null}let r={regex:"entrĆ©e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durĆ©e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaĆ®ne encodĆ©e en base64",base64url:"chaĆ®ne encodĆ©e en base64url",json_string:"chaĆ®ne JSON",e164:"numĆ©ro E.164",jwt:"JWT",template_literal:"entrĆ©e"},n={nan:"NaN",number:"nombre",array:"tableau"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`EntrĆ©e invalide : instanceof ${e.expected} attendu, ${i} reƧu`:`EntrĆ©e invalide : ${t} attendu, ${i} reƧu`}case"invalid_value":return 1===e.values.length?`EntrĆ©e invalide : ${Ya(e.values[0])} attendu`:`Option invalide : une valeur parmi ${wa(e.values,"|")} attendue`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Trop grand : ${e.origin??"valeur"} doit ${n.verb} ${r}${e.maximum.toString()} ${n.unit??"Ć©lĆ©ment(s)"}`:`Trop grand : ${e.origin??"valeur"} doit ĆŖtre ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Trop petit : ${e.origin} doit ${n.verb} ${r}${e.minimum.toString()} ${n.unit}`:`Trop petit : ${e.origin} doit ĆŖtre ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ChaĆ®ne invalide : doit commencer par "${t.prefix}"`:"ends_with"===t.format?`ChaĆ®ne invalide : doit se terminer par "${t.suffix}"`:"includes"===t.format?`ChaĆ®ne invalide : doit inclure "${t.includes}"`:"regex"===t.format?`ChaĆ®ne invalide : doit correspondre au modĆØle ${t.pattern}`:`${r[t.format]??e.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit ĆŖtre un multiple de ${e.divisor}`;case"unrecognized_keys":return`ClĆ©${e.keys.length>1?"s":""} non reconnue${e.keys.length>1?"s":""} : ${wa(e.keys,", ")}`;case"invalid_key":return`ClĆ© invalide dans ${e.origin}`;case"invalid_union":default:return"EntrĆ©e invalide";case"invalid_element":return`Valeur invalide dans ${e.origin}`}}};function ep(){return{localeError:Ql()}}var tp=()=>{let e={string:{unit:"caractĆØres",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"Ć©lĆ©ments",verb:"avoir"},set:{unit:"Ć©lĆ©ments",verb:"avoir"}};function t(t){return e[t]??null}let r={regex:"entrĆ©e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durĆ©e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaĆ®ne encodĆ©e en base64",base64url:"chaĆ®ne encodĆ©e en base64url",json_string:"chaĆ®ne JSON",e164:"numĆ©ro E.164",jwt:"JWT",template_literal:"entrĆ©e"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`EntrĆ©e invalide : attendu instanceof ${e.expected}, reƧu ${i}`:`EntrĆ©e invalide : attendu ${t}, reƧu ${i}`}case"invalid_value":return 1===e.values.length?`EntrĆ©e invalide : attendu ${Ya(e.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"ā¤":"<",n=t(e.origin);return n?`Trop grand : attendu que ${e.origin??"la valeur"} ait ${r}${e.maximum.toString()} ${n.unit}`:`Trop grand : attendu que ${e.origin??"la valeur"} soit ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?"ā„":">",n=t(e.origin);return n?`Trop petit : attendu que ${e.origin} ait ${r}${e.minimum.toString()} ${n.unit}`:`Trop petit : attendu que ${e.origin} soit ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ChaĆ®ne invalide : doit commencer par "${t.prefix}"`:"ends_with"===t.format?`ChaĆ®ne invalide : doit se terminer par "${t.suffix}"`:"includes"===t.format?`ChaĆ®ne invalide : doit inclure "${t.includes}"`:"regex"===t.format?`ChaĆ®ne invalide : doit correspondre au motif ${t.pattern}`:`${r[t.format]??e.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit ĆŖtre un multiple de ${e.divisor}`;case"unrecognized_keys":return`ClĆ©${e.keys.length>1?"s":""} non reconnue${e.keys.length>1?"s":""} : ${wa(e.keys,", ")}`;case"invalid_key":return`ClĆ© invalide dans ${e.origin}`;case"invalid_union":default:return"EntrĆ©e invalide";case"invalid_element":return`Valeur invalide dans ${e.origin}`}}};function rp(){return{localeError:tp()}}var np=()=>{let e={string:{label:"××ר×××Ŗ",gender:"f"},number:{label:"×הפר",gender:"m"},boolean:{label:"×¢×Ø× ×××××× ×",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"×Ŗ×ר××",gender:"m"},array:{label:"×ער×",gender:"m"},object:{label:"××××××§×",gender:"m"},null:{label:"×¢×Ø× ×Ø××§ (null)",gender:"m"},undefined:{label:"×¢×Ø× ×× ××××ר (undefined)",gender:"m"},symbol:{label:"×”××××× (Symbol)",gender:"m"},function:{label:"פ×× ×§×¦××",gender:"f"},map:{label:"××¤× (Map)",gender:"f"},set:{label:"×§×××¦× (Set)",gender:"f"},file:{label:"×§××ׄ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"×¢×Ø× ×× ××××¢",gender:"m"},value:{label:"ער×",gender:"m"}},t={string:{unit:"×Ŗ××××",shortLabel:"קצר",longLabel:"×ר××"},file:{unit:"××××××",shortLabel:"×§××",longLabel:"××××"},array:{unit:"פר××××",shortLabel:"×§××",longLabel:"××××"},set:{unit:"פר××××",shortLabel:"×§××",longLabel:"××××"},number:{unit:"",shortLabel:"×§××",longLabel:"××××"}},r=t=>t?e[t]:void 0,n=t=>{let n=r(t);return n?n.label:t??e.unknown.label},i=e=>`×${n(e)}`,o=e=>"f"===(r(e)?.gender??"m")?"צר××× ×××××Ŗ":"צר×× ×××××Ŗ",a=e=>e?t[e]??null:null,s={regex:{label:"×§××",gender:"m"},email:{label:"××Ŗ×××Ŗ ××××××",gender:"f"},url:{label:"××Ŗ×××Ŗ רשת",gender:"f"},emoji:{label:"×××××'×",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"×Ŗ×ר×× ×××× ISO",gender:"m"},date:{label:"×Ŗ×ר×× ISO",gender:"m"},time:{label:"××× ISO",gender:"m"},duration:{label:"××©× ××× ISO",gender:"m"},ipv4:{label:"××Ŗ×××Ŗ IPv4",gender:"f"},ipv6:{label:"××Ŗ×××Ŗ IPv6",gender:"f"},cidrv4:{label:"×××× IPv4",gender:"m"},cidrv6:{label:"×××× IPv6",gender:"m"},base64:{label:"××ר×××Ŗ ×××”××” 64",gender:"f"},base64url:{label:"××ר×××Ŗ ×××”××” 64 ×××Ŗ××××Ŗ רשת",gender:"f"},json_string:{label:"××ר×××Ŗ JSON",gender:"f"},e164:{label:"×הפר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"×§××",gender:"m"},includes:{label:"×§××",gender:"m"},lowercase:{label:"×§××",gender:"m"},starts_with:{label:"×§××",gender:"m"},uppercase:{label:"×§××",gender:"m"}},c={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=t.expected,i=c[r??""]??n(r),o=hs(t.input),a=c[o]??e[o]?.label??o;return/^[A-Z]/.test(t.expected)?`×§×× ×× ×Ŗ×§××: צר×× ×××××Ŗ instanceof ${t.expected}, ××Ŗ×§×× ${a}`:`×§×× ×× ×Ŗ×§××: צר×× ×××××Ŗ ${i}, ××Ŗ×§×× ${a}`}case"invalid_value":{if(1===t.values.length)return`×¢×Ø× ×× ×Ŗ×§××: ××¢×Ø× ×××× ×××××Ŗ ${Ya(t.values[0])}`;let e=t.values.map(e=>Ya(e));if(2===t.values.length)return`×¢×Ø× ×× ×Ŗ×§××: ××פשר××××Ŗ ×××Ŗ×××××Ŗ ×× ${e[0]} ×× ${e[1]}`;let r=e[e.length-1];return`×¢×Ø× ×× ×Ŗ×§××: ××פשר××××Ŗ ×××Ŗ×××××Ŗ ×× ${e.slice(0,-1).join(", ")} ×× ${r}`}case"too_big":{let e=a(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.longLabel??"×ר××"} ×××: ${r} צר××× ××××× ${t.maximum.toString()} ${e?.unit??""} ${t.inclusive?"×× ×¤×××Ŗ":"××× ×××תר"}`.trim();if("number"===t.origin)return`×××× ×××: ${r} צר×× ×××××Ŗ ${t.inclusive?`×§×× ×× ×©××× ×-${t.maximum}`:`×§×× ×-${t.maximum}`}`;if("array"===t.origin||"set"===t.origin)return`×××× ×××: ${r} ${"set"===t.origin?"צר×××":"צר××"} ××××× ${t.inclusive?`${t.maximum} ${e?.unit??""} ×× ×¤×××Ŗ`:`פ×××Ŗ ×-${t.maximum} ${e?.unit??""}`}`.trim();let n=t.inclusive?"<=":"<",s=o(t.origin??"value");return e?.unit?`${e.longLabel} ×××: ${r} ${s} ${n}${t.maximum.toString()} ${e.unit}`:`${e?.longLabel??"××××"} ×××: ${r} ${s} ${n}${t.maximum.toString()}`}case"too_small":{let e=a(t.origin),r=i(t.origin??"value");if("string"===t.origin)return`${e?.shortLabel??"קצר"} ×××: ${r} צר××× ××××× ${t.minimum.toString()} ${e?.unit??""} ${t.inclusive?"×× ××תר":"×פ×××Ŗ"}`.trim();if("number"===t.origin)return`×§×× ×××: ${r} צר×× ×××××Ŗ ${t.inclusive?`×××× ×× ×©××× ×-${t.minimum}`:`×××× ×-${t.minimum}`}`;if("array"===t.origin||"set"===t.origin){let n="set"===t.origin?"צר×××":"צר××";return 1===t.minimum&&t.inclusive?`×§×× ×××: ${r} ${n} ××××× ${t.origin,"×פ×××Ŗ פר×× ×××"}`:`×§×× ×××: ${r} ${n} ××××× ${t.inclusive?`${t.minimum} ${e?.unit??""} ×× ××תר`:`××תר ×-${t.minimum} ${e?.unit??""}`}`.trim()}let n=t.inclusive?">=":">",s=o(t.origin??"value");return e?.unit?`${e.shortLabel} ×××: ${r} ${s} ${n}${t.minimum.toString()} ${e.unit}`:`${e?.shortLabel??"×§××"} ×××: ${r} ${s} ${n}${t.minimum.toString()}`}case"invalid_format":{let e=t;if("starts_with"===e.format)return`×××ר×××Ŗ ×××××Ŗ ×××Ŗ××× × "${e.prefix}"`;if("ends_with"===e.format)return`×××ר×××Ŗ ×××××Ŗ ×××”×Ŗ××× × "${e.suffix}"`;if("includes"===e.format)return`×××ר×××Ŗ ×××××Ŗ ××××× "${e.includes}"`;if("regex"===e.format)return`×××ר×××Ŗ ×××××Ŗ ×××Ŗ××× ××Ŗ×× ××Ŗ ${e.pattern}`;let r=s[e.format];return`${r?.label??e.format} ×× ${"f"===(r?.gender??"m")?"×Ŗ×§×× ×":"×Ŗ×§××"}`}case"not_multiple_of":return`×הפר ×× ×Ŗ×§××: ×××× ×××××Ŗ ××פ×× ×©× ${t.divisor}`;case"unrecognized_keys":return`×פת×${t.keys.length>1?"××Ŗ":""} ×× ××××${t.keys.length>1?"××":"×"}: ${wa(t.keys,", ")}`;case"invalid_key":return"ש×× ×× ×Ŗ×§×× ×××××××§×";case"invalid_union":default:return"×§×× ×× ×Ŗ×§××";case"invalid_element":return`×¢×Ø× ×× ×Ŗ×§×× ×${i(t.origin??"array")}`}}};function ip(){return{localeError:np()}}var op=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(t){return e[t]??null}let r={regex:"bemenet",email:"email cĆm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO idÅbĆ©lyeg",date:"ISO dĆ”tum",time:"ISO idÅ",duration:"ISO idÅintervallum",ipv4:"IPv4 cĆm",ipv6:"IPv6 cĆm",cidrv4:"IPv4 tartomĆ”ny",cidrv6:"IPv6 tartomĆ”ny",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szĆ”m",jwt:"JWT",template_literal:"bemenet"},n={nan:"NaN",number:"szĆ”m",array:"tƶmb"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ĆrvĆ©nytelen bemenet: a vĆ”rt Ć©rtĆ©k instanceof ${e.expected}, a kapott Ć©rtĆ©k ${i}`:`ĆrvĆ©nytelen bemenet: a vĆ”rt Ć©rtĆ©k ${t}, a kapott Ć©rtĆ©k ${i}`}case"invalid_value":return 1===e.values.length?`ĆrvĆ©nytelen bemenet: a vĆ”rt Ć©rtĆ©k ${Ya(e.values[0])}`:`ĆrvĆ©nytelen opció: valamelyik Ć©rtĆ©k vĆ”rt ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`TĆŗl nagy: ${e.origin??"Ć©rtĆ©k"} mĆ©rete tĆŗl nagy ${r}${e.maximum.toString()} ${n.unit??"elem"}`:`TĆŗl nagy: a bemeneti Ć©rtĆ©k ${e.origin??"Ć©rtĆ©k"} tĆŗl nagy: ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`TĆŗl kicsi: a bemeneti Ć©rtĆ©k ${e.origin} mĆ©rete tĆŗl kicsi ${r}${e.minimum.toString()} ${n.unit}`:`TĆŗl kicsi: a bemeneti Ć©rtĆ©k ${e.origin} tĆŗl kicsi ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ĆrvĆ©nytelen string: "${t.prefix}" Ć©rtĆ©kkel kell kezdÅdnie`:"ends_with"===t.format?`ĆrvĆ©nytelen string: "${t.suffix}" Ć©rtĆ©kkel kell vĆ©gzÅdnie`:"includes"===t.format?`ĆrvĆ©nytelen string: "${t.includes}" Ć©rtĆ©ket kell tartalmaznia`:"regex"===t.format?`ĆrvĆ©nytelen string: ${t.pattern} mintĆ”nak kell megfelelnie`:`ĆrvĆ©nytelen ${r[t.format]??e.format}`}case"not_multiple_of":return`ĆrvĆ©nytelen szĆ”m: ${e.divisor} tƶbbszƶrƶsĆ©nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`ĆrvĆ©nytelen kulcs ${e.origin}`;case"invalid_union":default:return"ĆrvĆ©nytelen bemenet";case"invalid_element":return`ĆrvĆ©nytelen Ć©rtĆ©k: ${e.origin}`}}};function ap(){return{localeError:op()}}function sp(e,t,r){return 1===Math.abs(e)?t:r}function cp(e){if(!e)return"";let t=e[e.length-1];return e+(["Õ”","Õ„","ÕØ","Õ«","Õø","ÕøÖ","Ö
"].includes(t)?"Õ¶":"ÕØ")}var up=()=>{let e={string:{unit:{one:"Õ¶Õ·Õ”Õ¶",many:"Õ¶Õ·Õ”Õ¶Õ¶Õ„Ö"},verb:"ÕøÖÕ¶Õ„Õ¶Õ”Õ¬"},file:{unit:{one:"Õ¢Õ”ÕµÕ©",many:"Õ¢Õ”ÕµÕ©Õ„Ö"},verb:"ÕøÖÕ¶Õ„Õ¶Õ”Õ¬"},array:{unit:{one:"ÕæÕ”ÖÖ",many:"ÕæÕ”ÖÖÕ„Ö"},verb:"ÕøÖÕ¶Õ„Õ¶Õ”Õ¬"},set:{unit:{one:"ÕæÕ”ÖÖ",many:"ÕæÕ”ÖÖÕ„Ö"},verb:"ÕøÖÕ¶Õ„Õ¶Õ”Õ¬"}};function t(t){return e[t]??null}let r={regex:"Õ“ÕøÖÕæÖ",email:"Õ§Õ¬. Õ°Õ”Õ½ÖÕ„",url:"URL",emoji:"Õ§Õ“ÕøÕ»Õ«",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO Õ”Õ“Õ½Õ”Õ©Õ«Õ¾ Ö ÕŖÕ”Õ“",date:"ISO Õ”Õ“Õ½Õ”Õ©Õ«Õ¾",time:"ISO ÕŖÕ”Õ“",duration:"ISO ÕæÖÕøÕ²ÕøÖÕ©ÕµÕøÖÕ¶",ipv4:"IPv4 Õ°Õ”Õ½ÖÕ„",ipv6:"IPv6 Õ°Õ”Õ½ÖÕ„",cidrv4:"IPv4 Õ“Õ«Õ»Õ”ÕÆÕ”ÕµÖ",cidrv6:"IPv6 Õ“Õ«Õ»Õ”ÕÆÕ”ÕµÖ",base64:"base64 Õ±ÖÕ”Õ¹Õ”ÖÕøÕ¾ ÕæÕøÕ²",base64url:"base64url Õ±ÖÕ”Õ¹Õ”ÖÕøÕ¾ ÕæÕøÕ²",json_string:"JSON ÕæÕøÕ²",e164:"E.164 Õ°Õ”Õ“Õ”Ö",jwt:"JWT",template_literal:"Õ“ÕøÖÕæÖ"},n={nan:"NaN",number:"Õ©Õ«Õ¾",array:"Õ¦Õ”Õ¶Õ£Õ¾Õ”Õ®"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ÕÕÕ”Õ¬ Õ“ÕøÖÕæÖÕ”Õ£ÖÕøÖՓ⤠սպՔսվոÖÕ“ Õ§Ö instanceof ${e.expected}, Õ½ÕæÕ”ÖÕ¾Õ„Õ¬ Õ§ ${i}`:`ÕÕÕ”Õ¬ Õ“ÕøÖÕæÖÕ”Õ£ÖÕøÖՓ⤠սպՔսվոÖÕ“ Õ§Ö ${t}, Õ½ÕæÕ”ÖÕ¾Õ„Õ¬ Õ§ ${i}`}case"invalid_value":return 1===e.values.length?`ÕÕÕ”Õ¬ Õ“ÕøÖÕæÖÕ”Õ£ÖÕøÖՓ⤠սպՔսվոÖÕ“ Õ§Ö ${Ya(e.values[1])}`:`ÕÕÕ”Õ¬ ÕæÕ”ÖÕ¢Õ„ÖՔկ⤠սպՔսվոÖÕ“ Õ§Ö Õ°Õ„ÕæÖÕµÕ”Õ¬Õ¶Õ„ÖÕ«Ö Õ“Õ„ÕÆÕØÕ ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);if(n){let t=sp(Number(e.maximum),n.unit.one,n.unit.many);return`ÕÕ”ÖÕ”Õ¦Õ”Õ¶Ö Õ“Õ„Õ® Õ”ÖÕŖÕ„Ö⤠սպՔսվոÖÕ“ Õ§, ÕøÖ ${cp(e.origin??"Õ”ÖÕŖÕ„Ö")} ÕÆÕøÖÕ¶Õ„Õ¶Õ” ${r}${e.maximum.toString()} ${t}`}return`ÕÕ”ÖÕ”Õ¦Õ”Õ¶Ö Õ“Õ„Õ® Õ”ÖÕŖÕ„Ö⤠սպՔսվոÖÕ“ Õ§, ÕøÖ ${cp(e.origin??"Õ”ÖÕŖÕ„Ö")} Õ¬Õ«Õ¶Õ« ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);if(n){let t=sp(Number(e.minimum),n.unit.one,n.unit.many);return`ÕÕ”ÖÕ”Õ¦Õ”Õ¶Ö ÖÕøÖÖ Õ”ÖÕŖÕ„Ö⤠սպՔսվոÖÕ“ Õ§, ÕøÖ ${cp(e.origin)} ÕÆÕøÖÕ¶Õ„Õ¶Õ” ${r}${e.minimum.toString()} ${t}`}return`ÕÕ”ÖÕ”Õ¦Õ”Õ¶Ö ÖÕøÖÖ Õ”ÖÕŖÕ„Ö⤠սպՔսվոÖÕ“ Õ§, ÕøÖ ${cp(e.origin)} Õ¬Õ«Õ¶Õ« ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ÕÕÕ”Õ¬ ÕæÕøÕ²ā¤ ÕŗÕ„ÕæÖ Õ§ Õ½ÕÆÕ½Õ¾Õ« "${t.prefix}"-ÕøÕ¾`:"ends_with"===t.format?`ÕÕÕ”Õ¬ ÕæÕøÕ²ā¤ ÕŗÕ„ÕæÖ Õ§ Õ”Õ¾Õ”ÖÕæÕ¾Õ« "${t.suffix}"-ÕøÕ¾`:"includes"===t.format?`ÕÕÕ”Õ¬ ÕæÕøÕ²ā¤ ÕŗÕ„ÕæÖ Õ§ ÕŗÕ”ÖÕøÖÕ¶Õ”ÕÆÕ« "${t.includes}"`:"regex"===t.format?`ÕÕÕ”Õ¬ ÕæÕøÕ²ā¤ ÕŗÕ„ÕæÖ Õ§ Õ°Õ”Õ“Õ”ÕŗÕ”ÕæÕ”Õ½ÕÕ”Õ¶Õ« ${t.pattern} Õ±ÖÕ”Õ¹Õ”ÖÕ«Õ¶`:`ÕÕÕ”Õ¬ ${r[t.format]??e.format}`}case"not_multiple_of":return`ÕÕÕ”Õ¬ Õ©Õ«Õ¾ā¤ ÕŗÕ„ÕæÖ Õ§ Õ¢Õ”Õ¦Õ“Õ”ÕŗÕ”ÕæÕ«ÕÆ Õ¬Õ«Õ¶Õ« ${e.divisor}-Õ«`;case"unrecognized_keys":return`ÕÕ³Õ”Õ¶Õ”Õ¹Õ¾Õ”Õ® Õ¢Õ”Õ¶Õ”Õ¬Õ«${e.keys.length>1?"Õ¶Õ„Ö":""}. ${wa(e.keys,", ")}`;case"invalid_key":return`ÕÕÕ”Õ¬ Õ¢Õ”Õ¶Õ”Õ¬Õ« ${cp(e.origin)}-ÕøÖÕ“`;case"invalid_union":default:return"ÕÕÕ”Õ¬ Õ“ÕøÖÕæÖÕ”Õ£ÖÕøÖÕ“";case"invalid_element":return`ÕÕÕ”Õ¬ Õ”ÖÕŖÕ„Ö ${cp(e.origin)}-ÕøÖÕ“`}}};function dp(){return{localeError:up()}}var lp=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(t){return e[t]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Input tidak valid: diharapkan instanceof ${e.expected}, diterima ${i}`:`Input tidak valid: diharapkan ${t}, diterima ${i}`}case"invalid_value":return 1===e.values.length?`Input tidak valid: diharapkan ${Ya(e.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Terlalu besar: diharapkan ${e.origin??"value"} memiliki ${r}${e.maximum.toString()} ${n.unit??"elemen"}`:`Terlalu besar: diharapkan ${e.origin??"value"} menjadi ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Terlalu kecil: diharapkan ${e.origin} memiliki ${r}${e.minimum.toString()} ${n.unit}`:`Terlalu kecil: diharapkan ${e.origin} menjadi ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`String tidak valid: harus dimulai dengan "${t.prefix}"`:"ends_with"===t.format?`String tidak valid: harus berakhir dengan "${t.suffix}"`:"includes"===t.format?`String tidak valid: harus menyertakan "${t.includes}"`:"regex"===t.format?`String tidak valid: harus sesuai pola ${t.pattern}`:`${r[t.format]??e.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${e.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${e.origin}`;case"invalid_union":default:return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${e.origin}`}}};function pp(){return{localeError:lp()}}var fp=()=>{let e={string:{unit:"stafi",verb:"aư hafa"},file:{unit:"bƦti",verb:"aư hafa"},array:{unit:"hluti",verb:"aư hafa"},set:{unit:"hluti",verb:"aư hafa"}};function t(t){return e[t]??null}let r={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tĆmi",date:"ISO dagsetning",time:"ISO tĆmi",duration:"ISO tĆmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tƶlugildi",jwt:"JWT",template_literal:"gildi"},n={nan:"NaN",number:"nĆŗmer",array:"fylki"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Rangt gildi: ĆĆŗ slóst inn ${i} þar sem Ć” aư vera instanceof ${e.expected}`:`Rangt gildi: ĆĆŗ slóst inn ${i} þar sem Ć” aư vera ${t}`}case"invalid_value":return 1===e.values.length?`Rangt gildi: gert rƔư fyrir ${Ya(e.values[0])}`:`Ćgilt val: mĆ” vera eitt af eftirfarandi ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Of stórt: gert er rƔư fyrir aư ${e.origin??"gildi"} hafi ${r}${e.maximum.toString()} ${n.unit??"hluti"}`:`Of stórt: gert er rƔư fyrir aư ${e.origin??"gildi"} sĆ© ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Of lĆtiư: gert er rƔư fyrir aư ${e.origin} hafi ${r}${e.minimum.toString()} ${n.unit}`:`Of lĆtiư: gert er rƔư fyrir aư ${e.origin} sĆ© ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Ćgildur strengur: verưur aư byrja Ć” "${t.prefix}"`:"ends_with"===t.format?`Ćgildur strengur: verưur aư enda Ć” "${t.suffix}"`:"includes"===t.format?`Ćgildur strengur: verưur aư innihalda "${t.includes}"`:"regex"===t.format?`Ćgildur strengur: verưur aư fylgja mynstri ${t.pattern}`:`Rangt ${r[t.format]??e.format}`}case"not_multiple_of":return`Rƶng tala: verưur aư vera margfeldi af ${e.divisor}`;case"unrecognized_keys":return`Ćþekkt ${e.keys.length>1?"ir lyklar":"ur lykill"}: ${wa(e.keys,", ")}`;case"invalid_key":return`Rangur lykill Ć ${e.origin}`;case"invalid_union":default:return"Rangt gildi";case"invalid_element":return`Rangt gildi Ć ${e.origin}`}}};function hp(){return{localeError:fp()}}var mp=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(t){return e[t]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"numero",array:"vettore"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Input non valido: atteso instanceof ${e.expected}, ricevuto ${i}`:`Input non valido: atteso ${t}, ricevuto ${i}`}case"invalid_value":return 1===e.values.length?`Input non valido: atteso ${Ya(e.values[0])}`:`Opzione non valida: atteso uno tra ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Troppo grande: ${e.origin??"valore"} deve avere ${r}${e.maximum.toString()} ${n.unit??"elementi"}`:`Troppo grande: ${e.origin??"valore"} deve essere ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Troppo piccolo: ${e.origin} deve avere ${r}${e.minimum.toString()} ${n.unit}`:`Troppo piccolo: ${e.origin} deve essere ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Stringa non valida: deve iniziare con "${t.prefix}"`:"ends_with"===t.format?`Stringa non valida: deve terminare con "${t.suffix}"`:"includes"===t.format?`Stringa non valida: deve includere "${t.includes}"`:"regex"===t.format?`Stringa non valida: deve corrispondere al pattern ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${e.divisor}`;case"unrecognized_keys":return`Chiav${e.keys.length>1?"i":"e"} non riconosciut${e.keys.length>1?"e":"a"}: ${wa(e.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${e.origin}`;case"invalid_union":default:return"Input non valido";case"invalid_element":return`Valore non valido in ${e.origin}`}}};function gp(){return{localeError:mp()}}var vp=()=>{let e={string:{unit:"ęå",verb:"ć§ćć"},file:{unit:"ćć¤ć",verb:"ć§ćć"},array:{unit:"č¦ē“ ",verb:"ć§ćć"},set:{unit:"č¦ē“ ",verb:"ć§ćć"}};function t(t){return e[t]??null}let r={regex:"å
„åå¤",email:"ć”ć¼ć«ć¢ćć¬ć¹",url:"URL",emoji:"ēµµęå",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISOę„ę",date:"ISOę„ä»",time:"ISOęå»",duration:"ISOęé",ipv4:"IPv4ć¢ćć¬ć¹",ipv6:"IPv6ć¢ćć¬ć¹",cidrv4:"IPv4ēÆå²",cidrv6:"IPv6ēÆå²",base64:"base64ćØć³ć³ć¼ćęåå",base64url:"base64urlćØć³ć³ć¼ćęåå",json_string:"JSONęåå",e164:"E.164ēŖå·",jwt:"JWT",template_literal:"å
„åå¤"},n={nan:"NaN",number:"ę°å¤",array:"é
å"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ē”å¹ćŖå
„å: instanceof ${e.expected}ćęå¾
ććć¾ćććć${i}ćå
„åććć¾ćć`:`ē”å¹ćŖå
„å: ${t}ćęå¾
ććć¾ćććć${i}ćå
„åććć¾ćć`}case"invalid_value":return 1===e.values.length?`ē”å¹ćŖå
„å: ${Ya(e.values[0])}ćęå¾
ććć¾ćć`:`ē”å¹ćŖéøę: ${wa(e.values,"ć")}ć®ććććć§ććåæ
č¦ćććć¾ć`;case"too_big":{let r=e.inclusive?"仄äøć§ćć":"ććå°ćć",n=t(e.origin);return n?`大ććććå¤: ${e.origin??"å¤"}ćÆ${e.maximum.toString()}${n.unit??"č¦ē“ "}${r}åæ
č¦ćććć¾ć`:`大ććććå¤: ${e.origin??"å¤"}ćÆ${e.maximum.toString()}${r}åæ
č¦ćććć¾ć`}case"too_small":{let r=e.inclusive?"仄äøć§ćć":"ćć大ćć",n=t(e.origin);return n?`å°ććććå¤: ${e.origin}ćÆ${e.minimum.toString()}${n.unit}${r}åæ
č¦ćććć¾ć`:`å°ććććå¤: ${e.origin}ćÆ${e.minimum.toString()}${r}åæ
č¦ćććć¾ć`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ē”å¹ćŖęåå: "${t.prefix}"ć§å§ć¾ćåæ
č¦ćććć¾ć`:"ends_with"===t.format?`ē”å¹ćŖęåå: "${t.suffix}"ć§ēµććåæ
č¦ćććć¾ć`:"includes"===t.format?`ē”å¹ćŖęåå: "${t.includes}"ćå«ćåæ
č¦ćććć¾ć`:"regex"===t.format?`ē”å¹ćŖęåå: ććæć¼ć³${t.pattern}ć«äøč“ććåæ
č¦ćććć¾ć`:`ē”å¹ćŖ${r[t.format]??e.format}`}case"not_multiple_of":return`ē”å¹ćŖę°å¤: ${e.divisor}ć®åę°ć§ććåæ
č¦ćććć¾ć`;case"unrecognized_keys":return`čŖčććć¦ććŖććć¼${e.keys.length>1?"群":""}: ${wa(e.keys,"ć")}`;case"invalid_key":return`${e.origin}å
ć®ē”å¹ćŖćć¼`;case"invalid_union":default:return"ē”å¹ćŖå
„å";case"invalid_element":return`${e.origin}å
ć®ē”å¹ćŖå¤`}}};function yp(){return{localeError:vp()}}var _p=()=>{let e={string:{unit:"į”įįįįįį",verb:"į£įįį įØįįįŖįįįįį”"},file:{unit:"įįįį¢į",verb:"į£įįį įØįįįŖįįįįį”"},array:{unit:"įįįįįįį¢į",verb:"į£įįį įØįįįŖįįįįį”"},set:{unit:"įįįįįįį¢į",verb:"į£įįį įØįįįŖįįįįį”"}};function t(t){return e[t]??null}let r={regex:"įØįį§įįįį",email:"įį-į¤įį”į¢įį” įįį”įįįį įį",url:"URL",emoji:"įįįįÆį",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"įįį įį¦į-įį į",date:"įįį įį¦į",time:"įį į",duration:"į®įįįį į«įįįįįį",ipv4:"IPv4 įįį”įįįį įį",ipv6:"IPv6 įįį”įįįį įį",cidrv4:"IPv4 įįįįįįįįį",cidrv6:"IPv6 įįįįįįįįį",base64:"base64-įįįįį įįį£įį į”į¢į įįįį",base64url:"base64url-įįįįį įįį£įį į”į¢į įįįį",json_string:"JSON į”į¢į įįįį",e164:"E.164 įįįįį į",jwt:"JWT",template_literal:"įØįį§įįįį"},n={nan:"NaN",number:"į įįŖį®įį",string:"į”į¢į įįįį",boolean:"įį£įįįįį",function:"į¤į£įį„įŖįį",array:"įįį”įįį"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`įį įį”į¬įį į įØįį§įįįį: įįį”įįįįįįįį instanceof ${e.expected}, įįį¦įįį£įį ${i}`:`įį įį”į¬įį į įØįį§įįįį: įįį”įįįįįįįį ${t}, įįį¦įįį£įį ${i}`}case"invalid_value":return 1===e.values.length?`įį įį”į¬įį į įØįį§įįįį: įįį”įįįįįįįį ${Ya(e.values[0])}`:`įį įį”į¬įį į įįį įįįį¢į: įįį”įįįįįįįįį įį į-įį įį ${wa(e.values,"|")}-įįį`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`įįįįįį¢įį įįįį: įįį”įįįįįįįį ${e.origin??"įįįįØįįįįįįį"} ${n.verb} ${r}${e.maximum.toString()} ${n.unit}`:`įįįįįį¢įį įįįį: įįį”įįįįįįįį ${e.origin??"įįįįØįįįįįįį"} įį§įį” ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`įįįįįį¢įį įįį¢įį į: įįį”įįįįįįįį ${e.origin} ${n.verb} ${r}${e.minimum.toString()} ${n.unit}`:`įįįįįį¢įį įįį¢įį į: įįį”įįįįįįįį ${e.origin} įį§įį” ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`įį įį”į¬įį į į”į¢į įįįį: į£įįį įį¬į§įįįįįį” "${t.prefix}"-įį`:"ends_with"===t.format?`įį įį”į¬įį į į”į¢į įįįį: į£įįį įįįįį įįįįįįį” "${t.suffix}"-įį`:"includes"===t.format?`įį įį”į¬įį į į”į¢į įįįį: į£įįį įØįįįŖįįįįį” "${t.includes}"-į”`:"regex"===t.format?`įį įį”į¬įį į į”į¢į įįįį: į£įįį įØįįį”įįįįįįįįįį” įØįįįįįį” ${t.pattern}`:`įį įį”į¬įį į ${r[t.format]??e.format}`}case"not_multiple_of":return`įį įį”į¬įį į į įįŖį®įį: į£įįį įį§įį” ${e.divisor}-įį” įÆįį įįį`;case"unrecognized_keys":return`į£įŖįįįį įįį”įį¦įį${e.keys.length>1?"įįį":"į"}: ${wa(e.keys,", ")}`;case"invalid_key":return`įį įį”į¬įį į įįį”įį¦įįį ${e.origin}-įØį`;case"invalid_union":default:return"įį įį”į¬įį į įØįį§įįįį";case"invalid_element":return`įį įį”į¬įį į įįįįØįįįįįįį ${e.origin}-įØį`}}};function bp(){return{localeError:_p()}}var wp=()=>{let e={string:{unit:"įį½į¢įįįį",verb:"įį½įįį¶į"},file:{unit:"įį",verb:"įį½įįį¶į"},array:{unit:"įį¶įį»",verb:"įį½įįį¶į"},set:{unit:"įį¶įį»",verb:"įį½įįį¶į"}};function t(t){return e[t]??null}let r={regex:"įį·įįįįįįįįįį
į¼į",email:"į¢į¶įįįįįį¶įį¢įįøįįį",url:"URL",emoji:"įįįįį¶į¢į¶įįįįįį",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"įį¶įįįį·į
įįįį įį·įįįįį ISO",date:"įį¶įįįį·į
įįįį ISO",time:"įįįį ISO",duration:"įįįįįį ISO",ipv4:"į¢į¶įįįįįį¶į IPv4",ipv6:"į¢į¶įįįįįį¶į IPv6",cidrv4:"įįįį¢į¶įįįįįį¶į IPv4",cidrv6:"įįįį¢į¶įįįįįį¶į IPv6",base64:"įįįįį¢įįįįį¢įį·įį¼į base64",base64url:"įįįįį¢įįįįį¢įį·įį¼į base64url",json_string:"įįįįį¢įįįį JSON",e164:"įįį E.164",jwt:"JWT",template_literal:"įį·įįįįįįįįįį
į¼į"},n={nan:"NaN",number:"įįį",array:"į¢į¶įį (Array)",null:"įįįį¶įįįįįį (null)"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`įį·įįįįįįįįįį
į¼įįį·įįįįį¹įįįįį¼įį įįįį¼įįį¶į instanceof ${e.expected} įįį»įįįįįįį½įįį¶į ${i}`:`įį·įįįįįįįįįį
į¼įįį·įįįįį¹įįįįį¼įį įįįį¼įįį¶į ${t} įįį»įįįįįįį½įįį¶į ${i}`}case"invalid_value":return 1===e.values.length?`įį·įįįįįįįįįį
į¼įįį·įįįįį¹įįįįį¼įį įįįį¼įįį¶į ${Ya(e.values[0])}`:`įįįįį¾įįį·įįįįį¹įįįįį¼įį įįįį¼įįį¶įį½įįįįį»įį
įįįį ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`įįįįįį įįįį¼įįį¶į ${e.origin??"įįįįį"} ${r} ${e.maximum.toString()} ${n.unit??"įį¶įį»"}`:`įįįįįį įįįį¼įįį¶į ${e.origin??"įįįįį"} ${r} ${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`įį¼į
įįįį įįįį¼įįį¶į ${e.origin} ${r} ${e.minimum.toString()} ${n.unit}`:`įį¼į
įįįį įįįį¼įįį¶į ${e.origin} ${r} ${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`įįįįį¢įįįįįį·įįįįį¹įįįįį¼įį įįįį¼įį
į¶įįįįįį¾įįįį "${t.prefix}"`:"ends_with"===t.format?`įįįįį¢įįįįįį·įįįįį¹įįįįį¼įį įįįį¼įįįįį
įįįįį "${t.suffix}"`:"includes"===t.format?`įįįįį¢įįįįįį·įįįįį¹įįįįį¼įį įįįį¼įįį¶į "${t.includes}"`:"regex"===t.format?`įįįįį¢įįįįįį·įįįįį¹įįįįį¼įį įįįį¼įįįįįįį¼įįįįįį¹įįįįįįįįįįįį¶įįįįįį ${t.pattern}`:`įį·įįįįį¹įįįįį¼įį ${r[t.format]??e.format}`}case"not_multiple_of":return`įįįįį·įįįįį¹įįįįį¼įį įįįį¼įįįįį¶įį į»įį»įįį ${e.divisor}`;case"unrecognized_keys":return`įįįį¾įįįįį·įįįįį¶įįį ${wa(e.keys,", ")}`;case"invalid_key":return`įįįį·įįįįį¹įįįįį¼įįį
įįįį»į ${e.origin}`;case"invalid_union":default:return"įį·įįįįįįįį·įįįįį¹įįįįį¼į";case"invalid_element":return`įį·įįįįįįįį·įįįįį¹įįįįį¼įįį
įįįį»į ${e.origin}`}}};function $p(){return{localeError:wp()}}function kp(){return $p()}var Sp=()=>{let e={string:{unit:"문ģ",verb:"to have"},file:{unit:"ė°ģ“ķø",verb:"to have"},array:{unit:"ź°",verb:"to have"},set:{unit:"ź°",verb:"to have"}};function t(t){return e[t]??null}let r={regex:"ģ
ė „",email:"ģ“ė©ģ¼ 주ģ",url:"URL",emoji:"ģ“ėŖØģ§",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ė ģ§ģź°",date:"ISO ė ģ§",time:"ISO ģź°",duration:"ISO źø°ź°",ipv4:"IPv4 주ģ",ipv6:"IPv6 주ģ",cidrv4:"IPv4 ė²ģ",cidrv6:"IPv6 ė²ģ",base64:"base64 ģøģ½ė© 문ģģ“",base64url:"base64url ģøģ½ė© 문ģģ“",json_string:"JSON 문ģģ“",e164:"E.164 ė²ķø",jwt:"JWT",template_literal:"ģ
ė „"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ģėŖ»ė ģ
ė „: ģģ ķģ
ģ instanceof ${e.expected}, ė°ģ ķģ
ģ ${i}ģ
ėė¤`:`ģėŖ»ė ģ
ė „: ģģ ķģ
ģ ${t}, ė°ģ ķģ
ģ ${i}ģ
ėė¤`}case"invalid_value":return 1===e.values.length?`ģėŖ»ė ģ
ė „: ź°ģ ${Ya(e.values[0])} ģ“ģ“ģ¼ ķ©ėė¤`:`ģėŖ»ė ģµģ
: ${wa(e.values,"ėė ")} ģ¤ ķėģ¬ģ¼ ķ©ėė¤`;case"too_big":{let r=e.inclusive?"ģ“ķ":"미ė§",n="미ė§"===r?"ģ“ģ“ģ¼ ķ©ėė¤":"ģ¬ģ¼ ķ©ėė¤",i=t(e.origin),o=i?.unit??"ģģ";return i?`${e.origin??"ź°"}ģ“ ė묓 ķ½ėė¤: ${e.maximum.toString()}${o} ${r}${n}`:`${e.origin??"ź°"}ģ“ ė묓 ķ½ėė¤: ${e.maximum.toString()} ${r}${n}`}case"too_small":{let r=e.inclusive?"ģ“ģ":"ģ“ź³¼",n="ģ“ģ"===r?"ģ“ģ“ģ¼ ķ©ėė¤":"ģ¬ģ¼ ķ©ėė¤",i=t(e.origin),o=i?.unit??"ģģ";return i?`${e.origin??"ź°"}ģ“ ė묓 ģģµėė¤: ${e.minimum.toString()}${o} ${r}${n}`:`${e.origin??"ź°"}ģ“ ė묓 ģģµėė¤: ${e.minimum.toString()} ${r}${n}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ģėŖ»ė 문ģģ“: "${t.prefix}"(ģ¼)ė” ģģķ“ģ¼ ķ©ėė¤`:"ends_with"===t.format?`ģėŖ»ė 문ģģ“: "${t.suffix}"(ģ¼)ė” ėėģ¼ ķ©ėė¤`:"includes"===t.format?`ģėŖ»ė 문ģģ“: "${t.includes}"ģ(넼) ķ¬ķØķ“ģ¼ ķ©ėė¤`:"regex"===t.format?`ģėŖ»ė 문ģģ“: ģ ź·ģ ${t.pattern} ķØķ“ź³¼ ģ¼ģ¹ķ“ģ¼ ķ©ėė¤`:`ģėŖ»ė ${r[t.format]??e.format}`}case"not_multiple_of":return`ģėŖ»ė ģ«ģ: ${e.divisor}ģ ė°°ģģ¬ģ¼ ķ©ėė¤`;case"unrecognized_keys":return`ģøģķ ģ ģė ķ¤: ${wa(e.keys,", ")}`;case"invalid_key":return`ģėŖ»ė ķ¤: ${e.origin}`;case"invalid_union":default:return"ģėŖ»ė ģ
ė „";case"invalid_element":return`ģėŖ»ė ź°: ${e.origin}`}}};function Ip(){return{localeError:Sp()}}var Pp=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ep(e){let t=Math.abs(e),r=t%10,n=t%100;return n>=11&&n<=19||0===r?"many":1===r?"one":"few"}var xp=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi bÅ«ti ne ilgesnÄ kaip",notInclusive:"turi bÅ«ti trumpesnÄ kaip"},bigger:{inclusive:"turi bÅ«ti ne trumpesnÄ kaip",notInclusive:"turi bÅ«ti ilgesnÄ kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi bÅ«ti ne didesnis kaip",notInclusive:"turi bÅ«ti mažesnis kaip"},bigger:{inclusive:"turi bÅ«ti ne mažesnis kaip",notInclusive:"turi bÅ«ti didesnis kaip"}}},array:{unit:{one:"elementÄ
",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turÄti ne daugiau kaip",notInclusive:"turi turÄti mažiau kaip"},bigger:{inclusive:"turi turÄti ne mažiau kaip",notInclusive:"turi turÄti daugiau kaip"}}},set:{unit:{one:"elementÄ
",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turÄti ne daugiau kaip",notInclusive:"turi turÄti mažiau kaip"},bigger:{inclusive:"turi turÄti ne mažiau kaip",notInclusive:"turi turÄti daugiau kaip"}}}};function t(t,r,n,i){let o=e[t]??null;return null===o?o:{unit:o.unit[r],verb:o.verb[i][n?"inclusive":"notInclusive"]}}let r={regex:"ÄÆvestis",email:"el. paÅ”to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmÄ",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutÄ",base64url:"base64url užkoduota eilutÄ",json_string:"JSON eilutÄ",e164:"E.164 numeris",jwt:"JWT",template_literal:"ÄÆvestis"},n={nan:"NaN",number:"skaiÄius",bigint:"sveikasis skaiÄius",string:"eilutÄ",boolean:"loginÄ reikÅ”mÄ",undefined:"neapibrÄžta reikÅ”mÄ",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinÄ reikÅ”mÄ"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Gautas tipas ${i}, o tikÄtasi - instanceof ${e.expected}`:`Gautas tipas ${i}, o tikÄtasi - ${t}`}case"invalid_value":return 1===e.values.length?`Privalo bÅ«ti ${Ya(e.values[0])}`:`Privalo bÅ«ti vienas iÅ” ${wa(e.values,"|")} pasirinkimų`;case"too_big":{let r=n[e.origin]??e.origin,i=t(e.origin,Ep(Number(e.maximum)),e.inclusive??!1,"smaller");if(i?.verb)return`${Pp(r??e.origin??"reikÅ”mÄ")} ${i.verb} ${e.maximum.toString()} ${i.unit??"elementų"}`;let o=e.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Pp(r??e.origin??"reikÅ”mÄ")} turi bÅ«ti ${o} ${e.maximum.toString()} ${i?.unit}`}case"too_small":{let r=n[e.origin]??e.origin,i=t(e.origin,Ep(Number(e.minimum)),e.inclusive??!1,"bigger");if(i?.verb)return`${Pp(r??e.origin??"reikÅ”mÄ")} ${i.verb} ${e.minimum.toString()} ${i.unit??"elementų"}`;let o=e.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Pp(r??e.origin??"reikÅ”mÄ")} turi bÅ«ti ${o} ${e.minimum.toString()} ${i?.unit}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`EilutÄ privalo prasidÄti "${t.prefix}"`:"ends_with"===t.format?`EilutÄ privalo pasibaigti "${t.suffix}"`:"includes"===t.format?`EilutÄ privalo ÄÆtraukti "${t.includes}"`:"regex"===t.format?`EilutÄ privalo atitikti ${t.pattern}`:`Neteisingas ${r[t.format]??e.format}`}case"not_multiple_of":return`SkaiÄius privalo bÅ«ti ${e.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${e.keys.length>1?"i":"as"} rakt${e.keys.length>1?"ai":"as"}: ${wa(e.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":default:return"Klaidinga ÄÆvestis";case"invalid_element":{let t=n[e.origin]??e.origin;return`${Pp(t??e.origin??"reikÅ”mÄ")} turi klaidingÄ
ÄÆvestÄÆ`}}}};function Op(){return{localeError:xp()}}var Tp=()=>{let e={string:{unit:"Š·Š½Š°ŃŠø",verb:"Га имааŃ"},file:{unit:"баŃŃŠø",verb:"Га имааŃ"},array:{unit:"ŃŃŠ°Š²ŠŗŠø",verb:"Га имааŃ"},set:{unit:"ŃŃŠ°Š²ŠŗŠø",verb:"Га имааŃ"}};function t(t){return e[t]??null}let r={regex:"внеŃ",email:"Š°Š“ŃŠµŃа на е-поŃŃŠ°",url:"URL",emoji:"ŠµŠ¼Š¾ŃŠø",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ГаŃŃŠ¼ Šø Š²ŃŠµŠ¼Šµ",date:"ISO ГаŃŃŠ¼",time:"ISO Š²ŃŠµŠ¼Šµ",duration:"ISO Š²ŃŠµŠ¼ŠµŃŃŠ°ŠµŃе",ipv4:"IPv4 Š°Š“ŃŠµŃа",ipv6:"IPv6 Š°Š“ŃŠµŃа",cidrv4:"IPv4 Š¾ŠæŃŠµŠ³",cidrv6:"IPv6 Š¾ŠæŃŠµŠ³",base64:"base64-ŠµŠ½ŠŗŠ¾Š“ŠøŃŠ°Š½Š° низа",base64url:"base64url-ŠµŠ½ŠŗŠ¾Š“ŠøŃŠ°Š½Š° низа",json_string:"JSON низа",e164:"E.164 Š±ŃŠ¾Ń",jwt:"JWT",template_literal:"внеŃ"},n={nan:"NaN",number:"Š±ŃŠ¾Ń",array:"низа"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŠŃŠµŃŠµŠ½ внеŃ: ŃŠµ Š¾ŃŠµŠŗŃва instanceof ${e.expected}, ŠæŃŠøŠ¼ŠµŠ½Š¾ ${i}`:`ŠŃŠµŃŠµŠ½ внеŃ: ŃŠµ Š¾ŃŠµŠŗŃва ${t}, ŠæŃŠøŠ¼ŠµŠ½Š¾ ${i}`}case"invalid_value":return 1===e.values.length?`Invalid input: expected ${Ya(e.values[0])}`:`ŠŃŠµŃŠ°Š½Š° Š¾ŠæŃŠøŃа: ŃŠµ Š¾ŃŠµŠŗŃва еГна ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ŠŃŠµŠ¼Š½Š¾Š³Ń Š³Š¾Š»ŠµŠ¼: ŃŠµ Š¾ŃŠµŠŗŃва ${e.origin??"Š²ŃŠµŠ“ноŃŃŠ°"} Га има ${r}${e.maximum.toString()} ${n.unit??"ŠµŠ»ŠµŠ¼ŠµŠ½ŃŠø"}`:`ŠŃŠµŠ¼Š½Š¾Š³Ń Š³Š¾Š»ŠµŠ¼: ŃŠµ Š¾ŃŠµŠŗŃва ${e.origin??"Š²ŃŠµŠ“ноŃŃŠ°"} Га биГе ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ŠŃŠµŠ¼Š½Š¾Š³Ń Š¼Š°Š»: ŃŠµ Š¾ŃŠµŠŗŃва ${e.origin} Га има ${r}${e.minimum.toString()} ${n.unit}`:`ŠŃŠµŠ¼Š½Š¾Š³Ń Š¼Š°Š»: ŃŠµ Š¾ŃŠµŠŗŃва ${e.origin} Га биГе ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ŠŠµŠ²Š°Š¶ŠµŃка низа: Š¼Š¾ŃŠ° Га Š·Š°ŠæŠ¾ŃнŃва ŃŠ¾ "${t.prefix}"`:"ends_with"===t.format?`ŠŠµŠ²Š°Š¶ŠµŃка низа: Š¼Š¾ŃŠ° Га завŃŃŃŠ²Š° ŃŠ¾ "${t.suffix}"`:"includes"===t.format?`ŠŠµŠ²Š°Š¶ŠµŃка низа: Š¼Š¾ŃŠ° Га вклŃŃŃŠ²Š° "${t.includes}"`:"regex"===t.format?`ŠŠµŠ²Š°Š¶ŠµŃка низа: Š¼Š¾ŃŠ° Га Š¾Š“Š³Š¾Š°ŃŠ° на ŠæŠ°ŃŠµŃŠ½Š¾Ń ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case"not_multiple_of":return`ŠŃŠµŃŠµŠ½ Š±ŃŠ¾Ń: Š¼Š¾ŃŠ° Га биГе Гелив ŃŠ¾ ${e.divisor}`;case"unrecognized_keys":return`${e.keys.length>1?"ŠŠµŠæŃепознаени ŠŗŠ»ŃŃŠµŠ²Šø":"ŠŠµŠæŃепознаен ŠŗŠ»ŃŃ"}: ${wa(e.keys,", ")}`;case"invalid_key":return`ŠŃŠµŃŠµŠ½ ŠŗŠ»ŃŃ Š²Š¾ ${e.origin}`;case"invalid_union":default:return"ŠŃŠµŃŠµŠ½ внеŃ";case"invalid_element":return`ŠŃŠµŃŠ½Š° Š²ŃŠµŠ“ноŃŃ Š²Š¾ ${e.origin}`}}};function Ap(){return{localeError:Tp()}}var Cp=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(t){return e[t]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"nombor"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Input tidak sah: dijangka instanceof ${e.expected}, diterima ${i}`:`Input tidak sah: dijangka ${t}, diterima ${i}`}case"invalid_value":return 1===e.values.length?`Input tidak sah: dijangka ${Ya(e.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Terlalu besar: dijangka ${e.origin??"nilai"} ${n.verb} ${r}${e.maximum.toString()} ${n.unit??"elemen"}`:`Terlalu besar: dijangka ${e.origin??"nilai"} adalah ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Terlalu kecil: dijangka ${e.origin} ${n.verb} ${r}${e.minimum.toString()} ${n.unit}`:`Terlalu kecil: dijangka ${e.origin} adalah ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`String tidak sah: mesti bermula dengan "${t.prefix}"`:"ends_with"===t.format?`String tidak sah: mesti berakhir dengan "${t.suffix}"`:"includes"===t.format?`String tidak sah: mesti mengandungi "${t.includes}"`:"regex"===t.format?`String tidak sah: mesti sepadan dengan corak ${t.pattern}`:`${r[t.format]??e.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${e.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${wa(e.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${e.origin}`;case"invalid_union":default:return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${e.origin}`}}};function jp(){return{localeError:Cp()}}var Dp=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(t){return e[t]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},n={nan:"NaN",number:"getal"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Ongeldige invoer: verwacht instanceof ${e.expected}, ontving ${i}`:`Ongeldige invoer: verwacht ${t}, ontving ${i}`}case"invalid_value":return 1===e.values.length?`Ongeldige invoer: verwacht ${Ya(e.values[0])}`:`Ongeldige optie: verwacht ƩƩn van ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin),i="date"===e.origin?"laat":"string"===e.origin?"lang":"groot";return n?`Te ${i}: verwacht dat ${e.origin??"waarde"} ${r}${e.maximum.toString()} ${n.unit??"elementen"} ${n.verb}`:`Te ${i}: verwacht dat ${e.origin??"waarde"} ${r}${e.maximum.toString()} is`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin),i="date"===e.origin?"vroeg":"string"===e.origin?"kort":"klein";return n?`Te ${i}: verwacht dat ${e.origin} ${r}${e.minimum.toString()} ${n.unit} ${n.verb}`:`Te ${i}: verwacht dat ${e.origin} ${r}${e.minimum.toString()} is`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Ongeldige tekst: moet met "${t.prefix}" beginnen`:"ends_with"===t.format?`Ongeldige tekst: moet op "${t.suffix}" eindigen`:"includes"===t.format?`Ongeldige tekst: moet "${t.includes}" bevatten`:"regex"===t.format?`Ongeldige tekst: moet overeenkomen met patroon ${t.pattern}`:`Ongeldig: ${r[t.format]??e.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${e.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${e.origin}`;case"invalid_union":default:return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${e.origin}`}}};function zp(){return{localeError:Dp()}}var Np=()=>{let e={string:{unit:"tegn",verb:"Ć„ ha"},file:{unit:"bytes",verb:"Ć„ ha"},array:{unit:"elementer",verb:"Ć„ inneholde"},set:{unit:"elementer",verb:"Ć„ inneholde"}};function t(t){return e[t]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omrĆ„de",ipv6:"IPv6-omrĆ„de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"tall",array:"liste"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Ugyldig input: forventet instanceof ${e.expected}, fikk ${i}`:`Ugyldig input: forventet ${t}, fikk ${i}`}case"invalid_value":return 1===e.values.length?`Ugyldig verdi: forventet ${Ya(e.values[0])}`:`Ugyldig valg: forventet en av ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`For stor(t): forventet ${e.origin??"value"} til Ć„ ha ${r}${e.maximum.toString()} ${n.unit??"elementer"}`:`For stor(t): forventet ${e.origin??"value"} til Ć„ ha ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`For lite(n): forventet ${e.origin} til Ć„ ha ${r}${e.minimum.toString()} ${n.unit}`:`For lite(n): forventet ${e.origin} til Ć„ ha ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Ugyldig streng: mĆ„ starte med "${t.prefix}"`:"ends_with"===t.format?`Ugyldig streng: mĆ„ ende med "${t.suffix}"`:"includes"===t.format?`Ugyldig streng: mĆ„ inneholde "${t.includes}"`:"regex"===t.format?`Ugyldig streng: mĆ„ matche mĆønsteret ${t.pattern}`:`Ugyldig ${r[t.format]??e.format}`}case"not_multiple_of":return`Ugyldig tall: mĆ„ vƦre et multiplum av ${e.divisor}`;case"unrecognized_keys":return`${e.keys.length>1?"Ukjente nĆøkler":"Ukjent nĆøkkel"}: ${wa(e.keys,", ")}`;case"invalid_key":return`Ugyldig nĆøkkel i ${e.origin}`;case"invalid_union":default:return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${e.origin}`}}};function Rp(){return{localeError:Np()}}var Up=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(t){return e[t]??null}let r={regex:"giren",email:"epostagĆ¢h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengĆ¢mı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 niÅĆ¢nı",ipv6:"IPv6 niÅĆ¢nı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-Åifreli metin",base64url:"base64url-Åifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},n={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`FĆ¢sit giren: umulan instanceof ${e.expected}, alınan ${i}`:`FĆ¢sit giren: umulan ${t}, alınan ${i}`}case"invalid_value":return 1===e.values.length?`FĆ¢sit giren: umulan ${Ya(e.values[0])}`:`FĆ¢sit tercih: mĆ»teberler ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Fazla büyük: ${e.origin??"value"}, ${r}${e.maximum.toString()} ${n.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${e.origin??"value"}, ${r}${e.maximum.toString()} olmalıydı.`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Fazla küçük: ${e.origin}, ${r}${e.minimum.toString()} ${n.unit} sahip olmalıydı.`:`Fazla küçük: ${e.origin}, ${r}${e.minimum.toString()} olmalıydı.`}case"invalid_format":{let t=e;return"starts_with"===t.format?`FĆ¢sit metin: "${t.prefix}" ile baÅlamalı.`:"ends_with"===t.format?`FĆ¢sit metin: "${t.suffix}" ile bitmeli.`:"includes"===t.format?`FĆ¢sit metin: "${t.includes}" ihtivĆ¢ etmeli.`:"regex"===t.format?`FĆ¢sit metin: ${t.pattern} nakÅına uymalı.`:`FĆ¢sit ${r[t.format]??e.format}`}case"not_multiple_of":return`FĆ¢sit sayı: ${e.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`${e.origin} iƧin tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${e.origin} iƧin tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Mp(){return{localeError:Up()}}var Kp=()=>{let e={string:{unit:"ŲŖŁŚ©Ł",verb:"ŁŁŲ±Ł"},file:{unit:"ŲØŲ§ŪŁ¼Ų³",verb:"ŁŁŲ±Ł"},array:{unit:"ŲŖŁŚ©Ł",verb:"ŁŁŲ±Ł"},set:{unit:"ŲŖŁŚ©Ł",verb:"ŁŁŲ±Ł"}};function t(t){return e[t]??null}let r={regex:"ŁŲ±ŁŲÆŁ",email:"ŲØŲ±ŪŚŁŲ§ŁŪŚ©",url:"ŪŁ Ų¢Ų± Ų§Ł",emoji:"Ų§ŪŁ
ŁŲ¬Ł",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ŁŪټ٠ا٠ŁŲ®ŲŖ",date:"ŁŪټŁ",time:"ŁŲ®ŲŖ",duration:"Ł
ŁŲÆŁ",ipv4:"ŲÆ IPv4 پتŁ",ipv6:"ŲÆ IPv6 پتŁ",cidrv4:"ŲÆ IPv4 Ų³Ų§ŲŁ",cidrv6:"ŲÆ IPv6 Ų³Ų§ŲŁ",base64:"base64-encoded Ł
ŲŖŁ",base64url:"base64url-encoded Ł
ŲŖŁ",json_string:"JSON Ł
ŲŖŁ",e164:"ŲÆ E.164 Ų“Ł
ŪŲ±Ł",jwt:"JWT",template_literal:"ŁŲ±ŁŲÆŁ"},n={nan:"NaN",number:"Ų¹ŲÆŲÆ",array:"Ų§Ų±Ū"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŁŲ§Ų³Ł
ŁŲ±ŁŲÆŁ: ŲØŲ§ŪŲÆ instanceof ${e.expected} ŁŲ§Ū, Ł
ګر ${i} ŲŖŲ±ŁŲ§Ų³Ł Ų“Ł`:`ŁŲ§Ų³Ł
ŁŲ±ŁŲÆŁ: ŲØŲ§ŪŲÆ ${t} ŁŲ§Ū, Ł
ګر ${i} ŲŖŲ±ŁŲ§Ų³Ł Ų“Ł`}case"invalid_value":return 1===e.values.length?`ŁŲ§Ų³Ł
ŁŲ±ŁŲÆŁ: ŲØŲ§ŪŲÆ ${Ya(e.values[0])} ŁŲ§Ū`:`ŁŲ§Ų³Ł
Ų§ŁŲŖŲ®Ų§ŲØ: ŲØŲ§ŪŲÆ ŪŁ ŁŁ ${wa(e.values,"|")} Ś
خ٠ŁŲ§Ū`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ŚŪŲ± ŁŁŪ: ${e.origin??"Ų§Ų±Ų²ŚŲŖ"} ŲØŲ§ŪŲÆ ${r}${e.maximum.toString()} ${n.unit??"Ų¹ŁŲµŲ±ŁŁŁ"} ŁŁŲ±Ł`:`ŚŪŲ± ŁŁŪ: ${e.origin??"Ų§Ų±Ų²ŚŲŖ"} ŲØŲ§ŪŲÆ ${r}${e.maximum.toString()} ŁŁ`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ŚŪŲ± Ś©ŁŚŁŪ: ${e.origin} ŲØŲ§ŪŲÆ ${r}${e.minimum.toString()} ${n.unit} ŁŁŲ±Ł`:`ŚŪŲ± Ś©ŁŚŁŪ: ${e.origin} ŲØŲ§ŪŲÆ ${r}${e.minimum.toString()} ŁŁ`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ŁŲ§Ų³Ł
Ł
ŲŖŁ: ŲØŲ§ŪŲÆ ŲÆ "${t.prefix}" Ų³Ų±Ł Ł¾ŪŁ Ų“Ł`:"ends_with"===t.format?`ŁŲ§Ų³Ł
Ł
ŲŖŁ: ŲØŲ§ŪŲÆ ŲÆ "${t.suffix}" Ų³Ų±Ł Ł¾Ų§Ū ŲŖŁ ŁŲ±Ų³ŁŚŁ`:"includes"===t.format?`ŁŲ§Ų³Ł
Ł
ŲŖŁ: ŲØŲ§ŪŲÆ "${t.includes}" ŁŁŲ±Ł`:"regex"===t.format?`ŁŲ§Ų³Ł
Ł
ŲŖŁ: ŲØŲ§ŪŲÆ ŲÆ ${t.pattern} سر٠Ł
Ų·Ų§ŲØŁŲŖ ŁŁŲ±Ł`:`${r[t.format]??e.format} ŁŲ§Ų³Ł
ŲÆŪ`}case"not_multiple_of":return`ŁŲ§Ų³Ł
Ų¹ŲÆŲÆ: ŲØŲ§ŪŲÆ ŲÆ ${e.divisor} Ł
Ų¶Ų±ŲØ ŁŁ`;case"unrecognized_keys":return`ŁŲ§Ų³Ł
${e.keys.length>1?"Ś©ŁŪŚŁŁŁ":"Ś©ŁŪŚ"}: ${wa(e.keys,", ")}`;case"invalid_key":return`ŁŲ§Ų³Ł
Ś©ŁŪŚ Ł¾Ł ${e.origin} Ś©Ū`;case"invalid_union":default:return"ŁŲ§Ų³Ł
Ł ŁŲ±ŁŲÆŁ";case"invalid_element":return`ŁŲ§Ų³Ł
Ų¹ŁŲµŲ± پ٠${e.origin} Ś©Ū`}}};function Zp(){return{localeError:Kp()}}var Jp=()=>{let e={string:{unit:"znaków",verb:"mieÄ"},file:{unit:"bajtów",verb:"mieÄ"},array:{unit:"elementów",verb:"mieÄ"},set:{unit:"elementów",verb:"mieÄ"}};function t(t){return e[t]??null}let r={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciÄ
g znaków zakodowany w formacie base64",base64url:"ciÄ
g znaków zakodowany w formacie base64url",json_string:"ciÄ
g znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejÅcie"},n={nan:"NaN",number:"liczba",array:"tablica"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`NieprawidÅowe dane wejÅciowe: oczekiwano instanceof ${e.expected}, otrzymano ${i}`:`NieprawidÅowe dane wejÅciowe: oczekiwano ${t}, otrzymano ${i}`}case"invalid_value":return 1===e.values.length?`NieprawidÅowe dane wejÅciowe: oczekiwano ${Ya(e.values[0])}`:`NieprawidÅowa opcja: oczekiwano jednej z wartoÅci ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Za duża wartoÅÄ: oczekiwano, że ${e.origin??"wartoÅÄ"} bÄdzie mieÄ ${r}${e.maximum.toString()} ${n.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${e.origin??"wartoÅÄ"} bÄdzie wynosiÄ ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Za maÅa wartoÅÄ: oczekiwano, że ${e.origin??"wartoÅÄ"} bÄdzie mieÄ ${r}${e.minimum.toString()} ${n.unit??"elementów"}`:`Zbyt maÅ(y/a/e): oczekiwano, że ${e.origin??"wartoÅÄ"} bÄdzie wynosiÄ ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`NieprawidÅowy ciÄ
g znaków: musi zaczynaÄ siÄ od "${t.prefix}"`:"ends_with"===t.format?`NieprawidÅowy ciÄ
g znaków: musi koÅczyÄ siÄ na "${t.suffix}"`:"includes"===t.format?`NieprawidÅowy ciÄ
g znaków: musi zawieraÄ "${t.includes}"`:"regex"===t.format?`NieprawidÅowy ciÄ
g znaków: musi odpowiadaÄ wzorcowi ${t.pattern}`:`NieprawidÅow(y/a/e) ${r[t.format]??e.format}`}case"not_multiple_of":return`NieprawidÅowa liczba: musi byÄ wielokrotnoÅciÄ
${e.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`NieprawidÅowy klucz w ${e.origin}`;case"invalid_union":default:return"NieprawidÅowe dane wejÅciowe";case"invalid_element":return`NieprawidÅowa wartoÅÄ w ${e.origin}`}}};function Lp(){return{localeError:Jp()}}var Wp=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(t){return e[t]??null}let r={regex:"padrĆ£o",email:"endereƧo de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereƧo IPv4",ipv6:"endereƧo IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"nĆŗmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",number:"nĆŗmero",null:"nulo"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Tipo invĆ”lido: esperado instanceof ${e.expected}, recebido ${i}`:`Tipo invĆ”lido: esperado ${t}, recebido ${i}`}case"invalid_value":return 1===e.values.length?`Entrada invĆ”lida: esperado ${Ya(e.values[0])}`:`Opção invĆ”lida: esperada uma das ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Muito grande: esperado que ${e.origin??"valor"} tivesse ${r}${e.maximum.toString()} ${n.unit??"elementos"}`:`Muito grande: esperado que ${e.origin??"valor"} fosse ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Muito pequeno: esperado que ${e.origin} tivesse ${r}${e.minimum.toString()} ${n.unit}`:`Muito pequeno: esperado que ${e.origin} fosse ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Texto invĆ”lido: deve comeƧar com "${t.prefix}"`:"ends_with"===t.format?`Texto invĆ”lido: deve terminar com "${t.suffix}"`:"includes"===t.format?`Texto invĆ”lido: deve incluir "${t.includes}"`:"regex"===t.format?`Texto invĆ”lido: deve corresponder ao padrĆ£o ${t.pattern}`:`${r[t.format]??e.format} invĆ”lido`}case"not_multiple_of":return`NĆŗmero invĆ”lido: deve ser mĆŗltiplo de ${e.divisor}`;case"unrecognized_keys":return`Chave${e.keys.length>1?"s":""} desconhecida${e.keys.length>1?"s":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`Chave invĆ”lida em ${e.origin}`;case"invalid_union":return"Entrada invĆ”lida";case"invalid_element":return`Valor invĆ”lido em ${e.origin}`;default:return"Campo invĆ”lido"}}};function Fp(){return{localeError:Wp()}}function Vp(e,t,r,n){let i=Math.abs(e),o=i%10,a=i%100;return a>=11&&a<=19?n:1===o?t:o>=2&&o<=4?r:n}var Hp=()=>{let e={string:{unit:{one:"ŃŠøŠ¼Š²Š¾Š»",few:"ŃŠøŠ¼Š²Š¾Š»Š°",many:"ŃŠøŠ¼Š²Š¾Š»Š¾Š²"},verb:"имеŃŃ"},file:{unit:{one:"байŃ",few:"Š±Š°Š¹ŃŠ°",many:"байŃ"},verb:"имеŃŃ"},array:{unit:{one:"ŃŠ»ŠµŠ¼ŠµŠ½Ń",few:"ŃŠ»ŠµŠ¼ŠµŠ½Ńа",many:"ŃŠ»ŠµŠ¼ŠµŠ½Ńов"},verb:"имеŃŃ"},set:{unit:{one:"ŃŠ»ŠµŠ¼ŠµŠ½Ń",few:"ŃŠ»ŠµŠ¼ŠµŠ½Ńа",many:"ŃŠ»ŠµŠ¼ŠµŠ½Ńов"},verb:"имеŃŃ"}};function t(t){return e[t]??null}let r={regex:"ввоГ",email:"email Š°Š“ŃŠµŃ",url:"URL",emoji:"ŃŠ¼Š¾Š“Š·Šø",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO Š“Š°ŃŠ° Šø Š²ŃŠµŠ¼Ń",date:"ISO Š“Š°ŃŠ°",time:"ISO Š²ŃŠµŠ¼Ń",duration:"ISO Š“Š»ŠøŃŠµŠ»ŃноŃŃŃ",ipv4:"IPv4 Š°Š“ŃŠµŃ",ipv6:"IPv6 Š°Š“ŃŠµŃ",cidrv4:"IPv4 Гиапазон",cidrv6:"IPv6 Гиапазон",base64:"ŃŃŃŠ¾ŠŗŠ° в ŃŠ¾ŃŠ¼Š°ŃŠµ base64",base64url:"ŃŃŃŠ¾ŠŗŠ° в ŃŠ¾ŃŠ¼Š°ŃŠµ base64url",json_string:"JSON ŃŃŃŠ¾ŠŗŠ°",e164:"Š½Š¾Š¼ŠµŃ E.164",jwt:"JWT",template_literal:"ввоГ"},n={nan:"NaN",number:"ŃŠøŃло",array:"маŃŃŠøŠ²"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŠŠµŠ²ŠµŃŠ½ŃŠ¹ ввоГ: ожиГалоŃŃ instanceof ${e.expected}, полŃŃŠµŠ½Š¾ ${i}`:`ŠŠµŠ²ŠµŃŠ½ŃŠ¹ ввоГ: ожиГалоŃŃ ${t}, полŃŃŠµŠ½Š¾ ${i}`}case"invalid_value":return 1===e.values.length?`ŠŠµŠ²ŠµŃŠ½ŃŠ¹ ввоГ: ожиГалоŃŃ ${Ya(e.values[0])}`:`ŠŠµŠ²ŠµŃŠ½ŃŠ¹ Š²Š°ŃŠøŠ°Š½Ń: ожиГалоŃŃ Š¾Š“Š½Š¾ ŠøŠ· ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);if(n){let t=Vp(Number(e.maximum),n.unit.one,n.unit.few,n.unit.many);return`Š”Š»ŠøŃŠŗŠ¾Š¼ болŃŃŠ¾Šµ Š·Š½Š°ŃŠµŠ½ŠøŠµ: ожиГалоŃŃ, ŃŃŠ¾ ${e.origin??"Š·Š½Š°ŃŠµŠ½ŠøŠµ"} Š±ŃŠ“ŠµŃ ŠøŠ¼ŠµŃŃ ${r}${e.maximum.toString()} ${t}`}return`Š”Š»ŠøŃŠŗŠ¾Š¼ болŃŃŠ¾Šµ Š·Š½Š°ŃŠµŠ½ŠøŠµ: ожиГалоŃŃ, ŃŃŠ¾ ${e.origin??"Š·Š½Š°ŃŠµŠ½ŠøŠµ"} Š±ŃŠ“ŠµŃ ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);if(n){let t=Vp(Number(e.minimum),n.unit.one,n.unit.few,n.unit.many);return`Š”Š»ŠøŃŠŗŠ¾Š¼ Š¼Š°Š»ŠµŠ½ŃŠŗŠ¾Šµ Š·Š½Š°ŃŠµŠ½ŠøŠµ: ожиГалоŃŃ, ŃŃŠ¾ ${e.origin} Š±ŃŠ“ŠµŃ ŠøŠ¼ŠµŃŃ ${r}${e.minimum.toString()} ${t}`}return`Š”Š»ŠøŃŠŗŠ¾Š¼ Š¼Š°Š»ŠµŠ½ŃŠŗŠ¾Šµ Š·Š½Š°ŃŠµŠ½ŠøŠµ: ожиГалоŃŃ, ŃŃŠ¾ ${e.origin} Š±ŃŠ“ŠµŃ ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ŠŠµŠ²ŠµŃŠ½Š°Ń ŃŃŃŠ¾ŠŗŠ°: Голжна Š½Š°ŃинаŃŃŃŃ Ń "${t.prefix}"`:"ends_with"===t.format?`ŠŠµŠ²ŠµŃŠ½Š°Ń ŃŃŃŠ¾ŠŗŠ°: Голжна Š·Š°ŠŗŠ°Š½ŃиваŃŃŃŃ Š½Š° "${t.suffix}"`:"includes"===t.format?`ŠŠµŠ²ŠµŃŠ½Š°Ń ŃŃŃŠ¾ŠŗŠ°: Голжна ŃŠ¾Š“ŠµŃŠ¶Š°ŃŃ "${t.includes}"`:"regex"===t.format?`ŠŠµŠ²ŠµŃŠ½Š°Ń ŃŃŃŠ¾ŠŗŠ°: Голжна ŃŠ¾Š¾ŃвеŃŃŃŠ²Š¾Š²Š°ŃŃ ŃŠ°Š±Š»Š¾Š½Ń ${t.pattern}`:`ŠŠµŠ²ŠµŃŠ½ŃŠ¹ ${r[t.format]??e.format}`}case"not_multiple_of":return`ŠŠµŠ²ŠµŃное ŃŠøŃло: Голжно бŃŃŃ ŠŗŃŠ°ŃŠ½ŃŠ¼ ${e.divisor}`;case"unrecognized_keys":return`ŠŠµŃŠ°ŃŠæŠ¾Š·Š½Š°Š½Š½${e.keys.length>1?"ŃŠµ":"ŃŠ¹"} ŠŗŠ»ŃŃ${e.keys.length>1?"Šø":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`ŠŠµŠ²ŠµŃŠ½ŃŠ¹ ŠŗŠ»ŃŃ Š² ${e.origin}`;case"invalid_union":default:return"ŠŠµŠ²ŠµŃŠ½ŃŠµ вŃ
Š¾Š“Š½ŃŠµ Š“Š°Š½Š½ŃŠµ";case"invalid_element":return`ŠŠµŠ²ŠµŃное Š·Š½Š°Ńение в ${e.origin}`}}};function qp(){return{localeError:Hp()}}var Bp=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(t){return e[t]??null}let r={regex:"vnos",email:"e-poÅ”tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in Äas",date:"ISO datum",time:"ISO Äas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 Å”tevilka",jwt:"JWT",template_literal:"vnos"},n={nan:"NaN",number:"Å”tevilo",array:"tabela"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Neveljaven vnos: priÄakovano instanceof ${e.expected}, prejeto ${i}`:`Neveljaven vnos: priÄakovano ${t}, prejeto ${i}`}case"invalid_value":return 1===e.values.length?`Neveljaven vnos: priÄakovano ${Ya(e.values[0])}`:`Neveljavna možnost: priÄakovano eno izmed ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Preveliko: priÄakovano, da bo ${e.origin??"vrednost"} imelo ${r}${e.maximum.toString()} ${n.unit??"elementov"}`:`Preveliko: priÄakovano, da bo ${e.origin??"vrednost"} ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Premajhno: priÄakovano, da bo ${e.origin} imelo ${r}${e.minimum.toString()} ${n.unit}`:`Premajhno: priÄakovano, da bo ${e.origin} ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Neveljaven niz: mora se zaÄeti z "${t.prefix}"`:"ends_with"===t.format?`Neveljaven niz: mora se konÄati z "${t.suffix}"`:"includes"===t.format?`Neveljaven niz: mora vsebovati "${t.includes}"`:"regex"===t.format?`Neveljaven niz: mora ustrezati vzorcu ${t.pattern}`:`Neveljaven ${r[t.format]??e.format}`}case"not_multiple_of":return`Neveljavno Å”tevilo: mora biti veÄkratnik ${e.divisor}`;case"unrecognized_keys":return`Neprepoznan${e.keys.length>1?"i kljuÄi":" kljuÄ"}: ${wa(e.keys,", ")}`;case"invalid_key":return`Neveljaven kljuÄ v ${e.origin}`;case"invalid_union":default:return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${e.origin}`}}};function Gp(){return{localeError:Bp()}}var Yp=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehĆ„lla"},set:{unit:"objekt",verb:"att innehĆ„lla"}};function t(t){return e[t]??null}let r={regex:"reguljƤrt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad strƤng",base64url:"base64url-kodad strƤng",json_string:"JSON-strƤng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},n={nan:"NaN",number:"antal",array:"lista"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Ogiltig inmatning: fƶrvƤntat instanceof ${e.expected}, fick ${i}`:`Ogiltig inmatning: fƶrvƤntat ${t}, fick ${i}`}case"invalid_value":return 1===e.values.length?`Ogiltig inmatning: fƶrvƤntat ${Ya(e.values[0])}`:`Ogiltigt val: fƶrvƤntade en av ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Fƶr stor(t): fƶrvƤntade ${e.origin??"vƤrdet"} att ha ${r}${e.maximum.toString()} ${n.unit??"element"}`:`Fƶr stor(t): fƶrvƤntat ${e.origin??"vƤrdet"} att ha ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Fƶr lite(t): fƶrvƤntade ${e.origin??"vƤrdet"} att ha ${r}${e.minimum.toString()} ${n.unit}`:`Fƶr lite(t): fƶrvƤntade ${e.origin??"vƤrdet"} att ha ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Ogiltig strƤng: mĆ„ste bƶrja med "${t.prefix}"`:"ends_with"===t.format?`Ogiltig strƤng: mĆ„ste sluta med "${t.suffix}"`:"includes"===t.format?`Ogiltig strƤng: mĆ„ste innehĆ„lla "${t.includes}"`:"regex"===t.format?`Ogiltig strƤng: mĆ„ste matcha mƶnstret "${t.pattern}"`:`Ogiltig(t) ${r[t.format]??e.format}`}case"not_multiple_of":return`Ogiltigt tal: mĆ„ste vara en multipel av ${e.divisor}`;case"unrecognized_keys":return`${e.keys.length>1?"OkƤnda nycklar":"OkƤnd nyckel"}: ${wa(e.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${e.origin??"vƤrdet"}`;case"invalid_union":default:return"Ogiltig input";case"invalid_element":return`Ogiltigt vƤrde i ${e.origin??"vƤrdet"}`}}};function Xp(){return{localeError:Yp()}}var Qp=()=>{let e={string:{unit:"ą®ą®“ąÆą®¤ąÆą®¤ąÆą®ąÆą®ą®³ąÆ",verb:"ą®ąÆą®£ąÆą®ą®æą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ"},file:{unit:"ą®ŖąÆą®ąÆą®ąÆą®ą®³ąÆ",verb:"ą®ąÆą®£ąÆą®ą®æą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ"},array:{unit:"ą®ą®±ąÆą®ŖąÆą®ŖąÆą®ą®³ąÆ",verb:"ą®ąÆą®£ąÆą®ą®æą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ"},set:{unit:"ą®ą®±ąÆą®ŖąÆą®ŖąÆą®ą®³ąÆ",verb:"ą®ąÆą®£ąÆą®ą®æą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ"}};function t(t){return e[t]??null}let r={regex:"ą®ą®³ąÆą®³ąÆą®ąÆ",email:"ą®®ą®æą®©ąÆą®©ą®ąÆą®ą®²ąÆ ą®®ąÆą®ą®µą®°ą®æ",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ą®¤ąÆą®¤ą®æ ą®ØąÆą®°ą®®ąÆ",date:"ISO ą®¤ąÆą®¤ą®æ",time:"ISO ą®ØąÆą®°ą®®ąÆ",duration:"ISO ą®ą®¾ą®² ą®
ளவąÆ",ipv4:"IPv4 ą®®ąÆą®ą®µą®°ą®æ",ipv6:"IPv6 ą®®ąÆą®ą®µą®°ą®æ",cidrv4:"IPv4 ą®µą®°ą®®ąÆą®ŖąÆ",cidrv6:"IPv6 ą®µą®°ą®®ąÆą®ŖąÆ",base64:"base64-encoded ą®ą®°ą®®ąÆ",base64url:"base64url-encoded ą®ą®°ą®®ąÆ",json_string:"JSON ą®ą®°ą®®ąÆ",e164:"E.164 ą®ą®£ąÆ",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"ą®ą®£ąÆ",array:"ą®
ணி",null:"ą®µąÆą®±ąÆą®®ąÆ"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`தவறான ą®ą®³ąÆą®³ąÆą®ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ instanceof ${e.expected}, ą®ŖąÆą®±ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${i}`:`தவறான ą®ą®³ąÆą®³ąÆą®ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${t}, ą®ŖąÆą®±ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${i}`}case"invalid_value":return 1===e.values.length?`தவறான ą®ą®³ąÆą®³ąÆą®ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${Ya(e.values[0])}`:`தவறான ą®µą®æą®°ąÆą®ŖąÆą®Ŗą®®ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${wa(e.values,"|")} ą®ą®²ąÆ ą®ą®©ąÆą®±ąÆ`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ą®®ą®æą® ą®ŖąÆą®°ą®æą®Æą®¤ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${e.origin??"ą®®ą®¤ą®æą®ŖąÆą®ŖąÆ"} ${r}${e.maximum.toString()} ${n.unit??"ą®ą®±ąÆą®ŖąÆą®ŖąÆą®ą®³ąÆ"} ą®ą® ą®ą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ`:`ą®®ą®æą® ą®ŖąÆą®°ą®æą®Æą®¤ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${e.origin??"ą®®ą®¤ą®æą®ŖąÆą®ŖąÆ"} ${r}${e.maximum.toString()} ą®ą® ą®ą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ą®®ą®æą®ą®ąÆ ą®ą®æą®±ą®æą®Æą®¤ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${e.origin} ${r}${e.minimum.toString()} ${n.unit} ą®ą® ą®ą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ`:`ą®®ą®æą®ą®ąÆ ą®ą®æą®±ą®æą®Æą®¤ąÆ: ą®ą®¤ą®æą®°ąÆą®Ŗą®¾ą®°ąÆą®ąÆą®ą®ŖąÆą®Ŗą®ąÆą®ą®¤ąÆ ${e.origin} ${r}${e.minimum.toString()} ą®ą® ą®ą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ`}case"invalid_format":{let t=e;return"starts_with"===t.format?`தவறான ą®ą®°ą®®ąÆ: "${t.prefix}" ą®ą®²ąÆ ą®¤ąÆą®ą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ`:"ends_with"===t.format?`தவறான ą®ą®°ą®®ąÆ: "${t.suffix}" ą®ą®²ąÆ ą®®ąÆą®ą®æą®µą®ąÆą®Æ ą®µąÆą®£ąÆą®ąÆą®®ąÆ`:"includes"===t.format?`தவறான ą®ą®°ą®®ąÆ: "${t.includes}" ą® ą®ą®³ąÆą®³ą®ą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ`:"regex"===t.format?`தவறான ą®ą®°ą®®ąÆ: ${t.pattern} ą®®ąÆą®±ąÆą®Ŗą®¾ą®ąÆą®ąÆą®ą®©ąÆ ą®ŖąÆą®°ąÆą®ØąÆą®¤ ą®µąÆą®£ąÆą®ąÆą®®ąÆ`:`தவறான ${r[t.format]??e.format}`}case"not_multiple_of":return`தவறான ą®ą®£ąÆ: ${e.divisor} ą®ą®©ąÆ ą®Ŗą®²ą®®ą®¾ą® ą®ą®°ąÆą®ąÆą® ą®µąÆą®£ąÆą®ąÆą®®ąÆ`;case"unrecognized_keys":return`ą®
ą®ąÆą®Æą®¾ą®³ą®®ąÆ ą®¤ąÆą®°ą®æą®Æą®¾ą®¤ ą®µą®æą®ąÆ${e.keys.length>1?"ą®ą®³ąÆ":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`${e.origin} ą®ą®²ąÆ தவறான ą®µą®æą®ąÆ`;case"invalid_union":default:return"தவறான ą®ą®³ąÆą®³ąÆą®ąÆ";case"invalid_element":return`${e.origin} ą®ą®²ąÆ தவறான ą®®ą®¤ą®æą®ŖąÆą®ŖąÆ`}}};function ef(){return{localeError:Qp()}}var tf=()=>{let e={string:{unit:"ąøąø±ąø§ąøąø±ąøąø©ąø£",verb:"ąøąø§ąø£ąø”ąøµ"},file:{unit:"ą¹ąøąøą¹",verb:"ąøąø§ąø£ąø”ąøµ"},array:{unit:"ąø£ąø²ąø¢ąøąø²ąø£",verb:"ąøąø§ąø£ąø”ąøµ"},set:{unit:"ąø£ąø²ąø¢ąøąø²ąø£",verb:"ąøąø§ąø£ąø”ąøµ"}};function t(t){return e[t]??null}let r={regex:"ąøą¹ąøąø”ąø¹ąø„ąøąøµą¹ąøą¹ąøąø",email:"ąøąøµą¹ąøąø¢ąø¹ą¹ąøąøµą¹ąø”ąø„",url:"URL",emoji:"ąøąø“ą¹ąø”ąøąø“",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ąø§ąø±ąøąøąøµą¹ą¹ąø§ąø„ąø²ą¹ąøąø ISO",date:"ąø§ąø±ąøąøąøµą¹ą¹ąøąø ISO",time:"ą¹ąø§ąø„ąø²ą¹ąøąø ISO",duration:"ąøą¹ąø§ąøą¹ąø§ąø„ąø²ą¹ąøąø ISO",ipv4:"ąøąøµą¹ąøąø¢ąø¹ą¹ IPv4",ipv6:"ąøąøµą¹ąøąø¢ąø¹ą¹ IPv6",cidrv4:"ąøą¹ąø§ąø IP ą¹ąøąø IPv4",cidrv6:"ąøą¹ąø§ąø IP ą¹ąøąø IPv6",base64:"ąøą¹ąøąøąø§ąø²ąø”ą¹ąøąø Base64",base64url:"ąøą¹ąøąøąø§ąø²ąø”ą¹ąøąø Base64 สำหรัภURL",json_string:"ąøą¹ąøąøąø§ąø²ąø”ą¹ąøąø JSON",e164:"ą¹ąøąøąø£ą¹ą¹ąøąø£ąøØąø±ąøąøą¹ąø£ąø°ąø«ąø§ą¹ąø²ąøąøąø£ąø°ą¹ąøąøØ (E.164)",jwt:"ą¹ąøą¹ąøąø JWT",template_literal:"ąøą¹ąøąø”ąø¹ąø„ąøąøµą¹ąøą¹ąøąø"},n={nan:"NaN",number:"ąøąø±ąø§ą¹ąø„ąø",array:"ąøąø²ąø£ą¹ą¹ąø£ąø¢ą¹ (Array)",null:"ą¹ąø”ą¹ąø”ąøµąøą¹ąø² (null)"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ąøąø£ąø°ą¹ąø ąøąøą¹ąøąø”ąø¹ąø„ą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøąø§ąø£ą¹ąøą¹ąø instanceof ${e.expected} ą¹ąøą¹ą¹ąøą¹ąø£ąø±ąø ${i}`:`ąøąø£ąø°ą¹ąø ąøąøą¹ąøąø”ąø¹ąø„ą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøąø§ąø£ą¹ąøą¹ąø ${t} ą¹ąøą¹ą¹ąøą¹ąø£ąø±ąø ${i}`}case"invalid_value":return 1===e.values.length?`ąøą¹ąø²ą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøąø§ąø£ą¹ąøą¹ąø ${Ya(e.values[0])}`:`ąøąø±ąø§ą¹ąø„ąø·ąøąøą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøąø§ąø£ą¹ąøą¹ąøąø«ąøąø¶ą¹ąøą¹ąø ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"ą¹ąø”ą¹ą¹ąøąø“ąø":"ąøą¹ąøąø¢ąøąø§ą¹ąø²",n=t(e.origin);return n?`ą¹ąøąø“ąøąøąø³ąø«ąøąø: ${e.origin??"ąøą¹ąø²"} ąøąø§ąø£ąø”ąøµ${r} ${e.maximum.toString()} ${n.unit??"ąø£ąø²ąø¢ąøąø²ąø£"}`:`ą¹ąøąø“ąøąøąø³ąø«ąøąø: ${e.origin??"ąøą¹ąø²"} ąøąø§ąø£ąø”ąøµ${r} ${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?"ąøąø¢ą¹ąø²ąøąøą¹ąøąø¢":"ąø”ąø²ąøąøąø§ą¹ąø²",n=t(e.origin);return n?`ąøą¹ąøąø¢ąøąø§ą¹ąø²ąøąø³ąø«ąøąø: ${e.origin} ąøąø§ąø£ąø”ąøµ${r} ${e.minimum.toString()} ${n.unit}`:`ąøą¹ąøąø¢ąøąø§ą¹ąø²ąøąø³ąø«ąøąø: ${e.origin} ąøąø§ąø£ąø”ąøµ${r} ${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ąø£ąø¹ąøą¹ąøąøą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøą¹ąøąøąø§ąø²ąø”ąøą¹ąøąøąøąø¶ą¹ąøąøą¹ąøąøą¹ąø§ąø¢ "${t.prefix}"`:"ends_with"===t.format?`ąø£ąø¹ąøą¹ąøąøą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøą¹ąøąøąø§ąø²ąø”ąøą¹ąøąøąø„ąøąøą¹ąø²ąø¢ąøą¹ąø§ąø¢ "${t.suffix}"`:"includes"===t.format?`ąø£ąø¹ąøą¹ąøąøą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøą¹ąøąøąø§ąø²ąø”ąøą¹ąøąøąø”ąøµ "${t.includes}" ąøąø¢ąø¹ą¹ą¹ąøąøą¹ąøąøąø§ąø²ąø”`:"regex"===t.format?`ąø£ąø¹ąøą¹ąøąøą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøą¹ąøąøąøąø£ąøąøąø±ąøąø£ąø¹ąøą¹ąøąøąøąøµą¹ąøąø³ąø«ąøąø ${t.pattern}`:`ąø£ąø¹ąøą¹ąøąøą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ${r[t.format]??e.format}`}case"not_multiple_of":return`ąøąø±ąø§ą¹ąø„ąøą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ąøą¹ąøąøą¹ąøą¹ąøąøąø³ąøąø§ąøąøąøµą¹ąø«ąø²ąø£ąøą¹ąø§ąø¢ ${e.divisor} ą¹ąøą¹ąø„ąøąøąø±ąø§`;case"unrecognized_keys":return`ąøąøąøąøµąø¢ą¹ąøąøµą¹ą¹ąø”ą¹ąø£ąø¹ą¹ąøąø±ąø: ${wa(e.keys,", ")}`;case"invalid_key":return`ąøąøµąø¢ą¹ą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąøą¹ąø ${e.origin}`;case"invalid_union":return"ąøą¹ąøąø”ąø¹ąø„ą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø: ą¹ąø”ą¹ąøąø£ąøąøąø±ąøąø£ąø¹ąøą¹ąøąøąø¢ąø¹ą¹ąøąøµąø¢ąøąøąøµą¹ąøąø³ąø«ąøąøą¹ąø§ą¹";case"invalid_element":return`ąøą¹ąøąø”ąø¹ąø„ą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąøą¹ąø ${e.origin}`;default:return"ąøą¹ąøąø”ąø¹ąø„ą¹ąø”ą¹ąøąø¹ąøąøą¹ąøąø"}}};function rf(){return{localeError:tf()}}var nf=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"ƶÄe",verb:"olmalı"},set:{unit:"ƶÄe",verb:"olmalı"}};function t(t){return e[t]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralıÄı",cidrv6:"IPv6 aralıÄı",base64:"base64 ile ÅifrelenmiÅ metin",base64url:"base64url ile ÅifrelenmiÅ metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Åablon dizesi"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`GeƧersiz deÄer: beklenen instanceof ${e.expected}, alınan ${i}`:`GeƧersiz deÄer: beklenen ${t}, alınan ${i}`}case"invalid_value":return 1===e.values.length?`GeƧersiz deÄer: beklenen ${Ya(e.values[0])}`:`GeƧersiz seƧenek: aÅaÄıdakilerden biri olmalı: ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Ćok büyük: beklenen ${e.origin??"deÄer"} ${r}${e.maximum.toString()} ${n.unit??"ƶÄe"}`:`Ćok büyük: beklenen ${e.origin??"deÄer"} ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Ćok küçük: beklenen ${e.origin} ${r}${e.minimum.toString()} ${n.unit}`:`Ćok küçük: beklenen ${e.origin} ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`GeƧersiz metin: "${t.prefix}" ile baÅlamalı`:"ends_with"===t.format?`GeƧersiz metin: "${t.suffix}" ile bitmeli`:"includes"===t.format?`GeƧersiz metin: "${t.includes}" iƧermeli`:"regex"===t.format?`GeƧersiz metin: ${t.pattern} desenine uymalı`:`GeƧersiz ${r[t.format]??e.format}`}case"not_multiple_of":return`GeƧersiz sayı: ${e.divisor} ile tam bƶlünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${e.keys.length>1?"lar":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`${e.origin} iƧinde geƧersiz anahtar`;case"invalid_union":default:return"GeƧersiz deÄer";case"invalid_element":return`${e.origin} iƧinde geƧersiz deÄer`}}};function of(){return{localeError:nf()}}var af=()=>{let e={string:{unit:"ŃŠøŠ¼Š²Š¾Š»Ńв",verb:"Š¼Š°ŃŠøŠ¼Šµ"},file:{unit:"байŃŃŠ²",verb:"Š¼Š°ŃŠøŠ¼Šµ"},array:{unit:"елеменŃŃŠ²",verb:"Š¼Š°ŃŠøŠ¼Šµ"},set:{unit:"елеменŃŃŠ²",verb:"Š¼Š°ŃŠøŠ¼Šµ"}};function t(t){return e[t]??null}let r={regex:"вŃ
ŃŠ“Š½Ń Š“Š°Š½Ń",email:"Š°Š“ŃŠµŃа елекŃŃŠ¾Š½Š½Š¾Ń поŃŃŠø",url:"URL",emoji:"емоГзŃ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"Š“Š°ŃŠ° ŃŠ° ŃŠ°Ń ISO",date:"Š“Š°ŃŠ° ISO",time:"ŃŠ°Ń ISO",duration:"ŃŃŠøŠ²Š°Š»ŃŃŃŃ ISO",ipv4:"Š°Š“ŃŠµŃа IPv4",ipv6:"Š°Š“ŃŠµŃа IPv6",cidrv4:"Š“ŃŠ°ŠæŠ°Š·Š¾Š½ IPv4",cidrv6:"Š“ŃŠ°ŠæŠ°Š·Š¾Š½ IPv6",base64:"ŃŃŠ“ок Ń ŠŗŠ¾Š“ŃŠ²Š°Š½Š½Ń base64",base64url:"ŃŃŠ“ок Ń ŠŗŠ¾Š“ŃŠ²Š°Š½Š½Ń base64url",json_string:"ŃŃŠ“ок JSON",e164:"Š½Š¾Š¼ŠµŃ E.164",jwt:"JWT",template_literal:"вŃ
ŃŠ“Š½Ń Š“Š°Š½Ń"},n={nan:"NaN",number:"ŃŠøŃло",array:"Š¼Š°ŃŠøŠ²"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½Ń вŃ
ŃŠ“Š½Ń Š“Š°Š½Ń: оŃŃŠŗŃŃŃŃŃŃ instanceof ${e.expected}, оŃŃŠøŠ¼Š°Š½Š¾ ${i}`:`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½Ń вŃ
ŃŠ“Š½Ń Š“Š°Š½Ń: оŃŃŠŗŃŃŃŃŃŃ ${t}, оŃŃŠøŠ¼Š°Š½Š¾ ${i}`}case"invalid_value":return 1===e.values.length?`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½Ń вŃ
ŃŠ“Š½Ń Š“Š°Š½Ń: оŃŃŠŗŃŃŃŃŃŃ ${Ya(e.values[0])}`:`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½Š° опŃŃŃ: оŃŃŠŗŃŃŃŃŃŃ Š¾Š“Š½Šµ Š· ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ŠŠ°Š½Š°Š“ŃŠ¾ велике: оŃŃŠŗŃŃŃŃŃŃ, ŃŠ¾ ${e.origin??"Š·Š½Š°ŃŠµŠ½Š½Ń"} ${n.verb} ${r}${e.maximum.toString()} ${n.unit??"елеменŃŃŠ²"}`:`ŠŠ°Š½Š°Š“ŃŠ¾ велике: оŃŃŠŗŃŃŃŃŃŃ, ŃŠ¾ ${e.origin??"Š·Š½Š°ŃŠµŠ½Š½Ń"} Š±ŃŠ“е ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ŠŠ°Š½Š°Š“ŃŠ¾ мале: оŃŃŠŗŃŃŃŃŃŃ, ŃŠ¾ ${e.origin} ${n.verb} ${r}${e.minimum.toString()} ${n.unit}`:`ŠŠ°Š½Š°Š“ŃŠ¾ мале: оŃŃŠŗŃŃŃŃŃŃ, ŃŠ¾ ${e.origin} Š±ŃŠ“е ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½ŠøŠ¹ ŃŃŠ“ок: повинен ŠæŠ¾ŃŠøŠ½Š°ŃŠøŃŃ Š· "${t.prefix}"`:"ends_with"===t.format?`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½ŠøŠ¹ ŃŃŠ“ок: повинен Š·Š°ŠŗŃнŃŃŠ²Š°ŃŠøŃŃ Š½Š° "${t.suffix}"`:"includes"===t.format?`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½ŠøŠ¹ ŃŃŠ“ок: повинен мŃŃŃŠøŃŠø "${t.includes}"`:"regex"===t.format?`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½ŠøŠ¹ ŃŃŠ“ок: повинен Š²ŃŠ“ŠæŠ¾Š²ŃŠ“Š°ŃŠø ŃŠ°Š±Š»Š¾Š½Ń ${t.pattern}`:`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½ŠøŠ¹ ${r[t.format]??e.format}`}case"not_multiple_of":return`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½Šµ ŃŠøŃло: повинно бŃŃŠø ŠŗŃŠ°Ńним ${e.divisor}`;case"unrecognized_keys":return`ŠŠµŃŠ¾Š·ŠæŃŠ·Š½Š°Š½ŠøŠ¹ ŠŗŠ»ŃŃ${e.keys.length>1?"Ń":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½ŠøŠ¹ ŠŗŠ»ŃŃ Ń ${e.origin}`;case"invalid_union":default:return"ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½Ń вŃ
ŃŠ“Š½Ń Š“Š°Š½Ń";case"invalid_element":return`ŠŠµŠæŃŠ°Š²ŠøŠ»ŃŠ½Šµ Š·Š½Š°ŃŠµŠ½Š½Ń Ń ${e.origin}`}}};function sf(){return{localeError:af()}}function cf(){return sf()}var uf=()=>{let e={string:{unit:"ŲŲ±ŁŁ",verb:"ŪŁŁŲ§"},file:{unit:"بائٹس",verb:"ŪŁŁŲ§"},array:{unit:"آئٹŁ
Ų²",verb:"ŪŁŁŲ§"},set:{unit:"آئٹŁ
Ų²",verb:"ŪŁŁŲ§"}};function t(t){return e[t]??null}let r={regex:"ا٠پٹ",email:"Ų§Ū Ł
ŪŁ Ų§ŪŚŲ±ŪŲ³",url:"ŪŁ Ų¢Ų± Ų§ŪŁ",emoji:"Ų§ŪŁ
ŁŲ¬Ū",uuid:"ŪŁ ŪŁ Ų¢Ų¦Ū ŚŪ",uuidv4:"ŪŁ ŪŁ Ų¢Ų¦Ū ŚŪ ŁŪ 4",uuidv6:"ŪŁ ŪŁ Ų¢Ų¦Ū ŚŪ ŁŪ 6",nanoid:"ŁŪŁŁ Ų¢Ų¦Ū ŚŪ",guid:"Ų¬Ū ŪŁ Ų¢Ų¦Ū ŚŪ",cuid:"Ų³Ū ŪŁ Ų¢Ų¦Ū ŚŪ",cuid2:"Ų³Ū ŪŁ Ų¢Ų¦Ū ŚŪ 2",ulid:"ŪŁ Ų§ŪŁ Ų¢Ų¦Ū ŚŪ",xid:"Ų§ŪŚ©Ų³ Ų¢Ų¦Ū ŚŪ",ksuid:"Ś©Ū Ų§ŪŲ³ ŪŁ Ų¢Ų¦Ū ŚŪ",datetime:"Ų¢Ų¦Ū Ų§ŪŲ³ Ų§Ł ŚŪٹ ٹائŁ
",date:"Ų¢Ų¦Ū Ų§ŪŲ³ Ų§Ł ŲŖŲ§Ų±ŪŲ®",time:"Ų¢Ų¦Ū Ų§ŪŲ³ Ų§Ł ŁŁŲŖ",duration:"Ų¢Ų¦Ū Ų§ŪŲ³ Ų§Ł Ł
ŲÆŲŖ",ipv4:"Ų¢Ų¦Ū Ł¾Ū ŁŪ 4 Ų§ŪŚŲ±ŪŲ³",ipv6:"Ų¢Ų¦Ū Ł¾Ū ŁŪ 6 Ų§ŪŚŲ±ŪŲ³",cidrv4:"Ų¢Ų¦Ū Ł¾Ū ŁŪ 4 Ų±ŪŁŲ¬",cidrv6:"Ų¢Ų¦Ū Ł¾Ū ŁŪ 6 Ų±ŪŁŲ¬",base64:"ŲØŪŲ³ 64 Ų§Ł Ś©ŁŚŚ Ų³Ł¹Ų±ŁŚÆ",base64url:"ŲØŪŲ³ 64 ŪŁ Ų¢Ų± Ų§ŪŁ Ų§Ł Ś©ŁŚŚ Ų³Ł¹Ų±ŁŚÆ",json_string:"Ų¬Ū Ų§ŪŲ³ Ų§Ł Ų§ŪŁ Ų³Ł¹Ų±ŁŚÆ",e164:"Ų§Ū 164 ŁŁ
ŲØŲ±",jwt:"Ų¬Ū ŚŲØŁŪŁ ٹŪ",template_literal:"ا٠پٹ"},n={nan:"NaN",number:"ŁŁ
ŲØŲ±",array:"Ų¢Ų±Ū",null:"ŁŁ"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ŲŗŁŲ· ا٠پٹ: instanceof ${e.expected} Ł
ŲŖŁŁŲ¹ ŲŖŚ¾Ų§Ų ${i} Ł
ŁŲµŁŁ ŪŁŲ§`:`ŲŗŁŲ· ا٠پٹ: ${t} Ł
ŲŖŁŁŲ¹ ŲŖŚ¾Ų§Ų ${i} Ł
ŁŲµŁŁ ŪŁŲ§`}case"invalid_value":return 1===e.values.length?`ŲŗŁŲ· ا٠پٹ: ${Ya(e.values[0])} Ł
ŲŖŁŁŲ¹ تھا`:`ŲŗŁŲ· آپؓŁ: ${wa(e.values,"|")} Ł
ŪŚŗ Ų³Ū Ų§ŪŚ© Ł
ŲŖŁŁŲ¹ تھا`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ŲØŪŲŖ ŲØŚŲ§: ${e.origin??"ŁŪŁŪŁ"} Ś©Ū ${r}${e.maximum.toString()} ${n.unit??"Ų¹ŁŲ§ŲµŲ±"} ŪŁŁŪ Ł
ŲŖŁŁŲ¹ تھŪ`:`ŲØŪŲŖ ŲØŚŲ§: ${e.origin??"ŁŪŁŪŁ"} کا ${r}${e.maximum.toString()} ŪŁŁŲ§ Ł
ŲŖŁŁŲ¹ تھا`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ŲØŪŲŖ ŚŚ¾ŁŁ¹Ų§: ${e.origin} Ś©Ū ${r}${e.minimum.toString()} ${n.unit} ŪŁŁŪ Ł
ŲŖŁŁŲ¹ تھŪ`:`ŲØŪŲŖ ŚŚ¾ŁŁ¹Ų§: ${e.origin} کا ${r}${e.minimum.toString()} ŪŁŁŲ§ Ł
ŲŖŁŁŲ¹ تھا`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ŲŗŁŲ· Ų³Ł¹Ų±ŁŚÆ: "${t.prefix}" Ų³Ū Ų“Ų±ŁŲ¹ ŪŁŁŲ§ ŚŲ§ŪŪŪ`:"ends_with"===t.format?`ŲŗŁŲ· Ų³Ł¹Ų±ŁŚÆ: "${t.suffix}" پر Ų®ŲŖŁ
ŪŁŁŲ§ ŚŲ§ŪŪŪ`:"includes"===t.format?`ŲŗŁŲ· Ų³Ł¹Ų±ŁŚÆ: "${t.includes}" Ų“Ų§Ł
Ł ŪŁŁŲ§ ŚŲ§ŪŪŪ`:"regex"===t.format?`ŲŗŁŲ· Ų³Ł¹Ų±ŁŚÆ: Ł¾ŪŁ¹Ų±Ł ${t.pattern} Ų³Ū Ł
ŪŚ ŪŁŁŲ§ ŚŲ§ŪŪŪ`:`ŲŗŁŲ· ${r[t.format]??e.format}`}case"not_multiple_of":return`ŲŗŁŲ· ŁŁ
ŲØŲ±: ${e.divisor} کا Ł
Ų¶Ų§Ų¹Ł ŪŁŁŲ§ ŚŲ§ŪŪŪ`;case"unrecognized_keys":return`ŲŗŪŲ± ŲŖŲ³ŁŪŁ
Ų“ŲÆŪ Ś©Ū${e.keys.length>1?"Ų²":""}: ${wa(e.keys,"Ų ")}`;case"invalid_key":return`${e.origin} Ł
ŪŚŗ ŲŗŁŲ· Ś©Ū`;case"invalid_union":default:return"ŲŗŁŲ· ا٠پٹ";case"invalid_element":return`${e.origin} Ł
ŪŚŗ ŲŗŁŲ· ŁŪŁŪŁ`}}};function df(){return{localeError:uf()}}var lf=()=>{let e={string:{unit:"belgi",verb:"boālishi kerak"},file:{unit:"bayt",verb:"boālishi kerak"},array:{unit:"element",verb:"boālishi kerak"},set:{unit:"element",verb:"boālishi kerak"}};function t(t){return e[t]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},n={nan:"NaN",number:"raqam",array:"massiv"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Notoāgāri kirish: kutilgan instanceof ${e.expected}, qabul qilingan ${i}`:`Notoāgāri kirish: kutilgan ${t}, qabul qilingan ${i}`}case"invalid_value":return 1===e.values.length?`Notoāgāri kirish: kutilgan ${Ya(e.values[0])}`:`Notoāgāri variant: quyidagilardan biri kutilgan ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Juda katta: kutilgan ${e.origin??"qiymat"} ${r}${e.maximum.toString()} ${n.unit} ${n.verb}`:`Juda katta: kutilgan ${e.origin??"qiymat"} ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`Juda kichik: kutilgan ${e.origin} ${r}${e.minimum.toString()} ${n.unit} ${n.verb}`:`Juda kichik: kutilgan ${e.origin} ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Notoāgāri satr: "${t.prefix}" bilan boshlanishi kerak`:"ends_with"===t.format?`Notoāgāri satr: "${t.suffix}" bilan tugashi kerak`:"includes"===t.format?`Notoāgāri satr: "${t.includes}" ni oāz ichiga olishi kerak`:"regex"===t.format?`Notoāgāri satr: ${t.pattern} shabloniga mos kelishi kerak`:`Notoāgāri ${r[t.format]??e.format}`}case"not_multiple_of":return`Notoāgāri raqam: ${e.divisor} ning karralisi boālishi kerak`;case"unrecognized_keys":return`Nomaālum kalit${e.keys.length>1?"lar":""}: ${wa(e.keys,", ")}`;case"invalid_key":return`${e.origin} dagi kalit notoāgāri`;case"invalid_union":default:return"Notoāgāri kirish";case"invalid_element":return`${e.origin} da notoāgāri qiymat`}}};function pf(){return{localeError:lf()}}var ff=()=>{let e={string:{unit:"ký tį»±",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phįŗ§n tį»",verb:"có"},set:{unit:"phįŗ§n tį»",verb:"có"}};function t(t){return e[t]??null}let r={regex:"Äįŗ§u vĆ o",email:"Äį»a chį» email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngĆ y giį» ISO",date:"ngĆ y ISO",time:"giį» ISO",duration:"khoįŗ£ng thį»i gian ISO",ipv4:"Äį»a chį» IPv4",ipv6:"Äį»a chį» IPv6",cidrv4:"dįŗ£i IPv4",cidrv6:"dįŗ£i IPv6",base64:"chuį»i mĆ£ hóa base64",base64url:"chuį»i mĆ£ hóa base64url",json_string:"chuį»i JSON",e164:"sį» E.164",jwt:"JWT",template_literal:"Äįŗ§u vĆ o"},n={nan:"NaN",number:"sį»",array:"mįŗ£ng"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`Äįŗ§u vĆ o khĆ“ng hợp lį»: mong Äợi instanceof ${e.expected}, nhįŗn Äược ${i}`:`Äįŗ§u vĆ o khĆ“ng hợp lį»: mong Äợi ${t}, nhįŗn Äược ${i}`}case"invalid_value":return 1===e.values.length?`Äįŗ§u vĆ o khĆ“ng hợp lį»: mong Äợi ${Ya(e.values[0])}`:`Tùy chį»n khĆ“ng hợp lį»: mong Äợi mį»t trong cĆ”c giĆ” trį» ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`QuĆ” lį»n: mong Äợi ${e.origin??"giĆ” trį»"} ${n.verb} ${r}${e.maximum.toString()} ${n.unit??"phįŗ§n tį»"}`:`QuĆ” lį»n: mong Äợi ${e.origin??"giĆ” trį»"} ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`QuĆ” nhį»: mong Äợi ${e.origin} ${n.verb} ${r}${e.minimum.toString()} ${n.unit}`:`QuĆ” nhį»: mong Äợi ${e.origin} ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`Chuį»i khĆ“ng hợp lį»: phįŗ£i bįŗÆt Äįŗ§u bįŗ±ng "${t.prefix}"`:"ends_with"===t.format?`Chuį»i khĆ“ng hợp lį»: phįŗ£i kįŗæt thĆŗc bįŗ±ng "${t.suffix}"`:"includes"===t.format?`Chuį»i khĆ“ng hợp lį»: phįŗ£i bao gį»m "${t.includes}"`:"regex"===t.format?`Chuį»i khĆ“ng hợp lį»: phįŗ£i khį»p vį»i mįŗ«u ${t.pattern}`:`${r[t.format]??e.format} khĆ“ng hợp lį»`}case"not_multiple_of":return`Sį» khĆ“ng hợp lį»: phįŗ£i lĆ bį»i sį» cį»§a ${e.divisor}`;case"unrecognized_keys":return`Khóa khĆ“ng Äược nhįŗn dįŗ”ng: ${wa(e.keys,", ")}`;case"invalid_key":return`Khóa khĆ“ng hợp lį» trong ${e.origin}`;case"invalid_union":default:return"Äįŗ§u vĆ o khĆ“ng hợp lį»";case"invalid_element":return`GiĆ” trį» khĆ“ng hợp lį» trong ${e.origin}`}}};function hf(){return{localeError:ff()}}var mf=()=>{let e={string:{unit:"å符",verb:"å
å«"},file:{unit:"åč",verb:"å
å«"},array:{unit:"锹",verb:"å
å«"},set:{unit:"锹",verb:"å
å«"}};function t(t){return e[t]??null}let r={regex:"č¾å
„",email:"ēµåé®ä»¶",url:"URL",emoji:"蔨ę
符å·",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISOę„ęę¶é“",date:"ISOę„ę",time:"ISOę¶é“",duration:"ISOę¶éæ",ipv4:"IPv4å°å",ipv6:"IPv6å°å",cidrv4:"IPv4ē½ę®µ",cidrv6:"IPv6ē½ę®µ",base64:"base64ē¼ē å符串",base64url:"base64urlē¼ē å符串",json_string:"JSONå符串",e164:"E.164å·ē ",jwt:"JWT",template_literal:"č¾å
„"},n={nan:"NaN",number:"ę°å",array:"ę°ē»",null:"空å¼(null)"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ę ęč¾å
„ļ¼ęę instanceof ${e.expected}ļ¼å®é
ę„ę¶ ${i}`:`ę ęč¾å
„ļ¼ęę ${t}ļ¼å®é
ę„ę¶ ${i}`}case"invalid_value":return 1===e.values.length?`ę ęč¾å
„ļ¼ęę ${Ya(e.values[0])}`:`ę ęé锹ļ¼ęę仄äøä¹äø ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ę°å¼čæå¤§ļ¼ęę ${e.origin??"å¼"} ${r}${e.maximum.toString()} ${n.unit??"äøŖå
ē“ "}`:`ę°å¼čæå¤§ļ¼ęę ${e.origin??"å¼"} ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ę°å¼čæå°ļ¼ęę ${e.origin} ${r}${e.minimum.toString()} ${n.unit}`:`ę°å¼čæå°ļ¼ęę ${e.origin} ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ę ęå符串ļ¼åæ
锻仄 "${t.prefix}" å¼å¤“`:"ends_with"===t.format?`ę ęå符串ļ¼åæ
锻仄 "${t.suffix}" ē»å°¾`:"includes"===t.format?`ę ęå符串ļ¼åæ
é”»å
å« "${t.includes}"`:"regex"===t.format?`ę ęå符串ļ¼åæ
锻滔足ę£åč”Øč¾¾å¼ ${t.pattern}`:`ę ę${r[t.format]??e.format}`}case"not_multiple_of":return`ę ęę°åļ¼åæ
é”»ęÆ ${e.divisor} ēåę°`;case"unrecognized_keys":return`åŗē°ęŖē„ēé®(key): ${wa(e.keys,", ")}`;case"invalid_key":return`${e.origin} äøēé®(key)ę ę`;case"invalid_union":default:return"ę ęč¾å
„";case"invalid_element":return`${e.origin} äøå
å«ę ęå¼(value)`}}};function gf(){return{localeError:mf()}}var vf=()=>{let e={string:{unit:"åå
",verb:"ęę"},file:{unit:"ä½å
ēµ",verb:"ęę"},array:{unit:"é
ē®",verb:"ęę"},set:{unit:"é
ē®",verb:"ęę"}};function t(t){return e[t]??null}let r={regex:"č¼øå
„",email:"éµä»¶å°å",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ę„ęęé",date:"ISO ę„ę",time:"ISO ęé",duration:"ISO ęé",ipv4:"IPv4 ä½å",ipv6:"IPv6 ä½å",cidrv4:"IPv4 ēÆå",cidrv6:"IPv6 ēÆå",base64:"base64 編碼åäø²",base64url:"base64url 編碼åäø²",json_string:"JSON åäø²",e164:"E.164 ęøå¼",jwt:"JWT",template_literal:"č¼øå
„"},n={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ē”ęēč¼øå
„å¼ļ¼é ęēŗ instanceof ${e.expected}ļ¼ä½ę¶å° ${i}`:`ē”ęēč¼øå
„å¼ļ¼é ęēŗ ${t}ļ¼ä½ę¶å° ${i}`}case"invalid_value":return 1===e.values.length?`ē”ęēč¼øå
„å¼ļ¼é ęēŗ ${Ya(e.values[0])}`:`ē”ęēéøé
ļ¼é ęēŗä»„äøå
¶äøä¹äø ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`ęøå¼é大ļ¼é ę ${e.origin??"å¼"} ęēŗ ${r}${e.maximum.toString()} ${n.unit??"åå
ē“ "}`:`ęøå¼é大ļ¼é ę ${e.origin??"å¼"} ęēŗ ${r}${e.maximum.toString()}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`ęøå¼éå°ļ¼é ę ${e.origin} ęēŗ ${r}${e.minimum.toString()} ${n.unit}`:`ęøå¼éå°ļ¼é ę ${e.origin} ęēŗ ${r}${e.minimum.toString()}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`ē”ęēåäø²ļ¼åæ
é 仄 "${t.prefix}" éé `:"ends_with"===t.format?`ē”ęēåäø²ļ¼åæ
é 仄 "${t.suffix}" ēµå°¾`:"includes"===t.format?`ē”ęēåäø²ļ¼åæ
é å
å« "${t.includes}"`:"regex"===t.format?`ē”ęēåäø²ļ¼åæ
é 符åę ¼å¼ ${t.pattern}`:`ē”ęē ${r[t.format]??e.format}`}case"not_multiple_of":return`ē”ęēęøåļ¼åæ
é ēŗ ${e.divisor} ēåęø`;case"unrecognized_keys":return`ē”ę³čå„ēéµå¼${e.keys.length>1?"å":""}ļ¼${wa(e.keys,"ć")}`;case"invalid_key":return`${e.origin} äøęē”ęēéµå¼`;case"invalid_union":default:return"ē”ęēč¼øå
„å¼";case"invalid_element":return`${e.origin} äøęē”ęēå¼`}}};function yf(){return{localeError:vf()}}var _f=()=>{let e={string:{unit:"Ć mi",verb:"nĆ"},file:{unit:"bytes",verb:"nĆ"},array:{unit:"nkan",verb:"nĆ"},set:{unit:"nkan",verb:"nĆ"}};function t(t){return e[t]??null}let r={regex:"įŗ¹ĢrỠìbĆ”wį»lĆ©",email:"Ć dĆrįŗ¹ĢsƬ Ƭmįŗ¹ĢlƬ",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"Ć kókò ISO",date:"į»jį»Ģ ISO",time:"Ć kókò ISO",duration:"Ć kókò tó pĆ© ISO",ipv4:"Ć dĆrįŗ¹ĢsƬ IPv4",ipv6:"Ć dĆrįŗ¹ĢsƬ IPv6",cidrv4:"Ć gbĆØgbĆØ IPv4",cidrv6:"Ć gbĆØgbĆØ IPv6",base64:"į»Ģrį»Ģ tĆ a kį»Ģ nĆ base64",base64url:"į»Ģrį»Ģ base64url",json_string:"į»Ģrį»Ģ JSON",e164:"nį»ĢmbĆ E.164",jwt:"JWT",template_literal:"įŗ¹ĢrỠìbĆ”wį»lĆ©"},n={nan:"NaN",number:"nį»ĢmbĆ ",array:"akopį»"};return e=>{switch(e.code){case"invalid_type":{let t=n[e.expected]??e.expected,r=hs(e.input),i=n[r]??r;return/^[A-Z]/.test(e.expected)?`ĆbĆ”wį»lĆ© aṣìṣe: a nĆ lĆ”ti fi instanceof ${e.expected}, Ć mį»Ģ a rĆ ${i}`:`ĆbĆ”wį»lĆ© aṣìṣe: a nĆ lĆ”ti fi ${t}, Ć mį»Ģ a rĆ ${i}`}case"invalid_value":return 1===e.values.length?`ĆbĆ”wį»lĆ© aṣìṣe: a nĆ lĆ”ti fi ${Ya(e.values[0])}`:`Ćṣà yĆ n aṣìṣe: yan į»Ģkan lĆ”ra ${wa(e.values,"|")}`;case"too_big":{let r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Tó pį»Ģ jù: a nĆ lĆ”ti jįŗ¹Ģ pĆ© ${e.origin??"iye"} ${n.verb} ${r}${e.maximum} ${n.unit}`:`Tó pį»Ģ jù: a nĆ lĆ”ti jįŗ¹Ģ ${r}${e.maximum}`}case"too_small":{let r=e.inclusive?">=":">",n=t(e.origin);return n?`KĆ©rĆ© ju: a nĆ lĆ”ti jįŗ¹Ģ pĆ© ${e.origin} ${n.verb} ${r}${e.minimum} ${n.unit}`:`KĆ©rĆ© ju: a nĆ lĆ”ti jįŗ¹Ģ ${r}${e.minimum}`}case"invalid_format":{let t=e;return"starts_with"===t.format?`į»Ģrį»Ģ aṣìṣe: gbį»Ģdį»Ģ bįŗ¹Ģrįŗ¹Ģ pįŗ¹ĢlĆŗ "${t.prefix}"`:"ends_with"===t.format?`į»Ģrį»Ģ aṣìṣe: gbį»Ģdį»Ģ parĆ pįŗ¹ĢlĆŗ "${t.suffix}"`:"includes"===t.format?`į»Ģrį»Ģ aṣìṣe: gbį»Ģdį»Ģ nĆ "${t.includes}"`:"regex"===t.format?`į»Ģrį»Ģ aṣìṣe: gbį»Ģdį»Ģ bĆ” Ć pẹẹrįŗ¹ mu ${t.pattern}`:`Aṣìṣe: ${r[t.format]??e.format}`}case"not_multiple_of":return`Nį»ĢmbĆ aṣìṣe: gbį»Ģdį»Ģ jįŗ¹Ģ ĆØyĆ pĆpĆn ti ${e.divisor}`;case"unrecognized_keys":return`Bį»tƬnƬ à ìmį»Ģ: ${wa(e.keys,", ")}`;case"invalid_key":return`Bį»tƬnƬ aṣìṣe nĆnĆŗ ${e.origin}`;case"invalid_union":default:return"ĆbĆ”wį»lĆ© aṣìṣe";case"invalid_element":return`Iye aṣìṣe nĆnĆŗ ${e.origin}`}}};function bf(){return{localeError:_f()}}var wf,$f=Symbol("ZodOutput"),kf=Symbol("ZodInput");class Sf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function If(){return new Sf}(wf=globalThis).__zod_globalRegistry??(wf.__zod_globalRegistry=If());var Pf=globalThis.__zod_globalRegistry;function Ef(e,t){return new e({type:"string",...Ba(t)})}function xf(e,t){return new e({type:"string",coerce:!0,...Ba(t)})}function Of(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ba(t)})}function Tf(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ba(t)})}function Af(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ba(t)})}function Cf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ba(t)})}function jf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ba(t)})}function Df(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ba(t)})}function zf(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ba(t)})}function Nf(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ba(t)})}function Rf(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ba(t)})}function Uf(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ba(t)})}function Mf(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ba(t)})}function Kf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ba(t)})}function Zf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ba(t)})}function Jf(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ba(t)})}function Lf(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ba(t)})}function Wf(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ba(t)})}function Ff(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...Ba(t)})}function Vf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ba(t)})}function Hf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ba(t)})}function qf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ba(t)})}function Bf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ba(t)})}function Gf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ba(t)})}function Yf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ba(t)})}var Xf={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Qf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ba(t)})}function eh(e,t){return new e({type:"string",format:"date",check:"string_format",...Ba(t)})}function th(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ba(t)})}function rh(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ba(t)})}function nh(e,t){return new e({type:"number",checks:[],...Ba(t)})}function ih(e,t){return new e({type:"number",coerce:!0,checks:[],...Ba(t)})}function oh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ba(t)})}function ah(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...Ba(t)})}function sh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...Ba(t)})}function ch(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...Ba(t)})}function uh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...Ba(t)})}function dh(e,t){return new e({type:"boolean",...Ba(t)})}function lh(e,t){return new e({type:"boolean",coerce:!0,...Ba(t)})}function ph(e,t){return new e({type:"bigint",...Ba(t)})}function fh(e,t){return new e({type:"bigint",coerce:!0,...Ba(t)})}function hh(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Ba(t)})}function mh(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Ba(t)})}function gh(e,t){return new e({type:"symbol",...Ba(t)})}function vh(e,t){return new e({type:"undefined",...Ba(t)})}function yh(e,t){return new e({type:"null",...Ba(t)})}function _h(e){return new e({type:"any"})}function bh(e){return new e({type:"unknown"})}function wh(e,t){return new e({type:"never",...Ba(t)})}function $h(e,t){return new e({type:"void",...Ba(t)})}function kh(e,t){return new e({type:"date",...Ba(t)})}function Sh(e,t){return new e({type:"date",coerce:!0,...Ba(t)})}function Ih(e,t){return new e({type:"nan",...Ba(t)})}function Ph(e,t){return new hu({check:"less_than",...Ba(t),value:e,inclusive:!1})}function Eh(e,t){return new hu({check:"less_than",...Ba(t),value:e,inclusive:!0})}function xh(e,t){return new mu({check:"greater_than",...Ba(t),value:e,inclusive:!1})}function Oh(e,t){return new mu({check:"greater_than",...Ba(t),value:e,inclusive:!0})}function Th(e){return xh(0,e)}function Ah(e){return Ph(0,e)}function Ch(e){return Eh(0,e)}function jh(e){return Oh(0,e)}function Dh(e,t){return new gu({check:"multiple_of",...Ba(t),value:e})}function zh(e,t){return new _u({check:"max_size",...Ba(t),maximum:e})}function Nh(e,t){return new bu({check:"min_size",...Ba(t),minimum:e})}function Rh(e,t){return new wu({check:"size_equals",...Ba(t),size:e})}function Uh(e,t){return new $u({check:"max_length",...Ba(t),maximum:e})}function Mh(e,t){return new ku({check:"min_length",...Ba(t),minimum:e})}function Kh(e,t){return new Su({check:"length_equals",...Ba(t),length:e})}function Zh(e,t){return new Pu({check:"string_format",format:"regex",...Ba(t),pattern:e})}function Jh(e){return new Eu({check:"string_format",format:"lowercase",...Ba(e)})}function Lh(e){return new xu({check:"string_format",format:"uppercase",...Ba(e)})}function Wh(e,t){return new Ou({check:"string_format",format:"includes",...Ba(t),includes:e})}function Fh(e,t){return new Tu({check:"string_format",format:"starts_with",...Ba(t),prefix:e})}function Vh(e,t){return new Au({check:"string_format",format:"ends_with",...Ba(t),suffix:e})}function Hh(e,t,r){return new ju({check:"property",property:e,schema:t,...Ba(r)})}function qh(e,t){return new Du({check:"mime_type",mime:e,...Ba(t)})}function Bh(e){return new zu({check:"overwrite",tx:e})}function Gh(e){return Bh(t=>t.normalize(e))}function Yh(){return Bh(e=>e.trim())}function Xh(){return Bh(e=>e.toLowerCase())}function Qh(){return Bh(e=>e.toUpperCase())}function em(){return Bh(e=>Ra(e))}function tm(e,t,r){return new e({type:"array",element:t,...Ba(r)})}function rm(e,t,r){return new e({type:"union",options:t,...Ba(r)})}function nm(e,t,r){return new e({type:"union",options:t,inclusive:!1,...Ba(r)})}function im(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...Ba(n)})}function om(e,t,r){return new e({type:"intersection",left:t,right:r})}function am(e,t,r,n){let i=r instanceof Uu;return new e({type:"tuple",items:t,rest:i?r:null,...Ba(i?n:r)})}function sm(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...Ba(n)})}function cm(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...Ba(n)})}function um(e,t,r){return new e({type:"set",valueType:t,...Ba(r)})}function dm(e,t,r){return new e({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...Ba(r)})}function lm(e,t,r){return new e({type:"enum",entries:t,...Ba(r)})}function pm(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...Ba(r)})}function fm(e,t){return new e({type:"file",...Ba(t)})}function hm(e,t){return new e({type:"transform",transform:t})}function mm(e,t){return new e({type:"optional",innerType:t})}function gm(e,t){return new e({type:"nullable",innerType:t})}function vm(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():Ja(r)}})}function ym(e,t,r){return new e({type:"nonoptional",innerType:t,...Ba(r)})}function _m(e,t){return new e({type:"success",innerType:t})}function bm(e,t,r){return new e({type:"catch",innerType:t,catchValue:"function"==typeof r?r:()=>r})}function wm(e,t,r){return new e({type:"pipe",in:t,out:r})}function $m(e,t){return new e({type:"readonly",innerType:t})}function km(e,t,r){return new e({type:"template_literal",parts:t,...Ba(r)})}function Sm(e,t){return new e({type:"lazy",getter:t})}function Im(e,t){return new e({type:"promise",innerType:t})}function Pm(e,t,r){let n=Ba(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Em(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ba(r)})}function xm(e){let t=Om(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(ms(e,r.value,t._zod.def));else{let n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(ms(n))}},e(r.value,r)));return t}function Om(e,t){let r=new pu({check:"custom",...Ba(t)});return r._zod.check=e,r}function Tm(e){let t=new pu({check:"describe"});return t._zod.onattach=[t=>{let r=Pf.get(t)??{};Pf.add(t,{...r,description:e})}],t._zod.check=()=>{},t}function Am(e){let t=new pu({check:"meta"});return t._zod.onattach=[t=>{let r=Pf.get(t)??{};Pf.add(t,{...r,...e})}],t._zod.check=()=>{},t}function Cm(e,t){let r=Ba(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];"sensitive"!==r.case&&(n=n.map(e=>"string"==typeof e?e.toLowerCase():e),i=i.map(e=>"string"==typeof e?e.toLowerCase():e));let o=new Set(n),a=new Set(i),s=e.Codec??hl,c=e.Boolean??vd,u=new s({type:"pipe",in:new(e.String??Mu)({type:"string",error:r.error}),out:new c({type:"boolean",error:r.error}),transform:(e,t)=>{let n=e;return"sensitive"!==r.case&&(n=n.toLowerCase()),!!o.has(n)||!a.has(n)&&(t.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:t.value,inst:u,continue:!1}),{})},reverseTransform:(e,t)=>!0===e?n[0]||"true":i[0]||"false",error:r.error});return u}function jm(e,t,r,n={}){let i=Ba(n),o={...Ba(n),check:"string_format",type:"string",format:t,fn:"function"==typeof r?r:e=>r.test(e),...i};return r instanceof RegExp&&(o.pattern=r),new e(o)}function Dm(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Pf,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function zm(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,n);else{let r=a.schema,o=t.processors[i.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,r,n)}let o=e._zod.parent;o&&(a.ref||(a.ref=o),zm(o,t,n),t.seen.get(o).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),"input"===t.io&&Um(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Nm(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=n.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let n=t[1],{ref:i,defId:o}=(t=>{let n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};let i=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);n.def={...n.schema},o&&(n.defId=o);let a=n.schema;for(let e in a)delete a[e];a.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t!==r[0]){if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&i(r)}else i(r)}}function Rm(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,o={...i},a=r.ref;if(r.ref=null,a){n(a);let r=e.seen.get(a),s=r.schema;if(!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,s):(i.allOf=i.allOf??[],i.allOf.push(s)),Object.assign(i,o),t._zod.parent===a)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(s.$ref)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==a){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Km(t,"input",e.processors),output:Km(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}function Um(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return Um(n.element,r);if("set"===n.type)return Um(n.valueType,r);if("lazy"===n.type)return Um(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return Um(n.innerType,r);if("intersection"===n.type)return Um(n.left,r)||Um(n.right,r);if("record"===n.type||"map"===n.type)return Um(n.keyType,r)||Um(n.valueType,r);if("pipe"===n.type)return Um(n.in,r)||Um(n.out,r);if("object"===n.type){for(let e in n.shape)if(Um(n.shape[e],r))return!0;return!1}if("union"===n.type){for(let e of n.options)if(Um(e,r))return!0;return!1}if("tuple"===n.type){for(let e of n.items)if(Um(e,r))return!0;return!(!n.rest||!Um(n.rest,r))}return!1}var Mm=(e,t={})=>r=>{let n=Dm({...r,processors:t});return zm(e,n),Nm(n,e),Rm(n,e)},Km=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=Dm({...i??{},target:o,io:t,processors:r});return zm(e,a),Nm(a,e),Rm(a,e)},Zm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Jm=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if("number"==typeof o&&(i.minLength=o),"number"==typeof a&&(i.maxLength=a),s&&(i.format=Zm[s]??s,""===i.format&&delete i.format,"time"===s&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let e=[...c];1===e.length?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},Lm=(e,t,r,n)=>{let i=r,{minimum:o,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;"string"==typeof s&&s.includes("int")?i.type="integer":i.type="number","number"==typeof d&&("draft-04"===t.target||"openapi-3.0"===t.target?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d),"number"==typeof o&&(i.minimum=o,"number"==typeof d&&"draft-04"!==t.target&&(d>=o?delete i.minimum:delete i.exclusiveMinimum)),"number"==typeof u&&("draft-04"===t.target||"openapi-3.0"===t.target?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),"number"==typeof a&&(i.maximum=a,"number"==typeof u&&"draft-04"!==t.target&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),"number"==typeof c&&(i.multipleOf=c)},Wm=(e,t,r,n)=>{r.type="boolean"},Fm=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},Vm=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},Hm=(e,t,r,n)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},qm=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},Bm=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},Gm=(e,t,r,n)=>{r.not={}},Ym=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},Xm=(e,t,r,n)=>{let i=ba(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},Qm=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(e))}else o.push(e);if(0===o.length);else if(1===o.length){let e=o[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else o.every(e=>"number"==typeof e)&&(r.type="number"),o.every(e=>"string"==typeof e)&&(r.type="string"),o.every(e=>"boolean"==typeof e)&&(r.type="boolean"),o.every(e=>null===e)&&(r.type="null"),r.enum=o},eg=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},tg=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},rg=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;void 0!==a&&(o.minLength=a),void 0!==s&&(o.maxLength=s),c?1===c.length?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,o)},ng=(e,t,r,n)=>{r.type="boolean"},ig=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},og=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},ag=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},sg=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},cg=(e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},ug=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;"number"==typeof a&&(i.minItems=a),"number"==typeof s&&(i.maxItems=s),i.type="array",i.items=zm(o.element,t,{...n,path:[...n.path,"items"]})},dg=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let a=o.shape;for(let e in a)i.properties[e]=zm(a[e],t,{...n,path:[...n.path,"properties",e]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(e=>{let r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(i.required=Array.from(c)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=zm(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)},lg=(e,t,r,n)=>{let i=e._zod.def,o=!1===i.inclusive,a=i.options.map((e,r)=>zm(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=a:r.anyOf=a},pg=(e,t,r,n)=>{let i=e._zod.def,o=zm(i.left,t,{...n,path:[...n.path,"allOf",0]}),a=zm(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];r.allOf=c},fg=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let a="draft-2020-12"===t.target?"prefixItems":"items",s="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",c=o.items.map((e,r)=>zm(e,t,{...n,path:[...n.path,a,r]})),u=o.rest?zm(o.rest,t,{...n,path:[...n.path,s,..."openapi-3.0"===t.target?[o.items.length]:[]]}):null;"draft-2020-12"===t.target?(i.prefixItems=c,u&&(i.items=u)):"openapi-3.0"===t.target?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));let{minimum:d,maximum:l}=e._zod.bag;"number"==typeof d&&(i.minItems=d),"number"==typeof l&&(i.maxItems=l)},hg=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let a=o.keyType,s=a._zod.bag?.patterns;if("loose"===o.mode&&s&&s.size>0){let e=zm(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=zm(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=zm(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let c=a._zod.values;if(c){let e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(i.required=e)}},mg=(e,t,r,n)=>{let i=e._zod.def,o=zm(i.innerType,t,n),a=t.seen.get(e);"openapi-3.0"===t.target?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},gg=(e,t,r,n)=>{let i=e._zod.def;zm(i.innerType,t,n),t.seen.get(e).ref=i.innerType},vg=(e,t,r,n)=>{let i=e._zod.def;zm(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},yg=(e,t,r,n)=>{let i=e._zod.def;zm(i.innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},_g=(e,t,r,n)=>{let i,o=e._zod.def;zm(o.innerType,t,n),t.seen.get(e).ref=o.innerType;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},bg=(e,t,r,n)=>{let i=e._zod.def,o="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out;zm(o,t,n),t.seen.get(e).ref=o},wg=(e,t,r,n)=>{let i=e._zod.def;zm(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},$g=(e,t,r,n)=>{let i=e._zod.def;zm(i.innerType,t,n),t.seen.get(e).ref=i.innerType},kg=(e,t,r,n)=>{let i=e._zod.def;zm(i.innerType,t,n),t.seen.get(e).ref=i.innerType},Sg=(e,t,r,n)=>{let i=e._zod.innerType;zm(i,t,n),t.seen.get(e).ref=i},Ig={string:Jm,number:Lm,boolean:Wm,bigint:Fm,symbol:Vm,null:Hm,undefined:qm,void:Bm,never:Gm,any:(e,t,r,n)=>{},unknown:(e,t,r,n)=>{},date:Ym,enum:Xm,literal:Qm,nan:eg,template_literal:tg,file:rg,success:ng,custom:ig,function:og,transform:ag,map:sg,set:cg,array:ug,object:dg,union:lg,intersection:pg,tuple:fg,record:hg,nullable:mg,nonoptional:gg,default:vg,prefault:yg,catch:_g,pipe:bg,readonly:wg,promise:$g,optional:kg,lazy:Sg};function Pg(e,t){if("_idmap"in e){let r=e,n=Dm({...t,processors:Ig}),i={};for(let e of r._idmap.entries()){let[t,r]=e;zm(r,n)}let o={},a={registry:r,uri:t?.uri,defs:i};n.external=a;for(let e of r._idmap.entries()){let[t,r]=e;Nm(n,r),o[t]=Rm(n,r)}if(Object.keys(i).length>0){let e="draft-2020-12"===n.target?"$defs":"definitions";o.__shared={[e]:i}}return{schemas:o}}let r=Dm({...t,processors:Ig});return zm(e,r),Nm(r,e),Rm(r,e)}class Eg{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),this.ctx=Dm({processors:Ig,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return zm(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),Nm(this.ctx,e);let r=Rm(this.ctx,e),{"~standard":n,...i}=r;return i}}var xg={},Og={};ia(Og,{xor:()=>Jy,xid:()=>Ov,void:()=>Oy,uuidv7:()=>hv,uuidv6:()=>fv,uuidv4:()=>pv,uuid:()=>lv,url:()=>gv,unknown:()=>Iy,union:()=>Ky,undefined:()=>_y,ulid:()=>Ev,uint64:()=>my,uint32:()=>cy,tuple:()=>qy,transform:()=>l_,templateLiteral:()=>U_,symbol:()=>vy,superRefine:()=>B_,success:()=>P_,stringbool:()=>Q_,stringFormat:()=>Yv,string:()=>iv,strictObject:()=>Ry,set:()=>r_,refine:()=>q_,record:()=>Gy,readonly:()=>N_,promise:()=>J_,preprocess:()=>tb,prefault:()=>$_,pipe:()=>C_,partialRecord:()=>Yy,optional:()=>f_,object:()=>Ny,number:()=>ry,nullish:()=>y_,nullable:()=>v_,null:()=>wy,nonoptional:()=>S_,never:()=>Ey,nativeEnum:()=>o_,nanoid:()=>wv,nan:()=>T_,meta:()=>Y_,map:()=>e_,mac:()=>zv,looseRecord:()=>Xy,looseObject:()=>Uy,literal:()=>s_,lazy:()=>K_,ksuid:()=>Av,keyof:()=>Dy,jwt:()=>Bv,json:()=>eb,ipv6:()=>Rv,ipv4:()=>jv,intersection:()=>Vy,int64:()=>hy,int32:()=>sy,int:()=>iy,instanceof:()=>X_,httpUrl:()=>vv,hostname:()=>Xv,hex:()=>Qv,hash:()=>ey,guid:()=>uv,function:()=>W_,float64:()=>ay,float32:()=>oy,file:()=>u_,exactOptional:()=>m_,enum:()=>i_,emoji:()=>_v,email:()=>sv,e164:()=>Hv,discriminatedUnion:()=>Wy,describe:()=>G_,date:()=>Ay,custom:()=>H_,cuid2:()=>Iv,cuid:()=>kv,codec:()=>D_,cidrv6:()=>Zv,cidrv4:()=>Mv,check:()=>V_,catch:()=>x_,boolean:()=>dy,bigint:()=>py,base64url:()=>Fv,base64:()=>Lv,array:()=>jy,any:()=>ky,_function:()=>W_,_default:()=>b_,_ZodString:()=>rv,ZodXor:()=>Zy,ZodXID:()=>xv,ZodVoid:()=>xy,ZodUnknown:()=>Sy,ZodUnion:()=>My,ZodUndefined:()=>yy,ZodUUID:()=>dv,ZodURL:()=>mv,ZodULID:()=>Pv,ZodType:()=>tv,ZodTuple:()=>Hy,ZodTransform:()=>d_,ZodTemplateLiteral:()=>R_,ZodSymbol:()=>gy,ZodSuccess:()=>I_,ZodStringFormat:()=>ov,ZodString:()=>nv,ZodSet:()=>t_,ZodRecord:()=>By,ZodReadonly:()=>z_,ZodPromise:()=>Z_,ZodPrefault:()=>w_,ZodPipe:()=>A_,ZodOptional:()=>p_,ZodObject:()=>zy,ZodNumberFormat:()=>ny,ZodNumber:()=>ty,ZodNullable:()=>g_,ZodNull:()=>by,ZodNonOptional:()=>k_,ZodNever:()=>Py,ZodNanoID:()=>bv,ZodNaN:()=>O_,ZodMap:()=>Qy,ZodMAC:()=>Dv,ZodLiteral:()=>a_,ZodLazy:()=>M_,ZodKSUID:()=>Tv,ZodJWT:()=>qv,ZodIntersection:()=>Fy,ZodIPv6:()=>Nv,ZodIPv4:()=>Cv,ZodGUID:()=>cv,ZodFunction:()=>L_,ZodFile:()=>c_,ZodExactOptional:()=>h_,ZodEnum:()=>n_,ZodEmoji:()=>yv,ZodEmail:()=>av,ZodE164:()=>Vv,ZodDiscriminatedUnion:()=>Ly,ZodDefault:()=>__,ZodDate:()=>Ty,ZodCustomStringFormat:()=>Gv,ZodCustom:()=>F_,ZodCodec:()=>j_,ZodCatch:()=>E_,ZodCUID2:()=>Sv,ZodCUID:()=>$v,ZodCIDRv6:()=>Kv,ZodCIDRv4:()=>Uv,ZodBoolean:()=>uy,ZodBigIntFormat:()=>fy,ZodBigInt:()=>ly,ZodBase64URL:()=>Wv,ZodBase64:()=>Jv,ZodArray:()=>Cy,ZodAny:()=>$y});var Tg={};ia(Tg,{uppercase:()=>Lh,trim:()=>Yh,toUpperCase:()=>Qh,toLowerCase:()=>Xh,startsWith:()=>Fh,slugify:()=>em,size:()=>Rh,regex:()=>Zh,property:()=>Hh,positive:()=>Th,overwrite:()=>Bh,normalize:()=>Gh,nonpositive:()=>Ch,nonnegative:()=>jh,negative:()=>Ah,multipleOf:()=>Dh,minSize:()=>Nh,minLength:()=>Mh,mime:()=>qh,maxSize:()=>zh,maxLength:()=>Uh,lte:()=>Eh,lt:()=>Ph,lowercase:()=>Jh,length:()=>Kh,includes:()=>Wh,gte:()=>Oh,gt:()=>xh,endsWith:()=>Vh});var Ag={};ia(Ag,{time:()=>Rg,duration:()=>Mg,datetime:()=>jg,date:()=>zg,ZodISOTime:()=>Ng,ZodISODuration:()=>Ug,ZodISODateTime:()=>Cg,ZodISODate:()=>Dg});var Cg=ca("ZodISODateTime",(e,t)=>{Xu.init(e,t),ov.init(e,t)});function jg(e){return Qf(Cg,e)}var Dg=ca("ZodISODate",(e,t)=>{Qu.init(e,t),ov.init(e,t)});function zg(e){return eh(Dg,e)}var Ng=ca("ZodISOTime",(e,t)=>{ed.init(e,t),ov.init(e,t)});function Rg(e){return th(Ng,e)}var Ug=ca("ZodISODuration",(e,t)=>{td.init(e,t),ov.init(e,t)});function Mg(e){return rh(Ug,e)}var Kg=(e,t)=>{Is.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>xs(e,t)},flatten:{value:t=>Es(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,$a,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,$a,2)}},isEmpty:{get:()=>0===e.issues.length}})},Zg=ca("ZodError",Kg),Jg=ca("ZodError",Kg,{Parent:Error}),Lg=Cs(Jg),Wg=Ds(Jg),Fg=Ns(Jg),Vg=Us(Jg),Hg=Ks(Jg),qg=Js(Jg),Bg=Ws(Jg),Gg=Vs(Jg),Yg=qs(Jg),Xg=Gs(Jg),Qg=Xs(Jg),ev=ec(Jg),tv=ca("ZodType",(e,t)=>(Uu.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Km(e,"input"),output:Km(e,"output")}}),e.toJSONSchema=Mm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ha.mergeDefs(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>qa(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Lg(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Fg(e,t,r),e.parseAsync=async(t,r)=>Wg(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Vg(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Hg(e,t,r),e.decode=(t,r)=>qg(e,t,r),e.encodeAsync=async(t,r)=>Bg(e,t,r),e.decodeAsync=async(t,r)=>Gg(e,t,r),e.safeEncode=(t,r)=>Yg(e,t,r),e.safeDecode=(t,r)=>Xg(e,t,r),e.safeEncodeAsync=async(t,r)=>Qg(e,t,r),e.safeDecodeAsync=async(t,r)=>ev(e,t,r),e.refine=(t,r)=>e.check(q_(t,r)),e.superRefine=t=>e.check(B_(t)),e.overwrite=t=>e.check(Bh(t)),e.optional=()=>f_(e),e.exactOptional=()=>m_(e),e.nullable=()=>v_(e),e.nullish=()=>f_(v_(e)),e.nonoptional=t=>S_(e,t),e.array=()=>jy(e),e.or=t=>Ky([e,t]),e.and=t=>Vy(e,t),e.transform=t=>C_(e,l_(t)),e.default=t=>b_(e,t),e.prefault=t=>$_(e,t),e.catch=t=>x_(e,t),e.pipe=t=>C_(e,t),e.readonly=()=>N_(e),e.describe=t=>{let r=e.clone();return Pf.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Pf.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Pf.get(e);let r=e.clone();return Pf.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),rv=ca("_ZodString",(e,t)=>{Mu.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Jm(e,t,r);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(Zh(...t)),e.includes=(...t)=>e.check(Wh(...t)),e.startsWith=(...t)=>e.check(Fh(...t)),e.endsWith=(...t)=>e.check(Vh(...t)),e.min=(...t)=>e.check(Mh(...t)),e.max=(...t)=>e.check(Uh(...t)),e.length=(...t)=>e.check(Kh(...t)),e.nonempty=(...t)=>e.check(Mh(1,...t)),e.lowercase=t=>e.check(Jh(t)),e.uppercase=t=>e.check(Lh(t)),e.trim=()=>e.check(Yh()),e.normalize=(...t)=>e.check(Gh(...t)),e.toLowerCase=()=>e.check(Xh()),e.toUpperCase=()=>e.check(Qh()),e.slugify=()=>e.check(em())}),nv=ca("ZodString",(e,t)=>{Mu.init(e,t),rv.init(e,t),e.email=t=>e.check(Of(av,t)),e.url=t=>e.check(zf(mv,t)),e.jwt=t=>e.check(Yf(qv,t)),e.emoji=t=>e.check(Nf(yv,t)),e.guid=t=>e.check(Tf(cv,t)),e.uuid=t=>e.check(Af(dv,t)),e.uuidv4=t=>e.check(Cf(dv,t)),e.uuidv6=t=>e.check(jf(dv,t)),e.uuidv7=t=>e.check(Df(dv,t)),e.nanoid=t=>e.check(Rf(bv,t)),e.guid=t=>e.check(Tf(cv,t)),e.cuid=t=>e.check(Uf($v,t)),e.cuid2=t=>e.check(Mf(Sv,t)),e.ulid=t=>e.check(Kf(Pv,t)),e.base64=t=>e.check(qf(Jv,t)),e.base64url=t=>e.check(Bf(Wv,t)),e.xid=t=>e.check(Zf(xv,t)),e.ksuid=t=>e.check(Jf(Tv,t)),e.ipv4=t=>e.check(Lf(Cv,t)),e.ipv6=t=>e.check(Wf(Nv,t)),e.cidrv4=t=>e.check(Vf(Uv,t)),e.cidrv6=t=>e.check(Hf(Kv,t)),e.e164=t=>e.check(Gf(Vv,t)),e.datetime=t=>e.check(jg(t)),e.date=t=>e.check(zg(t)),e.time=t=>e.check(Rg(t)),e.duration=t=>e.check(Mg(t))});function iv(e){return Ef(nv,e)}var ov=ca("ZodStringFormat",(e,t)=>{Ku.init(e,t),rv.init(e,t)}),av=ca("ZodEmail",(e,t)=>{Lu.init(e,t),ov.init(e,t)});function sv(e){return Of(av,e)}var cv=ca("ZodGUID",(e,t)=>{Zu.init(e,t),ov.init(e,t)});function uv(e){return Tf(cv,e)}var dv=ca("ZodUUID",(e,t)=>{Ju.init(e,t),ov.init(e,t)});function lv(e){return Af(dv,e)}function pv(e){return Cf(dv,e)}function fv(e){return jf(dv,e)}function hv(e){return Df(dv,e)}var mv=ca("ZodURL",(e,t)=>{Wu.init(e,t),ov.init(e,t)});function gv(e){return zf(mv,e)}function vv(e){return zf(mv,{protocol:/^https?$/,hostname:rc.domain,...ha.normalizeParams(e)})}var yv=ca("ZodEmoji",(e,t)=>{Fu.init(e,t),ov.init(e,t)});function _v(e){return Nf(yv,e)}var bv=ca("ZodNanoID",(e,t)=>{Vu.init(e,t),ov.init(e,t)});function wv(e){return Rf(bv,e)}var $v=ca("ZodCUID",(e,t)=>{Hu.init(e,t),ov.init(e,t)});function kv(e){return Uf($v,e)}var Sv=ca("ZodCUID2",(e,t)=>{qu.init(e,t),ov.init(e,t)});function Iv(e){return Mf(Sv,e)}var Pv=ca("ZodULID",(e,t)=>{Bu.init(e,t),ov.init(e,t)});function Ev(e){return Kf(Pv,e)}var xv=ca("ZodXID",(e,t)=>{Gu.init(e,t),ov.init(e,t)});function Ov(e){return Zf(xv,e)}var Tv=ca("ZodKSUID",(e,t)=>{Yu.init(e,t),ov.init(e,t)});function Av(e){return Jf(Tv,e)}var Cv=ca("ZodIPv4",(e,t)=>{rd.init(e,t),ov.init(e,t)});function jv(e){return Lf(Cv,e)}var Dv=ca("ZodMAC",(e,t)=>{id.init(e,t),ov.init(e,t)});function zv(e){return Ff(Dv,e)}var Nv=ca("ZodIPv6",(e,t)=>{nd.init(e,t),ov.init(e,t)});function Rv(e){return Wf(Nv,e)}var Uv=ca("ZodCIDRv4",(e,t)=>{od.init(e,t),ov.init(e,t)});function Mv(e){return Vf(Uv,e)}var Kv=ca("ZodCIDRv6",(e,t)=>{ad.init(e,t),ov.init(e,t)});function Zv(e){return Hf(Kv,e)}var Jv=ca("ZodBase64",(e,t)=>{cd.init(e,t),ov.init(e,t)});function Lv(e){return qf(Jv,e)}var Wv=ca("ZodBase64URL",(e,t)=>{dd.init(e,t),ov.init(e,t)});function Fv(e){return Bf(Wv,e)}var Vv=ca("ZodE164",(e,t)=>{ld.init(e,t),ov.init(e,t)});function Hv(e){return Gf(Vv,e)}var qv=ca("ZodJWT",(e,t)=>{fd.init(e,t),ov.init(e,t)});function Bv(e){return Yf(qv,e)}var Gv=ca("ZodCustomStringFormat",(e,t)=>{hd.init(e,t),ov.init(e,t)});function Yv(e,t,r={}){return jm(Gv,e,t,r)}function Xv(e){return jm(Gv,"hostname",rc.hostname,e)}function Qv(e){return jm(Gv,"hex",rc.hex,e)}function ey(e,t){let r=`${e}_${t?.enc??"hex"}`,n=rc[r];if(!n)throw Error(`Unrecognized hash format: ${r}`);return jm(Gv,r,n,t)}var ty=ca("ZodNumber",(e,t)=>{md.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Lm(e,t,r),e.gt=(t,r)=>e.check(xh(t,r)),e.gte=(t,r)=>e.check(Oh(t,r)),e.min=(t,r)=>e.check(Oh(t,r)),e.lt=(t,r)=>e.check(Ph(t,r)),e.lte=(t,r)=>e.check(Eh(t,r)),e.max=(t,r)=>e.check(Eh(t,r)),e.int=t=>e.check(iy(t)),e.safe=t=>e.check(iy(t)),e.positive=t=>e.check(xh(0,t)),e.nonnegative=t=>e.check(Oh(0,t)),e.negative=t=>e.check(Ph(0,t)),e.nonpositive=t=>e.check(Eh(0,t)),e.multipleOf=(t,r)=>e.check(Dh(t,r)),e.step=(t,r)=>e.check(Dh(t,r)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ry(e){return nh(ty,e)}var ny=ca("ZodNumberFormat",(e,t)=>{gd.init(e,t),ty.init(e,t)});function iy(e){return oh(ny,e)}function oy(e){return ah(ny,e)}function ay(e){return sh(ny,e)}function sy(e){return ch(ny,e)}function cy(e){return uh(ny,e)}var uy=ca("ZodBoolean",(e,t)=>{vd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>Wm(0,0,t)});function dy(e){return dh(uy,e)}var ly=ca("ZodBigInt",(e,t)=>{yd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>Fm(0,e),e.gte=(t,r)=>e.check(Oh(t,r)),e.min=(t,r)=>e.check(Oh(t,r)),e.gt=(t,r)=>e.check(xh(t,r)),e.gte=(t,r)=>e.check(Oh(t,r)),e.min=(t,r)=>e.check(Oh(t,r)),e.lt=(t,r)=>e.check(Ph(t,r)),e.lte=(t,r)=>e.check(Eh(t,r)),e.max=(t,r)=>e.check(Eh(t,r)),e.positive=t=>e.check(xh(BigInt(0),t)),e.negative=t=>e.check(Ph(BigInt(0),t)),e.nonpositive=t=>e.check(Eh(BigInt(0),t)),e.nonnegative=t=>e.check(Oh(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(Dh(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function py(e){return ph(ly,e)}var fy=ca("ZodBigIntFormat",(e,t)=>{_d.init(e,t),ly.init(e,t)});function hy(e){return hh(fy,e)}function my(e){return mh(fy,e)}var gy=ca("ZodSymbol",(e,t)=>{bd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>Vm(0,e)});function vy(e){return gh(gy,e)}var yy=ca("ZodUndefined",(e,t)=>{wd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>qm(0,e)});function _y(e){return vh(yy,e)}var by=ca("ZodNull",(e,t)=>{$d.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>Hm(0,e,t)});function wy(e){return yh(by,e)}var $y=ca("ZodAny",(e,t)=>{kd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function ky(){return _h($y)}var Sy=ca("ZodUnknown",(e,t)=>{Sd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function Iy(){return bh(Sy)}var Py=ca("ZodNever",(e,t)=>{Id.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>Gm(0,0,t)});function Ey(e){return wh(Py,e)}var xy=ca("ZodVoid",(e,t)=>{Pd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>Bm(0,e)});function Oy(e){return $h(xy,e)}var Ty=ca("ZodDate",(e,t)=>{Ed.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>Ym(0,e),e.min=(t,r)=>e.check(Oh(t,r)),e.max=(t,r)=>e.check(Eh(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Ay(e){return kh(Ty,e)}var Cy=ca("ZodArray",(e,t)=>{Od.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>ug(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Mh(t,r)),e.nonempty=t=>e.check(Mh(1,t)),e.max=(t,r)=>e.check(Uh(t,r)),e.length=(t,r)=>e.check(Kh(t,r)),e.unwrap=()=>e.element});function jy(e,t){return tm(Cy,e,t)}function Dy(e){let t=e._zod.def.shape;return i_(Object.keys(t))}var zy=ca("ZodObject",(e,t)=>{Dd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>dg(e,t,r,n),ha.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>i_(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Iy()}),e.loose=()=>e.clone({...e._zod.def,catchall:Iy()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ey()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ha.extend(e,t),e.safeExtend=t=>ha.safeExtend(e,t),e.merge=t=>ha.merge(e,t),e.pick=t=>ha.pick(e,t),e.omit=t=>ha.omit(e,t),e.partial=(...t)=>ha.partial(p_,e,t[0]),e.required=(...t)=>ha.required(k_,e,t[0])});function Ny(e,t){let r={type:"object",shape:e??{},...ha.normalizeParams(t)};return new zy(r)}function Ry(e,t){return new zy({type:"object",shape:e,catchall:Ey(),...ha.normalizeParams(t)})}function Uy(e,t){return new zy({type:"object",shape:e,catchall:Iy(),...ha.normalizeParams(t)})}var My=ca("ZodUnion",(e,t)=>{Nd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>lg(e,t,r,n),e.options=t.options});function Ky(e,t){return new My({type:"union",options:e,...ha.normalizeParams(t)})}var Zy=ca("ZodXor",(e,t)=>{My.init(e,t),Ud.init(e,t),e._zod.processJSONSchema=(t,r,n)=>lg(e,t,r,n),e.options=t.options});function Jy(e,t){return new Zy({type:"union",options:e,inclusive:!1,...ha.normalizeParams(t)})}var Ly=ca("ZodDiscriminatedUnion",(e,t)=>{My.init(e,t),Md.init(e,t)});function Wy(e,t,r){return new Ly({type:"union",options:t,discriminator:e,...ha.normalizeParams(r)})}var Fy=ca("ZodIntersection",(e,t)=>{Kd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>pg(e,t,r,n)});function Vy(e,t){return new Fy({type:"intersection",left:e,right:t})}var Hy=ca("ZodTuple",(e,t)=>{Ld.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>fg(e,t,r,n),e.rest=t=>e.clone({...e._zod.def,rest:t})});function qy(e,t,r){let n=t instanceof Uu,i=n?r:t;return new Hy({type:"tuple",items:e,rest:n?t:null,...ha.normalizeParams(i)})}var By=ca("ZodRecord",(e,t)=>{Fd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>hg(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function Gy(e,t,r){return new By({type:"record",keyType:e,valueType:t,...ha.normalizeParams(r)})}function Yy(e,t,r){let n=qa(e);return n._zod.values=void 0,new By({type:"record",keyType:n,valueType:t,...ha.normalizeParams(r)})}function Xy(e,t,r){return new By({type:"record",keyType:e,valueType:t,mode:"loose",...ha.normalizeParams(r)})}var Qy=ca("ZodMap",(e,t)=>{Vd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>sg(0,e),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(Nh(...t)),e.nonempty=t=>e.check(Nh(1,t)),e.max=(...t)=>e.check(zh(...t)),e.size=(...t)=>e.check(Rh(...t))});function e_(e,t,r){return new Qy({type:"map",keyType:e,valueType:t,...ha.normalizeParams(r)})}var t_=ca("ZodSet",(e,t)=>{qd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>cg(0,e),e.min=(...t)=>e.check(Nh(...t)),e.nonempty=t=>e.check(Nh(1,t)),e.max=(...t)=>e.check(zh(...t)),e.size=(...t)=>e.check(Rh(...t))});function r_(e,t){return new t_({type:"set",valueType:e,...ha.normalizeParams(t)})}var n_=ca("ZodEnum",(e,t)=>{Gd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Xm(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e){if(!r.has(n))throw Error(`Key ${n} not found in enum`);i[n]=t.entries[n]}return new n_({...t,checks:[],...ha.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e){if(!r.has(t))throw Error(`Key ${t} not found in enum`);delete i[t]}return new n_({...t,checks:[],...ha.normalizeParams(n),entries:i})}});function i_(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new n_({type:"enum",entries:r,...ha.normalizeParams(t)})}function o_(e,t){return new n_({type:"enum",entries:e,...ha.normalizeParams(t)})}var a_=ca("ZodLiteral",(e,t)=>{Yd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Qm(e,t,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function s_(e,t){return new a_({type:"literal",values:Array.isArray(e)?e:[e],...ha.normalizeParams(t)})}var c_=ca("ZodFile",(e,t)=>{Xd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>rg(e,0,r),e.min=(t,r)=>e.check(Nh(t,r)),e.max=(t,r)=>e.check(zh(t,r)),e.mime=(t,r)=>e.check(qh(Array.isArray(t)?t:[t],r))});function u_(e){return fm(c_,e)}var d_=ca("ZodTransform",(e,t)=>{Qd.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>ag(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new la(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(ha.issue(n,r.value,t));else{let t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(ha.issue(t))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function l_(e){return new d_({type:"transform",transform:e})}var p_=ca("ZodOptional",(e,t)=>{tl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>kg(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function f_(e){return new p_({type:"optional",innerType:e})}var h_=ca("ZodExactOptional",(e,t)=>{rl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>kg(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function m_(e){return new h_({type:"optional",innerType:e})}var g_=ca("ZodNullable",(e,t)=>{nl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>mg(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function v_(e){return new g_({type:"nullable",innerType:e})}function y_(e){return f_(v_(e))}var __=ca("ZodDefault",(e,t)=>{il.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>vg(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function b_(e,t){return new __({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():ha.shallowClone(t)}})}var w_=ca("ZodPrefault",(e,t)=>{al.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>yg(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function $_(e,t){return new w_({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():ha.shallowClone(t)}})}var k_=ca("ZodNonOptional",(e,t)=>{sl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>gg(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function S_(e,t){return new k_({type:"nonoptional",innerType:e,...ha.normalizeParams(t)})}var I_=ca("ZodSuccess",(e,t)=>{ul.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>ng(0,0,t),e.unwrap=()=>e._zod.def.innerType});function P_(e){return new I_({type:"success",innerType:e})}var E_=ca("ZodCatch",(e,t)=>{dl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>_g(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function x_(e,t){return new E_({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}var O_=ca("ZodNaN",(e,t)=>{ll.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>eg(0,e)});function T_(e){return Ih(O_,e)}var A_=ca("ZodPipe",(e,t)=>{pl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>bg(e,t,0,n),e.in=t.in,e.out=t.out});function C_(e,t){return new A_({type:"pipe",in:e,out:t})}var j_=ca("ZodCodec",(e,t)=>{A_.init(e,t),hl.init(e,t)});function D_(e,t,r){return new j_({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var z_=ca("ZodReadonly",(e,t)=>{vl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>wg(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function N_(e){return new z_({type:"readonly",innerType:e})}var R_=ca("ZodTemplateLiteral",(e,t)=>{_l.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>tg(e,0,r)});function U_(e,t){return new R_({type:"template_literal",parts:e,...ha.normalizeParams(t)})}var M_=ca("ZodLazy",(e,t)=>{$l.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Sg(e,t,0,n),e.unwrap=()=>e._zod.def.getter()});function K_(e){return new M_({type:"lazy",getter:e})}var Z_=ca("ZodPromise",(e,t)=>{wl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(t,r,n)=>$g(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function J_(e){return new Z_({type:"promise",innerType:e})}var L_=ca("ZodFunction",(e,t)=>{bl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>og(0,e)});function W_(e){return new L_({type:"function",input:Array.isArray(e?.input)?qy(e?.input):e?.input??jy(Iy()),output:e?.output??Iy()})}var F_=ca("ZodCustom",(e,t)=>{kl.init(e,t),tv.init(e,t),e._zod.processJSONSchema=(e,t,r)=>ig(0,e)});function V_(e){let t=new pu({check:"custom"});return t._zod.check=e,t}function H_(e,t){return Pm(F_,e??(()=>!0),t)}function q_(e,t={}){return Em(F_,e,t)}function B_(e){return xm(e)}var G_=Tm,Y_=Am;function X_(e,t={}){let r=new F_({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...ha.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Q_=(...e)=>Cm({Codec:j_,Boolean:uy,String:nv},...e);function eb(e){let t=K_(()=>Ky([iv(e),ry(),dy(),wy(),jy(t),Gy(iv(),t)]));return t}function tb(e,t){return C_(l_(e),t)}var rb,nb={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"};function ib(e){fa({customError:e})}function ob(){return fa().customError}rb||(rb={});var ab={...Og,...Tg,iso:Ag},sb=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function cb(e,t){if(void 0!==e.not){if("object"==typeof e.not&&0===Object.keys(e.not).length)return ab.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(void 0!==e.unevaluatedItems)throw Error("unevaluatedItems is not supported");if(void 0!==e.unevaluatedProperties)throw Error("unevaluatedProperties is not supported");if(void 0!==e.if||void 0!==e.then||void 0!==e.else)throw Error("Conditional schemas (if/then/else) are not supported");if(void 0!==e.dependentSchemas||void 0!==e.dependentRequired)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return ab.lazy(()=>{if(!t.refs.has(r))throw Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let n=function(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(0===r.length)return t.rootSchema;let n="draft-2020-12"===t.version?"$defs":"definitions";if(r[0]===n){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}(r,t),i=ub(n,t);return t.refs.set(r,i),t.processing.delete(r),i}if(void 0!==e.enum){let r=e.enum;if("openapi-3.0"===t.version&&!0===e.nullable&&1===r.length&&null===r[0])return ab.null();if(0===r.length)return ab.never();if(1===r.length)return ab.literal(r[0]);if(r.every(e=>"string"==typeof e))return ab.enum(r);let n=r.map(e=>ab.literal(e));return n.length<2?n[0]:ab.union([n[0],n[1],...n.slice(2)])}if(void 0!==e.const)return ab.literal(e.const);let r,n=e.type;if(Array.isArray(n)){let r=n.map(r=>cb({...e,type:r},t));return 0===r.length?ab.never():1===r.length?r[0]:ab.union(r)}if(!n)return ab.any();switch(n){case"string":{let t=ab.string();if(e.format){let r=e.format;"email"===r?t=t.check(ab.email()):"uri"===r||"uri-reference"===r?t=t.check(ab.url()):"uuid"===r||"guid"===r?t=t.check(ab.uuid()):"date-time"===r?t=t.check(ab.iso.datetime()):"date"===r?t=t.check(ab.iso.date()):"time"===r?t=t.check(ab.iso.time()):"duration"===r?t=t.check(ab.iso.duration()):"ipv4"===r?t=t.check(ab.ipv4()):"ipv6"===r?t=t.check(ab.ipv6()):"mac"===r?t=t.check(ab.mac()):"cidr"===r?t=t.check(ab.cidrv4()):"cidr-v6"===r?t=t.check(ab.cidrv6()):"base64"===r?t=t.check(ab.base64()):"base64url"===r?t=t.check(ab.base64url()):"e164"===r?t=t.check(ab.e164()):"jwt"===r?t=t.check(ab.jwt()):"emoji"===r?t=t.check(ab.emoji()):"nanoid"===r?t=t.check(ab.nanoid()):"cuid"===r?t=t.check(ab.cuid()):"cuid2"===r?t=t.check(ab.cuid2()):"ulid"===r?t=t.check(ab.ulid()):"xid"===r?t=t.check(ab.xid()):"ksuid"===r&&(t=t.check(ab.ksuid()))}"number"==typeof e.minLength&&(t=t.min(e.minLength)),"number"==typeof e.maxLength&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),r=t;break}case"number":case"integer":{let t="integer"===n?ab.number().int():ab.number();"number"==typeof e.minimum&&(t=t.min(e.minimum)),"number"==typeof e.maximum&&(t=t.max(e.maximum)),"number"==typeof e.exclusiveMinimum?t=t.gt(e.exclusiveMinimum):!0===e.exclusiveMinimum&&"number"==typeof e.minimum&&(t=t.gt(e.minimum)),"number"==typeof e.exclusiveMaximum?t=t.lt(e.exclusiveMaximum):!0===e.exclusiveMaximum&&"number"==typeof e.maximum&&(t=t.lt(e.maximum)),"number"==typeof e.multipleOf&&(t=t.multipleOf(e.multipleOf)),r=t;break}case"boolean":r=ab.boolean();break;case"null":r=ab.null();break;case"object":{let n={},i=e.properties||{},o=new Set(e.required||[]);for(let[e,r]of Object.entries(i)){let i=ub(r,t);n[e]=o.has(e)?i:i.optional()}if(e.propertyNames){let i=ub(e.propertyNames,t),o=e.additionalProperties&&"object"==typeof e.additionalProperties?ub(e.additionalProperties,t):ab.any();if(0===Object.keys(n).length){r=ab.record(i,o);break}let a=ab.object(n).passthrough(),s=ab.looseRecord(i,o);r=ab.intersection(a,s);break}if(e.patternProperties){let i=e.patternProperties,o=Object.keys(i),a=[];for(let e of o){let r=ub(i[e],t),n=ab.string().regex(new RegExp(e));a.push(ab.looseRecord(n,r))}let s=[];if(Object.keys(n).length>0&&s.push(ab.object(n).passthrough()),s.push(...a),0===s.length)r=ab.object({}).passthrough();else if(1===s.length)r=s[0];else{let e=ab.intersection(s[0],s[1]);for(let t=2;t<s.length;t++)e=ab.intersection(e,s[t]);r=e}break}let a=ab.object(n);r=!1===e.additionalProperties?a.strict():"object"==typeof e.additionalProperties?a.catchall(ub(e.additionalProperties,t)):a.passthrough();break}case"array":{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let o=n.map(e=>ub(e,t)),a=i&&"object"==typeof i&&!Array.isArray(i)?ub(i,t):void 0;r=a?ab.tuple(o).rest(a):ab.tuple(o),"number"==typeof e.minItems&&(r=r.check(ab.minLength(e.minItems))),"number"==typeof e.maxItems&&(r=r.check(ab.maxLength(e.maxItems)))}else if(Array.isArray(i)){let n=i.map(e=>ub(e,t)),o=e.additionalItems&&"object"==typeof e.additionalItems?ub(e.additionalItems,t):void 0;r=o?ab.tuple(n).rest(o):ab.tuple(n),"number"==typeof e.minItems&&(r=r.check(ab.minLength(e.minItems))),"number"==typeof e.maxItems&&(r=r.check(ab.maxLength(e.maxItems)))}else if(void 0!==i){let n=ub(i,t),o=ab.array(n);"number"==typeof e.minItems&&(o=o.min(e.minItems)),"number"==typeof e.maxItems&&(o=o.max(e.maxItems)),r=o}else r=ab.array(ab.any());break}default:throw Error(`Unsupported type: ${n}`)}return e.description&&(r=r.describe(e.description)),void 0!==e.default&&(r=r.default(e.default)),r}function ub(e,t){if("boolean"==typeof e)return e?ab.any():ab.never();let r=cb(e,t),n=e.type||void 0!==e.enum||void 0!==e.const;if(e.anyOf&&Array.isArray(e.anyOf)){let i=e.anyOf.map(e=>ub(e,t)),o=ab.union(i);r=n?ab.intersection(r,o):o}if(e.oneOf&&Array.isArray(e.oneOf)){let i=e.oneOf.map(e=>ub(e,t)),o=ab.xor(i);r=n?ab.intersection(r,o):o}if(e.allOf&&Array.isArray(e.allOf))if(0===e.allOf.length)r=n?r:ab.any();else{let i=n?r:ub(e.allOf[0],t);for(let r=n?0:1;r<e.allOf.length;r++)i=ab.intersection(i,ub(e.allOf[r],t));r=i}!0===e.nullable&&"openapi-3.0"===t.version&&(r=ab.nullable(r)),!0===e.readOnly&&(r=ab.readonly(r));let i={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let t of o)t in e&&(i[t]=e[t]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let t of a)t in e&&(i[t]=e[t]);for(let t of Object.keys(e))sb.has(t)||(i[t]=e[t]);return Object.keys(i).length>0&&t.registry.add(r,i),r}function db(e,t){if("boolean"==typeof e)return e?ab.any():ab.never();let r=function(e,t){let r=e.$schema;return"https://json-schema.org/draft/2020-12/schema"===r?"draft-2020-12":"http://json-schema.org/draft-07/schema#"===r?"draft-7":"http://json-schema.org/draft-04/schema#"===r?"draft-4":t??"draft-2020-12"}(e,t?.defaultTarget);return ub(e,{version:r,defs:e.$defs||e.definitions||{},refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??Pf})}var lb={};function pb(e){return xf(nv,e)}function fb(e){return ih(ty,e)}function hb(e){return lh(uy,e)}function mb(e){return fh(ly,e)}function gb(e){return Sh(Ty,e)}ia(lb,{string:()=>pb,number:()=>fb,date:()=>gb,boolean:()=>hb,bigint:()=>mb}),fa(Wl());var vb=oa.union([oa.literal("light"),oa.literal("dark")]).describe("Color theme preference for the host environment."),yb=oa.union([oa.literal("inline"),oa.literal("fullscreen"),oa.literal("pip")]).describe("Display mode for UI presentation."),_b=oa.union([oa.literal("--color-background-primary"),oa.literal("--color-background-secondary"),oa.literal("--color-background-tertiary"),oa.literal("--color-background-inverse"),oa.literal("--color-background-ghost"),oa.literal("--color-background-info"),oa.literal("--color-background-danger"),oa.literal("--color-background-success"),oa.literal("--color-background-warning"),oa.literal("--color-background-disabled"),oa.literal("--color-text-primary"),oa.literal("--color-text-secondary"),oa.literal("--color-text-tertiary"),oa.literal("--color-text-inverse"),oa.literal("--color-text-ghost"),oa.literal("--color-text-info"),oa.literal("--color-text-danger"),oa.literal("--color-text-success"),oa.literal("--color-text-warning"),oa.literal("--color-text-disabled"),oa.literal("--color-text-ghost"),oa.literal("--color-border-primary"),oa.literal("--color-border-secondary"),oa.literal("--color-border-tertiary"),oa.literal("--color-border-inverse"),oa.literal("--color-border-ghost"),oa.literal("--color-border-info"),oa.literal("--color-border-danger"),oa.literal("--color-border-success"),oa.literal("--color-border-warning"),oa.literal("--color-border-disabled"),oa.literal("--color-ring-primary"),oa.literal("--color-ring-secondary"),oa.literal("--color-ring-inverse"),oa.literal("--color-ring-info"),oa.literal("--color-ring-danger"),oa.literal("--color-ring-success"),oa.literal("--color-ring-warning"),oa.literal("--font-sans"),oa.literal("--font-mono"),oa.literal("--font-weight-normal"),oa.literal("--font-weight-medium"),oa.literal("--font-weight-semibold"),oa.literal("--font-weight-bold"),oa.literal("--font-text-xs-size"),oa.literal("--font-text-sm-size"),oa.literal("--font-text-md-size"),oa.literal("--font-text-lg-size"),oa.literal("--font-heading-xs-size"),oa.literal("--font-heading-sm-size"),oa.literal("--font-heading-md-size"),oa.literal("--font-heading-lg-size"),oa.literal("--font-heading-xl-size"),oa.literal("--font-heading-2xl-size"),oa.literal("--font-heading-3xl-size"),oa.literal("--font-text-xs-line-height"),oa.literal("--font-text-sm-line-height"),oa.literal("--font-text-md-line-height"),oa.literal("--font-text-lg-line-height"),oa.literal("--font-heading-xs-line-height"),oa.literal("--font-heading-sm-line-height"),oa.literal("--font-heading-md-line-height"),oa.literal("--font-heading-lg-line-height"),oa.literal("--font-heading-xl-line-height"),oa.literal("--font-heading-2xl-line-height"),oa.literal("--font-heading-3xl-line-height"),oa.literal("--border-radius-xs"),oa.literal("--border-radius-sm"),oa.literal("--border-radius-md"),oa.literal("--border-radius-lg"),oa.literal("--border-radius-xl"),oa.literal("--border-radius-full"),oa.literal("--border-width-regular"),oa.literal("--shadow-hairline"),oa.literal("--shadow-sm"),oa.literal("--shadow-md"),oa.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),bb=oa.record(_b.describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation."),oa.union([oa.string(),oa.undefined()]).describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation.")).describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation."),wb=(oa.object({method:oa.literal("ui/open-link"),params:oa.object({url:oa.string().describe("URL to open in the host's browser")})}),oa.object({isError:oa.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),oa.object({isError:oa.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),oa.object({method:oa.literal("ui/notifications/sandbox-proxy-ready"),params:oa.object({})}),oa.object({connectDomains:oa.array(oa.string()).optional().describe("Origins for network requests (fetch/XHR/WebSocket)."),resourceDomains:oa.array(oa.string()).optional().describe("Origins for static resources (scripts, images, styles, fonts)."),frameDomains:oa.array(oa.string()).optional().describe("Origins for nested iframes (frame-src directive)."),baseUriDomains:oa.array(oa.string()).optional().describe("Allowed base URIs for the document (base-uri directive).")})),$b=oa.object({camera:oa.object({}).optional().describe("Request camera access (Permission Policy `camera` feature)."),microphone:oa.object({}).optional().describe("Request microphone access (Permission Policy `microphone` feature)."),geolocation:oa.object({}).optional().describe("Request geolocation access (Permission Policy `geolocation` feature)."),clipboardWrite:oa.object({}).optional().describe("Request clipboard write access (Permission Policy `clipboard-write` feature).")}),kb=(oa.object({method:oa.literal("ui/notifications/size-changed"),params:oa.object({width:oa.number().optional().describe("New width in pixels."),height:oa.number().optional().describe("New height in pixels.")})}),oa.object({method:oa.literal("ui/notifications/tool-input"),params:oa.object({arguments:oa.record(oa.string(),oa.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),oa.object({method:oa.literal("ui/notifications/tool-input-partial"),params:oa.object({arguments:oa.record(oa.string(),oa.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),oa.object({method:oa.literal("ui/notifications/tool-cancelled"),params:oa.object({reason:oa.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),oa.object({fonts:oa.string().optional()})),Sb=oa.object({variables:bb.optional().describe("CSS variables for theming the app."),css:kb.optional().describe("CSS blocks that apps can inject.")}),Ib=(oa.object({method:oa.literal("ui/resource-teardown"),params:oa.object({})}),oa.record(oa.string(),oa.unknown()),oa.object({text:oa.object({}).optional().describe("Host supports text content blocks."),image:oa.object({}).optional().describe("Host supports image content blocks."),audio:oa.object({}).optional().describe("Host supports audio content blocks."),resource:oa.object({}).optional().describe("Host supports resource content blocks."),resourceLink:oa.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:oa.object({}).optional().describe("Host supports structured content.")})),Pb=oa.object({experimental:oa.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:oa.object({}).optional().describe("Host supports opening external URLs."),serverTools:oa.object({listChanged:oa.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:oa.object({listChanged:oa.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:oa.object({}).optional().describe("Host accepts log messages."),sandbox:oa.object({permissions:$b.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:wb.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Ib.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Ib.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),Eb=oa.object({experimental:oa.object({}).optional().describe("Experimental features (structure TBD)."),tools:oa.object({listChanged:oa.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:oa.array(yb).optional().describe("Display modes the app supports.")}),xb=(oa.object({method:oa.literal("ui/notifications/initialized"),params:oa.object({}).optional()}),oa.object({csp:wb.optional().describe("Content Security Policy configuration."),permissions:$b.optional().describe("Sandbox permissions requested by the UI."),domain:oa.string().optional().describe("Dedicated origin for view sandbox."),prefersBorder:oa.boolean().optional().describe("Visual boundary preference - true if UI prefers a visible border.")}),oa.object({method:oa.literal("ui/request-display-mode"),params:oa.object({mode:yb.describe("The display mode being requested.")})}),oa.object({mode:yb.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),oa.union([oa.literal("model"),oa.literal("app")]).describe("Tool visibility scope - who can access the tool.")),Ob=(oa.object({resourceUri:oa.string().optional(),visibility:oa.array(xb).optional().describe('Who can access this tool. Default: ["model", "app"]\n- "model": Tool visible to and callable by the agent\n- "app": Tool callable by the app from this server only')}),oa.object({mimeTypes:oa.array(oa.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),oa.object({method:oa.literal("ui/message"),params:oa.object({role:oa.literal("user").describe('Message role, currently only "user" is supported.'),content:oa.array(no).describe("Message content blocks (text, image, etc.).")})}),oa.object({method:oa.literal("ui/notifications/sandbox-resource-ready"),params:oa.object({html:oa.string().describe("HTML content to load into the inner iframe."),sandbox:oa.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:wb.optional().describe("CSP configuration from resource metadata."),permissions:$b.optional().describe("Sandbox permissions from resource metadata.")})}),oa.object({method:oa.literal("ui/notifications/tool-result"),params:fo.describe("Standard MCP tool execution result.")}),oa.object({toolInfo:oa.object({id:Nn.optional().describe("JSON-RPC id of the tools/call request."),tool:uo.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:vb.optional().describe("Current color theme preference."),styles:Sb.optional().describe("Style configuration for theming the app."),displayMode:yb.optional().describe("How the UI is currently displayed."),availableDisplayModes:oa.array(yb).optional().describe("Display modes the host supports."),containerDimensions:oa.union([oa.object({height:oa.number().describe("Fixed container height in pixels.")}),oa.object({maxHeight:oa.union([oa.number(),oa.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(oa.union([oa.object({width:oa.number().describe("Fixed container width in pixels.")}),oa.object({maxWidth:oa.union([oa.number(),oa.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe("Container dimensions. Represents the dimensions of the iframe or other\ncontainer holding the app. Specify either width or maxWidth, and either height or maxHeight."),locale:oa.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:oa.string().optional().describe("User's timezone in IANA format."),userAgent:oa.string().optional().describe("Host application identifier."),platform:oa.union([oa.literal("web"),oa.literal("desktop"),oa.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:oa.object({touch:oa.boolean().optional().describe("Whether the device supports touch input."),hover:oa.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:oa.object({top:oa.number().describe("Top safe area inset in pixels."),right:oa.number().describe("Right safe area inset in pixels."),bottom:oa.number().describe("Bottom safe area inset in pixels."),left:oa.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough()),Tb=(oa.object({method:oa.literal("ui/notifications/host-context-changed"),params:Ob.describe("Partial context update containing only changed fields.")}),oa.object({method:oa.literal("ui/update-model-context"),params:oa.object({content:oa.array(no).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:oa.record(oa.string(),oa.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),oa.object({method:oa.literal("ui/initialize"),params:oa.object({appInfo:qn.describe("App identification (name and version)."),appCapabilities:Eb.describe("Features and capabilities this app provides."),protocolVersion:oa.string().describe("Protocol version this app supports.")})}),oa.object({protocolVersion:oa.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:qn.describe("Host application identification and version."),hostCapabilities:Pb.describe("Features and capabilities provided by the host."),hostContext:Ob.describe("Rich context about the host environment.")}).passthrough(),"ui/resourceUri"),Ab="text/html;profile=mcp-app";function Cb(e,t,r,n){let i=r._meta,o=i.ui,a=i[Tb],s=i;return o?.resourceUri&&!a?s={...i,[Tb]:o.resourceUri}:a&&!o?.resourceUri&&(s={...i,ui:{...o,resourceUri:a}}),e.registerTool(t,{...r,_meta:s},n)}function jb(e,t,r,n,i){e.registerResource(t,r,{mimeType:Ab,...n},i)}var Db="io.modelcontextprotocol/ui";function zb(e){if(e)return e.extensions?.[Db]}},81593:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,o,a,s){const c=(0,i.concat)(e,t,r,(0,i.uint64be)(e.length<<3)),u=(0,n.createHmac)(`sha${o}`,a);return u.update(c),u.digest().slice(0,s>>3)};const n=r(77598),i=r(45935)},81605:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateHandshakeFormat=t.createHandshakeRequest=t.SessionManager=void 0;var n=r(74630);Object.defineProperty(t,"SessionManager",{enumerable:!0,get:function(){return n.SessionManager}}),Object.defineProperty(t,"createHandshakeRequest",{enumerable:!0,get:function(){return n.createHandshakeRequest}}),Object.defineProperty(t,"validateHandshakeFormat",{enumerable:!0,get:function(){return n.validateHandshakeFormat}})},82880:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(39069);t.default=function(e,t,r,i,o){if(void 0!==o.crit&&void 0===i?.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!i||void 0===i.crit)return new Set;if(!Array.isArray(i.crit)||0===i.crit.length||i.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let a;a=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const t of i.crit){if(!a.has(t))throw new n.JOSENotSupported(`Extension Header Parameter "${t}" is not recognized`);if(void 0===o[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(a.get(t)&&void 0===i[t])throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(i.crit)}},82906:e=>{"use strict";e.exports=require("@kya-os/contracts/agentshield-api")},83959:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(98119),i=r(30659),o=r(88313),a=r(38563),s=r(44618),c=[n.default,i.default,(0,o.default)(),a.default,s.metadataVocabulary,s.contentVocabulary];t.default=c},84559:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.experimental_jwksCache=t.jwksCache=void 0,t.createRemoteJWKSet=function(e,t){const r=new c(e,t),n=async(e,t)=>r.getKey(e,t);return Object.defineProperties(n,{coolingDown:{get:()=>r.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>r.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>r.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!r._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>r._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n};const n=r(12930),i=r(39069),o=r(22562),a=r(71661);let s;"undefined"!=typeof navigator&&navigator.userAgent?.startsWith?.("Mozilla/5.0 ")||(s="jose/v5.10.0"),t.jwksCache=Symbol();class c{_url;_timeoutDuration;_cooldownDuration;_cacheMaxAge;_jwksTimestamp;_pendingFetch;_options;_local;_cache;constructor(e,r){if(!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,i;this._url=new URL(e.href),this._options={agent:r?.agent,headers:r?.headers},this._timeoutDuration="number"==typeof r?.timeoutDuration?r?.timeoutDuration:5e3,this._cooldownDuration="number"==typeof r?.cooldownDuration?r?.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof r?.cacheMaxAge?r?.cacheMaxAge:6e5,void 0!==r?.[t.jwksCache]&&(this._cache=r?.[t.jwksCache],n=r?.[t.jwksCache],i=this._cacheMaxAge,"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=i)&&"jwks"in n&&(0,a.default)(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,a.default)&&(this._jwksTimestamp=this._cache.uat,this._local=(0,o.createLocalJWKSet)(this._cache.jwks)))}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){this._local&&this.fresh()||await this.reload();try{return await this._local(e,t)}catch(r){if(r instanceof i.JWKSNoMatchingKey&&!1===this.coolingDown())return await this.reload(),this._local(e,t);throw r}}async reload(){this._pendingFetch&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(this._pendingFetch=void 0);const e=new Headers(this._options.headers);s&&!e.has("User-Agent")&&(e.set("User-Agent",s),this._options.headers=Object.fromEntries(e.entries())),this._pendingFetch||=(0,n.default)(this._url,this._timeoutDuration,this._options).then(e=>{this._local=(0,o.createLocalJWKSet)(e),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=e),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e}),await this._pendingFetch}}t.experimental_jwksCache=t.jwksCache},84641:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(77598);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.randomFillSync}})},84848:(e,t,r)=>{"use strict";const{isUUID:n}=r(609),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function a(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2])}function s(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function c(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const u={scheme:"http",domainHost:!0,parse:s,serialize:c},d={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=a(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(a(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},l={http:u,https:{scheme:"https",domainHost:u.domainHost,parse:s,serialize:c},ws:d,wss:{scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(i);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const i=p(`${n}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),i=p(`${r}:${t.nid||n}`);i&&(e=i.serialize(e,t));const o=e,a=e.nss;return o.path=`${n||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){const r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&n(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function p(e){return e&&(l[e]||l[e.toLowerCase()])||void 0}Object.setPrototypeOf(l,null),e.exports={wsIsSecure:a,SCHEMES:l,isValidSchemeName:function(e){return-1!==o.indexOf(e)},getSchemeHandler:p}},84948:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(67218),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:i}=e;if((0,n.alwaysValidSchema)(i,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};t.default=i},85251:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromX509=t.fromSPKI=t.fromPKCS8=t.toPKCS8=t.toSPKI=void 0;const n=r(77598),i=r(4573),o=r(99135),a=r(29994),s=r(71759),c=r(58242),u=(e,t,r)=>{let i;if((0,o.isCryptoKey)(r)){if(!r.extractable)throw new TypeError("CryptoKey is not extractable");i=n.KeyObject.from(r)}else{if(!(0,a.default)(r))throw new TypeError((0,s.default)(r,...c.types));i=r}if(i.type!==e)throw new TypeError(`key is not a ${e} key`);return i.export({format:"pem",type:t})};t.toSPKI=e=>u("public","spki",e),t.toPKCS8=e=>u("private","pkcs8",e),t.fromPKCS8=e=>(0,n.createPrivateKey)({key:i.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,""),"base64"),type:"pkcs8",format:"der"}),t.fromSPKI=e=>(0,n.createPublicKey)({key:i.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,""),"base64"),type:"spki",format:"der"}),t.fromX509=e=>(0,n.createPublicKey)({key:e,type:"spki",format:"pem"})},86443:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StorageKeyHelpers=void 0,t.createStorageProviders=async function(e){const t=!1!==e.fallbackToMemory;if(e.redisUrl)try{const t="redis",n=await r(74650)(t).catch(()=>null);if(!n)throw new Error("Redis package not available");const{createClient:i}=n,o=i({url:e.redisUrl,socket:{connectTimeout:5e3}});await o.connect(),await o.ping();return{storageProvider:new c(o),nonceCacheProvider:new u(o)}}catch(e){if(!t)throw e;console.warn("[StorageService] Failed to connect to Redis, falling back to memory:",e instanceof Error?e.message:String(e))}if(e.kvNamespace)try{const t=await async function(e){try{const t="@kya-os/mcp-i-cloudflare/providers/storage",{KVStorageProvider:n,KVNonceCacheProvider:i}=await r(46682)(t);return{storage:new n(e),nonceCache:new i(e)}}catch(e){throw new Error(`Failed to import Cloudflare storage providers: ${e instanceof Error?e.message:String(e)}`)}}(e.kvNamespace);return{storageProvider:t.storage,nonceCacheProvider:t.nonceCache}}catch(e){if(!t)throw e;console.warn("[StorageService] Failed to initialize KV, falling back to memory:",e instanceof Error?e.message:String(e))}if(e.durableObjectState)try{return{storageProvider:new a(e.durableObjectState),nonceCacheProvider:new s(e.durableObjectState)}}catch(e){if(!t)throw e;console.warn("[StorageService] Failed to initialize Durable Objects, falling back to memory:",e instanceof Error?e.message:String(e))}if(t)return{storageProvider:new i.MemoryStorageProvider,nonceCacheProvider:new i.MemoryNonceCacheProvider};throw new Error("No storage provider configured and fallbackToMemory is false")},t.migrateLegacyKeys=async function(e,t,r,n=100){let i=0;try{const o=await r.list(e);for(const e of o){const o=t(e);if(!o)continue;if(await r.exists(o))continue;const a=await r.get(e);a&&(await r.set(o,a),i++,i%n===0&&await new Promise(e=>setTimeout(e,0)))}}catch(e){throw console.error("[StorageService] Migration error:",e),e}return i};const n=r(3842),i=r(52884);class o{static buildDelegationKey(e,t,r){return`delegation:${e}:${t}:${r}`}static buildSessionKey(e){return`session:${e}`}static buildNonceKey(e,t){return`nonce:${e}:${t}`}static parseDelegationKey(e){if(!e.startsWith("delegation:"))return null;const t=e.slice(11),r=t.lastIndexOf(":");if(-1===r)return null;const n=t.slice(r+1);if(!n)return null;const i=t.slice(0,r),o=i.indexOf("did:");if(0!==o)return null;const a=i.indexOf(":",o+4);if(-1===a)return null;const s=i.indexOf("did:",a+1);if(-1===s)return null;const c=i.slice(0,s),u=i.slice(s),d=c.endsWith(":")?c.slice(0,-1):c;return d&&u?{userDid:d,agentDid:u,projectId:n}:null}}t.StorageKeyHelpers=o;class a extends n.StorageProvider{state;constructor(e){super(),this.state=e}async get(e){return await this.state.storage.get(e)??null}async set(e,t){await this.state.storage.put(e,t)}async delete(e){await this.state.storage.delete(e)}async exists(e){return void 0!==await this.state.storage.get(e)}async list(e){const t=await this.state.storage.list(e?{prefix:e}:void 0);return Array.from(t.keys())}}class s extends n.NonceCacheProvider{state;constructor(e){super(),this.state=e}async has(e,t){const r=t?o.buildNonceKey(t,e):`nonce:${e}`,n=await this.state.storage.get(r);if(!n)return!1;const i=parseInt(n,10);return Date.now()<i}async add(e,t,r){const n=r?o.buildNonceKey(r,e):`nonce:${e}`,i=Date.now()+1e3*t;await this.state.storage.put(n,i.toString())}async cleanup(){}async destroy(){}}class c extends n.StorageProvider{redis;constructor(e){super(),this.redis=e}async get(e){return await this.redis.get(e)}async set(e,t){await this.redis.set(e,t)}async delete(e){await this.redis.del(e)}async exists(e){return 1===await this.redis.exists(e)}async list(e){const t=e?`${e}*`:"*";return await this.redis.keys(t)}}class u extends n.NonceCacheProvider{redis;keyPrefix;constructor(e,t="nonce:"){super(),this.redis=e,this.keyPrefix=t}async has(e,t){const r=t?o.buildNonceKey(t,e):`${this.keyPrefix}${e}`;return 1===await this.redis.exists(r)}async add(e,t,r){const n=r?o.buildNonceKey(r,e):`${this.keyPrefix}${e}`;await this.redis.setEx(n,t,"1")}async cleanup(){}async destroy(){}}},86660:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i={data:new n.Name("data"),valCxt:new n.Name("valCxt"),instancePath:new n.Name("instancePath"),parentData:new n.Name("parentData"),parentDataProperty:new n.Name("parentDataProperty"),rootData:new n.Name("rootData"),dynamicAnchors:new n.Name("dynamicAnchors"),vErrors:new n.Name("vErrors"),errors:new n.Name("errors"),this:new n.Name("this"),self:new n.Name("self"),scope:new n.Name("scope"),json:new n.Name("json"),jsonPos:new n.Name("jsonPos"),jsonLen:new n.Name("jsonLen"),jsonPart:new n.Name("jsonPart")};t.default=i},87925:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;t.default=e=>{const t=r.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let i;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":i=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":i=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":i=Math.round(3600*n);break;case"day":case"days":case"d":i=Math.round(86400*n);break;case"week":case"weeks":case"w":i=Math.round(604800*n);break;default:i=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-i:i}},88313:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(30714),i=r(51997),o=r(23665),a=r(5153),s=r(32692),c=r(15860),u=r(80374),d=r(88401),l=r(23252),p=r(46398),f=r(84948),h=r(21070),m=r(5368),g=r(12003),v=r(8102),y=r(71871);t.default=function(e=!1){const t=[f.default,h.default,m.default,g.default,v.default,y.default,u.default,d.default,c.default,l.default,p.default];return e?t.push(i.default,a.default):t.push(n.default,o.default),t.push(s.default),t}},88401:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(24954),i=r(38994),o=r(86660),a=r(67218),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>i._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:r,parentSchema:s,data:c,errsCount:u,it:d}=e;if(!u)throw new Error("ajv implementation error");const{allErrors:l,opts:p}=d;if(d.props=!0,"all"!==p.removeAdditional&&(0,a.alwaysValidSchema)(d,r))return;const f=(0,n.allSchemaProperties)(s.properties),h=(0,n.allSchemaProperties)(s.patternProperties);function m(e){t.code(i._`delete ${c}[${e}]`)}function g(n){if("all"===p.removeAdditional||p.removeAdditional&&!1===r)m(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(l||t.break());if("object"==typeof r&&!(0,a.alwaysValidSchema)(d,r)){const r=t.name("valid");"failing"===p.removeAdditional?(v(n,r,!1),t.if((0,i.not)(r),()=>{e.reset(),m(n)})):(v(n,r),l||t.if((0,i.not)(r),()=>t.break()))}}}function v(t,r,n){const i={keyword:"additionalProperties",dataProp:t,dataPropType:a.Type.Str};!1===n&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",c,r=>{f.length||h.length?t.if(function(r){let o;if(f.length>8){const e=(0,a.schemaRefOrVal)(d,s.properties,"properties");o=(0,n.isOwnProperty)(t,e,r)}else o=f.length?(0,i.or)(...f.map(e=>i._`${r} === ${e}`)):i.nil;return h.length&&(o=(0,i.or)(o,...h.map(t=>i._`${(0,n.usePattern)(e,t)}.test(${r})`))),(0,i.not)(o)}(r),()=>g(r)):g(r)}),e.ok(i._`${u} === ${o.default.errors}`)}};t.default=s},88660:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmbeddedJWK=async function(e,t){const r={...e,...t?.header};if(!(0,i.default)(r.jwk))throw new o.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const a=await(0,n.importJWK)({...r.jwk,ext:!0},r.alg);if(a instanceof Uint8Array||"public"!==a.type)throw new o.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return a};const n=r(68846),i=r(71661),o=r(39069)},88915:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateSecret=async function(e,t){return(0,n.generateSecret)(e,t)};const n=r(37329)},89008:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const n=r(67218),i=r(67371),o=r(50205),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!c(e):!!t&&u(e)<=t)};const s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(s.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(c))return!0;if("object"==typeof r&&c(r))return!0}return!1}function u(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!a.has(r)&&("object"==typeof e[r]&&(0,n.eachItem)(e[r],e=>t+=u(e)),t===1/0))return 1/0}return t}function d(e,t="",r){!1!==r&&(t=f(t));const n=e.parse(t);return l(e,n)}function l(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=d,t._getFullPath=l;const p=/#\/?$/;function f(e){return e?e.replace(p,""):""}t.normalizeId=f,t.resolveUrl=function(e,t,r){return r=f(r),e.resolve(t,r)};const h=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,a=f(e[r]||t),s={"":a},c=d(n,a,!1),u={},l=new Set;return o(e,{allKeys:!0},(e,t,n,i)=>{if(void 0===i)return;const o=c+t;let a=s[i];function d(t){const r=this.opts.uriResolver.resolve;if(t=f(a?r(a,t):t),l.has(t))throw m(t);l.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?p(e,n.schema,t):t!==f(o)&&("#"===t[0]?(p(e,u[t],t),u[t]=e):this.refs[t]=o),t}function g(e){if("string"==typeof e){if(!h.test(e))throw new Error(`invalid anchor "${e}"`);d.call(this,`#${e}`)}}"string"==typeof e[r]&&(a=d.call(this,e[r])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=a}),u;function p(e,t,r){if(void 0!==t&&!i(e,t))throw m(r)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},89190:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>n.str`must be multiple of ${e}`,params:({schemaCode:e})=>n._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:i,it:o}=e,a=o.opts.multipleOfPrecision,s=t.let("res"),c=a?n._`Math.abs(Math.round(${s}) - ${s}) > 1e-${a}`:n._`${s} !== parseInt(${s})`;e.fail$data(n._`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}};t.default=i},89666:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkKeyTypeWithJwk=void 0;const n=r(71759),i=r(58242),o=r(45380),a=e=>e?.[Symbol.toStringTag],s=(e,t,r)=>{if(void 0!==t.use&&"sig"!==t.use)throw new TypeError("Invalid key for this operation, when present its use must be sig");if(void 0!==t.key_ops&&!0!==t.key_ops.includes?.(r))throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);if(void 0!==t.alg&&t.alg!==e)throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0};function c(e,t,r,c){t.startsWith("HS")||"dir"===t||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?((e,t,r,c)=>{if(!(t instanceof Uint8Array)){if(c&&o.isJWK(t)){if(o.isSecretJWK(t)&&s(e,t,r))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!(0,i.default)(t))throw new TypeError((0,n.withAlg)(e,t,...i.types,"Uint8Array",c?"JSON Web Key":null));if("secret"!==t.type)throw new TypeError(`${a(t)} instances for symmetric algorithms must be of type "secret"`)}})(t,r,c,e):((e,t,r,c)=>{if(c&&o.isJWK(t))switch(r){case"sign":if(o.isPrivateJWK(t)&&s(e,t,r))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(o.isPublicJWK(t)&&s(e,t,r))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!(0,i.default)(t))throw new TypeError((0,n.withAlg)(e,t,...i.types,c?"JSON Web Key":null));if("secret"===t.type)throw new TypeError(`${a(t)} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw new TypeError(`${a(t)} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw new TypeError(`${a(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw new TypeError(`${a(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw new TypeError(`${a(t)} instances for asymmetric algorithm encryption must be of type "public"`)})(t,r,c,e)}t.default=c.bind(void 0,!1),t.checkKeyTypeWithJwk=c.bind(void 0,!0)},90489:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(39069),i=r(29994);t.default=(e,t)=>{let r;switch(e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new n.JOSENotSupported(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(t instanceof Uint8Array){const e=t.byteLength<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`);return}if((0,i.default)(t)&&"secret"===t.type){const e=t.symmetricKeySize<<3;if(e!==r)throw new n.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`);return}throw new TypeError("Invalid Content Encryption Key type")}},90862:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.weakMap=void 0;const n=r(77598),i=r(39069),o=r(99135),a=r(29994),s=r(71759),c=r(58242),u=r(45380);t.weakMap=new WeakMap,t.default=(e,t)=>{let r;if((0,o.isCryptoKey)(e))r=n.KeyObject.from(e);else{if(!(0,a.default)(e)){if((0,u.isJWK)(e))return e.crv;throw new TypeError((0,s.default)(e,...c.types))}r=e}if("secret"===r.type)throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(r.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${r.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${r.asymmetricKeyType.slice(1)}`;case"ec":{const e=r.asymmetricKeyDetails.namedCurve;return t?e:(e=>{switch(e){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new i.JOSENotSupported("Unsupported key curve for this operation")}})(e)}default:throw new TypeError("Invalid asymmetric key type for this operation")}}},91146:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const e of t){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0}},91688:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const n=r(38994),i=r(74383),o=r(86660),a=r(89008),s=r(67218),c=r(36023);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,a.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function d(e){const t=p.call(this,e);if(t)return t;const r=(0,a.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:s,lines:u}=this.opts.code,{ownProperties:d}=this.opts,l=new n.CodeGen(this.scope,{es5:s,lines:u,ownProperties:d});let f;e.$async&&(f=l.scopeValue("Error",{ref:i.default,code:n._`require("ajv/dist/runtime/validation_error").default`}));const h=l.scopeName("validate");e.validateName=h;const m={gen:l,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[n.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:l.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,n.stringify)(e.schema)}:{ref:e.schema}),validateName:h,ValidationError:f,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:n.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:n._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,c.validateFunctionCode)(m),l.optimize(this.opts.code.optimize);const t=l.toString();g=`${l.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const r=new Function(`${o.default.self}`,`${o.default.scope}`,g)(this,this.scope.get());if(this.scope.value(h,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:h,validateCode:t,scopeValues:l._values}),this.opts.unevaluated){const{props:e,items:t}=m;r.evaluated={props:e instanceof n.Name?void 0:e,items:t instanceof n.Name?void 0:t,dynamicProps:e instanceof n.Name,dynamicItems:t instanceof n.Name},r.source&&(r.source.evaluated=(0,n.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function l(e){return(0,a.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:d.call(this,e)}function p(e){for(const t of this._compilations)if(f(t,e))return t}function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function h(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||m.call(this,e,t)}function m(e,t){const r=this.opts.uriResolver.parse(t),n=(0,a._getFullPath)(this.opts.uriResolver,r);let i=(0,a.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return v.call(this,r,e);const o=(0,a.normalizeId)(n),s=this.refs[o]||this.schemas[o];if("string"==typeof s){const t=m.call(this,e,s);if("object"!=typeof(null==t?void 0:t.schema))return;return v.call(this,r,t)}if("object"==typeof(null==s?void 0:s.schema)){if(s.validate||d.call(this,s),o===(0,a.normalizeId)(t)){const{schema:t}=s,{schemaId:r}=this.opts,n=t[r];return n&&(i=(0,a.resolveUrl)(this.opts.uriResolver,i,n)),new u({schema:t,schemaId:r,root:e,baseId:i})}return v.call(this,r,s)}}t.SchemaEnv=u,t.compileSchema=d,t.resolveRef=function(e,t,r){var n;r=(0,a.resolveUrl)(this.opts.uriResolver,t,r);const i=e.refs[r];if(i)return i;let o=h.call(this,e,r);if(void 0===o){const i=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new u({schema:i,schemaId:a,root:e,baseId:t}))}return void 0!==o?e.refs[r]=l.call(this,o):void 0},t.getCompilingSchema=p,t.resolveSchema=m;const g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(e,{baseId:t,schema:r,root:n}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,s.unescapeFragment)(n)];if(void 0===e)return;const i="object"==typeof(r=e)&&r[this.opts.schemaId];!g.has(n)&&i&&(t=(0,a.resolveUrl)(this.opts.uriResolver,t,i))}let o;if("boolean"!=typeof r&&r.$ref&&!(0,s.schemaHasRulesButRef)(r,this.RULES)){const e=(0,a.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=m.call(this,n,e)}const{schemaId:c}=this.opts;return o=o||new u({schema:r,schemaId:c,root:n,baseId:t}),o.schema!==o.root.schema?o:void 0}},91712:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5888),i=r(59035),o=r(38994),a=new o.Name("fullFormats"),s=new o.Name("fastFormats"),c=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,n.fullFormats,a),e;const[r,o]="fast"===t.mode?[n.fastFormats,s]:[n.fullFormats,a];return u(e,t.formats||n.formatNames,r,o),t.keywords&&(0,i.default)(e),e};function u(e,t,r,n){var i,a;null!==(i=(a=e.opts.code).formats)&&void 0!==i||(a.formats=o._`require("ajv-formats/dist/formats").${n}`);for(const n of t)e.addFormat(n,r[n])}c.get=(e,t="full")=>{const r=("fast"===t?n.fastFormats:n.fullFormats)[e];if(!r)throw new Error(`Unknown format "${e}"`);return r},e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c},92599:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FlattenedEncrypt=void 0;const n=r(3508),i=r(71458),o=r(19265),a=r(40554),s=r(39069),c=r(91146),u=r(45935),d=r(82880);t.FlattenedEncrypt=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,t){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new s.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,c.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new s.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,d.default)(s.JWEInvalid,new Map,t?.crit,this._protectedHeader,r),void 0!==r.zip)throw new s.JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');const{alg:l,enc:p}=r;if("string"!=typeof l||!l)throw new s.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof p||!p)throw new s.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let f,h,m,g,v;if(this._cek&&("dir"===l||"ECDH-ES"===l))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${l}`);{let r;({cek:h,encryptedKey:f,parameters:r}=await(0,a.default)(l,p,e,this._cek,this._keyManagementParameters)),r&&(t&&i.unprotected in t?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...r}:this.setUnprotectedHeader(r):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...r}:this.setProtectedHeader(r))}g=this._protectedHeader?u.encoder.encode((0,n.encode)(JSON.stringify(this._protectedHeader))):u.encoder.encode(""),this._aad?(v=(0,n.encode)(this._aad),m=(0,u.concat)(g,u.encoder.encode("."),u.encoder.encode(v))):m=g;const{ciphertext:y,tag:_,iv:b}=await(0,o.default)(p,this._plaintext,h,this._iv,m),w={ciphertext:(0,n.encode)(y)};return b&&(w.iv=(0,n.encode)(b)),_&&(w.tag=(0,n.encode)(_)),f&&(w.encrypted_key=(0,n.encode)(f)),v&&(w.aad=v),this._protectedHeader&&(w.protected=u.decoder.decode(g)),this._sharedUnprotectedHeader&&(w.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(w.header=this._unprotectedHeader),w}}},94280:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38994),i=r(67218),o=r(25532),a={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const r="maxLength"===e?"more":"fewer";return n.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:r,schemaCode:a,it:s}=e,c="maxLength"===t?n.operators.GT:n.operators.LT,u=!1===s.opts.unicode?n._`${r}.length`:n._`${(0,i.useFunc)(e.gen,o.default)}(${r})`;e.fail$data(n._`${u} ${c} ${a}`)}};t.default=a},94284:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolProtectionService=void 0;const n=r(60422);t.ToolProtectionService=class{config;cache;constructor(e,t){this.config=e,this.cache=t}getProjectId(){return this.config.projectId}async getStaleCache(e){if(!1===this.config.allowStaleCache)return null;if(!(this.cache instanceof n.InMemoryToolProtectionCache))return null;const t=this.cache.getStale(e);if(!t)return null;const r=this.cache.getExpiresAt(e);if(!r)return null;const i=Date.now(),o=this.config.maxStaleCacheAge??864e5;return i>r&&i-r<=o?(this.config.debug&&console.error("[ToolProtectionService] Using stale cache",{cacheKey:e,expiredAt:new Date(r).toISOString(),staleAgeMs:i-r,maxStaleAgeMs:o}),t):null}async getToolProtectionConfig(e){const t=this.config.projectId?`config:tool-protections:${this.config.projectId}`:`agent:${e}`,r=await this.cache.get(t);if(r){const n=this.config.cacheTtl??3e5,i=new Date(Date.now()+n).toISOString();return this.config.debug&&console.error("[ToolProtectionService] Cache hit",{source:"cache",cacheKey:t,agentDid:e.slice(0,20)+"...",projectId:this.config.projectId||"none",toolCount:Object.keys(r.toolProtections).length,protectedTools:Object.entries(r.toolProtections).filter(([e,t])=>t.requiresDelegation).map(([e])=>e),cacheTtlMs:n,cachedUntil:i}),r}this.config.debug&&console.error("[ToolProtectionService] Cache miss, fetching from API",{source:"api-fetch-start",cacheKey:t,agentDid:e.slice(0,20)+"...",projectId:this.config.projectId||"none",apiUrl:this.config.apiUrl,endpoint:this.config.projectId?`/api/v1/bouncer/projects/${this.config.projectId}/config`:`/api/v1/bouncer/config?agent_did=${e}`});try{const r=await this.fetchFromApi(e);this.config.debug&&console.error("[ToolProtectionService] API response received",{source:"api-fetch-complete",agentDid:e.slice(0,20)+"...",projectId:this.config.projectId||"none",responseKeys:Object.keys(r),dataKeys:r.data?Object.keys(r.data):[],rawConfig:r.data?.config||null,rawConfigToolProtection:r.data?.config?.toolProtection||null,responseMetadata:r.metadata||null});const n=this.parseToolProtectionsFromResponse(r);this.config.debug&&Object.keys(n).length>0&&console.error("[ToolProtectionService] Parsed tool protections from merged config",{toolCount:Object.keys(n).length,tools:Object.keys(n)});const i={};if(this.config.localConfig?.toolProtections)for(const[e,t]of Object.entries(this.config.localConfig.toolProtections)){if(!t||"object"!=typeof t||0===Object.keys(t).length){this.config.debug&&console.error("[ToolProtectionService] Skipping empty/invalid local config entry",{tool:e});continue}const r={requiresDelegation:t.requiresDelegation??!1,requiredScopes:t.requiredScopes??[],...t.oauthProvider&&{oauthProvider:t.oauthProvider},...t.riskLevel&&{riskLevel:t.riskLevel},...t.authorization&&{authorization:t.authorization}};i[e]=r,this.config.debug&&console.error("[ToolProtectionService] Applied local config as base",{tool:e,localConfig:r})}for(const[e,t]of Object.entries(n))i[e]=t,this.config.debug&&this.config.localConfig?.toolProtections?.[e]&&console.error("[ToolProtectionService] Remote config overrides local config",{tool:e,remoteConfig:t});const o={toolProtections:i},a=this.config.cacheTtl??3e5,s=new Date(Date.now()+a);return await this.cache.set(t,o,a),console.error("[ToolProtectionService] Config loaded from API",{source:"api",toolCount:Object.keys(i).length,protectedTools:Object.entries(i).filter(([e,t])=>t.requiresDelegation).map(([e])=>e),agentDid:e.slice(0,20)+"...",projectId:this.config.projectId||"none",cacheTtlMs:a,cacheExpiresAt:s.toISOString()}),this.config.debug&&console.error("[ToolProtectionService] API fetch successful, config cached",{source:"cache-write",agentDid:e.slice(0,20)+"...",cacheKey:t,toolCount:Object.keys(i).length,tools:Object.entries(i).map(([e,t])=>({name:e,requiresDelegation:t.requiresDelegation,scopeCount:(t.requiredScopes||[]).length})),ttlMs:a,ttlMinutes:Math.round(a/6e4),expiresAt:s.toISOString(),expiresIn:`${Math.round(a/1e3)}s`}),o}catch(r){const n=r instanceof Error?r.message:String(r);if(n.includes("API key is missing or empty"))throw r;if(n.includes("projectId is required"))throw r;if(n.includes("Failed to fetch bouncer config:")&&(429!==r.status||!this.config.offlineFallbackConfig))throw r;if(n.includes("Failed to parse API response:"))throw r;if(n.includes("API returned success: false"))throw r;this.config.debug&&console.error("[ToolProtectionService] API fetch failed",{agentDid:e.slice(0,20)+"...",error:n});const i=await this.getStaleCache(t);if(i)return console.warn("[ToolProtectionService] API fetch failed, using stale cache",{agentDid:e.slice(0,20)+"...",error:n,cacheKey:t}),i;if(this.config.offlineFallbackConfig){console.warn("[ToolProtectionService] API fetch failed, using offline fallback config",{agentDid:e.slice(0,20)+"...",error:n});const r=this.config.cacheTtl??3e5;return await this.cache.set(t,this.config.offlineFallbackConfig,r),this.config.offlineFallbackConfig}if("deny-all"===(this.config.failSafeBehavior??"deny-all")){console.error("[ToolProtectionService] API fetch failed, no offline fallback, failing closed (deny-all)",{agentDid:e.slice(0,20)+"...",error:n,cacheKey:t});const r={toolProtections:{"*":{requiresDelegation:!0,requiredScopes:[]}}},i=this.config.cacheTtl??3e5;return await this.cache.set(t,r,i),r}{console.warn("[ToolProtectionService] API fetch failed, no offline fallback, failing open (allow-all)",{agentDid:e.slice(0,20)+"...",error:n,cacheKey:t});const r={toolProtections:{}},i=this.config.cacheTtl??3e5;return await this.cache.set(t,r,i),r}}}async checkToolProtection(e,t){const r=await this.getToolProtectionConfig(t);let n=r.toolProtections[e];return!n&&r.toolProtections["*"]&&(n=r.toolProtections["*"]),(this.config.debug||!n||n.requiresDelegation)&&console.error("[ToolProtectionService] Protection check",{tool:e,agentDid:t.slice(0,20)+"...",found:!!n,isWildcard:n===r.toolProtections["*"],requiresDelegation:n?.requiresDelegation??!1,availableTools:Object.keys(r.toolProtections)}),n&&n.requiresDelegation?n:null}async fetchFromApi(e,t){let r,n=!1;if(!this.config.projectId){const e=new Error("[ToolProtectionService] projectId is required for user-scoped delegation. Agent-only scoping has been deprecated due to security concerns (cross-user delegation leakage). Please configure AGENTSHIELD_PROJECT_ID environment variable.");throw console.error("[ToolProtectionService]",e.message),e}if(r=`${this.config.apiUrl}/api/v1/bouncer/projects/${encodeURIComponent(this.config.projectId)}/config`,n=!0,t?.bypassCDNCache){const e=r.includes("?")?"&":"?";r=`${r}${e}_t=${Date.now()}`}const i=this.config.apiKey?(()=>{const e=this.config.apiKey.split("_");return e.length>=2?`${e[0]}_${e[1]}...`:`${this.config.apiKey.substring(0,8)}...`})():"(empty)",o=this.config.apiKey?.length||0;if(this.config.debug&&console.error("[ToolProtectionService] Fetching from API:",r,{method:"projects/{projectId}/config (merged)",projectId:this.config.projectId||"none",apiKeyPresent:!!this.config.apiKey,apiKeyLength:o,apiKeyMasked:i}),!this.config.apiKey||""===this.config.apiKey.trim()){const e="API key is missing or empty";throw this.config.debug&&console.error("[ToolProtectionService]",e,{apiKeyPresent:!!this.config.apiKey,apiKeyLength:o}),new Error(`ToolProtectionService: ${e}. Check AGENTSHIELD_API_KEY in .dev.vars or wrangler.toml [vars]`)}const a={"Content-Type":"application/json"};a["X-API-Key"]=this.config.apiKey,this.config.projectId&&(a["X-Project-Id"]=this.config.projectId),t?.bypassCDNCache&&(a["Cache-Control"]="no-cache, no-store, must-revalidate",a.Pragma="no-cache");const s=await fetch(r,{method:"GET",headers:a});if(!s.ok){const e=await s.text().catch(()=>"Unknown error"),t=new Error(`Failed to fetch bouncer config: ${s.status} ${s.statusText} - ${e}`);throw t.status=s.status,t}let c;try{c=await s.json()}catch(e){throw new Error(`Failed to parse API response: ${e instanceof Error?e.message:String(e)}`)}if(!c.success)throw new Error("API returned success: false");return c}parseToolProtectionsFromResponse(e){const t={},r=e.data.config?.toolProtection?.tools;if(!r)return t;for(const[e,n]of Object.entries(r)){const r=n.requiresDelegation??n.requires_delegation??!1,i=n.requiredScopes??n.required_scopes??n.scopes??[],o=n.oauthProvider??n.oauth_provider??void 0,a=n.riskLevel??n.risk_level??void 0,s=a&&["low","medium","high","critical"].includes(a)?a:void 0,c=n.authorization;t[e]={requiresDelegation:r,requiredScopes:i,...o&&{oauthProvider:o},...s&&{riskLevel:s},...c&&{authorization:c}}}return t}async clearCache(e){const t=this.config.projectId?`config:tool-protections:${this.config.projectId}`:`agent:${e}`;this.config.debug&&console.error("[ToolProtectionService] Clearing cache",{cacheKey:t,projectId:this.config.projectId||"none",agentDid:e.slice(0,20)+"..."}),await this.cache.delete(t)}async clearAndRefresh(e){const t=this.config.projectId?`config:tool-protections:${this.config.projectId}`:`agent:${e}`;console.error("[ToolProtectionService] clearAndRefresh starting",{cacheKey:t,projectId:this.config.projectId||"none",agentDid:e.slice(0,20)+"..."}),await this.cache.delete(t),console.error("[ToolProtectionService] Cache entry deleted",{cacheKey:t});try{const r=await this.fetchFromApi(e,{bypassCDNCache:!0}),n=this.parseToolProtectionsFromResponse(r),i={};if(this.config.localConfig?.toolProtections)for(const[e,t]of Object.entries(this.config.localConfig.toolProtections))if(t&&"object"==typeof t&&Object.keys(t).length>0){const r={requiresDelegation:t.requiresDelegation??!1,requiredScopes:t.requiredScopes??[],...t.oauthProvider&&{oauthProvider:t.oauthProvider},...t.riskLevel&&{riskLevel:t.riskLevel},...t.authorization&&{authorization:t.authorization}};i[e]=r}for(const[e,t]of Object.entries(n))i[e]=t;const o={toolProtections:i},a=this.config.cacheTtl??3e5;return await this.cache.set(t,o,a),console.error("[ToolProtectionService] Fresh config fetched and cached",{cacheKey:t,toolCount:Object.keys(i).length,protectedTools:Object.entries(i).filter(([e,t])=>t.requiresDelegation).map(([e])=>e),source:"api"}),{config:o,cacheKey:t,source:"api"}}catch(e){return console.warn("[ToolProtectionService] API fetch failed during refresh, using offline fallback",{error:e instanceof Error?e.message:String(e),cacheKey:t}),{config:this.config.offlineFallbackConfig||{toolProtections:{}},cacheKey:t,source:"fallback"}}}}},94726:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bitLength=o;const n=r(39069),i=r(84641);function o(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new n.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}t.default=e=>(0,i.default)(new Uint8Array(o(e)>>3))},95006:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolProtectionServiceError=t.DelegationRequiredError=void 0;class r extends Error{toolName;requiredScopes;consentUrl;resumeToken;interceptedCall;constructor(e,t,r,n,i){super(`Delegation required for tool "${e}"`),this.toolName=e,this.requiredScopes=t,this.consentUrl=r,this.name="DelegationRequiredError",this.interceptedCall=n,this.resumeToken=i}}t.DelegationRequiredError=r;class n extends Error{cause;constructor(e,t){super(e),this.cause=t,this.name="ToolProtectionServiceError"}}t.ToolProtectionServiceError=n},95202:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logger=void 0,t.createDefaultConsoleLogger=n;const r={debug:10,info:20,warn:30,error:40};function n(){let e="info",t=!1;function n(n,...i){if(function(t){return r[t]>=r[e]}(n))if(t)console.error(...i);else switch(n){case"debug":"function"==typeof console.debug?console.debug(...i):console.log(...i);break;case"info":"function"==typeof console.info?console.info(...i):console.log(...i);break;case"warn":"function"==typeof console.warn?console.warn(...i):console.error(...i);break;case"error":console.error(...i)}}return{configure(r={}){r.level&&(e=r.level),!0===r.forceStderr?t=!0:!1===r.forceStderr?t=!1:"stdio"===r.transport?t=!0:"sse"!==r.transport&&"http"!==r.transport||(t=!1)},debug:(...e)=>n("debug",...e),info:(...e)=>n("info",...e),warn:(...e)=>n("warn",...e),error:(...e)=>n("error",...e)}}t.logger=n()},95277:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.createCapabilityVerifier=t.createCombinedDidResolver=t.createVcJwtSignatureVerifier=t.DEFAULT_TRUSTED_ISSUERS=t.validateLevel2=t.verifyCapabilities=t.parseVCJWT=t.completeVCJWT=t.createUnsignedVCJWT=t.canonicalizeJSON=t.didWebToUrl=t.createDidWebResolver=t.resolveDidKeySync=t.publicKeyToJwk=t.extractPublicKeyFromDidKey=t.isEd25519DidKey=t.createDidKeyResolver=t.buildChainString=t.buildDelegationProofJWT=t.MemoryDelegationGraphStorage=t.MemoryStatusListStorage=t.createCascadingRevocationManager=t.CascadingRevocationManager=t.createDelegationGraph=t.DelegationGraphManager=t.isIndexSet=t.BitstringManager=t.createStatusListManager=t.StatusList2021Manager=t.createDelegationVerifier=t.DelegationCredentialVerifier=t.createDelegationIssuer=t.DelegationCredentialIssuer=void 0,i(r(41082),t);var o=r(30845);Object.defineProperty(t,"DelegationCredentialIssuer",{enumerable:!0,get:function(){return o.DelegationCredentialIssuer}}),Object.defineProperty(t,"createDelegationIssuer",{enumerable:!0,get:function(){return o.createDelegationIssuer}});var a=r(77460);Object.defineProperty(t,"DelegationCredentialVerifier",{enumerable:!0,get:function(){return a.DelegationCredentialVerifier}}),Object.defineProperty(t,"createDelegationVerifier",{enumerable:!0,get:function(){return a.createDelegationVerifier}});var s=r(98358);Object.defineProperty(t,"StatusList2021Manager",{enumerable:!0,get:function(){return s.StatusList2021Manager}}),Object.defineProperty(t,"createStatusListManager",{enumerable:!0,get:function(){return s.createStatusListManager}});var c=r(46610);Object.defineProperty(t,"BitstringManager",{enumerable:!0,get:function(){return c.BitstringManager}}),Object.defineProperty(t,"isIndexSet",{enumerable:!0,get:function(){return c.isIndexSet}});var u=r(55921);Object.defineProperty(t,"DelegationGraphManager",{enumerable:!0,get:function(){return u.DelegationGraphManager}}),Object.defineProperty(t,"createDelegationGraph",{enumerable:!0,get:function(){return u.createDelegationGraph}});var d=r(24886);Object.defineProperty(t,"CascadingRevocationManager",{enumerable:!0,get:function(){return d.CascadingRevocationManager}}),Object.defineProperty(t,"createCascadingRevocationManager",{enumerable:!0,get:function(){return d.createCascadingRevocationManager}});var l=r(7318);Object.defineProperty(t,"MemoryStatusListStorage",{enumerable:!0,get:function(){return l.MemoryStatusListStorage}});var p=r(44558);Object.defineProperty(t,"MemoryDelegationGraphStorage",{enumerable:!0,get:function(){return p.MemoryDelegationGraphStorage}});var f=r(68681);Object.defineProperty(t,"buildDelegationProofJWT",{enumerable:!0,get:function(){return f.buildDelegationProofJWT}}),Object.defineProperty(t,"buildChainString",{enumerable:!0,get:function(){return f.buildChainString}});var h=r(63146);Object.defineProperty(t,"createDidKeyResolver",{enumerable:!0,get:function(){return h.createDidKeyResolver}}),Object.defineProperty(t,"isEd25519DidKey",{enumerable:!0,get:function(){return h.isEd25519DidKey}}),Object.defineProperty(t,"extractPublicKeyFromDidKey",{enumerable:!0,get:function(){return h.extractPublicKeyFromDidKey}}),Object.defineProperty(t,"publicKeyToJwk",{enumerable:!0,get:function(){return h.publicKeyToJwk}}),Object.defineProperty(t,"resolveDidKeySync",{enumerable:!0,get:function(){return h.resolveDidKeySync}});var m=r(30765);Object.defineProperty(t,"createDidWebResolver",{enumerable:!0,get:function(){return m.createDidWebResolver}}),Object.defineProperty(t,"didWebToUrl",{enumerable:!0,get:function(){return m.didWebToUrl}});var g=r(63969);Object.defineProperty(t,"canonicalizeJSON",{enumerable:!0,get:function(){return g.canonicalizeJSON}}),Object.defineProperty(t,"createUnsignedVCJWT",{enumerable:!0,get:function(){return g.createUnsignedVCJWT}}),Object.defineProperty(t,"completeVCJWT",{enumerable:!0,get:function(){return g.completeVCJWT}}),Object.defineProperty(t,"parseVCJWT",{enumerable:!0,get:function(){return g.parseVCJWT}});var v=r(26027);Object.defineProperty(t,"verifyCapabilities",{enumerable:!0,get:function(){return v.verifyCapabilities}}),Object.defineProperty(t,"validateLevel2",{enumerable:!0,get:function(){return v.validateLevel2}}),Object.defineProperty(t,"DEFAULT_TRUSTED_ISSUERS",{enumerable:!0,get:function(){return v.DEFAULT_TRUSTED_ISSUERS}}),Object.defineProperty(t,"createVcJwtSignatureVerifier",{enumerable:!0,get:function(){return v.createVcJwtSignatureVerifier}}),Object.defineProperty(t,"createCombinedDidResolver",{enumerable:!0,get:function(){return v.createCombinedDidResolver}}),Object.defineProperty(t,"createCapabilityVerifier",{enumerable:!0,get:function(){return v.createCapabilityVerifier}})},95538:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(72425),i=r(50550),o=r(7918),a=r(80338),s=r(3508),c=r(32139),u=r(39069),d=r(94726),l=r(68846),p=r(89666),f=r(71661),h=r(6093);t.default=async function(e,t,r,m,g){switch((0,p.default)(e,t,"decrypt"),t=await(c.default.normalizePrivateKey?.(t,e))||t,e){case"dir":if(void 0!==r)throw new u.JWEInvalid("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new u.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,f.default)(m.epk))throw new u.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!i.ecdhAllowed(t))throw new u.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const o=await(0,l.importJWK)(m.epk,e);let a,c;if(void 0!==m.apu){if("string"!=typeof m.apu)throw new u.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{a=(0,s.decode)(m.apu)}catch{throw new u.JWEInvalid("Failed to base64url decode the apu")}}if(void 0!==m.apv){if("string"!=typeof m.apv)throw new u.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{c=(0,s.decode)(m.apv)}catch{throw new u.JWEInvalid("Failed to base64url decode the apv")}}const p=await i.deriveKey(o,t,"ECDH-ES"===e?m.enc:e,"ECDH-ES"===e?(0,d.bitLength)(m.enc):parseInt(e.slice(-5,-2),10),a,c);if("ECDH-ES"===e)return p;if(void 0===r)throw new u.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e.slice(-6),p,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new u.JWEInvalid("JWE Encrypted Key missing");return(0,a.decrypt)(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===r)throw new u.JWEInvalid("JWE Encrypted Key missing");if("number"!=typeof m.p2c)throw new u.JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');const n=g?.maxPBES2Count||1e4;if(m.p2c>n)throw new u.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof m.p2s)throw new u.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let i;try{i=(0,s.decode)(m.p2s)}catch{throw new u.JWEInvalid("Failed to base64url decode the p2s")}return(0,o.decrypt)(e,t,r,m.p2c,i)}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new u.JWEInvalid("JWE Encrypted Key missing");return(0,n.unwrap)(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(void 0===r)throw new u.JWEInvalid("JWE Encrypted Key missing");if("string"!=typeof m.iv)throw new u.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof m.tag)throw new u.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let n,i;try{n=(0,s.decode)(m.iv)}catch{throw new u.JWEInvalid("Failed to base64url decode the iv")}try{i=(0,s.decode)(m.tag)}catch{throw new u.JWEInvalid("Failed to base64url decode the tag")}return(0,h.unwrap)(e,t,r,n,i)}default:throw new u.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}},96114:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasMergedToolProtections=t.extractToolProtections=t.getToolProtection=t.fetchRemoteConfig=t.ProviderRuntimeConfigBuilder=void 0,t.createProviderRuntimeConfig=function(e,t){return(new n).withProviders(e).withEnvironment(t?.environment||"development").withSession(t?.session||{}).withIdentity(t?.identity||{enabled:!1,environment:"development"}).withProofing(t?.proofing||{enabled:!1}).withDelegation(t?.delegation||{enabled:!1,verifier:{type:"memory"}}).withAuditTrail(t?.auditTrail).withWellKnown(t?.wellKnown||{enabled:!0}).build()};class n{config={environment:"development"};withProviders(e){return Object.assign(this.config,e),this}withEnvironment(e){return this.config.environment=e,this}withSession(e){return this.config.session=e,this}withIdentity(e){return this.config.identity=e,this}withProofing(e){return this.config.proofing=e,this}withDelegation(e){return this.config.delegation=e,this}withToolProtectionService(e){return this.config.toolProtectionService=e,this}withToolProtection(e){return this.config.toolProtection=e,this}withAuditTrail(e){return this.config.auditTrail=e,this}withWellKnown(e){return this.config.wellKnown=e,this}build(){const e=["cryptoProvider","clockProvider","fetchProvider","storageProvider","nonceCacheProvider","identityProvider"];for(const t of e)if(!(t in this.config))throw new Error(`Missing required provider: ${t}`);return{environment:"development",session:{timestampSkewSeconds:120,ttlMinutes:30},...this.config}}}t.ProviderRuntimeConfigBuilder=n;var i=r(52150);Object.defineProperty(t,"fetchRemoteConfig",{enumerable:!0,get:function(){return i.fetchRemoteConfig}}),Object.defineProperty(t,"getToolProtection",{enumerable:!0,get:function(){return i.getToolProtection}}),Object.defineProperty(t,"extractToolProtections",{enumerable:!0,get:function(){return i.extractToolProtections}}),Object.defineProperty(t,"hasMergedToolProtections",{enumerable:!0,get:function(){return i.hasMergedToolProtections}})},97829:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateResumeToken=t.MemoryResumeTokenStore=t.hasSensitiveScopes=t.verifyOrHints=void 0;var n=r(36796);Object.defineProperty(t,"verifyOrHints",{enumerable:!0,get:function(){return n.verifyOrHints}}),Object.defineProperty(t,"hasSensitiveScopes",{enumerable:!0,get:function(){return n.hasSensitiveScopes}}),Object.defineProperty(t,"MemoryResumeTokenStore",{enumerable:!0,get:function(){return n.MemoryResumeTokenStore}}),Object.defineProperty(t,"generateResumeToken",{enumerable:!0,get:function(){return n.generateResumeToken}})},98119:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(33330),i=r(30930),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n.default,i.default];t.default=o},98358:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusList2021Manager=void 0,t.createStatusListManager=function(e,t,r,n,i,a){return new o(e,t,r,n,i,a)};const n=r(46610),i=r(63969);class o{storage;identity;signingFunction;compressor;decompressor;statusListBaseUrl;defaultListSize;constructor(e,t,r,n,i,o){this.storage=e,this.identity=t,this.signingFunction=r,this.compressor=n,this.decompressor=i,this.statusListBaseUrl=o?.statusListBaseUrl||"https://status.example.com",this.defaultListSize=o?.defaultListSize||131072}async allocateStatusEntry(e){const t=`${this.statusListBaseUrl}/${e}/v1`,r=await this.storage.allocateIndex(t);return await this.ensureStatusListExists(t,e),{id:`${t}#${r}`,type:"StatusList2021Entry",statusPurpose:e,statusListIndex:r.toString(),statusListCredential:t}}async updateStatus(e,t){const{statusListCredential:r,statusListIndex:o}=e,a=await this.storage.getStatusList(r);if(!a)throw new Error(`Status list not found: ${r}`);const s=await n.BitstringManager.decode(a.credentialSubject.encodedList,this.compressor,this.decompressor),c=parseInt(o,10);s.setBit(c,t);const u=await s.encode(),d={...a,credentialSubject:{...a.credentialSubject,encodedList:u}},l={...d};delete l.proof;const p=(0,i.canonicalizeJSON)(l),f=await this.signingFunction(p,this.identity.getDid(),this.identity.getKeyId()),h={...d,proof:f};await this.storage.setStatusList(r,h)}async checkStatus(e){const{statusListCredential:t,statusListIndex:r}=e,i=await this.storage.getStatusList(t);if(!i)return!1;const o=await n.BitstringManager.decode(i.credentialSubject.encodedList,this.compressor,this.decompressor),a=parseInt(r,10);return o.getBit(a)}async getRevokedIndices(e){const t=await this.storage.getStatusList(e);return t?(await n.BitstringManager.decode(t.credentialSubject.encodedList,this.compressor,this.decompressor)).getSetBits():[]}async ensureStatusListExists(e,t){if(await this.storage.getStatusList(e))return;const r=new n.BitstringManager(this.defaultListSize,this.compressor,this.decompressor),o=await r.encode(),a={"@context":["https://www.w3.org/2018/credentials/v1","https://w3id.org/vc/status-list/2021/v1"],id:e,type:["VerifiableCredential","StatusList2021Credential"],issuer:this.identity.getDid(),issuanceDate:(new Date).toISOString(),credentialSubject:{id:`${e}#list`,type:"StatusList2021",statusPurpose:t,encodedList:o}},s=(0,i.canonicalizeJSON)(a),c=await this.signingFunction(s,this.identity.getDid(),this.identity.getKeyId()),u={...a,proof:c};await this.storage.setStatusList(e,u)}getStatusListBaseUrl(){return this.statusListBaseUrl}getDefaultListSize(){return this.defaultListSize}}t.StatusList2021Manager=o},98448:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(56497),t)},99135:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCryptoKey=void 0;const n=r(77598),i=r(57975),o=n.webcrypto;t.default=o,t.isCryptoKey=e=>i.types.isCryptoKey(e)}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var o=r[e]={exports:{}};return t[e].call(o.exports,o,o.exports,n),o.exports}n.m=t,n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>e+".js",n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e={966:1},n.f.require=(t,r)=>{if(!e[t]){var i=require("./"+n.u(t));e[t]||(t=>{var r=t.modules,i=t.ids,o=t.runtime;for(var a in r)n.o(r,a)&&(n.m[a]=r[a]);o&&o(n);for(var s=0;s<i.length;s++)e[i[s]]=1})(i)}},(()=>{"use strict";const e=require("node:process");function t(e,t,r){function n(r,n){var i;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(i=r._zod).traits??(i.traits=new Set),r._zod.traits.add(e),t(r,n);for(const e in a.prototype)e in r||Object.defineProperty(r,e,{value:a.prototype[e].bind(r)});r._zod.constr=a,r._zod.def=n}const i=r?.Parent??Object;class o extends i{}function a(e){var t;const i=r?.Parent?new o:this;n(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Symbol("zod_brand");class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const i={};function o(e){return e&&Object.assign(i,e),i}function a(e,t="|"){return e.map(e=>k(e)).join(t)}function s(e,t){return"bigint"==typeof t?t.toString():t}function c(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function u(e){return null==e}function d(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function l(e,t,r){Object.defineProperty(e,t,{get(){{const n=r();return e[t]=n,n}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function p(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function f(e=10){let t="";for(let r=0;r<e;r++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(26*Math.random())];return t}function h(e){return JSON.stringify(e)}const m=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function g(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const v=c(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function y(e){if(!1===g(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!1!==g(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}const _=new Set(["string","number","symbol"]);function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function $(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function k(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}new Set(["string","number","bigint","boolean","symbol","undefined"]);const S={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function I(e,t=0){for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r].continue)return!0;return!1}function P(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function E(e){return"string"==typeof e?e:e?.message}function x(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const i=E(e.inst?._zod.def?.error?.(e))??E(t?.error?.(e))??E(r.customError?.(e))??E(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function O(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function T(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const A=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,s,2),enumerable:!0})},C=t("$ZodError",A),j=t("$ZodError",A,{Parent:Error}),D=e=>(t,n,i,a)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){const t=new(a?.Err??e)(c.issues.map(e=>x(e,s,o())));throw m(t,a?.callee),t}return c.value},z=e=>async(t,r,n,i)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>x(e,a,o())));throw m(t,i?.callee),t}return s.value},N=e=>(t,n,i)=>{const a=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??C)(s.issues.map(e=>x(e,a,o())))}:{success:!0,data:s.value}},R=N(j),U=e=>async(t,r,n)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>x(e,i,o())))}:{success:!0,data:a.value}},M=U(j),K=/^[cC][^\s-]{8,}$/,Z=/^[0-9a-z]+$/,J=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L=/^[0-9a-vA-V]{20}$/,W=/^[A-Za-z0-9]{27}$/,F=/^[a-zA-Z0-9_-]{21}$/,V=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,H=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,q=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,B=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Y=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,X=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Q=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,te=/^[A-Za-z0-9_-]*$/,re=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,ne=/^\+(?:[0-9]){6,14}[0-9]$/,ie="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",oe=new RegExp(`^${ie}$`);function ae(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const se=/^\d+$/,ce=/^-?\d+(?:\.\d+)?/i,ue=/true|false/i,de=/null/i,le=/^[^A-Z]*$/,pe=/^[^a-z]*$/,fe=t("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),he={number:"number",bigint:"bigint",object:"date"},me=t("$ZodCheckLessThan",(e,t)=>{fe.init(e,t);const r=he[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ge=t("$ZodCheckGreaterThan",(e,t)=>{fe.init(e,t);const r=he[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ve=t("$ZodCheckMultipleOf",(e,t)=>{fe.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ye=t("$ZodCheckNumberFormat",(e,t)=>{fe.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[i,o]=S[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=o,r&&(n.pattern=se)}),e._zod.check=a=>{const s=a.value;if(r){if(!Number.isInteger(s))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}))}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inst:e})}}),_e=t("$ZodCheckMaxLength",(e,t)=>{fe.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const i=O(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),be=t("$ZodCheckMinLength",(e,t)=>{fe.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const i=O(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),we=t("$ZodCheckLengthEquals",(e,t)=>{fe.init(e,t),e._zod.when=e=>{const t=e.value;return!u(t)&&void 0!==t.length},e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,i=n.length;if(i===t.length)return;const o=O(n),a=i>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},input:r.value,inst:e,continue:!t.abort})}}),$e=t("$ZodCheckStringFormat",(e,t)=>{var r;fe.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),(r=e._zod).check??(r.check=r=>{if(!t.pattern)throw new Error("Not implemented.");t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})})}),ke=t("$ZodCheckRegex",(e,t)=>{$e.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Se=t("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=le),$e.init(e,t)}),Ie=t("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pe),$e.init(e,t)}),Pe=t("$ZodCheckIncludes",(e,t)=>{fe.init(e,t);const r=b(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Ee=t("$ZodCheckStartsWith",(e,t)=>{fe.init(e,t);const r=new RegExp(`^${b(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),xe=t("$ZodCheckEndsWith",(e,t)=>{fe.init(e,t);const r=new RegExp(`.*${b(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Oe=t("$ZodCheckOverwrite",(e,t)=>{fe.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Te{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Ae={major:4,minor:0,patch:0},Ce=t("$ZodType",(e,t)=>{var n;e??(e={}),l(e._zod,"id",()=>t.type+"_"+f(10)),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ae;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const r of t._zod.onattach)r(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let i,o=I(e);for(const a of t){if(a._zod.when){if(!a._zod.when(e))continue}else if(o)continue;const t=e.issues.length,s=a._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new r;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(o||(o=I(e,t)))});else{if(e.issues.length===t)continue;o||(o=I(e,t))}}return i?i.then(()=>e):e};e._zod.run=(n,o)=>{const a=e._zod.parse(n,o);if(a instanceof Promise){if(!1===o.async)throw new r;return a.then(e=>t(e,i,o))}return t(a,i,o)}}e["~standard"]={validate:t=>{try{const r=R(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return M(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),je=t("$ZodString",(e,t)=>{var r;Ce.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),De=t("$ZodStringFormat",(e,t)=>{$e.init(e,t),je.init(e,t)}),ze=t("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=H),De.init(e,t)}),Ne=t("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=q(e))}else t.pattern??(t.pattern=q());De.init(e,t)}),Re=t("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=B),De.init(e,t)}),Ue=t("$ZodURL",(e,t)=>{De.init(e,t),e._zod.check=r=>{try{const n=new URL(r.value);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:re.source,input:r.value,inst:e,continue:!t.abort})),void(t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})))}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Me=t("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),De.init(e,t)}),Ke=t("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=F),De.init(e,t)}),Ze=t("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=K),De.init(e,t)}),Je=t("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Z),De.init(e,t)}),Le=t("$ZodULID",(e,t)=>{t.pattern??(t.pattern=J),De.init(e,t)}),We=t("$ZodXID",(e,t)=>{t.pattern??(t.pattern=L),De.init(e,t)}),Fe=t("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=W),De.init(e,t)}),Ve=t("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ae({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${ie}T(?:${n})$`)}(t)),De.init(e,t),e._zod.check}),He=t("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=oe),De.init(e,t)}),qe=t("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ae(t)}$`)),De.init(e,t),e._zod.check}),Be=t("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=V),De.init(e,t)}),Ge=t("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=G),De.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Ye=t("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Y),De.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Xe=t("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=X),De.init(e,t)}),Qe=t("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Q),De.init(e,t),e._zod.check=r=>{const[n,i]=r.value.split("/");try{if(!i)throw new Error;const e=Number(i);if(`${e}`!==i)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function et(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const tt=t("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ee),De.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{et(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rt=t("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=te),De.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{(function(e){if(!te.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return et(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),nt=t("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ne),De.init(e,t)}),it=t("$ZodJWT",(e,t)=>{De.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r,i=JSON.parse(atob(n));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ot=t("$ZodNumber",(e,t)=>{Ce.init(e,t),e._zod.pattern=e._zod.bag.pattern??ce,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}const i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),at=t("$ZodNumber",(e,t)=>{ye.init(e,t),ot.init(e,t)}),st=t("$ZodBoolean",(e,t)=>{Ce.init(e,t),e._zod.pattern=ue,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(e){}const i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),ct=t("$ZodNull",(e,t)=>{Ce.init(e,t),e._zod.pattern=de,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{const{value:n}=t;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),ut=t("$ZodUnknown",(e,t)=>{Ce.init(e,t),e._zod.parse=e=>e}),dt=t("$ZodNever",(e,t)=>{Ce.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function lt(e,t,r){e.issues.length&&t.issues.push(...P(r,e.issues)),t.value[r]=e.value}const pt=t("$ZodArray",(e,t)=>{Ce.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const a=i[e],s=t.element._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(t=>lt(t,r,e))):lt(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function ft(e,t,r){e.issues.length&&t.issues.push(...P(r,e.issues)),t.value[r]=e.value}function ht(e,t,r,n){e.issues.length?void 0===n[r]?t.value[r]=r in n?void 0:e.value:t.issues.push(...P(r,e.issues)):void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}const mt=t("$ZodObject",(e,t)=>{Ce.init(e,t);const r=c(()=>{const e=Object.keys(t.shape);for(const r of e)if(!(t.shape[r]instanceof Ce))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=t.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}});let n;l(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const o=g,a=!i.jitless,s=a&&v.value,{catchall:u}=t;let d;e._zod.parse=(i,c)=>{d??(d=r.value);const l=i.value;if(!o(l))return i.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),i;const p=[];if(a&&s&&!1===c?.async&&!0!==c.jitless)n||(n=(e=>{const t=new Te(["shape","payload","ctx"]),{keys:n,optionalKeys:i}=r.value,o=e=>{const t=h(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const a=Object.create(null);for(const e of n)a[e]=f(15);t.write("const newResult = {}");for(const e of n)if(i.has(e)){const r=a[e];t.write(`const ${r} = ${o(e)};`);const n=h(e);t.write(`\n if (${r}.issues.length) {\n if (input[${n}] === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${r}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}],\n }))\n );\n }\n } else if (${r}.value === undefined) {\n if (${n} in input) newResult[${n}] = undefined;\n } else {\n newResult[${n}] = ${r}.value;\n }\n `)}else{const r=a[e];t.write(`const ${r} = ${o(e)};`),t.write(`\n if (${r}.issues.length) payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${h(e)}, ...iss.path] : [${h(e)}]\n })));`),t.write(`newResult[${h(e)}] = ${r}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),i=n(i,c);else{i.value={};const e=d.shape;for(const t of d.keys){const r=e[t],n=r._zod.run({value:l[t],issues:[]},c),o="optional"===r._zod.optin&&"optional"===r._zod.optout;n instanceof Promise?p.push(n.then(e=>o?ht(e,i,t,l):ft(e,i,t))):o?ht(n,i,t,l):ft(n,i,t)}}if(!u)return p.length?Promise.all(p).then(()=>i):i;const m=[],g=d.keySet,v=u._zod,y=v.def.type;for(const e of Object.keys(l)){if(g.has(e))continue;if("never"===y){m.push(e);continue}const t=v.run({value:l[e],issues:[]},c);t instanceof Promise?p.push(t.then(t=>ft(t,i,e))):ft(t,i,e)}return m.length&&i.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),p.length?Promise.all(p).then(()=>i):i}});function gt(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>x(e,n,o())))}),t}const vt=t("$ZodUnion",(e,t)=>{Ce.init(e,t),l(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),l(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>d(e.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let i=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},n);if(t instanceof Promise)o.push(t),i=!0;else{if(0===t.issues.length)return t;o.push(t)}}return i?Promise.all(o).then(t=>gt(t,r,e,n)):gt(o,r,e,n)}}),yt=t("$ZodDiscriminatedUnion",(e,t)=>{vt.init(e,t);const r=e._zod.parse;l(e._zod,"propValues",()=>{const e={};for(const r of t.options){const n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[t,r]of Object.entries(n)){e[t]||(e[t]=new Set);for(const n of r)e[t].add(n)}}return e});const n=c(()=>{const e=t.options,r=new Map;for(const n of e){const e=n._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(r.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,o)=>{const a=i.value;if(!g(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;const s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[t.discriminator],inst:e}),i)}}),_t=t("$ZodIntersection",(e,t)=>{Ce.init(e,t),e._zod.parse=(e,r)=>{const{value:n}=e,i=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,r])=>wt(e,t,r)):wt(e,i,o)}});function bt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(y(e)&&y(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};for(const r of n){const n=bt(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i[r]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const i=bt(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function wt(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),I(e))return e;const n=bt(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const $t=t("$ZodRecord",(e,t)=>{Ce.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!y(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const a=[];if(t.keyType._zod.values){const o=t.keyType._zod.values;r.value={};for(const e of o)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const o=t.valueType._zod.run({value:i[e],issues:[]},n);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&r.issues.push(...P(e,t.issues)),r.value[e]=t.value})):(o.issues.length&&r.issues.push(...P(e,o.issues)),r.value[e]=o.value)}let s;for(const e in i)o.has(e)||(s=s??[],s.push(e));s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else{r.value={};for(const s of Reflect.ownKeys(i)){if("__proto__"===s)continue;const c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:c.issues.map(e=>x(e,n,o())),input:s,path:[s],inst:e}),r.value[c.value]=c.value;continue}const u=t.valueType._zod.run({value:i[s],issues:[]},n);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&r.issues.push(...P(s,e.issues)),r.value[c.value]=e.value})):(u.issues.length&&r.issues.push(...P(s,u.issues)),r.value[c.value]=u.value)}}return a.length?Promise.all(a).then(()=>r):r}}),kt=t("$ZodEnum",(e,t)=>{Ce.init(e,t);const r=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(e=>_.has(typeof e)).map(e=>"string"==typeof e?b(e):e.toString()).join("|")})$`),e._zod.parse=(t,n)=>{const i=t.value;return e._zod.values.has(i)||t.issues.push({code:"invalid_value",values:r,input:i,inst:e}),t}}),St=t("$ZodLiteral",(e,t)=>{Ce.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?b(e):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(r,n)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),It=t("$ZodTransform",(e,t)=>{Ce.init(e,t),e._zod.parse=(e,n)=>{const i=t.transform(e.value,e);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(t=>(e.value=t,e));if(i instanceof Promise)throw new r;return e.value=i,e}}),Pt=t("$ZodOptional",(e,t)=>{Ce.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),l(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>void 0===e.value?e:t.innerType._zod.run(e,r)}),Et=t("$ZodNullable",(e,t)=>{Ce.init(e,t),l(e._zod,"optin",()=>t.innerType._zod.optin),l(e._zod,"optout",()=>t.innerType._zod.optout),l(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)}|null)$`):void 0}),l(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),xt=t("$ZodDefault",(e,t)=>{Ce.init(e,t),e._zod.optin="optional",l(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Ot(e,t)):Ot(n,t)}});function Ot(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Tt=t("$ZodPrefault",(e,t)=>{Ce.init(e,t),e._zod.optin="optional",l(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),At=t("$ZodNonOptional",(e,t)=>{Ce.init(e,t),l(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>Ct(t,e)):Ct(i,e)}});function Ct(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const jt=t("$ZodCatch",(e,t)=>{Ce.init(e,t),l(e._zod,"optin",()=>t.innerType._zod.optin),l(e._zod,"optout",()=>t.innerType._zod.optout),l(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>x(e,r,o()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>x(e,r,o()))},input:e.value}),e.issues=[]),e)}}),Dt=t("$ZodPipe",(e,t)=>{Ce.init(e,t),l(e._zod,"values",()=>t.in._zod.values),l(e._zod,"optin",()=>t.in._zod.optin),l(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(e,r)=>{const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>zt(e,t,r)):zt(n,t,r)}});function zt(e,t,r){return I(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const Nt=t("$ZodReadonly",(e,t)=>{Ce.init(e,t),l(e._zod,"propValues",()=>t.innerType._zod.propValues),l(e._zod,"optin",()=>t.innerType._zod.optin),l(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(Rt):Rt(n)}});function Rt(e){return e.value=Object.freeze(e.value),e}const Ut=t("$ZodCustom",(e,t)=>{fe.init(e,t),Ce.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>Mt(t,r,n,e));Mt(i,r,n,e)}});function Mt(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(T(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class Kt{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Zt(){return new Kt}const Jt=Zt();function Lt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function Wt(e,t){return new me({check:"less_than",...$(t),value:e,inclusive:!1})}function Ft(e,t){return new me({check:"less_than",...$(t),value:e,inclusive:!0})}function Vt(e,t){return new ge({check:"greater_than",...$(t),value:e,inclusive:!1})}function Ht(e,t){return new ge({check:"greater_than",...$(t),value:e,inclusive:!0})}function qt(e,t){return new ve({check:"multiple_of",...$(t),value:e})}function Bt(e,t){return new _e({check:"max_length",...$(t),maximum:e})}function Gt(e,t){return new be({check:"min_length",...$(t),minimum:e})}function Yt(e,t){return new we({check:"length_equals",...$(t),length:e})}function Xt(e){return new Oe({check:"overwrite",tx:e})}const Qt=t("ZodISODateTime",(e,t)=>{Ve.init(e,t),hr.init(e,t)});function er(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}(Qt,e)}const tr=t("ZodISODate",(e,t)=>{He.init(e,t),hr.init(e,t)});const rr=t("ZodISOTime",(e,t)=>{qe.init(e,t),hr.init(e,t)});const nr=t("ZodISODuration",(e,t)=>{Be.init(e,t),hr.init(e,t)});const ir=(e,t)=>{C.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const r=t||function(e){return e.message},n={_errors:[]},i=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>i({issues:e}));else if("invalid_key"===t.code)i({issues:t.issues});else if("invalid_element"===t.code)i({issues:t.issues});else if(0===t.path.length)n._errors.push(r(t));else{let e=n,i=0;for(;i<t.path.length;){const n=t.path[i];i===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(r(t))):e[n]=e[n]||{_errors:[]},e=e[n],i++}}};return i(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},or=(t("ZodError",ir),t("ZodError",ir,{Parent:Error})),ar=D(or),sr=z(or),cr=N(or),ur=U(or),dr=t("ZodType",(e,t)=>(Ce.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,r)=>w(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>ar(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>cr(e,t,r),e.parseAsync=async(t,r)=>sr(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ur(e,t,r),e.spa=e.safeParseAsync,e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}($n,e,t)}(t,r)),e.superRefine=t=>e.check(function(e){const t=function(e,t){const r=new fe({check:"custom",...$(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(T(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(T(n))}},e(r.value,r)),void 0);return t}(t)),e.overwrite=t=>e.check(Xt(t)),e.optional=()=>pn(e),e.nullable=()=>hn(e),e.nullish=()=>pn(hn(e)),e.nonoptional=t=>function(e,t){return new vn({type:"nonoptional",innerType:e,...$(t)})}(e,t),e.array=()=>Vr(e),e.or=t=>Yr([e,t]),e.and=t=>tn(e,t),e.transform=t=>bn(e,dn(t)),e.default=t=>{return r=t,new mn({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():r}});var r},e.prefault=t=>{return r=t,new gn({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():r}});var r},e.catch=t=>{return new yn({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>bn(e,t),e.readonly=()=>new wn({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Jt.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Jt.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Jt.get(e);const r=e.clone();return Jt.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),lr=t("_ZodString",(e,t)=>{je.init(e,t),dr.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ke({check:"string_format",format:"regex",...$(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Pe({check:"string_format",format:"includes",...$(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ee({check:"string_format",format:"starts_with",...$(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new xe({check:"string_format",format:"ends_with",...$(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Gt(...t)),e.max=(...t)=>e.check(Bt(...t)),e.length=(...t)=>e.check(Yt(...t)),e.nonempty=(...t)=>e.check(Gt(1,...t)),e.lowercase=t=>e.check(function(e){return new Se({check:"string_format",format:"lowercase",...$(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ie({check:"string_format",format:"uppercase",...$(e)})}(t)),e.trim=()=>e.check(Xt(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Xt(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Xt(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Xt(e=>e.toUpperCase()))}),pr=t("ZodString",(e,t)=>{je.init(e,t),lr.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}(mr,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}(yr,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}(jr,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}(_r,t)),e.guid=t=>e.check(Lt(gr,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}(vr,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}(vr,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}(vr,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}(vr,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}(br,t)),e.guid=t=>e.check(Lt(gr,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}(wr,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}($r,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}(kr,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}(Tr,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}(Ar,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}(Sr,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}(Ir,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}(Pr,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}(Er,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}(xr,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}(Or,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}(Cr,t)),e.datetime=t=>e.check(er(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}(tr,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}(rr,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}(nr,e)}(t))});function fr(e){return function(e,t){return new e({type:"string",...$(t)})}(pr,e)}const hr=t("ZodStringFormat",(e,t)=>{De.init(e,t),lr.init(e,t)}),mr=t("ZodEmail",(e,t)=>{Re.init(e,t),hr.init(e,t)}),gr=t("ZodGUID",(e,t)=>{ze.init(e,t),hr.init(e,t)}),vr=t("ZodUUID",(e,t)=>{Ne.init(e,t),hr.init(e,t)}),yr=t("ZodURL",(e,t)=>{Ue.init(e,t),hr.init(e,t)}),_r=t("ZodEmoji",(e,t)=>{Me.init(e,t),hr.init(e,t)}),br=t("ZodNanoID",(e,t)=>{Ke.init(e,t),hr.init(e,t)}),wr=t("ZodCUID",(e,t)=>{Ze.init(e,t),hr.init(e,t)}),$r=t("ZodCUID2",(e,t)=>{Je.init(e,t),hr.init(e,t)}),kr=t("ZodULID",(e,t)=>{Le.init(e,t),hr.init(e,t)}),Sr=t("ZodXID",(e,t)=>{We.init(e,t),hr.init(e,t)}),Ir=t("ZodKSUID",(e,t)=>{Fe.init(e,t),hr.init(e,t)}),Pr=t("ZodIPv4",(e,t)=>{Ge.init(e,t),hr.init(e,t)}),Er=t("ZodIPv6",(e,t)=>{Ye.init(e,t),hr.init(e,t)}),xr=t("ZodCIDRv4",(e,t)=>{Xe.init(e,t),hr.init(e,t)}),Or=t("ZodCIDRv6",(e,t)=>{Qe.init(e,t),hr.init(e,t)}),Tr=t("ZodBase64",(e,t)=>{tt.init(e,t),hr.init(e,t)}),Ar=t("ZodBase64URL",(e,t)=>{rt.init(e,t),hr.init(e,t)}),Cr=t("ZodE164",(e,t)=>{nt.init(e,t),hr.init(e,t)}),jr=t("ZodJWT",(e,t)=>{it.init(e,t),hr.init(e,t)}),Dr=t("ZodNumber",(e,t)=>{ot.init(e,t),dr.init(e,t),e.gt=(t,r)=>e.check(Vt(t,r)),e.gte=(t,r)=>e.check(Ht(t,r)),e.min=(t,r)=>e.check(Ht(t,r)),e.lt=(t,r)=>e.check(Wt(t,r)),e.lte=(t,r)=>e.check(Ft(t,r)),e.max=(t,r)=>e.check(Ft(t,r)),e.int=t=>e.check(Rr(t)),e.safe=t=>e.check(Rr(t)),e.positive=t=>e.check(Vt(0,t)),e.nonnegative=t=>e.check(Ht(0,t)),e.negative=t=>e.check(Wt(0,t)),e.nonpositive=t=>e.check(Ft(0,t)),e.multipleOf=(t,r)=>e.check(qt(t,r)),e.step=(t,r)=>e.check(qt(t,r)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function zr(e){return function(e,t){return new e({type:"number",checks:[],...$(t)})}(Dr,e)}const Nr=t("ZodNumberFormat",(e,t)=>{at.init(e,t),Dr.init(e,t)});function Rr(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}(Nr,e)}const Ur=t("ZodBoolean",(e,t)=>{st.init(e,t),dr.init(e,t)});function Mr(e){return function(e,t){return new e({type:"boolean",...$(t)})}(Ur,e)}const Kr=t("ZodNull",(e,t)=>{ct.init(e,t),dr.init(e,t)});function Zr(e){return function(e,t){return new e({type:"null",...$(t)})}(Kr,e)}const Jr=t("ZodUnknown",(e,t)=>{ut.init(e,t),dr.init(e,t)});function Lr(){return new Jr({type:"unknown"})}const Wr=t("ZodNever",(e,t)=>{dt.init(e,t),dr.init(e,t)});const Fr=t("ZodArray",(e,t)=>{pt.init(e,t),dr.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(Gt(t,r)),e.nonempty=t=>e.check(Gt(1,t)),e.max=(t,r)=>e.check(Bt(t,r)),e.length=(t,r)=>e.check(Yt(t,r)),e.unwrap=()=>e.element});function Vr(e,t){return function(e,t,r){return new e({type:"array",element:t,...$(r)})}(Fr,e,t)}const Hr=t("ZodObject",(e,t)=>{mt.init(e,t),dr.init(e,t),l(e,"shape",()=>t.shape),e.keyof=()=>an(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Lr()}),e.loose=()=>e.clone({...e._zod.def,catchall:Lr()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:function(e,t){return new e({type:"never",...$(t)})}(Wr,t)});var t},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){const r={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return p(this,"shape",r),r},checks:[]};return w(e,r)}(e,t),e.merge=t=>{return n=t,w(r=e,{...r._zod.def,get shape(){const e={...r._zod.def.shape,...n._zod.def.shape};return p(this,"shape",e),e},catchall:n._zod.def.catchall,checks:[]});var r,n},e.pick=t=>function(e,t){const r={},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(r[e]=n.shape[e])}return w(e,{...e._zod.def,shape:r,checks:[]})}(e,t),e.omit=t=>function(e,t){const r={...e._zod.def.shape},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return w(e,{...e._zod.def,shape:r,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return w(t,{...t._zod.def,shape:i,checks:[]})}(ln,e,t[0]),e.required=(...t)=>function(e,t,r){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return w(t,{...t._zod.def,shape:i,checks:[]})}(vn,e,t[0])});function qr(e,t){const r={type:"object",get shape(){return p(this,"shape",{...e}),this.shape},...$(t)};return new Hr(r)}function Br(e,t){return new Hr({type:"object",get shape(){return p(this,"shape",{...e}),this.shape},catchall:Lr(),...$(t)})}const Gr=t("ZodUnion",(e,t)=>{vt.init(e,t),dr.init(e,t),e.options=t.options});function Yr(e,t){return new Gr({type:"union",options:e,...$(t)})}const Xr=t("ZodDiscriminatedUnion",(e,t)=>{Gr.init(e,t),yt.init(e,t)});function Qr(e,t,r){return new Xr({type:"union",options:t,discriminator:e,...$(r)})}const en=t("ZodIntersection",(e,t)=>{_t.init(e,t),dr.init(e,t)});function tn(e,t){return new en({type:"intersection",left:e,right:t})}const rn=t("ZodRecord",(e,t)=>{$t.init(e,t),dr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function nn(e,t,r){return new rn({type:"record",keyType:e,valueType:t,...$(r)})}const on=t("ZodEnum",(e,t)=>{kt.init(e,t),dr.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const i={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);i[n]=t.entries[n]}return new on({...t,checks:[],...$(n),entries:i})},e.exclude=(e,n)=>{const i={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new on({...t,checks:[],...$(n),entries:i})}});function an(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new on({type:"enum",entries:r,...$(t)})}const sn=t("ZodLiteral",(e,t)=>{St.init(e,t),dr.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function cn(e,t){return new sn({type:"literal",values:Array.isArray(e)?e:[e],...$(t)})}const un=t("ZodTransform",(e,t)=>{It.init(e,t),dr.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=n=>{if("string"==typeof n)r.issues.push(T(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),r.issues.push(T(t))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function dn(e){return new un({type:"transform",transform:e})}const ln=t("ZodOptional",(e,t)=>{Pt.init(e,t),dr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pn(e){return new ln({type:"optional",innerType:e})}const fn=t("ZodNullable",(e,t)=>{Et.init(e,t),dr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function hn(e){return new fn({type:"nullable",innerType:e})}const mn=t("ZodDefault",(e,t)=>{xt.init(e,t),dr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),gn=t("ZodPrefault",(e,t)=>{Tt.init(e,t),dr.init(e,t),e.unwrap=()=>e._zod.def.innerType}),vn=t("ZodNonOptional",(e,t)=>{At.init(e,t),dr.init(e,t),e.unwrap=()=>e._zod.def.innerType}),yn=t("ZodCatch",(e,t)=>{jt.init(e,t),dr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),_n=t("ZodPipe",(e,t)=>{Dt.init(e,t),dr.init(e,t),e.in=t.in,e.out=t.out});function bn(e,t){return new _n({type:"pipe",in:e,out:t})}const wn=t("ZodReadonly",(e,t)=>{Nt.init(e,t),dr.init(e,t)}),$n=t("ZodCustom",(e,t)=>{Ut.init(e,t),dr.init(e,t)});function kn(e,t){return bn(dn(e),t)}Object.freeze({status:"aborted"}),o({localeError:(()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(t){return e[t]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${e.expected}, received ${(e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}return t})(e.input)}`;case"invalid_value":return 1===e.values.length?`Invalid input: expected ${k(e.values[0])}`:`Invalid option: expected one of ${a(e.values,"|")}`;case"too_big":{const r=e.inclusive?"<=":"<",n=t(e.origin);return n?`Too big: expected ${e.origin??"value"} to have ${r}${e.maximum.toString()} ${n.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${r}${e.maximum.toString()}`}case"too_small":{const r=e.inclusive?">=":">",n=t(e.origin);return n?`Too small: expected ${e.origin} to have ${r}${e.minimum.toString()} ${n.unit}`:`Too small: expected ${e.origin} to be ${r}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${a(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}}})()});const Sn="2025-11-25",In=[Sn,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Pn="io.modelcontextprotocol/related-task",En="2.0",xn=function(e,t,r){const n=$(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),...n})}($n,0,undefined);const On=Yr([fr(),zr().int()]),Tn=fr(),An=(Br({ttl:Yr([zr(),Zr()]).optional(),pollInterval:zr().optional()}),qr({ttl:zr().optional()})),Cn=qr({taskId:fr()}),jn=Br({progressToken:On.optional(),[Pn]:Cn.optional()}),Dn=qr({_meta:jn.optional()}),zn=Dn.extend({task:An.optional()}),Nn=qr({method:fr(),params:Dn.loose().optional()}),Rn=qr({_meta:jn.optional()}),Un=qr({method:fr(),params:Rn.loose().optional()}),Mn=Br({_meta:jn.optional()}),Kn=Yr([fr(),zr().int()]),Zn=qr({jsonrpc:cn(En),id:Kn,...Nn.shape}).strict(),Jn=e=>Zn.safeParse(e).success,Ln=qr({jsonrpc:cn(En),...Un.shape}).strict(),Wn=qr({jsonrpc:cn(En),id:Kn,result:Mn}).strict(),Fn=e=>Wn.safeParse(e).success;var Vn;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"}(Vn||(Vn={}));const Hn=qr({jsonrpc:cn(En),id:Kn.optional(),error:qr({code:zr().int(),message:fr(),data:Lr().optional()})}).strict(),qn=Yr([Zn,Ln,Wn,Hn]),Bn=(Yr([Wn,Hn]),Mn.strict()),Gn=Rn.extend({requestId:Kn.optional(),reason:fr().optional()}),Yn=Un.extend({method:cn("notifications/cancelled"),params:Gn}),Xn=qr({src:fr(),mimeType:fr().optional(),sizes:Vr(fr()).optional(),theme:an(["light","dark"]).optional()}),Qn=qr({icons:Vr(Xn).optional()}),ei=qr({name:fr(),title:fr().optional()}),ti=ei.extend({...ei.shape,...Qn.shape,version:fr(),websiteUrl:fr().optional(),description:fr().optional()}),ri=tn(qr({applyDefaults:Mr().optional()}),nn(fr(),Lr())),ni=kn(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,tn(qr({form:ri.optional(),url:xn.optional()}),nn(fr(),Lr()).optional())),ii=Br({list:xn.optional(),cancel:xn.optional(),requests:Br({sampling:Br({createMessage:xn.optional()}).optional(),elicitation:Br({create:xn.optional()}).optional()}).optional()}),oi=Br({list:xn.optional(),cancel:xn.optional(),requests:Br({tools:Br({call:xn.optional()}).optional()}).optional()}),ai=qr({experimental:nn(fr(),xn).optional(),sampling:qr({context:xn.optional(),tools:xn.optional()}).optional(),elicitation:ni.optional(),roots:qr({listChanged:Mr().optional()}).optional(),tasks:ii.optional()}),si=Dn.extend({protocolVersion:fr(),capabilities:ai,clientInfo:ti}),ci=Nn.extend({method:cn("initialize"),params:si}),ui=qr({experimental:nn(fr(),xn).optional(),logging:xn.optional(),completions:xn.optional(),prompts:qr({listChanged:Mr().optional()}).optional(),resources:qr({subscribe:Mr().optional(),listChanged:Mr().optional()}).optional(),tools:qr({listChanged:Mr().optional()}).optional(),tasks:oi.optional()}),di=Mn.extend({protocolVersion:fr(),capabilities:ui,serverInfo:ti,instructions:fr().optional()}),li=Un.extend({method:cn("notifications/initialized"),params:Rn.optional()}),pi=Nn.extend({method:cn("ping"),params:Dn.optional()}),fi=qr({progress:zr(),total:pn(zr()),message:pn(fr())}),hi=qr({...Rn.shape,...fi.shape,progressToken:On}),mi=Un.extend({method:cn("notifications/progress"),params:hi}),gi=Dn.extend({cursor:Tn.optional()}),vi=Nn.extend({params:gi.optional()}),yi=Mn.extend({nextCursor:Tn.optional()}),_i=an(["working","input_required","completed","failed","cancelled"]),bi=qr({taskId:fr(),status:_i,ttl:Yr([zr(),Zr()]),createdAt:fr(),lastUpdatedAt:fr(),pollInterval:pn(zr()),statusMessage:pn(fr())}),wi=Mn.extend({task:bi}),$i=Rn.merge(bi),ki=Un.extend({method:cn("notifications/tasks/status"),params:$i}),Si=Nn.extend({method:cn("tasks/get"),params:Dn.extend({taskId:fr()})}),Ii=Mn.merge(bi),Pi=Nn.extend({method:cn("tasks/result"),params:Dn.extend({taskId:fr()})}),Ei=(Mn.loose(),vi.extend({method:cn("tasks/list")})),xi=yi.extend({tasks:Vr(bi)}),Oi=Nn.extend({method:cn("tasks/cancel"),params:Dn.extend({taskId:fr()})}),Ti=Mn.merge(bi),Ai=qr({uri:fr(),mimeType:pn(fr()),_meta:nn(fr(),Lr()).optional()}),Ci=Ai.extend({text:fr()}),ji=fr().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Di=Ai.extend({blob:ji}),zi=an(["user","assistant"]),Ni=qr({audience:Vr(zi).optional(),priority:zr().min(0).max(1).optional(),lastModified:er({offset:!0}).optional()}),Ri=qr({...ei.shape,...Qn.shape,uri:fr(),description:pn(fr()),mimeType:pn(fr()),annotations:Ni.optional(),_meta:pn(Br({}))}),Ui=qr({...ei.shape,...Qn.shape,uriTemplate:fr(),description:pn(fr()),mimeType:pn(fr()),annotations:Ni.optional(),_meta:pn(Br({}))}),Mi=vi.extend({method:cn("resources/list")}),Ki=yi.extend({resources:Vr(Ri)}),Zi=vi.extend({method:cn("resources/templates/list")}),Ji=yi.extend({resourceTemplates:Vr(Ui)}),Li=Dn.extend({uri:fr()}),Wi=Li,Fi=Nn.extend({method:cn("resources/read"),params:Wi}),Vi=Mn.extend({contents:Vr(Yr([Ci,Di]))}),Hi=Un.extend({method:cn("notifications/resources/list_changed"),params:Rn.optional()}),qi=Li,Bi=Nn.extend({method:cn("resources/subscribe"),params:qi}),Gi=Li,Yi=Nn.extend({method:cn("resources/unsubscribe"),params:Gi}),Xi=Rn.extend({uri:fr()}),Qi=Un.extend({method:cn("notifications/resources/updated"),params:Xi}),eo=qr({name:fr(),description:pn(fr()),required:pn(Mr())}),to=qr({...ei.shape,...Qn.shape,description:pn(fr()),arguments:pn(Vr(eo)),_meta:pn(Br({}))}),ro=vi.extend({method:cn("prompts/list")}),no=yi.extend({prompts:Vr(to)}),io=Dn.extend({name:fr(),arguments:nn(fr(),fr()).optional()}),oo=Nn.extend({method:cn("prompts/get"),params:io}),ao=qr({type:cn("text"),text:fr(),annotations:Ni.optional(),_meta:nn(fr(),Lr()).optional()}),so=qr({type:cn("image"),data:ji,mimeType:fr(),annotations:Ni.optional(),_meta:nn(fr(),Lr()).optional()}),co=qr({type:cn("audio"),data:ji,mimeType:fr(),annotations:Ni.optional(),_meta:nn(fr(),Lr()).optional()}),uo=qr({type:cn("tool_use"),name:fr(),id:fr(),input:nn(fr(),Lr()),_meta:nn(fr(),Lr()).optional()}),lo=qr({type:cn("resource"),resource:Yr([Ci,Di]),annotations:Ni.optional(),_meta:nn(fr(),Lr()).optional()}),po=Yr([ao,so,co,Ri.extend({type:cn("resource_link")}),lo]),fo=qr({role:zi,content:po}),ho=Mn.extend({description:fr().optional(),messages:Vr(fo)}),mo=Un.extend({method:cn("notifications/prompts/list_changed"),params:Rn.optional()}),go=qr({title:fr().optional(),readOnlyHint:Mr().optional(),destructiveHint:Mr().optional(),idempotentHint:Mr().optional(),openWorldHint:Mr().optional()}),vo=qr({taskSupport:an(["required","optional","forbidden"]).optional()}),yo=qr({...ei.shape,...Qn.shape,description:fr().optional(),inputSchema:qr({type:cn("object"),properties:nn(fr(),xn).optional(),required:Vr(fr()).optional()}).catchall(Lr()),outputSchema:qr({type:cn("object"),properties:nn(fr(),xn).optional(),required:Vr(fr()).optional()}).catchall(Lr()).optional(),annotations:go.optional(),execution:vo.optional(),_meta:nn(fr(),Lr()).optional()}),_o=vi.extend({method:cn("tools/list")}),bo=yi.extend({tools:Vr(yo)}),wo=Mn.extend({content:Vr(po).default([]),structuredContent:nn(fr(),Lr()).optional(),isError:Mr().optional()}),$o=(wo.or(Mn.extend({toolResult:Lr()})),zn.extend({name:fr(),arguments:nn(fr(),Lr()).optional()})),ko=Nn.extend({method:cn("tools/call"),params:$o}),So=Un.extend({method:cn("notifications/tools/list_changed"),params:Rn.optional()}),Io=(qr({autoRefresh:Mr().default(!0),debounceMs:zr().int().nonnegative().default(300)}),an(["debug","info","notice","warning","error","critical","alert","emergency"])),Po=Dn.extend({level:Io}),Eo=Nn.extend({method:cn("logging/setLevel"),params:Po}),xo=Rn.extend({level:Io,logger:fr().optional(),data:Lr()}),Oo=Un.extend({method:cn("notifications/message"),params:xo}),To=qr({name:fr().optional()}),Ao=qr({hints:Vr(To).optional(),costPriority:zr().min(0).max(1).optional(),speedPriority:zr().min(0).max(1).optional(),intelligencePriority:zr().min(0).max(1).optional()}),Co=qr({mode:an(["auto","required","none"]).optional()}),jo=qr({type:cn("tool_result"),toolUseId:fr().describe("The unique identifier for the corresponding tool call."),content:Vr(po).default([]),structuredContent:qr({}).loose().optional(),isError:Mr().optional(),_meta:nn(fr(),Lr()).optional()}),Do=Qr("type",[ao,so,co]),zo=Qr("type",[ao,so,co,uo,jo]),No=qr({role:zi,content:Yr([zo,Vr(zo)]),_meta:nn(fr(),Lr()).optional()}),Ro=zn.extend({messages:Vr(No),modelPreferences:Ao.optional(),systemPrompt:fr().optional(),includeContext:an(["none","thisServer","allServers"]).optional(),temperature:zr().optional(),maxTokens:zr().int(),stopSequences:Vr(fr()).optional(),metadata:xn.optional(),tools:Vr(yo).optional(),toolChoice:Co.optional()}),Uo=Nn.extend({method:cn("sampling/createMessage"),params:Ro}),Mo=Mn.extend({model:fr(),stopReason:pn(an(["endTurn","stopSequence","maxTokens"]).or(fr())),role:zi,content:Do}),Ko=Mn.extend({model:fr(),stopReason:pn(an(["endTurn","stopSequence","maxTokens","toolUse"]).or(fr())),role:zi,content:Yr([zo,Vr(zo)])}),Zo=qr({type:cn("boolean"),title:fr().optional(),description:fr().optional(),default:Mr().optional()}),Jo=qr({type:cn("string"),title:fr().optional(),description:fr().optional(),minLength:zr().optional(),maxLength:zr().optional(),format:an(["email","uri","date","date-time"]).optional(),default:fr().optional()}),Lo=qr({type:an(["number","integer"]),title:fr().optional(),description:fr().optional(),minimum:zr().optional(),maximum:zr().optional(),default:zr().optional()}),Wo=qr({type:cn("string"),title:fr().optional(),description:fr().optional(),enum:Vr(fr()),default:fr().optional()}),Fo=qr({type:cn("string"),title:fr().optional(),description:fr().optional(),oneOf:Vr(qr({const:fr(),title:fr()})),default:fr().optional()}),Vo=qr({type:cn("string"),title:fr().optional(),description:fr().optional(),enum:Vr(fr()),enumNames:Vr(fr()).optional(),default:fr().optional()}),Ho=Yr([Wo,Fo]),qo=Yr([qr({type:cn("array"),title:fr().optional(),description:fr().optional(),minItems:zr().optional(),maxItems:zr().optional(),items:qr({type:cn("string"),enum:Vr(fr())}),default:Vr(fr()).optional()}),qr({type:cn("array"),title:fr().optional(),description:fr().optional(),minItems:zr().optional(),maxItems:zr().optional(),items:qr({anyOf:Vr(qr({const:fr(),title:fr()}))}),default:Vr(fr()).optional()})]),Bo=Yr([Vo,Ho,qo]),Go=Yr([Bo,Zo,Jo,Lo]),Yo=Yr([zn.extend({mode:cn("form").optional(),message:fr(),requestedSchema:qr({type:cn("object"),properties:nn(fr(),Go),required:Vr(fr()).optional()})}),zn.extend({mode:cn("url"),message:fr(),elicitationId:fr(),url:fr().url()})]),Xo=Nn.extend({method:cn("elicitation/create"),params:Yo}),Qo=Rn.extend({elicitationId:fr()}),ea=Un.extend({method:cn("notifications/elicitation/complete"),params:Qo}),ta=Mn.extend({action:an(["accept","decline","cancel"]),content:kn(e=>null===e?void 0:e,nn(fr(),Yr([fr(),zr(),Mr(),Vr(fr())])).optional())}),ra=qr({type:cn("ref/resource"),uri:fr()}),na=qr({type:cn("ref/prompt"),name:fr()}),ia=Dn.extend({ref:Yr([na,ra]),argument:qr({name:fr(),value:fr()}),context:qr({arguments:nn(fr(),fr()).optional()}).optional()}),oa=Nn.extend({method:cn("completion/complete"),params:ia}),aa=Mn.extend({completion:Br({values:Vr(fr()).max(100),total:pn(zr().int()),hasMore:pn(Mr())})}),sa=qr({uri:fr().startsWith("file://"),name:fr().optional(),_meta:nn(fr(),Lr()).optional()}),ca=Nn.extend({method:cn("roots/list"),params:Dn.optional()}),ua=Mn.extend({roots:Vr(sa)}),da=Un.extend({method:cn("notifications/roots/list_changed"),params:Rn.optional()});Yr([pi,ci,oa,Eo,oo,ro,Mi,Zi,Fi,Bi,Yi,ko,_o,Si,Pi,Ei,Oi]),Yr([Yn,mi,li,da,ki]),Yr([Bn,Mo,Ko,ta,ua,Ii,xi,wi]),Yr([pi,Uo,Xo,ca,Si,Pi,Ei,Oi]),Yr([Yn,mi,Oo,Qi,Hi,So,mo,ki,ea]),Yr([Bn,di,aa,ho,no,Ki,Ji,Vi,wo,bo,Ii,xi,wi]);class la extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Vn.UrlElicitationRequired&&r){const e=r;if(e.elicitations)return new pa(e.elicitations,t)}return new la(e,t,r)}}class pa extends la{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Vn.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}class fa{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf("\n");if(-1===e)return null;const t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),function(e){return qn.parse(JSON.parse(e))}(t)}clear(){this._buffer=void 0}}class ha{constructor(t=e.stdin,r=e.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new fa,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{const e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{const r=function(e){return JSON.stringify(e)+"\n"}(e);this._stdout.write(r)?t():this._stdout.once("drain",t)})}}var ma,ga,va;(va=ma||(ma={})).assertEqual=e=>{},va.assertIs=function(e){},va.assertNever=function(e){throw new Error},va.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},va.getValidEnumValues=e=>{const t=va.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(const n of t)r[n]=e[n];return va.objectValues(r)},va.objectValues=e=>va.objectKeys(e).map(function(t){return e[t]}),va.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},va.find=(e,t)=>{for(const r of e)if(t(r))return r},va.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,va.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},va.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,function(e){e.mergeShapes=(e,t)=>({...e,...t})}(ga||(ga={}));const ya=ma.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_a=e=>{switch(typeof e){case"undefined":return ya.undefined;case"string":return ya.string;case"number":return Number.isNaN(e)?ya.nan:ya.number;case"boolean":return ya.boolean;case"function":return ya.function;case"bigint":return ya.bigint;case"symbol":return ya.symbol;case"object":return Array.isArray(e)?ya.array:null===e?ya.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ya.promise:"undefined"!=typeof Map&&e instanceof Map?ya.map:"undefined"!=typeof Set&&e instanceof Set?ya.set:"undefined"!=typeof Date&&e instanceof Date?ya.date:ya.object;default:return ya.unknown}},ba=ma.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class wa extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof wa))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ma.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}wa.create=e=>new wa(e);const $a=(e,t)=>{let r;switch(e.code){case ba.invalid_type:r=e.received===ya.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ba.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ma.jsonStringifyReplacer)}`;break;case ba.unrecognized_keys:r=`Unrecognized key(s) in object: ${ma.joinValues(e.keys,", ")}`;break;case ba.invalid_union:r="Invalid input";break;case ba.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ma.joinValues(e.options)}`;break;case ba.invalid_enum_value:r=`Invalid enum value. Expected ${ma.joinValues(e.options)}, received '${e.received}'`;break;case ba.invalid_arguments:r="Invalid function arguments";break;case ba.invalid_return_type:r="Invalid function return type";break;case ba.invalid_date:r="Invalid date";break;case ba.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ma.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ba.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ba.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ba.custom:r="Invalid input";break;case ba.invalid_intersection_types:r="Intersection results could not be merged";break;case ba.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ba.not_finite:r="Number must be finite";break;default:r=t.defaultError,ma.assertNever(e)}return{message:r}};let ka=$a;function Sa(e,t){const r=ka,n=(e=>{const{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],a={...i,path:o};if(void 0!==i.message)return{...i,path:o,message:i.message};let s="";const c=n.filter(e=>!!e).slice().reverse();for(const e of c)s=e(a,{data:t,defaultError:s}).message;return{...i,path:o,message:s}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===$a?void 0:$a].filter(e=>!!e)});e.common.issues.push(n)}class Ia{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return Pa;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return Ia.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:i}=n;if("aborted"===t.status)return Pa;if("aborted"===i.status)return Pa;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!n.alwaysSet||(r[t.value]=i.value)}return{status:e.value,value:r}}}const Pa=Object.freeze({status:"aborted"}),Ea=e=>({status:"dirty",value:e}),xa=e=>({status:"valid",value:e}),Oa=e=>"aborted"===e.status,Ta=e=>"dirty"===e.status,Aa=e=>"valid"===e.status,Ca=e=>"undefined"!=typeof Promise&&e instanceof Promise;var ja;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(ja||(ja={}));class Da{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const za=(e,t)=>{if(Aa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new wa(e.common.issues);return this._error=t,this._error}}};function Na(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??i.defaultError}:void 0===i.data?{message:o??n??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:o??r??i.defaultError}},description:i}}class Ra{get description(){return this._def.description}_getType(e){return _a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:_a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ia,ctx:{common:e.parent.common,data:e.data,parsedType:_a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ca(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_a(e)},n=this._parseSync({data:e,path:r.path,parent:r});return za(r,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_a(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return Aa(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Aa(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_a(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(Ca(n)?n:Promise.resolve(n));return za(r,i)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{const i=e(t),o=()=>n.addIssue({code:ba.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(o(),!1)):!!i||(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new zs({schema:this,typeName:Ws.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Ns.create(this,this._def)}nullable(){return Rs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bs.create(this)}promise(){return Ds.create(this,this._def)}or(e){return ks.create([this,e],this._def)}and(e){return Is.create(this,e,this._def)}transform(e){return new zs({...Na(this._def),schema:this,typeName:Ws.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Us({...Na(this._def),innerType:this,defaultValue:t,typeName:Ws.ZodDefault})}brand(){return new Zs({typeName:Ws.ZodBranded,type:this,...Na(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ms({...Na(this._def),innerType:this,catchValue:t,typeName:Ws.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Js.create(this,e)}readonly(){return Ls.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ua=/^c[^\s-]{8,}$/i,Ma=/^[0-9a-z]+$/,Ka=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Za=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ja=/^[a-z0-9_-]{21}$/i,La=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Wa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Fa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Va;const Ha=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,qa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ba=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ga=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ya=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qa="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",es=new RegExp(`^${Qa}$`);function ts(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function rs(e){return new RegExp(`^${ts(e)}$`)}function ns(e){let t=`${Qa}T${ts(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function is(e,t){return!("v4"!==t&&t||!Ha.test(e))||!("v6"!==t&&t||!Ba.test(e))}function os(e,t){if(!La.test(e))return!1;try{const[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!("object"!=typeof i||null===i||"typ"in i&&"JWT"!==i?.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function as(e,t){return!("v4"!==t&&t||!qa.test(e))||!("v6"!==t&&t||!Ga.test(e))}class ss extends Ra{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ya.string){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.string,received:t.parsedType}),Pa}const t=new Ia;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?Sa(r,{code:ba.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&Sa(r,{code:ba.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)Fa.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"email",code:ba.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)Va||(Va=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Va.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"emoji",code:ba.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)Za.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"uuid",code:ba.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)Ja.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"nanoid",code:ba.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)Ua.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"cuid",code:ba.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)Ma.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"cuid2",code:ba.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)Ka.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"ulid",code:ba.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Sa(r,{validation:"url",code:ba.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"regex",code:ba.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?ns(n).test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?es.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?rs(n).test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?Wa.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"duration",code:ba.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?is(e.data,n.version)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"ip",code:ba.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?os(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"jwt",code:ba.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?as(e.data,n.version)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"cidr",code:ba.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?Ya.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"base64",code:ba.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?Xa.test(e.data)||(r=this._getOrReturnCtx(e,r),Sa(r,{validation:"base64url",code:ba.invalid_string,message:n.message}),t.dirty()):ma.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:ba.invalid_string,...ja.errToObj(r)})}_addCheck(e){return new ss({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ja.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ja.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ja.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ja.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ja.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ja.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ja.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ja.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ja.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ja.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ja.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ja.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ja.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ja.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...ja.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ja.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ja.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...ja.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ja.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ja.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ja.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ja.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ja.errToObj(t)})}nonempty(e){return this.min(1,ja.errToObj(e))}trim(){return new ss({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ss({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ss({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function cs(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}ss.create=e=>new ss({checks:[],typeName:Ws.ZodString,coerce:e?.coerce??!1,...Na(e)});class us extends Ra{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ya.number){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.number,received:t.parsedType}),Pa}let t;const r=new Ia;for(const n of this._def.checks)"int"===n.kind?ma.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==cs(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.not_finite,message:n.message}),r.dirty()):ma.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(e,t,r,n){return new us({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ja.toString(n)}]})}_addCheck(e){return new us({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ja.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ja.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ja.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ja.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&ma.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}us.create=e=>new us({checks:[],typeName:Ws.ZodNumber,coerce:e?.coerce||!1,...Na(e)});class ds extends Ra{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ya.bigint)return this._getInvalidInput(e);let t;const r=new Ia;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Sa(t,{code:ba.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ma.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.bigint,received:t.parsedType}),Pa}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(e,t,r,n){return new ds({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ja.toString(n)}]})}_addCheck(e){return new ds({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ds.create=e=>new ds({checks:[],typeName:Ws.ZodBigInt,coerce:e?.coerce??!1,...Na(e)});class ls extends Ra{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==ya.boolean){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.boolean,received:t.parsedType}),Pa}return xa(e.data)}}ls.create=e=>new ls({typeName:Ws.ZodBoolean,coerce:e?.coerce||!1,...Na(e)});class ps extends Ra{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ya.date){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.date,received:t.parsedType}),Pa}if(Number.isNaN(e.data.getTime()))return Sa(this._getOrReturnCtx(e),{code:ba.invalid_date}),Pa;const t=new Ia;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),Sa(r,{code:ba.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):ma.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ps({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ja.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ja.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ps.create=e=>new ps({checks:[],coerce:e?.coerce||!1,typeName:Ws.ZodDate,...Na(e)});class fs extends Ra{_parse(e){if(this._getType(e)!==ya.symbol){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.symbol,received:t.parsedType}),Pa}return xa(e.data)}}fs.create=e=>new fs({typeName:Ws.ZodSymbol,...Na(e)});class hs extends Ra{_parse(e){if(this._getType(e)!==ya.undefined){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.undefined,received:t.parsedType}),Pa}return xa(e.data)}}hs.create=e=>new hs({typeName:Ws.ZodUndefined,...Na(e)});class ms extends Ra{_parse(e){if(this._getType(e)!==ya.null){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.null,received:t.parsedType}),Pa}return xa(e.data)}}ms.create=e=>new ms({typeName:Ws.ZodNull,...Na(e)});class gs extends Ra{constructor(){super(...arguments),this._any=!0}_parse(e){return xa(e.data)}}gs.create=e=>new gs({typeName:Ws.ZodAny,...Na(e)});class vs extends Ra{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xa(e.data)}}vs.create=e=>new vs({typeName:Ws.ZodUnknown,...Na(e)});class ys extends Ra{_parse(e){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.never,received:t.parsedType}),Pa}}ys.create=e=>new ys({typeName:Ws.ZodNever,...Na(e)});class _s extends Ra{_parse(e){if(this._getType(e)!==ya.undefined){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.void,received:t.parsedType}),Pa}return xa(e.data)}}_s.create=e=>new _s({typeName:Ws.ZodVoid,...Na(e)});class bs extends Ra{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==ya.array)return Sa(t,{code:ba.invalid_type,expected:ya.array,received:t.parsedType}),Pa;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(Sa(t,{code:e?ba.too_big:ba.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Sa(t,{code:ba.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Sa(t,{code:ba.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new Da(t,e,t.path,r)))).then(e=>Ia.mergeArray(r,e));const i=[...t.data].map((e,r)=>n.type._parseSync(new Da(t,e,t.path,r)));return Ia.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new bs({...this._def,minLength:{value:e,message:ja.toString(t)}})}max(e,t){return new bs({...this._def,maxLength:{value:e,message:ja.toString(t)}})}length(e,t){return new bs({...this._def,exactLength:{value:e,message:ja.toString(t)}})}nonempty(e){return this.min(1,e)}}function ws(e){if(e instanceof $s){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Ns.create(ws(n))}return new $s({...e._def,shape:()=>t})}return e instanceof bs?new bs({...e._def,type:ws(e.element)}):e instanceof Ns?Ns.create(ws(e.unwrap())):e instanceof Rs?Rs.create(ws(e.unwrap())):e instanceof Ps?Ps.create(e.items.map(e=>ws(e))):e}bs.create=(e,t)=>new bs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ws.ZodArray,...Na(t)});class $s extends Ra{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=ma.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ya.object){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.object,received:t.parsedType}),Pa}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ys&&"strip"===this._def.unknownKeys))for(const e in r.data)i.includes(e)||o.push(e);const a=[];for(const e of i){const t=n[e],i=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Da(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ys){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)o.length>0&&(Sa(r,{code:ba.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const n=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Da(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of a){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>Ia.mergeObjectSync(t,e)):Ia.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return ja.errToObj,new $s({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{const n=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:ja.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new $s({...this._def,unknownKeys:"strip"})}passthrough(){return new $s({...this._def,unknownKeys:"passthrough"})}extend(e){return new $s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ws.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new $s({...this._def,catchall:e})}pick(e){const t={};for(const r of ma.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new $s({...this._def,shape:()=>t})}omit(e){const t={};for(const r of ma.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new $s({...this._def,shape:()=>t})}deepPartial(){return ws(this)}partial(e){const t={};for(const r of ma.objectKeys(this.shape)){const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new $s({...this._def,shape:()=>t})}required(e){const t={};for(const r of ma.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Ns;)e=e._def.innerType;t[r]=e}return new $s({...this._def,shape:()=>t})}keyof(){return As(ma.objectKeys(this.shape))}}$s.create=(e,t)=>new $s({shape:()=>e,unknownKeys:"strip",catchall:ys.create(),typeName:Ws.ZodObject,...Na(t)}),$s.strictCreate=(e,t)=>new $s({shape:()=>e,unknownKeys:"strict",catchall:ys.create(),typeName:Ws.ZodObject,...Na(t)}),$s.lazycreate=(e,t)=>new $s({shape:e,unknownKeys:"strip",catchall:ys.create(),typeName:Ws.ZodObject,...Na(t)});class ks extends Ra{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map(e=>new wa(e.ctx.common.issues));return Sa(t,{code:ba.invalid_union,unionErrors:r}),Pa});{let e;const n=[];for(const i of r){const r={...t,common:{...t.common,issues:[]},parent:null},o=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=n.map(e=>new wa(e));return Sa(t,{code:ba.invalid_union,unionErrors:i}),Pa}}get options(){return this._def.options}}function Ss(e,t){const r=_a(e),n=_a(t);if(e===t)return{valid:!0,data:e};if(r===ya.object&&n===ya.object){const r=ma.objectKeys(t),n=ma.objectKeys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};for(const r of n){const n=Ss(e[r],t[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(r===ya.array&&n===ya.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const i=Ss(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===ya.date&&n===ya.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}ks.create=(e,t)=>new ks({options:e,typeName:Ws.ZodUnion,...Na(t)});class Is extends Ra{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(Oa(e)||Oa(n))return Pa;const i=Ss(e.value,n.value);return i.valid?((Ta(e)||Ta(n))&&t.dirty(),{status:t.value,value:i.data}):(Sa(r,{code:ba.invalid_intersection_types}),Pa)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Is.create=(e,t,r)=>new Is({left:e,right:t,typeName:Ws.ZodIntersection,...Na(r)});class Ps extends Ra{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ya.array)return Sa(r,{code:ba.invalid_type,expected:ya.array,received:r.parsedType}),Pa;if(r.data.length<this._def.items.length)return Sa(r,{code:ba.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pa;!this._def.rest&&r.data.length>this._def.items.length&&(Sa(r,{code:ba.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Da(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>Ia.mergeArray(t,e)):Ia.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ps({...this._def,rest:e})}}Ps.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ps({items:e,typeName:Ws.ZodTuple,rest:null,...Na(t)})};class Es extends Ra{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ya.map)return Sa(r,{code:ba.invalid_type,expected:ya.map,received:r.parsedType}),Pa;const n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([e,t],o)=>({key:n._parse(new Da(r,e,r.path,[o,"key"])),value:i._parse(new Da(r,t,r.path,[o,"value"]))}));if(r.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const r of o){const n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return Pa;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{const e=new Map;for(const r of o){const n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return Pa;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}Es.create=(e,t,r)=>new Es({valueType:t,keyType:e,typeName:Ws.ZodMap,...Na(r)});class xs extends Ra{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ya.set)return Sa(r,{code:ba.invalid_type,expected:ya.set,received:r.parsedType}),Pa;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(Sa(r,{code:ba.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(Sa(r,{code:ba.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const r=new Set;for(const n of e){if("aborted"===n.status)return Pa;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map((e,t)=>i._parse(new Da(r,e,r.path,t)));return r.common.async?Promise.all(a).then(e=>o(e)):o(a)}min(e,t){return new xs({...this._def,minSize:{value:e,message:ja.toString(t)}})}max(e,t){return new xs({...this._def,maxSize:{value:e,message:ja.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}xs.create=(e,t)=>new xs({valueType:e,minSize:null,maxSize:null,typeName:Ws.ZodSet,...Na(t)});class Os extends Ra{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Os.create=(e,t)=>new Os({getter:e,typeName:Ws.ZodLazy,...Na(t)});class Ts extends Ra{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Sa(t,{received:t.data,code:ba.invalid_literal,expected:this._def.value}),Pa}return{status:"valid",value:e.data}}get value(){return this._def.value}}function As(e,t){return new Cs({values:e,typeName:Ws.ZodEnum,...Na(t)})}Ts.create=(e,t)=>new Ts({value:e,typeName:Ws.ZodLiteral,...Na(t)});class Cs extends Ra{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return Sa(t,{expected:ma.joinValues(r),received:t.parsedType,code:ba.invalid_type}),Pa}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return Sa(t,{received:t.data,code:ba.invalid_enum_value,options:r}),Pa}return xa(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Cs.create(e,{...this._def,...t})}exclude(e,t=this._def){return Cs.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Cs.create=As;class js extends Ra{_parse(e){const t=ma.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ya.string&&r.parsedType!==ya.number){const e=ma.objectValues(t);return Sa(r,{expected:ma.joinValues(e),received:r.parsedType,code:ba.invalid_type}),Pa}if(this._cache||(this._cache=new Set(ma.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ma.objectValues(t);return Sa(r,{received:r.data,code:ba.invalid_enum_value,options:e}),Pa}return xa(e.data)}get enum(){return this._def.values}}js.create=(e,t)=>new js({values:e,typeName:Ws.ZodNativeEnum,...Na(t)});class Ds extends Ra{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ya.promise&&!1===t.common.async)return Sa(t,{code:ba.invalid_type,expected:ya.promise,received:t.parsedType}),Pa;const r=t.parsedType===ya.promise?t.data:Promise.resolve(t.data);return xa(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ds.create=(e,t)=>new Ds({type:e,typeName:Ws.ZodPromise,...Na(t)});class zs extends Ra{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ws.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{Sa(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){const e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return Pa;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?Pa:"dirty"===n.status||"dirty"===t.value?Ea(n.value):n});{if("aborted"===t.value)return Pa;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?Pa:"dirty"===n.status||"dirty"===t.value?Ea(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?Pa:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?Pa:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Aa(e))return Pa;const o=n.transform(e.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>Aa(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):Pa)}ma.assertNever(n)}}zs.create=(e,t,r)=>new zs({schema:e,typeName:Ws.ZodEffects,effect:t,...Na(r)}),zs.createWithPreprocess=(e,t,r)=>new zs({schema:t,effect:{type:"preprocess",transform:e},typeName:Ws.ZodEffects,...Na(r)});class Ns extends Ra{_parse(e){return this._getType(e)===ya.undefined?xa(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ns.create=(e,t)=>new Ns({innerType:e,typeName:Ws.ZodOptional,...Na(t)});class Rs extends Ra{_parse(e){return this._getType(e)===ya.null?xa(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Rs.create=(e,t)=>new Rs({innerType:e,typeName:Ws.ZodNullable,...Na(t)});class Us extends Ra{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ya.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Us.create=(e,t)=>new Us({innerType:e,typeName:Ws.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Na(t)});class Ms extends Ra{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ca(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new wa(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new wa(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ms.create=(e,t)=>new Ms({innerType:e,typeName:Ws.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Na(t)});class Ks extends Ra{_parse(e){if(this._getType(e)!==ya.nan){const t=this._getOrReturnCtx(e);return Sa(t,{code:ba.invalid_type,expected:ya.nan,received:t.parsedType}),Pa}return{status:"valid",value:e.data}}}Ks.create=e=>new Ks({typeName:Ws.ZodNaN,...Na(e)}),Symbol("zod_brand");class Zs extends Ra{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Js extends Ra{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Pa:"dirty"===e.status?(t.dirty(),Ea(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Pa:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Js({in:e,out:t,typeName:Ws.ZodPipeline})}}class Ls extends Ra{_parse(e){const t=this._def.innerType._parse(e),r=e=>(Aa(e)&&(e.value=Object.freeze(e.value)),e);return Ca(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}var Ws,Fs;function Vs(e){return!!e._zod}function Hs(e,t){return Vs(e)?R(e,t):e.safeParse(t)}function qs(e){if(!e)return;let t;if(Vs(e)){const r=e;t=r._zod?.def?.shape}else t=e.shape;if(t){if("function"==typeof t)try{return t()}catch{return}return t}}function Bs(e){return"completed"===e||"failed"===e||"cancelled"===e}function Gs(e){const t=qs(e),r=t?.method;if(!r)throw new Error("Schema is missing a method literal");const n=function(e){if(Vs(e)){const t=e,r=t._zod?.def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}}const t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const r=e.value;if(void 0!==r)return r}(r);if("string"!=typeof n)throw new Error("Schema method literal must be a string");return n}function Ys(e,t){const r=Hs(e,t);if(!r.success)throw r.error;return r.data}Ls.create=(e,t)=>new Ls({innerType:e,typeName:Ws.ZodReadonly,...Na(t)}),$s.lazycreate,(Fs=Ws||(Ws={})).ZodString="ZodString",Fs.ZodNumber="ZodNumber",Fs.ZodNaN="ZodNaN",Fs.ZodBigInt="ZodBigInt",Fs.ZodBoolean="ZodBoolean",Fs.ZodDate="ZodDate",Fs.ZodSymbol="ZodSymbol",Fs.ZodUndefined="ZodUndefined",Fs.ZodNull="ZodNull",Fs.ZodAny="ZodAny",Fs.ZodUnknown="ZodUnknown",Fs.ZodNever="ZodNever",Fs.ZodVoid="ZodVoid",Fs.ZodArray="ZodArray",Fs.ZodObject="ZodObject",Fs.ZodUnion="ZodUnion",Fs.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Fs.ZodIntersection="ZodIntersection",Fs.ZodTuple="ZodTuple",Fs.ZodRecord="ZodRecord",Fs.ZodMap="ZodMap",Fs.ZodSet="ZodSet",Fs.ZodFunction="ZodFunction",Fs.ZodLazy="ZodLazy",Fs.ZodLiteral="ZodLiteral",Fs.ZodEnum="ZodEnum",Fs.ZodEffects="ZodEffects",Fs.ZodNativeEnum="ZodNativeEnum",Fs.ZodOptional="ZodOptional",Fs.ZodNullable="ZodNullable",Fs.ZodDefault="ZodDefault",Fs.ZodCatch="ZodCatch",Fs.ZodPromise="ZodPromise",Fs.ZodBranded="ZodBranded",Fs.ZodPipeline="ZodPipeline",Fs.ZodReadonly="ZodReadonly",ss.create,us.create,Ks.create,ds.create,ls.create,ps.create,fs.create,hs.create,ms.create,gs.create,vs.create,ys.create,_s.create,bs.create,$s.create,$s.strictCreate,ks.create,Is.create,Ps.create,Es.create,xs.create,Os.create,Ts.create,Cs.create,js.create,Ds.create,zs.create,Ns.create,Rs.create,zs.createWithPreprocess,Js.create,Symbol("Let zodToJsonSchema decide on which parser to use");class Xs{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Yn,e=>{this._oncancel(e)}),this.setNotificationHandler(mi,e=>{this._onprogress(e)}),this.setRequestHandler(pi,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Si,async(e,t)=>{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new la(Vn.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(Pi,async(e,t)=>{const r=async()=>{const n=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(n,t.sessionId);){if("response"===e.type||"error"===e.type){const t=e.message,r=t.id,n=this._requestResolvers.get(r);if(n)if(this._requestResolvers.delete(r),"response"===e.type)n(t);else{const e=t;n(new la(e.error.code,e.error.message,e.error.data))}else{const t="response"===e.type?"Response":"Error";this._onerror(new Error(`${t} handler missing for request ${r}`))}continue}await(this._transport?.send(e.message,{relatedRequestId:t.requestId}))}}const i=await this._taskStore.getTask(n,t.sessionId);if(!i)throw new la(Vn.InvalidParams,`Task not found: ${n}`);if(!Bs(i.status))return await this._waitForTaskUpdate(n,t.signal),await r();if(Bs(i.status)){const e=await this._taskStore.getTaskResult(n,t.sessionId);return this._clearTaskQueue(n),{...e,_meta:{...e._meta,[Pn]:{taskId:n}}}}return await r()};return await r()}),this.setRequestHandler(Ei,async(e,t)=>{try{const{tasks:r,nextCursor:n}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:n,_meta:{}}}catch(e){throw new la(Vn.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(Oi,async(e,t)=>{try{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new la(Vn.InvalidParams,`Task not found: ${e.params.taskId}`);if(Bs(r.status))throw new la(Vn.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);const n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new la(Vn.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...n}}catch(e){if(e instanceof la)throw e;throw new la(Vn.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;const t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,n,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),la.fromError(Vn.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};const n=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{var r;n?.(e,t),Fn(e)||(e=>Hn.safeParse(e).success)(e)?this._onresponse(e):Jn(e)?this._onrequest(e,t):(r=e,Ln.safeParse(r).success?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`)))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();const t=la.fromError(Vn.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){const r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,i=e.params?._meta?.[Pn]?.taskId;if(void 0===r){const t={jsonrpc:"2.0",id:e.id,error:{code:Vn.MethodNotFound,message:"Method not found"}};return void(i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:t,timestamp:Date.now()},n?.sessionId).catch(e=>this._onerror(new Error(`Failed to enqueue error response: ${e}`))):n?.send(t).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))))}const o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);const a=(s=e.params,zn.safeParse(s).success?e.params.task:void 0);var s;const c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:o.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(o.signal.aborted)return;const r={relatedRequestId:e.id};i&&(r.relatedTask={taskId:i}),await this.notification(t,r)},sendRequest:async(t,r,n)=>{if(o.signal.aborted)throw new la(Vn.ConnectionClosed,"Request was cancelled");const a={...n,relatedRequestId:e.id};i&&!a.relatedTask&&(a.relatedTask={taskId:i});const s=a.relatedTask?.taskId??i;return s&&c&&await c.updateTaskStatus(s,"input_required"),await this.request(t,r,a)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,u)).then(async t=>{if(o.signal.aborted)return;const r={result:t,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:r,timestamp:Date.now()},n?.sessionId):await(n?.send(r))},async t=>{if(o.signal.aborted)return;const r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:Vn.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:r,timestamp:Date.now()},n?.sessionId):await(n?.send(r))}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,n=Number(t),i=this._progressHandlers.get(n);if(!i)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const o=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&o&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(e){return this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),void o(e)}i(r)}_onresponse(e){const t=Number(e.id),r=this._requestResolvers.get(t);if(r)return this._requestResolvers.delete(t),void(Fn(e)?r(e):r(new la(e.error.code,e.error.message,e.error.data)));const n=this._responseHandlers.get(t);if(void 0===n)return void this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(Fn(e)&&e.result&&"object"==typeof e.result){const r=e.result;if(r.task&&"object"==typeof r.task){const e=r.task;"string"==typeof e.taskId&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),Fn(e)?n(e):n(la.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await(this._transport?.close())}async*requestStream(e,t,r){const{task:n}=r??{};if(!n){try{const n=await this.request(e,t,r);yield{type:"result",result:n}}catch(e){yield{type:"error",error:e instanceof la?e:new la(Vn.InternalError,String(e))}}return}let i;try{const n=await this.request(e,wi,r);if(!n.task)throw new la(Vn.InternalError,"Task creation did not return a task");for(i=n.task.taskId,yield{type:"taskCreated",task:n.task};;){const e=await this.getTask({taskId:i},r);if(yield{type:"taskStatus",task:e},Bs(e.status)){if("completed"===e.status){const e=await this.getTaskResult({taskId:i},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new la(Vn.InternalError,`Task ${i} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new la(Vn.InternalError,`Task ${i} was cancelled`)});return}if("input_required"===e.status){const e=await this.getTaskResult({taskId:i},t,r);return void(yield{type:"result",result:e})}const n=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,n)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof la?e:new la(Vn.InternalError,String(e))}}}request(e,t,r){const{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o,task:a,relatedTask:s}=r??{};return new Promise((c,u)=>{const d=e=>{u(e)};if(!this._transport)return void d(new Error("Not connected"));if(!0===this._options?.enforceStrictCapabilities)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(e){return void d(e)}r?.signal?.throwIfAborted();const l=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:l};r?.onprogress&&(this._progressHandlers.set(l,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:l}}),a&&(p.params={...p.params,task:a}),s&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Pn]:s}});const f=e=>{this._responseHandlers.delete(l),this._progressHandlers.delete(l),this._cleanupTimeout(l),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:l,reason:String(e)}},{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)));const t=e instanceof la?e:new la(Vn.RequestTimeout,String(e));u(t)};this._responseHandlers.set(l,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return u(e);try{const r=Hs(t,e.result);r.success?c(r.data):u(r.error)}catch(e){u(e)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});const h=r?.timeout??6e4;this._setupTimeout(l,h,r?.maxTotalTimeout,()=>f(la.fromError(Vn.RequestTimeout,"Request timed out",{timeout:h})),r?.resetTimeoutOnProgress??!1);const m=s?.taskId;if(m){const e=e=>{const t=this._responseHandlers.get(l);t?t(e):this._onerror(new Error(`Response handler missing for side-channeled request ${l}`))};this._requestResolvers.set(l,e),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(l),u(e)})}else this._transport.send(p,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(e=>{this._cleanupTimeout(l),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Ii,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},xi,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Ti,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const r=t?.relatedTask?.taskId;if(r){const n={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Pn]:t.relatedTask}}};return void await this._enqueueTaskMessage(r,{type:"notification",message:n,timestamp:Date.now()})}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[Pn]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))})}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[Pn]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const r=Gs(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,n)=>{const i=Ys(e,r);return Promise.resolve(t(i,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const r=Gs(e);this._notificationHandlers.set(r,r=>{const n=Ys(e,r);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(e,t);for(const t of r)if("request"===t.type&&Jn(t.message)){const r=t.message.id,n=this._requestResolvers.get(r);n?(n(new la(Vn.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(r)):this._onerror(new Error(`Resolver missing for request ${r} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{const t=await(this._taskStore?.getTask(e));t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,n)=>{if(t.aborted)return void n(new la(Vn.InvalidRequest,"Request cancelled"));const i=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(i),n(new la(Vn.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{const n=await r.getTask(e,t);if(!n)throw new la(Vn.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(e,n,i)=>{await r.storeTaskResult(e,n,i,t);const o=await r.getTask(e,t);if(o){const t=ki.parse({method:"notifications/tasks/status",params:o});await this.notification(t),Bs(o.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,n,i)=>{const o=await r.getTask(e,t);if(!o)throw new la(Vn.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(Bs(o.status))throw new la(Vn.InvalidParams,`Cannot update task "${e}" from terminal status "${o.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,n,i,t);const a=await r.getTask(e,t);if(a){const t=ki.parse({method:"notifications/tasks/status",params:a});await this.notification(t),Bs(a.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function Qs(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var ec=n(28825),tc=n(91712);class rc{constructor(e){this._ajv=e??function(){const e=new ec({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return tc(e),e}()}getValidator(e){const t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class nc{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class ic extends Xs{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Io.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{const r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new rc,this.setRequestHandler(ci,e=>this._oninitialize(e)),this.setNotificationHandler(li,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Eo,async(e,t)=>{const r=t.sessionId||t.requestInfo?.headers["mcp-session-id"]||void 0,{level:n}=e.params,i=Io.safeParse(n);return i.success&&this._loggingLevels.set(r,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new nc(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){const r={...e};for(const e in t){const n=e,i=t[n];if(void 0===i)continue;const o=r[n];Qs(o)&&Qs(i)?r[n]={...o,...i}:r[n]=i}return r}(this._capabilities,e)}setRequestHandler(e,t){const r=qs(e),n=r?.method;if(!n)throw new Error("Schema is missing a method literal");let i;if(Vs(n)){const e=n,t=e._zod?.def;i=t?.value??e.value}else{const e=n,t=e._def;i=t?.value??e.value}if("string"!=typeof i)throw new Error("Schema method literal must be a string");if("tools/call"===i){const r=async(e,r)=>{const n=Hs(ko,e);if(!n.success){const e=n.error instanceof Error?n.error.message:String(n.error);throw new la(Vn.InvalidParams,`Invalid tools/call request: ${e}`)}const{params:i}=n.data,o=await Promise.resolve(t(e,r));if(i.task){const e=Hs(wi,o);if(!e.success){const t=e.error instanceof Error?e.error.message:String(e.error);throw new la(Vn.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}const a=Hs(wo,o);if(!a.success){const e=a.error instanceof Error?a.error.message:String(a.error);throw new la(Vn.InvalidParams,`Invalid tools/call result: ${e}`)}return a.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){!function(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`)}}(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&function(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);if("tools/call"===t&&!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`)}(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){const t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:In.includes(t)?t:Sn,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Bn)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const t=e.messages[e.messages.length-1],r=Array.isArray(t.content)?t.content:[t.content],n=r.some(e=>"tool_result"===e.type),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,o=i?Array.isArray(i.content)?i.content:[i.content]:[],a=o.some(e=>"tool_use"===e.type);if(n){if(r.some(e=>"tool_result"!==e.type))throw new Error("The last message must contain only tool_result content if any is present");if(!a)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){const e=new Set(o.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Ko,t):this.request({method:"sampling/createMessage",params:e},Mo,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");const r=e;return this.request({method:"elicitation/create",params:r},ta,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");const r="form"===e.mode?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:r},ta,t);if("accept"===n.action&&n.content&&r.requestedSchema)try{const e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(n.content);if(!e.valid)throw new la(Vn.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof la)throw e;throw new la(Vn.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},ua,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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"})}}var oc=n(41082);const ac=require("crypto"),sc=require("fs");var cc=n(16928);class uc extends oc.CryptoProvider{async sign(e,t){const r=Buffer.from(t,"base64"),n=64===r.length?r.subarray(0,32):r,i=Buffer.concat([Buffer.from("302e020100300506032b657004220420","hex"),n]),o=ac.createPrivateKey({key:i,format:"der",type:"pkcs8"}),a=ac.sign(null,Buffer.from(e),o);return new Uint8Array(a)}async verify(e,t,r){try{const n=Buffer.from(r,"base64"),i=Buffer.concat([Buffer.from("302a300506032b6570032100","hex"),n]),o=ac.createPublicKey({key:i,format:"der",type:"spki"});return ac.verify(null,Buffer.from(e),o,Buffer.from(t))}catch{return!1}}async generateKeyPair(){const{publicKey:e,privateKey:t}=ac.generateKeyPairSync("ed25519",{publicKeyEncoding:{type:"spki",format:"der"},privateKeyEncoding:{type:"pkcs8",format:"der"}}),r=t.subarray(16,48),n=e.subarray(12,44);return{privateKey:r.toString("base64"),publicKey:n.toString("base64")}}async hash(e){return`sha256:${ac.createHash("sha256").update(Buffer.from(e)).digest("hex")}`}async randomBytes(e){return new Uint8Array(ac.randomBytes(e))}}oc.StorageProvider,oc.IdentityProvider;class dc extends oc.ProofGenerator{constructor(e,t=new uc){super(e,t)}}const lc=require("fs/promises");var pc=n(77598),fc=n(57975);class hc extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class mc extends hc{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}Symbol.asyncIterator;const gc=(0,fc.promisify)(pc.generateKeyPair);var vc=n(4573);const yc=pc.webcrypto;const _c=["KeyObject"];(globalThis.CryptoKey||yc?.CryptoKey)&&_c.push("CryptoKey");const bc=e=>{let t;if((e=>fc.types.isCryptoKey(e))(e)){if(!e.extractable)throw new TypeError("CryptoKey is not extractable");t=pc.KeyObject.from(e)}else{if(n=e,!fc.types.isKeyObject(n)){if(e instanceof Uint8Array)return{kty:"oct",k:(r=e,vc.Buffer.from(r).toString("base64url"))};throw new TypeError(((e,...t)=>function(e,t,...r){if((r=r.filter(Boolean)).length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}("Key must be ",e,...t))(e,..._c,"Uint8Array"))}t=e}var r,n;if("secret"!==t.type&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(t.asymmetricKeyType))throw new mc("Unsupported key asymmetricKeyType");return t.export({format:"jwk"})};function wc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}n(18381);const $c="XMCP_I_ENOIDENTITY";class kc{async ensureIdentity(){return this.cachedIdentity||("development"===this.config.environment?this.cachedIdentity=await this.loadOrGenerateDevIdentity():this.cachedIdentity=await this.loadProdIdentity()),this.cachedIdentity}async loadOrGenerateDevIdentity(){const e=this.config.devIdentityPath;try{if((0,sc.existsSync)(e)){const t=await(0,lc.readFile)(e,"utf-8"),r=JSON.parse(t);let n=r.kid||r.keyId;if(r.keyId&&!r.kid&&n.startsWith("key-")){n=this.generateMultibaseKid(r.publicKey);const e={did:r.did,kid:n,privateKey:r.privateKey,publicKey:r.publicKey,createdAt:r.createdAt,lastRotated:r.lastRotated};return await this.saveDevIdentity(e),console.error(`ā
Migrated identity to new multibase kid format: ${n}`),e}return{did:r.did,kid:n,privateKey:r.privateKey,publicKey:r.publicKey,createdAt:r.createdAt,lastRotated:r.lastRotated}}}catch(t){console.warn(`Warning: Could not load identity from ${e}, generating new one`,t instanceof Error?t.message:t)}return await this.generateDevIdentity()}async generateDevIdentity(){const e=await async function(e,t){return async function(e,t){switch(e){case"RS256":case"RS384":case"RS512":case"PS256":case"PS384":case"PS512":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":case"RSA1_5":{const e=t?.modulusLength??2048;if("number"!=typeof e||e<2048)throw new mc("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return await gc("rsa",{modulusLength:e,publicExponent:65537})}case"ES256":return gc("ec",{namedCurve:"P-256"});case"ES256K":return gc("ec",{namedCurve:"secp256k1"});case"ES384":return gc("ec",{namedCurve:"P-384"});case"ES512":return gc("ec",{namedCurve:"P-521"});case"Ed25519":return gc("ed25519");case"EdDSA":switch(t?.crv){case void 0:case"Ed25519":return gc("ed25519");case"Ed448":return gc("ed448");default:throw new mc("Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448")}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const e=t?.crv??"P-256";switch(e){case void 0:case"P-256":case"P-384":case"P-521":return gc("ec",{namedCurve:e});case"X25519":return gc("x25519");case"X448":return gc("x448");default:throw new mc("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}}default:throw new mc('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}}(e,t)}("EdDSA",{crv:"Ed25519"}),t=await async function(e){return bc(e)}(e.privateKey);if(!t.x||!t.d)throw new Error("Failed to generate Ed25519 keypair");const r=Buffer.from(t.d,"base64url").toString("base64"),n=Buffer.from(t.x,"base64url").toString("base64"),i=this.generateMultibaseKid(n),o={did:`did:web:localhost:3000:agents:${(0,ac.createHash)("sha256").update(n).digest("hex").substring(0,8)}`,kid:i,privateKey:r,publicKey:n,createdAt:(new Date).toISOString()};return await this.saveDevIdentity(o),o}generateMultibaseKid(e){const t=Buffer.from(e,"base64"),r=Buffer.concat([Buffer.from([237,1]),t]);return`z${this.encodeBase58(r)}`}encodeBase58(e){let t=BigInt("0x"+e.toString("hex")),r="";for(;t>0n;)r="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"[Number(t%58n)]+r,t/=58n;for(let t=0;t<e.length&&0===e[t];t++)r="1"+r;return r}async saveDevIdentity(e){const t=this.config.devIdentityPath;await(0,lc.mkdir)((0,cc.dirname)(t),{recursive:!0});const r={version:"1.0",did:e.did,kid:e.kid,privateKey:e.privateKey,publicKey:e.publicKey,createdAt:e.createdAt,lastRotated:e.lastRotated};await(0,lc.writeFile)(t,JSON.stringify(r,null,2),{mode:384}),console.error(`ā
Identity saved to ${t}`),console.error(` DID: ${e.did}`),console.error(` Key ID: ${e.kid}`)}async loadProdIdentity(){const e=["AGENT_PRIVATE_KEY","AGENT_KEY_ID","AGENT_DID","KYA_VOUCHED_API_KEY"],t=[],r={};for(const n of e){const e=process.env[n];e?r[n]=e:t.push(n)}if(t.length>0){const e=new Error(`Missing required environment variables for production identity: ${t.join(", ")}\nRequired variables:\n AGENT_PRIVATE_KEY - Base64-encoded Ed25519 private key\n AGENT_KEY_ID - Key identifier\n AGENT_DID - Agent DID\n KYA_VOUCHED_API_KEY - Know-That-AI API key`);throw e.code=$c,e}let n;try{n=this.derivePublicKey(r.AGENT_PRIVATE_KEY)}catch(e){const t=new Error("AGENT_PRIVATE_KEY is not a valid Ed25519 private key (must be a base64-encoded 32-byte seed, or a 64-byte seed+public-key pair).");throw t.code=$c,t.cause=e,t}return{did:r.AGENT_DID,kid:r.AGENT_KEY_ID,privateKey:r.AGENT_PRIVATE_KEY,publicKey:n,createdAt:(new Date).toISOString()}}derivePublicKey(e){const t=Buffer.from(e,"base64"),r=64===t.length?t.subarray(0,32):t,n=Buffer.concat([Buffer.from("302e020100300506032b657004220420","hex"),r]),i=(0,ac.createPrivateKey)({key:n,format:"der",type:"pkcs8"});return(0,ac.createPublicKey)(i).export({format:"der",type:"spki"}).subarray(12).toString("base64")}async validateIdentity(e){try{return!!(e.did&&e.kid&&e.privateKey&&e.publicKey)&&!!e.did.startsWith("did:")&&(Buffer.from(e.privateKey,"base64"),Buffer.from(e.publicKey,"base64"),!0)}catch{return!1}}clearCache(){this.cachedIdentity=void 0}getConfig(){return{...this.config}}constructor(e={environment:"development"}){wc(this,"config",void 0),wc(this,"cachedIdentity",void 0);const t=n(16928);let r=e.devIdentityPath||".mcpi/identity.json";t.isAbsolute(r)||(r=t.resolve(process.cwd(),r)),this.config={privacyMode:!1,...e,devIdentityPath:r},this.config.debug&&console.error("[IdentityManager] Constructed with config:",{environment:this.config.environment,devIdentityPath:this.config.devIdentityPath})}}function Sc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}new kc;const Ic=new class{register(e,t){this.config.set(e,t),this.debug&&console.error(`[ToolProtectionRegistry] Registered protection for tool: ${e}`,t)}registerAll(e){for(const[t,r]of Object.entries(e))this.register(t,r)}get(e){return this.config.get(e)||null}requiresDelegation(e){const t=this.get(e);return t?.requiresDelegation||!1}getRequiredScopes(e){const t=this.get(e);return t?.requiredScopes||[]}setDelegationVerifier(e){this.delegationVerifier=e}setAuthConfig(e){this.authConfig=e}getDelegationVerifier(){return this.delegationVerifier}getAuthConfig(){return this.authConfig}setDebug(e){this.debug=e}setCurrentSession(e){this.currentSession=e}getCurrentSession(){return this.currentSession}getCurrentAgentDid(){return this.currentSession?.agentDid||null}clear(){this.config.clear(),this.delegationVerifier=null,this.authConfig=null,this.currentSession=null}getProtectedTools(){return Array.from(this.config.keys())}constructor(){Sc(this,"config",new Map),Sc(this,"delegationVerifier",null),Sc(this,"authConfig",null),Sc(this,"debug",!1),Sc(this,"currentSession",null)}};function Pc(e){const t=process.env.XMCP_I_TS_SKEW_SEC,r=process.env.XMCP_I_SESSION_TTL_MIN,n=t?parseInt(t,10):void 0,i=r?parseInt(r,10):void 0;return{...e,timestampSkewSeconds:e.timestampSkewSeconds??(void 0===n||isNaN(n)?void 0:n),sessionTtlMinutes:e.sessionTtlMinutes??(void 0===i||isNaN(i)?void 0:i)}}class Ec extends oc.SessionManager{constructor(e,t){e instanceof oc.CryptoProvider?super(e,Pc(t??{})):super(new uc,Pc(e??{}))}}new Ec;const xc=new(require("async_hooks").AsyncLocalStorage);function Oc(){return xc.getStore()}var Tc=n(95277);const Ac=Symbol.for("kya-os.outbound-identity.registry");let Cc=!1;function jc(){const e=Oc();if(!e?.delegationRef||!e.delegationPrivateKeyJwk||!e.delegationAgentKid)return;const t=e.delegationChain??e.delegationRef,r=e.delegationScopes??[],n=e.session?.serverDid??"",i=e.session?.userDid??"",o=e.session?.clientDid,a=e.delegationPrivateKeyJwk,s=e.delegationAgentKid,c=e.delegationRef;return{delegationRef:c,delegationChain:t,delegationScopes:r,agentDid:n,userDid:i,...o?{clientDid:o}:{},kid:s,delegationCredential:e.delegationCredential,buildProof:e=>(0,Tc.buildDelegationProofJWT)({agentDid:n,userDid:i,delegationId:c,delegationChain:t,scopes:r,privateKeyJwk:a,kid:s,targetHostname:e})}}function Dc(){return Oc()?.session?.sessionId}function zc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nc extends Error{constructor(e,t,r,n){super(e),zc(this,"failed",void 0),zc(this,"succeededCount",void 0),zc(this,"causes",void 0),this.failed=t,this.succeededCount=r,this.causes=n,this.name="PartialProofSubmissionError"}}class Rc{async submit(e){const t=(await Promise.allSettled(e.map(e=>this.submitOne(e)))).map((t,r)=>({result:t,submission:e[r]})).filter(e=>"rejected"===e.result.status);if(t.length>0){const r=t.map(e=>e.result.reason),n=r.map(e=>e instanceof Error?e.message:String(e)).join("; ");throw new Nc(`KTA proof submission failed for ${t.length}/${e.length} proof(s): ${n}`,t.map(e=>e.submission),e.length-t.length,r)}}async submitOne(e){const{proof:t,toolName:r,outcome:n}=e,i={"Content-Type":"application/json"};this.apiKey&&(i.Authorization=`Bearer ${this.apiKey}`);const o=await fetch(`${this.apiUrl}/api/v1/proofs`,{method:"POST",headers:i,body:JSON.stringify({proof:t,toolName:r,outcome:n,timestamp:t.meta.ts,businessDid:t.meta.audience})});if(!o.ok){let e;if(409===o.status&&(e=(await o.json().catch(()=>({}))).code,"CONFLICT"===e))return;throw new Error(`KTA proof submission failed: ${o.status} ${o.statusText}`+(e?` (${e})`:""))}}constructor(e,t){zc(this,"name","KTA"),zc(this,"apiUrl",void 0),zc(this,"apiKey",void 0),this.apiUrl=e.replace(/\/$/,""),this.apiKey=t}}class Uc{async submit(e){if(0===e.length)return;const t=e.map(e=>e.proof),r={delegation_id:null,session_id:t[0]?.meta?.sessionId||"unknown",proofs:t},n=await fetch(`${this.apiUrl}/api/v1/bouncer/proofs`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(r)});if(!n.ok){const e=await n.text().catch(()=>"Unable to read error body");throw new Error(`AgentShield proof submission failed: ${n.status} ${n.statusText}\n${e}`)}}constructor(e,t){zc(this,"name","AgentShield"),zc(this,"apiUrl",void 0),zc(this,"apiKey",void 0),this.apiUrl=e.replace(/\/$/,""),this.apiKey=t}}class Mc{enqueue(e){const t="proof"in e?e:this.submissionFromBareProof(e);this.closed?console.warn("[ProofBatchQueue] Queue is closed, dropping proof"):(this.queue.push(t),this.stats.queued++,this.config.debug&&console.error(`[ProofBatchQueue] Enqueued proof (queue size: ${this.queue.length})`),this.queue.length>=this.config.maxBatchSize&&this.flush())}submissionFromBareProof(e){const t=e.meta,r=null!==t&&"object"==typeof t&&"toolName"in t&&"string"==typeof t.toolName?t.toolName:void 0,n=null===t||"object"!=typeof t||!("submissionOutcome"in t)||"success"!==t.submissionOutcome&&"failure"!==t.submissionOutcome&&"denied"!==t.submissionOutcome?void 0:t.submissionOutcome;return void 0!==r&&void 0!==n||console.warn("[ProofBatchQueue] Enqueued a DetachedProof with no signed toolName/submissionOutcome -- the destination's server-side JWS payload check will reject this submission. Generate the proof with { toolName, submissionOutcome } options instead."),{proof:e,toolName:r??"unknown",outcome:n??"success"}}async flush(){if(0===this.queue.length)return;const e=this.queue.splice(0,this.config.maxBatchSize);this.config.debug&&console.error(`[ProofBatchQueue] Flushing ${e.length} proofs to ${this.config.destinations.length} destinations`);for(const t of this.config.destinations){const r={submissions:e,destination:t,retryCount:0};this.submitBatch(r)}}async submitBatch(e){try{await e.destination.submit(e.submissions),this.stats.submitted+=e.submissions.length,this.stats.batchesSubmitted++,this.config.debug&&console.error(`[ProofBatchQueue] Successfully submitted ${e.submissions.length} proofs to ${e.destination.name}`)}catch(t){console.error(`[ProofBatchQueue] Failed to submit to ${e.destination.name}:`,t);const r=t instanceof Nc,n=r?t.failed:e.submissions;if(r&&t.succeededCount>0&&(this.stats.submitted+=t.succeededCount),e.retryCount<this.config.maxRetries){e.retryCount++;const t=Math.min(1e3*Math.pow(2,e.retryCount-1),16e3);e.nextRetryAt=Date.now()+t,e.submissions=n,this.pendingBatches.push(e),this.config.debug&&console.error(`[ProofBatchQueue] Scheduling retry ${e.retryCount}/${this.config.maxRetries} in ${t}ms for ${e.submissions.length} proof(s)`)}else this.stats.failed+=n.length,console.error(`[ProofBatchQueue] Max retries exceeded for ${e.destination.name}, dropping ${n.length} proofs`)}}startFlushTimer(){this.flushTimer=setInterval(()=>{this.queue.length>0&&this.flush()},this.config.flushIntervalMs),"function"==typeof this.flushTimer.unref&&this.flushTimer.unref()}startRetryTimer(){this.retryTimer=setInterval(()=>{const e=Date.now(),t=this.pendingBatches.filter(t=>t.nextRetryAt&&t.nextRetryAt<=e);if(t.length>0){this.pendingBatches=this.pendingBatches.filter(e=>!t.includes(e));for(const e of t)this.submitBatch(e)}},1e3),"function"==typeof this.retryTimer.unref&&this.retryTimer.unref()}async close(){this.closed=!0,this.flushTimer&&clearInterval(this.flushTimer),this.retryTimer&&clearInterval(this.retryTimer),await this.flush();const e=Date.now();for(;this.pendingBatches.length>0&&Date.now()-e<3e4;)await new Promise(e=>setTimeout(e,100));this.pendingBatches.length>0&&console.warn(`[ProofBatchQueue] Closing with ${this.pendingBatches.length} pending batches (timed out)`)}getStats(){return{...this.stats,queueSize:this.queue.length,pendingBatches:this.pendingBatches.length}}constructor(e){zc(this,"queue",[]),zc(this,"pendingBatches",[]),zc(this,"config",void 0),zc(this,"flushTimer",void 0),zc(this,"retryTimer",void 0),zc(this,"closed",!1),zc(this,"stats",{queued:0,submitted:0,failed:0,batchesSubmitted:0}),this.config={destinations:e.destinations,maxBatchSize:e.maxBatchSize||10,flushIntervalMs:e.flushIntervalMs||5e3,maxRetries:e.maxRetries||5,debug:e.debug||!1},this.startFlushTimer(),this.startRetryTimer()}}function Kc(e){let t=e.type;return"provider"in e&&e.provider&&(t+=`:${e.provider}`),"issuer"in e&&e.issuer&&(t+=`:${e.issuer}`),"credentialType"in e&&e.credentialType&&(t+=`:${e.credentialType}`),t}const Zc="undefined"!=typeof RUNTIME_CONFIG_PATH?RUNTIME_CONFIG_PATH:void 0,Jc=Zc?"string"==typeof Zc?JSON.parse(Zc):Zc:null;let Lc=null;async function Wc(e,t,r,i){if("undefined"!=typeof global){if(global.__MCPI_HANDLERS_REGISTERED__)return r?.debug&&console.error("[MCPI] Handlers already registered, skipping duplicate registration"),e;global.__MCPI_HANDLERS_REGISTERED__=!0}r?.debug&&console.error("[MCPI] Registering handlers for the first time");const o=new Ec;let a=null;if(r?.enabled)try{a=new kc({environment:r.environment||"development",devIdentityPath:r.devIdentityPath,debug:r.debug});const e=await a.ensureIdentity();r.debug&&(console.error(`[MCPI] Identity enabled - DID: ${e.did}`),console.error(`[MCPI] Identity path: ${r.devIdentityPath||".mcpi/identity.json"}`))}catch(e){r?.debug&&console.error("[MCPI] Failed to initialize identity:",e),a=null}await async function(e){if(Lc)return Lc;if(!Jc)return e&&console.error("[MCPI] No runtime config found - proof submission disabled"),null;try{e&&console.error("[MCPI] Loading runtime config from:",Jc);const t=await n(23967)(Jc),r="function"==typeof t.getRuntimeConfig?t.getRuntimeConfig():t.default;if(!r?.proofing?.enabled)return e&&console.error("[MCPI] Proofing is disabled in runtime config"),null;const i=r.proofing;if(!i.batchQueue?.destinations||0===i.batchQueue.destinations.length)return e&&console.error("[MCPI] No proof destinations configured"),null;const o=[];for(const t of i.batchQueue.destinations)"agentshield"===t.type?(o.push(new Uc(t.apiUrl,t.apiKey)),e&&console.error(`[MCPI] Added AgentShield destination: ${t.apiUrl}`)):"kta"===t.type?(o.push(new Rc(t.apiUrl,t.apiKey)),e&&console.error(`[MCPI] Added KTA destination: ${t.apiUrl}`)):console.warn(`[MCPI] Unsupported proof destination type "${t.type}" - skipping`);return 0===o.length?(e&&console.error("[MCPI] No valid proof destinations configured"),null):(Lc=new Mc({destinations:o,maxBatchSize:i.batchQueue.maxBatchSize||10,flushIntervalMs:i.batchQueue.flushIntervalMs||5e3,maxRetries:i.batchQueue.maxRetries||3,debug:i.batchQueue.debug||e}),e&&console.error(`[MCPI] ProofBatchQueue initialized (batch: ${i.batchQueue.maxBatchSize}, flush: ${i.batchQueue.flushIntervalMs}ms, destinations: ${o.length})`),Lc)}catch(t){return e&&console.error("[MCPI] Failed to initialize ProofBatchQueue:",t),null}}(r?.debug);const s=[],c=new Map;if(t.forEach((e,t)=>{const r=function(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}(t),n={name:r,description:"No description provided"};let i={};const{default:o,metadata:a,schema:u}=e;"object"==typeof a&&null!==a&&Object.assign(n,a),function(e){if("object"!=typeof e||null===e)return!1;const t=e;return Object.entries(t).every(([e,t])=>"string"==typeof e&&"object"==typeof t&&null!==t&&"parse"in t&&"function"==typeof t.parse)}(u)?Object.assign(i,u):null!=u&&console.warn(`Invalid schema for tool "${n.name}" at ${t}. Expected Record<string, z.ZodType>`),void 0===n.annotations&&(n.annotations={}),void 0===n.annotations.title&&(n.annotations.title=n.name);const d={name:n.name,description:n.description,inputSchema:{type:"object",properties:Object.fromEntries(Object.entries(i).map(([e,t])=>[e,{type:"string"}]))}};s.push(d),c.set(n.name,o)}),r?.debug&&console.error("[MCPI] About to register handlers (tools/list, tools/call, handshake)"),a)try{const e=await a.ensureIdentity();o.setServerDid(e.did)}catch(e){r?.debug&&console.error("[MCPI] Failed to set server DID on session manager:",e),a=null}return s.push({name:"_kyaos_handshake",description:"Internal MCP-I handshake tool for session establishment. Clients should call this before protected tools.",inputSchema:{type:"object",properties:{nonce:{type:"string",description:"Unique nonce for replay prevention"},audience:{type:"string",description:"Target audience (server DID or URL)"},timestamp:{type:"number",description:"Unix timestamp in seconds"},agentDid:{type:"string",description:"Agent DID for delegation verification (optional)"},clientInfo:{type:"object",description:"MCP client metadata (optional)",properties:{name:{type:"string"},version:{type:"string"},platform:{type:"string"},vendor:{type:"string"}}},clientProtocolVersion:{type:"string",description:"MCP protocol version (optional)"},clientCapabilities:{type:"object",description:"MCP client capabilities (optional)",additionalProperties:!0}},required:["nonce","audience","timestamp"]}}),c.set("_kyaos_handshake",async e=>{const t=[];if((!e.nonce||"string"==typeof e.nonce&&0===e.nonce.trim().length)&&t.push("nonce"),(!e.audience||"string"==typeof e.audience&&0===e.audience.trim().length)&&t.push("audience"),void 0===e.timestamp||null===e.timestamp||"number"!=typeof e.timestamp||e.timestamp<=0||!Number.isInteger(e.timestamp)){if(void 0!==e.timestamp&&null!==e.timestamp)return{success:!1,error:{code:"XMCP_I_EHANDSHAKE",message:"Invalid timestamp: must be a positive integer (Unix timestamp in seconds)",details:{received:typeof e.timestamp,value:e.timestamp}}};t.push("timestamp")}if(t.length>0)return{success:!1,error:{code:"XMCP_I_EHANDSHAKE",message:`Missing required field(s): ${t.join(", ")}`,details:{missingFields:t,requiredFields:["nonce","audience","timestamp"]}}};const n=e.timestamp,i={nonce:String(e.nonce).trim(),audience:String(e.audience).trim(),timestamp:n,agentDid:"string"==typeof e.agentDid&&e.agentDid.trim().length>0?e.agentDid.trim():void 0,clientInfo:"object"==typeof e.clientInfo&&null!==e.clientInfo?e.clientInfo:void 0,clientProtocolVersion:"string"==typeof e.clientProtocolVersion&&e.clientProtocolVersion.trim().length>0?e.clientProtocolVersion.trim():void 0,clientCapabilities:"object"==typeof e.clientCapabilities&&null!==e.clientCapabilities?e.clientCapabilities:void 0};if(!(0,oc.validateHandshakeFormat)(i))return{success:!1,error:{code:"XMCP_I_EHANDSHAKE",message:"Invalid handshake request format. Required: nonce, audience, timestamp"}};const a=await o.validateHandshake(i);return r?.debug&&a.success&&a.session?.clientInfo&&console.error("[MCPI] Client connected:",{name:a.session.clientInfo.name,version:a.session.clientInfo.version,platform:a.session.clientInfo.platform,vendor:a.session.clientInfo.vendor,clientId:a.session.clientInfo.clientId}),a.success&&a.session?{success:!0,sessionId:a.session.sessionId,serverDid:a.session.serverDid,ttlMinutes:a.session.ttlMinutes,...a.session.clientInfo&&{clientInfo:a.session.clientInfo}}:{success:!1,error:a.error}}),e.setRequestHandler(_o,async e=>({tools:s})),e.setRequestHandler(ko,async e=>{const t=e._meta?.sessionId;let n=null;return t&&(n=await o.getSession(t),!n&&r?.debug&&console.error(`[MCPI] Session not found or expired: ${t}`)),s={session:n||void 0,requestId:e._meta?.requestId,startTime:Date.now()},xc.run(s,async()=>{const{name:t,arguments:o}=e.params,s=(0,oc.normalizeInternalToolName)(t);(0,oc.isInternalToolName)(t)&&(0,oc.recordWireForm)("tool_name",s===t?"new":"old",{tool:s});const u=c.get(s);if(!u)return{content:[{type:"text",text:`Tool "${s}" not found`}],isError:!0};const d=Ic.get(s);if(d?.requiresDelegation){const e=Ic.getAuthConfig();if(!Ic.getDelegationVerifier()||!e)return r?.debug&&console.error(`[MCPI] Tool "${s}" requires delegation but verifier not configured`),{content:[{type:"text",text:`ā Tool "${s}" requires delegation verification, but the delegation system is not configured.\n\nTo fix this:\n1. Configure a delegation verifier:\n - MemoryDelegationVerifier (development/testing)\n - KVDelegationVerifier (production with KV store)\n - AgentShieldVerifier (production with AgentShield service)\n\n2. Enable delegation in your runtime config:\n const runtime = new MCPIRuntime({\n delegation: { enabled: true },\n // ... other config\n });\n\n3. Ensure the verifier is initialized before tool execution.\n\nš Documentation: https://docs.mcp-i.dev/delegation/setup`}],isError:!0};const t=(Oc()?.session)?.agentDid;if(!t)return r?.debug&&console.error(`[MCPI] Tool "${s}" requires delegation but no agent DID in session`),{content:[{type:"text",text:`ā Tool "${s}" requires delegation, but no agent identity was found in the current session.\n\nThis usually means one of the following:\n\n1. **No handshake was performed**: The MCP client must send a handshake request before calling protected tools.\n Example handshake:\n {\n "agentDid": "did:key:z6Mk...",\n "nonce": "unique-value",\n "audience": "server-did",\n "timestamp": ${Math.floor(Date.now()/1e3)}\n }\n\n2. **Handshake missing agentDid**: Ensure the handshake request includes the 'agentDid' field.\n\n3. **Session expired**: The session may have expired. Try performing a new handshake.\n\n4. **Request missing sessionId**: Ensure tool call requests include _meta.sessionId from the handshake response.\n\nš Learn more: https://docs.mcp-i.dev/delegation/handshake`}],isError:!0};r?.debug&&console.error(`[MCPI] Tool "${s}" requires delegation - verifying scopes: ${d.requiredScopes?.join(", ")}`);const n=await(0,oc.verifyOrHints)(t,d.requiredScopes||[],e);if(!n.authorized){r?.debug&&console.error(`[MCPI] Tool "${s}" blocked - authorization required`);const e=new oc.DelegationErrorFormatter(i),{message:t,consentUrl:o}=e.format({toolName:s,consentUrl:n.authError?.authorizationUrl,scopes:n.authError?.scopes,clientId:void 0});return{content:[{type:"text",text:JSON.stringify({error:"needs_authorization",message:`Tool "${s}" requires user authorization`,displayMessage:t,authorizationUrl:o,resumeToken:n.authError?.resumeToken,scopes:n.authError?.scopes,display:n.authError?.display})}],isError:!0}}if(n.authorized&&d.authorization&&n.credential){const i=d.authorization,o=n.credential.authorization;if(!o){r?.debug&&console.error(`[MCPI] Tool "${s}" blocked - credential missing authorization data`);const n=new URL(e.bouncer.authorizationUrl);return n.searchParams.set("agent_did",t),n.searchParams.set("scopes",(d.requiredScopes||[]).join(",")),n.searchParams.set("tool",s),{content:[{type:"text",text:JSON.stringify({error:"authorization_data_missing",message:`Tool "${s}" requires authorization ${Kc(i)} but delegation credential does not contain authorization data. Please re-authorize.`,authorizationUrl:n.toString(),scopes:d.requiredScopes||[],requiredAuth:i})}],isError:!0}}if(!(0,oc.authorizationMatches)(o,i)){r?.debug&&console.error(`[MCPI] Tool "${s}" blocked - authorization method mismatch`);const n=new URL(e.bouncer.authorizationUrl);return n.searchParams.set("agent_did",t),n.searchParams.set("scopes",(d.requiredScopes||[]).join(",")),n.searchParams.set("tool",s),{content:[{type:"text",text:JSON.stringify({error:"authorization_method_mismatch",message:`Tool "${s}" requires re-authorization. Delegation was created with ${Kc(o)} but tool now requires ${Kc(i)}.`,authorizationUrl:n.toString(),scopes:d.requiredScopes||[],currentAuth:o,requiredAuth:i})}],isError:!0}}}if(r?.debug&&console.error(`[MCPI] Tool "${s}" authorized - executing handler`),n.delegation){const e=a?await a.ensureIdentity():null;!function(e){const t=Oc();t?(t.delegationRef=e.delegationRef,t.delegationChain=e.delegationChain,t.delegationScopes=e.delegationScopes,void 0!==e.delegationCredential&&(t.delegationCredential=e.delegationCredential),void 0!==e.delegationPrivateKeyJwk&&(t.delegationPrivateKeyJwk=e.delegationPrivateKeyJwk),void 0!==e.delegationAgentKid&&(t.delegationAgentKid=e.delegationAgentKid)):console.warn("[RequestContext] setDelegationContext called outside of runWithContext ā delegation headers will not be injected")}({delegationRef:(l={delegationId:n.delegation.id,delegationChain:(0,Tc.buildChainString)(n.delegation),delegationScopes:d.requiredScopes||[],delegationCredential:n.credential?.credential_jwt,identity:e??null}).delegationId,delegationChain:l.delegationChain,delegationScopes:l.delegationScopes,delegationCredential:l.delegationCredential,delegationPrivateKeyJwk:l.identity?.privateKey?{kty:"OKP",crv:"Ed25519",d:Buffer.from(l.identity.privateKey,"base64").toString("base64url"),x:Buffer.from(l.identity.publicKey,"base64").toString("base64url"),kid:l.identity.kid}:void 0,delegationAgentKid:l.identity?.kid})}!function(e){if(Cc)return!0;const t=globalThis[Ac];t?.setDelegationProvider?(t.setDelegationProvider(jc),t.setSessionIdProvider?.(Dc),Cc=!0,e?.debug("Outbound identity bridge: delegation + session providers registered")):e?.debug("Outbound identity bridge: compute interceptor not present ā skipping")}()}var l;try{const e=await u(o||{}),t={content:[{type:"text",text:"string"==typeof e?e:JSON.stringify(e)}]};if(a)try{const i=await a.ensureIdentity(),c={method:s,params:o||{}},u={data:e},d=Math.floor(Date.now()/1e3),l=n??{sessionId:`tool-${Date.now()}`,nonce:`${Date.now()}`,audience:"client",createdAt:d,timestamp:d,lastActivity:d,ttlMinutes:30,identityState:"anonymous"};let p;const f=Ic.get(s);p=f?.requiredScopes&&f.requiredScopes.length>0?f.requiredScopes[0]:`${s}:execute`,r?.debug&&console.error(`[MCPI] Proof scopeId for tool "${s}": ${p}`);const h=new dc(i),m=await h.generateProof(c,u,l,{scopeId:p,clientDid:n?.clientDid,toolName:s,submissionOutcome:"success"});if(r?.debug&&console.error(`[MCPI] Generated proof for tool "${s}" - DID: ${m.meta.did}`),Lc)try{Lc.enqueue({proof:m,toolName:s,outcome:m.meta.submissionOutcome??"success"}),r?.debug&&console.error("[MCPI] Proof enqueued for submission to AgentShield")}catch(e){r?.debug&&console.error("[MCPI] Failed to enqueue proof:",e)}return{...t,_meta:{proof:m}}}catch(e){return r?.debug&&console.error(`[MCPI] Failed to generate proof for tool "${s}":`,e),t}return t}catch(e){return{content:[{type:"text",text:`Error executing tool "${s}": ${e instanceof Error?e.message:String(e)}`}],isError:!0}}});var s}),r?.debug&&console.error("[MCPI] Handlers registered successfully"),e}"undefined"!=typeof global&&(global.__MCPI_HANDLERS_REGISTERED__=global.__MCPI_HANDLERS_REGISTERED__||!1);const Fc=INJECTED_TOOLS,Vc="undefined"!=typeof IDENTITY_CONFIG?IDENTITY_CONFIG:void 0,Hc=Vc?JSON.parse(Vc):void 0,qc={name:"MCP Server",version:"0.0.1"},Bc={capabilities:{tools:{}}};function Gc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}"undefined"!=typeof global&&(global.__MCPI_SERVER_CREATED__=global.__MCPI_SERVER_CREATED__||!1);class Yc{start(){try{this.mcpServer.connect(this.transport),this.debug&&console.error("[STDIO] MCP Server running with STDIO transport"),this.setupShutdownHandlers()}catch(e){this.debug&&console.error("[STDIO] Error starting STDIO transport:",e),process.exit(1)}}setupShutdownHandlers(){const e=()=>{this.debug&&console.error("[STDIO] Shutting down STDIO transport"),process.exit(0)};process.on("SIGINT",e),process.on("SIGTERM",e)}shutdown(){this.debug&&console.error("[STDIO] Shutting down STDIO transport"),process.exit(0)}constructor(e,t=!1){Gc(this,"mcpServer",void 0),Gc(this,"transport",void 0),Gc(this,"debug",void 0),this.mcpServer=e,this.transport=new ha,this.debug=t}}const Xc=STDIO_CONFIG.debug||!1;(async function(){if(Hc?.debug&&console.error("[createServer] Starting server creation"),"undefined"!=typeof global&&global.__MCPI_SERVER_CREATED__&&(Hc?.debug&&console.error("[createServer] Server already exists, returning cached instance"),global.__MCPI_SERVER_INSTANCE__))return global.__MCPI_SERVER_INSTANCE__;Hc?.debug&&(console.error("[createServer] Creating new McpServer"),console.error("[createServer] SERVER_INFO constant:",JSON.stringify(qc)),console.error("[createServer] SERVER_CAPABILITIES constant:",JSON.stringify(Bc)),console.error("[createServer] Calling: new McpServer(SERVER_INFO, SERVER_CAPABILITIES)"));const e=new ic(qc,Bc);if(Hc?.debug){console.error("[createServer] Server created successfully");const t=e;console.error("[createServer] Actual server._serverInfo:",JSON.stringify(t._serverInfo||"undefined")),console.error("[createServer] Actual server._capabilities:",JSON.stringify(t._capabilities||"undefined")),console.error("[createServer] Loading tools...")}const[t,r]=function(){const e=new Map,t=Object.keys(Fc);return Hc?.debug&&console.error("[loadTools] Injected tool paths:",t),[t.map(t=>Fc[t]().then(r=>{Hc?.debug&&console.error("[loadTools] Loaded tool from path:",t),e.set(t,r)})),e]}();await Promise.all(t),Hc?.debug&&console.error("[createServer] Tools loaded, configuring server");const n=await async function(e,t){return await Wc(e,t,Hc),e}(e,r);return Hc?.debug&&console.error("[createServer] Server configured successfully"),"undefined"!=typeof global&&(global.__MCPI_SERVER_CREATED__=!0,global.__MCPI_SERVER_INSTANCE__=n),n})().then(e=>{new Yc(e,Xc).start()})})()})();