claude-mem 3.6.3 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/commands/save.md +7 -3
- package/dist/claude-mem.min.js +2 -2
- package/package.json +1 -1
- package/src/commands/migrate-to-jsonl.ts +0 -122
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
## [3.6.4] - 2025-09-13
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Update save documentation to include allowed-tools and description metadata fields
|
|
12
|
+
|
|
13
|
+
### Removed
|
|
14
|
+
- Remove deprecated markdown to JSONL migration script
|
|
15
|
+
|
|
16
|
+
|
|
8
17
|
## [3.6.3] - 2025-09-11
|
|
9
18
|
|
|
10
19
|
### Changed
|
package/commands/save.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: Bash
|
|
3
|
+
description: Write an overview and save with claude-mem
|
|
4
|
+
---
|
|
5
|
+
**Write an overview** of the current conversation context and:
|
|
6
|
+
1. **Add it to claude-mem** using the chroma MCP tools
|
|
7
|
+
2. **IMPORTANT! Save the overview to index** using the claude-mem CLI tool: `claude-mem save "your overview message"`
|
package/dist/claude-mem.min.js
CHANGED
|
@@ -37,7 +37,7 @@ ${j}`:"",f=y_();return g6(`✅ ${q} completed successfully${K}${Y}`,f)}function
|
|
|
37
37
|
`))}catch(j){let K={type:"control_response",response:{subtype:"error",request_id:q.request_id,error:j.message||String(j)}};await Promise.resolve(this.transport.write(JSON.stringify(K)+`
|
|
38
38
|
`))}finally{this.cancelControllers.delete(q.request_id)}}handleControlCancelRequest(q){let _=this.cancelControllers.get(q.request_id);if(_)_.abort(),this.cancelControllers.delete(q.request_id)}async processControlRequest(q,_){if(q.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return this.canUseTool(q.request.tool_name,q.request.input,{signal:_,suggestions:q.request.permission_suggestions})}else if(q.request.subtype==="hook_callback")return await this.handleHookCallbacks(q.request.callback_id,q.request.input,q.request.tool_use_id,_);else if(q.request.subtype==="mcp_message"){let j=q.request,K=this.sdkMcpTransports.get(j.server_name);if(!K)throw new Error(`SDK MCP server not found: ${j.server_name}`);if("method"in j.message&&"id"in j.message&&j.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(j.server_name,j,K)};else{if(K.onmessage)K.onmessage(j.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}throw new Error("Unsupported control request subtype: "+q.request.subtype)}async*readSdkMessages(){for await(let q of this.inputStream)yield q}async initialize(){let q;if(this.hooks){q={};for(let[K,Y]of Object.entries(this.hooks))if(Y.length>0)q[K]=Y.map((f)=>{let P=[];for(let $ of f.hooks){let w=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(w,$),P.push(w)}return{matcher:f.matcher,hookCallbackIds:P}})}let _={subtype:"initialize",hooks:q};return(await this.request(_)).response}async interrupt(){if(!this.isStreamingMode)throw new Error("Interrupt requires --input-format stream-json");await this.request({subtype:"interrupt"})}async setPermissionMode(q){if(!this.isStreamingMode)throw new Error("setPermissionMode requires --input-format stream-json");await this.request({subtype:"set_permission_mode",mode:q})}request(q){let _=Math.random().toString(36).substring(2,15),j={request_id:_,type:"control_request",request:q};return new Promise((K,Y)=>{this.pendingControlResponses.set(_,(f)=>{if(f.subtype==="success")K(f);else Y(new Error(f.error))}),Promise.resolve(this.transport.write(JSON.stringify(j)+`
|
|
39
39
|
`))})}async supportedCommands(){if(!this.isStreamingMode)throw new Error("supportedCommands requires --input-format stream-json");if(!this.intialization)throw new Error("supportedCommands requires transport with bidirectional communication");return(await this.intialization).commands}async streamInput(q){try{for await(let _ of q){if(this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(_)+`
|
|
40
|
-
`))}this.transport.endInput()}catch(_){if(!(_ instanceof L_))throw _}}handleHookCallbacks(q,_,j,K){let Y=this.hookCallbacks.get(q);if(!Y)throw new Error(`No hook callback found for ID: ${q}`);return Y(_,j,{signal:K})}sendMcpServerMessageToCli(q,_){if("id"in _&&_.id!==null&&_.id!==void 0){let j=`${q}:${_.id}`,K=this.pendingMcpResponses.get(j);if(K){K.resolve(_),this.pendingMcpResponses.delete(j);return}}throw new Error("No pending request found")}handleMcpControlRequest(q,_,j){let K="id"in _.message?_.message.id:null,Y=`${q}:${K}`;return new Promise((f,P)=>{let $=null,w=()=>{if($)clearTimeout($);this.pendingMcpResponses.delete(Y)},O=(z)=>{w(),f(z)},v=(z)=>{w(),P(z)};if(this.pendingMcpResponses.set(Y,{resolve:O,reject:v}),j.onmessage)j.onmessage(_.message);else{w(),P(new Error("No message handler registered"));return}$=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))w(),P(new Error("Request timeout"))},30000)})}};k={};vO(k,{void:()=>Lz,util:()=>h8,unknown:()=>dz,union:()=>cz,undefined:()=>Iz,tuple:()=>oz,transformer:()=>g5,symbol:()=>mz,string:()=>U5,strictObject:()=>nz,setErrorMap:()=>jz,set:()=>tz,record:()=>az,quotelessJson:()=>_z,promise:()=>qv,preprocess:()=>jv,pipeline:()=>Pv,ostring:()=>Yv,optional:()=>_v,onumber:()=>fv,oboolean:()=>$v,objectUtil:()=>W4,object:()=>xz,number:()=>s5,nullable:()=>Kv,null:()=>gz,never:()=>pz,nativeEnum:()=>Qz,nan:()=>Sz,map:()=>Bz,makeIssue:()=>L3,literal:()=>Uz,lazy:()=>Fz,late:()=>Nz,isValid:()=>$_,isDirty:()=>J4,isAsync:()=>IK,isAborted:()=>H4,intersection:()=>iz,instanceof:()=>bz,getParsedType:()=>mq,getErrorMap:()=>p3,function:()=>ez,enum:()=>sz,effect:()=>g5,discriminatedUnion:()=>rz,defaultErrorMap:()=>n_,datetimeRegex:()=>t5,date:()=>Rz,custom:()=>F5,coerce:()=>wv,boolean:()=>Q5,bigint:()=>Ez,array:()=>lz,any:()=>yz,addIssueToContext:()=>F,ZodVoid:()=>yK,ZodUnknown:()=>aq,ZodUnion:()=>o_,ZodUndefined:()=>r_,ZodType:()=>k8,ZodTuple:()=>Aq,ZodTransformer:()=>B6,ZodSymbol:()=>gK,ZodString:()=>Yq,ZodSet:()=>z_,ZodSchema:()=>k8,ZodRecord:()=>dK,ZodReadonly:()=>s_,ZodPromise:()=>v_,ZodPipeline:()=>lK,ZodParsedType:()=>s,ZodOptional:()=>$q,ZodObject:()=>i8,ZodNumber:()=>Bq,ZodNullable:()=>Iq,ZodNull:()=>i_,ZodNever:()=>Xq,ZodNativeEnum:()=>e_,ZodNaN:()=>LK,ZodMap:()=>pK,ZodLiteral:()=>t_,ZodLazy:()=>B_,ZodIssueCode:()=>t,ZodIntersection:()=>a_,ZodFunction:()=>x_,ZodFirstPartyTypeKind:()=>W8,ZodError:()=>y6,ZodEnum:()=>eq,ZodEffects:()=>B6,ZodDiscriminatedUnion:()=>l3,ZodDefault:()=>F_,ZodDate:()=>w_,ZodCatch:()=>U_,ZodBranded:()=>x3,ZodBoolean:()=>c_,ZodBigInt:()=>tq,ZodArray:()=>fq,ZodAny:()=>O_,Schema:()=>k8,ParseStatus:()=>k6,OK:()=>D6,NEVER:()=>Ov,INVALID:()=>v8,EMPTY_PATH:()=>Pz,DIRTY:()=>l_,BRAND:()=>Mz});(function(q){q.assertEqual=(Y)=>{};function _(Y){}q.assertIs=_;function j(Y){throw new Error}q.assertNever=j,q.arrayToEnum=(Y)=>{let f={};for(let P of Y)f[P]=P;return f},q.getValidEnumValues=(Y)=>{let f=q.objectKeys(Y).filter(($)=>typeof Y[Y[$]]!=="number"),P={};for(let $ of f)P[$]=Y[$];return q.objectValues(P)},q.objectValues=(Y)=>{return q.objectKeys(Y).map(function(f){return Y[f]})},q.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let f=[];for(let P in Y)if(Object.prototype.hasOwnProperty.call(Y,P))f.push(P);return f},q.find=(Y,f)=>{for(let P of Y)if(f(P))return P;return},q.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function K(Y,f=" | "){return Y.map((P)=>typeof P==="string"?`'${P}'`:P).join(f)}q.joinValues=K,q.jsonStringifyReplacer=(Y,f)=>{if(typeof f==="bigint")return f.toString();return f}})(h8||(h8={}));(function(q){q.mergeShapes=(_,j)=>{return{..._,...j}}})(W4||(W4={}));s=h8.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t=h8.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"]);y6=class y6 extends Error{get errors(){return this.issues}constructor(q){super();this.issues=[],this.addIssue=(j)=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=q}format(q){let _=q||function(Y){return Y.message},j={_errors:[]},K=(Y)=>{for(let f of Y.issues)if(f.code==="invalid_union")f.unionErrors.map(K);else if(f.code==="invalid_return_type")K(f.returnTypeError);else if(f.code==="invalid_arguments")K(f.argumentsError);else if(f.path.length===0)j._errors.push(_(f));else{let P=j,$=0;while($<f.path.length){let w=f.path[$];if($!==f.path.length-1)P[w]=P[w]||{_errors:[]};else P[w]=P[w]||{_errors:[]},P[w]._errors.push(_(f));P=P[w],$++}}};return K(this),j}static assert(q){if(!(q instanceof y6))throw new Error(`Not a ZodError: ${q}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,h8.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(q=(_)=>_.message){let _={},j=[];for(let K of this.issues)if(K.path.length>0){let Y=K.path[0];_[Y]=_[Y]||[],_[Y].push(q(K))}else j.push(q(K));return{formErrors:j,fieldErrors:_}}get formErrors(){return this.flatten()}};y6.create=(q)=>{return new y6(q)};n_=Kz,o5=n_;Pz=[];v8=Object.freeze({status:"aborted"});(function(q){q.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},q.toString=(_)=>typeof _==="string"?_:_?.message})(f8||(f8={}));Yz=/^c[^\s-]{8,}$/i,fz=/^[0-9a-z]+$/,$z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wz=/^[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,Oz=/^[a-z0-9_-]{21}$/i,zz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vz=/^[-+]?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)?)??$/,Wz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jz=/^(?:(?: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])$/,Tz=/^(?:(?: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])$/,Zz=/^(([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]))$/,kz=/^(([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])$/,Xz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Az=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gz=new RegExp(`^${a5}$`);Yq=class Yq extends k8{_parse(q){if(this._def.coerce)q.data=String(q.data);if(this._getType(q)!==s.string){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:s.string,received:Y.parsedType}),v8}let j=new k6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.length<Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="max"){if(q.data.length>Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="length"){let f=q.data.length>Y.value,P=q.data.length<Y.value;if(f||P){if(K=this._getOrReturnCtx(q,K),f)F(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(P)F(K,{code:t.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});j.dirty()}}else if(Y.kind==="email"){if(!Wz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"email",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="emoji"){if(!z4)z4=new RegExp(Hz,"u");if(!z4.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"emoji",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="uuid"){if(!wz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"uuid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="nanoid"){if(!Oz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"nanoid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cuid"){if(!Yz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"cuid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cuid2"){if(!fz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"cuid2",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="ulid"){if(!$z.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"ulid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="url")try{new URL(q.data)}catch{K=this._getOrReturnCtx(q,K),F(K,{validation:"url",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"regex",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="trim")q.data=q.data.trim();else if(Y.kind==="includes"){if(!q.data.includes(Y.value,Y.position))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),j.dirty()}else if(Y.kind==="toLowerCase")q.data=q.data.toLowerCase();else if(Y.kind==="toUpperCase")q.data=q.data.toUpperCase();else if(Y.kind==="startsWith"){if(!q.data.startsWith(Y.value))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:{startsWith:Y.value},message:Y.message}),j.dirty()}else if(Y.kind==="endsWith"){if(!q.data.endsWith(Y.value))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:{endsWith:Y.value},message:Y.message}),j.dirty()}else if(Y.kind==="datetime"){if(!t5(Y).test(q.data))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:"datetime",message:Y.message}),j.dirty()}else if(Y.kind==="date"){if(!Gz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:"date",message:Y.message}),j.dirty()}else if(Y.kind==="time"){if(!uz(Y).test(q.data))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:"time",message:Y.message}),j.dirty()}else if(Y.kind==="duration"){if(!vz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"duration",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="ip"){if(!hz(q.data,Y.version))K=this._getOrReturnCtx(q,K),F(K,{validation:"ip",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="jwt"){if(!Dz(q.data,Y.alg))K=this._getOrReturnCtx(q,K),F(K,{validation:"jwt",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cidr"){if(!Cz(q.data,Y.version))K=this._getOrReturnCtx(q,K),F(K,{validation:"cidr",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="base64"){if(!Xz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"base64",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="base64url"){if(!Az.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"base64url",code:t.invalid_string,message:Y.message}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:q.data}}_regex(q,_,j){return this.refinement((K)=>q.test(K),{validation:_,code:t.invalid_string,...f8.errToObj(j)})}_addCheck(q){return new Yq({...this._def,checks:[...this._def.checks,q]})}email(q){return this._addCheck({kind:"email",...f8.errToObj(q)})}url(q){return this._addCheck({kind:"url",...f8.errToObj(q)})}emoji(q){return this._addCheck({kind:"emoji",...f8.errToObj(q)})}uuid(q){return this._addCheck({kind:"uuid",...f8.errToObj(q)})}nanoid(q){return this._addCheck({kind:"nanoid",...f8.errToObj(q)})}cuid(q){return this._addCheck({kind:"cuid",...f8.errToObj(q)})}cuid2(q){return this._addCheck({kind:"cuid2",...f8.errToObj(q)})}ulid(q){return this._addCheck({kind:"ulid",...f8.errToObj(q)})}base64(q){return this._addCheck({kind:"base64",...f8.errToObj(q)})}base64url(q){return this._addCheck({kind:"base64url",...f8.errToObj(q)})}jwt(q){return this._addCheck({kind:"jwt",...f8.errToObj(q)})}ip(q){return this._addCheck({kind:"ip",...f8.errToObj(q)})}cidr(q){return this._addCheck({kind:"cidr",...f8.errToObj(q)})}datetime(q){if(typeof q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:q});return this._addCheck({kind:"datetime",precision:typeof q?.precision==="undefined"?null:q?.precision,offset:q?.offset??!1,local:q?.local??!1,...f8.errToObj(q?.message)})}date(q){return this._addCheck({kind:"date",message:q})}time(q){if(typeof q==="string")return this._addCheck({kind:"time",precision:null,message:q});return this._addCheck({kind:"time",precision:typeof q?.precision==="undefined"?null:q?.precision,...f8.errToObj(q?.message)})}duration(q){return this._addCheck({kind:"duration",...f8.errToObj(q)})}regex(q,_){return this._addCheck({kind:"regex",regex:q,...f8.errToObj(_)})}includes(q,_){return this._addCheck({kind:"includes",value:q,position:_?.position,...f8.errToObj(_?.message)})}startsWith(q,_){return this._addCheck({kind:"startsWith",value:q,...f8.errToObj(_)})}endsWith(q,_){return this._addCheck({kind:"endsWith",value:q,...f8.errToObj(_)})}min(q,_){return this._addCheck({kind:"min",value:q,...f8.errToObj(_)})}max(q,_){return this._addCheck({kind:"max",value:q,...f8.errToObj(_)})}length(q,_){return this._addCheck({kind:"length",value:q,...f8.errToObj(_)})}nonempty(q){return this.min(1,f8.errToObj(q))}trim(){return new Yq({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Yq({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Yq({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((q)=>q.kind==="datetime")}get isDate(){return!!this._def.checks.find((q)=>q.kind==="date")}get isTime(){return!!this._def.checks.find((q)=>q.kind==="time")}get isDuration(){return!!this._def.checks.find((q)=>q.kind==="duration")}get isEmail(){return!!this._def.checks.find((q)=>q.kind==="email")}get isURL(){return!!this._def.checks.find((q)=>q.kind==="url")}get isEmoji(){return!!this._def.checks.find((q)=>q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((q)=>q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((q)=>q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((q)=>q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((q)=>q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((q)=>q.kind==="ulid")}get isIP(){return!!this._def.checks.find((q)=>q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((q)=>q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((q)=>q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((q)=>q.kind==="base64url")}get minLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}};Yq.create=(q)=>{return new Yq({checks:[],typeName:W8.ZodString,coerce:q?.coerce??!1,...Z8(q)})};Bq=class Bq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(q){if(this._def.coerce)q.data=Number(q.data);if(this._getType(q)!==s.number){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:s.number,received:Y.parsedType}),v8}let j=void 0,K=new k6;for(let Y of this._def.checks)if(Y.kind==="int"){if(!h8.isInteger(q.data))j=this._getOrReturnCtx(q,j),F(j,{code:t.invalid_type,expected:"integer",received:"float",message:Y.message}),K.dirty()}else if(Y.kind==="min"){if(Y.inclusive?q.data<Y.value:q.data<=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="max"){if(Y.inclusive?q.data>Y.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(Vz(q.data,Y.value)!==0)j=this._getOrReturnCtx(q,j),F(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(q.data))j=this._getOrReturnCtx(q,j),F(j,{code:t.not_finite,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}gte(q,_){return this.setLimit("min",q,!0,f8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,f8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,f8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,f8.toString(_))}setLimit(q,_,j,K){return new Bq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:f8.toString(K)}]})}_addCheck(q){return new Bq({...this._def,checks:[...this._def.checks,q]})}int(q){return this._addCheck({kind:"int",message:f8.toString(q)})}positive(q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:f8.toString(_)})}finite(q){return this._addCheck({kind:"finite",message:f8.toString(q)})}safe(q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f8.toString(q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f8.toString(q)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}get isInt(){return!!this._def.checks.find((q)=>q.kind==="int"||q.kind==="multipleOf"&&h8.isInteger(q.value))}get isFinite(){let q=null,_=null;for(let j of this._def.checks)if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;else if(j.kind==="min"){if(_===null||j.value>_)_=j.value}else if(j.kind==="max"){if(q===null||j.value<q)q=j.value}return Number.isFinite(_)&&Number.isFinite(q)}};Bq.create=(q)=>{return new Bq({checks:[],typeName:W8.ZodNumber,coerce:q?.coerce||!1,...Z8(q)})};tq=class tq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(q){if(this._def.coerce)try{q.data=BigInt(q.data)}catch{return this._getInvalidInput(q)}if(this._getType(q)!==s.bigint)return this._getInvalidInput(q);let j=void 0,K=new k6;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?q.data<Y.value:q.data<=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="max"){if(Y.inclusive?q.data>Y.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(q.data%Y.value!==BigInt(0))j=this._getOrReturnCtx(q,j),F(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}_getInvalidInput(q){let _=this._getOrReturnCtx(q);return F(_,{code:t.invalid_type,expected:s.bigint,received:_.parsedType}),v8}gte(q,_){return this.setLimit("min",q,!0,f8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,f8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,f8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,f8.toString(_))}setLimit(q,_,j,K){return new tq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:f8.toString(K)}]})}_addCheck(q){return new tq({...this._def,checks:[...this._def.checks,q]})}positive(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:f8.toString(_)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}};tq.create=(q)=>{return new tq({checks:[],typeName:W8.ZodBigInt,coerce:q?.coerce??!1,...Z8(q)})};c_=class c_ extends k8{_parse(q){if(this._def.coerce)q.data=Boolean(q.data);if(this._getType(q)!==s.boolean){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.boolean,received:j.parsedType}),v8}return D6(q.data)}};c_.create=(q)=>{return new c_({typeName:W8.ZodBoolean,coerce:q?.coerce||!1,...Z8(q)})};w_=class w_ extends k8{_parse(q){if(this._def.coerce)q.data=new Date(q.data);if(this._getType(q)!==s.date){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:s.date,received:Y.parsedType}),v8}if(Number.isNaN(q.data.getTime())){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_date}),v8}let j=new k6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.getTime()<Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),j.dirty()}else if(Y.kind==="max"){if(q.data.getTime()>Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:new Date(q.data.getTime())}}_addCheck(q){return new w_({...this._def,checks:[...this._def.checks,q]})}min(q,_){return this._addCheck({kind:"min",value:q.getTime(),message:f8.toString(_)})}max(q,_){return this._addCheck({kind:"max",value:q.getTime(),message:f8.toString(_)})}get minDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q!=null?new Date(q):null}get maxDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q!=null?new Date(q):null}};w_.create=(q)=>{return new w_({checks:[],coerce:q?.coerce||!1,typeName:W8.ZodDate,...Z8(q)})};gK=class gK extends k8{_parse(q){if(this._getType(q)!==s.symbol){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.symbol,received:j.parsedType}),v8}return D6(q.data)}};gK.create=(q)=>{return new gK({typeName:W8.ZodSymbol,...Z8(q)})};r_=class r_ extends k8{_parse(q){if(this._getType(q)!==s.undefined){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.undefined,received:j.parsedType}),v8}return D6(q.data)}};r_.create=(q)=>{return new r_({typeName:W8.ZodUndefined,...Z8(q)})};i_=class i_ extends k8{_parse(q){if(this._getType(q)!==s.null){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.null,received:j.parsedType}),v8}return D6(q.data)}};i_.create=(q)=>{return new i_({typeName:W8.ZodNull,...Z8(q)})};O_=class O_ extends k8{constructor(){super(...arguments);this._any=!0}_parse(q){return D6(q.data)}};O_.create=(q)=>{return new O_({typeName:W8.ZodAny,...Z8(q)})};aq=class aq extends k8{constructor(){super(...arguments);this._unknown=!0}_parse(q){return D6(q.data)}};aq.create=(q)=>{return new aq({typeName:W8.ZodUnknown,...Z8(q)})};Xq=class Xq extends k8{_parse(q){let _=this._getOrReturnCtx(q);return F(_,{code:t.invalid_type,expected:s.never,received:_.parsedType}),v8}};Xq.create=(q)=>{return new Xq({typeName:W8.ZodNever,...Z8(q)})};yK=class yK extends k8{_parse(q){if(this._getType(q)!==s.undefined){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.void,received:j.parsedType}),v8}return D6(q.data)}};yK.create=(q)=>{return new yK({typeName:W8.ZodVoid,...Z8(q)})};fq=class fq extends k8{_parse(q){let{ctx:_,status:j}=this._processInputParams(q),K=this._def;if(_.parsedType!==s.array)return F(_,{code:t.invalid_type,expected:s.array,received:_.parsedType}),v8;if(K.exactLength!==null){let f=_.data.length>K.exactLength.value,P=_.data.length<K.exactLength.value;if(f||P)F(_,{code:f?t.too_big:t.too_small,minimum:P?K.exactLength.value:void 0,maximum:f?K.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:K.exactLength.message}),j.dirty()}if(K.minLength!==null){if(_.data.length<K.minLength.value)F(_,{code:t.too_small,minimum:K.minLength.value,type:"array",inclusive:!0,exact:!1,message:K.minLength.message}),j.dirty()}if(K.maxLength!==null){if(_.data.length>K.maxLength.value)F(_,{code:t.too_big,maximum:K.maxLength.value,type:"array",inclusive:!0,exact:!1,message:K.maxLength.message}),j.dirty()}if(_.common.async)return Promise.all([..._.data].map((f,P)=>{return K.type._parseAsync(new wq(_,f,_.path,P))})).then((f)=>{return k6.mergeArray(j,f)});let Y=[..._.data].map((f,P)=>{return K.type._parseSync(new wq(_,f,_.path,P))});return k6.mergeArray(j,Y)}get element(){return this._def.type}min(q,_){return new fq({...this._def,minLength:{value:q,message:f8.toString(_)}})}max(q,_){return new fq({...this._def,maxLength:{value:q,message:f8.toString(_)}})}length(q,_){return new fq({...this._def,exactLength:{value:q,message:f8.toString(_)}})}nonempty(q){return this.min(1,q)}};fq.create=(q,_)=>{return new fq({type:q,minLength:null,maxLength:null,exactLength:null,typeName:W8.ZodArray,...Z8(_)})};i8=class i8 extends k8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let q=this._def.shape(),_=h8.objectKeys(q);return this._cached={shape:q,keys:_},this._cached}_parse(q){if(this._getType(q)!==s.object){let w=this._getOrReturnCtx(q);return F(w,{code:t.invalid_type,expected:s.object,received:w.parsedType}),v8}let{status:j,ctx:K}=this._processInputParams(q),{shape:Y,keys:f}=this._getCached(),P=[];if(!(this._def.catchall instanceof Xq&&this._def.unknownKeys==="strip")){for(let w in K.data)if(!f.includes(w))P.push(w)}let $=[];for(let w of f){let O=Y[w],v=K.data[w];$.push({key:{status:"valid",value:w},value:O._parse(new wq(K,v,K.path,w)),alwaysSet:w in K.data})}if(this._def.catchall instanceof Xq){let w=this._def.unknownKeys;if(w==="passthrough")for(let O of P)$.push({key:{status:"valid",value:O},value:{status:"valid",value:K.data[O]}});else if(w==="strict"){if(P.length>0)F(K,{code:t.unrecognized_keys,keys:P}),j.dirty()}else if(w==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let O of P){let v=K.data[O];$.push({key:{status:"valid",value:O},value:w._parse(new wq(K,v,K.path,O)),alwaysSet:O in K.data})}}if(K.common.async)return Promise.resolve().then(async()=>{let w=[];for(let O of $){let v=await O.key,z=await O.value;w.push({key:v,value:z,alwaysSet:O.alwaysSet})}return w}).then((w)=>{return k6.mergeObjectSync(j,w)});else return k6.mergeObjectSync(j,$)}get shape(){return this._def.shape()}strict(q){return f8.errToObj,new i8({...this._def,unknownKeys:"strict",...q!==void 0?{errorMap:(_,j)=>{let K=this._def.errorMap?.(_,j).message??j.defaultError;if(_.code==="unrecognized_keys")return{message:f8.errToObj(q).message??K};return{message:K}}}:{}})}strip(){return new i8({...this._def,unknownKeys:"strip"})}passthrough(){return new i8({...this._def,unknownKeys:"passthrough"})}extend(q){return new i8({...this._def,shape:()=>({...this._def.shape(),...q})})}merge(q){return new i8({unknownKeys:q._def.unknownKeys,catchall:q._def.catchall,shape:()=>({...this._def.shape(),...q._def.shape()}),typeName:W8.ZodObject})}setKey(q,_){return this.augment({[q]:_})}catchall(q){return new i8({...this._def,catchall:q})}pick(q){let _={};for(let j of h8.objectKeys(q))if(q[j]&&this.shape[j])_[j]=this.shape[j];return new i8({...this._def,shape:()=>_})}omit(q){let _={};for(let j of h8.objectKeys(this.shape))if(!q[j])_[j]=this.shape[j];return new i8({...this._def,shape:()=>_})}deepPartial(){return p_(this)}partial(q){let _={};for(let j of h8.objectKeys(this.shape)){let K=this.shape[j];if(q&&!q[j])_[j]=K;else _[j]=K.optional()}return new i8({...this._def,shape:()=>_})}required(q){let _={};for(let j of h8.objectKeys(this.shape))if(q&&!q[j])_[j]=this.shape[j];else{let Y=this.shape[j];while(Y instanceof $q)Y=Y._def.innerType;_[j]=Y}return new i8({...this._def,shape:()=>_})}keyof(){return e5(h8.objectKeys(this.shape))}};i8.create=(q,_)=>{return new i8({shape:()=>q,unknownKeys:"strip",catchall:Xq.create(),typeName:W8.ZodObject,...Z8(_)})};i8.strictCreate=(q,_)=>{return new i8({shape:()=>q,unknownKeys:"strict",catchall:Xq.create(),typeName:W8.ZodObject,...Z8(_)})};i8.lazycreate=(q,_)=>{return new i8({shape:q,unknownKeys:"strip",catchall:Xq.create(),typeName:W8.ZodObject,...Z8(_)})};o_=class o_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=this._def.options;function K(Y){for(let P of Y)if(P.result.status==="valid")return P.result;for(let P of Y)if(P.result.status==="dirty")return _.common.issues.push(...P.ctx.common.issues),P.result;let f=Y.map((P)=>new y6(P.ctx.common.issues));return F(_,{code:t.invalid_union,unionErrors:f}),v8}if(_.common.async)return Promise.all(j.map(async(Y)=>{let f={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:f}),ctx:f}})).then(K);else{let Y=void 0,f=[];for(let $ of j){let w={..._,common:{..._.common,issues:[]},parent:null},O=$._parseSync({data:_.data,path:_.path,parent:w});if(O.status==="valid")return O;else if(O.status==="dirty"&&!Y)Y={result:O,ctx:w};if(w.common.issues.length)f.push(w.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let P=f.map(($)=>new y6($));return F(_,{code:t.invalid_union,unionErrors:P}),v8}}get options(){return this._def.options}};o_.create=(q,_)=>{return new o_({options:q,typeName:W8.ZodUnion,...Z8(_)})};l3=class l3 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==s.object)return F(_,{code:t.invalid_type,expected:s.object,received:_.parsedType}),v8;let j=this.discriminator,K=_.data[j],Y=this.optionsMap.get(K);if(!Y)return F(_,{code:t.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),v8;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(q,_,j){let K=new Map;for(let Y of _){let f=Rq(Y.shape[q]);if(!f.length)throw new Error(`A discriminator value for key \`${q}\` could not be extracted from all schema options`);for(let P of f){if(K.has(P))throw new Error(`Discriminator property ${String(q)} has duplicate value ${String(P)}`);K.set(P,Y)}}return new l3({typeName:W8.ZodDiscriminatedUnion,discriminator:q,options:_,optionsMap:K,...Z8(j)})}};a_=class a_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=(Y,f)=>{if(H4(Y)||H4(f))return v8;let P=T4(Y.value,f.value);if(!P.valid)return F(j,{code:t.invalid_intersection_types}),v8;if(J4(Y)||J4(f))_.dirty();return{status:_.value,value:P.data}};if(j.common.async)return Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([Y,f])=>K(Y,f));else return K(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}};a_.create=(q,_,j)=>{return new a_({left:q,right:_,typeName:W8.ZodIntersection,...Z8(j)})};Aq=class Aq extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.array)return F(j,{code:t.invalid_type,expected:s.array,received:j.parsedType}),v8;if(j.data.length<this._def.items.length)return F(j,{code:t.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v8;if(!this._def.rest&&j.data.length>this._def.items.length)F(j,{code:t.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...j.data].map((f,P)=>{let $=this._def.items[P]||this._def.rest;if(!$)return null;return $._parse(new wq(j,f,j.path,P))}).filter((f)=>!!f);if(j.common.async)return Promise.all(Y).then((f)=>{return k6.mergeArray(_,f)});else return k6.mergeArray(_,Y)}get items(){return this._def.items}rest(q){return new Aq({...this._def,rest:q})}};Aq.create=(q,_)=>{if(!Array.isArray(q))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Aq({items:q,typeName:W8.ZodTuple,rest:null,...Z8(_)})};dK=class dK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.object)return F(j,{code:t.invalid_type,expected:s.object,received:j.parsedType}),v8;let K=[],Y=this._def.keyType,f=this._def.valueType;for(let P in j.data)K.push({key:Y._parse(new wq(j,P,j.path,P)),value:f._parse(new wq(j,j.data[P],j.path,P)),alwaysSet:P in j.data});if(j.common.async)return k6.mergeObjectAsync(_,K);else return k6.mergeObjectSync(_,K)}get element(){return this._def.valueType}static create(q,_,j){if(_ instanceof k8)return new dK({keyType:q,valueType:_,typeName:W8.ZodRecord,...Z8(j)});return new dK({keyType:Yq.create(),valueType:q,typeName:W8.ZodRecord,...Z8(_)})}};pK=class pK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.map)return F(j,{code:t.invalid_type,expected:s.map,received:j.parsedType}),v8;let K=this._def.keyType,Y=this._def.valueType,f=[...j.data.entries()].map(([P,$],w)=>{return{key:K._parse(new wq(j,P,j.path,[w,"key"])),value:Y._parse(new wq(j,$,j.path,[w,"value"]))}});if(j.common.async){let P=new Map;return Promise.resolve().then(async()=>{for(let $ of f){let w=await $.key,O=await $.value;if(w.status==="aborted"||O.status==="aborted")return v8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}})}else{let P=new Map;for(let $ of f){let{key:w,value:O}=$;if(w.status==="aborted"||O.status==="aborted")return v8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}}}};pK.create=(q,_,j)=>{return new pK({valueType:_,keyType:q,typeName:W8.ZodMap,...Z8(j)})};z_=class z_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.set)return F(j,{code:t.invalid_type,expected:s.set,received:j.parsedType}),v8;let K=this._def;if(K.minSize!==null){if(j.data.size<K.minSize.value)F(j,{code:t.too_small,minimum:K.minSize.value,type:"set",inclusive:!0,exact:!1,message:K.minSize.message}),_.dirty()}if(K.maxSize!==null){if(j.data.size>K.maxSize.value)F(j,{code:t.too_big,maximum:K.maxSize.value,type:"set",inclusive:!0,exact:!1,message:K.maxSize.message}),_.dirty()}let Y=this._def.valueType;function f($){let w=new Set;for(let O of $){if(O.status==="aborted")return v8;if(O.status==="dirty")_.dirty();w.add(O.value)}return{status:_.value,value:w}}let P=[...j.data.values()].map(($,w)=>Y._parse(new wq(j,$,j.path,w)));if(j.common.async)return Promise.all(P).then(($)=>f($));else return f(P)}min(q,_){return new z_({...this._def,minSize:{value:q,message:f8.toString(_)}})}max(q,_){return new z_({...this._def,maxSize:{value:q,message:f8.toString(_)}})}size(q,_){return this.min(q,_).max(q,_)}nonempty(q){return this.min(1,q)}};z_.create=(q,_)=>{return new z_({valueType:q,minSize:null,maxSize:null,typeName:W8.ZodSet,...Z8(_)})};x_=class x_ extends k8{constructor(){super(...arguments);this.validate=this.implement}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==s.function)return F(_,{code:t.invalid_type,expected:s.function,received:_.parsedType}),v8;function j(P,$){return L3({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,p3(),n_].filter((w)=>!!w),issueData:{code:t.invalid_arguments,argumentsError:$}})}function K(P,$){return L3({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,p3(),n_].filter((w)=>!!w),issueData:{code:t.invalid_return_type,returnTypeError:$}})}let Y={errorMap:_.common.contextualErrorMap},f=_.data;if(this._def.returns instanceof v_){let P=this;return D6(async function(...$){let w=new y6([]),O=await P._def.args.parseAsync($,Y).catch((W)=>{throw w.addIssue(j($,W)),w}),v=await Reflect.apply(f,this,O);return await P._def.returns._def.type.parseAsync(v,Y).catch((W)=>{throw w.addIssue(K(v,W)),w})})}else{let P=this;return D6(function(...$){let w=P._def.args.safeParse($,Y);if(!w.success)throw new y6([j($,w.error)]);let O=Reflect.apply(f,this,w.data),v=P._def.returns.safeParse(O,Y);if(!v.success)throw new y6([K(O,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...q){return new x_({...this._def,args:Aq.create(q).rest(aq.create())})}returns(q){return new x_({...this._def,returns:q})}implement(q){return this.parse(q)}strictImplement(q){return this.parse(q)}static create(q,_,j){return new x_({args:q?q:Aq.create([]).rest(aq.create()),returns:_||aq.create(),typeName:W8.ZodFunction,...Z8(j)})}};B_=class B_ extends k8{get schema(){return this._def.getter()}_parse(q){let{ctx:_}=this._processInputParams(q);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}};B_.create=(q,_)=>{return new B_({getter:q,typeName:W8.ZodLazy,...Z8(_)})};t_=class t_ extends k8{_parse(q){if(q.data!==this._def.value){let _=this._getOrReturnCtx(q);return F(_,{received:_.data,code:t.invalid_literal,expected:this._def.value}),v8}return{status:"valid",value:q.data}}get value(){return this._def.value}};t_.create=(q,_)=>{return new t_({value:q,typeName:W8.ZodLiteral,...Z8(_)})};eq=class eq extends k8{_parse(q){if(typeof q.data!=="string"){let _=this._getOrReturnCtx(q),j=this._def.values;return F(_,{expected:h8.joinValues(j),received:_.parsedType,code:t.invalid_type}),v8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(q.data)){let _=this._getOrReturnCtx(q),j=this._def.values;return F(_,{received:_.data,code:t.invalid_enum_value,options:j}),v8}return D6(q.data)}get options(){return this._def.values}get enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Values(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}extract(q,_=this._def){return eq.create(q,{...this._def,..._})}exclude(q,_=this._def){return eq.create(this.options.filter((j)=>!q.includes(j)),{...this._def,..._})}};eq.create=e5;e_=class e_ extends k8{_parse(q){let _=h8.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(q);if(j.parsedType!==s.string&&j.parsedType!==s.number){let K=h8.objectValues(_);return F(j,{expected:h8.joinValues(K),received:j.parsedType,code:t.invalid_type}),v8}if(!this._cache)this._cache=new Set(h8.getValidEnumValues(this._def.values));if(!this._cache.has(q.data)){let K=h8.objectValues(_);return F(j,{received:j.data,code:t.invalid_enum_value,options:K}),v8}return D6(q.data)}get enum(){return this._def.values}};e_.create=(q,_)=>{return new e_({values:q,typeName:W8.ZodNativeEnum,...Z8(_)})};v_=class v_ extends k8{unwrap(){return this._def.type}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==s.promise&&_.common.async===!1)return F(_,{code:t.invalid_type,expected:s.promise,received:_.parsedType}),v8;let j=_.parsedType===s.promise?_.data:Promise.resolve(_.data);return D6(j.then((K)=>{return this._def.type.parseAsync(K,{path:_.path,errorMap:_.common.contextualErrorMap})}))}};v_.create=(q,_)=>{return new v_({type:q,typeName:W8.ZodPromise,...Z8(_)})};B6=class B6 extends k8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===W8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=this._def.effect||null,Y={addIssue:(f)=>{if(F(j,f),f.fatal)_.abort();else _.dirty()},get path(){return j.path}};if(Y.addIssue=Y.addIssue.bind(Y),K.type==="preprocess"){let f=K.transform(j.data,Y);if(j.common.async)return Promise.resolve(f).then(async(P)=>{if(_.value==="aborted")return v8;let $=await this._def.schema._parseAsync({data:P,path:j.path,parent:j});if($.status==="aborted")return v8;if($.status==="dirty")return l_($.value);if(_.value==="dirty")return l_($.value);return $});else{if(_.value==="aborted")return v8;let P=this._def.schema._parseSync({data:f,path:j.path,parent:j});if(P.status==="aborted")return v8;if(P.status==="dirty")return l_(P.value);if(_.value==="dirty")return l_(P.value);return P}}if(K.type==="refinement"){let f=(P)=>{let $=K.refinement(P,Y);if(j.common.async)return Promise.resolve($);if($ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return P};if(j.common.async===!1){let P=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(P.status==="aborted")return v8;if(P.status==="dirty")_.dirty();return f(P.value),{status:_.value,value:P.value}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((P)=>{if(P.status==="aborted")return v8;if(P.status==="dirty")_.dirty();return f(P.value).then(()=>{return{status:_.value,value:P.value}})})}if(K.type==="transform")if(j.common.async===!1){let f=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!$_(f))return v8;let P=K.transform(f.value,Y);if(P instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:P}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((f)=>{if(!$_(f))return v8;return Promise.resolve(K.transform(f.value,Y)).then((P)=>({status:_.value,value:P}))});h8.assertNever(K)}};B6.create=(q,_,j)=>{return new B6({schema:q,typeName:W8.ZodEffects,effect:_,...Z8(j)})};B6.createWithPreprocess=(q,_,j)=>{return new B6({schema:_,effect:{type:"preprocess",transform:q},typeName:W8.ZodEffects,...Z8(j)})};$q=class $q extends k8{_parse(q){if(this._getType(q)===s.undefined)return D6(void 0);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};$q.create=(q,_)=>{return new $q({innerType:q,typeName:W8.ZodOptional,...Z8(_)})};Iq=class Iq extends k8{_parse(q){if(this._getType(q)===s.null)return D6(null);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};Iq.create=(q,_)=>{return new Iq({innerType:q,typeName:W8.ZodNullable,...Z8(_)})};F_=class F_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;if(_.parsedType===s.undefined)j=this._def.defaultValue();return this._def.innerType._parse({data:j,path:_.path,parent:_})}removeDefault(){return this._def.innerType}};F_.create=(q,_)=>{return new F_({innerType:q,typeName:W8.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...Z8(_)})};U_=class U_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j={..._,common:{..._.common,issues:[]}},K=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});if(IK(K))return K.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new y6(j.common.issues)},input:j.data})}});else return{status:"valid",value:K.status==="valid"?K.value:this._def.catchValue({get error(){return new y6(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}};U_.create=(q,_)=>{return new U_({innerType:q,typeName:W8.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...Z8(_)})};LK=class LK extends k8{_parse(q){if(this._getType(q)!==s.nan){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.nan,received:j.parsedType}),v8}return{status:"valid",value:q.data}}};LK.create=(q)=>{return new LK({typeName:W8.ZodNaN,...Z8(q)})};Mz=Symbol("zod_brand");x3=class x3 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};lK=class lK extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});if(Y.status==="aborted")return v8;if(Y.status==="dirty")return _.dirty(),l_(Y.value);else return this._def.out._parseAsync({data:Y.value,path:j.path,parent:j})})();else{let K=this._def.in._parseSync({data:j.data,path:j.path,parent:j});if(K.status==="aborted")return v8;if(K.status==="dirty")return _.dirty(),{status:"dirty",value:K.value};else return this._def.out._parseSync({data:K.value,path:j.path,parent:j})}}static create(q,_){return new lK({in:q,out:_,typeName:W8.ZodPipeline})}};s_=class s_ extends k8{_parse(q){let _=this._def.innerType._parse(q),j=(K)=>{if($_(K))K.value=Object.freeze(K.value);return K};return IK(_)?_.then((K)=>j(K)):j(_)}unwrap(){return this._def.innerType}};s_.create=(q,_)=>{return new s_({innerType:q,typeName:W8.ZodReadonly,...Z8(_)})};Nz={object:i8.lazycreate};(function(q){q.ZodString="ZodString",q.ZodNumber="ZodNumber",q.ZodNaN="ZodNaN",q.ZodBigInt="ZodBigInt",q.ZodBoolean="ZodBoolean",q.ZodDate="ZodDate",q.ZodSymbol="ZodSymbol",q.ZodUndefined="ZodUndefined",q.ZodNull="ZodNull",q.ZodAny="ZodAny",q.ZodUnknown="ZodUnknown",q.ZodNever="ZodNever",q.ZodVoid="ZodVoid",q.ZodArray="ZodArray",q.ZodObject="ZodObject",q.ZodUnion="ZodUnion",q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",q.ZodIntersection="ZodIntersection",q.ZodTuple="ZodTuple",q.ZodRecord="ZodRecord",q.ZodMap="ZodMap",q.ZodSet="ZodSet",q.ZodFunction="ZodFunction",q.ZodLazy="ZodLazy",q.ZodLiteral="ZodLiteral",q.ZodEnum="ZodEnum",q.ZodEffects="ZodEffects",q.ZodNativeEnum="ZodNativeEnum",q.ZodOptional="ZodOptional",q.ZodNullable="ZodNullable",q.ZodDefault="ZodDefault",q.ZodCatch="ZodCatch",q.ZodPromise="ZodPromise",q.ZodBranded="ZodBranded",q.ZodPipeline="ZodPipeline",q.ZodReadonly="ZodReadonly"})(W8||(W8={}));U5=Yq.create,s5=Bq.create,Sz=LK.create,Ez=tq.create,Q5=c_.create,Rz=w_.create,mz=gK.create,Iz=r_.create,gz=i_.create,yz=O_.create,dz=aq.create,pz=Xq.create,Lz=yK.create,lz=fq.create,xz=i8.create,nz=i8.strictCreate,cz=o_.create,rz=l3.create,iz=a_.create,oz=Aq.create,az=dK.create,Bz=pK.create,tz=z_.create,ez=x_.create,Fz=B_.create,Uz=t_.create,sz=eq.create,Qz=e_.create,qv=v_.create,g5=B6.create,_v=$q.create,Kv=Iq.create,jv=B6.createWithPreprocess,Pv=lK.create,wv={string:(q)=>Yq.create({...q,coerce:!0}),number:(q)=>Bq.create({...q,coerce:!0}),boolean:(q)=>c_.create({...q,coerce:!0}),bigint:(q)=>tq.create({...q,coerce:!0}),date:(q)=>w_.create({...q,coerce:!0})},Ov=v8,q1=k.union([k.string(),k.number().int()]),_1=k.string(),zv=k.object({progressToken:k.optional(q1)}).passthrough(),t6=k.object({_meta:k.optional(zv)}).passthrough(),S6=k.object({method:k.string(),params:k.optional(t6)}),xK=k.object({_meta:k.optional(k.object({}).passthrough())}).passthrough(),Gq=k.object({method:k.string(),params:k.optional(xK)}),e6=k.object({_meta:k.optional(k.object({}).passthrough())}).passthrough(),c3=k.union([k.string(),k.number().int()]),vv=k.object({jsonrpc:k.literal(n3),id:c3}).merge(S6).strict(),Wv=k.object({jsonrpc:k.literal(n3)}).merge(Gq).strict(),Hv=k.object({jsonrpc:k.literal(n3),id:c3,result:e6}).strict();(function(q){q[q.ConnectionClosed=-32000]="ConnectionClosed",q[q.RequestTimeout=-32001]="RequestTimeout",q[q.ParseError=-32700]="ParseError",q[q.InvalidRequest=-32600]="InvalidRequest",q[q.MethodNotFound=-32601]="MethodNotFound",q[q.InvalidParams=-32602]="InvalidParams",q[q.InternalError=-32603]="InternalError"})(y5||(y5={}));Jv=k.object({jsonrpc:k.literal(n3),id:c3,error:k.object({code:k.number().int(),message:k.string(),data:k.optional(k.unknown())})}).strict(),wC=k.union([vv,Wv,Hv,Jv]),K1=e6.strict(),j1=Gq.extend({method:k.literal("notifications/cancelled"),params:xK.extend({requestId:c3,reason:k.string().optional()})}),nK=k.object({name:k.string(),title:k.optional(k.string())}).passthrough(),P1=nK.extend({version:k.string()}),Tv=k.object({experimental:k.optional(k.object({}).passthrough()),sampling:k.optional(k.object({}).passthrough()),elicitation:k.optional(k.object({}).passthrough()),roots:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough())}).passthrough(),Zv=S6.extend({method:k.literal("initialize"),params:t6.extend({protocolVersion:k.string(),capabilities:Tv,clientInfo:P1})}),kv=k.object({experimental:k.optional(k.object({}).passthrough()),logging:k.optional(k.object({}).passthrough()),completions:k.optional(k.object({}).passthrough()),prompts:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough()),resources:k.optional(k.object({subscribe:k.optional(k.boolean()),listChanged:k.optional(k.boolean())}).passthrough()),tools:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough())}).passthrough(),Xv=e6.extend({protocolVersion:k.string(),capabilities:kv,serverInfo:P1,instructions:k.optional(k.string())}),Av=Gq.extend({method:k.literal("notifications/initialized")}),Y1=S6.extend({method:k.literal("ping")}),Gv=k.object({progress:k.number(),total:k.optional(k.number()),message:k.optional(k.string())}).passthrough(),f1=Gq.extend({method:k.literal("notifications/progress"),params:xK.merge(Gv).extend({progressToken:q1})}),r3=S6.extend({params:t6.extend({cursor:k.optional(_1)}).optional()}),i3=e6.extend({nextCursor:k.optional(_1)}),$1=k.object({uri:k.string(),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}).passthrough(),w1=$1.extend({text:k.string()}),u4=k.string().refine((q)=>{try{return atob(q),!0}catch(_){return!1}},{message:"Invalid Base64 string"}),O1=$1.extend({blob:u4}),z1=nK.extend({uri:k.string(),description:k.optional(k.string()),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}),uv=nK.extend({uriTemplate:k.string(),description:k.optional(k.string()),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}),hv=r3.extend({method:k.literal("resources/list")}),Dv=i3.extend({resources:k.array(z1)}),Cv=r3.extend({method:k.literal("resources/templates/list")}),Vv=i3.extend({resourceTemplates:k.array(uv)}),Mv=S6.extend({method:k.literal("resources/read"),params:t6.extend({uri:k.string()})}),Nv=e6.extend({contents:k.array(k.union([w1,O1]))}),bv=Gq.extend({method:k.literal("notifications/resources/list_changed")}),Sv=S6.extend({method:k.literal("resources/subscribe"),params:t6.extend({uri:k.string()})}),Ev=S6.extend({method:k.literal("resources/unsubscribe"),params:t6.extend({uri:k.string()})}),Rv=Gq.extend({method:k.literal("notifications/resources/updated"),params:xK.extend({uri:k.string()})}),mv=k.object({name:k.string(),description:k.optional(k.string()),required:k.optional(k.boolean())}).passthrough(),Iv=nK.extend({description:k.optional(k.string()),arguments:k.optional(k.array(mv)),_meta:k.optional(k.object({}).passthrough())}),gv=r3.extend({method:k.literal("prompts/list")}),yv=i3.extend({prompts:k.array(Iv)}),dv=S6.extend({method:k.literal("prompts/get"),params:t6.extend({name:k.string(),arguments:k.optional(k.record(k.string()))})}),h4=k.object({type:k.literal("text"),text:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),D4=k.object({type:k.literal("image"),data:u4,mimeType:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),C4=k.object({type:k.literal("audio"),data:u4,mimeType:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),pv=k.object({type:k.literal("resource"),resource:k.union([w1,O1]),_meta:k.optional(k.object({}).passthrough())}).passthrough(),Lv=z1.extend({type:k.literal("resource_link")}),v1=k.union([h4,D4,C4,Lv,pv]),lv=k.object({role:k.enum(["user","assistant"]),content:v1}).passthrough(),xv=e6.extend({description:k.optional(k.string()),messages:k.array(lv)}),nv=Gq.extend({method:k.literal("notifications/prompts/list_changed")}),cv=k.object({title:k.optional(k.string()),readOnlyHint:k.optional(k.boolean()),destructiveHint:k.optional(k.boolean()),idempotentHint:k.optional(k.boolean()),openWorldHint:k.optional(k.boolean())}).passthrough(),rv=nK.extend({description:k.optional(k.string()),inputSchema:k.object({type:k.literal("object"),properties:k.optional(k.object({}).passthrough()),required:k.optional(k.array(k.string()))}).passthrough(),outputSchema:k.optional(k.object({type:k.literal("object"),properties:k.optional(k.object({}).passthrough()),required:k.optional(k.array(k.string()))}).passthrough()),annotations:k.optional(cv),_meta:k.optional(k.object({}).passthrough())}),iv=r3.extend({method:k.literal("tools/list")}),ov=i3.extend({tools:k.array(rv)}),W1=e6.extend({content:k.array(v1).default([]),structuredContent:k.object({}).passthrough().optional(),isError:k.optional(k.boolean())}),OC=W1.or(e6.extend({toolResult:k.unknown()})),av=S6.extend({method:k.literal("tools/call"),params:t6.extend({name:k.string(),arguments:k.optional(k.record(k.unknown()))})}),Bv=Gq.extend({method:k.literal("notifications/tools/list_changed")}),H1=k.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),tv=S6.extend({method:k.literal("logging/setLevel"),params:t6.extend({level:H1})}),ev=Gq.extend({method:k.literal("notifications/message"),params:xK.extend({level:H1,logger:k.optional(k.string()),data:k.unknown()})}),Fv=k.object({name:k.string().optional()}).passthrough(),Uv=k.object({hints:k.optional(k.array(Fv)),costPriority:k.optional(k.number().min(0).max(1)),speedPriority:k.optional(k.number().min(0).max(1)),intelligencePriority:k.optional(k.number().min(0).max(1))}).passthrough(),sv=k.object({role:k.enum(["user","assistant"]),content:k.union([h4,D4,C4])}).passthrough(),Qv=S6.extend({method:k.literal("sampling/createMessage"),params:t6.extend({messages:k.array(sv),systemPrompt:k.optional(k.string()),includeContext:k.optional(k.enum(["none","thisServer","allServers"])),temperature:k.optional(k.number()),maxTokens:k.number().int(),stopSequences:k.optional(k.array(k.string())),metadata:k.optional(k.object({}).passthrough()),modelPreferences:k.optional(Uv)})}),qW=e6.extend({model:k.string(),stopReason:k.optional(k.enum(["endTurn","stopSequence","maxTokens"]).or(k.string())),role:k.enum(["user","assistant"]),content:k.discriminatedUnion("type",[h4,D4,C4])}),_W=k.object({type:k.literal("boolean"),title:k.optional(k.string()),description:k.optional(k.string()),default:k.optional(k.boolean())}).passthrough(),KW=k.object({type:k.literal("string"),title:k.optional(k.string()),description:k.optional(k.string()),minLength:k.optional(k.number()),maxLength:k.optional(k.number()),format:k.optional(k.enum(["email","uri","date","date-time"]))}).passthrough(),jW=k.object({type:k.enum(["number","integer"]),title:k.optional(k.string()),description:k.optional(k.string()),minimum:k.optional(k.number()),maximum:k.optional(k.number())}).passthrough(),PW=k.object({type:k.literal("string"),title:k.optional(k.string()),description:k.optional(k.string()),enum:k.array(k.string()),enumNames:k.optional(k.array(k.string()))}).passthrough(),YW=k.union([_W,KW,jW,PW]),fW=S6.extend({method:k.literal("elicitation/create"),params:t6.extend({message:k.string(),requestedSchema:k.object({type:k.literal("object"),properties:k.record(k.string(),YW),required:k.optional(k.array(k.string()))}).passthrough()})}),$W=e6.extend({action:k.enum(["accept","decline","cancel"]),content:k.optional(k.record(k.string(),k.unknown()))}),wW=k.object({type:k.literal("ref/resource"),uri:k.string()}).passthrough(),OW=k.object({type:k.literal("ref/prompt"),name:k.string()}).passthrough(),zW=S6.extend({method:k.literal("completion/complete"),params:t6.extend({ref:k.union([OW,wW]),argument:k.object({name:k.string(),value:k.string()}).passthrough(),context:k.optional(k.object({arguments:k.optional(k.record(k.string(),k.string()))}))})}),vW=e6.extend({completion:k.object({values:k.array(k.string()).max(100),total:k.optional(k.number().int()),hasMore:k.optional(k.boolean())}).passthrough()}),WW=k.object({uri:k.string().startsWith("file://"),name:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}).passthrough(),HW=S6.extend({method:k.literal("roots/list")}),JW=e6.extend({roots:k.array(WW)}),TW=Gq.extend({method:k.literal("notifications/roots/list_changed")}),zC=k.union([Y1,Zv,zW,tv,dv,gv,hv,Cv,Mv,Sv,Ev,av,iv]),vC=k.union([j1,f1,Av,TW]),WC=k.union([K1,qW,$W,JW]),HC=k.union([Y1,Qv,fW,HW]),JC=k.union([j1,f1,ev,Rv,bv,Bv,nv]),TC=k.union([K1,Xv,vW,xv,yv,Dv,Vv,Nv,W1,ov]),ZC=zO(oO(),1),kC=Symbol("Let zodToJsonSchema decide on which parser to use"),XC=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");(function(q){q.Completable="McpCompletable"})(Z4||(Z4={}));k4=class k4 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};k4.create=(q,_)=>{return new k4({type:q,typeName:Z4.Completable,complete:_.complete,...ZW(_)})}});var J1={};EK(J1,{version:()=>AW,type:()=>uW,scripts:()=>DW,repository:()=>NW,publishConfig:()=>EW,name:()=>XW,main:()=>hW,license:()=>MW,keywords:()=>CW,homepage:()=>bW,files:()=>yW,engines:()=>IW,devDependencies:()=>mW,description:()=>GW,dependencies:()=>RW,default:()=>dW,bugs:()=>SW,bin:()=>gW,author:()=>VW});var XW="claude-mem",AW="3.6.3",GW="Memory compression system for Claude Code - persist context across sessions",uW="module",hW="claude-mem",DW,CW,VW="Alex Newman",MW="SEE LICENSE IN LICENSE",NW,bW="https://github.com/thedotmack/claude-mem#readme",SW,EW,RW,mW,IW,gW,yW,dW;var T1=f6(()=>{DW={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall",build:"./scripts/build-minified.sh","test:watch":"npm test -- --watch",lint:"eslint 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","build:npm":"./scripts/npm-publish.sh",publish:"./scripts/publish-with-changelog.sh","publish:latest":"./scripts/publish-with-changelog.sh bump","publish:github":"./scripts/github-publish.sh"},CW=["claude","claude-code","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],NW={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},SW={url:"https://github.com/thedotmack/claude-mem/issues"},EW={access:"public",registry:"https://registry.npmjs.org/"},RW={"@anthropic-ai/claude-code":"^1.0.88","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^0.5.0",boxen:"^8.0.1",chalk:"^5.6.0",chromadb:"^3.0.14",commander:"^14.0.0",cors:"^2.8.5",express:"^5.1.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8",http:"^0.0.1-security","oh-my-logo":"^0.3.2",open:"^10.2.0"},mW={"@types/chai":"^4.3.0","@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0",chai:"^4.3.0",eslint:"^8.0.0",prettier:"^3.0.0","ts-node":"^10.0.0",tsx:"^4.20.5",typescript:"^5.0.0"},IW={node:">=18.0.0",bun:">=1.0.0"},gW={"claude-mem":"dist/claude-mem.min.js"},yW=["dist","hooks","commands","docs","src","CHANGELOG.md"],dW={name:XW,version:AW,description:GW,type:uW,main:hW,scripts:DW,keywords:CW,author:VW,license:MW,repository:NW,homepage:bW,bugs:SW,publishConfig:EW,dependencies:RW,devDependencies:mW,engines:IW,bin:gW,files:yW}});import{join as F8,dirname as a3,sep as pW}from"path";import{homedir as V4}from"os";import{existsSync as cK,statSync as LW}from"fs";import{execSync as lW}from"child_process";import{fileURLToPath as xW}from"url";class $8{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!$8.instance)$8.instance=new $8;return $8.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||F8(V4(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return F8(this.getDataDirectory(),"archives")}getHooksDirectory(){return F8(this.getDataDirectory(),"hooks")}getLogsDirectory(){return F8(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return F8(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return F8(this.getDataDirectory(),"trash")}getBackupsDirectory(){return F8(this.getDataDirectory(),"backups")}getChromaDirectory(){return F8(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(q){return F8(this.getArchivesDirectory(),q)}getUserSettingsPath(){return F8(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||F8(V4(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return F8(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return F8(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return F8(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return F8(V4(),".claude.json")}getProjectMcpConfigPath(){return F8(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let j=h6.resolve("/Users/alexnewman/Scripts/claude-mem-source/package.json");return this._packageRoot=a3(j),this._packageRoot}catch{}let q=xW(import.meta.url),_=a3(q);for(let j=0;j<10;j++){let K=F8(_,"package.json");if(cK(K))try{if(h6(K).name==="claude-mem")return this._packageRoot=_,this._packageRoot}catch{}let Y=a3(_);if(Y===_)break;_=Y}try{let j=lW("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),K=JSON.parse(j);if(K.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=a3(K.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHooksDirectory(){let q=this.getPackageRoot(),_=F8(q,"hooks"),j=["pre-compact.js","session-start.js"];for(let K of j)if(!cK(F8(_,K)))throw new Error(`Package hooks directory missing required file: ${K}`);return _}findPackageCommandsDirectory(){let q=this.getPackageRoot(),_=F8(q,"commands"),j=["save.md"];for(let K of j)if(!cK(F8(_,K)))throw new Error(`Package commands directory missing required file: ${K}`);return _}ensureDirectory(q){if(!cK(q))h6("fs").mkdirSync(q,{recursive:!0})}ensureDirectories(q){q.forEach((_)=>this.ensureDirectory(_))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(q){let _=q.split(pW),j=["src","lib","app","project","workspace"];for(let K=_.length-1;K>=0;K--)if(j.includes(_[K])&&K>0)return _[K-1];if(_.length>1)return _[_.length-2];return"unknown-project"}static getCurrentProjectName(){return h6("path").basename(process.cwd())}static createBackupFilename(q){let _=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${q}.backup.${_}`}static isPathAccessible(q){try{return cK(q)&&LW(q).isDirectory()}catch{return!1}}static getDataDirectory(){return $8.getInstance().getDataDirectory()}static getArchivesDirectory(){return $8.getInstance().getArchivesDirectory()}static getHooksDirectory(){return $8.getInstance().getHooksDirectory()}static getLogsDirectory(){return $8.getInstance().getLogsDirectory()}static getClaudeSettingsPath(){return $8.getInstance().getClaudeSettingsPath()}static getClaudeMdPath(){return $8.getInstance().getClaudeMdPath()}static findPackageHooksDirectory(){return $8.getInstance().findPackageHooksDirectory()}static findPackageCommandsDirectory(){return $8.getInstance().findPackageCommandsDirectory()}}var VC;var d6=f6(()=>{VC=$8.getInstance()});class yq{pathDiscovery;constructor(){this.pathDiscovery=$8.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(q){return this.pathDiscovery.getProjectArchiveDirectory(q)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(q){$8.getInstance().ensureDirectory(q)}static ensureDirectories(q){$8.getInstance().ensureDirectories(q)}static extractProjectName(q){return $8.extractProjectName(q)}static getCurrentProjectPrefix(){return $8.getCurrentProjectName()}static getCurrentProjectName(){return $8.getCurrentProjectName()}}var M4=f6(()=>{d6()});var C6=_8((UW)=>{UW.__esModule=!0;UW.extend=Z1;UW.indexOf=oW;UW.escapeExpression=aW;UW.isEmpty=BW;UW.createFrame=tW;UW.blockParams=eW;UW.appendContextPath=FW;var nW={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},cW=/[&<>"'`=]/g,rW=/[&<>"'`=]/;function iW(q){return nW[q]}function Z1(q){for(var _=1;_<arguments.length;_++)for(var j in arguments[_])if(Object.prototype.hasOwnProperty.call(arguments[_],j))q[j]=arguments[_][j];return q}var b4=Object.prototype.toString;UW.toString=b4;var N4=function q(_){return typeof _==="function"};if(N4(/x/))UW.isFunction=N4=function(q){return typeof q==="function"&&b4.call(q)==="[object Function]"};UW.isFunction=N4;var k1=Array.isArray||function(q){return q&&typeof q==="object"?b4.call(q)==="[object Array]":!1};UW.isArray=k1;function oW(q,_){for(var j=0,K=q.length;j<K;j++)if(q[j]===_)return j;return-1}function aW(q){if(typeof q!=="string"){if(q&&q.toHTML)return q.toHTML();else if(q==null)return"";else if(!q)return q+"";q=""+q}if(!rW.test(q))return q;return q.replace(cW,iW)}function BW(q){if(!q&&q!==0)return!0;else if(k1(q)&&q.length===0)return!0;else return!1}function tW(q){var _=Z1({},q);return _._parent=q,_}function eW(q,_){return q.path=_,q}function FW(q,_){return(q?q+".":"")+_}});var F6=_8((X1,A1)=>{X1.__esModule=!0;var S4=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function E4(q,_){var j=_&&_.loc,K=void 0,Y=void 0,f=void 0,P=void 0;if(j)K=j.start.line,Y=j.end.line,f=j.start.column,P=j.end.column,q+=" - "+K+":"+f;var $=Error.prototype.constructor.call(this,q);for(var w=0;w<S4.length;w++)this[S4[w]]=$[S4[w]];if(Error.captureStackTrace)Error.captureStackTrace(this,E4);try{if(j)if(this.lineNumber=K,this.endLineNumber=Y,Object.defineProperty)Object.defineProperty(this,"column",{value:f,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:P,enumerable:!0});else this.column=f,this.endColumn=P}catch(O){}}E4.prototype=new Error;X1.default=E4;A1.exports=X1.default});var h1=_8((G1,u1)=>{G1.__esModule=!0;var R4=C6();G1.default=function(q){q.registerHelper("blockHelperMissing",function(_,j){var{inverse:K,fn:Y}=j;if(_===!0)return Y(this);else if(_===!1||_==null)return K(this);else if(R4.isArray(_))if(_.length>0){if(j.ids)j.ids=[j.name];return q.helpers.each(_,j)}else return K(this);else{if(j.data&&j.ids){var f=R4.createFrame(j.data);f.contextPath=R4.appendContextPath(j.data.contextPath,j.name),j={data:f}}return Y(_,j)}})};u1.exports=G1.default});var V1=_8((D1,C1)=>{D1.__esModule=!0;function HH(q){return q&&q.__esModule?q:{default:q}}var rK=C6(),JH=F6(),TH=HH(JH);D1.default=function(q){q.registerHelper("each",function(_,j){if(!j)throw new TH.default("Must pass iterator to #each");var{fn:K,inverse:Y}=j,f=0,P="",$=void 0,w=void 0;if(j.data&&j.ids)w=rK.appendContextPath(j.data.contextPath,j.ids[0])+".";if(rK.isFunction(_))_=_.call(this);if(j.data)$=rK.createFrame(j.data);function O(T,H,X){if($){if($.key=T,$.index=H,$.first=H===0,$.last=!!X,w)$.contextPath=w+T}P=P+K(_[T],{data:$,blockParams:rK.blockParams([_[T],T],[w+T,null])})}if(_&&typeof _==="object")if(rK.isArray(_)){for(var v=_.length;f<v;f++)if(f in _)O(f,f,f===_.length-1)}else if(typeof Symbol==="function"&&_[Symbol.iterator]){var z=[],W=_[Symbol.iterator]();for(var J=W.next();!J.done;J=W.next())z.push(J.value);_=z;for(var v=_.length;f<v;f++)O(f,f,f===_.length-1)}else(function(){var T=void 0;if(Object.keys(_).forEach(function(H){if(T!==void 0)O(T,f-1);T=H,f++}),T!==void 0)O(T,f-1,!0)})();if(f===0)P=Y(this);return P})};C1.exports=D1.default});var b1=_8((M1,N1)=>{M1.__esModule=!0;function XH(q){return q&&q.__esModule?q:{default:q}}var AH=F6(),GH=XH(AH);M1.default=function(q){q.registerHelper("helperMissing",function(){if(arguments.length===1)return;else throw new GH.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};N1.exports=M1.default});var I1=_8((R1,m1)=>{R1.__esModule=!0;function DH(q){return q&&q.__esModule?q:{default:q}}var S1=C6(),CH=F6(),E1=DH(CH);R1.default=function(q){q.registerHelper("if",function(_,j){if(arguments.length!=2)throw new E1.default("#if requires exactly one argument");if(S1.isFunction(_))_=_.call(this);if(!j.hash.includeZero&&!_||S1.isEmpty(_))return j.inverse(this);else return j.fn(this)}),q.registerHelper("unless",function(_,j){if(arguments.length!=2)throw new E1.default("#unless requires exactly one argument");return q.helpers.if.call(this,_,{fn:j.inverse,inverse:j.fn,hash:j.hash})})};m1.exports=R1.default});var d1=_8((g1,y1)=>{g1.__esModule=!0;g1.default=function(q){q.registerHelper("log",function(){var _=[void 0],j=arguments[arguments.length-1];for(var K=0;K<arguments.length-1;K++)_.push(arguments[K]);var Y=1;if(j.hash.level!=null)Y=j.hash.level;else if(j.data&&j.data.level!=null)Y=j.data.level;_[0]=Y,q.log.apply(q,_)})};y1.exports=g1.default});var l1=_8((p1,L1)=>{p1.__esModule=!0;p1.default=function(q){q.registerHelper("lookup",function(_,j,K){if(!_)return _;return K.lookupProperty(_,j)})};L1.exports=p1.default});var c1=_8((x1,n1)=>{x1.__esModule=!0;function RH(q){return q&&q.__esModule?q:{default:q}}var iK=C6(),mH=F6(),IH=RH(mH);x1.default=function(q){q.registerHelper("with",function(_,j){if(arguments.length!=2)throw new IH.default("#with requires exactly one argument");if(iK.isFunction(_))_=_.call(this);var K=j.fn;if(!iK.isEmpty(_)){var Y=j.data;if(j.data&&j.ids)Y=iK.createFrame(j.data),Y.contextPath=iK.appendContextPath(j.data.contextPath,j.ids[0]);return K(_,{data:Y,blockParams:iK.blockParams([_],[Y&&Y.contextPath])})}else return j.inverse(this)})};n1.exports=x1.default});var m4=_8((sH)=>{sH.__esModule=!0;sH.registerDefaultHelpers=FH;sH.moveHelperToHooks=UH;function W_(q){return q&&q.__esModule?q:{default:q}}var dH=h1(),pH=W_(dH),LH=V1(),lH=W_(LH),xH=b1(),nH=W_(xH),cH=I1(),rH=W_(cH),iH=d1(),oH=W_(iH),aH=l1(),BH=W_(aH),tH=c1(),eH=W_(tH);function FH(q){pH.default(q),lH.default(q),nH.default(q),rH.default(q),oH.default(q),BH.default(q),eH.default(q)}function UH(q,_,j){if(q.helpers[_]){if(q.hooks[_]=q.helpers[_],!j)delete q.helpers[_]}}});var o1=_8((r1,i1)=>{r1.__esModule=!0;var KJ=C6();r1.default=function(q){q.registerDecorator("inline",function(_,j,K,Y){var f=_;if(!j.partials)j.partials={},f=function(P,$){var w=K.partials;K.partials=KJ.extend({},w,j.partials);var O=_(P,$);return K.partials=w,O};return j.partials[Y.args[0]]=Y.fn,f})};i1.exports=r1.default});var a1=_8((OJ)=>{OJ.__esModule=!0;OJ.registerDefaultDecorators=wJ;function YJ(q){return q&&q.__esModule?q:{default:q}}var fJ=o1(),$J=YJ(fJ);function wJ(q){$J.default(q)}});var I4=_8((B1,t1)=>{B1.__esModule=!0;var WJ=C6(),qK={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function q(_){if(typeof _==="string"){var j=WJ.indexOf(qK.methodMap,_.toLowerCase());if(j>=0)_=j;else _=parseInt(_,10)}return _},log:function q(_){if(_=qK.lookupLevel(_),typeof console!=="undefined"&&qK.lookupLevel(qK.level)<=_){var j=qK.methodMap[_];if(!console[j])j="log";for(var K=arguments.length,Y=Array(K>1?K-1:0),f=1;f<K;f++)Y[f-1]=arguments[f];console[j].apply(console,Y)}}};B1.default=qK;t1.exports=B1.default});var e1=_8((kJ)=>{kJ.__esModule=!0;kJ.createNewLookupObject=ZJ;var TJ=C6();function ZJ(){for(var q=arguments.length,_=Array(q),j=0;j<q;j++)_[j]=arguments[j];return TJ.extend.apply(void 0,[Object.create(null)].concat(_))}});var g4=_8((NJ)=>{NJ.__esModule=!0;NJ.createProtoAccessControl=DJ;NJ.resultIsAllowed=CJ;NJ.resetLoggedProperties=MJ;function GJ(q){return q&&q.__esModule?q:{default:q}}var F1=e1(),uJ=I4(),hJ=GJ(uJ),B3=Object.create(null);function DJ(q){var _=Object.create(null);_.constructor=!1,_.__defineGetter__=!1,_.__defineSetter__=!1,_.__lookupGetter__=!1;var j=Object.create(null);return j.__proto__=!1,{properties:{whitelist:F1.createNewLookupObject(j,q.allowedProtoProperties),defaultValue:q.allowProtoPropertiesByDefault},methods:{whitelist:F1.createNewLookupObject(_,q.allowedProtoMethods),defaultValue:q.allowProtoMethodsByDefault}}}function CJ(q,_,j){if(typeof q==="function")return U1(_.methods,j);else return U1(_.properties,j)}function U1(q,_){if(q.whitelist[_]!==void 0)return q.whitelist[_]===!0;if(q.defaultValue!==void 0)return q.defaultValue;return VJ(_),!1}function VJ(q){if(B3[q]!==!0)B3[q]=!0,hJ.default.log("error",'Handlebars: Access has been denied to resolve the property "'+q+`" because it is not an "own property" of its parent.
|
|
40
|
+
`))}this.transport.endInput()}catch(_){if(!(_ instanceof L_))throw _}}handleHookCallbacks(q,_,j,K){let Y=this.hookCallbacks.get(q);if(!Y)throw new Error(`No hook callback found for ID: ${q}`);return Y(_,j,{signal:K})}sendMcpServerMessageToCli(q,_){if("id"in _&&_.id!==null&&_.id!==void 0){let j=`${q}:${_.id}`,K=this.pendingMcpResponses.get(j);if(K){K.resolve(_),this.pendingMcpResponses.delete(j);return}}throw new Error("No pending request found")}handleMcpControlRequest(q,_,j){let K="id"in _.message?_.message.id:null,Y=`${q}:${K}`;return new Promise((f,P)=>{let $=null,w=()=>{if($)clearTimeout($);this.pendingMcpResponses.delete(Y)},O=(z)=>{w(),f(z)},v=(z)=>{w(),P(z)};if(this.pendingMcpResponses.set(Y,{resolve:O,reject:v}),j.onmessage)j.onmessage(_.message);else{w(),P(new Error("No message handler registered"));return}$=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))w(),P(new Error("Request timeout"))},30000)})}};k={};vO(k,{void:()=>Lz,util:()=>h8,unknown:()=>dz,union:()=>cz,undefined:()=>Iz,tuple:()=>oz,transformer:()=>g5,symbol:()=>mz,string:()=>U5,strictObject:()=>nz,setErrorMap:()=>jz,set:()=>tz,record:()=>az,quotelessJson:()=>_z,promise:()=>qv,preprocess:()=>jv,pipeline:()=>Pv,ostring:()=>Yv,optional:()=>_v,onumber:()=>fv,oboolean:()=>$v,objectUtil:()=>W4,object:()=>xz,number:()=>s5,nullable:()=>Kv,null:()=>gz,never:()=>pz,nativeEnum:()=>Qz,nan:()=>Sz,map:()=>Bz,makeIssue:()=>L3,literal:()=>Uz,lazy:()=>Fz,late:()=>Nz,isValid:()=>$_,isDirty:()=>J4,isAsync:()=>IK,isAborted:()=>H4,intersection:()=>iz,instanceof:()=>bz,getParsedType:()=>mq,getErrorMap:()=>p3,function:()=>ez,enum:()=>sz,effect:()=>g5,discriminatedUnion:()=>rz,defaultErrorMap:()=>n_,datetimeRegex:()=>t5,date:()=>Rz,custom:()=>F5,coerce:()=>wv,boolean:()=>Q5,bigint:()=>Ez,array:()=>lz,any:()=>yz,addIssueToContext:()=>F,ZodVoid:()=>yK,ZodUnknown:()=>aq,ZodUnion:()=>o_,ZodUndefined:()=>r_,ZodType:()=>k8,ZodTuple:()=>Aq,ZodTransformer:()=>B6,ZodSymbol:()=>gK,ZodString:()=>Yq,ZodSet:()=>z_,ZodSchema:()=>k8,ZodRecord:()=>dK,ZodReadonly:()=>s_,ZodPromise:()=>v_,ZodPipeline:()=>lK,ZodParsedType:()=>s,ZodOptional:()=>$q,ZodObject:()=>i8,ZodNumber:()=>Bq,ZodNullable:()=>Iq,ZodNull:()=>i_,ZodNever:()=>Xq,ZodNativeEnum:()=>e_,ZodNaN:()=>LK,ZodMap:()=>pK,ZodLiteral:()=>t_,ZodLazy:()=>B_,ZodIssueCode:()=>t,ZodIntersection:()=>a_,ZodFunction:()=>x_,ZodFirstPartyTypeKind:()=>W8,ZodError:()=>y6,ZodEnum:()=>eq,ZodEffects:()=>B6,ZodDiscriminatedUnion:()=>l3,ZodDefault:()=>F_,ZodDate:()=>w_,ZodCatch:()=>U_,ZodBranded:()=>x3,ZodBoolean:()=>c_,ZodBigInt:()=>tq,ZodArray:()=>fq,ZodAny:()=>O_,Schema:()=>k8,ParseStatus:()=>k6,OK:()=>D6,NEVER:()=>Ov,INVALID:()=>v8,EMPTY_PATH:()=>Pz,DIRTY:()=>l_,BRAND:()=>Mz});(function(q){q.assertEqual=(Y)=>{};function _(Y){}q.assertIs=_;function j(Y){throw new Error}q.assertNever=j,q.arrayToEnum=(Y)=>{let f={};for(let P of Y)f[P]=P;return f},q.getValidEnumValues=(Y)=>{let f=q.objectKeys(Y).filter(($)=>typeof Y[Y[$]]!=="number"),P={};for(let $ of f)P[$]=Y[$];return q.objectValues(P)},q.objectValues=(Y)=>{return q.objectKeys(Y).map(function(f){return Y[f]})},q.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let f=[];for(let P in Y)if(Object.prototype.hasOwnProperty.call(Y,P))f.push(P);return f},q.find=(Y,f)=>{for(let P of Y)if(f(P))return P;return},q.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function K(Y,f=" | "){return Y.map((P)=>typeof P==="string"?`'${P}'`:P).join(f)}q.joinValues=K,q.jsonStringifyReplacer=(Y,f)=>{if(typeof f==="bigint")return f.toString();return f}})(h8||(h8={}));(function(q){q.mergeShapes=(_,j)=>{return{..._,...j}}})(W4||(W4={}));s=h8.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t=h8.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"]);y6=class y6 extends Error{get errors(){return this.issues}constructor(q){super();this.issues=[],this.addIssue=(j)=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=q}format(q){let _=q||function(Y){return Y.message},j={_errors:[]},K=(Y)=>{for(let f of Y.issues)if(f.code==="invalid_union")f.unionErrors.map(K);else if(f.code==="invalid_return_type")K(f.returnTypeError);else if(f.code==="invalid_arguments")K(f.argumentsError);else if(f.path.length===0)j._errors.push(_(f));else{let P=j,$=0;while($<f.path.length){let w=f.path[$];if($!==f.path.length-1)P[w]=P[w]||{_errors:[]};else P[w]=P[w]||{_errors:[]},P[w]._errors.push(_(f));P=P[w],$++}}};return K(this),j}static assert(q){if(!(q instanceof y6))throw new Error(`Not a ZodError: ${q}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,h8.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(q=(_)=>_.message){let _={},j=[];for(let K of this.issues)if(K.path.length>0){let Y=K.path[0];_[Y]=_[Y]||[],_[Y].push(q(K))}else j.push(q(K));return{formErrors:j,fieldErrors:_}}get formErrors(){return this.flatten()}};y6.create=(q)=>{return new y6(q)};n_=Kz,o5=n_;Pz=[];v8=Object.freeze({status:"aborted"});(function(q){q.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},q.toString=(_)=>typeof _==="string"?_:_?.message})(f8||(f8={}));Yz=/^c[^\s-]{8,}$/i,fz=/^[0-9a-z]+$/,$z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wz=/^[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,Oz=/^[a-z0-9_-]{21}$/i,zz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vz=/^[-+]?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)?)??$/,Wz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jz=/^(?:(?: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])$/,Tz=/^(?:(?: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])$/,Zz=/^(([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]))$/,kz=/^(([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])$/,Xz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Az=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gz=new RegExp(`^${a5}$`);Yq=class Yq extends k8{_parse(q){if(this._def.coerce)q.data=String(q.data);if(this._getType(q)!==s.string){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:s.string,received:Y.parsedType}),v8}let j=new k6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.length<Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="max"){if(q.data.length>Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="length"){let f=q.data.length>Y.value,P=q.data.length<Y.value;if(f||P){if(K=this._getOrReturnCtx(q,K),f)F(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(P)F(K,{code:t.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});j.dirty()}}else if(Y.kind==="email"){if(!Wz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"email",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="emoji"){if(!z4)z4=new RegExp(Hz,"u");if(!z4.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"emoji",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="uuid"){if(!wz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"uuid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="nanoid"){if(!Oz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"nanoid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cuid"){if(!Yz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"cuid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cuid2"){if(!fz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"cuid2",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="ulid"){if(!$z.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"ulid",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="url")try{new URL(q.data)}catch{K=this._getOrReturnCtx(q,K),F(K,{validation:"url",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"regex",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="trim")q.data=q.data.trim();else if(Y.kind==="includes"){if(!q.data.includes(Y.value,Y.position))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),j.dirty()}else if(Y.kind==="toLowerCase")q.data=q.data.toLowerCase();else if(Y.kind==="toUpperCase")q.data=q.data.toUpperCase();else if(Y.kind==="startsWith"){if(!q.data.startsWith(Y.value))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:{startsWith:Y.value},message:Y.message}),j.dirty()}else if(Y.kind==="endsWith"){if(!q.data.endsWith(Y.value))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:{endsWith:Y.value},message:Y.message}),j.dirty()}else if(Y.kind==="datetime"){if(!t5(Y).test(q.data))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:"datetime",message:Y.message}),j.dirty()}else if(Y.kind==="date"){if(!Gz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:"date",message:Y.message}),j.dirty()}else if(Y.kind==="time"){if(!uz(Y).test(q.data))K=this._getOrReturnCtx(q,K),F(K,{code:t.invalid_string,validation:"time",message:Y.message}),j.dirty()}else if(Y.kind==="duration"){if(!vz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"duration",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="ip"){if(!hz(q.data,Y.version))K=this._getOrReturnCtx(q,K),F(K,{validation:"ip",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="jwt"){if(!Dz(q.data,Y.alg))K=this._getOrReturnCtx(q,K),F(K,{validation:"jwt",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="cidr"){if(!Cz(q.data,Y.version))K=this._getOrReturnCtx(q,K),F(K,{validation:"cidr",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="base64"){if(!Xz.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"base64",code:t.invalid_string,message:Y.message}),j.dirty()}else if(Y.kind==="base64url"){if(!Az.test(q.data))K=this._getOrReturnCtx(q,K),F(K,{validation:"base64url",code:t.invalid_string,message:Y.message}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:q.data}}_regex(q,_,j){return this.refinement((K)=>q.test(K),{validation:_,code:t.invalid_string,...f8.errToObj(j)})}_addCheck(q){return new Yq({...this._def,checks:[...this._def.checks,q]})}email(q){return this._addCheck({kind:"email",...f8.errToObj(q)})}url(q){return this._addCheck({kind:"url",...f8.errToObj(q)})}emoji(q){return this._addCheck({kind:"emoji",...f8.errToObj(q)})}uuid(q){return this._addCheck({kind:"uuid",...f8.errToObj(q)})}nanoid(q){return this._addCheck({kind:"nanoid",...f8.errToObj(q)})}cuid(q){return this._addCheck({kind:"cuid",...f8.errToObj(q)})}cuid2(q){return this._addCheck({kind:"cuid2",...f8.errToObj(q)})}ulid(q){return this._addCheck({kind:"ulid",...f8.errToObj(q)})}base64(q){return this._addCheck({kind:"base64",...f8.errToObj(q)})}base64url(q){return this._addCheck({kind:"base64url",...f8.errToObj(q)})}jwt(q){return this._addCheck({kind:"jwt",...f8.errToObj(q)})}ip(q){return this._addCheck({kind:"ip",...f8.errToObj(q)})}cidr(q){return this._addCheck({kind:"cidr",...f8.errToObj(q)})}datetime(q){if(typeof q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:q});return this._addCheck({kind:"datetime",precision:typeof q?.precision==="undefined"?null:q?.precision,offset:q?.offset??!1,local:q?.local??!1,...f8.errToObj(q?.message)})}date(q){return this._addCheck({kind:"date",message:q})}time(q){if(typeof q==="string")return this._addCheck({kind:"time",precision:null,message:q});return this._addCheck({kind:"time",precision:typeof q?.precision==="undefined"?null:q?.precision,...f8.errToObj(q?.message)})}duration(q){return this._addCheck({kind:"duration",...f8.errToObj(q)})}regex(q,_){return this._addCheck({kind:"regex",regex:q,...f8.errToObj(_)})}includes(q,_){return this._addCheck({kind:"includes",value:q,position:_?.position,...f8.errToObj(_?.message)})}startsWith(q,_){return this._addCheck({kind:"startsWith",value:q,...f8.errToObj(_)})}endsWith(q,_){return this._addCheck({kind:"endsWith",value:q,...f8.errToObj(_)})}min(q,_){return this._addCheck({kind:"min",value:q,...f8.errToObj(_)})}max(q,_){return this._addCheck({kind:"max",value:q,...f8.errToObj(_)})}length(q,_){return this._addCheck({kind:"length",value:q,...f8.errToObj(_)})}nonempty(q){return this.min(1,f8.errToObj(q))}trim(){return new Yq({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Yq({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Yq({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((q)=>q.kind==="datetime")}get isDate(){return!!this._def.checks.find((q)=>q.kind==="date")}get isTime(){return!!this._def.checks.find((q)=>q.kind==="time")}get isDuration(){return!!this._def.checks.find((q)=>q.kind==="duration")}get isEmail(){return!!this._def.checks.find((q)=>q.kind==="email")}get isURL(){return!!this._def.checks.find((q)=>q.kind==="url")}get isEmoji(){return!!this._def.checks.find((q)=>q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((q)=>q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((q)=>q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((q)=>q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((q)=>q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((q)=>q.kind==="ulid")}get isIP(){return!!this._def.checks.find((q)=>q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((q)=>q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((q)=>q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((q)=>q.kind==="base64url")}get minLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}};Yq.create=(q)=>{return new Yq({checks:[],typeName:W8.ZodString,coerce:q?.coerce??!1,...Z8(q)})};Bq=class Bq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(q){if(this._def.coerce)q.data=Number(q.data);if(this._getType(q)!==s.number){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:s.number,received:Y.parsedType}),v8}let j=void 0,K=new k6;for(let Y of this._def.checks)if(Y.kind==="int"){if(!h8.isInteger(q.data))j=this._getOrReturnCtx(q,j),F(j,{code:t.invalid_type,expected:"integer",received:"float",message:Y.message}),K.dirty()}else if(Y.kind==="min"){if(Y.inclusive?q.data<Y.value:q.data<=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="max"){if(Y.inclusive?q.data>Y.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(Vz(q.data,Y.value)!==0)j=this._getOrReturnCtx(q,j),F(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(q.data))j=this._getOrReturnCtx(q,j),F(j,{code:t.not_finite,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}gte(q,_){return this.setLimit("min",q,!0,f8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,f8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,f8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,f8.toString(_))}setLimit(q,_,j,K){return new Bq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:f8.toString(K)}]})}_addCheck(q){return new Bq({...this._def,checks:[...this._def.checks,q]})}int(q){return this._addCheck({kind:"int",message:f8.toString(q)})}positive(q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:f8.toString(_)})}finite(q){return this._addCheck({kind:"finite",message:f8.toString(q)})}safe(q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f8.toString(q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f8.toString(q)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}get isInt(){return!!this._def.checks.find((q)=>q.kind==="int"||q.kind==="multipleOf"&&h8.isInteger(q.value))}get isFinite(){let q=null,_=null;for(let j of this._def.checks)if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;else if(j.kind==="min"){if(_===null||j.value>_)_=j.value}else if(j.kind==="max"){if(q===null||j.value<q)q=j.value}return Number.isFinite(_)&&Number.isFinite(q)}};Bq.create=(q)=>{return new Bq({checks:[],typeName:W8.ZodNumber,coerce:q?.coerce||!1,...Z8(q)})};tq=class tq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(q){if(this._def.coerce)try{q.data=BigInt(q.data)}catch{return this._getInvalidInput(q)}if(this._getType(q)!==s.bigint)return this._getInvalidInput(q);let j=void 0,K=new k6;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?q.data<Y.value:q.data<=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="max"){if(Y.inclusive?q.data>Y.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(q.data%Y.value!==BigInt(0))j=this._getOrReturnCtx(q,j),F(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else h8.assertNever(Y);return{status:K.value,value:q.data}}_getInvalidInput(q){let _=this._getOrReturnCtx(q);return F(_,{code:t.invalid_type,expected:s.bigint,received:_.parsedType}),v8}gte(q,_){return this.setLimit("min",q,!0,f8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,f8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,f8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,f8.toString(_))}setLimit(q,_,j,K){return new tq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:f8.toString(K)}]})}_addCheck(q){return new tq({...this._def,checks:[...this._def.checks,q]})}positive(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:f8.toString(_)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q}};tq.create=(q)=>{return new tq({checks:[],typeName:W8.ZodBigInt,coerce:q?.coerce??!1,...Z8(q)})};c_=class c_ extends k8{_parse(q){if(this._def.coerce)q.data=Boolean(q.data);if(this._getType(q)!==s.boolean){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.boolean,received:j.parsedType}),v8}return D6(q.data)}};c_.create=(q)=>{return new c_({typeName:W8.ZodBoolean,coerce:q?.coerce||!1,...Z8(q)})};w_=class w_ extends k8{_parse(q){if(this._def.coerce)q.data=new Date(q.data);if(this._getType(q)!==s.date){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:s.date,received:Y.parsedType}),v8}if(Number.isNaN(q.data.getTime())){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_date}),v8}let j=new k6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.getTime()<Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),j.dirty()}else if(Y.kind==="max"){if(q.data.getTime()>Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),j.dirty()}else h8.assertNever(Y);return{status:j.value,value:new Date(q.data.getTime())}}_addCheck(q){return new w_({...this._def,checks:[...this._def.checks,q]})}min(q,_){return this._addCheck({kind:"min",value:q.getTime(),message:f8.toString(_)})}max(q,_){return this._addCheck({kind:"max",value:q.getTime(),message:f8.toString(_)})}get minDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q!=null?new Date(q):null}get maxDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value<q)q=_.value}return q!=null?new Date(q):null}};w_.create=(q)=>{return new w_({checks:[],coerce:q?.coerce||!1,typeName:W8.ZodDate,...Z8(q)})};gK=class gK extends k8{_parse(q){if(this._getType(q)!==s.symbol){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.symbol,received:j.parsedType}),v8}return D6(q.data)}};gK.create=(q)=>{return new gK({typeName:W8.ZodSymbol,...Z8(q)})};r_=class r_ extends k8{_parse(q){if(this._getType(q)!==s.undefined){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.undefined,received:j.parsedType}),v8}return D6(q.data)}};r_.create=(q)=>{return new r_({typeName:W8.ZodUndefined,...Z8(q)})};i_=class i_ extends k8{_parse(q){if(this._getType(q)!==s.null){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.null,received:j.parsedType}),v8}return D6(q.data)}};i_.create=(q)=>{return new i_({typeName:W8.ZodNull,...Z8(q)})};O_=class O_ extends k8{constructor(){super(...arguments);this._any=!0}_parse(q){return D6(q.data)}};O_.create=(q)=>{return new O_({typeName:W8.ZodAny,...Z8(q)})};aq=class aq extends k8{constructor(){super(...arguments);this._unknown=!0}_parse(q){return D6(q.data)}};aq.create=(q)=>{return new aq({typeName:W8.ZodUnknown,...Z8(q)})};Xq=class Xq extends k8{_parse(q){let _=this._getOrReturnCtx(q);return F(_,{code:t.invalid_type,expected:s.never,received:_.parsedType}),v8}};Xq.create=(q)=>{return new Xq({typeName:W8.ZodNever,...Z8(q)})};yK=class yK extends k8{_parse(q){if(this._getType(q)!==s.undefined){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.void,received:j.parsedType}),v8}return D6(q.data)}};yK.create=(q)=>{return new yK({typeName:W8.ZodVoid,...Z8(q)})};fq=class fq extends k8{_parse(q){let{ctx:_,status:j}=this._processInputParams(q),K=this._def;if(_.parsedType!==s.array)return F(_,{code:t.invalid_type,expected:s.array,received:_.parsedType}),v8;if(K.exactLength!==null){let f=_.data.length>K.exactLength.value,P=_.data.length<K.exactLength.value;if(f||P)F(_,{code:f?t.too_big:t.too_small,minimum:P?K.exactLength.value:void 0,maximum:f?K.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:K.exactLength.message}),j.dirty()}if(K.minLength!==null){if(_.data.length<K.minLength.value)F(_,{code:t.too_small,minimum:K.minLength.value,type:"array",inclusive:!0,exact:!1,message:K.minLength.message}),j.dirty()}if(K.maxLength!==null){if(_.data.length>K.maxLength.value)F(_,{code:t.too_big,maximum:K.maxLength.value,type:"array",inclusive:!0,exact:!1,message:K.maxLength.message}),j.dirty()}if(_.common.async)return Promise.all([..._.data].map((f,P)=>{return K.type._parseAsync(new wq(_,f,_.path,P))})).then((f)=>{return k6.mergeArray(j,f)});let Y=[..._.data].map((f,P)=>{return K.type._parseSync(new wq(_,f,_.path,P))});return k6.mergeArray(j,Y)}get element(){return this._def.type}min(q,_){return new fq({...this._def,minLength:{value:q,message:f8.toString(_)}})}max(q,_){return new fq({...this._def,maxLength:{value:q,message:f8.toString(_)}})}length(q,_){return new fq({...this._def,exactLength:{value:q,message:f8.toString(_)}})}nonempty(q){return this.min(1,q)}};fq.create=(q,_)=>{return new fq({type:q,minLength:null,maxLength:null,exactLength:null,typeName:W8.ZodArray,...Z8(_)})};i8=class i8 extends k8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let q=this._def.shape(),_=h8.objectKeys(q);return this._cached={shape:q,keys:_},this._cached}_parse(q){if(this._getType(q)!==s.object){let w=this._getOrReturnCtx(q);return F(w,{code:t.invalid_type,expected:s.object,received:w.parsedType}),v8}let{status:j,ctx:K}=this._processInputParams(q),{shape:Y,keys:f}=this._getCached(),P=[];if(!(this._def.catchall instanceof Xq&&this._def.unknownKeys==="strip")){for(let w in K.data)if(!f.includes(w))P.push(w)}let $=[];for(let w of f){let O=Y[w],v=K.data[w];$.push({key:{status:"valid",value:w},value:O._parse(new wq(K,v,K.path,w)),alwaysSet:w in K.data})}if(this._def.catchall instanceof Xq){let w=this._def.unknownKeys;if(w==="passthrough")for(let O of P)$.push({key:{status:"valid",value:O},value:{status:"valid",value:K.data[O]}});else if(w==="strict"){if(P.length>0)F(K,{code:t.unrecognized_keys,keys:P}),j.dirty()}else if(w==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let O of P){let v=K.data[O];$.push({key:{status:"valid",value:O},value:w._parse(new wq(K,v,K.path,O)),alwaysSet:O in K.data})}}if(K.common.async)return Promise.resolve().then(async()=>{let w=[];for(let O of $){let v=await O.key,z=await O.value;w.push({key:v,value:z,alwaysSet:O.alwaysSet})}return w}).then((w)=>{return k6.mergeObjectSync(j,w)});else return k6.mergeObjectSync(j,$)}get shape(){return this._def.shape()}strict(q){return f8.errToObj,new i8({...this._def,unknownKeys:"strict",...q!==void 0?{errorMap:(_,j)=>{let K=this._def.errorMap?.(_,j).message??j.defaultError;if(_.code==="unrecognized_keys")return{message:f8.errToObj(q).message??K};return{message:K}}}:{}})}strip(){return new i8({...this._def,unknownKeys:"strip"})}passthrough(){return new i8({...this._def,unknownKeys:"passthrough"})}extend(q){return new i8({...this._def,shape:()=>({...this._def.shape(),...q})})}merge(q){return new i8({unknownKeys:q._def.unknownKeys,catchall:q._def.catchall,shape:()=>({...this._def.shape(),...q._def.shape()}),typeName:W8.ZodObject})}setKey(q,_){return this.augment({[q]:_})}catchall(q){return new i8({...this._def,catchall:q})}pick(q){let _={};for(let j of h8.objectKeys(q))if(q[j]&&this.shape[j])_[j]=this.shape[j];return new i8({...this._def,shape:()=>_})}omit(q){let _={};for(let j of h8.objectKeys(this.shape))if(!q[j])_[j]=this.shape[j];return new i8({...this._def,shape:()=>_})}deepPartial(){return p_(this)}partial(q){let _={};for(let j of h8.objectKeys(this.shape)){let K=this.shape[j];if(q&&!q[j])_[j]=K;else _[j]=K.optional()}return new i8({...this._def,shape:()=>_})}required(q){let _={};for(let j of h8.objectKeys(this.shape))if(q&&!q[j])_[j]=this.shape[j];else{let Y=this.shape[j];while(Y instanceof $q)Y=Y._def.innerType;_[j]=Y}return new i8({...this._def,shape:()=>_})}keyof(){return e5(h8.objectKeys(this.shape))}};i8.create=(q,_)=>{return new i8({shape:()=>q,unknownKeys:"strip",catchall:Xq.create(),typeName:W8.ZodObject,...Z8(_)})};i8.strictCreate=(q,_)=>{return new i8({shape:()=>q,unknownKeys:"strict",catchall:Xq.create(),typeName:W8.ZodObject,...Z8(_)})};i8.lazycreate=(q,_)=>{return new i8({shape:q,unknownKeys:"strip",catchall:Xq.create(),typeName:W8.ZodObject,...Z8(_)})};o_=class o_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=this._def.options;function K(Y){for(let P of Y)if(P.result.status==="valid")return P.result;for(let P of Y)if(P.result.status==="dirty")return _.common.issues.push(...P.ctx.common.issues),P.result;let f=Y.map((P)=>new y6(P.ctx.common.issues));return F(_,{code:t.invalid_union,unionErrors:f}),v8}if(_.common.async)return Promise.all(j.map(async(Y)=>{let f={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:f}),ctx:f}})).then(K);else{let Y=void 0,f=[];for(let $ of j){let w={..._,common:{..._.common,issues:[]},parent:null},O=$._parseSync({data:_.data,path:_.path,parent:w});if(O.status==="valid")return O;else if(O.status==="dirty"&&!Y)Y={result:O,ctx:w};if(w.common.issues.length)f.push(w.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let P=f.map(($)=>new y6($));return F(_,{code:t.invalid_union,unionErrors:P}),v8}}get options(){return this._def.options}};o_.create=(q,_)=>{return new o_({options:q,typeName:W8.ZodUnion,...Z8(_)})};l3=class l3 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==s.object)return F(_,{code:t.invalid_type,expected:s.object,received:_.parsedType}),v8;let j=this.discriminator,K=_.data[j],Y=this.optionsMap.get(K);if(!Y)return F(_,{code:t.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),v8;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(q,_,j){let K=new Map;for(let Y of _){let f=Rq(Y.shape[q]);if(!f.length)throw new Error(`A discriminator value for key \`${q}\` could not be extracted from all schema options`);for(let P of f){if(K.has(P))throw new Error(`Discriminator property ${String(q)} has duplicate value ${String(P)}`);K.set(P,Y)}}return new l3({typeName:W8.ZodDiscriminatedUnion,discriminator:q,options:_,optionsMap:K,...Z8(j)})}};a_=class a_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=(Y,f)=>{if(H4(Y)||H4(f))return v8;let P=T4(Y.value,f.value);if(!P.valid)return F(j,{code:t.invalid_intersection_types}),v8;if(J4(Y)||J4(f))_.dirty();return{status:_.value,value:P.data}};if(j.common.async)return Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([Y,f])=>K(Y,f));else return K(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}};a_.create=(q,_,j)=>{return new a_({left:q,right:_,typeName:W8.ZodIntersection,...Z8(j)})};Aq=class Aq extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.array)return F(j,{code:t.invalid_type,expected:s.array,received:j.parsedType}),v8;if(j.data.length<this._def.items.length)return F(j,{code:t.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v8;if(!this._def.rest&&j.data.length>this._def.items.length)F(j,{code:t.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...j.data].map((f,P)=>{let $=this._def.items[P]||this._def.rest;if(!$)return null;return $._parse(new wq(j,f,j.path,P))}).filter((f)=>!!f);if(j.common.async)return Promise.all(Y).then((f)=>{return k6.mergeArray(_,f)});else return k6.mergeArray(_,Y)}get items(){return this._def.items}rest(q){return new Aq({...this._def,rest:q})}};Aq.create=(q,_)=>{if(!Array.isArray(q))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Aq({items:q,typeName:W8.ZodTuple,rest:null,...Z8(_)})};dK=class dK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.object)return F(j,{code:t.invalid_type,expected:s.object,received:j.parsedType}),v8;let K=[],Y=this._def.keyType,f=this._def.valueType;for(let P in j.data)K.push({key:Y._parse(new wq(j,P,j.path,P)),value:f._parse(new wq(j,j.data[P],j.path,P)),alwaysSet:P in j.data});if(j.common.async)return k6.mergeObjectAsync(_,K);else return k6.mergeObjectSync(_,K)}get element(){return this._def.valueType}static create(q,_,j){if(_ instanceof k8)return new dK({keyType:q,valueType:_,typeName:W8.ZodRecord,...Z8(j)});return new dK({keyType:Yq.create(),valueType:q,typeName:W8.ZodRecord,...Z8(_)})}};pK=class pK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.map)return F(j,{code:t.invalid_type,expected:s.map,received:j.parsedType}),v8;let K=this._def.keyType,Y=this._def.valueType,f=[...j.data.entries()].map(([P,$],w)=>{return{key:K._parse(new wq(j,P,j.path,[w,"key"])),value:Y._parse(new wq(j,$,j.path,[w,"value"]))}});if(j.common.async){let P=new Map;return Promise.resolve().then(async()=>{for(let $ of f){let w=await $.key,O=await $.value;if(w.status==="aborted"||O.status==="aborted")return v8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}})}else{let P=new Map;for(let $ of f){let{key:w,value:O}=$;if(w.status==="aborted"||O.status==="aborted")return v8;if(w.status==="dirty"||O.status==="dirty")_.dirty();P.set(w.value,O.value)}return{status:_.value,value:P}}}};pK.create=(q,_,j)=>{return new pK({valueType:_,keyType:q,typeName:W8.ZodMap,...Z8(j)})};z_=class z_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==s.set)return F(j,{code:t.invalid_type,expected:s.set,received:j.parsedType}),v8;let K=this._def;if(K.minSize!==null){if(j.data.size<K.minSize.value)F(j,{code:t.too_small,minimum:K.minSize.value,type:"set",inclusive:!0,exact:!1,message:K.minSize.message}),_.dirty()}if(K.maxSize!==null){if(j.data.size>K.maxSize.value)F(j,{code:t.too_big,maximum:K.maxSize.value,type:"set",inclusive:!0,exact:!1,message:K.maxSize.message}),_.dirty()}let Y=this._def.valueType;function f($){let w=new Set;for(let O of $){if(O.status==="aborted")return v8;if(O.status==="dirty")_.dirty();w.add(O.value)}return{status:_.value,value:w}}let P=[...j.data.values()].map(($,w)=>Y._parse(new wq(j,$,j.path,w)));if(j.common.async)return Promise.all(P).then(($)=>f($));else return f(P)}min(q,_){return new z_({...this._def,minSize:{value:q,message:f8.toString(_)}})}max(q,_){return new z_({...this._def,maxSize:{value:q,message:f8.toString(_)}})}size(q,_){return this.min(q,_).max(q,_)}nonempty(q){return this.min(1,q)}};z_.create=(q,_)=>{return new z_({valueType:q,minSize:null,maxSize:null,typeName:W8.ZodSet,...Z8(_)})};x_=class x_ extends k8{constructor(){super(...arguments);this.validate=this.implement}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==s.function)return F(_,{code:t.invalid_type,expected:s.function,received:_.parsedType}),v8;function j(P,$){return L3({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,p3(),n_].filter((w)=>!!w),issueData:{code:t.invalid_arguments,argumentsError:$}})}function K(P,$){return L3({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,p3(),n_].filter((w)=>!!w),issueData:{code:t.invalid_return_type,returnTypeError:$}})}let Y={errorMap:_.common.contextualErrorMap},f=_.data;if(this._def.returns instanceof v_){let P=this;return D6(async function(...$){let w=new y6([]),O=await P._def.args.parseAsync($,Y).catch((W)=>{throw w.addIssue(j($,W)),w}),v=await Reflect.apply(f,this,O);return await P._def.returns._def.type.parseAsync(v,Y).catch((W)=>{throw w.addIssue(K(v,W)),w})})}else{let P=this;return D6(function(...$){let w=P._def.args.safeParse($,Y);if(!w.success)throw new y6([j($,w.error)]);let O=Reflect.apply(f,this,w.data),v=P._def.returns.safeParse(O,Y);if(!v.success)throw new y6([K(O,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...q){return new x_({...this._def,args:Aq.create(q).rest(aq.create())})}returns(q){return new x_({...this._def,returns:q})}implement(q){return this.parse(q)}strictImplement(q){return this.parse(q)}static create(q,_,j){return new x_({args:q?q:Aq.create([]).rest(aq.create()),returns:_||aq.create(),typeName:W8.ZodFunction,...Z8(j)})}};B_=class B_ extends k8{get schema(){return this._def.getter()}_parse(q){let{ctx:_}=this._processInputParams(q);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}};B_.create=(q,_)=>{return new B_({getter:q,typeName:W8.ZodLazy,...Z8(_)})};t_=class t_ extends k8{_parse(q){if(q.data!==this._def.value){let _=this._getOrReturnCtx(q);return F(_,{received:_.data,code:t.invalid_literal,expected:this._def.value}),v8}return{status:"valid",value:q.data}}get value(){return this._def.value}};t_.create=(q,_)=>{return new t_({value:q,typeName:W8.ZodLiteral,...Z8(_)})};eq=class eq extends k8{_parse(q){if(typeof q.data!=="string"){let _=this._getOrReturnCtx(q),j=this._def.values;return F(_,{expected:h8.joinValues(j),received:_.parsedType,code:t.invalid_type}),v8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(q.data)){let _=this._getOrReturnCtx(q),j=this._def.values;return F(_,{received:_.data,code:t.invalid_enum_value,options:j}),v8}return D6(q.data)}get options(){return this._def.values}get enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Values(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}extract(q,_=this._def){return eq.create(q,{...this._def,..._})}exclude(q,_=this._def){return eq.create(this.options.filter((j)=>!q.includes(j)),{...this._def,..._})}};eq.create=e5;e_=class e_ extends k8{_parse(q){let _=h8.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(q);if(j.parsedType!==s.string&&j.parsedType!==s.number){let K=h8.objectValues(_);return F(j,{expected:h8.joinValues(K),received:j.parsedType,code:t.invalid_type}),v8}if(!this._cache)this._cache=new Set(h8.getValidEnumValues(this._def.values));if(!this._cache.has(q.data)){let K=h8.objectValues(_);return F(j,{received:j.data,code:t.invalid_enum_value,options:K}),v8}return D6(q.data)}get enum(){return this._def.values}};e_.create=(q,_)=>{return new e_({values:q,typeName:W8.ZodNativeEnum,...Z8(_)})};v_=class v_ extends k8{unwrap(){return this._def.type}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==s.promise&&_.common.async===!1)return F(_,{code:t.invalid_type,expected:s.promise,received:_.parsedType}),v8;let j=_.parsedType===s.promise?_.data:Promise.resolve(_.data);return D6(j.then((K)=>{return this._def.type.parseAsync(K,{path:_.path,errorMap:_.common.contextualErrorMap})}))}};v_.create=(q,_)=>{return new v_({type:q,typeName:W8.ZodPromise,...Z8(_)})};B6=class B6 extends k8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===W8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=this._def.effect||null,Y={addIssue:(f)=>{if(F(j,f),f.fatal)_.abort();else _.dirty()},get path(){return j.path}};if(Y.addIssue=Y.addIssue.bind(Y),K.type==="preprocess"){let f=K.transform(j.data,Y);if(j.common.async)return Promise.resolve(f).then(async(P)=>{if(_.value==="aborted")return v8;let $=await this._def.schema._parseAsync({data:P,path:j.path,parent:j});if($.status==="aborted")return v8;if($.status==="dirty")return l_($.value);if(_.value==="dirty")return l_($.value);return $});else{if(_.value==="aborted")return v8;let P=this._def.schema._parseSync({data:f,path:j.path,parent:j});if(P.status==="aborted")return v8;if(P.status==="dirty")return l_(P.value);if(_.value==="dirty")return l_(P.value);return P}}if(K.type==="refinement"){let f=(P)=>{let $=K.refinement(P,Y);if(j.common.async)return Promise.resolve($);if($ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return P};if(j.common.async===!1){let P=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(P.status==="aborted")return v8;if(P.status==="dirty")_.dirty();return f(P.value),{status:_.value,value:P.value}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((P)=>{if(P.status==="aborted")return v8;if(P.status==="dirty")_.dirty();return f(P.value).then(()=>{return{status:_.value,value:P.value}})})}if(K.type==="transform")if(j.common.async===!1){let f=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!$_(f))return v8;let P=K.transform(f.value,Y);if(P instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:P}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((f)=>{if(!$_(f))return v8;return Promise.resolve(K.transform(f.value,Y)).then((P)=>({status:_.value,value:P}))});h8.assertNever(K)}};B6.create=(q,_,j)=>{return new B6({schema:q,typeName:W8.ZodEffects,effect:_,...Z8(j)})};B6.createWithPreprocess=(q,_,j)=>{return new B6({schema:_,effect:{type:"preprocess",transform:q},typeName:W8.ZodEffects,...Z8(j)})};$q=class $q extends k8{_parse(q){if(this._getType(q)===s.undefined)return D6(void 0);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};$q.create=(q,_)=>{return new $q({innerType:q,typeName:W8.ZodOptional,...Z8(_)})};Iq=class Iq extends k8{_parse(q){if(this._getType(q)===s.null)return D6(null);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};Iq.create=(q,_)=>{return new Iq({innerType:q,typeName:W8.ZodNullable,...Z8(_)})};F_=class F_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;if(_.parsedType===s.undefined)j=this._def.defaultValue();return this._def.innerType._parse({data:j,path:_.path,parent:_})}removeDefault(){return this._def.innerType}};F_.create=(q,_)=>{return new F_({innerType:q,typeName:W8.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...Z8(_)})};U_=class U_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j={..._,common:{..._.common,issues:[]}},K=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});if(IK(K))return K.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new y6(j.common.issues)},input:j.data})}});else return{status:"valid",value:K.status==="valid"?K.value:this._def.catchValue({get error(){return new y6(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}};U_.create=(q,_)=>{return new U_({innerType:q,typeName:W8.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...Z8(_)})};LK=class LK extends k8{_parse(q){if(this._getType(q)!==s.nan){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:s.nan,received:j.parsedType}),v8}return{status:"valid",value:q.data}}};LK.create=(q)=>{return new LK({typeName:W8.ZodNaN,...Z8(q)})};Mz=Symbol("zod_brand");x3=class x3 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};lK=class lK extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});if(Y.status==="aborted")return v8;if(Y.status==="dirty")return _.dirty(),l_(Y.value);else return this._def.out._parseAsync({data:Y.value,path:j.path,parent:j})})();else{let K=this._def.in._parseSync({data:j.data,path:j.path,parent:j});if(K.status==="aborted")return v8;if(K.status==="dirty")return _.dirty(),{status:"dirty",value:K.value};else return this._def.out._parseSync({data:K.value,path:j.path,parent:j})}}static create(q,_){return new lK({in:q,out:_,typeName:W8.ZodPipeline})}};s_=class s_ extends k8{_parse(q){let _=this._def.innerType._parse(q),j=(K)=>{if($_(K))K.value=Object.freeze(K.value);return K};return IK(_)?_.then((K)=>j(K)):j(_)}unwrap(){return this._def.innerType}};s_.create=(q,_)=>{return new s_({innerType:q,typeName:W8.ZodReadonly,...Z8(_)})};Nz={object:i8.lazycreate};(function(q){q.ZodString="ZodString",q.ZodNumber="ZodNumber",q.ZodNaN="ZodNaN",q.ZodBigInt="ZodBigInt",q.ZodBoolean="ZodBoolean",q.ZodDate="ZodDate",q.ZodSymbol="ZodSymbol",q.ZodUndefined="ZodUndefined",q.ZodNull="ZodNull",q.ZodAny="ZodAny",q.ZodUnknown="ZodUnknown",q.ZodNever="ZodNever",q.ZodVoid="ZodVoid",q.ZodArray="ZodArray",q.ZodObject="ZodObject",q.ZodUnion="ZodUnion",q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",q.ZodIntersection="ZodIntersection",q.ZodTuple="ZodTuple",q.ZodRecord="ZodRecord",q.ZodMap="ZodMap",q.ZodSet="ZodSet",q.ZodFunction="ZodFunction",q.ZodLazy="ZodLazy",q.ZodLiteral="ZodLiteral",q.ZodEnum="ZodEnum",q.ZodEffects="ZodEffects",q.ZodNativeEnum="ZodNativeEnum",q.ZodOptional="ZodOptional",q.ZodNullable="ZodNullable",q.ZodDefault="ZodDefault",q.ZodCatch="ZodCatch",q.ZodPromise="ZodPromise",q.ZodBranded="ZodBranded",q.ZodPipeline="ZodPipeline",q.ZodReadonly="ZodReadonly"})(W8||(W8={}));U5=Yq.create,s5=Bq.create,Sz=LK.create,Ez=tq.create,Q5=c_.create,Rz=w_.create,mz=gK.create,Iz=r_.create,gz=i_.create,yz=O_.create,dz=aq.create,pz=Xq.create,Lz=yK.create,lz=fq.create,xz=i8.create,nz=i8.strictCreate,cz=o_.create,rz=l3.create,iz=a_.create,oz=Aq.create,az=dK.create,Bz=pK.create,tz=z_.create,ez=x_.create,Fz=B_.create,Uz=t_.create,sz=eq.create,Qz=e_.create,qv=v_.create,g5=B6.create,_v=$q.create,Kv=Iq.create,jv=B6.createWithPreprocess,Pv=lK.create,wv={string:(q)=>Yq.create({...q,coerce:!0}),number:(q)=>Bq.create({...q,coerce:!0}),boolean:(q)=>c_.create({...q,coerce:!0}),bigint:(q)=>tq.create({...q,coerce:!0}),date:(q)=>w_.create({...q,coerce:!0})},Ov=v8,q1=k.union([k.string(),k.number().int()]),_1=k.string(),zv=k.object({progressToken:k.optional(q1)}).passthrough(),t6=k.object({_meta:k.optional(zv)}).passthrough(),S6=k.object({method:k.string(),params:k.optional(t6)}),xK=k.object({_meta:k.optional(k.object({}).passthrough())}).passthrough(),Gq=k.object({method:k.string(),params:k.optional(xK)}),e6=k.object({_meta:k.optional(k.object({}).passthrough())}).passthrough(),c3=k.union([k.string(),k.number().int()]),vv=k.object({jsonrpc:k.literal(n3),id:c3}).merge(S6).strict(),Wv=k.object({jsonrpc:k.literal(n3)}).merge(Gq).strict(),Hv=k.object({jsonrpc:k.literal(n3),id:c3,result:e6}).strict();(function(q){q[q.ConnectionClosed=-32000]="ConnectionClosed",q[q.RequestTimeout=-32001]="RequestTimeout",q[q.ParseError=-32700]="ParseError",q[q.InvalidRequest=-32600]="InvalidRequest",q[q.MethodNotFound=-32601]="MethodNotFound",q[q.InvalidParams=-32602]="InvalidParams",q[q.InternalError=-32603]="InternalError"})(y5||(y5={}));Jv=k.object({jsonrpc:k.literal(n3),id:c3,error:k.object({code:k.number().int(),message:k.string(),data:k.optional(k.unknown())})}).strict(),wC=k.union([vv,Wv,Hv,Jv]),K1=e6.strict(),j1=Gq.extend({method:k.literal("notifications/cancelled"),params:xK.extend({requestId:c3,reason:k.string().optional()})}),nK=k.object({name:k.string(),title:k.optional(k.string())}).passthrough(),P1=nK.extend({version:k.string()}),Tv=k.object({experimental:k.optional(k.object({}).passthrough()),sampling:k.optional(k.object({}).passthrough()),elicitation:k.optional(k.object({}).passthrough()),roots:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough())}).passthrough(),Zv=S6.extend({method:k.literal("initialize"),params:t6.extend({protocolVersion:k.string(),capabilities:Tv,clientInfo:P1})}),kv=k.object({experimental:k.optional(k.object({}).passthrough()),logging:k.optional(k.object({}).passthrough()),completions:k.optional(k.object({}).passthrough()),prompts:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough()),resources:k.optional(k.object({subscribe:k.optional(k.boolean()),listChanged:k.optional(k.boolean())}).passthrough()),tools:k.optional(k.object({listChanged:k.optional(k.boolean())}).passthrough())}).passthrough(),Xv=e6.extend({protocolVersion:k.string(),capabilities:kv,serverInfo:P1,instructions:k.optional(k.string())}),Av=Gq.extend({method:k.literal("notifications/initialized")}),Y1=S6.extend({method:k.literal("ping")}),Gv=k.object({progress:k.number(),total:k.optional(k.number()),message:k.optional(k.string())}).passthrough(),f1=Gq.extend({method:k.literal("notifications/progress"),params:xK.merge(Gv).extend({progressToken:q1})}),r3=S6.extend({params:t6.extend({cursor:k.optional(_1)}).optional()}),i3=e6.extend({nextCursor:k.optional(_1)}),$1=k.object({uri:k.string(),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}).passthrough(),w1=$1.extend({text:k.string()}),u4=k.string().refine((q)=>{try{return atob(q),!0}catch(_){return!1}},{message:"Invalid Base64 string"}),O1=$1.extend({blob:u4}),z1=nK.extend({uri:k.string(),description:k.optional(k.string()),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}),uv=nK.extend({uriTemplate:k.string(),description:k.optional(k.string()),mimeType:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}),hv=r3.extend({method:k.literal("resources/list")}),Dv=i3.extend({resources:k.array(z1)}),Cv=r3.extend({method:k.literal("resources/templates/list")}),Vv=i3.extend({resourceTemplates:k.array(uv)}),Mv=S6.extend({method:k.literal("resources/read"),params:t6.extend({uri:k.string()})}),Nv=e6.extend({contents:k.array(k.union([w1,O1]))}),bv=Gq.extend({method:k.literal("notifications/resources/list_changed")}),Sv=S6.extend({method:k.literal("resources/subscribe"),params:t6.extend({uri:k.string()})}),Ev=S6.extend({method:k.literal("resources/unsubscribe"),params:t6.extend({uri:k.string()})}),Rv=Gq.extend({method:k.literal("notifications/resources/updated"),params:xK.extend({uri:k.string()})}),mv=k.object({name:k.string(),description:k.optional(k.string()),required:k.optional(k.boolean())}).passthrough(),Iv=nK.extend({description:k.optional(k.string()),arguments:k.optional(k.array(mv)),_meta:k.optional(k.object({}).passthrough())}),gv=r3.extend({method:k.literal("prompts/list")}),yv=i3.extend({prompts:k.array(Iv)}),dv=S6.extend({method:k.literal("prompts/get"),params:t6.extend({name:k.string(),arguments:k.optional(k.record(k.string()))})}),h4=k.object({type:k.literal("text"),text:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),D4=k.object({type:k.literal("image"),data:u4,mimeType:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),C4=k.object({type:k.literal("audio"),data:u4,mimeType:k.string(),_meta:k.optional(k.object({}).passthrough())}).passthrough(),pv=k.object({type:k.literal("resource"),resource:k.union([w1,O1]),_meta:k.optional(k.object({}).passthrough())}).passthrough(),Lv=z1.extend({type:k.literal("resource_link")}),v1=k.union([h4,D4,C4,Lv,pv]),lv=k.object({role:k.enum(["user","assistant"]),content:v1}).passthrough(),xv=e6.extend({description:k.optional(k.string()),messages:k.array(lv)}),nv=Gq.extend({method:k.literal("notifications/prompts/list_changed")}),cv=k.object({title:k.optional(k.string()),readOnlyHint:k.optional(k.boolean()),destructiveHint:k.optional(k.boolean()),idempotentHint:k.optional(k.boolean()),openWorldHint:k.optional(k.boolean())}).passthrough(),rv=nK.extend({description:k.optional(k.string()),inputSchema:k.object({type:k.literal("object"),properties:k.optional(k.object({}).passthrough()),required:k.optional(k.array(k.string()))}).passthrough(),outputSchema:k.optional(k.object({type:k.literal("object"),properties:k.optional(k.object({}).passthrough()),required:k.optional(k.array(k.string()))}).passthrough()),annotations:k.optional(cv),_meta:k.optional(k.object({}).passthrough())}),iv=r3.extend({method:k.literal("tools/list")}),ov=i3.extend({tools:k.array(rv)}),W1=e6.extend({content:k.array(v1).default([]),structuredContent:k.object({}).passthrough().optional(),isError:k.optional(k.boolean())}),OC=W1.or(e6.extend({toolResult:k.unknown()})),av=S6.extend({method:k.literal("tools/call"),params:t6.extend({name:k.string(),arguments:k.optional(k.record(k.unknown()))})}),Bv=Gq.extend({method:k.literal("notifications/tools/list_changed")}),H1=k.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),tv=S6.extend({method:k.literal("logging/setLevel"),params:t6.extend({level:H1})}),ev=Gq.extend({method:k.literal("notifications/message"),params:xK.extend({level:H1,logger:k.optional(k.string()),data:k.unknown()})}),Fv=k.object({name:k.string().optional()}).passthrough(),Uv=k.object({hints:k.optional(k.array(Fv)),costPriority:k.optional(k.number().min(0).max(1)),speedPriority:k.optional(k.number().min(0).max(1)),intelligencePriority:k.optional(k.number().min(0).max(1))}).passthrough(),sv=k.object({role:k.enum(["user","assistant"]),content:k.union([h4,D4,C4])}).passthrough(),Qv=S6.extend({method:k.literal("sampling/createMessage"),params:t6.extend({messages:k.array(sv),systemPrompt:k.optional(k.string()),includeContext:k.optional(k.enum(["none","thisServer","allServers"])),temperature:k.optional(k.number()),maxTokens:k.number().int(),stopSequences:k.optional(k.array(k.string())),metadata:k.optional(k.object({}).passthrough()),modelPreferences:k.optional(Uv)})}),qW=e6.extend({model:k.string(),stopReason:k.optional(k.enum(["endTurn","stopSequence","maxTokens"]).or(k.string())),role:k.enum(["user","assistant"]),content:k.discriminatedUnion("type",[h4,D4,C4])}),_W=k.object({type:k.literal("boolean"),title:k.optional(k.string()),description:k.optional(k.string()),default:k.optional(k.boolean())}).passthrough(),KW=k.object({type:k.literal("string"),title:k.optional(k.string()),description:k.optional(k.string()),minLength:k.optional(k.number()),maxLength:k.optional(k.number()),format:k.optional(k.enum(["email","uri","date","date-time"]))}).passthrough(),jW=k.object({type:k.enum(["number","integer"]),title:k.optional(k.string()),description:k.optional(k.string()),minimum:k.optional(k.number()),maximum:k.optional(k.number())}).passthrough(),PW=k.object({type:k.literal("string"),title:k.optional(k.string()),description:k.optional(k.string()),enum:k.array(k.string()),enumNames:k.optional(k.array(k.string()))}).passthrough(),YW=k.union([_W,KW,jW,PW]),fW=S6.extend({method:k.literal("elicitation/create"),params:t6.extend({message:k.string(),requestedSchema:k.object({type:k.literal("object"),properties:k.record(k.string(),YW),required:k.optional(k.array(k.string()))}).passthrough()})}),$W=e6.extend({action:k.enum(["accept","decline","cancel"]),content:k.optional(k.record(k.string(),k.unknown()))}),wW=k.object({type:k.literal("ref/resource"),uri:k.string()}).passthrough(),OW=k.object({type:k.literal("ref/prompt"),name:k.string()}).passthrough(),zW=S6.extend({method:k.literal("completion/complete"),params:t6.extend({ref:k.union([OW,wW]),argument:k.object({name:k.string(),value:k.string()}).passthrough(),context:k.optional(k.object({arguments:k.optional(k.record(k.string(),k.string()))}))})}),vW=e6.extend({completion:k.object({values:k.array(k.string()).max(100),total:k.optional(k.number().int()),hasMore:k.optional(k.boolean())}).passthrough()}),WW=k.object({uri:k.string().startsWith("file://"),name:k.optional(k.string()),_meta:k.optional(k.object({}).passthrough())}).passthrough(),HW=S6.extend({method:k.literal("roots/list")}),JW=e6.extend({roots:k.array(WW)}),TW=Gq.extend({method:k.literal("notifications/roots/list_changed")}),zC=k.union([Y1,Zv,zW,tv,dv,gv,hv,Cv,Mv,Sv,Ev,av,iv]),vC=k.union([j1,f1,Av,TW]),WC=k.union([K1,qW,$W,JW]),HC=k.union([Y1,Qv,fW,HW]),JC=k.union([j1,f1,ev,Rv,bv,Bv,nv]),TC=k.union([K1,Xv,vW,xv,yv,Dv,Vv,Nv,W1,ov]),ZC=zO(oO(),1),kC=Symbol("Let zodToJsonSchema decide on which parser to use"),XC=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");(function(q){q.Completable="McpCompletable"})(Z4||(Z4={}));k4=class k4 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};k4.create=(q,_)=>{return new k4({type:q,typeName:Z4.Completable,complete:_.complete,...ZW(_)})}});var J1={};EK(J1,{version:()=>AW,type:()=>uW,scripts:()=>DW,repository:()=>NW,publishConfig:()=>EW,name:()=>XW,main:()=>hW,license:()=>MW,keywords:()=>CW,homepage:()=>bW,files:()=>yW,engines:()=>IW,devDependencies:()=>mW,description:()=>GW,dependencies:()=>RW,default:()=>dW,bugs:()=>SW,bin:()=>gW,author:()=>VW});var XW="claude-mem",AW="3.6.4",GW="Memory compression system for Claude Code - persist context across sessions",uW="module",hW="claude-mem",DW,CW,VW="Alex Newman",MW="SEE LICENSE IN LICENSE",NW,bW="https://github.com/thedotmack/claude-mem#readme",SW,EW,RW,mW,IW,gW,yW,dW;var T1=f6(()=>{DW={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall",build:"./scripts/build-minified.sh","test:watch":"npm test -- --watch",lint:"eslint 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","build:npm":"./scripts/npm-publish.sh",publish:"./scripts/publish-with-changelog.sh","publish:latest":"./scripts/publish-with-changelog.sh bump","publish:github":"./scripts/github-publish.sh"},CW=["claude","claude-code","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],NW={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},SW={url:"https://github.com/thedotmack/claude-mem/issues"},EW={access:"public",registry:"https://registry.npmjs.org/"},RW={"@anthropic-ai/claude-code":"^1.0.88","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^0.5.0",boxen:"^8.0.1",chalk:"^5.6.0",chromadb:"^3.0.14",commander:"^14.0.0",cors:"^2.8.5",express:"^5.1.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8",http:"^0.0.1-security","oh-my-logo":"^0.3.2",open:"^10.2.0"},mW={"@types/chai":"^4.3.0","@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0",chai:"^4.3.0",eslint:"^8.0.0",prettier:"^3.0.0","ts-node":"^10.0.0",tsx:"^4.20.5",typescript:"^5.0.0"},IW={node:">=18.0.0",bun:">=1.0.0"},gW={"claude-mem":"dist/claude-mem.min.js"},yW=["dist","hooks","commands","docs","src","CHANGELOG.md"],dW={name:XW,version:AW,description:GW,type:uW,main:hW,scripts:DW,keywords:CW,author:VW,license:MW,repository:NW,homepage:bW,bugs:SW,publishConfig:EW,dependencies:RW,devDependencies:mW,engines:IW,bin:gW,files:yW}});import{join as F8,dirname as a3,sep as pW}from"path";import{homedir as V4}from"os";import{existsSync as cK,statSync as LW}from"fs";import{execSync as lW}from"child_process";import{fileURLToPath as xW}from"url";class $8{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!$8.instance)$8.instance=new $8;return $8.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||F8(V4(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return F8(this.getDataDirectory(),"archives")}getHooksDirectory(){return F8(this.getDataDirectory(),"hooks")}getLogsDirectory(){return F8(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return F8(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return F8(this.getDataDirectory(),"trash")}getBackupsDirectory(){return F8(this.getDataDirectory(),"backups")}getChromaDirectory(){return F8(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(q){return F8(this.getArchivesDirectory(),q)}getUserSettingsPath(){return F8(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||F8(V4(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return F8(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return F8(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return F8(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return F8(V4(),".claude.json")}getProjectMcpConfigPath(){return F8(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let j=h6.resolve("/Users/alexnewman/Scripts/claude-mem-source/package.json");return this._packageRoot=a3(j),this._packageRoot}catch{}let q=xW(import.meta.url),_=a3(q);for(let j=0;j<10;j++){let K=F8(_,"package.json");if(cK(K))try{if(h6(K).name==="claude-mem")return this._packageRoot=_,this._packageRoot}catch{}let Y=a3(_);if(Y===_)break;_=Y}try{let j=lW("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),K=JSON.parse(j);if(K.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=a3(K.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHooksDirectory(){let q=this.getPackageRoot(),_=F8(q,"hooks"),j=["pre-compact.js","session-start.js"];for(let K of j)if(!cK(F8(_,K)))throw new Error(`Package hooks directory missing required file: ${K}`);return _}findPackageCommandsDirectory(){let q=this.getPackageRoot(),_=F8(q,"commands"),j=["save.md"];for(let K of j)if(!cK(F8(_,K)))throw new Error(`Package commands directory missing required file: ${K}`);return _}ensureDirectory(q){if(!cK(q))h6("fs").mkdirSync(q,{recursive:!0})}ensureDirectories(q){q.forEach((_)=>this.ensureDirectory(_))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(q){let _=q.split(pW),j=["src","lib","app","project","workspace"];for(let K=_.length-1;K>=0;K--)if(j.includes(_[K])&&K>0)return _[K-1];if(_.length>1)return _[_.length-2];return"unknown-project"}static getCurrentProjectName(){return h6("path").basename(process.cwd())}static createBackupFilename(q){let _=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${q}.backup.${_}`}static isPathAccessible(q){try{return cK(q)&&LW(q).isDirectory()}catch{return!1}}static getDataDirectory(){return $8.getInstance().getDataDirectory()}static getArchivesDirectory(){return $8.getInstance().getArchivesDirectory()}static getHooksDirectory(){return $8.getInstance().getHooksDirectory()}static getLogsDirectory(){return $8.getInstance().getLogsDirectory()}static getClaudeSettingsPath(){return $8.getInstance().getClaudeSettingsPath()}static getClaudeMdPath(){return $8.getInstance().getClaudeMdPath()}static findPackageHooksDirectory(){return $8.getInstance().findPackageHooksDirectory()}static findPackageCommandsDirectory(){return $8.getInstance().findPackageCommandsDirectory()}}var VC;var d6=f6(()=>{VC=$8.getInstance()});class yq{pathDiscovery;constructor(){this.pathDiscovery=$8.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(q){return this.pathDiscovery.getProjectArchiveDirectory(q)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(q){$8.getInstance().ensureDirectory(q)}static ensureDirectories(q){$8.getInstance().ensureDirectories(q)}static extractProjectName(q){return $8.extractProjectName(q)}static getCurrentProjectPrefix(){return $8.getCurrentProjectName()}static getCurrentProjectName(){return $8.getCurrentProjectName()}}var M4=f6(()=>{d6()});var C6=_8((UW)=>{UW.__esModule=!0;UW.extend=Z1;UW.indexOf=oW;UW.escapeExpression=aW;UW.isEmpty=BW;UW.createFrame=tW;UW.blockParams=eW;UW.appendContextPath=FW;var nW={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},cW=/[&<>"'`=]/g,rW=/[&<>"'`=]/;function iW(q){return nW[q]}function Z1(q){for(var _=1;_<arguments.length;_++)for(var j in arguments[_])if(Object.prototype.hasOwnProperty.call(arguments[_],j))q[j]=arguments[_][j];return q}var b4=Object.prototype.toString;UW.toString=b4;var N4=function q(_){return typeof _==="function"};if(N4(/x/))UW.isFunction=N4=function(q){return typeof q==="function"&&b4.call(q)==="[object Function]"};UW.isFunction=N4;var k1=Array.isArray||function(q){return q&&typeof q==="object"?b4.call(q)==="[object Array]":!1};UW.isArray=k1;function oW(q,_){for(var j=0,K=q.length;j<K;j++)if(q[j]===_)return j;return-1}function aW(q){if(typeof q!=="string"){if(q&&q.toHTML)return q.toHTML();else if(q==null)return"";else if(!q)return q+"";q=""+q}if(!rW.test(q))return q;return q.replace(cW,iW)}function BW(q){if(!q&&q!==0)return!0;else if(k1(q)&&q.length===0)return!0;else return!1}function tW(q){var _=Z1({},q);return _._parent=q,_}function eW(q,_){return q.path=_,q}function FW(q,_){return(q?q+".":"")+_}});var F6=_8((X1,A1)=>{X1.__esModule=!0;var S4=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function E4(q,_){var j=_&&_.loc,K=void 0,Y=void 0,f=void 0,P=void 0;if(j)K=j.start.line,Y=j.end.line,f=j.start.column,P=j.end.column,q+=" - "+K+":"+f;var $=Error.prototype.constructor.call(this,q);for(var w=0;w<S4.length;w++)this[S4[w]]=$[S4[w]];if(Error.captureStackTrace)Error.captureStackTrace(this,E4);try{if(j)if(this.lineNumber=K,this.endLineNumber=Y,Object.defineProperty)Object.defineProperty(this,"column",{value:f,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:P,enumerable:!0});else this.column=f,this.endColumn=P}catch(O){}}E4.prototype=new Error;X1.default=E4;A1.exports=X1.default});var h1=_8((G1,u1)=>{G1.__esModule=!0;var R4=C6();G1.default=function(q){q.registerHelper("blockHelperMissing",function(_,j){var{inverse:K,fn:Y}=j;if(_===!0)return Y(this);else if(_===!1||_==null)return K(this);else if(R4.isArray(_))if(_.length>0){if(j.ids)j.ids=[j.name];return q.helpers.each(_,j)}else return K(this);else{if(j.data&&j.ids){var f=R4.createFrame(j.data);f.contextPath=R4.appendContextPath(j.data.contextPath,j.name),j={data:f}}return Y(_,j)}})};u1.exports=G1.default});var V1=_8((D1,C1)=>{D1.__esModule=!0;function HH(q){return q&&q.__esModule?q:{default:q}}var rK=C6(),JH=F6(),TH=HH(JH);D1.default=function(q){q.registerHelper("each",function(_,j){if(!j)throw new TH.default("Must pass iterator to #each");var{fn:K,inverse:Y}=j,f=0,P="",$=void 0,w=void 0;if(j.data&&j.ids)w=rK.appendContextPath(j.data.contextPath,j.ids[0])+".";if(rK.isFunction(_))_=_.call(this);if(j.data)$=rK.createFrame(j.data);function O(T,H,X){if($){if($.key=T,$.index=H,$.first=H===0,$.last=!!X,w)$.contextPath=w+T}P=P+K(_[T],{data:$,blockParams:rK.blockParams([_[T],T],[w+T,null])})}if(_&&typeof _==="object")if(rK.isArray(_)){for(var v=_.length;f<v;f++)if(f in _)O(f,f,f===_.length-1)}else if(typeof Symbol==="function"&&_[Symbol.iterator]){var z=[],W=_[Symbol.iterator]();for(var J=W.next();!J.done;J=W.next())z.push(J.value);_=z;for(var v=_.length;f<v;f++)O(f,f,f===_.length-1)}else(function(){var T=void 0;if(Object.keys(_).forEach(function(H){if(T!==void 0)O(T,f-1);T=H,f++}),T!==void 0)O(T,f-1,!0)})();if(f===0)P=Y(this);return P})};C1.exports=D1.default});var b1=_8((M1,N1)=>{M1.__esModule=!0;function XH(q){return q&&q.__esModule?q:{default:q}}var AH=F6(),GH=XH(AH);M1.default=function(q){q.registerHelper("helperMissing",function(){if(arguments.length===1)return;else throw new GH.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};N1.exports=M1.default});var I1=_8((R1,m1)=>{R1.__esModule=!0;function DH(q){return q&&q.__esModule?q:{default:q}}var S1=C6(),CH=F6(),E1=DH(CH);R1.default=function(q){q.registerHelper("if",function(_,j){if(arguments.length!=2)throw new E1.default("#if requires exactly one argument");if(S1.isFunction(_))_=_.call(this);if(!j.hash.includeZero&&!_||S1.isEmpty(_))return j.inverse(this);else return j.fn(this)}),q.registerHelper("unless",function(_,j){if(arguments.length!=2)throw new E1.default("#unless requires exactly one argument");return q.helpers.if.call(this,_,{fn:j.inverse,inverse:j.fn,hash:j.hash})})};m1.exports=R1.default});var d1=_8((g1,y1)=>{g1.__esModule=!0;g1.default=function(q){q.registerHelper("log",function(){var _=[void 0],j=arguments[arguments.length-1];for(var K=0;K<arguments.length-1;K++)_.push(arguments[K]);var Y=1;if(j.hash.level!=null)Y=j.hash.level;else if(j.data&&j.data.level!=null)Y=j.data.level;_[0]=Y,q.log.apply(q,_)})};y1.exports=g1.default});var l1=_8((p1,L1)=>{p1.__esModule=!0;p1.default=function(q){q.registerHelper("lookup",function(_,j,K){if(!_)return _;return K.lookupProperty(_,j)})};L1.exports=p1.default});var c1=_8((x1,n1)=>{x1.__esModule=!0;function RH(q){return q&&q.__esModule?q:{default:q}}var iK=C6(),mH=F6(),IH=RH(mH);x1.default=function(q){q.registerHelper("with",function(_,j){if(arguments.length!=2)throw new IH.default("#with requires exactly one argument");if(iK.isFunction(_))_=_.call(this);var K=j.fn;if(!iK.isEmpty(_)){var Y=j.data;if(j.data&&j.ids)Y=iK.createFrame(j.data),Y.contextPath=iK.appendContextPath(j.data.contextPath,j.ids[0]);return K(_,{data:Y,blockParams:iK.blockParams([_],[Y&&Y.contextPath])})}else return j.inverse(this)})};n1.exports=x1.default});var m4=_8((sH)=>{sH.__esModule=!0;sH.registerDefaultHelpers=FH;sH.moveHelperToHooks=UH;function W_(q){return q&&q.__esModule?q:{default:q}}var dH=h1(),pH=W_(dH),LH=V1(),lH=W_(LH),xH=b1(),nH=W_(xH),cH=I1(),rH=W_(cH),iH=d1(),oH=W_(iH),aH=l1(),BH=W_(aH),tH=c1(),eH=W_(tH);function FH(q){pH.default(q),lH.default(q),nH.default(q),rH.default(q),oH.default(q),BH.default(q),eH.default(q)}function UH(q,_,j){if(q.helpers[_]){if(q.hooks[_]=q.helpers[_],!j)delete q.helpers[_]}}});var o1=_8((r1,i1)=>{r1.__esModule=!0;var KJ=C6();r1.default=function(q){q.registerDecorator("inline",function(_,j,K,Y){var f=_;if(!j.partials)j.partials={},f=function(P,$){var w=K.partials;K.partials=KJ.extend({},w,j.partials);var O=_(P,$);return K.partials=w,O};return j.partials[Y.args[0]]=Y.fn,f})};i1.exports=r1.default});var a1=_8((OJ)=>{OJ.__esModule=!0;OJ.registerDefaultDecorators=wJ;function YJ(q){return q&&q.__esModule?q:{default:q}}var fJ=o1(),$J=YJ(fJ);function wJ(q){$J.default(q)}});var I4=_8((B1,t1)=>{B1.__esModule=!0;var WJ=C6(),qK={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function q(_){if(typeof _==="string"){var j=WJ.indexOf(qK.methodMap,_.toLowerCase());if(j>=0)_=j;else _=parseInt(_,10)}return _},log:function q(_){if(_=qK.lookupLevel(_),typeof console!=="undefined"&&qK.lookupLevel(qK.level)<=_){var j=qK.methodMap[_];if(!console[j])j="log";for(var K=arguments.length,Y=Array(K>1?K-1:0),f=1;f<K;f++)Y[f-1]=arguments[f];console[j].apply(console,Y)}}};B1.default=qK;t1.exports=B1.default});var e1=_8((kJ)=>{kJ.__esModule=!0;kJ.createNewLookupObject=ZJ;var TJ=C6();function ZJ(){for(var q=arguments.length,_=Array(q),j=0;j<q;j++)_[j]=arguments[j];return TJ.extend.apply(void 0,[Object.create(null)].concat(_))}});var g4=_8((NJ)=>{NJ.__esModule=!0;NJ.createProtoAccessControl=DJ;NJ.resultIsAllowed=CJ;NJ.resetLoggedProperties=MJ;function GJ(q){return q&&q.__esModule?q:{default:q}}var F1=e1(),uJ=I4(),hJ=GJ(uJ),B3=Object.create(null);function DJ(q){var _=Object.create(null);_.constructor=!1,_.__defineGetter__=!1,_.__defineSetter__=!1,_.__lookupGetter__=!1;var j=Object.create(null);return j.__proto__=!1,{properties:{whitelist:F1.createNewLookupObject(j,q.allowedProtoProperties),defaultValue:q.allowProtoPropertiesByDefault},methods:{whitelist:F1.createNewLookupObject(_,q.allowedProtoMethods),defaultValue:q.allowProtoMethodsByDefault}}}function CJ(q,_,j){if(typeof q==="function")return U1(_.methods,j);else return U1(_.properties,j)}function U1(q,_){if(q.whitelist[_]!==void 0)return q.whitelist[_]===!0;if(q.defaultValue!==void 0)return q.defaultValue;return VJ(_),!1}function VJ(q){if(B3[q]!==!0)B3[q]=!0,hJ.default.log("error",'Handlebars: Access has been denied to resolve the property "'+q+`" because it is not an "own property" of its parent.
|
|
41
41
|
You can add a runtime option to disable the check or this warning:
|
|
42
42
|
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`)}function MJ(){Object.keys(B3).forEach(function(q){delete B3[q]})}});var e3=_8((cJ)=>{cJ.__esModule=!0;cJ.HandlebarsEnvironment=p4;function s1(q){return q&&q.__esModule?q:{default:q}}var H_=C6(),mJ=F6(),y4=s1(mJ),IJ=m4(),gJ=a1(),yJ=I4(),t3=s1(yJ),dJ=g4(),pJ="4.7.8";cJ.VERSION=pJ;var LJ=8;cJ.COMPILER_REVISION=LJ;var lJ=7;cJ.LAST_COMPATIBLE_COMPILER_REVISION=lJ;var xJ={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};cJ.REVISION_CHANGES=xJ;var d4="[object Object]";function p4(q,_,j){this.helpers=q||{},this.partials=_||{},this.decorators=j||{},IJ.registerDefaultHelpers(this),gJ.registerDefaultDecorators(this)}p4.prototype={constructor:p4,logger:t3.default,log:t3.default.log,registerHelper:function q(_,j){if(H_.toString.call(_)===d4){if(j)throw new y4.default("Arg not supported with multiple helpers");H_.extend(this.helpers,_)}else this.helpers[_]=j},unregisterHelper:function q(_){delete this.helpers[_]},registerPartial:function q(_,j){if(H_.toString.call(_)===d4)H_.extend(this.partials,_);else{if(typeof j==="undefined")throw new y4.default('Attempting to register a partial called "'+_+'" as undefined');this.partials[_]=j}},unregisterPartial:function q(_){delete this.partials[_]},registerDecorator:function q(_,j){if(H_.toString.call(_)===d4){if(j)throw new y4.default("Arg not supported with multiple decorators");H_.extend(this.decorators,_)}else this.decorators[_]=j},unregisterDecorator:function q(_){delete this.decorators[_]},resetLoggedPropertyAccesses:function q(){dJ.resetLoggedProperties()}};var nJ=t3.default.log;cJ.log=nJ;cJ.createFrame=H_.createFrame;cJ.logger=t3.default});var _j=_8((Q1,qj)=>{Q1.__esModule=!0;function L4(q){this.string=q}L4.prototype.toString=L4.prototype.toHTML=function(){return""+this.string};Q1.default=L4;qj.exports=Q1.default});var Kj=_8((_T)=>{_T.__esModule=!0;_T.wrapHelper=qT;function qT(q,_){if(typeof q!=="function")return q;var j=function K(){var Y=arguments[arguments.length-1];return arguments[arguments.length-1]=_(Y),q.apply(this,arguments)};return j}});var $j=_8((ZT)=>{ZT.__esModule=!0;ZT.checkRevision=OT;ZT.template=zT;ZT.wrapProgram=F3;ZT.resolvePartial=vT;ZT.invokePartial=WT;ZT.noop=Yj;function PT(q){return q&&q.__esModule?q:{default:q}}function YT(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}var fT=C6(),dq=YT(fT),$T=F6(),pq=PT($T),Lq=e3(),jj=m4(),wT=Kj(),Pj=g4();function OT(q){var _=q&&q[0]||1,j=Lq.COMPILER_REVISION;if(_>=Lq.LAST_COMPATIBLE_COMPILER_REVISION&&_<=Lq.COMPILER_REVISION)return;if(_<Lq.LAST_COMPATIBLE_COMPILER_REVISION){var K=Lq.REVISION_CHANGES[j],Y=Lq.REVISION_CHANGES[_];throw new pq.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+K+") or downgrade your runtime to an older version ("+Y+").")}else throw new pq.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+q[1]+").")}function zT(q,_){if(!_)throw new pq.default("No environment passed to template");if(!q||!q.main)throw new pq.default("Unknown template object: "+typeof q);q.main.decorator=q.main_d,_.VM.checkRevision(q.compiler);var j=q.compiler&&q.compiler[0]===7;function K(P,$,w){if(w.hash){if($=dq.extend({},$,w.hash),w.ids)w.ids[0]=!0}P=_.VM.resolvePartial.call(this,P,$,w);var O=dq.extend({},w,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),v=_.VM.invokePartial.call(this,P,$,O);if(v==null&&_.compile)w.partials[w.name]=_.compile(P,q.compilerOptions,_),v=w.partials[w.name]($,O);if(v!=null){if(w.indent){var z=v.split(`
|
|
43
43
|
`);for(var W=0,J=z.length;W<J;W++){if(!z[W]&&W+1===J)break;z[W]=w.indent+z[W]}v=z.join(`
|
|
@@ -258,7 +258,7 @@ ${o.default.gray(sq)} ${q}
|
|
|
258
258
|
`).filter((z)=>z.trim());if(Y.length===0){if(q.format==="session-start")console.log(mK("NO_MEMORIES",q.project||"this project"));return}let f=[];for(let z of Y)try{if(!z.trim().startsWith("{"))continue;let W=JSON.parse(z);f.push(W)}catch(W){continue}if(f.length===0){if(q.format==="session-start")console.log(mK("NO_MEMORIES",q.project||"this project"));return}let P=f.filter((z)=>z.type==="memory"),$=f.filter((z)=>z.type==="overview"),w=f.filter((z)=>z.type==="session"),O=P,v=$;if(q.project)O=P.filter((z)=>z.project===q.project),v=$.filter((z)=>z.project===q.project);if(q.format==="session-start"){let z=O.slice(-10),W=v.slice(-5),J=[...z,...W],T="recently",H=J.map((X)=>{return X.timestamp?new Date(X.timestamp):null}).filter((X)=>X!==null).sort((X,A)=>A.getTime()-X.getTime());if(H.length>0)T=D5(H[0]);V5({projectName:q.project||"your project",memoryCount:z.length,lastSessionTime:T,recentObjects:J})}else if(q.format==="json"){let z=O.slice(-10),W=v.slice(-3),J=[...z,...W];console.log(JSON.stringify(J))}else{let z=O.slice(-10),W=v.slice(-3),J=z.length+W.length;console.log(d3("Context loading",J,"recent entries found")),z.forEach((T)=>{console.log(`${T.text} | ${T.document_id} | ${T.keywords}`)}),W.forEach((T)=>{console.log(`**Overview:** ${T.content}`)})}if(q.format!=="json"){let z=zu();if(!z.isEmpty){let W=Ou(z.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${z.folderCount} folders | ${z.fileCount} files | ${W} – use \`$ claude-mem restore\``),console.log("")}}}catch(K){let Y=K instanceof Error?K.message:String(K);if(q.format==="session-start")console.log(mK("CONNECTION_FAILED",Y));else console.log(d_("Context loading",Y,"Check file permissions and try again"))}}var T9=f6(()=>{d6();O4()});var S$={};EK(S$,{viewTrash:()=>WD});import{readdirSync as V$,statSync as M$}from"fs";import{join as N$}from"path";function vD(q){let _=q.lastIndexOf(".");if(_===-1)return{name:q,timestamp:0};let j=parseInt(q.substring(_+1));if(isNaN(j))return{name:q,timestamp:0};return{name:q.substring(0,_),timestamp:j}}function C$(q){if(q===0)return"0 B";let _=1024,j=["B","KB","MB","GB"],K=Math.floor(Math.log(q)/Math.log(_));return parseFloat((q/Math.pow(_,K)).toFixed(2))+" "+j[K]}function b$(q){let _=0,j=V$(q);for(let K of j){let Y=N$(q,K),f=M$(Y);if(f.isDirectory())_+=b$(Y);else _+=f.size}return _}async function WD(){let q=$8.getInstance().getTrashDirectory();try{let _=V$(q);if(_.length===0){K6.info("\uD83D\uDDD1️ Trash is empty");return}let j=_.map((P)=>{let $=N$(q,P),w=M$($),{name:O,timestamp:v}=vD(P),z=w.isDirectory()?b$($):w.size;return{originalName:O,trashedName:P,size:z,trashedAt:new Date(v),isDirectory:w.isDirectory()}});j.sort((P,$)=>$.trashedAt.getTime()-P.trashedAt.getTime()),console.log(`
|
|
259
259
|
\uD83D\uDDD1️ Trash Contents
|
|
260
260
|
`),console.log("─".repeat(80));let K=0,Y=0,f=0;for(let P of j){if(K+=P.size,P.isDirectory)Y++;else f++;let $=P.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",w=P.trashedAt.toLocaleString(),O=C$(P.size);console.log(`${$} ${P.originalName}`),console.log(` Size: ${O} | Trashed: ${w}`),console.log(` ID: ${P.trashedName}`),console.log()}console.log("─".repeat(80)),console.log(`Total: ${Y} folders, ${f} files (${C$(K)})`),console.log(`
|
|
261
|
-
To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(_){if(_.code==="ENOENT")K6.info("\uD83D\uDDD1️ Trash is empty");else K6.error("Failed to read trash directory"),console.error(_)}}var E$=f6(()=>{vK();d6()});var m$={};EK(m$,{emptyTrash:()=>kD});import{rmSync as HD,readdirSync as JD,existsSync as TD,statSync as ZD}from"fs";import{join as R$}from"path";async function kD(q={}){let _=$8.getInstance().getTrashDirectory();if(!TD(_)){K6.info("\uD83D\uDDD1️ Trash is already empty");return}try{let j=JD(_);if(j.length===0){K6.info("\uD83D\uDDD1️ Trash is already empty");return}let K=0,Y=0;for(let P of j){let $=R$(_,P);if(ZD($).isDirectory())K++;else Y++}if(!q.force){let P=await hq({message:`Permanently delete ${K} folders and ${Y} files from trash?`,initialValue:!1});if(L8(P)||!P){K6.info("Cancelled - trash not emptied");return}}let f=Qq();f.start("Emptying trash...");for(let P of j){let $=R$(_,P);HD($,{recursive:!0,force:!0})}f.stop(`\uD83D\uDDD1️ Trash emptied - permanently deleted ${K} folders and ${Y} files`)}catch(j){K6.error("Failed to empty trash"),console.error(j),process.exit(1)}}var I$=f6(()=>{vK();d6()});var o7={};EK(o7,{sessionStartHook:()=>AD,sessionEndHook:()=>GD,preCompactHook:()=>XD});import{basename as g$}from"path";async function XD(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{_=JSON.parse(q).transcript_path}catch(j){_=q.trim()}if(!_)_=process.env.TRANSCRIPT_PATH||process.argv[2];if(!_){console.log("\uD83D\uDDDC️ Compressing session transcript..."),console.log("❌ No transcript path provided to pre-compact hook"),console.log("Hook data received:",q||"none"),console.log("Environment TRANSCRIPT_PATH:",process.env.TRANSCRIPT_PATH||"not set"),console.log("Command line args:",process.argv.slice(2));return}await QK(_,{dryRun:!1})}catch(q){console.error("Pre-compact hook failed:",q.message),process.exit(1)}}async function AD(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{let j=JSON.parse(q);if(j.cwd)_=g$(j.cwd)}catch(j){console.error("Failed to parse session-start hook data:",j)}if(!_)_=g$(process.cwd());await V7({format:"session-start",count:"10",project:_})}catch(q){console.error("Session-start hook failed:",q.message),process.exit(1)}}async function GD(){try{let q="";process.stdin.setEncoding("utf8");for await(let _ of process.stdin)q+=_;if(q)try{let _=JSON.parse(q);if(_.reason==="clear"&&_.transcript_path)console.log("\uD83D\uDDDC️ Compressing current session before /clear..."),await QK(_.transcript_path,{dryRun:!1})}catch(_){console.error("Failed to parse hook data:",_)}console.log("Session ended successfully")}catch(q){console.error("Session-end hook failed:",q.message),process.exit(1)}}var a7=f6(()=>{k2();T9()});var v5=Pq(z5(),1),{program:LD,createCommand:lD,createArgument:xD,createOption:nD,CommanderError:cD,InvalidArgumentError:rD,InvalidOptionArgumentError:iD,Command:W5,Argument:oD,Option:aD,Help:BD}=v5.default;import{readFileSync as ew,existsSync as Fw}from"fs";import{join as Uw,dirname as sw}from"path";import{fileURLToPath as Qw}from"url";var H5="claude-mem",J5="3.6.
|
|
261
|
+
To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(_){if(_.code==="ENOENT")K6.info("\uD83D\uDDD1️ Trash is empty");else K6.error("Failed to read trash directory"),console.error(_)}}var E$=f6(()=>{vK();d6()});var m$={};EK(m$,{emptyTrash:()=>kD});import{rmSync as HD,readdirSync as JD,existsSync as TD,statSync as ZD}from"fs";import{join as R$}from"path";async function kD(q={}){let _=$8.getInstance().getTrashDirectory();if(!TD(_)){K6.info("\uD83D\uDDD1️ Trash is already empty");return}try{let j=JD(_);if(j.length===0){K6.info("\uD83D\uDDD1️ Trash is already empty");return}let K=0,Y=0;for(let P of j){let $=R$(_,P);if(ZD($).isDirectory())K++;else Y++}if(!q.force){let P=await hq({message:`Permanently delete ${K} folders and ${Y} files from trash?`,initialValue:!1});if(L8(P)||!P){K6.info("Cancelled - trash not emptied");return}}let f=Qq();f.start("Emptying trash...");for(let P of j){let $=R$(_,P);HD($,{recursive:!0,force:!0})}f.stop(`\uD83D\uDDD1️ Trash emptied - permanently deleted ${K} folders and ${Y} files`)}catch(j){K6.error("Failed to empty trash"),console.error(j),process.exit(1)}}var I$=f6(()=>{vK();d6()});var o7={};EK(o7,{sessionStartHook:()=>AD,sessionEndHook:()=>GD,preCompactHook:()=>XD});import{basename as g$}from"path";async function XD(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{_=JSON.parse(q).transcript_path}catch(j){_=q.trim()}if(!_)_=process.env.TRANSCRIPT_PATH||process.argv[2];if(!_){console.log("\uD83D\uDDDC️ Compressing session transcript..."),console.log("❌ No transcript path provided to pre-compact hook"),console.log("Hook data received:",q||"none"),console.log("Environment TRANSCRIPT_PATH:",process.env.TRANSCRIPT_PATH||"not set"),console.log("Command line args:",process.argv.slice(2));return}await QK(_,{dryRun:!1})}catch(q){console.error("Pre-compact hook failed:",q.message),process.exit(1)}}async function AD(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{let j=JSON.parse(q);if(j.cwd)_=g$(j.cwd)}catch(j){console.error("Failed to parse session-start hook data:",j)}if(!_)_=g$(process.cwd());await V7({format:"session-start",count:"10",project:_})}catch(q){console.error("Session-start hook failed:",q.message),process.exit(1)}}async function GD(){try{let q="";process.stdin.setEncoding("utf8");for await(let _ of process.stdin)q+=_;if(q)try{let _=JSON.parse(q);if(_.reason==="clear"&&_.transcript_path)console.log("\uD83D\uDDDC️ Compressing current session before /clear..."),await QK(_.transcript_path,{dryRun:!1})}catch(_){console.error("Failed to parse hook data:",_)}console.log("Session ended successfully")}catch(q){console.error("Session-end hook failed:",q.message),process.exit(1)}}var a7=f6(()=>{k2();T9()});var v5=Pq(z5(),1),{program:LD,createCommand:lD,createArgument:xD,createOption:nD,CommanderError:cD,InvalidArgumentError:rD,InvalidOptionArgumentError:iD,Command:W5,Argument:oD,Option:aD,Help:BD}=v5.default;import{readFileSync as ew,existsSync as Fw}from"fs";import{join as Uw,dirname as sw}from"path";import{fileURLToPath as Qw}from"url";var H5="claude-mem",J5="3.6.4",T5="Memory compression system for Claude Code - persist context across sessions",Z5=H5,k5=J5,X5=T5;try{let q=Qw(import.meta.url),_=sw(q),j=Uw(_,"..","..","package.json");if(Fw(j)){let K=JSON.parse(ew(j,"utf-8"));Z5=K.name||H5,k5=K.version||J5,X5=K.description||T5}}catch{}var oq=Z5,A5=k5,G5=X5;k2();vK();import{readFileSync as JK,writeFileSync as h_,existsSync as R8,chmodSync as gG,mkdirSync as ZK,copyFileSync as u_,statSync as yG,readdirSync as dG}from"fs";import{join as V8,dirname as TK}from"path";import{homedir as v9}from"os";import{execSync as G_}from"child_process";import{fileURLToPath as zf}from"url";var fY=(q=0)=>(_)=>`\x1B[${_+q}m`,$Y=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,wY=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,l8={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},oV=Object.keys(l8.modifier),uA=Object.keys(l8.color),hA=Object.keys(l8.bgColor),aV=[...uA,...hA];function DA(){let q=new Map;for(let[_,j]of Object.entries(l8)){for(let[K,Y]of Object.entries(j))l8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=l8[K],q.set(Y[0],Y[1]);Object.defineProperty(l8,_,{value:j,enumerable:!1})}return Object.defineProperty(l8,"codes",{value:q,enumerable:!1}),l8.color.close="\x1B[39m",l8.bgColor.close="\x1B[49m",l8.color.ansi=fY(),l8.color.ansi256=$Y(),l8.color.ansi16m=wY(),l8.bgColor.ansi=fY(10),l8.bgColor.ansi256=$Y(10),l8.bgColor.ansi16m=wY(10),Object.defineProperties(l8,{rgbToAnsi256:{value(_,j,K){if(_===j&&j===K){if(_<8)return 16;if(_>248)return 231;return Math.round((_-8)/247*24)+232}return 16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5)},enumerable:!1},hexToRgb:{value(_){let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;if(K.length===3)K=[...K].map((f)=>f+f).join("");let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>l8.rgbToAnsi256(...l8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value(_){if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));if(f===2)P+=60;return P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>l8.ansi256ToAnsi(l8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>l8.ansi256ToAnsi(l8.hexToAnsi256(_)),enumerable:!1}}),l8}var CA=DA(),Wq=CA;import l2 from"node:process";import VA from"node:os";import OY from"node:tty";function s6(q,_=globalThis.Deno?globalThis.Deno.args:l2.argv){let j=q.startsWith("-")?"":q.length===1?"-":"--",K=_.indexOf(j+q),Y=_.indexOf("--");return K!==-1&&(Y===-1||K<Y)}var{env:x8}=l2,Z7;if(s6("no-color")||s6("no-colors")||s6("color=false")||s6("color=never"))Z7=0;else if(s6("color")||s6("colors")||s6("color=true")||s6("color=always"))Z7=1;function MA(){if("FORCE_COLOR"in x8){if(x8.FORCE_COLOR==="true")return 1;if(x8.FORCE_COLOR==="false")return 0;return x8.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(x8.FORCE_COLOR,10),3)}}function NA(q){if(q===0)return!1;return{level:q,hasBasic:!0,has256:q>=2,has16m:q>=3}}function bA(q,{streamIsTTY:_,sniffFlags:j=!0}={}){let K=MA();if(K!==void 0)Z7=K;let Y=j?Z7:K;if(Y===0)return 0;if(j){if(s6("color=16m")||s6("color=full")||s6("color=truecolor"))return 3;if(s6("color=256"))return 2}if("TF_BUILD"in x8&&"AGENT_NAME"in x8)return 1;if(q&&!_&&Y===void 0)return 0;let f=Y||0;if(x8.TERM==="dumb")return f;if(l2.platform==="win32"){let P=VA.release().split(".");if(Number(P[0])>=10&&Number(P[2])>=10586)return Number(P[2])>=14931?3:2;return 1}if("CI"in x8){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((P)=>(P in x8)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((P)=>(P in x8))||x8.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in x8)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(x8.TEAMCITY_VERSION)?1:0;if(x8.COLORTERM==="truecolor")return 3;if(x8.TERM==="xterm-kitty")return 3;if(x8.TERM==="xterm-ghostty")return 3;if(x8.TERM==="wezterm")return 3;if("TERM_PROGRAM"in x8){let P=Number.parseInt((x8.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(x8.TERM_PROGRAM){case"iTerm.app":return P>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(x8.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(x8.TERM))return 1;if("COLORTERM"in x8)return 1;return f}function zY(q,_={}){let j=bA(q,{streamIsTTY:q&&q.isTTY,..._});return NA(j)}var SA={stdout:zY({isTTY:OY.isatty(1)}),stderr:zY({isTTY:OY.isatty(2)})},vY=SA;function WY(q,_,j){let K=q.indexOf(_);if(K===-1)return q;let Y=_.length,f=0,P="";do P+=q.slice(f,K)+_+j,f=K+Y,K=q.indexOf(_,f);while(K!==-1);return P+=q.slice(f),P}function HY(q,_,j,K){let Y=0,f="";do{let P=q[K-1]==="\r";f+=q.slice(Y,P?K-1:K)+_+(P?`\r
|
|
262
262
|
`:`
|
|
263
263
|
`)+j,Y=K+1,K=q.indexOf(`
|
|
264
264
|
`,Y)}while(K!==-1);return f+=q.slice(Y),f}var{stdout:JY,stderr:TY}=vY,x2=Symbol("GENERATOR"),WK=Symbol("STYLER"),P3=Symbol("IS_EMPTY"),ZY=["ansi","ansi","ansi256","ansi16m"],HK=Object.create(null),EA=(q,_={})=>{if(_.level&&!(Number.isInteger(_.level)&&_.level>=0&&_.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let j=JY?JY.level:0;q.level=_.level===void 0?j:_.level};var RA=(q)=>{let _=(...j)=>j.join(" ");return EA(_,q),Object.setPrototypeOf(_,Y3.prototype),_};function Y3(q){return RA(q)}Object.setPrototypeOf(Y3.prototype,Function.prototype);for(let[q,_]of Object.entries(Wq))HK[q]={get(){let j=k7(this,c2(_.open,_.close,this[WK]),this[P3]);return Object.defineProperty(this,q,{value:j}),j}};HK.visible={get(){let q=k7(this,this[WK],!0);return Object.defineProperty(this,"visible",{value:q}),q}};var n2=(q,_,j,...K)=>{if(q==="rgb"){if(_==="ansi16m")return Wq[j].ansi16m(...K);if(_==="ansi256")return Wq[j].ansi256(Wq.rgbToAnsi256(...K));return Wq[j].ansi(Wq.rgbToAnsi(...K))}if(q==="hex")return n2("rgb",_,j,...Wq.hexToRgb(...K));return Wq[j][q](...K)},mA=["rgb","hex","ansi256"];for(let q of mA){HK[q]={get(){let{level:j}=this;return function(...K){let Y=c2(n2(q,ZY[j],"color",...K),Wq.color.close,this[WK]);return k7(this,Y,this[P3])}}};let _="bg"+q[0].toUpperCase()+q.slice(1);HK[_]={get(){let{level:j}=this;return function(...K){let Y=c2(n2(q,ZY[j],"bgColor",...K),Wq.bgColor.close,this[WK]);return k7(this,Y,this[P3])}}}}var IA=Object.defineProperties(()=>{},{...HK,level:{enumerable:!0,get(){return this[x2].level},set(q){this[x2].level=q}}}),c2=(q,_,j)=>{let K,Y;if(j===void 0)K=q,Y=_;else K=j.openAll+q,Y=_+j.closeAll;return{open:q,close:_,openAll:K,closeAll:Y,parent:j}},k7=(q,_,j)=>{let K=(...Y)=>gA(K,Y.length===1?""+Y[0]:Y.join(" "));return Object.setPrototypeOf(K,IA),K[x2]=q,K[WK]=_,K[P3]=j,K},gA=(q,_)=>{if(q.level<=0||!_)return q[P3]?"":_;let j=q[WK];if(j===void 0)return _;let{openAll:K,closeAll:Y}=j;if(_.includes("\x1B"))while(j!==void 0)_=WY(_,j.close,j.open),j=j.parent;let f=_.indexOf(`
|
package/package.json
CHANGED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* One-time migration script to convert claude-mem-index.md to claude-mem-index.jsonl
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { PathDiscovery } from '../services/path-discovery.js';
|
|
10
|
-
|
|
11
|
-
export function migrateToJSONL(): void {
|
|
12
|
-
const pathDiscovery = PathDiscovery.getInstance();
|
|
13
|
-
const oldIndexPath = path.join(pathDiscovery.getDataDirectory(), 'claude-mem-index.md');
|
|
14
|
-
const newIndexPath = pathDiscovery.getIndexPath();
|
|
15
|
-
|
|
16
|
-
// Check if old index exists
|
|
17
|
-
if (!fs.existsSync(oldIndexPath)) {
|
|
18
|
-
console.log('No markdown index found to migrate');
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Check if new index already exists
|
|
23
|
-
if (fs.existsSync(newIndexPath)) {
|
|
24
|
-
console.log('JSONL index already exists, skipping migration');
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
console.log('Starting migration from MD to JSONL...');
|
|
29
|
-
|
|
30
|
-
const content = fs.readFileSync(oldIndexPath, 'utf-8');
|
|
31
|
-
const lines = content.split('\n').filter(line => line.trim());
|
|
32
|
-
|
|
33
|
-
const jsonlLines: string[] = [];
|
|
34
|
-
let currentSessionId = '';
|
|
35
|
-
let currentSessionTimestamp = '';
|
|
36
|
-
|
|
37
|
-
for (const line of lines) {
|
|
38
|
-
// Parse session headers: # Session: <id> [<timestamp>]
|
|
39
|
-
const sessionMatch = line.match(/^# Session:\s*([^\[]+)(?:\s*\[([^\]]+)\])?/);
|
|
40
|
-
if (sessionMatch) {
|
|
41
|
-
currentSessionId = sessionMatch[1].trim();
|
|
42
|
-
currentSessionTimestamp = sessionMatch[2]?.trim() || new Date().toISOString();
|
|
43
|
-
|
|
44
|
-
// Extract project from session ID (assuming format like <project>_<uuid>)
|
|
45
|
-
const projectMatch = currentSessionId.match(/^([^_]+)_/);
|
|
46
|
-
const project = projectMatch ? projectMatch[1] : 'unknown';
|
|
47
|
-
|
|
48
|
-
jsonlLines.push(JSON.stringify({
|
|
49
|
-
type: 'session',
|
|
50
|
-
session_id: currentSessionId,
|
|
51
|
-
timestamp: currentSessionTimestamp,
|
|
52
|
-
project
|
|
53
|
-
}));
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Parse overviews: **Overview:** <text>
|
|
58
|
-
const overviewMatch = line.match(/^\*\*Overview:\*\*\s*(.+)/);
|
|
59
|
-
if (overviewMatch) {
|
|
60
|
-
const overviewText = overviewMatch[1].trim();
|
|
61
|
-
|
|
62
|
-
// Extract project from current session ID
|
|
63
|
-
const projectMatch = currentSessionId.match(/^([^_]+)_/);
|
|
64
|
-
const project = projectMatch ? projectMatch[1] : 'unknown';
|
|
65
|
-
|
|
66
|
-
jsonlLines.push(JSON.stringify({
|
|
67
|
-
type: 'overview',
|
|
68
|
-
content: overviewText,
|
|
69
|
-
session_id: currentSessionId,
|
|
70
|
-
project,
|
|
71
|
-
timestamp: currentSessionTimestamp
|
|
72
|
-
}));
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Skip certain lines
|
|
77
|
-
if (line.startsWith('# NO SUMMARIES EXTRACTED')) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Parse memory entries (pipe-separated)
|
|
82
|
-
if (line.includes(' | ')) {
|
|
83
|
-
const parts = line.split(' | ').map(p => p.trim());
|
|
84
|
-
|
|
85
|
-
if (parts.length >= 3) {
|
|
86
|
-
const [text, document_id, keywords, timestamp, archive] = parts;
|
|
87
|
-
|
|
88
|
-
// Extract project from document_id (format: <project>_<session>_<number>)
|
|
89
|
-
const projectMatch = document_id?.match(/^([^_]+)_/);
|
|
90
|
-
const project = projectMatch ? projectMatch[1] : 'unknown';
|
|
91
|
-
|
|
92
|
-
jsonlLines.push(JSON.stringify({
|
|
93
|
-
type: 'memory',
|
|
94
|
-
text,
|
|
95
|
-
document_id: document_id || `${currentSessionId}_${Date.now()}`,
|
|
96
|
-
keywords: keywords || '',
|
|
97
|
-
session_id: currentSessionId,
|
|
98
|
-
project,
|
|
99
|
-
timestamp: timestamp || currentSessionTimestamp,
|
|
100
|
-
archive: archive || `${currentSessionId}.jsonl.archive`
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Write JSONL file
|
|
107
|
-
fs.writeFileSync(newIndexPath, jsonlLines.join('\n') + '\n');
|
|
108
|
-
|
|
109
|
-
// Backup old index
|
|
110
|
-
const backupPath = oldIndexPath + '.backup';
|
|
111
|
-
fs.renameSync(oldIndexPath, backupPath);
|
|
112
|
-
|
|
113
|
-
console.log(`✅ Migration complete!`);
|
|
114
|
-
console.log(` - Converted ${jsonlLines.length} entries`);
|
|
115
|
-
console.log(` - New index: ${newIndexPath}`);
|
|
116
|
-
console.log(` - Backup: ${backupPath}`);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Run if called directly
|
|
120
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
121
|
-
migrateToJSONL();
|
|
122
|
-
}
|