@visa/cli 5.0.0-rc.413 → 5.0.0-rc.414

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tool-call.js CHANGED
@@ -54,10 +54,10 @@ ${c}`:c:"",p=Function,_=`return (input) => {
54
54
  ${c}
55
55
  }`,b;try{b=new p(...o,_)(...s)}catch(w){throw new ge(`this schema (generated code failed to evaluate: ${w.message})`)}return t?.debug&&(b.code=d),b}function X(e,t){for(let[i,n]of e.constants)if(n===t)return i;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function ee(e){return`v${e.varCounter++}`}function Oz(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return we.INVALID;let i=r;return i.issues.length===0?i.value:we.INVALID}function He(e,t,r,i,n=!0){let a=e.content.length,o=t.constants.size,s=t.constantCounter,c=t.varCounter;try{return ke(e,t,r,i,n)}catch(d){if(!(d instanceof ge)||!d.islandable)throw d;if(e.content.length=a,t.constants.size>o){let p=Array.from(t.constants.keys()).slice(o);for(let _ of p)t.constants.delete(_)}return t.constantCounter=s,t.varCounter=c,kz(e,t,r,i)}}function kz(e,t,r,i){let n=X(t,r),a=X(t,Oz),o=ee(t);return e.write(`const ${o} = ${a}(${n}, ${i});`),e.write(`if (${o} === INVALID) return INVALID;`),o}var Pz=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function jz(e,t,r,i){let n=r._zod.def.checks;if(!n||n.length===0)return i;let a=i;for(let o of n){let s=o._zod.def;if(s.when&&!Pz.has(s.check))throw new ge('check with a custom "when" condition');switch(s.check){case"greater_than":Tz(e,t,s,a);break;case"less_than":Az(e,t,s,a);break;case"multiple_of":xz(e,t,s,a);break;case"number_format":kd(e,s,a);break;case"min_length":{let c=ir(s.minimum,"min_length"),d=Qo(e,t,a,`${a}.length >= ${c} && ${a}.length < ${s.minimum*2}`);e.write(`if (${d} < ${c}) return INVALID;`);break}case"max_length":{let c=ir(s.maximum,"max_length"),d=Qo(e,t,a,`${a}.length > ${c}`);e.write(`if (${d} > ${c}) return INVALID;`);break}case"length_equals":{let c=ir(s.length,"length_equals"),d=Qo(e,t,a,`${a}.length >= ${c} && ${a}.length <= ${s.length*2}`);e.write(`if (${d} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${a}.size < ${ir(s.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${a}.size > ${ir(s.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${a}.size !== ${ir(s.size,"size_equals")}) return INVALID;`);break;case"string_format":a=Pd(e,t,s,a);break;case"custom":a=Mz(e,t,o,a);break;case"bigint_format":Ez(e,s,a);break;case"mime_type":Dz(e,t,s,a);break;case"property":Nz(e,t,s,a);break;case"overwrite":{let c=ee(t);Cz(e,t,o,a,c),a=c;break}default:throw new ge(`check type ${s.check}`)}}return a}function Qo(e,t,r,i){let n=X(t,Ge.codePointLength),a=ee(t);return e.write(`const ${a} = typeof ${r} === "string" && ${i} ? ${n}(${r}) : ${r}.length;`),a}function ir(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new ge(`${t} bound of type ${typeof e}`);return`${e}`}function Od(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new ge("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new ge("comparison check with Invalid Date bound");return X(e,t)}throw new ge(`comparison check bound of type ${typeof t}`)}function Tz(e,t,r,i){let n=r.inclusive?"<":"<=";e.write(`if (${i} ${n} ${Od(t,r.value)}) return INVALID;`)}function Az(e,t,r,i){let n=r.inclusive?">":">=";e.write(`if (${i} ${n} ${Od(t,r.value)}) return INVALID;`)}function xz(e,t,r,i){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new ge("multiple_of check with a zero divisor");e.write(`if (${i} % ${r.value}n !== 0n) return INVALID;`)}else{let n=X(t,Ge.floatSafeRemainder);e.write(`if (${n}(${i}, ${ir(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function kd(e,t,r){let i=t.format;switch(i){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new ge(`number format ${i}`)}}function Ez(e,t,r){let i=t.format;if(i)switch(i){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new ge(`bigint format ${i}`)}}function Dz(e,t,r,i){let n=r.mime;if(n&&n.length>0){let a=X(t,new Set(n));e.write(`if (!${a}.has(${i}.type)) return INVALID;`)}}function Nz(e,t,r,i){let n=`${i}[${JSON.stringify(r.property)}]`;ke(e,t,r.schema,n)}function Cz(e,t,r,i,n){let a=r._zod.def.tx;if(!a)throw new ge("overwrite check without a transform function");if(sr(a))throw new Nn("z.compile: async overwrite transforms are not supported");let o=X(t,a);e.write(`const ${n} = ${o}(${i});`)}function es(){throw new bz.$ZodAsyncError}function ns(e){this.issues.push(e)}function Mz(e,t,r,i){let n=r._zod.def;if(n.fn){if(sr(n.fn))throw new Nn("z.compile: async .refine() predicates are not supported");let a=X(t,n.fn),o=X(t,es),s=ee(t);return e.write(`const ${s} = ${a}(${i});`),e.write(`if (${s} instanceof Promise) ${o}();`),e.write(`if (!${s}) return INVALID;`),i}if(r._zod.check){if(sr(r._zod.check))throw new Nn("z.compile: async .superRefine() / check functions are not supported");let a=r._zod.check,s=X(t,d=>{let p={value:d,issues:[],addIssue:ns};return a(p)instanceof Promise&&es(),p.issues.length===0?p.value:we.INVALID}),c=ee(t);return e.write(`const ${c} = ${s}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new ge("custom check without a predicate or check function")}var Rz=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function Pd(e,t,r,i){let n=r.format;if(n==="base64"){let c=X(t,vt.isValidBase64);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(n==="base64url"){let c=X(t,vt.isValidBase64URL);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(n==="jwt"){let c=X(t,vt.isValidJWT),d=X(t,r.alg??null);return e.write(`if (!${c}(${i}, ${d})) return INVALID;`),i}if(n==="ipv6"){let c=X(t,vt.isValidIPv6);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(n==="cidrv6"){let c=X(t,vt.isValidCIDRv6);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(n==="credit_card"){let c=X(t,vt.isValidCreditCard);return e.write(`if (!${c}(${i})) return INVALID;`),i}let a=r;if(n==="url"||n==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let c=X(t,vt.parseURLObject),d=X(t,r),p=ee(t),_=ee(t);if(e.write(`const ${p} = ${i}.trim();`),e.write(`const ${_} = ${c}(${p}, ${d});`),e.write(`if (typeof ${_} === "number") return INVALID;`),a.hostname!==void 0){let z=X(t,vt.urlHostnameOk);e.write(`if (!${z}(${_}, ${d}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let z=X(t,vt.urlProtocolOk);e.write(`if (!${z}(${_}, ${d}.protocol)) return INVALID;`)}let b=ee(t),w=a.normalize?`${_}.href`:`${X(t,vt.stripTabAndNewline)}(${p})`;return e.write(`const ${b} = ${w};`),b}let o=r.fn;if(o){if(sr(o))throw new ge(`async string format ${n}`);let c=X(t,o);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(Rz.has(n)&&r.pattern){let c=X(t,r.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${i})) return INVALID;`),i}let s=r.format;switch(s){case"regex":throw new ge("regex format without a pattern");case"lowercase":e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${i}.includes(${Ge.esc(r.includes)})) return INVALID;`);break;case"starts_with":{let c=r.prefix;e.write(`if (${i}.slice(0, ${c.length}) !== ${Ge.esc(c)}) return INVALID;`);break}case"ends_with":{let c=r.suffix;e.write(`if (${i}.slice(-${c.length}) !== ${Ge.esc(c)}) return INVALID;`);break}default:throw new ge(`string format ${s}`)}return i}function ke(e,t,r,i,n=!0){let a=r._zod.def,o=a.type;if(a.coerce)throw new ge(`coercion (z.coerce.${o}())`);let s=n||!!a.checks?.length,c;switch(o){case"string":c=Uz(e,t,r,i);break;case"number":c=Zz(e,r,i);break;case"boolean":c=qz(e,i);break;case"bigint":c=Lz(e,r,i);break;case"symbol":c=Vz(e,i);break;case"undefined":c=Fz(e,i);break;case"null":c=Bz(e,i);break;case"any":case"unknown":c=i;break;case"never":e.write("return INVALID;"),c=i;break;case"void":c=Gz(e,i);break;case"nan":c=Jz(e,i);break;case"date":c=Wz(e,i);break;case"object":c=Kz(e,t,r,i,s);break;case"optional":c=Hz(e,t,r,i,s);break;case"nullable":c=Qz(e,t,r,i,s);break;case"array":c=eI(e,t,r,i,s);break;case"literal":c=tI(e,t,r,i);break;case"enum":c=nI(e,t,r,i);break;case"readonly":{let d=$d(e,t,r,i),p=ee(t);e.write(`const ${p} = Object.freeze(${d});`),c=p;break}case"success":$d(e,t,r,i),c="true";break;case"default":case"prefault":c=rI(e,t,r,i);break;case"nonoptional":c=iI(e,t,r,i);break;case"tuple":c=aI(e,t,r,i);break;case"union":c=oI(e,t,r,i);break;case"intersection":c=cI(e,t,r,i);break;case"record":c=lI(e,t,r,i);break;case"map":c=pI(e,t,r,i);break;case"set":c=fI(e,t,r,i);break;case"file":c=mI(e,i);break;case"template_literal":c=gI(e,t,r,i);break;case"lazy":c=hI(e,t,r,i);break;case"pipe":c=_I(e,t,r,i);break;case"custom":c=vI(e,t,r,i);break;case"transform":c=wI(e,t,r,i);break;case"catch":c=bI(e,t,r,i);break;default:throw new ge(`schema type ${o}`)}return c===null?null:jz(e,t,r,c)}function Uz(e,t,r,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let n=r._zod.def;return n.format===void 0?i:Pd(e,t,n,i)}function Zz(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let i=t._zod.def;return i.check==="number_format"&&i.format&&kd(e,{format:i.format},r),r}function qz(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function Lz(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let i=t._zod.def;if(i.format)switch(i.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function Vz(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function Fz(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Bz(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function Gz(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Jz(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function Wz(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function Kz(e,t,r,i,n=!0){let a=r._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let o=a.shape,s=Object.keys(o),c=Object.getOwnPropertySymbols(o),d=c.length?[...s,...c]:s,p=Y=>typeof Y=="symbol"?X(t,Y):Ge.esc(Y),_=Y=>typeof Y=="symbol"?`[${p(Y)}]`:Ge.esc(Y),b=o;if(s.includes("__proto__"))throw new ge('object shape key "__proto__"');let w=new Map;for(let Y of d){let oe=b[Y],ze=p(Y),Oe=ee(t);if(e.write(`const ${Oe} = ${i}[${ze}];`),oe._zod.optin!==void 0){let he=ee(t);e.write(`let ${he} = (() => {`),e.indented(Fe=>{let xr=He(Fe,t,oe,Oe);Fe.write(`return ${xr};`)}),e.write("})();"),oe._zod.optout==="optional"?(e.write(`if (${he} === INVALID) {`),e.indented(Fe=>{Fe.write(`if (${ze} in ${i}) return INVALID;`),Fe.write(`${he} = undefined;`)}),e.write("}")):e.write(`if (${he} === INVALID) return INVALID;`),w.set(Y,he)}else{Xz(oe)&&e.write(`if (!(${ze} in ${i})) return INVALID;`);let he=He(e,t,oe,Oe,n);he!==null&&w.set(Y,he)}}let z=a.catchall,N="none";if(z){let Y=z._zod.def.type;if(Y==="never"){let oe=s.map(ze=>`k !== ${Ge.esc(ze)}`).join(" && ")||"true";e.write(`for (const k in ${i}) {`),e.indented(ze=>{ze.write(`if (${oe}) return INVALID;`)}),e.write("}")}else(Y==="unknown"||Y==="any")&&!z._zod.def.checks?.length?N="passthrough":N="schema"}let q=ee(t),_e=d.some(Y=>or(b[Y])||ts(b[Y]));if(!n){if(N==="schema"){let Y=s.length>0?X(t,new Set(s)):null;e.write(`for (const k in ${i}) {`),e.indented(oe=>{oe.write('if (k === "__proto__") continue;'),Y&&oe.write(`if (${Y}.has(k)) continue;`);let ze=ee(t);oe.write(`const ${ze} = ${i}[k];`),He(oe,t,z,ze,!1)}),e.write("}")}return null}if(_e){e.write(`const ${q} = {};`);for(let Y of d){let oe=p(Y),ze=w.get(Y);ts(b[Y])?e.write(`if (${oe} in ${i}) ${q}[${oe}] = ${ze};`):or(b[Y])?e.write(`if (${ze} !== undefined || ${oe} in ${i}) ${q}[${oe}] = ${ze};`):e.write(`${q}[${oe}] = ${ze};`)}}else{let Y=d.map(oe=>`${_(oe)}: ${w.get(oe)}`).join(", ");e.write(`const ${q} = { ${Y} };`)}if(N!=="none"){let Y=s.length>0?X(t,new Set(s)):null;e.write(`for (const k in ${i}) {`),e.indented(oe=>{if(oe.write('if (k === "__proto__") continue;'),Y&&oe.write(`if (${Y}.has(k)) continue;`),N==="passthrough")oe.write(`${q}[k] = ${i}[k];`);else{let ze=ee(t);oe.write(`const ${ze} = ${i}[k];`);let Oe=He(oe,t,z,ze);oe.write(`${q}[k] = ${Oe};`)}}),e.write("}")}return q}function Hz(e,t,r,i,n=!0){let a=r._zod.def;if(Yz(r))return ke(e,t,a.innerType,i,n);if(a.innerType._zod.optin==="defaulted"){let s=ee(t),c=ee(t);return e.write(`let ${s};`),e.write(`if (${i} === undefined) {`),e.indented(d=>{d.write(`const ${c} = (() => {`),d.indented(p=>{let _=ke(p,t,a.innerType,i);p.write(`return ${_};`)}),d.write("})();"),d.write(`if (${c} !== INVALID) ${s} = ${c};`)}),e.write("} else {"),e.indented(d=>{let p=ke(d,t,a.innerType,i);d.write(`${s} = ${p};`)}),e.write("}"),s}let o=n?ee(t):null;return o&&e.write(`let ${o};`),e.write(`if (${i} !== undefined) {`),e.indented(s=>{let c=ke(s,t,a.innerType,i,n);o&&c!==null&&s.write(`${o} = ${c};`)}),e.write("}"),o}function Yz(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Xz(e){return e._zod.optin===void 0&&ar(e)}function ar(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?ar(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?ar(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(ar):!0;case"intersection":return!t.left||!t.right?!0:ar(t.left)&&ar(t.right);case"pipe":return t.in?ar(t.in):!0;default:return!0}}function ts(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function or(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?or(t.innerType):!0;case"union":return t.options?t.options.some(or):!0;case"intersection":return!t.left||!t.right||or(t.left)||or(t.right);case"pipe":return t.out?or(t.out):!0;default:return!0}}function Qz(e,t,r,i,n=!0){let a=r._zod.def,o=n?ee(t):null;return o&&e.write(`let ${o} = null;`),e.write(`if (${i} !== null) {`),e.indented(s=>{let c=ke(s,t,a.innerType,i,n);o&&c!==null&&s.write(`${o} = ${c};`)}),e.write("}"),o}function eI(e,t,r,i,n=!0){let a=r._zod.def;e.write(`if (!Array.isArray(${i})) return INVALID;`);let o=n?ee(t):null,s=ee(t),c=ee(t);return o&&e.write(`const ${o} = new Array(${i}.length);`),e.write(`for (let ${s} = 0; ${s} < ${i}.length; ${s}++) {`),e.indented(d=>{d.write(`const ${c} = ${i}[${s}];`);let p=He(d,t,a.element,c,n);o&&p!==null&&d.write(`${o}[${s}] = ${p};`)}),e.write("}"),o}function tI(e,t,r,i){let a=r._zod.def.values;if(a.length!==1){let s=X(t,new Set(a));return e.write(`if (!${s}.has(${i})) return INVALID;`),i}let o=a[0];if(typeof o=="number"&&Number.isNaN(o)){let s=X(t,new Set(a));return e.write(`if (!${s}.has(${i})) return INVALID;`),i}if(typeof o=="string")e.write(`if (${i} !== ${Ge.esc(o)}) return INVALID;`);else if(typeof o=="number"||typeof o=="boolean")e.write(`if (${i} !== ${o}) return INVALID;`);else if(o===null)e.write(`if (${i} !== null) return INVALID;`);else if(o===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof o=="bigint")e.write(`if (${i} !== ${o}n) return INVALID;`);else throw new ge(`literal type ${typeof o}`);return i}function nI(e,t,r,i){let n=r._zod.values;if(!n)throw new ge("enum schema without enumerated values");let a=X(t,n);return e.write(`if (!${a}.has(${i})) return INVALID;`),i}function $d(e,t,r,i){let n=r._zod.def;return ke(e,t,n.innerType,i)}function rI(e,t,r,i){let n=r._zod.def,o=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!o)return ke(e,t,n.innerType,i);let c=X(t,o),d=ee(t);return e.write(`let ${d} = ${i};`),e.write(`if (${i} === undefined) ${d} = ${c}();`),ke(e,t,n.innerType,d)}let s=ee(t);if(o){let c=X(t,o),d=X(t,Ge.shallowClone);e.write(`let ${s};`),e.write(`if (${i} === undefined) {`),e.indented(p=>{p.write(`${s} = ${d}(${c}());`)}),e.write("} else {"),e.indented(p=>{let _=ke(p,t,n.innerType,i);p.write(`${s} = ${_} === undefined ? ${d}(${c}()) : ${_};`)}),e.write("}")}else e.write(`let ${s};`),e.write(`if (${i} !== undefined) {`),e.indented(c=>{let d=ke(c,t,n.innerType,i);c.write(`${s} = ${d};`)}),e.write("}");return s}function iI(e,t,r,i){let n=r._zod.def,a=ke(e,t,n.innerType,i),o=ee(t);return e.write(`const ${o} = ${a};`),e.write(`if (${o} === undefined) return INVALID;`),o}function aI(e,t,r,i){let n=r._zod.def,a=n.items,o=n.rest;e.write(`if (!Array.isArray(${i})) return INVALID;`);let s=zd(a,"optin"),c=zd(a,"optout");o?e.write(`if (${i}.length < ${s}) return INVALID;`):e.write(`if (${i}.length < ${s} || ${i}.length > ${a.length}) return INVALID;`);let d=ee(t);e.write(`const ${d} = [];`);for(let p=0;p<a.length;p++){let _=a[p];if(p>=c)e.write(`if (${d}.length === ${p}) {`),e.indented(b=>{b.write(`if (${p} < ${i}.length) {`),b.indented(w=>{let z=ee(t);w.write(`const ${z} = ${i}[${p}];`);let N=He(w,t,_,z);w.write(`${d}[${p}] = ${N};`)}),b.write("} else {"),b.indented(w=>{if(ts(_)){w.write(`${d}.length = ${p};`);return}let z=ee(t),N=ee(t);w.write(`const ${z} = undefined;`),w.write(`const ${N} = (() => {`),w.indented(q=>{let _e=He(q,t,_,z);q.write(`return ${_e};`)}),w.write("})();"),w.write(`if (${N} === INVALID || ${N} === undefined) ${d}.length = ${p};`),w.write(`else ${d}[${p}] = ${N};`)}),b.write("}")}),e.write("}");else{let b=ee(t);e.write(`const ${b} = ${i}[${p}];`);let w=He(e,t,_,b);e.write(`${d}[${p}] = ${w};`)}}if(o){let p=ee(t),_=ee(t);e.write(`for (let ${p} = ${a.length}; ${p} < ${i}.length; ${p}++) {`),e.indented(b=>{b.write(`const ${_} = ${i}[${p}];`);let w=He(b,t,o,_);b.write(`${d}[${p}] = ${w};`)}),e.write("}")}return d}function zd(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function oI(e,t,r,i){let n=r._zod.def,a=n.options;if(n.discriminator)return sI(e,t,n,i);if(n.inclusive===!1)throw new ge("exclusive unions (z.xor)");if(a.length===0)return e.write("return INVALID;"),i;if(a.length===1)return ke(e,t,a[0],i);if(a.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(a.flatMap(p=>p._zod.def.values)),d=X(t,c);return e.write(`if (!${d}.has(${i})) return INVALID;`),i}let s=ee(t);e.write(`let ${s};`);for(let c=0;c<a.length;c++){let d=a[c];c===0?e.write(`${s} = (() => {`):e.write(`if (${s} === INVALID) ${s} = (() => {`),e.indented(p=>{let _=ke(p,t,d,i);p.write(`return ${_};`)}),e.write("})();")}return e.write(`if (${s} === INVALID) return INVALID;`),s}function sI(e,t,r,i){if(r.unionFallback)throw new ge("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),i;let n=ee(t),a=ee(t);e.write(`const ${n} = ${i}?.[${Ge.esc(r.discriminator)}];`),e.write(`let ${a};`);let o=!0,s=new Set;for(let c of r.options){let d=c._zod.propValues?.[r.discriminator];if(!d||d.size===0)throw new ge("discriminated union option without static discriminator values");for(let b of d){if(s.has(b))throw new ge(`duplicate discriminator value ${String(b)}`);s.add(b)}let p=Array.from(d,b=>uI(t,n,b)),_=o?"if":"else if";e.write(`${_} (${p.join(" || ")}) {`),e.indented(b=>{let w=ke(b,t,c,i);b.write(`${a} = ${w};`)}),e.write("}"),o=!1}return e.write("else { return INVALID; }"),a}function uI(e,t,r){if(typeof r=="string")return`${t} === ${Ge.esc(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let i=X(e,r);return`${t} === ${i}`}throw new ge(`literal discriminator value ${String(r)}`)}function cI(e,t,r,i){let n=r._zod.def,a=He(e,t,n.left,i),o=He(e,t,n.right,i),s=X(t,vt.mergeValues),c=ee(t);return e.write(`const ${c} = ${s}(${a}, ${o});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function lI(e,t,r,i){let n=r._zod.def,a=X(t,Ge.isPlainObject);e.write(`if (!${a}(${i})) return INVALID;`);let o=ee(t),s=ee(t),c=ee(t);e.write(`const ${o} = {};`);let d=n,p=d.partial?void 0:n.keyType._zod.values;if(p){let z=[];for(let q of p){if(!(typeof q=="string"||typeof q=="number"||typeof q=="symbol"))throw new ge(`record key value ${String(q)}`);let _e=typeof q=="number"?q.toString():q;if(_e==="__proto__")throw new ge('record key "__proto__"');z.push(_e);let Y=X(t,q),oe=ke(e,t,n.keyType,Y),ze=ee(t);e.write(`const ${ze} = ${i}[${dI(t,_e)}];`);let Oe=He(e,t,n.valueType,ze);e.write(`${o}[${oe}] = ${Oe};`)}let N=X(t,new Set(z));return e.write(`for (const ${s} in ${i}) {`),e.indented(q=>{q.write(`if (${N}.has(${s})) continue;`),d.mode==="loose"?q.write(`if (${s} !== "__proto__") ${o}[${s}] = ${i}[${s}];`):q.write("return INVALID;")}),e.write("}"),o}let _=n.keyType._zod.def;if(!(_.type==="string"&&_.format===void 0&&!_.coerce&&(_.checks?.length??0)===0)){let z=n.mode==="loose",N=X(t,Aa(n.keyType)),q=X(t,$z.number),_e=X(t,Object.prototype.propertyIsEnumerable),Y=ee(t);return e.write(`for (const ${s} of Reflect.ownKeys(${i})) {`),e.indented(oe=>{oe.write(`if (${s} === "__proto__") continue;`),oe.write(`if (!${_e}.call(${i}, ${s})) continue;`),oe.write(`let ${Y} = ${N}(${s});`),oe.write(`if (${Y} === INVALID && typeof ${s} === "string" && ${q}.test(${s})) ${Y} = ${N}(Number(${s}));`),z?oe.write(`if (${Y} === INVALID) { ${o}[${s}] = ${i}[${s}]; continue; }`):oe.write(`if (${Y} === INVALID) return INVALID;`),oe.write(`if (${Y} === "__proto__") continue;`);let ze=ee(t);oe.write(`const ${ze} = ${i}[${s}];`);let Oe=He(oe,t,n.valueType,ze);oe.write(`${o}[${Y}] = ${Oe};`)}),e.write("}"),o}let w=X(t,Object.prototype.propertyIsEnumerable);return e.write(`for (const ${s} of Reflect.ownKeys(${i})) {`),e.indented(z=>{z.write(`if (${s} === "__proto__") continue;`),z.write(`if (!${w}.call(${i}, ${s})) continue;`),z.write(`if (typeof ${s} !== "string") return INVALID;`),z.write(`const ${c} = ${i}[${s}];`);let N=He(z,t,n.valueType,c);z.write(`${o}[${s}] = ${N};`)}),e.write("}"),o}function dI(e,t){return typeof t=="string"?Ge.esc(t):X(e,t)}function pI(e,t,r,i){let n=r._zod.def;e.write(`if (!(${i} instanceof Map)) return INVALID;`);let a=ee(t),o=ee(t),s=ee(t);return e.write(`const ${a} = new Map();`),e.write(`for (const [${o}, ${s}] of ${i}) {`),e.indented(c=>{let d=ke(c,t,n.keyType,o),p=ke(c,t,n.valueType,s);c.write(`${a}.set(${d}, ${p});`)}),e.write("}"),a}function fI(e,t,r,i){let n=r._zod.def;e.write(`if (!(${i} instanceof Set)) return INVALID;`);let a=ee(t),o=ee(t);return e.write(`const ${a} = new Set();`),e.write(`for (const ${o} of ${i}) {`),e.indented(s=>{let c=ke(s,t,n.valueType,o);s.write(`${a}.add(${c});`)}),e.write("}"),a}function mI(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function gI(e,t,r,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let n=r._zod.pattern;if(n){let a=X(t,n);e.write(`${a}.lastIndex = 0;`),e.write(`if (!${a}.test(${i})) return INVALID;`)}return i}function hI(e,t,r,i){let n=r._zod.def,a=X(t,n.getter),o=X(t,{parser:null});e.write(`if (!${o}.parser) {`),e.indented(c=>{c.write(`const inner = ${a}();`),c.write(`${o}.parser = function(input) {`),c.indented(d=>{d.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),d.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let s=ee(t);return e.write(`const ${s} = ${o}.parser(${i});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function _I(e,t,r,i){let n=r._zod.def,a=ke(e,t,n.in,i);if(n.transform){if(sr(n.transform))throw new Nn("z.compile: async transforms in pipes are not supported");let o=n.transform,c=X(t,p=>{let _={value:p,issues:[],addIssue:ns},b=o(p,_);return b instanceof Promise?we.INVALID:_.issues.length===0?b:we.INVALID}),d=ee(t);return e.write(`const ${d} = ${c}(${a});`),e.write(`if (${d} === INVALID) return INVALID;`),ke(e,t,n.out,d)}else return ke(e,t,n.out,a)}function sr(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function vI(e,t,r,i){let n=r._zod.def;if(n.fn){if(sr(n.fn))throw new Nn("z.compile: async custom predicates are not supported");let a=X(t,n.fn),o=X(t,es),s=ee(t);e.write(`const ${s} = ${a}(${i});`),e.write(`if (${s} instanceof Promise) ${o}();`),e.write(`if (!${s}) return INVALID;`)}else throw new ge("custom schema without a predicate function");return i}function yI(e,t,r){let i=e._zod.run({value:r,issues:[]},{});if(i&&typeof i.then=="function")return we.INVALID;let n=i;return n.issues.length===0?n.value:t()}function bI(e,t,r,i){let n=r._zod.def;if(!n.catchValue[Ge.CONSTANT_CATCH])throw new ge("catch with a callback (only a constant catch value compiles)",!1);let a=ee(t);e.write(`let ${a} = (() => {`),e.indented(d=>{let p=He(d,t,n.innerType,i);d.write(`return ${p};`)}),e.write("})();");let o=X(t,n.innerType),s=X(t,n.catchValue),c=X(t,yI);return e.write(`if (${a} === INVALID) {`),e.indented(d=>{d.write(`${a} = ${c}(${o}, ${s}, ${i});`),d.write(`if (${a} === INVALID) return INVALID;`)}),e.write("}"),a}function wI(e,t,r,i){let n=r._zod.def;if(n.transform){if(sr(n.transform))throw new Nn("z.compile: async transforms are not supported");let a=n.transform,s=X(t,d=>{let p={value:d,issues:[],addIssue:ns},_=a(d,p);return _ instanceof Promise?we.INVALID:p.issues.length===0?_:we.INVALID}),c=ee(t);return e.write(`const ${c} = ${s}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return i}});var Ed=j(S=>{"use strict";var $I=S&&S.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),zI=S&&S.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Da=S&&S.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$I(t,e,r);return zI(t,e),t};Object.defineProperty(S,"__esModule",{value:!0});S.TimePrecision=void 0;S._string=II;S._coercedString=SI;S._email=OI;S._guid=kI;S._uuid=PI;S._uuidv4=jI;S._uuidv6=TI;S._uuidv7=AI;S._url=xI;S._emoji=EI;S._nanoid=DI;S._cuid=NI;S._cuid2=CI;S._ulid=MI;S._xid=RI;S._ksuid=UI;S._ipv4=ZI;S._ipv6=qI;S._mac=LI;S._cidrv4=VI;S._cidrv6=FI;S._base64=BI;S._base64url=GI;S._e164=JI;S._creditCard=WI;S._jwt=KI;S._isoDateTime=HI;S._isoDate=YI;S._isoTime=XI;S._isoDuration=QI;S._number=eS;S._coercedNumber=tS;S._int=nS;S._float32=rS;S._float64=iS;S._int32=aS;S._uint32=oS;S._boolean=sS;S._coercedBoolean=uS;S._bigint=cS;S._coercedBigint=lS;S._int64=dS;S._uint64=pS;S._symbol=fS;S._undefined=mS;S._null=gS;S._any=hS;S._unknown=_S;S._never=vS;S._void=yS;S._date=bS;S._coercedDate=wS;S._nan=$S;S._lt=Td;S._lte=Rr;S._max=Rr;S._lte=Rr;S._max=Rr;S._gt=Ad;S._gte=Ur;S._min=Ur;S._gte=Ur;S._min=Ur;S._positive=zS;S._negative=IS;S._nonpositive=SS;S._nonnegative=OS;S._multipleOf=kS;S._maxSize=PS;S._minSize=jS;S._size=TS;S._maxLength=AS;S._minLength=xS;S._length=ES;S._regex=DS;S._lowercase=NS;S._uppercase=CS;S._includes=MS;S._startsWith=RS;S._endsWith=US;S._property=ZS;S._properties=qS;S._mime=LS;S._overwrite=Ir;S._normalize=VS;S._trim=FS;S._toLowerCase=BS;S._toUpperCase=GS;S._slugify=JS;S._array=WS;S._union=KS;S._xor=HS;S._discriminatedUnion=YS;S._intersection=XS;S._tuple=QS;S._record=eO;S._map=tO;S._set=nO;S._enum=rO;S._nativeEnum=iO;S._literal=aO;S._file=oO;S._transform=sO;S._optional=uO;S._nullable=cO;S._default=lO;S._nonoptional=dO;S._success=pO;S._catch=fO;S._pipe=mO;S._readonly=gO;S._templateLiteral=hO;S._lazy=_O;S._promise=vO;S._custom=yO;S._refine=bO;S._superRefine=wO;S._check=xd;S.describe=$O;S.meta=zO;S._stringbool=IO;S._stringFormat=SO;var Pe=Da(li()),Ea=Da(Mr()),xa=Da(Nr()),E=Da(Z());function II(e,t){return new e({type:"string",...E.normalizeParams(t)})}function SI(e,t){return new e({type:"string",coerce:!0,...E.normalizeParams(t)})}function OI(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E.normalizeParams(t)})}function kI(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E.normalizeParams(t)})}function PI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E.normalizeParams(t)})}function jI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E.normalizeParams(t)})}function TI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E.normalizeParams(t)})}function AI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E.normalizeParams(t)})}function xI(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E.normalizeParams(t)})}function EI(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E.normalizeParams(t)})}function DI(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E.normalizeParams(t)})}function NI(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E.normalizeParams(t)})}function CI(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E.normalizeParams(t)})}function MI(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E.normalizeParams(t)})}function RI(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E.normalizeParams(t)})}function UI(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E.normalizeParams(t)})}function ZI(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E.normalizeParams(t)})}function qI(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E.normalizeParams(t)})}function LI(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...E.normalizeParams(t)})}function VI(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E.normalizeParams(t)})}function FI(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E.normalizeParams(t)})}function BI(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E.normalizeParams(t)})}function GI(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E.normalizeParams(t)})}function JI(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E.normalizeParams(t)})}function WI(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...E.normalizeParams(t)})}function KI(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E.normalizeParams(t)})}S.TimePrecision={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function HI(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E.normalizeParams(t)})}function YI(e,t){return new e({type:"string",format:"date",check:"string_format",...E.normalizeParams(t)})}function XI(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E.normalizeParams(t)})}function QI(e,t){return new e({type:"string",format:"duration",check:"string_format",...E.normalizeParams(t)})}function eS(e,t){return new e({type:"number",checks:[],...E.normalizeParams(t)})}function tS(e,t){return new e({type:"number",coerce:!0,checks:[],...E.normalizeParams(t)})}function nS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E.normalizeParams(t)})}function rS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...E.normalizeParams(t)})}function iS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...E.normalizeParams(t)})}function aS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...E.normalizeParams(t)})}function oS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...E.normalizeParams(t)})}function sS(e,t){return new e({type:"boolean",...E.normalizeParams(t)})}function uS(e,t){return new e({type:"boolean",coerce:!0,...E.normalizeParams(t)})}function cS(e,t){return new e({type:"bigint",...E.normalizeParams(t)})}function lS(e,t){return new e({type:"bigint",coerce:!0,...E.normalizeParams(t)})}function dS(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...E.normalizeParams(t)})}function pS(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...E.normalizeParams(t)})}function fS(e,t){return new e({type:"symbol",...E.normalizeParams(t)})}function mS(e,t){return new e({type:"undefined",...E.normalizeParams(t)})}function gS(e,t){return new e({type:"null",...E.normalizeParams(t)})}function hS(e){return new e({type:"any"})}function _S(e){return new e({type:"unknown"})}function vS(e,t){return new e({type:"never",...E.normalizeParams(t)})}function yS(e,t){return new e({type:"void",...E.normalizeParams(t)})}function bS(e,t){return new e({type:"date",...E.normalizeParams(t)})}function wS(e,t){return new e({type:"date",coerce:!0,...E.normalizeParams(t)})}function $S(e,t){return new e({type:"nan",...E.normalizeParams(t)})}function Td(e,t){return new Pe.$ZodCheckLessThan({check:"less_than",...E.normalizeParams(t),value:e,inclusive:!1})}function Rr(e,t){return new Pe.$ZodCheckLessThan({check:"less_than",...E.normalizeParams(t),value:e,inclusive:!0})}function Ad(e,t){return new Pe.$ZodCheckGreaterThan({check:"greater_than",...E.normalizeParams(t),value:e,inclusive:!1})}function Ur(e,t){return new Pe.$ZodCheckGreaterThan({check:"greater_than",...E.normalizeParams(t),value:e,inclusive:!0})}function zS(e){return Ad(0,e)}function IS(e){return Td(0,e)}function SS(e){return Rr(0,e)}function OS(e){return Ur(0,e)}function kS(e,t){return new Pe.$ZodCheckMultipleOf({check:"multiple_of",...E.normalizeParams(t),value:e})}function PS(e,t){return new Pe.$ZodCheckMaxSize({check:"max_size",...E.normalizeParams(t),maximum:e})}function jS(e,t){return new Pe.$ZodCheckMinSize({check:"min_size",...E.normalizeParams(t),minimum:e})}function TS(e,t){return new Pe.$ZodCheckSizeEquals({check:"size_equals",...E.normalizeParams(t),size:e})}function AS(e,t){return new Pe.$ZodCheckMaxLength({check:"max_length",...E.normalizeParams(t),maximum:e})}function xS(e,t){return new Pe.$ZodCheckMinLength({check:"min_length",...E.normalizeParams(t),minimum:e})}function ES(e,t){return new Pe.$ZodCheckLengthEquals({check:"length_equals",...E.normalizeParams(t),length:e})}function DS(e,t){return new Pe.$ZodCheckRegex({check:"string_format",format:"regex",...E.normalizeParams(t),pattern:e})}function NS(e){return new Pe.$ZodCheckLowerCase({check:"string_format",format:"lowercase",...E.normalizeParams(e)})}function CS(e){return new Pe.$ZodCheckUpperCase({check:"string_format",format:"uppercase",...E.normalizeParams(e)})}function MS(e,t){return new Pe.$ZodCheckIncludes({check:"string_format",format:"includes",...E.normalizeParams(t),includes:e})}function RS(e,t){return new Pe.$ZodCheckStartsWith({check:"string_format",format:"starts_with",...E.normalizeParams(t),prefix:e})}function US(e,t){return new Pe.$ZodCheckEndsWith({check:"string_format",format:"ends_with",...E.normalizeParams(t),suffix:e})}function ZS(e,t,r){return new Pe.$ZodCheckProperty({check:"property",property:e,schema:t,...E.normalizeParams(r)})}function qS(e){return Object.entries(e).map(([t,r])=>new Pe.$ZodCheckProperty({check:"property",property:t,schema:r}))}function LS(e,t){return new Pe.$ZodCheckMimeType({check:"mime_type",mime:e,...E.normalizeParams(t)})}function Ir(e){return new Pe.$ZodCheckOverwrite({check:"overwrite",tx:e})}function VS(e){return Ir(t=>t.normalize(e))}function FS(){return Ir(e=>e.trim())}function BS(){return Ir(e=>e.toLowerCase())}function GS(){return Ir(e=>e.toUpperCase())}function JS(){return Ir(e=>E.slugify(e))}function WS(e,t,r){return new e({type:"array",element:t,...E.normalizeParams(r)})}function KS(e,t,r){return new e({type:"union",options:t,...E.normalizeParams(r)})}function HS(e,t,r){return new e({type:"union",options:t,inclusive:!1,...E.normalizeParams(r)})}function YS(e,t,r,i){return new e({type:"union",options:r,discriminator:t,...E.normalizeParams(i)})}function XS(e,t,r){return new e({type:"intersection",left:t,right:r})}function QS(e,t,r,i){let n=r instanceof xa.$ZodType,a=n?i:r,o=n?r:null;return new e({type:"tuple",items:t,rest:o,...E.normalizeParams(a)})}function eO(e,t,r,i){return new e({type:"record",keyType:t,valueType:r,...E.normalizeParams(i)})}function tO(e,t,r,i){return new e({type:"map",keyType:t,valueType:r,...E.normalizeParams(i)})}function nO(e,t,r){return new e({type:"set",valueType:t,...E.normalizeParams(r)})}function rO(e,t,r){let i=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:i,...E.normalizeParams(r)})}function iO(e,t,r){return new e({type:"enum",entries:t,...E.normalizeParams(r)})}function aO(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...E.normalizeParams(r)})}function oO(e,t){return new e({type:"file",...E.normalizeParams(t)})}function sO(e,t){return new e({type:"transform",transform:t})}function uO(e,t){return new e({type:"optional",innerType:t})}function cO(e,t){return new e({type:"nullable",innerType:t})}function lO(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():E.shallowClone(r)}})}function dO(e,t,r){return new e({type:"nonoptional",innerType:t,...E.normalizeParams(r)})}function pO(e,t){return new e({type:"success",innerType:t})}function fO(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:E.constantCatch(r)})}function mO(e,t,r){return new e({type:"pipe",in:t,out:r})}function gO(e,t){return new e({type:"readonly",innerType:t})}function hO(e,t,r){return new e({type:"template_literal",parts:t,...E.normalizeParams(r)})}function _O(e,t){return new e({type:"lazy",getter:t})}function vO(e,t){return new e({type:"promise",innerType:t})}function yO(e,t,r){let i=E.normalizeParams(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function bO(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E.normalizeParams(r)})}function wO(e,t){let r=xd(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(E.issue(n,i.value,r._zod.def));else{let a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=r),a.continue??(a.continue=!r._zod.def.abort),i.issues.push(E.issue(a))}},e(i.value,i)),t);return r}function xd(e,t){let r=new Pe.$ZodCheck({check:"custom",...E.normalizeParams(t)});return r._zod.check=e,r}function $O(e){let t=new Pe.$ZodCheck({check:"describe"});return t._zod.onattach=[r=>{let i=Ea.globalRegistry.get(r)??{};Ea.globalRegistry.add(r,{...i,description:e})}],t._zod.check=()=>{},t}function zO(e){let t=new Pe.$ZodCheck({check:"meta"});return t._zod.onattach=[r=>{let i=Ea.globalRegistry.get(r)??{};Ea.globalRegistry.add(r,{...i,...e})}],t._zod.check=()=>{},t}function IO(e,t){let r=E.normalizeParams(t),i=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(i=i.map(w=>typeof w=="string"?w.toLowerCase():w),n=n.map(w=>typeof w=="string"?w.toLowerCase():w));let a=new Set(i),o=new Set(n),s=e.Codec??xa.$ZodCodec,c=e.Boolean??xa.$ZodBoolean,d=e.String??xa.$ZodString,p=new d({type:"string",error:r.error}),_=new c({type:"boolean",error:r.error}),b=new s({type:"pipe",in:p,out:_,transform:((w,z)=>{let N=w;return r.case!=="sensitive"&&(N=N.toLowerCase()),a.has(N)?!0:o.has(N)?!1:(z.issues.push({code:"invalid_value",expected:"stringbool",values:[...a,...o],input:z.value,inst:b,continue:!1}),{})}),reverseTransform:((w,z)=>w===!0?i[0]||"true":n[0]||"false"),error:r.error});return b._zod.bag.truthy=i,b._zod.bag.falsy=n,b._zod.bag.case=r.case??"insensitive",b}function SO(e,t,r,i={}){let n=E.normalizeParams(i),a={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(a.pattern=r),new e(a)}});var qr=j(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.createStandardJSONSchemaMethod=st.createToJSONSchemaMethod=void 0;st.initializeContext=as;st.handleUnrepresentable=kO;st.process=Na;st.extractDefs=os;st.finalize=ss;var OO=Mr(),is=Z();function Zr(e,...t){for(let r of t)for(let i of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,i)&&(0,is.assignProp)(e,i,r[i]);return e}function as(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??OO.globalRegistry,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function kO(e,t,r,i,n){let a=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:n}):t.unrepresentable;if(a==="any")return!1;if(a===void 0||a==="throw")throw new Error(n);return Object.assign(r,a),!0}function Na(e,t,r={path:[],schemaPath:[]}){var i;let n=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,p);else{let b=o.schema,w=t.processors[n.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);w(e,t,b,p)}let _=e._zod.parent;_&&(o.ref||(o.ref=_),Na(_,t,p),t.seen.get(_).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Zr(o.schema,c),t.io==="input"&&Ye(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((i=o.schema).default??(i.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Dd(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function os(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let o of e.seen.entries()){let s=e.metadataRegistry.get(o[0])?.id;if(s){let c=i.get(s);if(c&&c!==o[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(s,o[0])}}let n=o=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let _=e.external.registry.get(o[0])?.id,b=e.external.uri??(z=>z);if(_)return{ref:b(_)};let w=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=w,{defId:w,ref:`${b("__shared")}#/${s}/${Dd(w)}`}}let c="#",d=`${c}/${s}/`;if(o[1]===r&&!o[1].schema.id)return{ref:c};let p=o[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:d+Dd(p)}},a=o=>{if(o[1].schema.$ref)return;let s=o[1],{ref:c,defId:d}=n(o);s.def={...s.schema},d&&(s.defId=d);let p=s.schema;for(let _ in p)delete p[_];p.$ref=c};if(e.cycles==="throw")for(let o of e.seen.entries()){let s=o[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
56
56
 
57
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let s=o[1];if(t===o[0]){a(o);continue}if(e.external){let d=e.external.registry.get(o[0])?.id;if(t!==o[0]&&d){a(o);continue}}if(e.metadataRegistry.get(o[0])?.id){a(o);continue}if(s.cycle){a(o);continue}if(s.count>1&&e.reused==="ref"){a(o);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Md(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let i of t){if(!i||typeof i!="object")return;Md(i);let n=Object.keys(i);if(n.length!==1||n[0]!=="type")return;let a=i.type;for(let o of Array.isArray(a)?a:[a]){if(typeof o!="string")return;r.includes(o)||r.push(o)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Rd=new Set(["type","properties","required","additionalProperties"]),Nd=["oneOf","anyOf"];function Cd(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function rs(e){let t=[];for(let a of e){if(typeof a!="object"||a.type!=="object")return null;for(let o in a)if(!Rd.has(o))return null;t.push(a)}let r={},i=new Set;for(let a of t){for(let o in a.properties){if(Object.prototype.hasOwnProperty.call(r,o))continue;let s=[];for(let d of t){let p=d.properties?.[o]??Cd(d);p!=null&&(s.some(_=>JSON.stringify(_)===JSON.stringify(p))||s.push(p))}let c=s.length===1?s[0]:rs(s)??{allOf:s};(0,is.assignProp)(r,o,c)}for(let o of a.required??[])i.add(o)}let n={type:"object",properties:r};if(i.size&&(n.required=[...i]),t.every(a=>a.additionalProperties===!1))n.additionalProperties=!1;else{let a=[];for(let o of t){let s=Cd(o);s&&!a.some(c=>JSON.stringify(c)===JSON.stringify(s))&&a.push(s)}a.length===1?n.additionalProperties=a[0]:a.length>1&&(n.additionalProperties={allOf:a})}return n}function PO(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Rd)if(n in e)return;let r=t.filter(n=>Nd.some(a=>Array.isArray(n[a]))),i=null;if(!r.length)i=rs(t);else{let n=r[0],a=Nd.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let o=t.filter(c=>c!==n),s=n[a].map(c=>rs([...o,c]));if(s.some(c=>!c))return;i={[a]:s}}i&&(delete e.allOf,Zr(e,i))}function ss(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=s=>{let c=e.seen.get(s);if(c.ref===null)return;let d=c.def??c.schema,p={...d},_=c.ref;if(c.ref=null,_){i(_);let w=e.seen.get(_),z=w.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(z)):Zr(d,z),Zr(d,p),s._zod.parent===_)for(let q in d)q==="$ref"||q==="allOf"||q in p||delete d[q];if(z.$ref&&w.def)for(let q in d)q==="$ref"||q==="allOf"||q in w.def&&JSON.stringify(d[q])===JSON.stringify(w.def[q])&&delete d[q]}let b=s._zod.parent;if(b&&b!==_){i(b);let w=e.seen.get(b);if(w?.schema.$ref&&(d.$ref=w.schema.$ref,w.def))for(let z in d)z==="$ref"||z==="allOf"||z in w.def&&JSON.stringify(d[z])===JSON.stringify(w.def[z])&&delete d[z]}e.override({zodSchema:s,jsonSchema:d,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())i(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())Md(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let c of e.seen.values())for(let d of[c.schema,c.def]){let p=d?.allOf;if(!Array.isArray(p))continue;let _=s.get(p);_?_.push(d):s.set(p,[d])}for(let c of e.intersections)for(let d of s.get(c)??[])PO(d)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Zr(n,r.defId?r.schema:r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&n.id===a&&delete n.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let c=s[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,(0,is.assignProp)(o,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?n.$defs=o:n.definitions=o);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:(0,st.createStandardJSONSchemaMethod)(t,"input",e.processors),output:(0,st.createStandardJSONSchemaMethod)(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Ye(i.element,r);if(i.type==="set")return Ye(i.valueType,r);if(i.type==="lazy")return Ye(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Ye(i.innerType,r);if(i.type==="intersection")return Ye(i.left,r)||Ye(i.right,r);if(i.type==="record"||i.type==="map")return Ye(i.keyType,r)||Ye(i.valueType,r);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ye(i.in,r)||Ye(i.out,r);if(i.type==="object"){for(let n in i.shape)if(Ye(i.shape[n],r))return!0;return!1}if(i.type==="union"){for(let n of i.options)if(Ye(n,r))return!0;return!1}if(i.type==="tuple"){for(let n of i.items)if(Ye(n,r))return!0;return!!(i.rest&&Ye(i.rest,r))}return!1}var jO=(e,t={})=>r=>{let i=as({...r,processors:t});return Na(e,i),os(i,e),ss(i,e)};st.createToJSONSchemaMethod=jO;var TO=(e,t,r={})=>i=>{let{libraryOptions:n,target:a}=i??{},o=as({...n??{},target:a,io:t,processors:r});return Na(e,o),os(o,e),ss(o,e)};st.createStandardJSONSchemaMethod=TO});var Vr=j(k=>{"use strict";var AO=k&&k.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),xO=k&&k.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EO=k&&k.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&AO(t,e,r);return xO(t,e),t};Object.defineProperty(k,"__esModule",{value:!0});k.allProcessors=k.lazyProcessor=k.optionalProcessor=k.promiseProcessor=k.readonlyProcessor=k.pipeProcessor=k.catchProcessor=k.prefaultProcessor=k.defaultProcessor=k.nonoptionalProcessor=k.nullableProcessor=k.recordProcessor=k.tupleProcessor=k.intersectionProcessor=k.unionProcessor=k.objectProcessor=k.arrayProcessor=k.setProcessor=k.mapProcessor=k.transformProcessor=k.functionProcessor=k.customProcessor=k.successProcessor=k.fileProcessor=k.templateLiteralProcessor=k.nanProcessor=k.literalProcessor=k.enumProcessor=k.dateProcessor=k.unknownProcessor=k.anyProcessor=k.neverProcessor=k.voidProcessor=k.undefinedProcessor=k.nullProcessor=k.symbolProcessor=k.bigintProcessor=k.booleanProcessor=k.numberProcessor=k.stringProcessor=void 0;k.toJSONSchema=wk;var Ud=EO(yr()),ne=qr(),Ca=Z(),DO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},NO=(e,t,r,i)=>{let n=r;n.type="string";let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:d,laxFormat:p}=e._zod.bag;if(typeof a=="number"&&(n.minLength=a),typeof o=="number"&&(n.maxLength=o),s&&(n.format=DO[s]??s,n.format===""&&delete n.format,(s==="time"||p)&&delete n.format),d&&(n.contentEncoding=d),c&&c.size>0){let _=[...c];_.length===1?n.pattern=_[0].source:_.length>1&&(n.allOf=[..._.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}};k.stringProcessor=NO;var CO=(e,t,r,i)=>{let n=r,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:p}=e._zod.bag;typeof s=="string"&&s.includes("int")?n.type="integer":n.type="number";let _=typeof p=="number"&&p>=(a??Number.NEGATIVE_INFINITY),b=typeof d=="number"&&d<=(o??Number.POSITIVE_INFINITY),w=t.target==="draft-04"||t.target==="openapi-3.0";_?w?(n.minimum=p,n.exclusiveMinimum=!0):n.exclusiveMinimum=p:typeof a=="number"&&(n.minimum=a),b?w?(n.maximum=d,n.exclusiveMaximum=!0):n.exclusiveMaximum=d:typeof o=="number"&&(n.maximum=o),typeof c=="number"&&(Number.isFinite(c)&&c!==0?n.multipleOf=Math.abs(c):(0,ne.handleUnrepresentable)(e,t,n,i,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))};k.numberProcessor=CO;var MO=(e,t,r,i)=>{r.type="boolean"};k.booleanProcessor=MO;var RO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"BigInt cannot be represented in JSON Schema")};k.bigintProcessor=RO;var UO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Symbols cannot be represented in JSON Schema")};k.symbolProcessor=UO;var ZO=(e,t,r,i)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};k.nullProcessor=ZO;var qO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Undefined cannot be represented in JSON Schema")};k.undefinedProcessor=qO;var LO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Void cannot be represented in JSON Schema")};k.voidProcessor=LO;var VO=(e,t,r,i)=>{r.not={}};k.neverProcessor=VO;var FO=(e,t,r,i)=>{};k.anyProcessor=FO;var BO=(e,t,r,i)=>{};k.unknownProcessor=BO;var GO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Date cannot be represented in JSON Schema")};k.dateProcessor=GO;var JO=(e,t,r,i)=>{let n=e._zod.def,a=(0,Ca.getEnumValues)(n.entries);if(a.length===0){r.not={};return}a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),r.enum=a};k.enumProcessor=JO;var WO=(e,t,r,i)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let a=[];for(let o of n.values)if(o===void 0){if((0,ne.handleUnrepresentable)(e,t,r,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if((0,ne.handleUnrepresentable)(e,t,r,i,"BigInt literals cannot be represented in JSON Schema"))return;a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let o=a[0];r.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[o]:r.const=o}else a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),a.every(o=>typeof o=="boolean")&&(r.type="boolean"),a.every(o=>o===null)&&(r.type="null"),r.enum=a};k.literalProcessor=WO;var KO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"NaN cannot be represented in JSON Schema")};k.nanProcessor=KO;var HO=(e,t,r,i)=>{let n=r,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=a.source};k.templateLiteralProcessor=HO;var YO=(e,t,r,i)=>{let n=r,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(n,a)):(Object.assign(n,a),n.anyOf=c.map(d=>({contentMediaType:d}))):Object.assign(n,a)};k.fileProcessor=YO;var XO=(e,t,r,i)=>{r.type="boolean"};k.successProcessor=XO;var QO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Custom types cannot be represented in JSON Schema")};k.customProcessor=QO;var ek=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Function types cannot be represented in JSON Schema")};k.functionProcessor=ek;var tk=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Transforms cannot be represented in JSON Schema")};k.transformProcessor=tk;var nk=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Map cannot be represented in JSON Schema")};k.mapProcessor=nk;var rk=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Set cannot be represented in JSON Schema")};k.setProcessor=rk;var ik=(e,t,r,i)=>{let n=r,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o=="number"&&(n.minItems=o),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=(0,ne.process)(a.element,t,{...i,path:[...i.path,"items"]})};k.arrayProcessor=ik;function Lr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Lr(t.out):t.type==="catch"?Lr(t.innerType):e._zod.optin}var ak=(e,t,r,i)=>{let n=r,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&(0,ne.handleUnrepresentable)(e,t,n,i,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let p in o)(0,Ca.assignProp)(n.properties,p,(0,ne.process)(o[p],t,{...i,path:[...i.path,"properties",p]}));let c=new Set(Object.keys(o)),d=new Set([...c].filter(p=>{let _=a.shape[p];return t.io==="input"?Lr(_)===void 0:_._zod.optout===void 0}));d.size>0&&(n.required=Array.from(d)),a.catchall?._zod.def.type==="never"?n.additionalProperties=!1:a.catchall?a.catchall&&(n.additionalProperties=(0,ne.process)(a.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)};k.objectProcessor=ak;var ok=(e,t,r,i)=>{let n=e._zod.def,a=n.inclusive===!1,o=n.options.map((s,c)=>(0,ne.process)(s,t,{...i,path:[...i.path,a?"oneOf":"anyOf",c]}));a?r.oneOf=o:r.anyOf=o};k.unionProcessor=ok;var sk=(e,t,r,i)=>{let n=e._zod.def,a=(0,ne.process)(n.left,t,{...i,path:[...i.path,"allOf",0]}),o=(0,ne.process)(n.right,t,{...i,path:[...i.path,"allOf",1]}),s=d=>"allOf"in d&&Object.keys(d).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];r.allOf=c,t.intersections.push(c)};k.intersectionProcessor=sk;var uk=(e,t,r,i)=>{let n=r,a=e._zod.def;n.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=a.items.map((N,q)=>(0,ne.process)(N,t,{...i,path:[...i.path,o,q]})),d=a.rest?(0,ne.process)(a.rest,t,{...i,path:[...i.path,s,...t.target==="openapi-3.0"?[a.items.length]:[]]}):null,p=a.items.length;for(;p>0;){let N=a.items[p-1];if(!(t.io==="input"?Lr(N)!==void 0:N._zod.optout==="optional"))break;p--}let _=a.items.length,b=!a.rest;t.target==="draft-2020-12"?(n.prefixItems=c,b?n.items=!1:d&&(n.items=d),p>0&&(n.minItems=p),b&&(n.maxItems=_)):t.target==="openapi-3.0"?(n.items={anyOf:c},d&&n.items.anyOf.push(d),p>0&&(n.minItems=p),b&&(n.maxItems=_)):(n.items=c,b?n.additionalItems=!1:d&&(n.additionalItems=d),p>0&&(n.minItems=p),b&&(n.maxItems=_));let{minimum:w,maximum:z}=e._zod.bag;typeof w=="number"&&(n.minItems=w),typeof z=="number"&&(n.maxItems=z)};k.tupleProcessor=uk;function us(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let z=e.get(t)?.def;if(!z)return t;let N=us(e,z,r);return N===z?t:N}for(let z of["anyOf","oneOf"]){let N=t[z];if(!Array.isArray(N))continue;let q=N.map(_e=>us(e,_e,r));q.some((_e,Y)=>_e!==N[Y])&&(t={...t,[z]:q})}let i=Array.isArray(t.type)?t.type:[t.type],n=!i.includes("string")&&i.some(z=>z==="number"||z==="integer"),a=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!a?.some(z=>typeof z=="number"))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:p,format:_,id:b,...w}=t;return w.enum?w.enum=w.enum.map(z=>typeof z=="number"?String(z):z):typeof w.const=="number"&&(w.const=String(w.const)),n&&(w.type="string",a||(w.pattern=(i.includes("number")?Ud.number:Ud.integer).source)),w}var cs=new WeakMap;function ck(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let r=new Map;for(let i of cs.get(e)??[]){let n=e.seen.get(i),a=(n?.def??n?.schema)?.propertyNames;if(!a||a===!0||r.has(a))continue;let o=us(t,a,new Set);o!==a&&r.set(a,o)}if(r.size)for(let i of e.seen.values())for(let n of[i.schema,i.def]){let a=n&&r.get(n.propertyNames);a&&(n.propertyNames=a)}}var lk=(e,t,r,i)=>{let n=r,a=e._zod.def;n.type="object";let o=a.keyType,c=o._zod.bag?.patterns;if(a.mode==="loose"&&c&&c.size>0){let _=(0,ne.process)(a.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});n.patternProperties={};for(let b of c)(0,Ca.assignProp)(n.patternProperties,b.source,_)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=(0,ne.process)(a.keyType,t,{...i,path:[...i.path,"propertyNames"]});let _=cs.get(t);_||(_=[],cs.set(t,_),t.deferred.push(()=>ck(t))),_.push(e)}n.additionalProperties=(0,ne.process)(a.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let d=o._zod.values,p=t.io==="input"&&Lr(a.valueType)!==void 0;if(d&&!a.partial&&!p){let _=[...d].filter(b=>typeof b=="string"||typeof b=="number");_.length>0&&(n.required=_.map(String))}};k.recordProcessor=lk;var dk=(e,t,r,i)=>{let n=e._zod.def,a=(0,ne.process)(n.innerType,t,i),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=n.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]};k.nullableProcessor=dk;var pk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType};k.nonoptionalProcessor=pk;var ls=Symbol();function Zd(e,t,r,i,n){let a=!1,o=JSON.stringify(e,(s,c)=>typeof c!="bigint"?c:(a=!0,null));return a?((0,ne.handleUnrepresentable)(t,r,i,n,"BigInt defaults cannot be represented in JSON Schema"),ls):JSON.parse(o)}var fk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType;let o=Zd(n.defaultValue,e,t,r,i);o!==ls&&(r.default=o)};k.defaultProcessor=fk;var mk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);if(a.ref=n.innerType,t.io!=="input")return;let o=Zd(n.defaultValue,e,t,r,i);o!==ls&&(r._prefault=o)};k.prefaultProcessor=mk;var gk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType;let o;try{o=n.catchValue(void 0)}catch{(0,ne.handleUnrepresentable)(e,t,r,i,"Dynamic catch values are not supported in JSON Schema");return}r.default=o};k.catchProcessor=gk;var hk=(e,t,r,i)=>{let n=e._zod.def,a=n.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?a?n.out:n.in:n.out;(0,ne.process)(o,t,i);let s=t.seen.get(e);s.ref=o};k.pipeProcessor=hk;var _k=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType,r.readOnly=!0};k.readonlyProcessor=_k;var vk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType};k.promiseProcessor=vk;var yk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType};k.optionalProcessor=yk;var bk=(e,t,r,i)=>{let n=e._zod.innerType;(0,ne.process)(n,t,i);let a=t.seen.get(e);a.ref=n};k.lazyProcessor=bk;k.allProcessors={string:k.stringProcessor,number:k.numberProcessor,boolean:k.booleanProcessor,bigint:k.bigintProcessor,symbol:k.symbolProcessor,null:k.nullProcessor,undefined:k.undefinedProcessor,void:k.voidProcessor,never:k.neverProcessor,any:k.anyProcessor,unknown:k.unknownProcessor,date:k.dateProcessor,enum:k.enumProcessor,literal:k.literalProcessor,nan:k.nanProcessor,template_literal:k.templateLiteralProcessor,file:k.fileProcessor,success:k.successProcessor,custom:k.customProcessor,function:k.functionProcessor,transform:k.transformProcessor,map:k.mapProcessor,set:k.setProcessor,array:k.arrayProcessor,object:k.objectProcessor,union:k.unionProcessor,intersection:k.intersectionProcessor,tuple:k.tupleProcessor,record:k.recordProcessor,nullable:k.nullableProcessor,nonoptional:k.nonoptionalProcessor,default:k.defaultProcessor,prefault:k.prefaultProcessor,catch:k.catchProcessor,pipe:k.pipeProcessor,readonly:k.readonlyProcessor,promise:k.promiseProcessor,optional:k.optionalProcessor,lazy:k.lazyProcessor};function wk(e,t){if("_idmap"in e){let i=e,n=(0,ne.initializeContext)({...t,processors:k.allProcessors}),a={};for(let c of i._idmap.entries()){let[d,p]=c;(0,ne.process)(p,n)}let o={},s={registry:i,uri:t?.uri,defs:a};n.external=s;for(let c of i._idmap.entries()){let[d,p]=c;(0,ne.extractDefs)(n,p),(0,Ca.assignProp)(o,d,(0,ne.finalize)(n,p))}if(Object.keys(a).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:a}}return{schemas:o}}let r=(0,ne.initializeContext)({...t,processors:k.allProcessors});return(0,ne.process)(e,r),(0,ne.extractDefs)(r,e),(0,ne.finalize)(r,e)}});var qd=j(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.JSONSchemaGenerator=void 0;var $k=Vr(),Ma=qr(),ds=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=(0,Ma.initializeContext)({processors:$k.allProcessors,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return(0,Ma.process)(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,(0,Ma.extractDefs)(this.ctx,t);let i=(0,Ma.finalize)(this.ctx,t),{"~standard":n,...a}=i;return a}};Ra.JSONSchemaGenerator=ds});var Vd=j(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0})});var nt=j(de=>{"use strict";var Fd=de&&de.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),zk=de&&de.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),dt=de&&de.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Fd(t,e,r)},Ua=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Fd(t,e,r);return zk(t,e),t};Object.defineProperty(de,"__esModule",{value:!0});de.JSONSchema=de.JSONSchemaGenerator=de.toJSONSchema=de.locales=de.regexes=de.toZod=de.util=void 0;dt(Kn(),de);dt(Do(),de);dt(xo(),de);dt(Nr(),de);dt(Wo(),de);dt(li(),de);dt(qo(),de);de.util=Ua(Z());var Ik=Z();Object.defineProperty(de,"toZod",{enumerable:!0,get:function(){return Ik.toZod}});de.regexes=Ua(yr());de.locales=Ua(Xo());dt(Mr(),de);dt(pi(),de);dt(jd(),de);dt(Ed(),de);dt(qr(),de);var Sk=Vr();Object.defineProperty(de,"toJSONSchema",{enumerable:!0,get:function(){return Sk.toJSONSchema}});var Ok=qd();Object.defineProperty(de,"JSONSchemaGenerator",{enumerable:!0,get:function(){return Ok.JSONSchemaGenerator}});de.JSONSchema=Ua(Vd())});var Za=j(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.slugify=J.toUpperCase=J.toLowerCase=J.trim=J.normalize=J.overwrite=J.mime=J.properties=J.property=J.endsWith=J.startsWith=J.includes=J.uppercase=J.lowercase=J.regex=J.length=J.minLength=J.maxLength=J.size=J.minSize=J.maxSize=J.multipleOf=J.nonnegative=J.nonpositive=J.negative=J.positive=J.gte=J.gt=J.lte=J.lt=void 0;var ye=nt();Object.defineProperty(J,"lt",{enumerable:!0,get:function(){return ye._lt}});Object.defineProperty(J,"lte",{enumerable:!0,get:function(){return ye._lte}});Object.defineProperty(J,"gt",{enumerable:!0,get:function(){return ye._gt}});Object.defineProperty(J,"gte",{enumerable:!0,get:function(){return ye._gte}});Object.defineProperty(J,"positive",{enumerable:!0,get:function(){return ye._positive}});Object.defineProperty(J,"negative",{enumerable:!0,get:function(){return ye._negative}});Object.defineProperty(J,"nonpositive",{enumerable:!0,get:function(){return ye._nonpositive}});Object.defineProperty(J,"nonnegative",{enumerable:!0,get:function(){return ye._nonnegative}});Object.defineProperty(J,"multipleOf",{enumerable:!0,get:function(){return ye._multipleOf}});Object.defineProperty(J,"maxSize",{enumerable:!0,get:function(){return ye._maxSize}});Object.defineProperty(J,"minSize",{enumerable:!0,get:function(){return ye._minSize}});Object.defineProperty(J,"size",{enumerable:!0,get:function(){return ye._size}});Object.defineProperty(J,"maxLength",{enumerable:!0,get:function(){return ye._maxLength}});Object.defineProperty(J,"minLength",{enumerable:!0,get:function(){return ye._minLength}});Object.defineProperty(J,"length",{enumerable:!0,get:function(){return ye._length}});Object.defineProperty(J,"regex",{enumerable:!0,get:function(){return ye._regex}});Object.defineProperty(J,"lowercase",{enumerable:!0,get:function(){return ye._lowercase}});Object.defineProperty(J,"uppercase",{enumerable:!0,get:function(){return ye._uppercase}});Object.defineProperty(J,"includes",{enumerable:!0,get:function(){return ye._includes}});Object.defineProperty(J,"startsWith",{enumerable:!0,get:function(){return ye._startsWith}});Object.defineProperty(J,"endsWith",{enumerable:!0,get:function(){return ye._endsWith}});Object.defineProperty(J,"property",{enumerable:!0,get:function(){return ye._property}});Object.defineProperty(J,"properties",{enumerable:!0,get:function(){return ye._properties}});Object.defineProperty(J,"mime",{enumerable:!0,get:function(){return ye._mime}});Object.defineProperty(J,"overwrite",{enumerable:!0,get:function(){return ye._overwrite}});Object.defineProperty(J,"normalize",{enumerable:!0,get:function(){return ye._normalize}});Object.defineProperty(J,"trim",{enumerable:!0,get:function(){return ye._trim}});Object.defineProperty(J,"toLowerCase",{enumerable:!0,get:function(){return ye._toLowerCase}});Object.defineProperty(J,"toUpperCase",{enumerable:!0,get:function(){return ye._toUpperCase}});Object.defineProperty(J,"slugify",{enumerable:!0,get:function(){return ye._slugify}})});var ps=j(pt=>{"use strict";var kk=pt&&pt.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Pk=pt&&pt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Jd=pt&&pt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kk(t,e,r);return Pk(t,e),t};Object.defineProperty(pt,"__esModule",{value:!0});pt.ZodRealError=pt.ZodError=void 0;var La=Jd(nt()),jk=nt(),Bd=Jd(Z()),Gd=new WeakSet([Object.prototype,Error.prototype]);function qa(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=r(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var Wd=(e,t)=>{jk.$ZodError.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Gd.has(r)||(Gd.add(r),qa(r,"format",i=>n=>La.formatError(i,n)),qa(r,"flatten",i=>n=>La.flattenError(i,n)),qa(r,"addIssue",i=>n=>{i.issues.push(n),i.message=JSON.stringify(i.issues,Bd.jsonStringifyReplacer,2)}),qa(r,"addIssues",i=>n=>{i.issues.push(...n),i.message=JSON.stringify(i.issues,Bd.jsonStringifyReplacer,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};pt.ZodError=La.$constructor("ZodError",Wd);pt.ZodRealError=La.$constructor("ZodError",Wd,void 0,{Parent:Error})});var fs=j(pe=>{"use strict";var Tk=pe&&pe.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Ak=pe&&pe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),xk=pe&&pe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Tk(t,e,r);return Ak(t,e),t};Object.defineProperty(pe,"__esModule",{value:!0});pe.safeDecodeAsync=pe.safeEncodeAsync=pe.safeDecode=pe.safeEncode=pe.decodeAsync=pe.encodeAsync=pe.decode=pe.encode=pe.validateAsync=pe.validate=pe.safeParseAsync=pe.safeParse=pe.parseAsync=pe.parse=void 0;var ft=xk(nt()),mt=ps();pe.parse=ft._parse(mt.ZodRealError);pe.parseAsync=ft._parseAsync(mt.ZodRealError);pe.safeParse=ft._safeParse(mt.ZodRealError);pe.safeParseAsync=ft._safeParseAsync(mt.ZodRealError);var Kd=nt();Object.defineProperty(pe,"validate",{enumerable:!0,get:function(){return Kd.validate}});Object.defineProperty(pe,"validateAsync",{enumerable:!0,get:function(){return Kd.validateAsync}});pe.encode=ft._encode(mt.ZodRealError);pe.decode=ft._decode(mt.ZodRealError);pe.encodeAsync=ft._encodeAsync(mt.ZodRealError);pe.decodeAsync=ft._decodeAsync(mt.ZodRealError);pe.safeEncode=ft._safeEncode(mt.ZodRealError);pe.safeDecode=ft._safeDecode(mt.ZodRealError);pe.safeEncodeAsync=ft._safeEncodeAsync(mt.ZodRealError);pe.safeDecodeAsync=ft._safeDecodeAsync(mt.ZodRealError)});var Hn=j(l=>{"use strict";var Ek=l&&l.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Dk=l&&l.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Ga=l&&l.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ek(t,e,r);return Dk(t,e),t},Nk=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l,"__esModule",{value:!0});l.ZodTuple=l.ZodIntersection=l.ZodDiscriminatedUnion=l.ZodXor=l.ZodUnion=l.ZodObject=l.ZodArray=l.ZodDate=l.ZodVoid=l.ZodNever=l.ZodUnknown=l.ZodAny=l.ZodNull=l.ZodUndefined=l.ZodSymbol=l.ZodBigIntFormat=l.ZodBigInt=l.ZodBoolean=l.ZodNumberFormat=l.ZodNumber=l.ZodCustomStringFormat=l.ZodJWT=l.ZodCreditCard=l.ZodE164=l.ZodBase64URL=l.ZodBase64=l.ZodCIDRv6=l.ZodCIDRv4=l.ZodIPv6=l.ZodMAC=l.ZodIPv4=l.ZodKSUID=l.ZodXID=l.ZodULID=l.ZodCUID2=l.ZodCUID=l.ZodNanoID=l.ZodEmoji=l.ZodURL=l.ZodUUID=l.ZodGUID=l.ZodEmail=l.ZodISODuration=l.ZodISOTime=l.ZodISODate=l.ZodISODateTime=l.ZodStringFormat=l.ZodString=l._ZodString=l.ZodType=void 0;l.stringbool=l.meta=l.describe=l.ZodCustom=l.ZodFunction=l.ZodPromise=l.ZodLazy=l.ZodTemplateLiteral=l.ZodReadonly=l.ZodPreprocess=l.ZodCodec=l.ZodPipe=l.ZodNaN=l.ZodCatch=l.ZodSuccess=l.ZodNonOptional=l.ZodPrefault=l.ZodDefault=l.ZodNullable=l.ZodExactOptional=l.ZodOptional=l.ZodTransform=l.ZodFile=l.ZodLiteral=l.ZodEnum=l.ZodSet=l.ZodMap=l.ZodRecord=void 0;l.string=Va;l.email=Rk;l.guid=Uk;l.uuid=Zk;l.uuidv4=qk;l.uuidv6=Lk;l.uuidv7=Vk;l.url=Fk;l.httpUrl=Bk;l.emoji=Gk;l.nanoid=Jk;l.cuid=Wk;l.cuid2=Kk;l.ulid=Hk;l.xid=Yk;l.ksuid=Xk;l.ipv4=Qk;l.mac=eP;l.ipv6=tP;l.cidrv4=nP;l.cidrv6=rP;l.base64=iP;l.base64url=aP;l.e164=oP;l.creditCard=sP;l.jwt=uP;l.stringFormat=cP;l.hostname=lP;l.hex=dP;l.hash=pP;l.number=Hd;l.int=gs;l.float32=fP;l.float64=mP;l.int32=gP;l.uint32=hP;l.boolean=Yd;l.bigint=_P;l.int64=vP;l.uint64=yP;l.symbol=bP;l.undefined=wP;l.null=Xd;l.any=$P;l.unknown=Sr;l.never=_s;l.void=zP;l.date=IP;l.array=Ja;l.keyof=SP;l.object=OP;l.strictObject=kP;l.looseObject=PP;l.union=vs;l.xor=jP;l.discriminatedUnion=TP;l.intersection=Qd;l.tuple=ep;l.record=tp;l.partialRecord=AP;l.looseRecord=xP;l.map=EP;l.set=DP;l.enum=ys;l.nativeEnum=NP;l.literal=CP;l.file=MP;l.transform=bs;l.optional=Fa;l.exactOptional=np;l.nullable=Ba;l.nullish=RP;l._default=rp;l.prefault=ip;l.nonoptional=ap;l.success=UP;l.catch=op;l.nan=ZP;l.pipe=hs;l.codec=qP;l.invertCodec=LP;l.readonly=sp;l.templateLiteral=VP;l.lazy=up;l.promise=FP;l._function=Wa;l.function=Wa;l._function=Wa;l.function=Wa;l.check=BP;l.custom=GP;l.refine=cp;l.superRefine=lp;l.instanceof=JP;l.json=KP;l.preprocess=HP;var f=Ga(nt()),ce=nt(),se=Ga(Vr()),ms=qr(),Ck=Nk(Ko()),ae=Ga(Za()),gt=Ga(fs());function Mk(){f.globalConfig.localeError||f.config((0,Ck.default)())}function ur(){f.globalConfig.memoizer||f.config({memoizer:f.memoizer()})}l.ZodType=f.$constructor("ZodType",(e,t)=>(Mk(),f.$ZodType.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ce.util.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return f.clone(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cp(e,t))},superRefine(e,t){return this.check(lp(e,t))},overwrite(e){return this.check(ae.overwrite(e))},optional(){return Fa(this)},exactOptional(){return np(this)},nullable(){return Ba(this)},nullish(){return Fa(Ba(this))},nonoptional(e){return ap(this,e)},array(){return Ja(this)},or(e){return vs([this,e])},and(e){return Qd(this,e)},transform(e){return hs(this,bs(e))},default(e){return rp(this,e)},prefault(e){return ip(this,e)},catch(e){return op(this,e)},pipe(e){return hs(this,e)},readonly(){return sp(this)},describe(e){let t=this.clone();return f.globalRegistry.add(t,{description:e}),t},meta(...e){if(e.length===0)return f.globalRegistry.get(this);let t=this.clone();return f.globalRegistry.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ce.util.hide(this,"~standard",{...f.standardProps(this),jsonSchema:{input:(0,ms.createStandardJSONSchemaMethod)(this,"input"),output:(0,ms.createStandardJSONSchemaMethod)(this,"output")}})},set"~standard"(e){ce.util.own(this,"~standard",e)},parse:function e(t,r){return gt.parse(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await gt.parseAsync(this,t,r,{callee:e})},safeParse(e,t){return gt.safeParse(this,e,t)},async safeParseAsync(e,t){return gt.safeParseAsync(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ce.util.own(this,"spa",e)},encode:function e(t,r){return gt.encode(this,t,r,{callee:e})},decode:function e(t,r){return gt.decode(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await gt.encodeAsync(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await gt.decodeAsync(this,t,r,{callee:e})},safeEncode(e,t){return gt.safeEncode(this,e,t)},safeDecode(e,t){return gt.safeDecode(this,e,t)},async safeEncodeAsync(e,t){return gt.safeEncodeAsync(this,e,t)},async safeDecodeAsync(e,t){return gt.safeDecodeAsync(this,e,t)},toJSONSchema(e){return(0,ms.createToJSONSchemaMethod)(this,{})(e)},get description(){return f.globalRegistry.get(this)?.description},get _def(){return this._zod.def}});l._ZodString=f.$constructor("_ZodString",(e,t)=>{f.$ZodString.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.stringProcessor(e,i,n,a);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null},{regex(...e){return this.check(ae.regex(...e))},includes(...e){return this.check(ae.includes(...e))},startsWith(...e){return this.check(ae.startsWith(...e))},endsWith(...e){return this.check(ae.endsWith(...e))},min(...e){return this.check(ae.minLength(...e))},max(...e){return this.check(ae.maxLength(...e))},length(...e){return this.check(ae.length(...e))},nonempty(...e){return this.check(ae.minLength(1,...e))},lowercase(e){return this.check(ae.lowercase(e))},uppercase(e){return this.check(ae.uppercase(e))},trim(){return this.check(ae.trim())},normalize(...e){return this.check(ae.normalize(...e))},toLowerCase(){return this.check(ae.toLowerCase())},toUpperCase(){return this.check(ae.toUpperCase())},slugify(){return this.check(ae.slugify())}});l.ZodString=f.$constructor("ZodString",(e,t)=>{f.$ZodString.init(e,t),l._ZodString.init(e,t)},{email(e){return this.check(f._email(l.ZodEmail,e))},url(e){return this.check(f._url(l.ZodURL,e))},jwt(e){return this.check(f._jwt(l.ZodJWT,e))},emoji(e){return this.check(f._emoji(l.ZodEmoji,e))},guid(e){return this.check(f._guid(l.ZodGUID,e))},uuid(e){return this.check(f._uuid(l.ZodUUID,e))},uuidv4(e){return this.check(f._uuidv4(l.ZodUUID,e))},uuidv6(e){return this.check(f._uuidv6(l.ZodUUID,e))},uuidv7(e){return this.check(f._uuidv7(l.ZodUUID,e))},nanoid(e){return this.check(f._nanoid(l.ZodNanoID,e))},cuid(e){return this.check(f._cuid(l.ZodCUID,e))},cuid2(e){return this.check(f._cuid2(l.ZodCUID2,e))},ulid(e){return this.check(f._ulid(l.ZodULID,e))},base64(e){return this.check(f._base64(l.ZodBase64,e))},base64url(e){return this.check(f._base64url(l.ZodBase64URL,e))},xid(e){return this.check(f._xid(l.ZodXID,e))},ksuid(e){return this.check(f._ksuid(l.ZodKSUID,e))},ipv4(e){return this.check(f._ipv4(l.ZodIPv4,e))},ipv6(e){return this.check(f._ipv6(l.ZodIPv6,e))},cidrv4(e){return this.check(f._cidrv4(l.ZodCIDRv4,e))},cidrv6(e){return this.check(f._cidrv6(l.ZodCIDRv6,e))},e164(e){return this.check(f._e164(l.ZodE164,e))},datetime(e){return this.check(f._isoDateTime(l.ZodISODateTime,e))},date(e){return this.check(f._isoDate(l.ZodISODate,e))},time(e){return this.check(f._isoTime(l.ZodISOTime,e))},duration(e){return this.check(f._isoDuration(l.ZodISODuration,e))}});function Va(e){return f._string(l.ZodString,e)}l.ZodStringFormat=f.$constructor("ZodStringFormat",(e,t)=>{f.$ZodStringFormat.init(e,t),l._ZodString.init(e,t)});l.ZodISODateTime=f.$constructor("ZodISODateTime",(e,t)=>{f.$ZodISODateTime.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodISODate=f.$constructor("ZodISODate",(e,t)=>{f.$ZodISODate.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodISOTime=f.$constructor("ZodISOTime",(e,t)=>{f.$ZodISOTime.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodISODuration=f.$constructor("ZodISODuration",(e,t)=>{f.$ZodISODuration.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodEmail=f.$constructor("ZodEmail",(e,t)=>{f.$ZodEmail.init(e,t),l.ZodStringFormat.init(e,t)});function Rk(e){return f._email(l.ZodEmail,e)}l.ZodGUID=f.$constructor("ZodGUID",(e,t)=>{f.$ZodGUID.init(e,t),l.ZodStringFormat.init(e,t)});function Uk(e){return f._guid(l.ZodGUID,e)}l.ZodUUID=f.$constructor("ZodUUID",(e,t)=>{f.$ZodUUID.init(e,t),l.ZodStringFormat.init(e,t)});function Zk(e){return f._uuid(l.ZodUUID,e)}function qk(e){return f._uuidv4(l.ZodUUID,e)}function Lk(e){return f._uuidv6(l.ZodUUID,e)}function Vk(e){return f._uuidv7(l.ZodUUID,e)}l.ZodURL=f.$constructor("ZodURL",(e,t)=>{f.$ZodURL.init(e,t),l.ZodStringFormat.init(e,t)});function Fk(e){return f._url(l.ZodURL,e)}function Bk(e){return f._url(l.ZodURL,{protocol:f.regexes.httpProtocol,hostname:f.regexes.domain,...ce.util.normalizeParams(e)})}l.ZodEmoji=f.$constructor("ZodEmoji",(e,t)=>{f.$ZodEmoji.init(e,t),l.ZodStringFormat.init(e,t)});function Gk(e){return f._emoji(l.ZodEmoji,e)}l.ZodNanoID=f.$constructor("ZodNanoID",(e,t)=>{f.$ZodNanoID.init(e,t),l.ZodStringFormat.init(e,t)});function Jk(e){return f._nanoid(l.ZodNanoID,e)}l.ZodCUID=f.$constructor("ZodCUID",(e,t)=>{f.$ZodCUID.init(e,t),l.ZodStringFormat.init(e,t)});function Wk(e){return f._cuid(l.ZodCUID,e)}l.ZodCUID2=f.$constructor("ZodCUID2",(e,t)=>{f.$ZodCUID2.init(e,t),l.ZodStringFormat.init(e,t)});function Kk(e){return f._cuid2(l.ZodCUID2,e)}l.ZodULID=f.$constructor("ZodULID",(e,t)=>{f.$ZodULID.init(e,t),l.ZodStringFormat.init(e,t)});function Hk(e){return f._ulid(l.ZodULID,e)}l.ZodXID=f.$constructor("ZodXID",(e,t)=>{f.$ZodXID.init(e,t),l.ZodStringFormat.init(e,t)});function Yk(e){return f._xid(l.ZodXID,e)}l.ZodKSUID=f.$constructor("ZodKSUID",(e,t)=>{f.$ZodKSUID.init(e,t),l.ZodStringFormat.init(e,t)});function Xk(e){return f._ksuid(l.ZodKSUID,e)}l.ZodIPv4=f.$constructor("ZodIPv4",(e,t)=>{f.$ZodIPv4.init(e,t),l.ZodStringFormat.init(e,t)});function Qk(e){return f._ipv4(l.ZodIPv4,e)}l.ZodMAC=f.$constructor("ZodMAC",(e,t)=>{f.$ZodMAC.init(e,t),l.ZodStringFormat.init(e,t)});function eP(e){return f._mac(l.ZodMAC,e)}l.ZodIPv6=f.$constructor("ZodIPv6",(e,t)=>{f.$ZodIPv6.init(e,t),l.ZodStringFormat.init(e,t)});function tP(e){return f._ipv6(l.ZodIPv6,e)}l.ZodCIDRv4=f.$constructor("ZodCIDRv4",(e,t)=>{f.$ZodCIDRv4.init(e,t),l.ZodStringFormat.init(e,t)});function nP(e){return f._cidrv4(l.ZodCIDRv4,e)}l.ZodCIDRv6=f.$constructor("ZodCIDRv6",(e,t)=>{f.$ZodCIDRv6.init(e,t),l.ZodStringFormat.init(e,t)});function rP(e){return f._cidrv6(l.ZodCIDRv6,e)}l.ZodBase64=f.$constructor("ZodBase64",(e,t)=>{f.$ZodBase64.init(e,t),l.ZodStringFormat.init(e,t)});function iP(e){return f._base64(l.ZodBase64,e)}l.ZodBase64URL=f.$constructor("ZodBase64URL",(e,t)=>{f.$ZodBase64URL.init(e,t),l.ZodStringFormat.init(e,t)});function aP(e){return f._base64url(l.ZodBase64URL,e)}l.ZodE164=f.$constructor("ZodE164",(e,t)=>{f.$ZodE164.init(e,t),l.ZodStringFormat.init(e,t)});function oP(e){return f._e164(l.ZodE164,e)}l.ZodCreditCard=f.$constructor("ZodCreditCard",(e,t)=>{f.$ZodCreditCard.init(e,t),l.ZodStringFormat.init(e,t)});function sP(e){return f._creditCard(l.ZodCreditCard,e)}l.ZodJWT=f.$constructor("ZodJWT",(e,t)=>{f.$ZodJWT.init(e,t),l.ZodStringFormat.init(e,t)});function uP(e){return f._jwt(l.ZodJWT,e)}l.ZodCustomStringFormat=f.$constructor("ZodCustomStringFormat",(e,t)=>{f.$ZodCustomStringFormat.init(e,t),l.ZodStringFormat.init(e,t)});function cP(e,t,r={}){return f._stringFormat(l.ZodCustomStringFormat,e,t,r)}function lP(e){return f._stringFormat(l.ZodCustomStringFormat,"hostname",f.regexes.hostname,e)}function dP(e){return f._stringFormat(l.ZodCustomStringFormat,"hex",f.regexes.hex,e)}function pP(e,t){let r=t?.enc??"hex",i=`${e}_${r}`,n=f.regexes[i];if(!n)throw new Error(`Unrecognized hash format: ${i}`);return f._stringFormat(l.ZodCustomStringFormat,i,n,t)}l.ZodNumber=f.$constructor("ZodNumber",(e,t)=>{f.$ZodNumber.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.numberProcessor(e,i,n,a);let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null},{gt(e,t){return this.check(ae.gt(e,t))},gte(e,t){return this.check(ae.gte(e,t))},min(e,t){return this.check(ae.gte(e,t))},lt(e,t){return this.check(ae.lt(e,t))},lte(e,t){return this.check(ae.lte(e,t))},max(e,t){return this.check(ae.lte(e,t))},int(e){return this.check(gs(e))},safe(e){return this.check(gs(e))},positive(e){return this.check(ae.gt(0,e))},nonnegative(e){return this.check(ae.gte(0,e))},negative(e){return this.check(ae.lt(0,e))},nonpositive(e){return this.check(ae.lte(0,e))},multipleOf(e,t){return this.check(ae.multipleOf(e,t))},step(e,t){return this.check(ae.multipleOf(e,t))},finite(){return this}});function Hd(e){return f._number(l.ZodNumber,e)}l.ZodNumberFormat=f.$constructor("ZodNumberFormat",(e,t)=>{f.$ZodNumberFormat.init(e,t),l.ZodNumber.init(e,t)});function gs(e){return f._int(l.ZodNumberFormat,e)}function fP(e){return f._float32(l.ZodNumberFormat,e)}function mP(e){return f._float64(l.ZodNumberFormat,e)}function gP(e){return f._int32(l.ZodNumberFormat,e)}function hP(e){return f._uint32(l.ZodNumberFormat,e)}l.ZodBoolean=f.$constructor("ZodBoolean",(e,t)=>{f.$ZodBoolean.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.booleanProcessor(e,r,i,n)});function Yd(e){return f._boolean(l.ZodBoolean,e)}l.ZodBigInt=f.$constructor("ZodBigInt",(e,t)=>{f.$ZodBigInt.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.bigintProcessor(e,i,n,a);let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null},{gte(e,t){return this.check(ae.gte(e,t))},min(e,t){return this.check(ae.gte(e,t))},gt(e,t){return this.check(ae.gt(e,t))},lt(e,t){return this.check(ae.lt(e,t))},lte(e,t){return this.check(ae.lte(e,t))},max(e,t){return this.check(ae.lte(e,t))},positive(e){return this.check(ae.gt(BigInt(0),e))},negative(e){return this.check(ae.lt(BigInt(0),e))},nonpositive(e){return this.check(ae.lte(BigInt(0),e))},nonnegative(e){return this.check(ae.gte(BigInt(0),e))},multipleOf(e,t){return this.check(ae.multipleOf(e,t))}});function _P(e){return f._bigint(l.ZodBigInt,e)}l.ZodBigIntFormat=f.$constructor("ZodBigIntFormat",(e,t)=>{f.$ZodBigIntFormat.init(e,t),l.ZodBigInt.init(e,t)});function vP(e){return f._int64(l.ZodBigIntFormat,e)}function yP(e){return f._uint64(l.ZodBigIntFormat,e)}l.ZodSymbol=f.$constructor("ZodSymbol",(e,t)=>{f.$ZodSymbol.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.symbolProcessor(e,r,i,n)});function bP(e){return f._symbol(l.ZodSymbol,e)}l.ZodUndefined=f.$constructor("ZodUndefined",(e,t)=>{f.$ZodUndefined.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.undefinedProcessor(e,r,i,n)});function wP(e){return f._undefined(l.ZodUndefined,e)}l.ZodNull=f.$constructor("ZodNull",(e,t)=>{f.$ZodNull.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nullProcessor(e,r,i,n)});function Xd(e){return f._null(l.ZodNull,e)}l.ZodAny=f.$constructor("ZodAny",(e,t)=>{f.$ZodAny.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.anyProcessor(e,r,i,n)});function $P(){return f._any(l.ZodAny)}l.ZodUnknown=f.$constructor("ZodUnknown",(e,t)=>{f.$ZodUnknown.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.unknownProcessor(e,r,i,n)});function Sr(){return f._unknown(l.ZodUnknown)}l.ZodNever=f.$constructor("ZodNever",(e,t)=>{f.$ZodNever.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.neverProcessor(e,r,i,n)});function _s(e){return f._never(l.ZodNever,e)}l.ZodVoid=f.$constructor("ZodVoid",(e,t)=>{f.$ZodVoid.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.voidProcessor(e,r,i,n)});function zP(e){return f._void(l.ZodVoid,e)}l.ZodDate=f.$constructor("ZodDate",(e,t)=>{f.$ZodDate.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.dateProcessor(e,i,n,a),e.min=(i,n)=>e.check(ae.gte(i,n)),e.max=(i,n)=>e.check(ae.lte(i,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function IP(e){return f._date(l.ZodDate,e)}l.ZodArray=f.$constructor("ZodArray",(e,t)=>{ur(),f.$ZodArray.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.arrayProcessor(e,r,i,n),e.element=t.element},{min(e,t){return this.check(ae.minLength(e,t))},nonempty(e){return this.check(ae.minLength(1,e))},max(e,t){return this.check(ae.maxLength(e,t))},length(e,t){return this.check(ae.length(e,t))},unwrap(){return this.element}});function Ja(e,t){return f._array(l.ZodArray,e,t)}function SP(e){let t=e._zod.def.shape;return ys(Object.keys(t))}l.ZodObject=f.$constructor("ZodObject",(e,t)=>{ur(),f.$ZodObjectJIT.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.objectProcessor(e,r,i,n),ce.util.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ys(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Sr()})},loose(){return this.clone({...this._zod.def,catchall:Sr()})},strict(){return this.clone({...this._zod.def,catchall:_s()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ce.util.extend(this,e)},safeExtend(e){return ce.util.safeExtend(this,e)},merge(e){return ce.util.merge(this,e)},pick(e){return ce.util.pick(this,e)},omit(e){return ce.util.omit(this,e)},partial(...e){return ce.util.partial(l.ZodOptional,this,e[0])},exactPartial(...e){return ce.util.partial(l.ZodExactOptional,this,e[0],"exactPartial")},required(...e){return ce.util.required(l.ZodNonOptional,this,e[0])}});function OP(e,t){let r={type:"object",shape:e??{},...ce.util.normalizeParams(t)};return new l.ZodObject(r)}function kP(e,t){return new l.ZodObject({type:"object",shape:e,catchall:_s(),...ce.util.normalizeParams(t)})}function PP(e,t){return new l.ZodObject({type:"object",shape:e,catchall:Sr(),...ce.util.normalizeParams(t)})}l.ZodUnion=f.$constructor("ZodUnion",(e,t)=>{f.$ZodUnion.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.unionProcessor(e,r,i,n),e.options=t.options});function vs(e,t){return new l.ZodUnion({type:"union",options:e,...ce.util.normalizeParams(t)})}l.ZodXor=f.$constructor("ZodXor",(e,t)=>{l.ZodUnion.init(e,t),f.$ZodXor.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.unionProcessor(e,r,i,n),e.options=t.options});function jP(e,t){return new l.ZodXor({type:"union",options:e,inclusive:!1,...ce.util.normalizeParams(t)})}l.ZodDiscriminatedUnion=f.$constructor("ZodDiscriminatedUnion",(e,t)=>{l.ZodUnion.init(e,t),f.$ZodDiscriminatedUnion.init(e,t)});function TP(e,t,r){return new l.ZodDiscriminatedUnion({type:"union",options:t,discriminator:e,...ce.util.normalizeParams(r)})}l.ZodIntersection=f.$constructor("ZodIntersection",(e,t)=>{f.$ZodIntersection.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.intersectionProcessor(e,r,i,n)});function Qd(e,t){return new l.ZodIntersection({type:"intersection",left:e,right:t})}l.ZodTuple=f.$constructor("ZodTuple",(e,t)=>{ur(),f.$ZodTuple.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.tupleProcessor(e,r,i,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new l.ZodOptional({type:"optional",innerType:t}))})}});function ep(e,t,r){let i=t instanceof f.$ZodType,n=i?r:t,a=i?t:null;return new l.ZodTuple({type:"tuple",items:e,rest:a,...ce.util.normalizeParams(n)})}l.ZodRecord=f.$constructor("ZodRecord",(e,t)=>{ur(),f.$ZodRecord.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.recordProcessor(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType});function tp(e,t,r){return!t||!t._zod?new l.ZodRecord({type:"record",keyType:Va(),valueType:e,...ce.util.normalizeParams(t)}):new l.ZodRecord({type:"record",keyType:e,valueType:t,...ce.util.normalizeParams(r)})}function AP(e,t,r){return new l.ZodRecord({type:"record",keyType:e,valueType:t,...ce.util.normalizeParams(r),partial:!0})}function xP(e,t,r){return new l.ZodRecord({type:"record",keyType:e,valueType:t,mode:"loose",...ce.util.normalizeParams(r)})}l.ZodMap=f.$constructor("ZodMap",(e,t)=>{ur(),f.$ZodMap.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.mapProcessor(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(f._minSize(...r)),e.nonempty=r=>e.check(f._minSize(1,r)),e.max=(...r)=>e.check(f._maxSize(...r)),e.size=(...r)=>e.check(f._size(...r))});function EP(e,t,r){return new l.ZodMap({type:"map",keyType:e,valueType:t,...ce.util.normalizeParams(r)})}l.ZodSet=f.$constructor("ZodSet",(e,t)=>{ur(),f.$ZodSet.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.setProcessor(e,r,i,n),e.min=(...r)=>e.check(f._minSize(...r)),e.nonempty=r=>e.check(f._minSize(1,r)),e.max=(...r)=>e.check(f._maxSize(...r)),e.size=(...r)=>e.check(f._size(...r))});function DP(e,t){return new l.ZodSet({type:"set",valueType:e,...ce.util.normalizeParams(t)})}l.ZodEnum=f.$constructor("ZodEnum",(e,t)=>{f.$ZodEnum.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.enumProcessor(e,i,n,a),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(i,n)=>{let a={};for(let o of i)if(r.has(o))a[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new l.ZodEnum({...t,checks:[],...ce.util.normalizeParams(n),entries:a})},e.exclude=(i,n)=>{let a={...t.entries};for(let o of i)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new l.ZodEnum({...t,checks:[],...ce.util.normalizeParams(n),entries:a})}});function ys(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new l.ZodEnum({type:"enum",entries:r,...ce.util.normalizeParams(t)})}function NP(e,t){return new l.ZodEnum({type:"enum",entries:e,...ce.util.normalizeParams(t)})}l.ZodLiteral=f.$constructor("ZodLiteral",(e,t)=>{f.$ZodLiteral.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.literalProcessor(e,r,i,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function CP(e,t){return new l.ZodLiteral({type:"literal",values:Array.isArray(e)?e:[e],...ce.util.normalizeParams(t)})}l.ZodFile=f.$constructor("ZodFile",(e,t)=>{f.$ZodFile.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.fileProcessor(e,r,i,n),e.min=(r,i)=>e.check(f._minSize(r,i)),e.max=(r,i)=>e.check(f._maxSize(r,i)),e.mime=(r,i)=>e.check(f._mime(Array.isArray(r)?r:[r],i))});function MP(e){return f._file(l.ZodFile,e)}l.ZodTransform=f.$constructor("ZodTransform",(e,t)=>{ur(),f.$ZodTransform.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.transformProcessor(e,r,i,n),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new f.$ZodEncodeError(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(ce.util.issue(a,r.value,t));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=r.value),o.inst??(o.inst=e),r.issues.push(ce.util.issue(o))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(a=>(r.value=a,r)):(r.value=n,r)}});function bs(e){return new l.ZodTransform({type:"transform",transform:e})}l.ZodOptional=f.$constructor("ZodOptional",(e,t)=>{f.$ZodOptional.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.optionalProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Fa(e){return new l.ZodOptional({type:"optional",innerType:e})}l.ZodExactOptional=f.$constructor("ZodExactOptional",(e,t)=>{f.$ZodExactOptional.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.optionalProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function np(e){return new l.ZodExactOptional({type:"optional",innerType:e})}l.ZodNullable=f.$constructor("ZodNullable",(e,t)=>{f.$ZodNullable.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nullableProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Ba(e){return new l.ZodNullable({type:"nullable",innerType:e})}function RP(e){return Fa(Ba(e))}l.ZodDefault=f.$constructor("ZodDefault",(e,t)=>{f.$ZodDefault.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.defaultProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rp(e,t){return new l.ZodDefault({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.util.shallowClone(t)}})}l.ZodPrefault=f.$constructor("ZodPrefault",(e,t)=>{f.$ZodPrefault.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.prefaultProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function ip(e,t){return new l.ZodPrefault({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.util.shallowClone(t)}})}l.ZodNonOptional=f.$constructor("ZodNonOptional",(e,t)=>{f.$ZodNonOptional.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nonoptionalProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function ap(e,t){return new l.ZodNonOptional({type:"nonoptional",innerType:e,...ce.util.normalizeParams(t)})}l.ZodSuccess=f.$constructor("ZodSuccess",(e,t)=>{f.$ZodSuccess.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.successProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function UP(e){return new l.ZodSuccess({type:"success",innerType:e})}l.ZodCatch=f.$constructor("ZodCatch",(e,t)=>{f.$ZodCatch.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.catchProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function op(e,t){return new l.ZodCatch({type:"catch",innerType:e,catchValue:typeof t=="function"?t:f.util.constantCatch(t)})}l.ZodNaN=f.$constructor("ZodNaN",(e,t)=>{f.$ZodNaN.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nanProcessor(e,r,i,n)});function ZP(e){return f._nan(l.ZodNaN,e)}l.ZodPipe=f.$constructor("ZodPipe",(e,t)=>{f.$ZodPipe.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.pipeProcessor(e,r,i,n),e.in=t.in,e.out=t.out});function hs(e,t){return new l.ZodPipe({type:"pipe",in:e,out:t})}l.ZodCodec=f.$constructor("ZodCodec",(e,t)=>{l.ZodPipe.init(e,t),f.$ZodCodec.init(e,t)});function qP(e,t,r){return new l.ZodCodec({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function LP(e){let t=e._zod.def;return new l.ZodCodec({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}l.ZodPreprocess=f.$constructor("ZodPreprocess",(e,t)=>{l.ZodPipe.init(e,t),f.$ZodPreprocess.init(e,t)});l.ZodReadonly=f.$constructor("ZodReadonly",(e,t)=>{f.$ZodReadonly.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.readonlyProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function sp(e){return new l.ZodReadonly({type:"readonly",innerType:e})}l.ZodTemplateLiteral=f.$constructor("ZodTemplateLiteral",(e,t)=>{f.$ZodTemplateLiteral.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.templateLiteralProcessor(e,r,i,n)});function VP(e,t){return new l.ZodTemplateLiteral({type:"template_literal",parts:e,...ce.util.normalizeParams(t)})}l.ZodLazy=f.$constructor("ZodLazy",(e,t)=>{f.$ZodLazy.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.lazyProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.getter()});function up(e){return new l.ZodLazy({type:"lazy",getter:e})}l.ZodPromise=f.$constructor("ZodPromise",(e,t)=>{f.$ZodPromise.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.promiseProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function FP(e){return new l.ZodPromise({type:"promise",innerType:e})}l.ZodFunction=f.$constructor("ZodFunction",(e,t)=>{f.$ZodFunction.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.functionProcessor(e,r,i,n)});function Wa(e){return new l.ZodFunction({type:"function",input:Array.isArray(e?.input)?ep(e?.input):e?.input??Ja(Sr()),output:e?.output??Sr()})}l.ZodCustom=f.$constructor("ZodCustom",(e,t)=>{f.$ZodCustom.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.customProcessor(e,r,i,n)});function BP(e){let t=new f.$ZodCheck({check:"custom"});return t._zod.check=e,t}function GP(e,t){return f._custom(l.ZodCustom,e??(()=>!0),t)}function cp(e,t={}){return f._refine(l.ZodCustom,e,t)}function lp(e,t){return f._superRefine(e,t)}l.describe=f.describe;l.meta=f.meta;function JP(e,t={}){let r=new l.ZodCustom({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...ce.util.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:r,path:[...r._zod.def.path??[]]})},r}var WP=(...e)=>f._stringbool({Codec:l.ZodCodec,Boolean:l.ZodBoolean,String:l.ZodString},...e);l.stringbool=WP;function KP(e){let t=up(()=>vs([Va(e),Hd(),Yd(),Xd(),Ja(t),tp(Va(),t)]));return t}function HP(e,t){return new l.ZodPreprocess({type:"pipe",in:bs(e),out:t})}});var mp=j(Ze=>{"use strict";var YP=Ze&&Ze.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),XP=Ze&&Ze.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),QP=Ze&&Ze.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YP(t,e,r);return XP(t,e),t};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ZodFirstPartyTypeKind=Ze.config=Ze.$brand=Ze.ZodIssueCode=void 0;Ze.setErrorMap=ej;Ze.getErrorMap=tj;var pp=QP(nt());Ze.ZodIssueCode={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var fp=nt();Object.defineProperty(Ze,"$brand",{enumerable:!0,get:function(){return fp.$brand}});Object.defineProperty(Ze,"config",{enumerable:!0,get:function(){return fp.config}});function ej(e){pp.config({customError:e})}function tj(){return pp.config().customError}var dp;dp||(Ze.ZodFirstPartyTypeKind=dp={})});var Xa=j(Re=>{"use strict";var nj=Re&&Re.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),rj=Re&&Re.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ij=Re&&Re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nj(t,e,r);return rj(t,e),t};Object.defineProperty(Re,"__esModule",{value:!0});Re.ZodISOTime=Re.ZodISODuration=Re.ZodISODateTime=Re.ZodISODate=void 0;Re.datetime=aj;Re.date=oj;Re.time=sj;Re.duration=uj;var Ka=ij(nt()),Ha=Hn(),Ya=Hn();Object.defineProperty(Re,"ZodISODate",{enumerable:!0,get:function(){return Ya.ZodISODate}});Object.defineProperty(Re,"ZodISODateTime",{enumerable:!0,get:function(){return Ya.ZodISODateTime}});Object.defineProperty(Re,"ZodISODuration",{enumerable:!0,get:function(){return Ya.ZodISODuration}});Object.defineProperty(Re,"ZodISOTime",{enumerable:!0,get:function(){return Ya.ZodISOTime}});function aj(e){return Ka._isoDateTime(Ha.ZodISODateTime,e)}function oj(e){return Ka._isoDate(Ha.ZodISODate,e)}function sj(e){return Ka._isoTime(Ha.ZodISOTime,e)}function uj(e){return Ka._isoDuration(Ha.ZodISODuration,e)}});var vp=j(Cn=>{"use strict";var cj=Cn&&Cn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),lj=Cn&&Cn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$s=Cn&&Cn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cj(t,e,r);return lj(t,e),t};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.fromJSONSchema=wj;var dj=Mr(),ws=Z(),pj=$s(Za()),fj=$s(Xa()),mj=$s(Hn()),B={...mj,...pj,iso:fj},gj=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function hj(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function gp(e,t){return e.map((r,i)=>i<t?r:r.optional())}function _j(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function vj(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===i){let n=r[1]===void 0?void 0:_j(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function yj(e,t){return B.transform(i=>i).check(i=>{let n=i.value;if(!(typeof n!="object"||n===null||Array.isArray(n)))for(let a of Object.getOwnPropertyNames(n)){let o=t.safeParse(a);o.success||i.issues.push({code:"invalid_key",origin:"record",issues:o.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function hp(e,t){if(e!==!1)return e===void 0||e===!0?B.any():rt(e,t)}var bj=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function _p(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return B.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return B.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let a=vj(n,t),o=rt(a,t);return t.refs.set(n,o),t.processing.delete(n),o}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return B.null();if(n.length===0)return B.never();if(n.length===1)return B.literal(n[0]);if(n.every(o=>typeof o=="string"))return B.enum(n);let a=n.map(o=>B.literal(o));return a.length<2?a[0]:B.union([a[0],a[1],...a.slice(2)])}if(e.const!==void 0)return B.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(a=>{let o={...e,type:a};return _p(o,t)});return n.length===0?B.never():n.length===1?n[0]:B.union(n)}if(!r)return B.any();let i;switch(r){case"string":{let n=B.string();if(e.format){let a=e.format;a==="email"?n=n.check(B.email()):a==="uri"||a==="uri-reference"?n=n.check(B.url()):a==="uuid"||a==="guid"?n=n.check(B.uuid()):a==="date-time"?n=n.check(B.iso.datetime({offset:!0})):a==="date"?n=n.check(B.iso.date()):a==="time"?n=n.check(B.regex(bj)):a==="duration"?n=n.check(B.iso.duration()):a==="hostname"?n=n.check(B.hostname()):a==="ipv4"?n=n.check(B.ipv4()):a==="ipv6"?n=n.check(B.ipv6()):a==="mac"?n=n.check(B.mac()):a==="cidr"?n=n.check(B.cidrv4()):a==="cidr-v6"?n=n.check(B.cidrv6()):a==="base64"?n=n.check(B.base64()):a==="base64url"?n=n.check(B.base64url()):a==="e164"?n=n.check(B.e164()):a==="credit_card"?n=n.check(B.creditCard()):a==="jwt"?n=n.check(B.jwt()):a==="emoji"?n=n.check(B.emoji()):a==="nanoid"?n=n.check(B.nanoid()):a==="cuid"?n=n.check(B.cuid()):a==="cuid2"?n=n.check(B.cuid2()):a==="ulid"?n=n.check(B.ulid()):a==="xid"?n=n.check(B.xid()):a==="ksuid"&&(n=n.check(B.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),i=n;break}case"number":case"integer":{let n=r==="integer"?B.number().int():B.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),i=n;break}case"boolean":{i=B.boolean();break}case"null":{i=B.null();break}case"object":{let n={},a=e.properties||{},o=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?rt(e.additionalProperties,t):void 0;for(let[c,d]of Object.entries(a)){let p=rt(d,t);(0,ws.assignProp)(n,c,o.has(c)?p:p.optional())}if(e.patternProperties){let c=e.patternProperties,d=Object.keys(c),p=[];for(let b of d){let w=rt(c[b],t),z=B.string().regex(new RegExp(b));p.push(B.looseRecord(z,w))}let _=[];if(Object.keys(n).length>0&&_.push(B.object(n).passthrough()),_.push(...p),_.length===0)i=B.object({}).passthrough();else if(_.length===1)i=_[0];else{let b=B.intersection(_[0],_[1]);for(let w=2;w<_.length;w++)b=B.intersection(b,_[w]);i=b}if(e.additionalProperties===!1){let b=Object.keys(n),w=d.map(N=>new RegExp(N)),z=i;i=i.check(N=>{if(!(0,ws.isPlainObject)(N.value))return;let q=[];for(let _e of Object.keys(N.value))b.includes(_e)||w.some(Y=>Y.test(_e))||q.push(_e);q.length&&N.issues.push({code:"unrecognized_keys",keys:q,input:N.value,inst:z})})}}else{let c=B.object(n);e.additionalProperties===!1?i=c.strict():s?i=c.catchall(s):i=c.passthrough()}if(e.propertyNames!==void 0&&e.propertyNames!==!0){let c=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;i=yj(i,rt(c,t))}break}case"array":{let n=e.prefixItems,a=e.items;if(n&&Array.isArray(n)){let o=typeof e.minItems=="number"?e.minItems:0,s=n.map(_=>rt(_,t)),c=gp(s,o),d=Array.isArray(a)?void 0:hp(a,t),p=B.tuple(c);i=d?p.rest(d):p,typeof e.minItems=="number"&&(i=i.check(B.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(B.maxLength(e.maxItems)))}else if(Array.isArray(a)){let o=typeof e.minItems=="number"?e.minItems:0,s=a.map(_=>rt(_,t)),c=gp(s,o),d=hp(e.additionalItems,t),p=B.tuple(c);i=d?p.rest(d):p,typeof e.minItems=="number"&&(i=i.check(B.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(B.maxLength(e.maxItems)))}else if(a!==void 0){let o=rt(a,t),s=B.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),i=s}else i=B.array(B.any());break}default:throw new Error(`Unsupported type: ${r}`)}return i}function rt(e,t){if(typeof e=="boolean")return e?B.any():B.never();let r=_p(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(d=>rt(d,t)),c=B.union(s);r=i?B.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(d=>rt(d,t)),c=B.xor(s);r=i?B.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=i?r:B.any();else{let s=i?r:rt(e.allOf[0],t),c=i?0:1;for(let d=c;d<e.allOf.length;d++)s=B.intersection(s,rt(e.allOf[d],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=B.nullable(r)),e.readOnly===!0&&(r=B.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},a=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of a)s in e&&(n[s]=e[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in e&&(n[s]=e[s]);e.propertyNames!==void 0&&e.type==="object"&&e.$ref===void 0&&(n.propertyNames=e.propertyNames);for(let s of Object.keys(e))gj.has(s)||(0,ws.assignProp)(n,s,e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function wj(e,t){if(typeof e=="boolean")return e?B.any():B.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=hj(r,t?.defaultTarget),n=r.$defs||r.definitions||{},a={version:i,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??dj.globalRegistry};return rt(r,a)}});var zs=j(Mn=>{"use strict";var $j=Mn&&Mn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),zj=Mn&&Mn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Ij=Mn&&Mn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$j(t,e,r);return zj(t,e),t};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.visit=Oj;var Sj=Ij(Nr()),yt=Z(),yp=Symbol("z.visit/resolving");function Oj(e,t){let r=typeof t=="function"?t:(o,s)=>{let c=t[o._zod.def.type];return c?c(o,s):o},i=new Map;function n(o){let s=i.get(o);if(s===yp)return new Sj.$ZodLazy({type:"lazy",getter:()=>i.get(o)});if(s!==void 0)return s;i.set(o,yp);let c=a(o),d=r(c,c!==o);return i.set(o,d),d}function a(o){let s=o._zod.def,c=s.type;switch(c){case"object":{let d=s.shape,p=Object.keys(d),_=!1,b={};for(let z of p){let N=n(d[z]);N!==d[z]&&(_=!0),b[z]=N}let w=s.catchall;return s.catchall&&(w=n(s.catchall),w!==s.catchall&&(_=!0)),_?(0,yt.clone)(o,{...s,shape:b,catchall:w}):o}case"array":{let d=n(s.element);return d===s.element?o:(0,yt.clone)(o,{...s,element:d})}case"tuple":{let d=s.items,p=!1,_=[];for(let w of d){let z=n(w);z!==w&&(p=!0),_.push(z)}let b=s.rest;return s.rest&&(b=n(s.rest),b!==s.rest&&(p=!0)),p?(0,yt.clone)(o,{...s,items:_,rest:b}):o}case"record":case"map":{let d=n(s.keyType),p=n(s.valueType);return d===s.keyType&&p===s.valueType?o:(0,yt.clone)(o,{...s,keyType:d,valueType:p})}case"set":{let d=n(s.valueType);return d===s.valueType?o:(0,yt.clone)(o,{...s,valueType:d})}case"union":{let d=s.options,p=!1,_=[];for(let b of d){let w=n(b);w!==b&&(p=!0),_.push(w)}return p?(0,yt.clone)(o,{...s,options:_}):o}case"intersection":{let d=n(s.left),p=n(s.right);return d===s.left&&p===s.right?o:(0,yt.clone)(o,{...s,left:d,right:p})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let d=n(s.innerType);return d===s.innerType?o:(0,yt.clone)(o,{...s,innerType:d})}case"pipe":{let d=n(s.in),p=n(s.out);return d===s.in&&p===s.out?o:(0,yt.clone)(o,{...s,in:d,out:p})}case"function":{let d=n(s.input),p=n(s.output);return d===s.input&&p===s.output?o:(0,yt.clone)(o,{...s,input:d,output:p})}case"lazy":{let d=s.getter,{_cachedInner:p,..._}=s;return(0,yt.clone)(o,{..._,getter:()=>n(d())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return n(e)}});var bp=j(Rn=>{"use strict";var kj=Rn&&Rn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Pj=Rn&&Rn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),jj=Rn&&Rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kj(t,e,r);return Pj(t,e),t};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.deepPartial=xj;var Tj=zs(),Aj=jj(Hn());function xj(e){return(0,Tj.visit)(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:Aj.union(r.options)}})}});var Ip=j(Tn=>{"use strict";var Ej=Tn&&Tn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Dj=Tn&&Tn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Nj=Tn&&Tn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ej(t,e,r);return Dj(t,e),t};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.input=Uj;Tn.output=Zj;var wp=Z(),$p=zs(),Cj=Nj(Hn());function Mj(e,t){if(!t?.length)return e;let r=e._zod.def;return(0,wp.clone)(e,(0,wp.mergeDefs)(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function zp(e){return Mj(e.out,e.checks)}function Rj(e){return e.in._zod.traits.has("$ZodTransform")?zp(e):e.in}function Uj(e){return(0,$p.visit)(e,{pipe:t=>Rj(t._zod.def),default:(t,r)=>r?Cj.optional(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function Zj(e){return(0,$p.visit)(e,{pipe:t=>zp(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}});var Op=j(ut=>{"use strict";var qj=ut&&ut.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Lj=ut&&ut.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Sp=ut&&ut.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qj(t,e,r);return Lj(t,e),t};Object.defineProperty(ut,"__esModule",{value:!0});ut.string=Vj;ut.number=Fj;ut.boolean=Bj;ut.bigint=Gj;ut.date=Jj;var Fr=Sp(nt()),Br=Sp(Hn());function Vj(e){return Fr._coercedString(Br.ZodString,e)}function Fj(e){return Fr._coercedNumber(Br.ZodNumber,e)}function Bj(e){return Fr._coercedBoolean(Br.ZodBoolean,e)}function Gj(e){return Fr._coercedBigint(Br.ZodBigInt,e)}function Jj(e){return Fr._coercedDate(Br.ZodDate,e)}});var Is=j(R=>{"use strict";var kp=R&&R.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Wj=R&&R.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Qa=R&&R.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kp(t,e,r);return Wj(t,e),t},Gr=R&&R.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&kp(t,e,r)};Object.defineProperty(R,"__esModule",{value:!0});R.coerce=R.iso=R.ZodISODuration=R.ZodISOTime=R.ZodISODate=R.ZodISODateTime=R.locales=R.output=R.input=R.deepPartial=R.fromJSONSchema=R.toJSONSchema=R.getDiscriminatedOption=R.ZodCompileUnsupportedError=R.ZodCompileAsyncError=R.compile=R.toZod=R.NEVER=R.util=R.TimePrecision=R.flattenError=R.formatError=R.prettifyError=R.treeifyError=R.regexes=R.clone=R.$brand=R.$input=R.$output=R.memoizer=R.config=R.registry=R.globalRegistry=R.core=void 0;R.core=Qa(nt());Gr(Hn(),R);Gr(Za(),R);Gr(ps(),R);Gr(fs(),R);Gr(mp(),R);var Ne=nt();Object.defineProperty(R,"globalRegistry",{enumerable:!0,get:function(){return Ne.globalRegistry}});Object.defineProperty(R,"registry",{enumerable:!0,get:function(){return Ne.registry}});Object.defineProperty(R,"config",{enumerable:!0,get:function(){return Ne.config}});Object.defineProperty(R,"memoizer",{enumerable:!0,get:function(){return Ne.memoizer}});Object.defineProperty(R,"$output",{enumerable:!0,get:function(){return Ne.$output}});Object.defineProperty(R,"$input",{enumerable:!0,get:function(){return Ne.$input}});Object.defineProperty(R,"$brand",{enumerable:!0,get:function(){return Ne.$brand}});Object.defineProperty(R,"clone",{enumerable:!0,get:function(){return Ne.clone}});Object.defineProperty(R,"regexes",{enumerable:!0,get:function(){return Ne.regexes}});Object.defineProperty(R,"treeifyError",{enumerable:!0,get:function(){return Ne.treeifyError}});Object.defineProperty(R,"prettifyError",{enumerable:!0,get:function(){return Ne.prettifyError}});Object.defineProperty(R,"formatError",{enumerable:!0,get:function(){return Ne.formatError}});Object.defineProperty(R,"flattenError",{enumerable:!0,get:function(){return Ne.flattenError}});Object.defineProperty(R,"TimePrecision",{enumerable:!0,get:function(){return Ne.TimePrecision}});Object.defineProperty(R,"util",{enumerable:!0,get:function(){return Ne.util}});Object.defineProperty(R,"NEVER",{enumerable:!0,get:function(){return Ne.NEVER}});Object.defineProperty(R,"toZod",{enumerable:!0,get:function(){return Ne.toZod}});Object.defineProperty(R,"compile",{enumerable:!0,get:function(){return Ne.compile}});Object.defineProperty(R,"ZodCompileAsyncError",{enumerable:!0,get:function(){return Ne.ZodCompileAsyncError}});Object.defineProperty(R,"ZodCompileUnsupportedError",{enumerable:!0,get:function(){return Ne.ZodCompileUnsupportedError}});Object.defineProperty(R,"getDiscriminatedOption",{enumerable:!0,get:function(){return Ne.getDiscriminatedOption}});var Kj=Vr();Object.defineProperty(R,"toJSONSchema",{enumerable:!0,get:function(){return Kj.toJSONSchema}});var Hj=vp();Object.defineProperty(R,"fromJSONSchema",{enumerable:!0,get:function(){return Hj.fromJSONSchema}});var Yj=bp();Object.defineProperty(R,"deepPartial",{enumerable:!0,get:function(){return Yj.deepPartial}});var Pp=Ip();Object.defineProperty(R,"input",{enumerable:!0,get:function(){return Pp.input}});Object.defineProperty(R,"output",{enumerable:!0,get:function(){return Pp.output}});R.locales=Qa(Xo());var eo=Xa();Object.defineProperty(R,"ZodISODateTime",{enumerable:!0,get:function(){return eo.ZodISODateTime}});Object.defineProperty(R,"ZodISODate",{enumerable:!0,get:function(){return eo.ZodISODate}});Object.defineProperty(R,"ZodISOTime",{enumerable:!0,get:function(){return eo.ZodISOTime}});Object.defineProperty(R,"ZodISODuration",{enumerable:!0,get:function(){return eo.ZodISODuration}});R.iso=Qa(Xa());R.coerce=Qa(Op())});var Je=j(Xe=>{"use strict";var jp=Xe&&Xe.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Xj=Xe&&Xe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Qj=Xe&&Xe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jp(t,e,r);return Xj(t,e),t},eT=Xe&&Xe.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&jp(t,e,r)};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.default=Xe.z=void 0;var Tp=Qj(Is());Xe.z=Tp;Xe.default=Tp;eT(Is(),Xe)});var it=j(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.apiMetadata=void 0;Or.apiMetadataOf=nT;var tT=Je(),Ss=class extends tT.z.core.$ZodRegistry{owners=new Map;add(t,r){if(r.id!==void 0){if(this.owners.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this.owners.set(r.id,t)}return super.add(t,r)}remove(t){let r=this.get(t)?.id;return r!==void 0&&this.owners.get(r)===t&&this.owners.delete(r),super.remove(t)}clear(){return this.owners.clear(),super.clear()}};Or.apiMetadata=new Ss;function nT(e){return Or.apiMetadata.get(e)}});var ks=j(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.FINANCIAL_RUNTIME_PATH_PREFIX=We.FINANCIAL_RUNTIME_ROUTES=void 0;We.isFinancialRuntimeRequestId=rT;We.financialRuntimeRoutePath=iT;We.financialRuntimeRoute=Os;We.financialRuntimeBodyMismatch=aT;We.nativeAgentFinancialRuntimeAction=oT;function rT(e){return typeof e=="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}var to=["requestId","operationId","agentId","runtimeId","connectorKeyId","grantId","grantVersion","intentHash","issuedAtSec","identitySlip","connectorProof","leaseConnectorProof","signingInput"];We.FINANCIAL_RUNTIME_ROUTES={"device-context":{fields:["requestId","agentId"],id:"requestId",clients:"auth",variants:[["requestId","agentId","runtimeId"]]},"device-handoff-create":{fields:["requestId","proposal","ceremony"],id:"requestId",clients:"auth",variants:[["requestId","proposal","requestPop"]]},"device-handoff-read":{fields:["requestId","proposal"],id:"requestId",clients:"both"},"device-handoff-proof":{fields:["requestId","proposal","childPop"],id:"requestId",clients:"auth"},"device-handoff-prepare":{fields:["requestId","proposal","ownerSession"],id:"requestId",clients:"web",variants:[["requestId","proposal","ownerSession","instrumentId"],["requestId","proposal","ownerSession","instrumentId","certificateExpiresAt"]]},"device-handoff-signatures":{fields:["requestId","proposal","ownerSession","certificate","delegation"],id:"requestId",clients:"web",variants:[["requestId","proposal","ownerSession","certificate"]]},"device-handoff-activate":{fields:["requestId","proposal","ownerSession"],id:"requestId",clients:"web"},"device-prepare":{fields:["ownerSession","requestId","associationId","runtimeId","publicJwk"],id:"requestId",clients:"web"},"device-activate":{fields:["ownerSession","requestId","certificate","delegation","childPop"],id:"requestId",clients:"web"},"device-renew-prepare":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"device-renew-activate":{fields:["ownerSession","requestId","certificate","delegation"],id:"requestId",clients:"web"},lookup:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},pause:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},resume:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"revoke-agent":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"teardown-claim":{fields:["ownerSession","requestId"],id:"requestId",clients:"web"},"teardown-confirm":{fields:["ownerSession","requestId","teardownIds"],id:"requestId",clients:"web"},history:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},prepare:{fields:["ownerSession","requestId","associationId","custody"],id:"requestId",clients:"web",variants:[["ownerSession","requestId","associationId","custody","runtimeId"]]},"tempo-pay":{fields:["requestId","runtimeId","requestPop","request","intent"],variants:[["requestId","runtimeId","requestPop","request","intent","ownerApproval"],["requestId","runtimeId","requestPop","request","intent","purchaseKey"],["requestId","runtimeId","requestPop","request","intent","ownerApproval","purchaseKey"],["requestId","runtimeId","requestPop","request","intent","merchantUrl"],["requestId","runtimeId","requestPop","request","intent","ownerApproval","merchantUrl"],["requestId","runtimeId","requestPop","request","intent","purchaseKey","merchantUrl"],["requestId","runtimeId","requestPop","request","intent","ownerApproval","purchaseKey","merchantUrl"]],id:"requestId",clients:"auth"},"tempo-history":{fields:["requestId","runtimeId","requestPop","limit"],id:"requestId",clients:"auth"},"tempo-report":{fields:["requestId","runtimeId","requestPop","outcome","txHash"],id:"requestId",clients:"auth"},"tempo-attempt":{fields:["requestId","runtimeId","requestPop","attemptRequestId"],id:"requestId",clients:"auth"},"tempo-context":{nativeAgentOperation:"agent.financialRuntime.context",fields:["requestId","agentId","runtimeId"],id:"requestId",clients:"auth"},"atum-sign":{fields:["requestId","runtimeId","requestPop","request","intent"],variants:[["requestId","runtimeId","requestPop","request","intent","ownerApproval"]],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.sign"},"atum-operation":{fields:["requestId","runtimeId","requestPop","operationRequestId"],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.operation"},"atum-confirm":{fields:["requestId","runtimeId","requestPop","operationRequestId","transactionHash"],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.confirm"},"atum-settle":{fields:["requestId","runtimeId","requestPop","settlement"],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.settle"},"tempo-wallets":{fields:["ownerSession"],id:"correlation",clients:"web",variants:[["ownerSession","keysOnly"]]},"tempo-status":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"tempo-disable":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"tempo-retire-ungranted":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"tempo-cleanup-confirm":{fields:["ownerSession","requestId","accessKeyAddress"],id:"requestId",clients:"web"},"tempo-limit-confirm":{fields:["ownerSession","requestId","agentId","txHash"],id:"requestId",clients:"web"},"tempo-limit-intent":{fields:["ownerSession","requestId","agentId","txHash","raw"],id:"requestId",clients:"web"},"tempo-enroll-prepare":{fields:["ownerSession","requestId","agentId","accessKeyAddress"],id:"requestId",clients:"web"},"tempo-enroll-finish":{fields:["ownerSession","requestId","agentId","accountAddress","accessKeyAddress","accessKeyPublicKey","turnkeyPrivateKeyId","tokenAddress","limitMicros","periodSeconds","expiresAtSeconds","authorizationTxHash"],id:"requestId",clients:"web"},"tempo-hosted-autonomous":{fields:[...to,"terms","request"],variants:[[...to,"terms","request","hostedTap"]],id:"requestId",clients:"none"},"tempo-hosted-context":{fields:["requestId","agentId","runtimeId"],variants:[["requestId","agentId","runtimeId","terms"]],id:"requestId",clients:"none"},"tempo-hosted-prepare":{fields:["requestId","operationId","agentId","runtimeId","terms","request"],id:"requestId",clients:"none"},"tempo-hosted-status":{fields:["requestId","agentId","runtimeId"],id:"requestId",clients:"none"},"tempo-hosted-approved":{fields:["requestId","operationId","agentId","runtimeId","terms","request","ownerApproval"],variants:[[...to,"terms","request","ownerApproval","hostedTap"]],id:"requestId",clients:"none"},"card-hosted-context":{fields:["requestId","agentId","runtimeId"],id:"requestId",clients:"none"},"card-hosted-presence":{fields:[...to],id:"requestId",clients:"none"},"card-hosted-status":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"card-hosted-setup":{fields:["ownerSession","requestId","agentId","instrumentId","certificateExpiresAt"],variants:[["ownerSession","requestId","agentId","instrumentId","certificateExpiresAt","signerRequestId"]],id:"requestId",clients:"web"},"card-hosted-activate":{fields:["ownerSession","requestId","certificate"],id:"requestId",clients:"web"},"tempo-connector-autonomy":{fields:["ownerSession","requestId","agentId","statement"],id:"requestId",clients:"web"}};We.FINANCIAL_RUNTIME_PATH_PREFIX="/v1/financial-runtime/";function iT(e){return We.FINANCIAL_RUNTIME_PATH_PREFIX+e}function Os(e){return Object.hasOwn(We.FINANCIAL_RUNTIME_ROUTES,e)?We.FINANCIAL_RUNTIME_ROUTES[e]:null}function aT(e,t){let r=Os(e);if(!r)return`unknown financial-runtime action "${e}"`;if(!t||typeof t!="object"||Array.isArray(t))return`financial-runtime "${e}" body must be an object`;let i=Object.keys(t).sort(),n=[...r.fields].sort();if([n,...(r.variants??[]).map(c=>[...c].sort())].some(c=>c.join(",")===i.join(",")))return null;let o=n.filter(c=>!i.includes(c)),s=i.filter(c=>!n.includes(c));return`financial-runtime "${e}" body`+(o.length?` is missing ${o.join(", ")}`:"")+(o.length&&s.length?" and":"")+(s.length?` carries unexpected ${s.join(", ")}`:"")}function oT(e){if(!e.startsWith(We.FINANCIAL_RUNTIME_PATH_PREFIX))return null;let t=e.slice(We.FINANCIAL_RUNTIME_PATH_PREFIX.length);return Os(t)?.nativeAgentOperation?t:null}});var Un=j(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.AGENT_AUTH=Qe.CSRF_HEADER=Qe.FAMILY_PREFIX=Qe.PRODUCT_FAMILIES=void 0;Qe.defineOperations=sT;Qe.openApiPath=uT;Qe.pathParams=cT;Qe.operationPathMatchesFamily=lT;var Ap=ks();Qe.PRODUCT_FAMILIES=["owner","agent"];Qe.FAMILY_PREFIX={owner:"/owner/v1/",agent:"/agent/v1/",admin:"/admin/v1/",mcp:"/mcp",oauth:"/oauth/","well-known":"/.well-known/",public:"/"};Qe.CSRF_HEADER="X-CSRF-Token";Qe.AGENT_AUTH=["agent_signature","agent_token","oauth_token","app_token"];function sT(e){return e}function uT(e){return e.replace(/:([A-Za-z][A-Za-z0-9_]*)/g,"{$1}")}function cT(e){return[...e.matchAll(/:([A-Za-z][A-Za-z0-9_]*)/g)].map(t=>t[1])}function lT(e){if(e.path.startsWith(Qe.FAMILY_PREFIX[e.family]))return!0;let t=(0,Ap.nativeAgentFinancialRuntimeAction)(e.path);return e.family==="agent"&&e.method==="POST"&&t!==null&&(0,Ap.financialRuntimeRoute)(t)?.nativeAgentOperation===e.id}});var ct=j(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.OwnerStatusWordSchema=I.OWNER_STATUS_WORDS=I.PaymentMoney=I.PaymentFacts=I.EVIDENCE_QUALITY=I.Attempt=I.ProviderEvidence=I.ATTEMPT_CLOSED_EVIDENCE=I.ATTEMPT_STATES=I.ATTEMPT_KINDS=I.PAYMENT_TERMINAL_STATES=I.PAYMENT_STATES=I.Operation=I.OwnerAction=I.WithdrawalTerms=I.TokenRef=I.OperationStep=I.OPERATION_TERMINAL_STATES=I.OPERATION_STEP_STATES=I.OPERATION_STATES=I.FINANCIAL_OPERATION_KINDS=I.OPERATION_STEP_ACTIONS=I.DEVICE_APPROVER_ACTIONS=I.OPERATION_KINDS=I.Readiness=I.Continuation=I.RetryOrExpiry=I.ACTORS=I.CapabilitySchema=I.CAPABILITIES=I.ReadinessLevelSchema=I.READINESS_LADDER=I.PageQuery=I.Page=I.Surface=I.SURFACES=I.Rail=I.RAILS=I.Amount=I.Asset=I.ASSETS=I.Micros=I.Timestamp=I.Id=void 0;I.ownerStatusWord=pT;var C=Je(),Q=it();I.Id=C.z.string().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/).clone().register(Q.apiMetadata,{id:"Id",description:"An opaque identifier: 1\u2013128 ASCII characters, starting alphanumeric, then alphanumeric or . _ : -"});I.Timestamp=C.z.iso.datetime({offset:!1}).clone().register(Q.apiMetadata,{id:"Timestamp",description:"An RFC 3339 timestamp in UTC, with the `Z` designator."});I.Micros=C.z.string().regex(/^(0|[1-9][0-9]{0,24})$/).clone().register(Q.apiMetadata,{id:"Micros",description:"Integer micros (10\u207B\u2076 of one unit of the asset) as a decimal string."});I.ASSETS=["USD","OUSD","USDC.e"];I.Asset=C.z.enum(I.ASSETS).clone().register(Q.apiMetadata,{id:"Asset",description:"USD is the card rail; OUSD and USDC.e are Tempo stablecoins."});I.Amount=C.z.object({micros:I.Micros,asset:I.Asset}).clone().register(Q.apiMetadata,{id:"Amount",description:"An exact amount of one asset."});I.RAILS=["tempo","card"];I.Rail=C.z.enum(I.RAILS).clone().register(Q.apiMetadata,{id:"Rail",description:'How money moves. A field on payments, approvals and grants, never a path. tempo = Tempo MPP from the owner wallet (owner-facing copy says "wallet"); card = a VIC network credential minted from the owner\u2019s enrolled card.'});I.SURFACES=["laptop","hosted"];I.Surface=C.z.enum(I.SURFACES).clone().register(Q.apiMetadata,{id:"Surface",description:"Where the agent runs. laptop = the Visa CLI and its stdio MCP on a computer the owner controls; hosted = a remote connector (OAuth) or REST app."});I.Page=C.z.object({next_cursor:C.z.string().nullable()}).clone().register(Q.apiMetadata,{id:"Page",description:"Cursor pagination. `next_cursor` is null on the last page."});I.PageQuery=C.z.object({cursor:C.z.string().optional(),limit:C.z.coerce.number().int().min(1).max(100).optional()});I.READINESS_LADDER=["supported","configured","authorized","funded","ready"];I.ReadinessLevelSchema=C.z.enum(I.READINESS_LADDER).clone().register(Q.apiMetadata,{id:"ReadinessLevel",description:"supported: this deployment and host can offer it. configured: its prerequisites exist. authorized: the owner granted it to this agent. funded: money is there to use it. ready: this exact operation can proceed. A rung that does not apply to a capability (identity has no funding) is passed through."});I.CAPABILITIES=["identity","tempo","card","tap","hosted_connection"];I.CapabilitySchema=C.z.enum(I.CAPABILITIES).clone().register(Q.apiMetadata,{id:"Capability"});I.ACTORS=["agent","owner","server","operator"];I.RetryOrExpiry=C.z.discriminatedUnion("kind",[C.z.object({kind:C.z.literal("retry"),after_seconds:C.z.number().int().min(0),until:I.Timestamp.nullable()}),C.z.object({kind:C.z.literal("expires"),at:I.Timestamp}),C.z.object({kind:C.z.literal("none")})]).clone().register(Q.apiMetadata,{id:"RetryOrExpiry",description:"retry: the actor may repeat the same request (same identifiers) after the delay, until the deadline. expires: the step lapses at `at`. none: no timing rule (for example a terminal state)."});I.Continuation=C.z.object({actor:C.z.enum(I.ACTORS),next_action:C.z.string().regex(/^[a-z][a-z0-9_]*$/).clone().register(Q.apiMetadata,{description:"A stable machine code for the next step, for example `approve_payment`."}),message:C.z.string().clone().register(Q.apiMetadata,{description:"One plain sentence for the actor."}),url:C.z.url().nullable().clone().register(Q.apiMetadata,{description:"Where the owner acts, when the actor is the owner."}),retry_or_expiry:I.RetryOrExpiry}).clone().register(Q.apiMetadata,{id:"Continuation",description:"What happens next and who does it. Every non-terminal answer carries one; the server decides it and clients only display it."});I.Readiness=C.z.discriminatedUnion("status",[C.z.object({status:C.z.literal("ready"),capability:I.CapabilitySchema,reached:C.z.literal("ready"),continuation:C.z.null()}),C.z.object({status:C.z.literal("incomplete"),capability:I.CapabilitySchema,reached:C.z.enum(["supported","configured","authorized","funded"]).clone().register(Q.apiMetadata,{description:"The highest rung reached so far."}),continuation:I.Continuation.clone().register(Q.apiMetadata,{description:"Required: who climbs the next rung, and how."})}),C.z.object({status:C.z.literal("unsupported"),capability:I.CapabilitySchema,reached:C.z.null(),continuation:C.z.null()})]).clone().register(Q.apiMetadata,{id:"Readiness",description:"ready: nothing left to do. incomplete: a continuation is always given. unsupported: not offered on this deployment or host."});I.OPERATION_KINDS=["wallet_enable","setup","renewal","revocation_teardown","account_closure","account_recovery","provider_cleanup","withdrawal","telemetry_deletion","chain_limit"];I.DEVICE_APPROVER_ACTIONS=["create_device_approver_guard","create_device_approver_user","create_tempo_signer_guard","create_tempo_signer_user","create_device_approver_policy","update_device_approver_policy"];I.OPERATION_STEP_ACTIONS=["revoke_wallet_key","withdraw_tap_entry","remove_custody_user","remove_device_approver","end_card_mandate","remove_card_instrument","end_connector_tokens","delete_provider_data","delete_telemetry","sign_withdrawal","broadcast_withdrawal","sign_key_authorization","sign_tap_enrollment","sign_hosted_identity","sign_chain_limit","sign_renewal","create_owner_wallet","create_owner_identity_root",...I.DEVICE_APPROVER_ACTIONS];I.FINANCIAL_OPERATION_KINDS=["withdrawal"];I.OPERATION_STATES=["pending","running","needs_owner_action","succeeded","failed","cancelled"];I.OPERATION_STEP_STATES=["pending","running","done","failed","skipped"];I.OPERATION_TERMINAL_STATES=["succeeded","failed","cancelled"];I.OperationStep=C.z.object({action:C.z.enum(I.OPERATION_STEP_ACTIONS),state:C.z.enum(I.OPERATION_STEP_STATES),effect:C.z.enum(["removal","owner_signed"]).clone().register(Q.apiMetadata,{description:"removal: revoke or delete only. owner_signed: needs the owner\u2019s signature."}),executor:C.z.enum(["server","owner"]).clone().register(Q.apiMetadata,{description:"server: a removal-only step the server finishes under a narrow delegated permission (revoke, delete). owner: a step that needs the owner\u2019s own signature (P3)."}),external_refs:C.z.array(C.z.object({system:C.z.string(),ref:C.z.string()})).clone().register(Q.apiMetadata,{description:"Transaction hashes and provider ids."}),completed_at:I.Timestamp.nullable(),evidence:C.z.string().nullable().clone().register(Q.apiMetadata,{description:"Verified completion evidence; telemetry alone never counts."})}).clone().register(Q.apiMetadata,{id:"OperationStep"});I.TokenRef=C.z.discriminatedUnion("kind",[C.z.object({kind:C.z.literal("supported"),asset:C.z.enum(["OUSD","USDC.e"])}),C.z.object({kind:C.z.literal("other"),contract_address:C.z.string().regex(/^0x[0-9a-fA-F]{40}$/).clone().register(Q.apiMetadata,{description:"Any other token the wallet holds (unsupported or sent by mistake)."})})]).clone().register(Q.apiMetadata,{id:"TokenRef"});I.WithdrawalTerms=C.z.object({chain_id:C.z.number().int(),to_address:C.z.string().regex(/^0x[0-9a-fA-F]{40}$/),token:I.TokenRef,amount_base_units:C.z.string().regex(/^(0|[1-9][0-9]{0,77})$/).clone().register(Q.apiMetadata,{description:"Exact amount in the token\u2019s own base units, so sub-micro dust is representable."})}).clone().register(Q.apiMetadata,{id:"WithdrawalTerms",description:"The immutable terms of one withdrawal, fixed when the operation is recorded (before any signature or broadcast)."});I.OwnerAction=C.z.object({action:C.z.enum(["sign_withdrawal","sign_key_authorization","sign_tap_enrollment","sign_hosted_identity","sign_chain_limit","sign_renewal","create_owner_wallet","create_owner_identity_root","revoke_wallet_key","remove_custody_user","remove_device_approver",...I.DEVICE_APPROVER_ACTIONS,"revoke_wallet_key","remove_custody_user","remove_device_approver"]),challenge_id:I.Id.clone().register(Q.apiMetadata,{description:"Fetch or renew it with owner.operations.challenge."}),expires_at:I.Timestamp}).clone().register(Q.apiMetadata,{id:"OwnerAction",description:"The owner signature an operation is waiting for."});I.Operation=C.z.object({id:I.Id,kind:C.z.enum(I.OPERATION_KINDS),state:C.z.enum(I.OPERATION_STATES),steps:C.z.array(I.OperationStep),withdrawal:I.WithdrawalTerms.nullable().clone().register(Q.apiMetadata,{description:"Set for kind withdrawal: its immutable terms."}),owner_action:I.OwnerAction.nullable().clone().register(Q.apiMetadata,{description:"Set while state is needs_owner_action."}),needs_attention:C.z.boolean().clone().register(Q.apiMetadata,{description:"Stuck, overdue or unsafe: shown to the owner and in the operator view."}),created_at:I.Timestamp,updated_at:I.Timestamp,continuation:I.Continuation.nullable()}).clone().register(Q.apiMetadata,{id:"Operation",description:"Durable multi-step work. Recorded before any external effect, so status and recovery follow the owner across browsers and devices. Spending shutdown never stops withdrawals, export, reconciliation or cleanup."});I.PAYMENT_STATES=["proposed","awaiting_owner","authorized","submitted","unknown","issued","settled","released","refused","declined","expired","failed"];I.PAYMENT_TERMINAL_STATES=["issued","settled","released","refused","declined","expired","failed"];I.ATTEMPT_KINDS=["quote","approval","execution"];I.ATTEMPT_STATES=["open","approved","declined","admitted","credential_issued","signed","submitted","settled","superseded","expired","refused","failed","unknown"];I.ATTEMPT_CLOSED_EVIDENCE=["expired_unsigned","expired_on_chain","provider_void","declined","refused_before_signing","superseded_quote","settled"];I.ProviderEvidence=C.z.object({provider:C.z.literal("turnkey"),organization_id:C.z.string(),activity_id:C.z.string(),fingerprint:C.z.string(),status:C.z.string().clone().register(Q.apiMetadata,{description:"The provider\u2019s own activity status, as last read by the server."}),observed_at:I.Timestamp}).clone().register(Q.apiMetadata,{id:"ProviderEvidence",description:"The durable locator of the provider signing activity for one execution attempt. Recorded when the activity is created and re-read, never trusted from the client."});I.Attempt=C.z.object({id:I.Id,kind:C.z.enum(I.ATTEMPT_KINDS),state:C.z.enum(I.ATTEMPT_STATES),terms:C.z.object({amount:I.Amount,funding_max:I.Amount.clone().register(Q.apiMetadata,{description:"The most of the funding asset it may consume (a swap\u2019s maxIn)."}),fee_ceiling:I.Amount,merchant:C.z.string(),expires_at:I.Timestamp.clone().register(Q.apiMetadata,{description:"Quote validity or the charge\u2019s valid-before."})}).clone().register(Q.apiMetadata,{description:"The exact terms this attempt binds (its terms_hash). Changed terms need fresh consent."}),terms_hash:C.z.string(),wire_request_id:C.z.uuid().nullable().clone().register(Q.apiMetadata,{description:"Execution attempts: the client-chosen execution id (unique), used as the PoP nonce."}),signing_hash:C.z.string().nullable().clone().register(Q.apiMetadata,{description:"The chain signing payload hash: one charge, one attempt (unique)."}),network_ref:C.z.string().nullable().clone().register(Q.apiMetadata,{description:"Transaction hash once known."}),provider_evidence:I.ProviderEvidence.nullable(),admission_expires_at:I.Timestamp.nullable().clone().register(Q.apiMetadata,{description:"A signed admission is honoured by SlipGate for at most 60 seconds after issue."}),closed_evidence:C.z.enum(I.ATTEMPT_CLOSED_EVIDENCE).nullable(),created_at:I.Timestamp}).clone().register(Q.apiMetadata,{id:"Attempt",description:"One quote, approval or execution of a purchase. A replacement quote stays on the same purchase. Another execution requires the previous one closed with evidence that it can no longer execute. An explicit decline is terminal."});I.EVIDENCE_QUALITY=["proven","conservative_max"];I.PaymentFacts=C.z.object({credential_issued_at:I.Timestamp.nullable(),submission_reported_at:I.Timestamp.nullable(),funds_settled_at:I.Timestamp.nullable(),settlement:C.z.object({kind:C.z.literal("merchant_held"),network_ref:C.z.string().regex(/^0x[0-9a-f]{64}$/)}).strict().nullable().clone().register(Q.apiMetadata,{description:"Independently reconciled receive-policy hold: the recorded debit left the wallet but did not reach the merchant. Recovery eligibility depends on the merchant settings; this is never an unpaid retry or a claim authorization. Null means no retained proof of this cause, not delivery."}),delivery:C.z.enum(["none","delivered","unavailable"]).clone().register(Q.apiMetadata,{description:'Merchant delivery, separate from money. `unavailable` is "paid, result unavailable": Visa stores no request or result content, so recovery runs between the agent and the merchant.'})}).clone().register(Q.apiMetadata,{id:"PaymentFacts"});I.PaymentMoney=C.z.object({authorized:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"What the owner (or their grant) authorized."}),may_still_owe:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"Reserved exposure still unresolved."}),moved:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"What actually left the funding source, where known."}),received:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"Refunds or reversals received back."}),fees:I.Amount.nullable(),evidence_quality:C.z.enum(I.EVIDENCE_QUALITY).clone().register(Q.apiMetadata,{description:"proven, or a conservative maximum (as with a swap\u2019s maxIn)."})}).clone().register(Q.apiMetadata,{id:"PaymentMoney"});I.OWNER_STATUS_WORDS=["Pending","Settling","Completed","Card issued","Cancelled","Failed","Needs attention"];I.OwnerStatusWordSchema=C.z.enum(I.OWNER_STATUS_WORDS).clone().register(Q.apiMetadata,{id:"OwnerStatusWord",description:"The only words the owner sees for a payment."});var dT={proposed:"Pending",awaiting_owner:"Pending",authorized:"Pending",issued:"Card issued",submitted:"Settling",settled:"Completed",released:"Cancelled",refused:"Cancelled",declined:"Cancelled",expired:"Cancelled",failed:"Failed",unknown:"Needs attention"};function pT(e){return e.overdue_operation||e.state==="settled"&&e.delivery==="unavailable"?"Needs attention":dT[e.state]}});var no=j(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.ALWAYS_POSSIBLE=Ce.SPENDING_OFF_REFUSALS=Ce.Problem=Ce.ERROR_STAGES=Ce.WIRE_ERROR_FAMILIES=Ce.ERROR_FAMILY_NAMES=Ce.ERROR_FAMILIES=void 0;var Zn=Je(),Ps=it(),fT=ct();Ce.ERROR_FAMILIES={update_required:{kind:"caller",status:426,retryable:!1,message:"This Visa CLI is older than the server accepts. Update the CLI: npm install -g @visa/cli@rc",fix:"Update Visa CLI, restart the agent session, then retry the same request."},setup_required:{kind:"caller",status:401,retryable:!1,message:"This agent is not connected, signed in or set up here.",fix:"Run visa connect (shell) or call the connect tool (MCP) and have the owner finish the browser step; both resume where they left off. Then retry the original request."},owner_approval_required:{kind:"platform",status:403,retryable:!0,message:"The owner must approve this first.",fix:"Show the owner the approval link in the continuation and wait. Then retry the same request with the same identifiers; do not change it or start a new one."},owner_declined:{kind:"platform",status:403,retryable:!1,message:"The owner declined this.",fix:"Stop. Do not retry it automatically. Tell the owner; only if they ask again, start a new request, which asks them again."},agent_inactive:{kind:"platform",status:403,retryable:!1,message:"This agent cannot act: it is paused, revoked or its keys were replaced.",fix:"Do not retry. Ask the owner to check the agent in the Visa Console: they resume a paused agent, or connect a new one."},grant_required:{kind:"platform",status:403,retryable:!1,message:"This agent has no current spending approval.",fix:"Nothing was charged. Ask the owner to approve or renew the agent\u2019s limits in the Visa Console, then retry the same payment once."},limit_reached:{kind:"platform",status:403,retryable:!1,message:"This payment is over a spending limit.",fix:"Nothing was charged. Try a smaller amount or later, or ask the owner to raise the limit. Do not loop, and do not switch agents or payment methods to get around it."},blocked:{kind:"platform",status:403,retryable:!1,message:"Visa refused this request.",fix:"Tell the owner what was refused. Do not retry, and do not switch agents, payment methods or merchants to get around it."},merchant_unsupported:{kind:"caller",status:422,retryable:!1,message:"This merchant cannot be paid this way.",fix:"Nothing was charged. Do not retry it unchanged: pay a merchant that supports this payment, or tell the human."},invalid_request:{kind:"caller",status:400,retryable:!1,message:"Some details in this request were not valid.",fix:"Correct the request and try again. To check an earlier purchase, use its original reference."},not_found:{kind:"caller",status:404,retryable:!1,message:"Visa could not find that for this agent.",fix:"Check the reference and the selected agent. Do not create a replacement because a read found nothing."},expired:{kind:"caller",status:410,retryable:!1,message:"That request expired before it was completed.",fix:"Check the original request\u2019s outcome first, then start a fresh one."},conflict:{kind:"caller",status:409,retryable:!0,message:"An existing request conflicts with this one.",fix:"Check the original request by its reference; if it is still in progress, wait and retry the same request. Do not start a replacement."},outcome_unknown:{kind:"caller",status:202,retryable:!0,message:"The result of this request is not known yet.",fix:"Do not pay again or create a replacement. Read the original purchase, or repeat the request with the same identifiers, until its outcome is known."},unavailable:{kind:"platform",status:503,retryable:!0,message:"Visa, or a service it depends on, did not answer.",fix:"Check whether the original request went through before trying another payment, and retry later. Do not switch agents or payment methods."},not_enabled:{kind:"platform",status:403,retryable:!1,message:"This feature is not available right now.",fix:"Tell Visa support which feature you tried to use. Retrying or signing in again will not turn it on."},local_keystore:{kind:"platform",status:0,retryable:!0,message:"This computer\u2019s key store could not be used, so nothing was signed or sent.",fix:"Ask the owner to fix the key store on this computer (unlock it, restore access or sync the clock), then retry once."},rate_limited:{kind:"caller",status:429,retryable:!0,message:"Too many requests from this caller right now.",fix:"Wait for the Retry-After time (also in retry_after_seconds), then repeat the same request with the same identifiers. Do not switch agents to get around it."},internal_error:{kind:"platform",status:500,retryable:!1,message:"Visa could not complete this request.",fix:"Tell a human, with the request reference. Do not retry a payment automatically."}};Ce.ERROR_FAMILY_NAMES=Object.keys(Ce.ERROR_FAMILIES);Ce.WIRE_ERROR_FAMILIES=Ce.ERROR_FAMILY_NAMES.filter(e=>Ce.ERROR_FAMILIES[e].status!==0);Ce.ERROR_STAGES=["edge","identity","grant","controls","policy","approval","execution","settlement"];Ce.Problem=Zn.z.object({code:Zn.z.enum(Ce.ERROR_FAMILY_NAMES),detail:Zn.z.string().clone().register(Ps.apiMetadata,{description:"The specific check that refused. Diagnostic only."}),stage:Zn.z.enum(Ce.ERROR_STAGES),message:Zn.z.string(),fix:Zn.z.string(),retryable:Zn.z.boolean(),request_id:Zn.z.string(),retry_after_seconds:Zn.z.number().int().min(0).nullable().clone().register(Ps.apiMetadata,{description:"Set with rate_limited (and mirrored in the Retry-After header)."}),continuation:fT.Continuation.nullable()}).clone().register(Ps.apiMetadata,{id:"Problem",description:"The one refusal shape. Branch on `code` only. Money refusals state whether anything was charged in `message`."});Ce.SPENDING_OFF_REFUSALS={operator_kill_switch:{code:"not_enabled",detail:"spending_admission_off"},owner_stop_all:{code:"blocked",detail:"owner_spending_stopped"}};Ce.ALWAYS_POSSIBLE=["invalid_request","rate_limited","unavailable","internal_error"]});var Kr=j(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.NATIVE_FINANCIAL_OPERATIONS=F.NativeFinancialRefusal=F.NativeAtumSettlementResult=F.NativeAtumSignResult=F.NativeAtumApprovalDetail=F.NativeAtumOperationResult=F.NativeAtumOperation=F.NativeTempoContext=F.NativeAtumSettleInput=F.NativeAtumSettlement=F.NativeAtumConfirmInput=F.NativeAtumOperationInput=F.NativeAtumSignPrivateInput=F.NativeAtumSignInput=F.NativeTempoContextInput=F.NativeAtumOwnerTerms=F.NativeAtumSignRequest=F.NativeAtumSigningOperation=F.NativeAtumDeployment=F.NativeAtumFundingPlan=F.NativeAtumFundingTerms=void 0;var h=Je(),je=it(),xp=ks(),mT=Un(),gT=no(),An=h.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),Te=h.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i),Ae=h.z.string().regex(/^0x[0-9a-fA-F]{40}$/),qn=h.z.string().regex(/^0x[0-9a-fA-F]*$/),Wr=h.z.string().regex(/^0x[0-9a-fA-F]{64}$/),bt=h.z.string().regex(/^(0|[1-9][0-9]{0,15})$/),cr=h.z.json().register(je.apiMetadata,{id:"NativeFinancialJson",description:"Original JSON protocol value. No reconstruction, HTTP body capture, logging or telemetry permission."}),ro=h.z.record(h.z.string(),cr),js=h.z.strictObject({to:Ae,data:qn,value:h.z.literal("0x0")}),hT=h.z.strictObject({network:h.z.string(),token:Ae,recipient:Ae,amount:bt}),Up=h.z.strictObject({url:h.z.string(),method:h.z.enum(["GET","POST"]),bodySha256:h.z.string().regex(/^[0-9a-f]{64}$/).nullable()}),_T=h.z.strictObject({token:Ae,maxAmountInMicros:bt});F.NativeAtumFundingTerms=h.z.strictObject({v:h.z.literal(1),agentId:Te,runtimeId:Te,economicIntentId:h.z.string(),ownerAccount:Ae,fundingAccount:Ae,sourceNetwork:h.z.literal("eip155:4217"),sourceToken:h.z.literal("0x20c000000000000000000000b9537d11c60e8b50"),sourceCapMicros:bt,approvalFeeCapMicros:bt,ownerTransferFeeCapMicros:bt,maxOwnerDebitMicros:bt,ownerSwap:_T.optional(),merchant:Up,destination:hT}).register(je.apiMetadata,{id:"NativeAtumFundingTerms"});F.NativeAtumFundingPlan=h.z.strictObject({terms:F.NativeAtumFundingTerms,termsHash:h.z.string().regex(/^[0-9a-f]{64}$/),fundedAmountMicros:bt,ownerDebitCapMicros:bt,ownerTransfer:js,ownerCalls:h.z.array(js),permit2Approval:js}).register(je.apiMetadata,{id:"NativeAtumFundingPlan"});F.NativeAtumDeployment=h.z.strictObject({chainId:h.z.literal(4217),escrow:Ae,reserver:Ae,releaser:Ae}).register(je.apiMetadata,{id:"NativeAtumDeployment"});var Jr=h.z.strictObject({chainId:h.z.number(),maxPriorityFeePerGas:qn,maxFeePerGas:qn,gas:qn,calls:h.z.array(h.z.strictObject({to:Ae.nullable(),value:qn,data:qn})),accessList:h.z.array(cr),nonceKey:qn,nonce:qn,validBefore:h.z.number().nullable(),validAfter:h.z.number().nullable(),feeToken:Ae.nullable(),feePayer:h.z.boolean(),authorizationList:h.z.array(cr),keyAuthorization:cr}),Zp=h.z.strictObject({witness:h.z.strictObject({depositId:Wr,quoteHash:Wr,depositRequestHash:Wr,destinationHash:Wr,depositor:Ae,token:Ae,amount:bt,feeAmount:bt,reserver:Ae,releaser:Ae,settler:Ae}),signature:qn});F.NativeAtumSigningOperation=h.z.discriminatedUnion("kind",[h.z.strictObject({kind:h.z.literal("prefund"),transaction:Jr}),h.z.strictObject({kind:h.z.literal("permit2_approval"),transaction:Jr}),h.z.strictObject({kind:h.z.literal("permit2_revoke"),transaction:Jr}),h.z.strictObject({kind:h.z.literal("deposit_witness"),deadline:h.z.number(),escrow:Ae,reserver:Ae,releaser:Ae}),h.z.strictObject({kind:h.z.literal("refund"),transaction:Jr,amountMicros:bt}),h.z.strictObject({kind:h.z.literal("escrow_refund"),transaction:Jr,authorization:Zp})]).register(je.apiMetadata,{id:"NativeAtumSigningOperation"});F.NativeAtumSignRequest=h.z.strictObject({deployment:F.NativeAtumDeployment,plan:F.NativeAtumFundingPlan,operation:F.NativeAtumSigningOperation,keyRef:h.z.strictObject({subOrganizationId:h.z.string(),accessKeyAddress:Ae})}).register(je.apiMetadata,{id:"NativeAtumSignRequest"});F.NativeAtumOwnerTerms=h.z.strictObject({v:h.z.literal(1),plan:F.NativeAtumFundingPlan,prefundSigningHash:h.z.string().regex(/^[A-Za-z0-9_-]{43}$/),grantId:Te,grantVersion:h.z.number().int().positive()}).register(je.apiMetadata,{id:"NativeAtumOwnerTerms"});var io=h.z.string().min(1).max(65536);F.NativeTempoContextInput=h.z.strictObject({requestId:Te,agentId:Te,runtimeId:Te}).register(je.apiMetadata,{id:"NativeTempoContextInput"});var qp={requestId:An,runtimeId:An,requestPop:io,request:F.NativeAtumSignRequest,intent:cr.clone().register(je.apiMetadata,{description:"The original signing context, canonical JSON at most 4096 bytes. Transient replay at this existing boundary; not a capture or telemetry request."})};F.NativeAtumSignInput=h.z.strictObject({...qp,approvalOperationId:Te.clone().register(je.apiMetadata,{description:"Original public approval lookup reference. Never signed owner authorization."}).optional()}).register(je.apiMetadata,{id:"NativeAtumSignInput"});F.NativeAtumSignPrivateInput=h.z.strictObject({...qp,ownerApproval:h.z.strictObject({statement:io,terms:F.NativeAtumOwnerTerms}).optional()}).register(je.apiMetadata,{id:"NativeAtumSignPrivateInput"});F.NativeAtumOperationInput=h.z.strictObject({requestId:An,runtimeId:An,requestPop:io,operationRequestId:An}).register(je.apiMetadata,{id:"NativeAtumOperationInput"});F.NativeAtumConfirmInput=F.NativeAtumOperationInput.extend({transactionHash:Wr}).register(je.apiMetadata,{id:"NativeAtumConfirmInput"});var vT=h.z.object({version:h.z.string(),request_id:h.z.string(),source:h.z.strictObject({asset_identifier:h.z.string(),account:h.z.string()}),destination:h.z.array(h.z.strictObject({asset_identifier:h.z.string(),account:h.z.string()})),fulfillment_amount:h.z.string(),max_source_amount:h.z.string(),quote_deadline:h.z.string(),fulfillment_deadline:h.z.string(),escrow_contract_address:h.z.string(),fulfillment_proxy:h.z.string(),quote_selector:h.z.string(),fulfillment_verifier:h.z.strictObject({account:h.z.string(),endpoint:h.z.string()}),sender_auth:h.z.strictObject({message_scheme:h.z.string(),signed_messages:h.z.array(h.z.strictObject({message:h.z.string(),message_prehash:h.z.string(),signature:h.z.string()}))}),executor:h.z.strictObject({deposit:h.z.literal("settler"),reserve:h.z.literal("settler"),fulfill:h.z.literal("originator")}),presentation:ro.optional()}).catchall(cr),Ep=h.z.strictObject({scheme:h.z.string(),network:h.z.string(),asset:h.z.string(),amount:h.z.string(),payTo:h.z.string(),maxTimeoutSeconds:h.z.number(),extra:ro}),Dp=h.z.strictObject({request:vT,paymentRequired:h.z.strictObject({x402Version:h.z.number(),error:h.z.string().optional(),resource:h.z.strictObject({url:h.z.string(),description:h.z.string().optional(),mimeType:h.z.string().optional(),serviceName:h.z.string().optional(),tags:h.z.array(h.z.string()).optional(),iconUrl:h.z.string().optional()}),accepts:h.z.array(Ep),extensions:ro.optional()}),requirements:Ep,merchantRequest:Up}),yT=h.z.object({version:h.z.string(),scheme:h.z.literal("EIP-3009"),authorization:h.z.strictObject({message:h.z.string(),message_prehash:h.z.string().optional(),signature:h.z.string(),payload:ro.optional()}),fulfillment_quote_json:h.z.string(),evidence:h.z.strictObject({transaction_id:h.z.string(),log_index:h.z.number()})}).catchall(cr);F.NativeAtumSettlement=h.z.union([h.z.strictObject({operationRequestId:An,abort:h.z.literal(!0)}),h.z.strictObject({operationRequestId:An,prepared:Dp,sourceTransactionHash:h.z.string(),refundAuthorization:Zp}),h.z.strictObject({operationRequestId:An,prepared:Dp,sourceTransactionHash:h.z.string(),fulfillment:yT,destinationTransactionHash:h.z.string()})]).register(je.apiMetadata,{id:"NativeAtumSettlement"});F.NativeAtumSettleInput=h.z.strictObject({requestId:An,runtimeId:An,requestPop:io,settlement:F.NativeAtumSettlement}).register(je.apiMetadata,{id:"NativeAtumSettleInput"});var Np={v:h.z.literal(1),available:h.z.boolean(),swapAvailable:h.z.boolean()};F.NativeTempoContext=h.z.union([h.z.strictObject({...Np,enrolled:h.z.literal(!1)}),h.z.strictObject({...Np,enrolled:h.z.literal(!0),paymentMode:h.z.strictObject({mode:h.z.string(),reason:h.z.string(),reasonText:h.z.string()}).nullable(),budget:h.z.strictObject({remainingMicros:h.z.string(),perTransactionMicros:h.z.string(),expiresAt:h.z.string()}).nullable(),accountAddress:Ae,accessKeyAddress:Ae,accessKeyPublicKey:h.z.string(),subOrganizationId:h.z.string(),tokenAddress:Ae,limitMicros:h.z.string().nullable(),periodSeconds:h.z.number(),expiresAtSeconds:h.z.number(),atum:h.z.strictObject({deployment:F.NativeAtumDeployment,forwardAvailable:h.z.boolean()}).optional()})]).register(je.apiMetadata,{id:"NativeTempoContext"});var Cp=h.z.strictObject({blockNumber:h.z.string().nullable(),blockHash:h.z.string().nullable(),timestamp:h.z.number()}),bT=F.NativeAtumFundingTerms.pick({economicIntentId:!0,ownerAccount:!0,fundingAccount:!0,sourceCapMicros:!0,approvalFeeCapMicros:!0,ownerTransferFeeCapMicros:!0,ownerSwap:!0,destination:!0}).extend({planTermsHash:h.z.string(),fundedAmountMicros:h.z.string(),ownerDebitCapMicros:h.z.string()});F.NativeAtumOperation=h.z.strictObject({v:h.z.literal(1),status:h.z.enum(["admitted","signed","refused","indeterminate","confirmed","expired","not_found","failed"]),operationId:Te,requestId:Te,requestHash:h.z.string(),purchaseId:Te,signingHash:h.z.string(),kind:h.z.enum(["prefund","permit2_approval","permit2_revoke","deposit_witness","refund","escrow_refund"]),attempt:h.z.number().int().positive(),reservedMicros:h.z.string(),destination:h.z.strictObject({network:h.z.string(),token:h.z.string(),recipient:h.z.string(),amountBaseUnits:h.z.string()}),signature:h.z.string().optional(),transactionHash:h.z.string().optional(),activity:h.z.strictObject({organizationId:h.z.string(),activityId:h.z.string(),fingerprint:h.z.string(),validBefore:h.z.string(),status:h.z.string()}).optional(),resumable:h.z.boolean().optional(),nonLandingEvidence:h.z.strictObject({kind:h.z.string(),reference:h.z.string().nullable()}).optional(),receipt:h.z.strictObject({blockNumber:h.z.string().nullable().optional(),blockHash:h.z.string().nullable().optional(),sender:h.z.string().nullable().optional(),reverted:h.z.boolean().nullable().optional(),delivered:h.z.boolean().nullable().optional(),feeMicros:h.z.string().nullable().optional(),status:h.z.literal("expired").optional(),anchor:Cp.optional(),finalized:Cp.optional()}).optional(),request:F.NativeAtumSignRequest.optional(),originalAccessKeyPublicKey:h.z.string().optional(),financial:h.z.strictObject({binding:bT,operation:F.NativeAtumSigningOperation}).optional()}).register(je.apiMetadata,{id:"NativeAtumOperation"});var Lp=h.z.strictObject({v:h.z.literal(1),status:h.z.literal("not_found")});F.NativeAtumOperationResult=h.z.union([F.NativeAtumOperation,Lp]).register(je.apiMetadata,{id:"NativeAtumOperationResult"});F.NativeAtumApprovalDetail=h.z.strictObject({v:h.z.literal(1),approvalId:Te,purchaseId:Te,agentId:Te,runtimeId:Te,terms:F.NativeAtumOwnerTerms,binding:h.z.strictObject({ownerPrincipalId:Te,associationId:Te,associationVersion:h.z.number().int().positive(),agentId:Te,rootJkt:h.z.string().regex(/^[A-Za-z0-9_-]{43}$/),operationId:Te}),expiresAt:h.z.iso.datetime()}).register(je.apiMetadata,{id:"NativeAtumApprovalDetail",description:"Original native owner review from the authenticated Money reader. approvalId names the existing approval route; purchaseId and binding.operationId name the original purchase. Exact optional review terms are separately deletable and never telemetry or immutable history. The owner resolves the existing named identity root through the authenticated SDK and verifies its JKT against binding.rootJkt; this record is not authorization."});F.NativeAtumSignResult=h.z.union([F.NativeAtumOperation,h.z.strictObject({v:h.z.literal(1),status:h.z.literal("owner_approval_required"),purchaseId:Te,approvalId:Te.optional().clone().register(je.apiMetadata,{description:"Original approval route ID, distinct from the purchase lookup reference. Supplied by the canonical native owner approval receiver."}),agentId:Te,originalRequest:F.NativeAtumSignRequest,expiresAt:h.z.string(),ownerTerms:F.NativeAtumOwnerTerms})]).register(je.apiMetadata,{id:"NativeAtumSignResult"});var Mp=h.z.enum(["OUSD","USDC.e","USD"]),wT=h.z.strictObject({word:h.z.enum(["Pending","Card issued","Settling","Completed","Cancelled","Failed","Needs attention"]),authorizedMicros:h.z.string(),asset:Mp,mayStillOweMicros:h.z.string(),fundingAsset:Mp,debitedMicros:h.z.string().nullable(),feeMicros:h.z.string().nullable(),movedMicros:h.z.string(),movedQuality:h.z.enum(["proven","conservative_max"]).nullable(),refundedMicros:h.z.string(),received:h.z.enum(["none","available","unavailable"]),settlement:h.z.strictObject({kind:h.z.literal("merchant_held"),networkRef:h.z.string()}).nullable()});F.NativeAtumSettlementResult=h.z.union([Lp,h.z.strictObject({v:h.z.literal(1),status:h.z.literal("pending"),purchaseId:Te}),h.z.strictObject({v:h.z.literal(1),status:h.z.enum(["completed","refunded","not_funded"]),purchaseId:Te,accounting:wT})]).register(je.apiMetadata,{id:"NativeAtumSettlementResult"});F.NativeFinancialRefusal=h.z.union([h.z.strictObject({code:h.z.enum(gT.WIRE_ERROR_FAMILIES),detail:h.z.string(),retryable:h.z.boolean(),next_action:h.z.string().optional()}),h.z.strictObject({code:h.z.literal("internal_error"),detail:h.z.literal("unexpected")})]).register(je.apiMetadata,{id:"NativeFinancialRefusal"});var Rp={"tempo-context":{body:F.NativeTempoContextInput,response:F.NativeTempoContext,summary:"Read the current laptop Tempo runtime and native ATUM availability"},"atum-sign":{body:F.NativeAtumSignInput,response:F.NativeAtumSignResult,summary:"Admit or resume the original native ATUM signing operation"},"atum-operation":{body:F.NativeAtumOperationInput,response:F.NativeAtumOperationResult,summary:"Read the original admitted native ATUM operation"},"atum-confirm":{body:F.NativeAtumConfirmInput,response:F.NativeAtumOperationResult,summary:"Reconcile a native ATUM operation against its transaction"},"atum-settle":{body:F.NativeAtumSettleInput,response:F.NativeAtumSettlementResult,summary:"Reconcile original native ATUM settlement or cancellation evidence"}};F.NATIVE_FINANCIAL_OPERATIONS=(0,mT.defineOperations)(Object.keys(Rp).map(e=>{let t=e,r=Rp[t];return{id:xp.FINANCIAL_RUNTIME_ROUTES[t].nativeAgentOperation,family:"agent",method:"POST",path:(0,xp.financialRuntimeRoutePath)(t),...r,auth:["agent_token"],errorResponse:F.NativeFinancialRefusal,status:200,idempotency:"request_id",backedBy:"authority",launch:"on",errors:["setup_required","update_required","agent_inactive","invalid_request","blocked","grant_required","limit_reached","owner_approval_required","owner_declined","expired","not_found","conflict","outcome_unknown","not_enabled","unavailable","rate_limited","internal_error"],description:"Existing laptop-only carrier. Auth verifies the current agent token and immutable installation before signed Authority forwarding. Money verifies the original PoP, signed financial meaning and admission/recovery fences. Public paying pause and effective controls remain enforced; declaration does not activate this route. Request/response transport bound: 262144 bytes. Original private context is not telemetry or HTTP capture."}}))});var xs=j(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.OwnerCleanupIntent=xn.OwnerChainRemovalStatement=xn.OwnerRemovalStatement=void 0;var re=Je(),Fp=it(),lt=ct(),kr=re.z.string().regex(/^[A-Za-z0-9_:.-]{1,128}$/),As=re.z.array(kr).min(1).max(50).refine(e=>new Set(e).size===e.length),$T=re.z.discriminatedUnion("kind",[re.z.strictObject({kind:re.z.literal("key"),agent_id:lt.Id,key_id:lt.Id,installation_id:lt.Id,generation:re.z.number().int().positive(),purpose:re.z.enum(["wallet","identity"]),provider_ref:kr}),re.z.strictObject({kind:re.z.literal("approver"),agent_id:lt.Id,approver_id:lt.Id,installation_id:lt.Id,provider_ref:kr})]),Hr={kind:re.z.literal("owner_provider_removal"),intent_id:lt.Id,operation_id:lt.Id,step_no:re.z.number().int().positive(),action:re.z.enum(["revoke_wallet_key","remove_custody_user","remove_device_approver"]),owner_id:lt.Id,organization_id:kr,owner_user_id:kr,security_epoch:re.z.number().int().nonnegative(),created_at:lt.Timestamp,targets:re.z.array($T).min(1).max(50)},Vp=re.z.strictObject({type:re.z.literal("ACTIVITY_TYPE_DELETE_POLICIES"),parameters:re.z.strictObject({policyIds:As})});xn.OwnerRemovalStatement=re.z.discriminatedUnion("phase",[re.z.strictObject({...Hr,phase:re.z.literal("delete_policies"),request:Vp}),re.z.strictObject({...Hr,phase:re.z.literal("delete_users"),request:re.z.strictObject({type:re.z.literal("ACTIVITY_TYPE_DELETE_USERS"),parameters:re.z.strictObject({userIds:As})})}),re.z.strictObject({...Hr,phase:re.z.literal("delete_denies"),request:Vp}),re.z.strictObject({...Hr,phase:re.z.literal("delete_private_keys"),request:re.z.strictObject({type:re.z.literal("ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"),parameters:re.z.strictObject({privateKeyIds:As,deleteWithoutExport:re.z.literal(!0)})})})]).refine(e=>e.action==="remove_device_approver"?e.targets.length===1&&e.targets[0].kind==="approver"&&(e.phase==="delete_users"||e.phase==="delete_denies"):e.targets.every(t=>t.kind==="key"&&t.purpose===(e.action==="revoke_wallet_key"?"wallet":"identity"))&&(e.action!=="revoke_wallet_key"||e.targets.length===1),{message:"removal action and targets must agree"}).refine(e=>new TextEncoder().encode(JSON.stringify(e)).length<=32768,{message:"removal intent exceeds 32 KiB"}).clone().register(Fp.apiMetadata,{id:"OwnerRemovalStatement"});var Ts=re.z.templateLiteral(["0x",re.z.string()]).refine(e=>/^0x[0-9a-f]{40}$/.test(e),{message:"exact lowercase chain address"});xn.OwnerChainRemovalStatement=re.z.strictObject({...Hr,kind:re.z.literal("owner_wallet_revocation"),phase:re.z.literal("revoke_chain_key"),action:re.z.literal("revoke_wallet_key"),targets:re.z.tuple([re.z.strictObject({kind:re.z.literal("key"),agent_id:lt.Id,key_id:lt.Id,installation_id:lt.Id,generation:re.z.number().int().positive(),purpose:re.z.literal("wallet"),provider_ref:kr})]),account:Ts,access_key:Ts,chain_id:re.z.literal(4217),fee_token:Ts}).refine(e=>new TextEncoder().encode(JSON.stringify(e)).length<=32768,{message:"removal intent exceeds 32 KiB"}).clone().register(Fp.apiMetadata,{id:"OwnerChainRemovalStatement"});xn.OwnerCleanupIntent=re.z.union([xn.OwnerRemovalStatement,xn.OwnerChainRemovalStatement])});var Es=j(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.HostedIdentityChallenge=qe.HostedIdentitySubmission=qe.HostedProviderRequest=qe.TapEnrollmentChallenge=qe.TapEnrollmentSubmission=qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES=void 0;var x=Je(),Gp=it(),Bp=ct();qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES=60*1024;var et=x.z.object({body:x.z.string().min(1).max(32768),stamp:x.z.object({stampHeaderName:x.z.string().min(1).max(64),stampHeaderValue:x.z.string().min(1).max(16384)}).strict()}).strict();qe.TapEnrollmentSubmission=x.z.object({method:x.z.literal("tap_enrollment"),request_id:x.z.string().uuid(),owner_whoami:et,proof:x.z.discriminatedUnion("phase",[x.z.object({phase:x.z.literal("authorizations"),owner_authorization:et,gate_authorization:et,delegation:et}).strict(),x.z.object({phase:x.z.literal("root_challenge"),root_challenge:et}).strict()])}).strict().refine(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES,{message:"TAP original submission exceeds the bounded owner envelope"}).clone().register(Gp.apiMetadata,{id:"TapEnrollmentSubmission",description:"The original owner-stamped TAP protocol requests for the final step of the existing setup operation. Every request is checked against its server-prepared input, recorded before relay and independently read back. Unknown delivery never authorizes a new request."});var Yn={request_id:x.z.string().uuid(),organization_id:Bp.Id,root_key_id:Bp.Id},Ln=x.z.string().max(16384).regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/);qe.TapEnrollmentChallenge=x.z.discriminatedUnion("phase",[x.z.object({...Yn,phase:x.z.literal("authorizations"),owner_authorization_signing_input:Ln,gate_authorization_signing_input:Ln,delegation_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}).strict(),x.z.object({...Yn,phase:x.z.literal("root_challenge"),payload_hex:x.z.string().regex(/^[0-9a-f]{64}$/),expires_at:x.z.number().int().nonnegative()}).strict(),x.z.object({request_id:x.z.string().uuid(),phase:x.z.literal("pending"),reason:x.z.enum(["provider_response_unknown","gate_response_unknown","directory_response_unknown","directory_pending","contact_required","authorization_expired"])}).strict()]).clone().register(Gp.apiMetadata,{id:"TapEnrollmentChallenge",description:"Prepared TAP-only inputs for the existing owner setup tap. Provider-aware preflight checks serialized bodies before owner signing; complete original stamps must still pass the submission bound. Pending names an unfinished obligation and has no new signing input. Neither pending nor a missing directory ID proves enrollment, publication or payment readiness."});var zT=x.z.strictObject({policyName:x.z.string().min(1).max(512),effect:x.z.enum(["EFFECT_ALLOW","EFFECT_DENY"]),consensus:x.z.string().min(1).max(16384),condition:x.z.string().min(1).max(16384),notes:x.z.string().max(1024)});qe.HostedProviderRequest=x.z.discriminatedUnion("type",[x.z.strictObject({type:x.z.enum(["ACTIVITY_TYPE_CREATE_USERS_V3","ACTIVITY_TYPE_CREATE_USERS_V4"]),parameters:x.z.strictObject({users:x.z.tuple([x.z.strictObject({userName:x.z.string().min(1).max(256),apiKeys:x.z.tuple([x.z.strictObject({apiKeyName:x.z.string().min(1).max(256),publicKey:x.z.string().regex(/^0[23][0-9a-f]{64}$/),curveType:x.z.literal("API_KEY_CURVE_P256")})]),authenticators:x.z.tuple([]),oauthProviders:x.z.tuple([]),userTags:x.z.tuple([])})])})}),x.z.strictObject({type:x.z.literal("ACTIVITY_TYPE_CREATE_POLICIES"),parameters:x.z.strictObject({policies:x.z.array(zT).min(1).max(2)})})]);qe.HostedIdentitySubmission=x.z.strictObject({method:x.z.literal("hosted_identity"),request_id:x.z.string().uuid(),owner_whoami:et,proof:x.z.discriminatedUnion("phase",[x.z.strictObject({phase:x.z.literal("principal"),principal:et}),x.z.strictObject({phase:x.z.literal("enrollment_authorization"),owner_authorization:et}),x.z.strictObject({phase:x.z.literal("root_challenge"),root_challenge:et}),x.z.strictObject({phase:x.z.literal("runtime_authorizations"),certificate:et,presence_delegation:et,gate_authorization:et,money_delegation:et}),x.z.strictObject({phase:x.z.literal("wallet_policy"),request:et}),x.z.strictObject({phase:x.z.literal("tap_authorization"),tap_delegation:et})])}).refine(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES,{message:"Hosted original submission exceeds the bounded owner envelope"});qe.HostedIdentityChallenge=x.z.discriminatedUnion("phase",[x.z.strictObject({...Yn,phase:x.z.literal("principal"),action:x.z.enum(["create_user","create_policies"]),request:qe.HostedProviderRequest}),x.z.strictObject({...Yn,phase:x.z.literal("enrollment_authorization"),authorization_undispatched:x.z.literal(!0).optional(),owner_authorization_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("root_challenge"),payload_hex:x.z.string().regex(/^[0-9a-f]{64}$/),expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("runtime_authorizations"),certificate_signing_input:Ln,presence_delegation_signing_input:Ln,gate_authorization_signing_input:Ln,money_delegation_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("tap_authorization"),tap_delegation_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("wallet_policy"),step_no:x.z.union([x.z.literal(4),x.z.literal(5),x.z.literal(6)]),action:x.z.enum(["create_tempo_signer_guard","create_tempo_signer_user","create_device_approver_policy"]),request:qe.HostedProviderRequest}),x.z.strictObject({request_id:x.z.string().uuid(),phase:x.z.literal("pending"),reason:x.z.enum(["provider_response_unknown","gate_response_unknown","authorization_expired"])})])});var Ns=j(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.ChainLimitScope=Vn.ChainLimitUpdate=Vn.ChainLimitStatement=void 0;var $e=Je(),Jp=it(),so=ct(),ao=$e.z.string().regex(/^0x[0-9a-f]{40}$/),Ds=$e.z.string().regex(/^0x[0-9a-f]{64}$/);Vn.ChainLimitStatement=$e.z.strictObject({kind:$e.z.literal("chain_limit"),operation_id:so.Id,key_id:so.Id,chain_id:$e.z.literal(4217),account:ao,access_key_address:ao,tokens:$e.z.tuple([ao,ao]),limit_micros:so.Micros.refine(e=>BigInt(e)>0n),period_seconds:$e.z.literal(604800),fee:$e.z.literal("owner")}).register(Jp.apiMetadata,{id:"ChainLimitStatement"});var oo={agent_id:so.Id,statement:Vn.ChainLimitStatement};Vn.ChainLimitUpdate=$e.z.discriminatedUnion("phase",[$e.z.strictObject({...oo,phase:$e.z.literal("prepared")}),$e.z.strictObject({...oo,phase:$e.z.literal("pending"),signed_tx:$e.z.string().max(4096).regex(/^0x76(?:[0-9a-f]{2})+$/),tx_hash:Ds,valid_before:$e.z.number().int().positive().max(Number.MAX_SAFE_INTEGER)}),$e.z.strictObject({...oo,phase:$e.z.literal("applied"),tx_hash:Ds}),$e.z.strictObject({...oo,phase:$e.z.literal("not_applied"),tx_hash:Ds,reason:$e.z.enum(["missed","reverted"])})]).register(Jp.apiMetadata,{id:"ChainLimitUpdate"});Vn.ChainLimitScope=$e.z.union([$e.z.strictObject({agentId:$e.z.string().uuid(),grantId:$e.z.string().uuid(),version:$e.z.number().int().positive()}),$e.z.strictObject({operationIds:$e.z.array($e.z.string().uuid()).min(1).max(100)})])});var dr=j(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});m.GrantVersion=m.Grant=m.SetupClaimed=m.SetupClaim=m.OwnerSetupStart=m.AgentSetupStarted=m.AgentSetupStart=m.Setup=m.SETUP_STATES=m.SETUP_KINDS=m.GrantRequest=m.GrantTerms=m.GrantMode=m.GRANT_MODES=m.AgentTokenAlreadyCreated=m.AgentTokenCreated=m.AgentToken=m.Device=m.AgentPatch=m.Agent=m.HostedSetupRecovery=m.Installation=m.AGENT_END_REASONS=m.AGENT_LIFECYCLE=m.DeviceApprover=m.APPROVER_STATES=m.KEY_END_REASONS=m.KEY_LIFECYCLE=m.KEY_CUSTODY=m.Owner=m.OWNER_LIFECYCLE_FROM_TODAY=m.OWNER_ACCESS_FROM_TODAY=m.OWNER_LIFECYCLE=m.OWNER_ACCESS=m.Session=m.SessionSigner=m.SignatureResult=m.OwnerPaymentProgress=m.SignatureSubmission=m.Challenge=m.WalletKeyAuthorizationResume=m.WithdrawalTransaction=m.RecordedOwnerCleanupTransaction=m.WalletKeyChainAuthorizationStatement=m.CardCodeStep=m.CardCodeDelivery=m.ApprovalKind=m.APPROVAL_KINDS=m.CHALLENGE_SIGNERS=m.EVIDENCE_METHODS=void 0;m.Timestamp=m.Id=m.ToolDescriptor=m.ClientEvent=m.MerchantResult=m.AgentStatus=m.WalletSigningContext=m.Console=m.Security=m.SpendingState=m.ActivityList=m.ActivityItem=m.CardEnrollmentAlreadyStarted=m.CardEnrollment=m.Card=m.Withdrawal=m.Wallet=m.Approval=m.CardCredential=m.PaymentReport=m.PaymentList=m.Payment=m.SigningExchange=m.PaymentCreate=m.ApprovalReviewDetail=m.OwnerPreparedPayment=m.OriginalHostedPurchaseContext=m.MerchantReceipt=m.RETAINED_PAYMENT_FACTS=m.ATTEMPT_TERMS_FIELDS=m.PURCHASE_IDENTITY_FIELDS=m.RuntimeAuthorization=m.TapSignatureBasePayload=m.POP_INTENT_CLAIM=m.PreparedCharge=m.ApprovalReviewChargeRequest=m.TempoChargeRequestWire=m.PaymentTarget=m.GrantChange=m.GrantHistory=void 0;var Yp=Kr(),u=Je(),v=it(),IT=xs(),Xr=Es(),ST=Ns(),$=ct();Object.defineProperty(m,"Id",{enumerable:!0,get:function(){return $.Id}});Object.defineProperty(m,"Timestamp",{enumerable:!0,get:function(){return $.Timestamp}});m.EVIDENCE_METHODS=["passkey","owner_jws","email_code","owner_session"];m.CHALLENGE_SIGNERS=["passkey","owner_jws","card_otp","transaction","provider_activity","email_code","tap_enrollment","hosted_identity"];m.APPROVAL_KINDS=["setup","grant","payment","connector_autonomy","replacement","account_closure","agent_reissue","spending_activation","autonomy_increase","contact_email"];m.ApprovalKind=u.z.enum(m.APPROVAL_KINDS).clone().register(v.apiMetadata,{id:"ApprovalKind"});m.CardCodeDelivery=u.z.object({identifier:u.z.string().min(1).max(512).clone().register(v.apiMetadata,{description:"Opaque choice id; owner.cards.collect { send_to } sends a new code there."}),method:u.z.string().clone().register(v.apiMetadata,{description:"How the issuer sends the code, for example OTPSMS or OTPEMAIL."}),value:u.z.string().nullable().clone().register(v.apiMetadata,{description:"Where it goes, already masked by the issuer (a\u2022\u2022\u2022@example.com)."})}).clone().register(v.apiMetadata,{id:"CardCodeDelivery"});m.CardCodeStep=u.z.object({delivery:u.z.array(m.CardCodeDelivery),sent_to:u.z.string().nullable().clone().register(v.apiMetadata,{description:"Where the newest code went, as the issuer masked it; null before any code is sent."}),resend_in_seconds:u.z.number().int().min(0).nullable().clone().register(v.apiMetadata,{description:"Seconds before another code may be requested (each new code invalidates the earlier ones)."})}).clone().register(v.apiMetadata,{id:"CardCodeStep"});m.WalletKeyChainAuthorizationStatement=u.z.strictObject({kind:u.z.literal("wallet_key_chain_authorization"),operation_id:$.Id,key_id:$.Id,account:u.z.string().regex(/^0x[0-9a-fA-F]{40}$/),access_key_address:u.z.string().regex(/^0x[0-9a-fA-F]{40}$/),access_key_public_key:u.z.string().regex(/^(?:0x)?(?:0[23][0-9a-fA-F]{64}|04[0-9a-fA-F]{128})$/),limits:u.z.array(u.z.strictObject({token:u.z.string(),micros:u.z.string().regex(/^(?:0|[1-9][0-9]*)$/),period_seconds:u.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER)})).length(2),expires_at_seconds:u.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),scope:u.z.literal("mpp_only")}).clone().register(v.apiMetadata,{id:"WalletKeyChainAuthorizationStatement"});m.RecordedOwnerCleanupTransaction=u.z.strictObject({raw:u.z.string().regex(/^0x76(?:[0-9a-f]{2})+$/).max(4096),hash:u.z.string().regex(/^0x[0-9a-f]{64}$/),intent:IT.OwnerChainRemovalStatement}).clone().register(v.apiMetadata,{description:"Owner-only original acknowledged revoke bytes and hash; resume these bytes without signing again."});m.WithdrawalTransaction=u.z.object({signed_tx:u.z.string().max(4096).regex(/^0x76(?:[0-9a-f]{2})+$/),tx_hash:u.z.string().regex(/^0x[0-9a-f]{64}$/)}).clone().register(v.apiMetadata,{description:"Owner-only withdrawal bytes durably bound before broadcast. Resume this exact transaction after a lost acknowledgement; this binding does not prove payment."});m.WalletKeyAuthorizationResume=u.z.object({signed_tx:u.z.string().max(16384).regex(/^0x76(?:[0-9a-f]{2})+$/),tx_hash:u.z.string().regex(/^0x[0-9a-f]{64}$/),intent:m.WalletKeyChainAuthorizationStatement.nullable().optional().clone().register(v.apiMetadata,{description:"The existing original chain statement, verified against these recorded bytes and owner-bound stored terms. Null when newer facts cannot establish the original intent; never permission to sign or proof of finalized absence."})}).clone().register(v.apiMetadata,{description:"The original recorded wallet key authorization. Owner-only recovery bytes; neither chain inclusion nor an active grant is implied."});m.Challenge=u.z.object({challenge_id:$.Id,purpose:u.z.enum(["session","setup_approval","grant","payment_approval","wallet_enable","wallet_conversion","withdrawal","card_enrollment","spending_reopen","agent_reissue","account_closure","autonomy_increase","provider_cleanup","contact_email","provider_cleanup"]),approval_kind:m.ApprovalKind.nullable().clone().register(v.apiMetadata,{description:"The approval row this signature creates; null for signatures that are not consents (sign-in, a withdrawal transaction, a wallet key authorisation)."}),signer:u.z.enum(m.CHALLENGE_SIGNERS).clone().register(v.apiMetadata,{description:"How this challenge is answered. passkey: a WebAuthn assertion. owner_jws: a stamped Turnkey activity / owner JWS over the statement. provider_activity: the id of the owner\u2019s own Turnkey activity in which the identity root signed the statement\u2019s money_delegation_signing_input (wallet key authorisation), or the completed deletion activity for the exact OwnerRemovalStatement (provider cleanup). email_code: proof of a contact address only; never a money, setup or autonomy consent. card_otp: the one-time code the card issuer sent the cardholder (card enrollment only; owner.cards.collect sends it). transaction: the owner\u2019s own wallet\u2019s transfer hash (withdrawal), its signed on-chain limit update (sign_chain_limit), the original signed revoke bytes for the exact OwnerChainRemovalStatement (provider_cleanup), or its wallet key authorisation (sign_key_authorization, signed_tx or independently read tx_hash)."}),transaction_modes:u.z.array(u.z.enum(["signed_tx","tx_hash"])).optional().clone().register(v.apiMetadata,{description:"Wallet key authorization only: submit exactly one named field. signed_tx is recorded before dispatch; tx_hash is independently read on chain."}),step_up:u.z.object({accepted:u.z.array(u.z.enum(["email_code","passkey"])).clone().register(v.apiMetadata,{description:"The accepted proof for this contact-email challenge."}),email_code_sent_to:u.z.string().nullable().clone().register(v.apiMetadata,{description:"The masked verified owner email the code was sent to."})}).nullable().optional().clone().register(v.apiMetadata,{description:"Set for the contact-email proof. Console autonomy changes and reopening spending use the current owner session, not this challenge."}),statement:u.z.string().clone().register(v.apiMetadata,{description:"The canonical terms the owner signs: amounts, merchant, limits, expiry. Never request content. The client renders it and checks it against the resource it shows before signing."}),payload:u.z.string().clone().register(v.apiMetadata,{description:"The encoding of `statement` to sign, base64url. The client re-derives it; it never signs bytes it cannot read."}),card_otp:m.CardCodeStep.nullable().optional().clone().register(v.apiMetadata,{description:"Set when signer is card_otp: where the issuer can send the code, and where the newest code went."}),tap_enrollment:Xr.TapEnrollmentChallenge.optional().clone().register(v.apiMetadata,{description:"The exact final TAP setup protocol phase; required only when signer is tap_enrollment."}),hosted_identity:Xr.HostedIdentityChallenge.optional(),resource:u.z.object({type:u.z.string(),id:$.Id}),expires_at:$.Timestamp}).refine(e=>e.signer==="tap_enrollment"==(e.tap_enrollment!==void 0),{message:"tap_enrollment signer requires its exact TAP phase"}).refine(e=>e.signer==="hosted_identity"==(e.hosted_identity!==void 0),{message:"hosted_identity signer requires its exact hosted phase"}).clone().register(v.apiMetadata,{id:"Challenge",description:"Returned with 202 by every owner action that needs the owner\u2019s own signature. Submit it at POST /owner/v1/signatures/{challengeId}; Authority verifies."});m.SignatureSubmission=u.z.discriminatedUnion("method",[Xr.TapEnrollmentSubmission,Xr.HostedIdentitySubmission,u.z.object({method:u.z.enum(["passkey","owner_jws"]),assertion:u.z.string().min(1).clone().register(v.apiMetadata,{description:"The passkey assertion or owner JWS / Turnkey stamp over the statement, base64url."}),terms:Yp.NativeAtumOwnerTerms.optional().clone().register(v.apiMetadata,{description:"Transient exact native original terms resupply with the owner JWS only; Money verifies immutable commitments and current original bindings. Never stored by this submission or used as authority."})}).refine(e=>e.terms===void 0||e.method==="owner_jws",{message:"native terms require the original owner JWS"}),u.z.object({method:u.z.literal("card_otp"),code:u.z.string().min(1).max(32).regex(/^[^\u0000-\u001f\u007f]+$/).clone().register(v.apiMetadata,{description:"The one-time code the card issuer sent the cardholder (card enrollment). Checked by the issuer through the card executor and never stored."})}),u.z.object({method:u.z.literal("provider_activity"),activity_id:u.z.string().regex(/^[A-Za-z0-9_:.-]{1,128}$/).clone().register(v.apiMetadata,{description:"The owner\u2019s Turnkey activity for the challenge: a wallet key money-delegation signature, or the exact deletion in an owner_provider_removal statement. The server reads the activity and independently verifies removal; a client success report is never completion evidence."})}),u.z.object({method:u.z.literal("transaction"),tx_hash:u.z.string().regex(/^0x[0-9a-fA-F]{64}$/).optional().clone().register(v.apiMetadata,{description:"A withdrawal: the hash of the transfer the owner\u2019s own wallet signed and broadcast; Visa holds no signature and confirms it on chain (decided 8 Oct, proposal 5)."}),signed_tx:u.z.string().max(16384).regex(/^0x76(?:[0-9a-f]{2})+$/).optional().clone().register(v.apiMetadata,{description:"The owner root\u2019s signed transaction: wallet key authorization (sign_key_authorization, at most 16384 characters) an owner provider-cleanup revoke (revoke_wallet_key, at most 4096), or an on-chain limit update (sign_chain_limit, at most 4096). Visa verifies and records it before dispatch and recovers the same bytes until the chain answers. The wallet pays the existing fee."})}).refine(e=>e.tx_hash===void 0!=(e.signed_tx===void 0),{message:"exactly one of tx_hash or signed_tx"}),u.z.object({method:u.z.literal("email_code"),code:u.z.string().regex(/^[0-9]{6}$/).clone().register(v.apiMetadata,{description:"The six-digit code sent to the contact address the owner is verifying. Accepted only for contact_email; the approval records the verifier receipt and verification time, never the code."})})]).clone().register(v.apiMetadata,{id:"SignatureSubmission",description:"One answer to one challenge, by the challenge\u2019s signer: a signature (passkey or owner JWS) for consents, the owner\u2019s provider activity for the wallet key authorisation, an email code only for contact_email verification, a card code only for a card_enrollment challenge whose signer is card_otp, a transaction hash for a withdrawal or independently verified wallet key authorization, or original signed transaction bytes for wallet key authorization / provider cleanup / on-chain limit update. Any other pairing is refused."});m.OwnerPaymentProgress=u.z.strictObject({state:u.z.enum(["awaiting_owner","approved","cosign_needed","signed","paid","not_paid","unknown"]),cosign:u.z.strictObject({organization_id:u.z.string().regex(/^[-_A-Za-z0-9]{1,256}$/),activity_id:u.z.string().regex(/^[A-Za-z0-9_:.-]{1,128}$/),fingerprint:u.z.string().min(1).max(256),valid_before:u.z.number().int().positive()}).nullable().clone().register(v.apiMetadata,{description:"While Turnkey waits for the owner\u2019s own vote: the recorded signing activity. The Console reads it with the owner\u2019s session, checks it against the approved charge, and only then approves it. Never voted for automatically."}),reason:u.z.string().regex(/^[a-z0-9_]{1,64}$/).nullable()}).clone().register(v.apiMetadata,{id:"OwnerPaymentProgress",description:"An owner-approved hosted payment after the owner pressed Approve and pay. signed means the payment was signed once and the agent\u2019s app completes it; paid only on chain evidence. Never a receipt by itself. approved means the owner\u2019s signature is recorded and the agent\u2019s own runtime finishes it (a laptop resumes and casts its own vote, as today). Absent while owner-approved paying is paused."});m.SignatureResult=u.z.object({withdrawal_transaction:m.WithdrawalTransaction.nullable().optional(),chain_limit_update:ST.ChainLimitUpdate.optional(),wallet_key_authorization:m.WalletKeyAuthorizationResume.nullable().optional(),challenge_id:$.Id,state:u.z.enum(["pending","accepted","rejected","expired"]),resource:u.z.object({type:u.z.string(),id:$.Id,version:u.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional().clone().register(v.apiMetadata,{description:"Only for an accepted grant with an exact applied receipt: the immutable version this signature applied. Later replacements do not advance it. Absence means application cannot be confirmed from this result; never infer the version from a current grant read."})}),challenge:m.Challenge.nullable().clone().register(v.apiMetadata,{description:"While pending: the full challenge (statement and payload), so any browser can sign it."}),continuation:$.Continuation.nullable(),recorded_transaction:m.RecordedOwnerCleanupTransaction.optional(),native:Yp.NativeAtumApprovalDetail.optional(),progress:m.OwnerPaymentProgress.optional()}).refine(e=>e.resource.version===void 0||e.state==="accepted"&&e.resource.type==="grant",{message:"a version receipt requires an accepted grant"}).clone().register(v.apiMetadata,{id:"SignatureResult"});m.SessionSigner=u.z.object({provider:u.z.literal("turnkey"),organization_id:u.z.string(),user_id:u.z.string()}).clone().register(v.apiMetadata,{id:"SessionSigner",description:"The Turnkey organisation and user the sign-in proved for this session. Owner-signed actions in this session must be signed by this user; the Console never infers it from the owner id."});m.Session=u.z.object({id:$.Id,owner_id:$.Id,scope:u.z.enum(["product","exit"]).clone().register(v.apiMetadata,{description:"exit: product admission is refused but the owner can still withdraw, export and close."}),created_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"Nullable until cutover B: today Auth does not record it for every live session. Required from B."}),expires_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"Nullable until cutover B: today Auth does not record it for every live session. Required from B."}),current:u.z.boolean(),client:u.z.string().nullable().clone().register(v.apiMetadata,{description:"A coarse device description, never a fingerprint."}),last_active_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"When this session last made a request (to the minute); null if never since issue (decided 8 Oct, 10b)."})}).clone().register(v.apiMetadata,{id:"Session",description:"Auth change needed before /owner/v1/sessions serves non-null times: record created_at at issue and expires_at from the session TTL (or the web-session token exp) for every owner session, web and CLI. Sessions issued before that change may lack them, so both stay nullable until cutover B, which rebuilds sessions empty; from B both are required."});m.OWNER_ACCESS=["pending","approved","rejected"];m.OWNER_LIFECYCLE=["active","closing","closed"];m.OWNER_ACCESS_FROM_TODAY=[{today:"ownerAccess v4 (every users.status row approved)",access:"approved"},{today:"ownerAccess revoked (any users.status row rejected)",access:"rejected"},{today:"ownerAccess none with rows (some pending, none rejected)",access:"pending"},{today:"ownerAccess none with no rows",access:null}];m.OWNER_LIFECYCLE_FROM_TODAY=[{today:"no account closure",lifecycle:"active"},{today:"POST /v4/account/close accepted, closure not finished",lifecycle:"closing"},{today:"closure finished (GET /v4/account/closure/:id done)",lifecycle:"closed"}];m.Owner=u.z.object({id:$.Id,wallet_address:u.z.string().regex(/^0x[0-9a-f]{40}$/).nullable().clone().register(v.apiMetadata,{description:"The recorded owner wallet address, published after the owner wallet and identity roots complete custody readback. null until that ceremony completes."}),display_name:u.z.string().nullable(),photo_url:u.z.url().nullable(),contact_email:u.z.string().nullable().clone().register(v.apiMetadata,{description:"A5: the one verified owner email, used only for the TAP directory and essential notices."}),access:u.z.enum(m.OWNER_ACCESS).clone().register(v.apiMetadata,{description:"Whether Visa admits this owner (entry gate: Visa identity plus legal geo-blocking). Mapping from today: see OWNER_ACCESS_FROM_TODAY."}),lifecycle:u.z.enum(m.OWNER_LIFECYCLE).clone().register(v.apiMetadata,{description:"closing: an account_closure operation is running (exit still works). closed: done."}),renewal_due_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"The account's one spending renewal date: every agent's grant ends on it, and one owner tap renews them all for 90 days from that tap. null until the first agent is set up."}),created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Owner"});m.KEY_CUSTODY=["device","enclave","turnkey"];m.KEY_LIFECYCLE=["pending","active","ending","ended"];m.KEY_END_REASONS=["rotated","upgraded","replaced","emergency_replaced","recovered","revoked","agent_ended","expired","abandoned"];m.APPROVER_STATES=["pending","active","removing","removed"];m.DeviceApprover=u.z.object({id:$.Id,installation_id:$.Id.clone().register(v.apiMetadata,{description:"The installation whose device holds the approver credential."}),provider:u.z.literal("turnkey"),state:u.z.enum(m.APPROVER_STATES).clone().register(v.apiMetadata,{description:"pending: created, policy not yet in force. removing: provider removal in flight."}),created_at:$.Timestamp,activated_at:$.Timestamp.nullable(),removed_at:$.Timestamp.nullable()}).clone().register(v.apiMetadata,{id:"DeviceApprover",description:"A provider approver that must vote on this agent\u2019s signing (two of two, at most 8 per agent). Approvers only vote; they never sign. Removed by a remove_device_approver operation step."});m.AGENT_LIFECYCLE=["pending","active","paused","ending","ended"];m.AGENT_END_REASONS=["revoked","owner_closed","setup_abandoned"];m.Installation=u.z.object({id:$.Id,surface:$.Surface,lifecycle:u.z.enum(m.KEY_LIFECYCLE).clone().register(v.apiMetadata,{description:"The lifecycle of this installation\u2019s current key generation."}),end_reason:u.z.enum(m.KEY_END_REASONS).nullable(),key_generation:u.z.number().int().min(1),custody:u.z.enum(m.KEY_CUSTODY).clone().register(v.apiMetadata,{description:"device: an OS key store on the owner\u2019s computer. enclave: a key held by an attested enclave. turnkey: a non-exportable Turnkey-held key."}),client:u.z.string().nullable(),created_at:$.Timestamp,last_used_at:$.Timestamp.nullable()}).clone().register(v.apiMetadata,{id:"Installation",description:"Where the durable agent runs. One active installation per agent is policy; replacing it never loses the agent or resets its grant."});m.HostedSetupRecovery=u.z.strictObject({setup_id:$.Id,operation_id:$.Id,agent_id:$.Id,installation_id:$.Id,organization_id:u.z.string().min(1),owner_user_id:u.z.string().min(1),private_key_name:u.z.string().min(1),wallet_policy:Xr.HostedIdentityChallenge}).clone().register(v.apiMetadata,{id:"HostedSetupRecovery"});m.Agent=u.z.object({id:$.Id,setup_id:$.Id.nullable().optional(),name:u.z.string(),surface:$.Surface,lifecycle:u.z.enum(m.AGENT_LIFECYCLE),end_reason:u.z.enum(m.AGENT_END_REASONS).nullable(),installations:u.z.array(m.Installation),active_installation_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The one installation allowed to act (policy)."}),approvers:u.z.array(m.DeviceApprover).clone().register(v.apiMetadata,{description:"The device-approver roster for laptop co-signing, separate from the active installation."}),tap_agent_id:u.z.string().nullable().clone().register(v.apiMetadata,{description:"The public Trusted Agent Protocol directory id."}),grant_version:u.z.number().int().nullable(),grants:u.z.array(u.z.lazy(()=>m.Grant)).max($.Rail.options.length).optional().clone().register(v.apiMetadata,{description:"Current or latest ended grant per rail. Owner reads always supply an explicit empty collection when none exist; absent means unavailable, never zero permission."}),grant_history:u.z.lazy(()=>m.GrantHistory).optional().clone().register(v.apiMetadata,{description:"A bounded page of immutable terms versions on owner agent detail reads."}),readiness:u.z.array($.Readiness),created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Agent"});m.AgentPatch=u.z.object({name:u.z.string().min(1).max(80).optional(),paused:u.z.boolean().optional()}).clone().register(v.apiMetadata,{id:"AgentPatch"});m.Device=u.z.object({id:$.Id.clone().register(v.apiMetadata,{description:"The app\u2019s own device id (registering it again is idempotent)."}),platform:u.z.enum(["ios"]),app_env:u.z.enum(["preview","production"]).clone().register(v.apiMetadata,{description:"The APNs environment; a sandbox token is never sent to production APNs."}),created_at:$.Timestamp,updated_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Device",description:"A phone registered for the owner\u2019s notifications (proposal 30). Registration only: nothing is sent at launch. The push token is never answered."});m.AgentToken=u.z.object({key_id:$.Id,label:u.z.string().clone().register(v.apiMetadata,{description:"Server-assigned from the app; not set by the owner."}),app:u.z.string().nullable().clone().register(v.apiMetadata,{description:"The app or harness the token is for."}),created_at:$.Timestamp,expires_at:$.Timestamp,last_used_at:$.Timestamp.nullable(),prefix:u.z.string().clone().register(v.apiMetadata,{description:"The non-secret first characters of the token, to tell tokens apart (decided 8 Oct, 10b)."})}).clone().register(v.apiMetadata,{id:"AgentToken"});m.AgentTokenCreated=m.AgentToken.extend({token:u.z.string().clone().register(v.apiMetadata,{description:"Shown once. Visa keeps only a hash."})}).clone().register(v.apiMetadata,{id:"AgentTokenCreated"});var Xp=u.z.literal(!0),Qp=u.z.string().clone().register(v.apiMetadata,{description:"What to do if the first answer was lost."});m.AgentTokenAlreadyCreated=m.AgentToken.extend({already_created:Xp,message:Qp}).clone().register(v.apiMetadata,{id:"AgentTokenAlreadyCreated",description:"This request_id already created this token. Its secret was shown once and is not stored; if it was lost, revoke this token and create a new one."});m.GRANT_MODES=["within_limit","ask_each_time"];m.GrantMode=u.z.enum(m.GRANT_MODES).clone().register(v.apiMetadata,{id:"GrantMode",description:"within_limit: pay without asking up to the limits. ask_each_time: every payment needs an approval (hosted agents default here). Not a versioned term: switching keeps the grant version and its usage."});m.GrantTerms=u.z.object({max_per_payment:$.Amount,max_per_period:$.Amount,period_seconds:u.z.number().int().min(3600).max(2678400),expires_at:$.Timestamp,instrument_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"card: the enrolled card the VIC mandate binds."})}).clone().register(v.apiMetadata,{id:"GrantTerms",description:"The consented, immutable terms of one rail\u2019s grant version. No grant on a rail means zero spend there, never unlimited."});m.GrantRequest=u.z.object({rail:$.Rail,mode:m.GrantMode,terms:m.GrantTerms}).clone().register(v.apiMetadata,{id:"GrantRequest"});m.SETUP_KINDS=["laptop","hosted","card","replacement"];m.SETUP_STATES=["open","claimed","approved","completed","cancelled","expired"];m.Setup=u.z.object({id:$.Id,kind:u.z.enum(m.SETUP_KINDS),agent_id:$.Id.nullable(),installation_id:$.Id.nullable(),state:u.z.enum(m.SETUP_STATES),terminal_joined:u.z.boolean().optional().clone().register(v.apiMetadata,{description:"The laptop installation joined this setup, independently of owner claim."}),replacement_reason:u.z.enum(["planned","emergency"]).nullable().clone().register(v.apiMetadata,{description:"replacement only. emergency: the old keys ended before this setup existed."}),replaces_key_id:$.Id.nullable(),approval_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The owner\u2019s consent for this setup, once approved."}),code:u.z.string().clone().register(v.apiMetadata,{description:"The short code the owner matches on the setup page."}),owner_url:u.z.url(),client:u.z.object({name:u.z.string(),version:u.z.string().nullable()}),requested_grants:u.z.array(m.GrantRequest),operation_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The durable operation that carries this setup."}),expires_at:$.Timestamp,continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"Setup",description:"One setup ceremony, durable across browsers and restarts. It owns the CLI rendezvous (the old login and handoff doors). The original task is kept and resumes after approval."});var Wp={installation_key:u.z.record(u.z.string(),u.z.unknown()).clone().register(v.apiMetadata,{description:"The new installation\u2019s public JWK (Ed25519)."}),client:u.z.object({name:u.z.string(),version:u.z.string()}),setup_key:u.z.string().optional().clone().register(v.apiMetadata,{description:"Join a setup the owner started in the Console (web-start pickup)."}),resume_proof:u.z.object({signature:u.z.string().clone().register(v.apiMetadata,{description:"Ed25519 signature by the installation key, base64url."}),setup_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The open setup being resumed, if the client still knows it."}),nonce:u.z.string().min(16).max(64).clone().register(v.apiMetadata,{description:"Random, single use per installation."}),issued_at:u.z.number().int().clone().register(v.apiMetadata,{description:"Unix seconds; accepted only within 120 s."})}).optional().clone().register(v.apiMetadata,{description:'Required to resume an open setup for this installation key (repeating the same start). Signs exactly "visa-setup-resume:v1:" + jwk_thumbprint + ":" + (setup_id or "-") + ":" + nonce + ":" + issued_at. The request must also match the open setup (same kind and, for a replacement, the same agent); otherwise conflict.'})};m.AgentSetupStart=u.z.discriminatedUnion("kind",[u.z.object({kind:u.z.literal("laptop"),...Wp}),u.z.object({kind:u.z.literal("replacement"),agent_id:$.Id.clone().register(v.apiMetadata,{description:"The durable agent whose installation is replaced."}),...Wp})]).clone().register(v.apiMetadata,{id:"AgentSetupStart"});m.AgentSetupStarted=u.z.object({setup:m.Setup,setup_secret:u.z.string().clone().register(v.apiMetadata,{description:"Shown once; authorizes polling and claim."})}).clone().register(v.apiMetadata,{id:"AgentSetupStarted"});var Cs=u.z.string().clone().register(v.apiMetadata,{description:"The app the owner picked (for example a CLI harness)."}),Ms=$.Id.clone().register(v.apiMetadata,{description:"Client-generated key: repeating a start with the same request_id returns the same setup, never a second one."});m.OwnerSetupStart=u.z.discriminatedUnion("kind",[u.z.object({kind:u.z.literal("laptop"),request_id:Ms,client:Cs}),u.z.object({kind:u.z.literal("hosted"),request_id:Ms,client:Cs}),u.z.object({kind:u.z.literal("replacement"),request_id:Ms,agent_id:$.Id.clone().register(v.apiMetadata,{description:"The durable agent whose installation is replaced."}),replacement_reason:u.z.enum(["planned","emergency"]),client:Cs})]).clone().register(v.apiMetadata,{id:"OwnerSetupStart",description:"Card setups start at POST /owner/v1/cards."});m.SetupClaim=u.z.object({proof:u.z.string().clone().register(v.apiMetadata,{description:"A signature by the installation key over the setup id."})}).clone().register(v.apiMetadata,{id:"SetupClaim"});m.SetupClaimed=u.z.object({agent:m.Agent,installation_id:$.Id,wallet_context:u.z.lazy(()=>m.WalletSigningContext).nullable()}).clone().register(v.apiMetadata,{id:"SetupClaimed"});m.Grant=u.z.object({grant_id:$.Id,agent_id:$.Id,rail:$.Rail,version:u.z.number().int().min(1),mode:m.GrantMode,mode_changed_at:$.Timestamp.nullable(),mode_approval_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The autonomy_increase approval (current Console product-session consent) consumed by the last widening."}),terms:m.GrantTerms,approval_id:$.Id.clone().register(v.apiMetadata,{description:"The owner consent these terms sit inside."}),lifecycle:u.z.enum(["active","ended"]),end_reason:u.z.enum(["replaced","revoked","expired","agent_ended","owner_closed","recovered"]).nullable(),usage:u.z.object({period_used:$.Amount,period_started_at:$.Timestamp,period_booked:$.Amount.optional(),period_held:$.Amount.optional(),period_remaining:$.Amount.optional(),observed_at:$.Timestamp.optional(),budget_use:u.z.object({spent_pct:u.z.number().int().min(0).max(100),reserved_pct:u.z.number().int().min(0).max(100),used_pct:u.z.number().int().min(0).max(100),tone:u.z.enum(["normal","warning","critical"])}).optional()}).clone().register(v.apiMetadata,{description:"Current rolling usage counted by grant_id across versions. Booked debits plus unresolved holds consume room; refunds never restore it. Missing split facts mean unavailable, never zero. observed_at and period_started_at describe this read, not the creation of an earlier terms version."}),created_at:$.Timestamp,continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"Grant",description:"What one agent may spend on one rail. Narrower terms mint a version that keeps the existing consent; wider terms, a new rail, card or key need fresh consent; a mode change is in place."});m.GrantVersion=m.Grant.pick({grant_id:!0,agent_id:!0,rail:!0,version:!0,terms:!0,approval_id:!0,lifecycle:!0,end_reason:!0,created_at:!0}).extend({key_id:$.Id.nullable()}).clone().register(v.apiMetadata,{id:"GrantVersion",description:"Retained immutable terms and consent of an exact grant version, with its current lifecycle/end reason. No historical mode or usage is inferred."});m.GrantHistory=u.z.object({versions:u.z.array(m.GrantVersion).max(100),truncated:u.z.boolean(),next_cursor:u.z.string().nullable()}).clone().register(v.apiMetadata,{id:"GrantHistory"});m.GrantChange=u.z.object({grant:m.Grant,consent:u.z.enum(["kept","fresh_required"]).clone().register(v.apiMetadata,{description:"kept: the change sits inside what the owner already approved and applied at once. fresh_required: the owner must sign `challenge` first; nothing changed yet."}),challenge:m.Challenge.nullable()}).clone().register(v.apiMetadata,{id:"GrantChange"});m.PaymentTarget=u.z.discriminatedUnion("kind",[u.z.object({kind:u.z.literal("url"),url:u.z.url(),method:u.z.enum(["GET","POST"]).default("GET"),body:u.z.string().optional().clone().register(v.apiMetadata,{description:"Forwarded to the merchant in memory only. Visa stores no request content."})}),u.z.object({kind:u.z.literal("checkout"),merchant:u.z.string(),checkout_url:u.z.url(),amount:$.Amount,country:u.z.string().length(2).optional()})]).clone().register(v.apiMetadata,{id:"PaymentTarget",description:"url: an API that answers HTTP 402 with a Tempo charge (tempo rail). checkout: exact card checkout terms the host established independently (card rail)."});m.TempoChargeRequestWire=u.z.object({tempoTransaction:u.z.record(u.z.string(),u.z.unknown()),charge:u.z.object({chainId:u.z.number().int(),account:u.z.string(),token:u.z.string(),recipient:u.z.string(),amount:u.z.string().regex(/^(0|[1-9][0-9]*)$/),memo:u.z.string(),notAfter:u.z.number().int(),maxNetworkFee:u.z.string().regex(/^(0|[1-9][0-9]*)$/),funding:u.z.object({token:u.z.string(),maxAmount:u.z.string().regex(/^(0|[1-9][0-9]*)$/)}).optional()}),keyRef:u.z.object({subOrganizationId:u.z.string(),accessKeyAddress:u.z.string()})}).clone().register(v.apiMetadata,{id:"TempoChargeRequestWire",description:"Frozen wire: the Tempo charge request exactly as the signing enclave verifies it. Transaction commitments only, never merchant request or result content."});var uo=u.z.string().regex(/^0x(|[1-9a-f][0-9a-f]{0,63})$/),lr=u.z.string().regex(/^0x[0-9a-f]{40}$/),Rs=u.z.string().regex(/^(0|[1-9][0-9]{0,38})$/).refine(e=>BigInt(e)<1n<<128n);m.ApprovalReviewChargeRequest=u.z.strictObject({tempoTransaction:u.z.strictObject({chainId:u.z.literal(4217),maxPriorityFeePerGas:uo,maxFeePerGas:uo,gas:uo,calls:u.z.array(u.z.strictObject({to:lr,value:u.z.literal("0x"),data:u.z.string().regex(/^0x(?:[0-9a-f]{136}|[0-9a-f]{264}|[0-9a-f]{200})$/)})).min(1).max(3),accessList:u.z.tuple([]),nonceKey:uo,nonce:u.z.literal("0x"),validBefore:u.z.number().int().nonnegative().nullable(),validAfter:u.z.number().int().nonnegative().nullable(),feeToken:lr.nullable(),feePayer:u.z.boolean(),authorizationList:u.z.tuple([]),keyAuthorization:u.z.null()}),charge:u.z.strictObject({chainId:u.z.literal(4217),account:lr,token:lr,recipient:lr,amount:Rs,memo:u.z.string().regex(/^0x[0-9a-f]{64}$/),notAfter:u.z.number().int().positive(),maxNetworkFee:Rs,funding:u.z.strictObject({token:lr,maxAmount:Rs}).optional()}),keyRef:u.z.strictObject({subOrganizationId:$.Id,accessKeyAddress:lr})}).clone().register(v.apiMetadata,{id:"ApprovalReviewChargeRequest",description:"The original body-free unsigned Tempo charge, with only the existing canonical transaction/charge/custody fields. Independent wallet verification still checks selectors, charge equality, nonce, fee and time bounds; parsing does not reconstruct or authorize a transaction. Unknown nested fields refuse instead of being stripped."});m.PreparedCharge=u.z.object({request:m.TempoChargeRequestWire,merchant_origin:u.z.url(),method:u.z.enum(["GET","POST"]),endpoint_path:u.z.string().regex(/^\/[^?#]*$/).clone().register(v.apiMetadata,{description:"The path only: no query string."}),mpp:u.z.object({challenge_id:u.z.string().regex(/^[\x21-\x7e]{1,256}$/),realm:u.z.string().regex(/^[\x20-\x7e]{1,256}$/)}).clone().register(v.apiMetadata,{description:"The merchant\u2019s MPP challenge this charge answers (its id and realm). The charge\u2019s memo must be exactly MPP\u2019s anonymous attribution memo for them (hash prefixes only): nothing caller-chosen goes on chain."})}).clone().register(v.apiMetadata,{id:"PreparedCharge",description:"A Tempo charge the laptop prepared locally from the merchant\u2019s 402 using its wallet signing context. The server re-derives the terms and the signing payload from it and checks them against the grant; it never hands the laptop a payload to sign blind."});m.POP_INTENT_CLAIM="int";m.TapSignatureBasePayload=u.z.object({kind:u.z.literal("tap_signature_base"),method:u.z.string().regex(/^[A-Z]{1,16}$/),authority:u.z.string().min(1).max(255),path:u.z.string().regex(/^\/[^\n\r]{0,4095}$/),coveredComponents:u.z.array(u.z.string().min(1).max(64)).min(4).max(8),paymentHeaderName:u.z.enum(["payment-signature","x-payment","authorization"]),paymentHeaderValue:u.z.string().min(1).max(16384),contentDigest:u.z.string().max(256).optional(),created:u.z.number().int(),expires:u.z.number().int(),keyId:u.z.string().regex(/^[A-Za-z0-9_-]{43}$/),nonce:u.z.string().regex(/^[A-Za-z0-9+/]{43}=$/).clone().register(v.apiMetadata,{description:"32 random bytes, base64."}),tag:u.z.literal("agent-payer-auth"),signatureBase:u.z.string().min(1).max(32768)}).clone().register(v.apiMetadata,{id:"TapSignatureBasePayload",description:"The TAP signature base the agent sends the merchant, as the identity gate takes it (frozen wire, its field names). keyId is the agent\u2019s TAP key thumbprint (status `tap`). The gate signs only the base it rebuilds from these fields; expires \u2212 created is at most 480 s."});m.RuntimeAuthorization=u.z.object({pop_jwt:u.z.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).clone().register(v.apiMetadata,{description:'Compact JWS, typ visa-agent-pop+jwt, signed by the installation key (header kid = its JWK thumbprint, cnf.jwk = its public key). Claims: aud visa-tempo-mpp-payment:v1, nonce = the execution\u2019s wire_request_id (the verifier\u2019s financial request id), int = tempoPayIntentHash(financialRequestHash("wallet.tempo.mpp.sign", request), intent), iat within 120 s. A fresh one on every submission.'}),intent:u.z.record(u.z.string(),u.z.unknown()).clone().register(v.apiMetadata,{description:"The JSON object the proof commits to (at most 4 KiB). Forwarded to the verifier in memory and never stored."})}).clone().register(v.apiMetadata,{id:"RuntimeAuthorization"});m.PURCHASE_IDENTITY_FIELDS=["agent_id","request_id","rail","merchant_origin","method","endpoint_path","max"];m.ATTEMPT_TERMS_FIELDS=["amount","asset","funding_asset","recipient","funding_max","fee_ceiling","valid_before","signing_payload"];m.RETAINED_PAYMENT_FACTS=[...m.PURCHASE_IDENTITY_FIELDS,...m.ATTEMPT_TERMS_FIELDS,"state","delivery","network_ref","provider_evidence","timestamps"];var Kp=u.z.uuid().clone().register(v.apiMetadata,{description:"Client-generated UUID for one execution: the verifier\u2019s financial request id and the PoP nonce. The same execution\u2019s retries reuse it; a replacement execution under the same request_id gets a new one."}),Yr={request_id:$.Id.clone().register(v.apiMetadata,{description:"Client idempotency key. New per purchase; unchanged on every later step. It fixes the purchase identity fields."}),agent_id:$.Id.optional().clone().register(v.apiMetadata,{description:"Needed only when the credential holds more than one agent."})},Hp=u.z.string().min(1).max(200).optional().clone().register(v.apiMetadata,{description:"What the purchase is for, used only in this response\u2019s continuation (for the agent to relay at the approval moment). Never stored and never returned by a later read."});m.MerchantReceipt=u.z.object({kind:u.z.enum(["receipt","job_reference"]),value:u.z.string().min(1).max(512)}).clone().register(v.apiMetadata,{id:"MerchantReceipt",description:"What the caller kept from the merchant. Visa asks the merchant to verify it; Visa never keeps request content to compare against."});m.OriginalHostedPurchaseContext=u.z.strictObject({terms:u.z.strictObject({v:u.z.literal(1),resource:u.z.string().max(2048),method:u.z.enum(["GET","HEAD","POST","PUT","PATCH","DELETE"]),bodySha256:u.z.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable(),maxAmountMicros:u.z.string(),recipient:u.z.string(),intent:u.z.record(u.z.string(),u.z.unknown())}),request:u.z.strictObject({method:u.z.enum(["GET","HEAD","POST","PUT","PATCH","DELETE"]),headers:u.z.array(u.z.tuple([u.z.string().refine(e=>/^(accept|accept-language|content-type|user-agent|x-[a-z0-9-]+)$/i.test(e)&&!/^(authorization|cookie|proxy-authorization|payment|x-payment|x-payment-response)$|auth|token|secret|key|session|cookie|signature|credential|password/i.test(e)),u.z.string().max(1024)])).max(32),bodyBase64:u.z.string().regex(/^[A-Za-z0-9+/=_-]*$/).nullable()})}).clone().register(v.apiMetadata,{id:"OriginalHostedPurchaseContext",description:"Original canonical Tempo v1 signing terms and transient public replay request. Consumers check the existing canonical verifier, actual body digest, authenticated purchase and original commitment. Configured private owner approval review may retain only supported exact signing context; other paths remain local/hash-only. Replay body and headers never enter retained state. Missing replay bytes cannot be reconstructed from hashes. Never put this context into URLs, logs or telemetry."});m.OwnerPreparedPayment=u.z.strictObject({ownerId:$.Id,agentId:$.Id,paymentId:$.Id,approvalId:$.Id,executionAttemptId:$.Id,requestedTerms:m.OriginalHostedPurchaseContext.shape.terms,terms:m.OriginalHostedPurchaseContext.shape.terms.extend({v:u.z.literal(2),runtimeId:$.Id,charge:u.z.strictObject({chainId:u.z.literal(4217),account:u.z.string(),accessKeyAddress:u.z.string(),token:u.z.string(),amountMicros:u.z.string().regex(/^[1-9][0-9]*$/),fundingToken:u.z.string().optional(),maxFundingMicros:u.z.string().regex(/^[1-9][0-9]*$/).optional(),memo:u.z.string(),notAfter:u.z.number().int().positive(),maxNetworkFee:u.z.string().regex(/^(0|[1-9][0-9]*)$/),signingHash:u.z.string()})}),request:m.ApprovalReviewChargeRequest,mppChallengeId:m.PreparedCharge.shape.mpp.shape.challenge_id,mppRealm:m.PreparedCharge.shape.mpp.shape.realm,signingInput:u.z.string().min(1),decisionExpiresAt:$.Timestamp}).clone().register(v.apiMetadata,{id:"OwnerPreparedPayment",description:"The original requested terms, exact approved charge and root-signing input from the existing owner approval producer. The client independently verifies these against its original context and current owner facts before signing. This response carries no HTTP replay body or headers. Public owner-approved paying remains paused."});m.ApprovalReviewDetail=u.z.strictObject({requestedTerms:m.OriginalHostedPurchaseContext.shape.terms,prepared:m.OwnerPreparedPayment.optional()}).clone().register(v.apiMetadata,{id:"ApprovalReviewDetail",description:"Private owner-scoped original signing context for the existing approval page. Retention is configurable, initially on; product capture never enables telemetry. No replay HTTP body/headers. Later reads preserve original record bindings and quote/decision expiry. Null detail means no available captured context, not a deletion or renewal claim."});m.PaymentCreate=u.z.discriminatedUnion("step",[u.z.object({step:u.z.literal("prepare"),...Yr,target:m.PaymentTarget,original:m.OriginalHostedPurchaseContext.optional(),max:$.Amount.clone().register(v.apiMetadata,{description:"Hard ceiling. Pricing without paying is a discover call."}),description:Hp}),u.z.object({step:u.z.literal("admit"),...Yr,original:m.OriginalHostedPurchaseContext.optional(),wire_request_id:Kp,charge:m.PreparedCharge,authorization:m.RuntimeAuthorization,max:$.Amount,replaces_attempt_id:$.Id.optional().clone().register(v.apiMetadata,{description:"A re-quote on the same purchase: allowed only once that attempt is closed with evidence it can no longer execute."}),description:Hp}),u.z.object({step:u.z.literal("vote"),...Yr,attempt_id:$.Id.clone().register(v.apiMetadata,{description:"The exact attempt voted on; a vote for a closed attempt has no effect."}),vote:u.z.object({organization_id:u.z.string(),activity_id:u.z.string(),fingerprint:u.z.string(),voted_at:$.Timestamp})}),u.z.object({step:u.z.literal("resume"),...Yr,attempt_id:$.Id.optional().clone().register(v.apiMetadata,{description:"Laptop: the attempt being resumed."}),wire_request_id:Kp.optional().clone().register(v.apiMetadata,{description:"Laptop: the same execution\u2019s wire id."}),charge:m.PreparedCharge.optional().clone().register(v.apiMetadata,{description:"Laptop: identical to the admitted charge."}),authorization:m.RuntimeAuthorization.optional().clone().register(v.apiMetadata,{description:"Laptop: a fresh proof for the same charge."}),target:m.PaymentTarget.optional().clone().register(v.apiMetadata,{description:"Hosted, before any credential was released: the request again. Visa kept no copy and never treats it as the original: the merchant\u2019s fresh charge must match the purchase\u2019s retained payment facts exactly."}),original:m.OriginalHostedPurchaseContext.optional()}),u.z.object({step:u.z.literal("recover"),...Yr,attempt_id:$.Id,receipt:m.MerchantReceipt.optional().clone().register(v.apiMetadata,{description:'Absent when the caller lost its state: the outcome is then "paid, result unavailable".'})})]).clone().register(v.apiMetadata,{id:"PaymentCreate",description:"prepare: hosted, the server runs the 402 exchange. admit: laptop, the agent submits its own prepared charge with its independent proof. vote: the laptop records its vote on one attempt\u2019s provider activity after verifying it. resume: continue after an approval, a vote, a crash or a lost response. recover: after a credential was released, get the result back only through the merchant (receipt or job reference); the credential is never re-sent."});m.SigningExchange=u.z.object({attempt_id:$.Id,wire_request_id:u.z.uuid().clone().register(v.apiMetadata,{description:"The execution\u2019s wire id; the PoP nonce for every retry of it."}),state:u.z.enum(["consensus_needed","signed","expired","refused"]),provider:u.z.literal("turnkey"),organization_id:u.z.string(),activity_id:u.z.string(),fingerprint:u.z.string(),sign_with:u.z.string().clone().register(v.apiMetadata,{description:"The wallet access key the activity signs with."}),valid_before:u.z.number().int(),signature:u.z.string().regex(/^0x[0-9a-f]{130}$/).nullable()}).clone().register(v.apiMetadata,{id:"SigningExchange",description:"The laptop co-signing exchange (two of two). The laptop reads the activity from the provider itself, recomputes the payload from its own prepared charge, checks signer, encoding, organisation and expiry, votes, then resumes. Nothing here is signed on the server\u2019s word."});m.Payment=u.z.object({id:$.Id,request_id:$.Id,agent_id:$.Id,rail:$.Rail,protocol:u.z.enum(["standard","atum"]).optional().clone().register(v.apiMetadata,{description:"How the wallet paid: standard (the merchant\u2019s Tempo charge, MPP) or atum (a native ATUM purchase). Receipts label it; the rail stays the funding rail."}),merchant:u.z.string().clone().register(v.apiMetadata,{description:"The merchant origin."}),method:u.z.enum(["GET","POST"]).nullable(),endpoint_path:u.z.string().nullable(),state:u.z.enum($.PAYMENT_STATES),word:$.OwnerStatusWordSchema,money:$.PaymentMoney,facts:$.PaymentFacts,attempts:u.z.array($.Attempt),signing:m.SigningExchange.nullable().clone().register(v.apiMetadata,{description:"Present while a laptop execution is being co-signed."}),approval_id:$.Id.nullable(),approval:u.z.object({id:$.Id,state:u.z.enum(["requested","approved","declined","expired"]),expires_at:u.z.string().datetime()}).nullable().optional().clone().register(v.apiMetadata,{description:"The persisted owner decision and its original deadline, when approval is needed."}),result:u.z.object({status:u.z.number().int(),content_type:u.z.string().nullable(),body_base64:u.z.string(),truncated:u.z.boolean().clone().register(v.apiMetadata,{description:"True when the merchant\u2019s answer was longer than the hosted limit (1 MB) and only its first part is in body_base64."})}).nullable().clone().register(v.apiMetadata,{description:"Hosted only: the merchant\u2019s answer, returned once in the response that executed the payment and never stored."}),created_at:$.Timestamp,updated_at:$.Timestamp,continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"Payment",description:'The stable purchase identity, described only by payment facts. A quote expiring during review keeps the same purchase; an unknown outcome is never reported as "nothing was paid".'});m.PaymentList=u.z.object({payments:u.z.array(m.Payment),page:$.Page}).clone().register(v.apiMetadata,{id:"PaymentList"});m.PaymentReport=u.z.object({wire_request_id:u.z.uuid().optional().clone().register(v.apiMetadata,{description:"Laptop: the execution being reported."}),network_ref:u.z.string().optional().clone().register(v.apiMetadata,{description:"Laptop: the transaction hash it submitted. Settlement is still read from the chain."}),delivery:u.z.enum(["delivered","unavailable"]).optional(),merchant_reference:u.z.string().max(200).optional(),authorization:u.z.object({pop_jwt:u.z.string().clone().register(v.apiMetadata,{description:"Laptop: compact JWS by the installation key, aud visa-tempo-mpp-report:v1, nonce = the execution\u2019s wire_request_id, int = tempoReportIntentHash(outcome, network_ref)."})}).optional()}).clone().register(v.apiMetadata,{id:"PaymentReport",description:"The agent reports what the merchant delivered. Payment facts are never inferred from it."});m.CardCredential=u.z.object({payment_id:$.Id,network_token:u.z.string(),expiry:u.z.string(),cryptogram:u.z.string(),bound_to:u.z.object({merchant:u.z.string(),expires_at:$.Timestamp})}).clone().register(v.apiMetadata,{id:"CardCredential",description:"A network token and cryptogram for one checkout, never the funding card. Suppressed at launch: how it reaches agents without entering model transcripts is open (decision P1)."});m.Approval=u.z.object({id:$.Id,kind:m.ApprovalKind,payment_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"Set for kind payment."}),agent_id:$.Id.nullable(),subject:u.z.object({type:u.z.enum(["setup","grant","payment_attempt","agent_key","control","owner","agent"]),id:$.Id}),statement:u.z.string().clone().register(v.apiMetadata,{description:"The terms the owner signs (never request content)."}),state:u.z.enum(["requested","approved","declined","expired"]),rail:$.Rail.nullable().clone().register(v.apiMetadata,{description:"Set for kind payment and grant."}),amount:$.Amount.nullable().clone().register(v.apiMetadata,{description:"Set for kind payment."}),merchant:u.z.string().nullable().clone().register(v.apiMetadata,{description:"Set for kind payment."}),endpoint_path:u.z.string().nullable(),evidence:u.z.discriminatedUnion("method",[u.z.object({method:u.z.enum(["passkey","owner_jws"]),signature:u.z.string()}),u.z.object({method:u.z.enum(["email_code","owner_session"]),verification_ref:u.z.string().clone().register(v.apiMetadata,{description:"The verified consent\u2019s non-secret receipt or session/epoch reference; never a code or token."}),verified_at:$.Timestamp})]).nullable().clone().register(v.apiMetadata,{description:"Set once approved: how the owner consented. owner_session only for Console autonomy_increase consent; historical email_code receipts remain readable."}),consumed_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"When the consent was used; each approval is used once."}),expires_at:$.Timestamp,created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Approval",description:"One owner consent of one kind (#10983 approvals). A payment approval is shown by its payment facts (no free-text purpose is kept). Controls are re-checked when the approval is consumed, not only when it is requested."});m.Wallet=u.z.object({state:u.z.enum(["disabled","enabling","enabled","disabling"]),address:u.z.string().nullable(),network:u.z.string().nullable(),balances:u.z.array(u.z.object({asset:$.Asset,micros:$.Micros,spendable:u.z.boolean()})),setup_fee_covered:u.z.boolean().nullable().optional().clone().register(v.apiMetadata,{description:"Authority confirms that the owner wallet covers the existing OUSD setup-fee reserve. null or absent: coverage is unknown, never permission to sign."}),other_tokens:u.z.array(u.z.object({contract_address:u.z.string(),symbol:u.z.string().nullable(),base_units:u.z.string(),decimals:u.z.number().int().nullable()})).clone().register(v.apiMetadata,{description:"Tokens held that cannot be spent here; each can be withdrawn."}),other_tokens_status:u.z.enum(["complete","unavailable"]).clone().register(v.apiMetadata,{description:"complete: other_tokens lists every other token held. unavailable: they could not be discovered, so other_tokens may be missing some (never read as nothing held)."}),readiness:$.Readiness}).clone().register(v.apiMetadata,{id:"Wallet"});m.Withdrawal=u.z.object({request_id:$.Id.clone().register(v.apiMetadata,{description:"Client key: repeating the same request_id returns the same withdrawal operation (after a lost response), never a second one."}),chain_id:u.z.number().int().optional().clone().register(v.apiMetadata,{description:"Default: the wallet\u2019s network."}),to_address:u.z.string().regex(/^0x[0-9a-fA-F]{40}$/),token:$.TokenRef.clone().register(v.apiMetadata,{description:"The exit for unsupported tokens: any token the wallet holds can be withdrawn, independent of what agents may spend."}),amount_base_units:u.z.string().regex(/^(0|[1-9][0-9]{0,77})$/).nullable().clone().register(v.apiMetadata,{description:"In the token\u2019s own base units. null withdraws the whole balance, dust included."})}).clone().register(v.apiMetadata,{id:"Withdrawal"});m.Card=u.z.object({id:$.Id,brand:u.z.string().nullable(),last4:u.z.string().length(4).nullable(),country:u.z.string().regex(/^[A-Z]{2}$/).nullable().clone().register(v.apiMetadata,{description:"Issuing country from the card BIN; null until the issuer attributes are read."}),state:u.z.enum(["collecting","verifying","active","removed","failed"]),is_default:u.z.boolean(),created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Card",description:"The owner\u2019s enrolled card. Entered once; agents get grants, never per-agent cards."});m.CardEnrollment=u.z.object({card:m.Card,setup_id:$.Id.clone().register(v.apiMetadata,{description:"The setup of kind card that carries this enrollment."}),collect:u.z.object({vault_id:u.z.string(),environment:u.z.string(),form_token:u.z.string()}).clone().register(v.apiMetadata,{description:"Configuration for the VGS hosted fields. Card numbers never reach Visa servers. form_token is the card executor\u2019s Collect bearer for this setup."})}).clone().register(v.apiMetadata,{id:"CardEnrollment"});m.CardEnrollmentAlreadyStarted=u.z.object({card:m.Card,setup_id:$.Id,already_started:Xp,message:Qp}).clone().register(v.apiMetadata,{id:"CardEnrollmentAlreadyStarted",description:"This request_id already started this enrollment; the card is shown as it is now. The hosted-fields form_token is not stored or shown again: to enter the card, start a new enrollment (a new request_id), which opens a fresh form."});m.ActivityItem=u.z.object({id:$.Id,kind:u.z.enum(["payment","grant","agent","setup","security","operation"]),at:$.Timestamp,agent_id:$.Id.nullable(),title:u.z.string(),word:$.OwnerStatusWordSchema.nullable(),payment:m.Payment.nullable(),authority:u.z.object({action:u.z.string(),actor_kind:u.z.enum(["owner","agent","operator","server"]),subject_type:u.z.string().nullable(),subject_id:u.z.string().nullable(),outcome:u.z.enum(["succeeded","refused","failed"]),reason_code:u.z.string().nullable()}).optional().clone().register(v.apiMetadata,{description:"Actual retained audit metadata. It does not prove a grant version or confer permission."})}).clone().register(v.apiMetadata,{id:"ActivityItem"});m.ActivityList=u.z.object({items:u.z.array(m.ActivityItem),page:$.Page}).clone().register(v.apiMetadata,{id:"ActivityList"});m.SpendingState=u.z.object({state:u.z.enum(["open","stopped"]),changed_at:$.Timestamp.nullable(),continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"SpendingState",description:"The owner\u2019s stop-all switch. Stopping is immediate, from any owner session; reopening needs the current Console product owner session and CSRF protection. Withdrawals, export and cleanup continue while stopped."});m.Security=u.z.object({sessions:u.z.array(m.Session),events:u.z.array(u.z.object({at:$.Timestamp,kind:u.z.string(),detail:u.z.string(),actor:u.z.string(),agent_id:$.Id.nullable().optional().clone().register(v.apiMetadata,{description:"The agent the event is about, when it is about one."})})),devices:u.z.array(m.Device).optional().clone().register(v.apiMetadata,{description:"The phones registered for notifications, newest first (never their tokens): what the owner removes with owner.devices.remove."}),spending:m.SpendingState}).clone().register(v.apiMetadata,{id:"Security",description:"Read from the audit log; its reader is Authority. Events are the newest 100 security events only (sign-in, sign-in methods, agents and their keys, setups, limits, TAP, contact email, spending stop/reopen, recovery), so payments never crowd them out."});var OT=u.z.object({id:$.Id,kind:u.z.string(),title:u.z.string(),since:$.Timestamp});m.Console=u.z.object({owner:m.Owner.extend({eligibility:u.z.enum(["unchecked","eligible","ineligible"]).clone().register(v.apiMetadata,{description:"Stored US-card eligibility, established by eligible US card enrollment and VIC verification. Independent of admission and current card inventory; remains eligible after the last card is removed."})}),readiness:u.z.array($.Readiness),agents:u.z.array(m.Agent).max(100),agents_page:u.z.object({truncated:u.z.boolean(),next_cursor:u.z.string().nullable()}).optional(),wallet:m.Wallet.nullable(),cards:u.z.array(m.Card),pending_approvals:u.z.number().int().min(0),needs_attention:u.z.array(OT),spending:m.SpendingState,payment_availability:u.z.object({tempo:u.z.object({setup_rail_enabled:u.z.boolean().clone().register(v.apiMetadata,{description:"Current Tempo rail switch; custody setup retains its own owner guards."}),admission_enabled:u.z.boolean().clone().register(v.apiMetadata,{description:"Spending admission and Tempo rail are enabled; each payment still checks its current guards."})}),selectable_modes:u.z.object({laptop:u.z.tuple([u.z.literal("ask_each_time"),u.z.literal("within_limit")]),hosted:u.z.tuple([u.z.literal("ask_each_time")])}).clone().register(v.apiMetadata,{description:"Modes the existing grant command can save, separately from executable payments."}),within_limit_available:u.z.object({laptop:u.z.object({tempo:u.z.boolean()}),hosted:u.z.object({tempo:u.z.literal(!1)})}).clone().register(v.apiMetadata,{description:"Shared payment-mode policy allows the mode; admission, stops and grant limits remain separate."}),owner_approved_payments:u.z.object({enabled:u.z.boolean(),reason:u.z.literal("owner_approved_payments_paused").nullable()}),card_payments:u.z.object({enabled:u.z.literal(!1),reason:u.z.literal("card_rail_not_built")})}).clone().register(v.apiMetadata,{description:"Current service and mode availability; wallet custody readiness is independent and this read never authorizes a payment."})}).clone().register(v.apiMetadata,{id:"Console",description:"The screen answer: everything the Console home needs in one read. The server decides what is allowed and what comes next."});m.WalletSigningContext=u.z.object({chain_id:u.z.number().int(),account_address:u.z.string().clone().register(v.apiMetadata,{description:"The owner wallet that pays (charge.account)."}),access_key_address:u.z.string(),access_key_public_key:u.z.string().clone().register(v.apiMetadata,{description:"Used by the transaction serializer; the laptop prepares charges with it."}),sub_organization_id:u.z.string().clone().register(v.apiMetadata,{description:"The provider organisation (keyRef.subOrganizationId)."}),key_generation:u.z.number().int().min(1),limit:$.Amount.clone().register(v.apiMetadata,{description:"The chain-enforced limit mirroring the grant."}),expires_at:$.Timestamp,swap_available:u.z.boolean()}).clone().register(v.apiMetadata,{id:"WalletSigningContext",description:"The current-generation wallet signing context of this installation, bound to its approved key and payer. Everything the laptop needs to prepare a charge before admission."});m.AgentStatus=u.z.object({agent:m.Agent.nullable(),installation_id:$.Id.nullable(),wallet_context:m.WalletSigningContext.nullable(),readiness:u.z.array($.Readiness),min_cli_version:u.z.string(),renewal_due_at:$.Timestamp.nullable().optional().clone().register(v.apiMetadata,{description:"When the owner's spending renewal is due (the account's one date). From 7 days before it, tell the user once per cycle; after it, new payments refuse grant_required (renewal_required) until the owner renews in the Console. Status and cancellation keep working."}),continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"AgentStatus",description:"The live oracle for an agent: identity, every capability\u2019s rung and what comes next. Clients trust it over any document."});m.MerchantResult=u.z.object({results:u.z.array(u.z.object({name:u.z.string(),url:u.z.url(),description:u.z.string().nullable(),listed_price:$.Amount.nullable().clone().register(v.apiMetadata,{description:"Advisory; the payment re-prices."}),rails:u.z.array($.Rail),method:u.z.enum(["GET","POST"]).optional(),request_format:u.z.enum(["json","query"]).optional().clone().register(v.apiMetadata,{description:"How the listed input is sent: JSON body or query."}),input:u.z.record(u.z.string(),u.z.unknown()).optional().clone().register(v.apiMetadata,{description:"The provider\u2019s declared input schema (advisory)."}),price_hint:u.z.string().optional().clone().register(v.apiMetadata,{description:"The listing\u2019s free-text price hint (advisory)."}),pricing_dynamic:u.z.boolean().optional(),service_id:u.z.string().optional()})),probe:u.z.object({url:u.z.url(),payable:u.z.boolean(),price:$.Amount.nullable(),rail:$.Rail.nullable()}).nullable()}).clone().register(v.apiMetadata,{id:"MerchantResult",description:"Read-only: searching and probing never spend."});m.ClientEvent=u.z.object({name:u.z.string().regex(/^[a-z][a-z0-9_.]*$/),at:$.Timestamp,attributes:u.z.record(u.z.string(),u.z.union([u.z.string(),u.z.number(),u.z.boolean()]))}).clone().register(v.apiMetadata,{id:"ClientEvent",description:"A closed-schema client event. Never secrets, keys, tokens, card data, passkey material, prompts or request content; filtered before every sink."});m.ToolDescriptor=u.z.object({name:u.z.string(),description:u.z.string(),input_schema:u.z.record(u.z.string(),u.z.unknown())}).clone().register(v.apiMetadata,{id:"ToolDescriptor"})});var nf=j(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.ADMIN_OPERATIONS=fe.PolicyAuditEntry=fe.AuditEntry=fe.MerchantRule=fe.Control=fe.AdminUser=fe.AdminClosedAccount=fe.AdminOperation=void 0;var y=Je(),tt=it(),kT=Un(),Pr=dr(),ue=ct(),ve=["operator_session"];fe.AdminOperation=ue.Operation.extend({owner_id:ue.Id.nullable(),agent_id:ue.Id.nullable(),due_at:ue.Timestamp,next_action:y.z.string().nullable(),waiting_on:y.z.string().nullable().clone().register(tt.apiMetadata,{description:"Why the operation last stopped (its error class), e.g. closure_awaiting_reconciliation."})}).clone().register(tt.apiMetadata,{id:"AdminOperation"});fe.AdminClosedAccount=y.z.object({owner_id:ue.Id,lifecycle:y.z.enum(["closing","closed"]),closed_at:ue.Timestamp.nullable(),closure:fe.AdminOperation.nullable(),wallet:Pr.Wallet.nullable().clone().register(tt.apiMetadata,{description:"Read from the chain now; null when the read failed (never shown as empty)."}),wallet_status:y.z.enum(["read","unavailable","none"]),blockers:y.z.array(y.z.enum(["funds_remain","balance_unavailable","payments_unresolved","withdrawal_open","keys_not_cleared","holdings_unknown"])).clone().register(tt.apiMetadata,{description:"What a closing account still waits on, read now (empty once closed). Funds never hold closure: they stay the owner's exit obligation."})}).clone().register(tt.apiMetadata,{id:"AdminClosedAccount"});fe.AdminUser=Pr.Owner.extend({login:y.z.string(),is_admin:y.z.boolean(),tags:y.z.array(y.z.string()),agents:y.z.number().int(),spent_24h_micros:ue.Micros.optional().clone().register(tt.apiMetadata,{description:"admin.users.get only: what the owner spent and holds against their operator limit in the last 24 hours."})}).clone().register(tt.apiMetadata,{id:"AdminUser"});fe.Control=y.z.object({key:y.z.string(),type:y.z.enum(["capability","spending_limit","agent_override","block"]),scope:y.z.enum(["global","owner","agent"]),subject:ue.Id.nullable(),value:y.z.union([y.z.boolean(),y.z.string()]).nullable().clone().register(tt.apiMetadata,{description:"null = absent (the typed default applies)."}),default_meaning:y.z.string().clone().register(tt.apiMetadata,{description:"capability: deny. spending_limit: zero spend. agent_override: inherit. block: not blocked."}),updated_at:ue.Timestamp.nullable(),updated_by:y.z.string().nullable()}).clone().register(tt.apiMetadata,{id:"Control",description:"A typed control with an explicit default. Precedence global \u2192 owner \u2192 agent; blocks always win; an outage fails closed. Every change is audited."});fe.MerchantRule=y.z.object({origin:y.z.string(),decision:y.z.enum(["allow","block","review"]),reason:y.z.string().max(500).nullable(),reason_code:y.z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),updated_by:y.z.uuid().nullable(),updated_at:ue.Timestamp}).clone().register(tt.apiMetadata,{id:"MerchantRule"});fe.AuditEntry=y.z.object({id:ue.Id,at:ue.Timestamp,actor:y.z.string(),action:y.z.string(),subject:y.z.string().nullable(),detail:y.z.string(),actor_name:y.z.string().nullable().optional(),actor_email:y.z.string().nullable().optional(),owner_id:ue.Id.nullable().optional(),owner_name:y.z.string().nullable().optional(),owner_email:y.z.string().nullable().optional(),agent_id:ue.Id.nullable().optional(),control:y.z.object({key:y.z.string(),scope:y.z.enum(["global","owner","agent"]),agent_id:ue.Id.nullable(),enabled:y.z.boolean().nullable(),limit_micros:y.z.string().nullable()}).optional()}).clone().register(tt.apiMetadata,{id:"AuditEntry"});var ef=y.z.object({decision:y.z.enum(["allow","block","review"]),reason:y.z.string().nullable()}).nullable();fe.PolicyAuditEntry=fe.AuditEntry.extend({change:y.z.enum(["set","clear"]),before:ef,after:ef}).clone().register(tt.apiMetadata,{id:"PolicyAuditEntry"});var tf=y.z.object({login:y.z.string()});fe.ADMIN_OPERATIONS=(0,kT.defineOperations)([{id:"admin.session.start",backedBy:"edge",family:"admin",method:"POST",path:"/admin/v1/session",summary:"Open an operator session",description:"Needs an existing verified product owner session (never the exit session), its X-CSRF-Token, and current operator membership. No second sign-in assertion is required. Sets the visa_operator_session cookie (HttpOnly, Secure, SameSite=Strict, Path=/admin/v1); every admin write then sends X-CSRF-Token with the csrf_token answered here, and operator membership is re-checked on every request.",auth:["owner_session"],body:y.z.object({}).strict(),response:y.z.object({expires_at:ue.Timestamp,csrf_token:y.z.string()}),status:201,errors:["blocked","setup_required"],launch:"on"},{id:"admin.session.end",backedBy:"edge",family:"admin",method:"DELETE",path:"/admin/v1/session",summary:"Operator sign-out",auth:ve,response:null,status:204,errors:[],launch:"on"},{id:"admin.users.list",family:"admin",method:"GET",path:"/admin/v1/users",summary:"List owners",auth:ve,query:ue.PageQuery.extend({q:y.z.string().optional(),access:Pr.Owner.shape.access.optional()}),response:y.z.object({users:y.z.array(fe.AdminUser),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.users.get",family:"admin",method:"GET",path:"/admin/v1/users/:login",summary:"Read one owner",auth:ve,params:tf,response:fe.AdminUser,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"admin.users.update",family:"admin",method:"PATCH",path:"/admin/v1/users/:login",summary:"Change an owner\u2019s access, admin role or tags",description:"Granting admin needs a second admin\u2019s approval (admin requests).",auth:ve,params:tf,body:y.z.object({access:Pr.Owner.shape.access.optional(),is_admin:y.z.boolean().optional(),tags:y.z.array(y.z.string()).optional()}),response:fe.AdminUser,status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"admin.users.bulk",family:"admin",method:"POST",path:"/admin/v1/users/bulk",summary:"Approve or reject several owners",auth:ve,body:y.z.object({logins:y.z.array(y.z.string()).min(1).max(200),access:y.z.enum(["approved","rejected"])}),response:y.z.object({updated:y.z.number().int()}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.adminRequests.list",family:"admin",method:"GET",path:"/admin/v1/admin-requests",summary:"Pending two-admin grant requests",auth:ve,response:y.z.object({requests:y.z.array(y.z.object({id:ue.Id,login:y.z.string(),requested_by:y.z.string(),at:ue.Timestamp}))}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.controls.list",family:"admin",method:"GET",path:"/admin/v1/controls",summary:"Read every control (capabilities, limits, overrides, blocks, kill switch)",auth:ve,query:y.z.object({scope:fe.Control.shape.scope.optional(),subject:ue.Id.optional()}),response:y.z.object({controls:y.z.array(fe.Control)}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.controls.set",family:"admin",method:"PUT",path:"/admin/v1/controls/:key",summary:"Set or clear one control",description:"Setting value null makes the control absent, so its typed default applies. Stopping spending admission is the operator kill switch.",auth:ve,params:y.z.object({key:y.z.string()}),body:y.z.object({scope:fe.Control.shape.scope,subject:ue.Id.nullable(),value:fe.Control.shape.value,reason:y.z.string().min(1)}),response:fe.Control,status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"admin.activation.request",family:"admin",method:"POST",path:"/admin/v1/activation",summary:"Ask to turn spending on after the rebuild (proposal 3)",description:"Creates the spending_activation approval, bound to this operator session and live for ten minutes. Only the named operator may (Dom, 8 Oct); the operator is the session, never the body, and no email code is asked. #10366: a passkey step-up and two-person approval are required before production.",auth:ve,body:y.z.object({}).strict(),response:y.z.object({approval_id:ue.Id,expires_at:ue.Timestamp}),status:202,errors:["setup_required","blocked","invalid_request","conflict"],launch:"on"},{id:"admin.activation.approve",family:"admin",method:"POST",path:"/admin/v1/activation/:approvalId/approve",summary:"Approve the activation from the same session: spending opens, once",description:"Opens spending admission and the Tempo rail in one audited step, once. Only the operator session that asked approves (the approval records it as evidence operator_session). One operator for now (Dom, 8 Oct): the requester approves; #10366: a passkey step-up and two-person approval (approver not the requester, enforced) are required before production. Stopping and reopening are admin.controls.set.",auth:ve,params:y.z.object({approvalId:ue.Id}),body:y.z.object({}).strict(),response:y.z.object({activated:y.z.enum(["now","already"]),approval_id:ue.Id}),status:200,errors:["setup_required","blocked","invalid_request","not_found","expired","conflict"],launch:"on"},{id:"admin.policy.defaults.get",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/defaults",summary:"Read Policy\u2019s default rules",auth:ve,response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"future"},{id:"admin.policy.defaults.set",backedBy:"policy",family:"admin",method:"PUT",path:"/admin/v1/policy/defaults",summary:"Replace Policy\u2019s default rules",auth:ve,body:y.z.record(y.z.string(),y.z.unknown()),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required","conflict"],launch:"future"},{id:"admin.policy.merchants.list",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/merchants",summary:"List merchant rules",auth:ve,query:y.z.object({after:y.z.string().optional()}),response:y.z.object({merchants:y.z.array(fe.MerchantRule),nextAfter:y.z.string().nullable()}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.merchants.set",backedBy:"policy",family:"admin",method:"PUT",path:"/admin/v1/policy/merchants/:origin",summary:"Set a merchant rule",auth:ve,params:y.z.object({origin:y.z.string()}),body:fe.MerchantRule.pick({decision:!0,reason:!0}).partial({reason:!0}).strict(),response:fe.MerchantRule,status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.merchants.remove",backedBy:"policy",family:"admin",method:"DELETE",path:"/admin/v1/policy/merchants/:origin",summary:"Remove a merchant rule",auth:ve,params:y.z.object({origin:y.z.string()}),response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"admin.policy.simulate",backedBy:"policy",family:"admin",method:"POST",path:"/admin/v1/policy/simulate",summary:"Simulate a Policy decision",auth:ve,body:y.z.record(y.z.string(),y.z.unknown()),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"future"},{id:"admin.policy.audit",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/audit",summary:"Policy\u2019s rule-change history, each change with its before and after",auth:ve,query:ue.PageQuery,response:y.z.object({entries:y.z.array(fe.PolicyAuditEntry),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.status",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/screening",summary:"Whether wallet payees are being screened, its settings and the last day",auth:ve,response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.set",backedBy:"policy",family:"admin",method:"PUT",path:"/admin/v1/policy/screening",summary:"Turn screening enforcement on or off, or change its block level and reuse window",auth:ve,body:y.z.object({required:y.z.boolean().optional(),blockLevel:y.z.union([y.z.literal(5),y.z.literal(10),y.z.literal(15)]).optional(),reuseSeconds:y.z.number().int().min(0).max(604800).optional()}),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required","conflict"],launch:"on"},{id:"admin.policy.screening.results",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/screening/results",summary:"The screening record: every payment, withdrawal and operator check",auth:ve,query:y.z.object({outcome:y.z.enum(["allow","deny","unavailable","bypass"]).optional(),before:y.z.string().uuid().optional(),limit:y.z.coerce.number().int().min(1).max(500).optional(),scope:y.z.literal("traffic").optional()}),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.check",backedBy:"policy",family:"admin",method:"POST",path:"/admin/v1/policy/screening/check",summary:"What a payment to this address or merchant would meet now: the block list, then TRM; keeps nothing",auth:ve,body:y.z.union([y.z.object({chainId:y.z.union([y.z.literal(4217),y.z.literal(8453)]),address:y.z.string()}),y.z.object({merchantUrl:y.z.string()})]),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.rescreen",backedBy:"policy",family:"admin",method:"POST",path:"/admin/v1/policy/screening/rescreen",summary:"Screen one address now and replace the answer payments reuse",auth:ve,body:y.z.object({chainId:y.z.union([y.z.literal(4217),y.z.literal(8453)]),address:y.z.string()}),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.audit.list",family:"admin",method:"GET",path:"/admin/v1/audit",summary:"The append-only audit log",auth:ve,query:ue.PageQuery.extend({subject:y.z.string().optional(),actor_kind:y.z.enum(["owner","agent","operator","server"]).optional()}),response:y.z.object({entries:y.z.array(fe.AuditEntry),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.metrics.get",family:"admin",method:"GET",path:"/admin/v1/metrics",summary:"Operator metrics",auth:ve,response:y.z.record(y.z.string(),y.z.number()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.agents.list",family:"admin",method:"GET",path:"/admin/v1/agents",summary:"List agents across owners",auth:ve,query:ue.PageQuery.extend({login:y.z.string().optional()}),response:y.z.object({agents:y.z.array(Pr.Agent),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.agents.tap",family:"admin",method:"POST",path:"/admin/v1/agents/:agentId/tap",summary:"Retry or reset an agent\u2019s TAP setup",description:"retry: clear the background job\u2019s backoff and list the agent\u2019s TAP key in the directory now. reset: end the TAP key at once (no TAP signature with it from then on), withdraw its directory entry through a provider_cleanup operation, and enroll and list a new one when the deployment can (otherwise the owner\u2019s finish_tap_setup step does). Never moves money. Every action is written to the audit log with the operator and the reason code. Contract proposal 29.",auth:ve,params:y.z.object({agentId:ue.Id}),body:y.z.object({action:y.z.enum(["retry","reset"]),reason:y.z.enum(["stuck_publication","directory_conflict","owner_request","other"])}),response:Pr.Agent,status:200,errors:["setup_required","invalid_request","not_found","agent_inactive","not_enabled"],launch:"on"},{id:"admin.operations.list",family:"admin",method:"GET",path:"/admin/v1/operations",summary:"Operations that need attention, across owners",description:"Stuck, overdue or unsafe operations, each with its owner, age, next action and evidence.",auth:ve,query:ue.PageQuery.extend({needs_attention:y.z.enum(["true","false"]).optional()}),response:y.z.object({operations:y.z.array(fe.AdminOperation),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.operations.resolve",family:"admin",method:"POST",path:"/admin/v1/operations/:id/resolve",summary:"Mark a stuck operation failed or succeeded, on proof",description:"Decision A4: operators never initiate, re-send, change or approve a payment, and there is no operator retry. Financial operations (withdrawal) take money proofs: mark_failed requires Authority to independently verify the bound transaction\u2019s reverted receipt; a missing report, pending receipt or chain outage cannot prove no money moved. mark_succeeded must name the bound transaction and is independently reconciled before success. Non-money operations (cleanup, closure, recovery, telemetry deletion) take removal proofs: mark_succeeded with proof the provider removal is confirmed, mark_failed with proof it was not done. A proof of the wrong kind for the operation is refused (invalid_request). Every resolution is written to the audit log with the operator and the evidence.",auth:ve,params:y.z.object({id:ue.Id}),body:y.z.discriminatedUnion("resolution",[y.z.object({resolution:y.z.literal("mark_failed"),evidence:y.z.object({proves:y.z.enum(["no_money_moved","removal_not_done"]),ref:y.z.string().min(1).clone().register(tt.apiMetadata,{description:"Chain read, provider record or ticket that shows it."})})}),y.z.object({resolution:y.z.literal("mark_succeeded"),evidence:y.z.object({proves:y.z.enum(["money_moved","removal_confirmed"]),ref:y.z.string().min(1).clone().register(tt.apiMetadata,{description:"Transaction hash or provider record that shows it."})})})]),response:fe.AdminOperation,status:200,errors:["setup_required","not_found","conflict","unavailable"],launch:"on"},{id:"admin.payments.attention",family:"admin",method:"GET",path:"/admin/v1/payments/attention",summary:"Payments that need attention, across owners",description:"Purchases whose answer was lost, that are overdue to settle, or whose paid result did not arrive, oldest first. The reconciler resolves them from chain evidence; operators never act on a payment (decision A4), so this is a read.",auth:ve,response:y.z.object({payments:y.z.array(y.z.object({payment_id:ue.Id,owner_id:ue.Id,agent_id:ue.Id,reason:y.z.enum(["outcome_unknown","overdue","paid_result_unavailable","paid_result_overdue"]),state:y.z.string(),age_seconds:y.z.number().int()})),truncated:y.z.boolean()}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.closures.list",family:"admin",method:"GET",path:"/admin/v1/closures",summary:"Closing and closed accounts and the money they still hold",description:"The closed-account obligations list: every closing or closed account with a wallet, its closure operation and its balances read from the chain now. Funds stay the owner's to withdraw from the exit page; operators never move them.",auth:ve,query:ue.PageQuery,response:y.z.object({accounts:y.z.array(fe.AdminClosedAccount),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.db.query",family:"admin",method:"POST",path:"/admin/v1/db/query",summary:"Audited read-only SQL",auth:ve,body:y.z.object({sql:y.z.string(),store:y.z.enum(["postgres","redis"]).optional()}),response:y.z.object({rows:y.z.array(y.z.record(y.z.string(),y.z.unknown())),truncated:y.z.boolean()}),status:200,errors:["setup_required","blocked"],launch:"on"}])});var of=j(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.AGENT_OPERATIONS=void 0;var ie=Je(),af=it(),PT=Kr(),ht=Un(),Le=dr(),pr=ct(),Us=ie.z.object({id:pr.Id}),Zs=ie.z.object({id:pr.Id.clone().register(af.apiMetadata,{description:"The agent's request_id for the payment (the key it always holds, even after a lost answer). Visa's payment id is not accepted here."})}),rf=["setup_required","update_required","agent_inactive","grant_required","limit_reached","owner_approval_required","owner_declined","blocked","merchant_unsupported","conflict","outcome_unknown","not_enabled"];co.AGENT_OPERATIONS=(0,ht.defineOperations)([...PT.NATIVE_FINANCIAL_OPERATIONS,{id:"agent.status.get",family:"agent",method:"GET",path:"/agent/v1/status",summary:"Identity, readiness and what comes next",auth:ht.AGENT_AUTH,response:Le.AgentStatus,status:200,errors:["setup_required","update_required"],launch:"on"},{id:"agent.token.create",family:"agent",method:"POST",path:"/agent/v1/token",summary:"Exchange an installation-key proof for a short access token",description:"Exchange a request signed by an active laptop installation key for an agent access token. Hosted agents use OAuth or an owner-issued app token. A CLI session is not an agent token.",auth:["agent_signature"],body:ie.z.object({audience:ie.z.string().optional()}),response:ie.z.object({access_token:ie.z.string(),expires_at:pr.Timestamp}),status:201,errors:["setup_required","update_required","agent_inactive"],launch:"on"},{id:"agent.setups.start",family:"agent",method:"POST",path:"/agent/v1/setups",summary:"Start (or resume) a laptop setup",description:"Returns the owner link and short code. Repeating the same start resumes an interrupted setup. Hosted agents are set up by OAuth, not here.",auth:["none"],body:Le.AgentSetupStart,response:Le.AgentSetupStarted,status:201,errors:["update_required","conflict","blocked"],launch:"on"},{id:"agent.setups.get",family:"agent",method:"GET",path:"/agent/v1/setups/:id",summary:"Poll a setup",auth:["setup_secret"],params:Us,response:Le.Setup,status:200,errors:["not_found","expired"],launch:"on"},{id:"agent.setups.claim",family:"agent",method:"POST",path:"/agent/v1/setups/:id/claim",summary:"Claim an approved setup with the installation key",auth:["setup_secret"],params:Us,body:Le.SetupClaim,response:Le.SetupClaimed,status:200,errors:["not_found","expired","owner_approval_required","owner_declined","conflict"],launch:"on"},{id:"agent.keys.lease",family:"agent",method:"POST",path:"/agent/v1/keys/lease",summary:"Lease the installation for one operation",description:"Today the only operation is `tap_signature_base`: a `visa-agent-runtime-lease+jwt` (at most 120 s) from Authority\u2019s identity lease issuer, for this installation\u2019s TAP authority (contract proposal 28). The agent presents it to agent.keys.tapSign.",auth:["agent_signature","agent_token"],body:ie.z.object({operation:ie.z.literal("tap_signature_base"),request_id:pr.Id}),response:ie.z.object({lease:ie.z.string(),expires_at:pr.Timestamp}),status:201,errors:["setup_required","update_required","agent_inactive","not_enabled"],launch:"on"},{id:"agent.keys.tapSign",family:"agent",method:"POST",path:"/agent/v1/keys/tap-sign",summary:"Sign a merchant request with the agent\u2019s TAP key",description:"The identity gate signs the agent\u2019s TAP signature base (contract proposal 28). request_id is a new UUID per signature (the gate refuses a replay). authorization.lease comes from agent.keys.lease; authorization.pop_jwt is the installation key\u2019s proof: typ visa-agent-pop+jwt, aud urn:visa:tvc:identity-gate, nonce = request_id, int = the payload digest (identityTapPayloadSha256), at most 60 s old. The answer\u2019s signature_input and signature are the Signature-Input and Signature header values (label sig2).",auth:["agent_signature","agent_token"],body:ie.z.object({request_id:ie.z.uuid(),payload:Le.TapSignatureBasePayload,authorization:ie.z.object({lease:ie.z.string(),pop_jwt:ie.z.string()})}),response:ie.z.object({signature:ie.z.string(),signature_input:ie.z.string(),key_id:ie.z.string()}),status:200,errors:["setup_required","update_required","agent_inactive","not_enabled","expired","unavailable"],launch:"on"},{id:"agent.keys.reissue",family:"agent",method:"POST",path:"/agent/v1/keys/reissue",summary:"Pick up an owner-approved key re-issue (#10945)",auth:["agent_signature"],body:ie.z.object({installation_key:ie.z.record(ie.z.string(),ie.z.unknown()),proof:ie.z.string()}),response:ie.z.object({installation_id:pr.Id,key_generation:ie.z.number().int()}),status:200,errors:["setup_required","update_required","agent_inactive","owner_approval_required"],launch:"future"},{id:"agent.payments.create",family:"agent",method:"POST",path:"/agent/v1/payments",summary:"Create, co-sign, resume or recover a purchase",description:'One purchase, several steps, all under the same request_id (purchase identity: PURCHASE_IDENTITY_FIELDS; a different value under the same request_id is a conflict). Hosted (prepare): every payment first answers owner_approval_required (A2: the owner approves each connector payment at launch, whatever the grant mode or controls; ownerApprovalRequired); after approval the server runs the 402 exchange and returns the merchant result once. Laptop (admit \u2192 vote \u2192 resume): the laptop prepares the charge itself from its wallet signing context (agent.status.get), picks a new wire_request_id for this execution, and sends both with its independent proof (RuntimeAuthorization, nonce = wire_request_id); retries of the same execution reuse its wire_request_id, a replacement execution picks a new one under the same request_id; the server adds the delegation, lease and root key, admits it against the grant and controls, commits the attempt and its signing hash before contacting the provider (pre-dispatch fence), and answers with a signing exchange; the laptop verifies and votes directly with the provider on that attempt, records the vote, then resumes with the identical charge and a fresh proof to receive the signature. Recovery: repeating a step with the same request_id and identical terms returns the same attempt; a lost provider response is found again by reading the provider for the exact signing payload, otherwise the attempt stays fenced as unknown (dispatchRecovery). Time alone never closes a signed attempt: it stays fenced until a landed transaction settles it or finalized non-landing or a provider void closes it (executionDecision); only then may admit name it in replaces_attempt_id for a re-quote, which needs fresh consent above the consented terms. Hosted, after a credential was released, the credential is never re-sent: recover asks the merchant to verify the caller\u2019s receipt or job reference, otherwise the outcome is "paid, result unavailable" (hostedResumeDecision). Ask-each-time or over the limit: owner_approval_required, then resume. Spending switched off: the operator kill switch answers not_enabled (spending_admission_off); the owner\u2019s stop-all answers blocked (owner_spending_stopped).',auth:ht.AGENT_AUTH,body:Le.PaymentCreate,response:Le.Payment,status:200,idempotency:"request_id",controls:["spending_admission"],errors:rf,launch:"on"},{id:"agent.payments.list",family:"agent",method:"GET",path:"/agent/v1/payments",summary:"This agent\u2019s purchases, newest first",auth:ht.AGENT_AUTH,query:pr.PageQuery,response:Le.PaymentList,status:200,errors:["setup_required","update_required"],launch:"on"},{id:"agent.payments.get",family:"agent",method:"GET",path:"/agent/v1/payments/:id",summary:"Read a purchase, optionally waiting for it to change",description:"With `wait` (seconds, at most 30) the answer comes as soon as the purchase changes (its state or updated_at), or at the deadline with it unchanged: compare updated_at to tell which. A resolved purchase answers at once. Use it instead of polling in a loop, for example while the owner approves.",auth:ht.AGENT_AUTH,params:Zs,query:ie.z.object({wait:ie.z.coerce.number().int().min(0).max(30).optional()}),response:Le.Payment,status:200,errors:["setup_required","update_required","not_found"],launch:"on"},{id:"agent.payments.cancel",family:"agent",method:"POST",path:"/agent/v1/payments/:id/cancel",summary:"Cancel a purchase that has not executed",auth:ht.AGENT_AUTH,params:Zs,response:Le.Payment,status:200,errors:["setup_required","update_required","not_found","conflict","outcome_unknown"],launch:"on"},{id:"agent.payments.report",family:"agent",method:"POST",path:"/agent/v1/payments/:id/report",summary:"Report what the merchant delivered",auth:ht.AGENT_AUTH,params:Zs,body:Le.PaymentReport,response:Le.Payment,status:200,errors:["setup_required","update_required","not_found","conflict"],launch:"on"},{id:"agent.payments.credential",family:"agent",method:"POST",path:"/agent/v1/payments/:id/credential",summary:"Deliver the card credential for an admitted card purchase",description:"Future, not in the launch build (A1 cut card paying; enrollment, IDV and TAP stay). Before it returns: the testers\u2019 CLI drained and the floor raised, existing card records resolved, enrollment and TAP proven on real Postgres, the code saved on a tagged branch, and the credential-delivery decision (P1). Then: an unsupported card host is refused before any credential is issued.",auth:ht.AGENT_AUTH,params:Us,body:ie.z.object({host:ie.z.string().clone().register(af.apiMetadata,{description:"The agent host, checked against the card host support matrix."})}),response:Le.CardCredential,status:200,controls:["card_payments_enabled","spending_admission"],errors:["setup_required","update_required","not_found","not_enabled","expired","outcome_unknown","merchant_unsupported"],launch:"future"},{id:"agent.merchants.search",family:"agent",method:"GET",path:"/agent/v1/merchants",summary:"Search paid services, or probe one target\u2019s live terms",description:"Read-only: signs and spends nothing. Listed prices are advisory.",auth:ht.AGENT_AUTH,query:ie.z.object({q:ie.z.string().optional(),target:ie.z.url().optional(),limit:ie.z.coerce.number().int().min(1).max(50).optional()}),response:Le.MerchantResult,status:200,errors:["setup_required","update_required","unavailable"],launch:"on"},{id:"agent.events.create",backedBy:"edge",family:"agent",method:"POST",path:"/agent/v1/events",summary:"Send closed-schema client events",auth:[...ht.AGENT_AUTH,"none"],body:ie.z.object({events:ie.z.array(Le.ClientEvent).max(50)}),response:null,status:204,errors:[],launch:"on"},{id:"agent.tools.list",backedBy:"edge",family:"agent",method:"GET",path:"/agent/v1/tools",summary:"The MCP tool catalogue, for REST apps",auth:ht.AGENT_AUTH,response:ie.z.object({tools:ie.z.array(Le.ToolDescriptor)}),status:200,errors:["setup_required"],launch:"on"},{id:"agent.tools.call",family:"agent",method:"POST",path:"/agent/v1/tools/:name",summary:"Call one MCP tool over REST",auth:ht.AGENT_AUTH,params:ie.z.object({name:ie.z.string()}),body:ie.z.record(ie.z.string(),ie.z.unknown()),response:ie.z.record(ie.z.string(),ie.z.unknown()),status:200,errors:[...rf,"not_found"],launch:"on"}])});var cf=j(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.OWNER_OPERATIONS=void 0;var sf=Kr(),T=Je(),Ee=it(),jT=Un(),L=dr(),le=ct(),uf=le.Id.clone().register(Ee.apiMetadata,{description:"Client-generated retry key, one per owner action: repeating it never creates a second one."}),qs=le.Operation.extend({hosted_setup_recovery:L.HostedSetupRecovery.nullable().optional(),withdrawal_transaction:L.WithdrawalTransaction.nullable().optional(),wallet_key_authorization:L.WalletKeyAuthorizationResume.nullable().optional()}),xe=["owner_session"],be=["owner_session","owner_exit_session"],jr=T.z.object({agentId:le.Id}),Ke=T.z.object({id:le.Id}),lo=e=>T.z.object({resource:e,challenge:L.Challenge});po.OWNER_OPERATIONS=(0,jT.defineOperations)([{id:"owner.session.start",backedBy:"edge",family:"owner",method:"POST",path:"/owner/v1/session",summary:"Start owner sign-in",description:"Begins Turnkey sign-in and the entry gate (Visa identity plus legal geo-blocking). Returns the challenge to complete at /owner/v1/session/verify.",auth:["none"],body:T.z.object({email:T.z.email().optional(),return_to:T.z.string().optional()}),response:T.z.object({challenge:L.Challenge,terms:T.z.object({bundle_version:T.z.string().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}(\.[0-9]+)?$/).clone().register(Ee.apiMetadata,{description:"The legal bundle (Terms of Service and Privacy Notice) the owner accepts."}),terms_path:T.z.string().regex(/^\/legal\/[a-z-]+$/).clone().register(Ee.apiMetadata,{description:"The Terms of Service page, on this API\u2019s own origin."}),privacy_path:T.z.string().regex(/^\/legal\/[a-z-]+$/).clone().register(Ee.apiMetadata,{description:"The Privacy Notice page, on this API\u2019s own origin."})}).clone().register(Ee.apiMetadata,{description:"What signing in accepts; the owner must see both links before verify."})}),status:202,errors:["blocked","not_enabled"],launch:"on"},{id:"owner.session.verify",backedBy:"edge",family:"owner",method:"POST",path:"/owner/v1/session/verify",summary:"Complete owner sign-in",description:"One Turnkey user is one owner, whichever of its sign-in methods (email code, Google, passkey) proved it: owners are keyed by the Turnkey user, never by an email. Refuses invalid_request (terms_acceptance_required) unless accepted_terms names the current legal bundle.",auth:["none"],body:T.z.object({challenge_id:le.Id,assertion:T.z.string(),accepted_terms:T.z.string().clone().register(Ee.apiMetadata,{description:"The terms.bundle_version from owner.session.start, sent only when the owner accepted it. Required on every sign-in; recorded once per owner and version."}),identity_token:T.z.string().max(8192).optional().clone().register(Ee.apiMetadata,{description:"The Google or Apple ID token of this sign-in, when it used one. Believed only when its signature checks against the provider's published keys and its account is one the signing-in Turnkey user holds; then the owner's name, verified email and Google photo are recorded (a name the owner set is kept). Never required: a sign-in without it, or with one that does not check, proceeds unchanged."})}),response:T.z.object({session:L.Session,owner:L.Owner,csrf_token:T.z.string().clone().register(Ee.apiMetadata,{description:"Send it as the X-CSRF-Token header on every owner write in this session."}),signer:L.SessionSigner.nullable().optional().clone().register(Ee.apiMetadata,{description:"Who may sign for the owner in this session (INT-3). Absent: not yet named."})}),status:201,errors:["expired","blocked"],launch:"on"},{id:"owner.session.get",backedBy:"edge",family:"owner",method:"GET",path:"/owner/v1/session",summary:"Read the current session",auth:be,response:T.z.object({session:L.Session,owner:L.Owner,csrf_token:T.z.string().clone().register(Ee.apiMetadata,{description:"Send it as the X-CSRF-Token header on every owner write in this session."}),signer:L.SessionSigner.nullable().optional().clone().register(Ee.apiMetadata,{description:"Who may sign for the owner in this session (INT-3). Absent: not yet named."})}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.session.end",backedBy:"edge",family:"owner",method:"DELETE",path:"/owner/v1/session",summary:"Sign out",auth:be,response:null,status:204,errors:[],launch:"on"},{id:"owner.sessions.list",backedBy:"edge",family:"owner",method:"GET",path:"/owner/v1/sessions",summary:"List the owner\u2019s signed-in sessions",auth:xe,response:T.z.object({sessions:T.z.array(L.Session)}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.sessions.revoke",backedBy:"edge",family:"owner",method:"DELETE",path:"/owner/v1/sessions/:id",summary:"Revoke one session",auth:xe,params:Ke,response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"owner.console.get",family:"owner",method:"GET",path:"/owner/v1/console",summary:"The Console screen answer",description:"One read for the Console home: readiness ladder per capability, agents, wallet, cards, pending approvals, needs-attention items and the stop-all state.",auth:be,response:L.Console,status:200,errors:["setup_required"],launch:"on"},{id:"owner.agents.list",family:"owner",method:"GET",path:"/owner/v1/agents",summary:"List agents",auth:be,query:T.z.object({section:T.z.enum(["live","ended"]).optional(),...le.PageQuery.shape}),description:"Live agents by default, including ending agents. The ended section preserves owner history. Each page is bounded to 100 with deterministic ordering and server-projected per-rail grant facts. Cursor pagination: pass next_cursor back as cursor (with the same section); null on the last page.",response:le.Page.extend({agents:T.z.array(L.Agent).max(100),truncated:T.z.boolean().optional()}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.agents.get",family:"owner",method:"GET",path:"/owner/v1/agents/:agentId",summary:"Read one agent",auth:be,params:jr,query:T.z.object({history_cursor:T.z.string().optional(),history_limit:T.z.coerce.number().int().min(1).max(100).optional()}),description:"Includes ended agents and a bounded exact grant terms history page, newest first; pass grant_history.next_cursor back as history_cursor for the next page. History is retained evidence, never active authority.",response:L.Agent,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.agents.update",family:"owner",method:"PATCH",path:"/owner/v1/agents/:agentId",summary:"Rename, pause or resume an agent",description:"Pausing blocks new admissions at once; resuming re-checks the current controls.",auth:xe,params:jr,body:L.AgentPatch,response:L.Agent,status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"owner.agents.revoke",family:"owner",method:"DELETE",path:"/owner/v1/agents/:agentId",summary:"Revoke an agent",description:"New admissions stop at once. Signed admissions already issued live at most 60 s at SlipGate (a frozen verifier limit). Submitted money settles or reconciles; provider credentials and directory entries are cleaned up by a revocation_teardown operation.",auth:be,params:jr,response:T.z.object({agent:L.Agent,operation:le.Operation}),status:202,errors:["setup_required","not_found"],launch:"on"},{id:"owner.agents.reissue",family:"owner",method:"POST",path:"/owner/v1/agents/:agentId/reissue",summary:"Replace an agent\u2019s installation key (upgrade, planned or emergency)",description:"upgrade (#10945) and planned: a replacement setup the owner signs; the old generation ends when the new installation activates. emergency (device lost): the old installation\u2019s keys end immediately in this request, before any new device exists, and new admissions are refused from then on; the agent stays active with no usable key until the replacement setup completes. Admissions signed before it can still be honoured for up to 60 s at SlipGate, and money already submitted settles or reconciles. Agent identity and grants are kept in every case.",auth:xe,params:jr,body:T.z.object({reason:T.z.enum(["upgrade","planned","emergency"])}),response:T.z.object({agent:L.Agent,setup:L.Setup,challenge:L.Challenge}),status:202,variants:[{status:200,description:"emergency: the old keys are already ended; the replacement setup is open.",response:T.z.object({agent:L.Agent,ended_installation_id:le.Id,keys_ended_at:le.Timestamp,admissions_honoured_until:le.Timestamp.clone().register(Ee.apiMetadata,{description:"At most 60 s after keys_ended_at."}),setup:L.Setup})}],signed:!0,errors:["setup_required","not_found","agent_inactive"],launch:"on"},{id:"owner.tokens.list",family:"owner",method:"GET",path:"/owner/v1/agents/:agentId/tokens",summary:"List an agent\u2019s app tokens",description:"OWNER_OR_EXIT (decided 8 Oct, 10a): a leaving owner can list and then revoke every token of an app (owner.tokens.revoke), so disconnecting an app needs no extra operation.",auth:be,params:jr,response:T.z.object({tokens:T.z.array(L.AgentToken)}),status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.tokens.create",family:"owner",method:"POST",path:"/owner/v1/agents/:agentId/tokens",summary:"Mint an app token for an agent",description:"Send a request_id to retry safely: the same request_id never mints a second token; it answers 200 with the token it created (no secret, which is shown once and never stored) and says to revoke and create again if the secret was lost. The same request_id with a different app is a conflict. Without a request_id, minting again ends the agent\u2019s earlier token for that app.",auth:xe,params:jr,body:T.z.object({app:T.z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional().clone().register(Ee.apiMetadata,{description:"The app or harness the token is for. The label is server-assigned from it."}),request_id:uf.optional()}),response:L.AgentTokenCreated,status:201,variants:[{status:200,description:"A retry with the same request_id: the token it already created, without the secret.",response:L.AgentTokenAlreadyCreated}],idempotency:"request_id",errors:["setup_required","not_found","agent_inactive"],launch:"on"},{id:"owner.tokens.revoke",family:"owner",method:"DELETE",path:"/owner/v1/agents/:agentId/tokens/:keyId",summary:"Revoke an app token",auth:be,params:T.z.object({agentId:le.Id,keyId:le.Id}),response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"owner.setups.start",family:"owner",method:"POST",path:"/owner/v1/setups",summary:"Start a setup from the Console",description:"Laptop: returns the one command the owner pastes; the terminal joins with the setup key. Hosted: returns the connector link.",auth:xe,body:L.OwnerSetupStart,idempotency:"request_id",response:T.z.object({setup:L.Setup,setup_key:T.z.string()}),status:201,errors:["setup_required","blocked","conflict","not_found","agent_inactive"],launch:"on"},{id:"owner.setups.get",family:"owner",method:"GET",path:"/owner/v1/setups/:id",summary:"Read a setup",auth:xe,params:Ke,response:L.Setup,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.setups.approve",family:"owner",method:"POST",path:"/owner/v1/setups/:id/approve",summary:"Approve a setup and its first grant",auth:xe,params:Ke,body:T.z.object({code:T.z.string(),grants:T.z.array(L.GrantRequest)}),response:lo(L.Setup),status:202,signed:!0,errors:["setup_required","not_found","expired","conflict"],launch:"on"},{id:"owner.setups.decline",family:"owner",method:"POST",path:"/owner/v1/setups/:id/decline",summary:"Decline a setup",auth:xe,params:Ke,response:L.Setup,status:200,errors:["setup_required","not_found","expired"],launch:"on"},{id:"owner.grants.get",family:"owner",method:"GET",path:"/owner/v1/agents/:agentId/grants/:rail",summary:"Read an agent\u2019s current grant on one rail",auth:be,params:T.z.object({agentId:le.Id,rail:le.Rail}),query:T.z.object({grant_id:le.Id.optional().clone().register(Ee.apiMetadata,{description:"An exact retained grant identity; combine with version to read its immutable terms without choosing a successor."}),version:T.z.coerce.number().int().min(1).optional().clone().register(Ee.apiMetadata,{description:"An immutable terms version. Supply grant_id to disambiguate earlier identities after an ended grant is replaced. Usage and mode on Grant are current read facts, not historical snapshots."})}),response:L.Grant,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.grants.replace",family:"owner",method:"PUT",path:"/owner/v1/agents/:agentId/grants/:rail",summary:"Change a grant\u2019s terms (a new version)",description:"Lower limits or an earlier expiry: a new version that keeps the existing consent, applied at once (200). Higher limits, a later expiry, another period, a first grant on this rail, or a new card or key: fresh consent (202 with a challenge); nothing changes until it is signed. Usage carries across versions. A hosted agent\u2019s grant is always ask_each_time at launch (A2). Card grants are not in the launch build (A1).",auth:xe,params:T.z.object({agentId:le.Id,rail:le.Rail}),body:T.z.object({terms:L.GrantTerms,mode:L.GrantMode.optional().clone().register(Ee.apiMetadata,{description:"First grant only."})}),response:L.GrantChange,status:202,variants:[{status:200,description:"Narrower terms: applied with the existing consent.",response:L.GrantChange}],signed:!0,errors:["setup_required","not_found","agent_inactive","not_enabled"],launch:"on"},{id:"owner.grants.setMode",family:"owner",method:"PATCH",path:"/owner/v1/agents/:agentId/grants/:rail",summary:"Switch within_limit \u21C4 ask_each_time in place",description:"The required grant_id and version name the displayed grant whose terms the owner intends to change. Authority checks that exact grant/version for this owner, agent and rail under the owner lock before any consent or mutation; stale intent refuses conflict. Not a new version: the grant version, its consent and its usage are kept. Narrowing (to ask_each_time) applies at once (200). Widening (to within_limit) is a Console button action from the current product owner session with CSRF protection. It applies at once (200), recording and consuming an autonomy_increase consent; no email code or additional credential. Agent/CLI credentials and exit sessions cannot widen. Hosted agents cannot be widened at launch (A2): every hosted payment needs the owner\u2019s approval until a connector-side signing key exists, so widening a hosted agent is refused (not_enabled, hosted_autonomy_unsupported).",auth:xe,params:T.z.object({agentId:le.Id,rail:le.Rail}),body:T.z.object({mode:L.GrantMode,grant_id:le.Id.clone().register(Ee.apiMetadata,{description:"The displayed Grant.grant_id whose terms the owner intends to change."}),version:T.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).clone().register(Ee.apiMetadata,{description:"The displayed Grant.version; must still be current at the effect boundary."})}),response:L.GrantChange,status:200,signed:!0,errors:["setup_required","not_found","agent_inactive","not_enabled","conflict"],launch:"on"},{id:"owner.approvals.list",family:"owner",method:"GET",path:"/owner/v1/approvals",summary:"List approvals waiting for the owner",auth:xe,query:le.PageQuery.extend({state:T.z.enum(["requested","all"]).optional()}),response:T.z.object({approvals:T.z.array(L.Approval),page:le.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.approvals.get",family:"owner",method:"GET",path:"/owner/v1/approvals/:id",summary:"Read one approval",auth:xe,params:Ke,response:L.Approval.extend({detail:L.ApprovalReviewDetail.nullable().optional(),native:sf.NativeAtumApprovalDetail.optional(),progress:L.OwnerPaymentProgress.optional()}),status:200,errors:["setup_required","not_found","unavailable","conflict"],launch:"on"},{id:"owner.approvals.approve",family:"owner",method:"POST",path:"/owner/v1/approvals/:id/approve",summary:"Approve one purchase",auth:xe,params:Ke,body:T.z.object({original:L.OriginalHostedPurchaseContext.optional()}).optional(),response:T.z.union([lo(L.Approval).extend({prepared:L.OwnerPreparedPayment.optional()}),T.z.strictObject({resource:L.Approval,challenge:T.z.null(),native:sf.NativeAtumApprovalDetail})]),status:202,signed:!0,controls:["spending_admission"],errors:["setup_required","not_found","expired","conflict","limit_reached","not_enabled"],launch:"on"},{id:"owner.approvals.decline",family:"owner",method:"POST",path:"/owner/v1/approvals/:id/decline",summary:"Decline one purchase (terminal)",auth:xe,params:Ke,response:L.Approval,status:200,errors:["setup_required","not_found","expired"],launch:"on"},{id:"owner.wallet.get",family:"owner",method:"GET",path:"/owner/v1/wallet",summary:"Read the owner wallet",auth:be,response:L.Wallet,status:200,errors:["setup_required"],launch:"on"},{id:"owner.wallet.enable",family:"owner",method:"POST",path:"/owner/v1/wallet",summary:"Enable the Tempo wallet",auth:xe,response:lo(L.Wallet),variants:[{status:200,description:"The wallet is already enabled.",response:L.Wallet}],status:202,signed:!0,errors:["setup_required","conflict","not_enabled"],launch:"on"},{id:"owner.wallet.disable",family:"owner",method:"DELETE",path:"/owner/v1/wallet",summary:"Disable the wallet for spending",description:"Stops agent spending from the wallet. Funds stay withdrawable.",auth:be,response:T.z.object({wallet:L.Wallet,operation:le.Operation.nullable()}),status:202,errors:["setup_required"],launch:"on"},{id:"owner.wallet.withdraw",family:"owner",method:"POST",path:"/owner/v1/wallet/withdrawals",summary:"Withdraw from the wallet",description:"Recorded as a withdrawal operation with its immutable terms before any signature or broadcast. Repeating the same request_id returns the same operation (after a lost response). Another browser or the exit session finds it with owner.operations.list or .get (terms included) and fetches or renews its signing challenge with owner.operations.challenge. Works while spending is stopped. Any token the wallet holds, by contract address, dust included.",auth:be,body:L.Withdrawal,response:T.z.object({operation:le.Operation,challenge:L.Challenge}),status:202,signed:!0,errors:["setup_required","conflict"],launch:"on"},{id:"owner.wallet.withdrawals.cancel",family:"owner",method:"POST",path:"/owner/v1/wallet/withdrawals/:id/cancel",summary:"Cancel an unsigned or reverted withdrawal",description:"Ends a withdrawal waiting for the owner with no bound signed transaction and no unresolved broadcast. A reported transaction permits cancellation only after Authority independently verifies its reverted receipt and clears its binding. The historical hash remains recorded. The owner can then withdraw to another destination. Missing reports, balances and elapsed time never prove that signed bytes are unsent; unresolved or successor-bound transfers refuse cancellation (conflict).",auth:be,params:Ke,response:T.z.object({operation:le.Operation}),status:200,signed:!0,errors:["setup_required","not_found","conflict","unavailable"],launch:"on"},{id:"owner.cards.list",family:"owner",method:"GET",path:"/owner/v1/cards",summary:"List enrolled cards",auth:be,response:T.z.object({cards:T.z.array(L.Card)}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.cards.enroll",family:"owner",method:"POST",path:"/owner/v1/cards",summary:"Start enrolling a card (VGS hosted fields)",description:"Opens a setup of kind card and answers the VGS hosted-fields configuration. Card entry happens once, in VGS hosted fields. One card enrollment runs at a time: starting another ends the earlier unfinished one. Send a request_id to retry safely: the same request_id starts nothing new and answers 200 with that enrollment\u2019s current state and no form token (it is never stored); a new request_id opens a fresh form. To swap cards, enroll the new one, then remove the old one.",auth:xe,body:T.z.object({request_id:uf.optional()}),response:L.CardEnrollment,status:201,variants:[{status:200,description:"A retry with the same request_id: the enrollment it already started, without a form token.",response:L.CardEnrollmentAlreadyStarted}],idempotency:"request_id",errors:["setup_required","blocked"],launch:"on"},{id:"owner.cards.collect",family:"owner",method:"POST",path:"/owner/v1/cards/:id/collect",summary:"Finish card collection",description:"Receives the VGS alias of the card the owner typed, with the email the card issuer verifies against and the owner\u2019s residency attestation. Reads the issuer attributes and applies the entry rule (a US-issued Visa card): an ineligible card stops here (blocked, `unsupported_issuer_country:<country>` or `unsupported_card_brand`) and nothing is enrolled. An eligible card is enrolled with VIC, the issuer sends a one-time code to its first delivery choice, and the card is answered as `verifying` with a card_enrollment challenge (signer card_otp) naming where the code went and the other choices. Calling it again with only `send_to` sends a new code to that choice (refused rate_limited inside `resend_in_seconds`; each new code invalidates the earlier ones). With only `restart: true` it starts the verification again on the card already collected, after the issuer refused the attempt. Answer the challenge with owner.signatures.submit { method: card_otp, code }; the owner then signs the acceptance with their own key, and only then is the card active and the owner eligible.",auth:xe,params:Ke,body:T.z.union([T.z.object({aliases:T.z.object({card:T.z.string().min(1).max(256)}),email:T.z.email().max(254),residency_attested:T.z.literal(!0)}),T.z.object({send_to:T.z.string().min(1).max(512).clone().register(Ee.apiMetadata,{description:"A delivery choice from the challenge: send a new code there."})}),T.z.object({restart:T.z.literal(!0).clone().register(Ee.apiMetadata,{description:"Start the verification again with the card already collected (the owner never types it again): a fresh VIC enrollment, and a code to its first choice."})})]),response:lo(L.Card),status:202,signed:!0,errors:["setup_required","not_found","expired","blocked","conflict","rate_limited"],launch:"on"},{id:"owner.cards.update",family:"owner",method:"PATCH",path:"/owner/v1/cards/:id",summary:"Make a card the default",auth:xe,params:Ke,body:T.z.object({is_default:T.z.literal(!0)}),response:L.Card,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.cards.remove",family:"owner",method:"DELETE",path:"/owner/v1/cards/:id",summary:"Remove a card",description:"Also revokes the VIC mandates of every grant that used it (a provider_cleanup operation).",auth:be,params:Ke,response:T.z.object({card:L.Card,operation:le.Operation.nullable()}),status:202,errors:["setup_required","not_found"],launch:"on"},{id:"owner.activity.list",family:"owner",method:"GET",path:"/owner/v1/activity",summary:"List activity",auth:be,query:le.PageQuery.extend({agent_id:le.Id.optional(),kind:L.ActivityItem.shape.kind.optional()}),response:L.ActivityList,status:200,errors:["setup_required"],launch:"on"},{id:"owner.activity.get",family:"owner",method:"GET",path:"/owner/v1/activity/:id",summary:"Read one activity item",auth:be,params:Ke,response:L.ActivityItem,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.activity.export",family:"owner",method:"GET",path:"/owner/v1/activity/export",summary:"Export activity as CSV",auth:be,query:T.z.object({from:le.Timestamp.optional(),to:le.Timestamp.optional()}),response:T.z.string().clone().register(Ee.apiMetadata,{description:"text/csv"}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.security.get",family:"owner",method:"GET",path:"/owner/v1/security",summary:"Sessions, security history and the stop-all state",auth:be,response:L.Security,status:200,errors:["setup_required"],launch:"on"},{id:"owner.spending.stop",family:"owner",method:"POST",path:"/owner/v1/spending/stop",summary:"Stop all spending now",description:"Takes effect at once. Allowed from the exit session too: a refused or closing owner may always stop spending, withdraw and export. Withdrawals, export and cleanup continue while stopped.",auth:be,response:T.z.object({spending:L.SpendingState}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.spending.reopen",family:"owner",method:"POST",path:"/owner/v1/spending/reopen",summary:"Reopen spending from the Console",description:"A Console button action from the current product owner session with CSRF protection; agent/CLI credentials and exit sessions cannot reopen. Reopens only the owner\u2019s own stop at once, retaining a consumed autonomy_increase consent. No email code or additional credential; an operator stop cannot be lifted.",auth:xe,response:T.z.object({spending:L.SpendingState,challenge:T.z.null()}),status:200,signed:!0,errors:["setup_required","blocked"],launch:"on"},{id:"owner.account.update",family:"owner",method:"PATCH",path:"/owner/v1/account",summary:"Update the owner profile",auth:xe,description:"contact_email: null clears the owner\u2019s contact email (proposal 10). Setting one goes through owner.contact.start.",body:T.z.object({display_name:T.z.string().max(80).optional(),photo:T.z.string().optional(),contact_email:T.z.null().optional()}),response:L.Owner,status:200,errors:["setup_required"],launch:"on"},{id:"owner.contact.start",family:"owner",method:"POST",path:"/owner/v1/account/contact",summary:"Prove a contact email address (TAP directory and essential notices)",description:"Sends a one-time code to the address and answers a challenge with signer email_code; the owner submits the code at owner.signatures.submit, and the address becomes contact_email (source owner_code). The code proves the address only: it never approves money, a setup or a grant (proposal 10). Owners whose sign-in provider vouched for an email already have one and are asked only at the TAP step.",auth:xe,body:T.z.object({email:T.z.email().max(254)}),response:T.z.object({challenge:L.Challenge}),status:202,signed:!0,errors:["setup_required","blocked","unavailable"],launch:"on"},{id:"owner.account.export",family:"owner",method:"POST",path:"/owner/v1/account/export",summary:"Export the owner\u2019s data",auth:be,response:T.z.record(T.z.string(),T.z.unknown()).clone().register(Ee.apiMetadata,{description:"The export document (JSON)."}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.devices.register",family:"owner",method:"PUT",path:"/owner/v1/devices/:id",summary:"Register this phone for notifications",description:"Registration only (nothing is sent at launch; it grants no authority). The id is the app\u2019s own: registering again updates the token in place. A token or app install registered under another account moves to this one. At most 20 devices. Works from the exit session, so a pending owner can be told when they are admitted. Closing the account deletes every device.",auth:be,params:Ke,body:T.z.object({platform:T.z.literal("ios"),app_env:T.z.enum(["preview","production"]),token:T.z.string().regex(/^[0-9a-fA-F]{16,200}$/).clone().register(Ee.apiMetadata,{description:"The APNs device token (hex)."})}),response:L.Device,status:200,errors:["setup_required","invalid_request","conflict"],launch:"on"},{id:"owner.devices.remove",family:"owner",method:"DELETE",path:"/owner/v1/devices/:id",summary:"Stop notifications to a phone",auth:be,params:Ke,response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"owner.account.close",family:"owner",method:"POST",path:"/owner/v1/account/close",summary:"Close the account",description:"Starts an account_closure operation. It is accepted while money remains, a payment is unresolved or a withdrawal is open: signing it stops all spending at once, and the operation finishes after the reconciler settles payments (next_action reconcile_payments) and the owner withdraws (owner_withdraw). Closing keeps the owner\u2019s custody and exit sign-in, so later funds stay withdrawable; recovery can never revive spending authority. A never-used account (no wallet ever enabled, no agent ever set up) is closed on the owner\u2019s sign-in alone: `challenge` is null and the operation has already started.",auth:be,response:T.z.object({operation:le.Operation,challenge:L.Challenge.nullable()}),status:202,signed:!0,errors:["setup_required","conflict"],launch:"on"},{id:"owner.signatures.submit",family:"owner",method:"POST",path:"/owner/v1/signatures/:challengeId",summary:"Submit the owner\u2019s signature for a challenge",auth:be,params:T.z.object({challengeId:le.Id}),body:L.SignatureSubmission,response:L.SignatureResult,status:200,errors:["setup_required","not_found","expired","conflict","blocked"],launch:"on"},{id:"owner.signatures.get",family:"owner",method:"GET",path:"/owner/v1/signatures/:challengeId",summary:"Read a challenge\u2019s state",auth:be,params:T.z.object({challengeId:le.Id}),response:L.SignatureResult,status:200,errors:["setup_required","not_found","unavailable","conflict"],launch:"on"},{id:"owner.renewal.start",family:"owner",method:"POST",path:"/owner/v1/renewal",summary:"Begin deliberate account spending-consent renewal",description:"Available before the seven-day reminder window. Returns the existing open renewal operation or opens one awaiting the owner\u2019s exact signature through owner.operations.challenge and owner.signatures.submit. Starting changes no consent, budget, hold, key, TAP or bearer authority. Repeat an interrupted start to recover the open operation; after completion, a new start awaits a new signature. Consent ends ninety days from the tap, without carry-over. This operation renews spending consent only; technical authority readiness remains separate.",auth:xe,response:le.Operation,status:200,errors:["setup_required","blocked","conflict"],launch:"on"},{id:"owner.operations.list",family:"owner",method:"GET",path:"/owner/v1/operations",summary:"List the owner\u2019s operations",description:'`needs_attention=true` is the owner\u2019s "Needs attention" list.',auth:be,query:le.PageQuery.extend({needs_attention:T.z.enum(["true","false"]).optional()}),response:T.z.object({operations:T.z.array(qs),page:le.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.operations.challenge",family:"owner",method:"POST",path:"/owner/v1/operations/:id/challenge",summary:"Fetch or renew the signing challenge an operation is waiting for",description:"For an operation in needs_owner_action: returns the current challenge if it is still valid, or a fresh one for the same step and the same immutable terms if it expired. A recorded wallet key authorization instead returns its original owner-only signed bytes and hash with challenge null, including while running or retained terminal; unknown outcomes never create a new challenge. Never changes the terms and never signs for the owner.",auth:be,params:Ke,response:T.z.object({operation:qs,challenge:L.Challenge.nullable()}),status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"owner.operations.get",family:"owner",method:"GET",path:"/owner/v1/operations/:id",summary:"Read one operation",auth:be,params:Ke,response:qs,status:200,errors:["setup_required","not_found"],launch:"on"}])});var Fs=j(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.PUBLIC_OPERATIONS=Me.CliFailureReport=Me.CLI_FAILURE_EVENT_MAX_BYTES=Me.CLI_FAILURE_PLATFORMS=Me.CLI_FAILURE_KINDS=Me.CLI_FAILURE_STEPS=Me.CLI_FAILURE_SURFACES=void 0;var W=Je(),TT=Un(),Ls=dr(),fo=ct(),Xn=W.z.record(W.z.string(),W.z.unknown()),Vs="RFC 6749 errors: { error, error_description }";Me.CLI_FAILURE_SURFACES=["cli","mcp"];Me.CLI_FAILURE_STEPS=["connect","connect_sign_in","connect_enroll","connect_mount","connect_skill","connect_hud","disconnect","update","statusline","keychain","enrollment_finisher","get_status","agent_enroll","discover","pay","history","purchase_create","purchase_retrieve","purchase_cancel","crash","other"];Me.CLI_FAILURE_KINDS=["caller","platform","unknown"];Me.CLI_FAILURE_PLATFORMS=["darwin","linux","win32","other"];Me.CLI_FAILURE_EVENT_MAX_BYTES=2048;Me.CliFailureReport=W.z.strictObject({reference:W.z.string().regex(/^[0-9a-f]{8}$/),failedRequestId:W.z.uuid().optional(),surface:W.z.enum(Me.CLI_FAILURE_SURFACES),step:W.z.enum(Me.CLI_FAILURE_STEPS),code:W.z.string().regex(/^[a-z][a-z0-9_]{1,63}$/),kind:W.z.enum(Me.CLI_FAILURE_KINDS),httpStatus:W.z.number().int().min(100).max(599).optional(),cliVersion:W.z.string().max(40),platform:W.z.enum(Me.CLI_FAILURE_PLATFORMS),harness:W.z.string().regex(/^[a-z0-9_-]{1,32}$/).optional()});Me.PUBLIC_OPERATIONS=(0,TT.defineOperations)([{id:"mcp.endpoint",backedBy:"edge",family:"mcp",method:"ALL",path:"/mcp",summary:"The MCP server (streamable HTTP)",description:"JSON-RPC over POST; GET opens the event stream and DELETE ends a session. Serves the 7-tool catalogue in mcp.ts, each tool an adapter over an /agent/v1 operation.",auth:["oauth_token","agent_token","app_token"],body:Xn,response:Xn,status:200,errors:["setup_required","update_required"],launch:"on",externalSpec:"Model Context Protocol, streamable HTTP transport"},{id:"oauth.authorize",backedBy:"edge",family:"oauth",method:"GET",path:"/oauth/authorize",summary:"Authorization request (PKCE)",description:"Redirects (302) to the Console consent page (/agent/enroll/connector) with `request_id` in the query string; the Console signs the owner in if needed (the browser holds no Auth session). The request_id identifies one decision and expires after 10 minutes; the page posts it to oauth.decision, and the first owner who decides it binds it (an owner session present at authorize binds it at once). Re-requesting the same parameters issues a fresh request_id.",auth:["none","owner_session"],query:W.z.object({response_type:W.z.literal("code"),client_id:W.z.string(),redirect_uri:W.z.url(),code_challenge:W.z.string(),code_challenge_method:W.z.literal("S256"),scope:W.z.string().optional(),state:W.z.string().optional(),resource:W.z.url().optional()}),response:null,status:302,errors:[],launch:"on",externalSpec:`RFC 6749, RFC 7636. ${Vs}; until the client and redirect_uri are verified the error is answered directly, after that it is redirected to the client's callback. \`resource\` is accepted and not used: the token is bound to one agent.`},{id:"oauth.decision",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/authorize/decision",summary:"The owner\u2019s consent decision; creates the hosted agent and its setup",description:"request_id is the one the consent page received in the query string of the oauth.authorize redirect. deny: 200 with the redirect carrying access_denied. allow carries the original visible ask_each_time Tempo grant; an identical retry retains the same setup and approval. allow: 202 with the hosted setup and its setup_approval challenge; the Console signs it silently with the owner\u2019s browser key (no extra step) through owner.signatures.submit, whose continuation.url is the redirect carrying the code. No code is issued before the owner\u2019s signature over the setup statement is verified (contract proposal 7, decided 8 Oct).",auth:["owner_session"],body:W.z.discriminatedUnion("decision",[W.z.object({request_id:fo.Id,decision:W.z.literal("allow"),agent_id:fo.Id.optional(),grant:Ls.GrantRequest.extend({rail:W.z.literal("tempo"),mode:W.z.literal("ask_each_time")})}),W.z.object({request_id:fo.Id,decision:W.z.literal("deny"),agent_id:fo.Id.optional()})]),response:W.z.object({redirect_to:W.z.url()}),status:200,variants:[{status:202,description:"allow: the owner signs the setup statement; the code follows the signature.",response:W.z.object({setup:Ls.Setup,challenge:Ls.Challenge})}],errors:["setup_required","expired","blocked","invalid_request","conflict"],launch:"on",externalSpec:"RFC 6749 (the consent step). The Console calls it; refusals are the Problem."},{id:"oauth.token",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/token",summary:"Token endpoint (authorization_code, refresh_token)",description:"A refresh keeps the same hosted agent identity.",auth:["none"],bodyType:"application/x-www-form-urlencoded",body:W.z.object({grant_type:W.z.enum(["authorization_code","refresh_token"]),code:W.z.string().optional(),code_verifier:W.z.string().optional(),refresh_token:W.z.string().optional(),client_id:W.z.string(),redirect_uri:W.z.url().optional()}),response:W.z.object({access_token:W.z.string(),token_type:W.z.literal("Bearer"),expires_in:W.z.number().int(),refresh_token:W.z.string().optional(),scope:W.z.string().optional()}),status:200,errors:[],launch:"on",externalSpec:`RFC 6749. ${Vs}`},{id:"oauth.register",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/register",summary:"Dynamic client registration",auth:["none"],body:Xn,response:Xn,status:201,errors:[],launch:"on",externalSpec:`RFC 7591; client ID metadata documents. ${Vs}`},{id:"oauth.revoke",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/revoke",summary:"Token revocation",auth:["none"],bodyType:"application/x-www-form-urlencoded",body:W.z.object({token:W.z.string(),token_type_hint:W.z.string().optional()}),response:null,status:200,errors:[],launch:"on",externalSpec:"RFC 7009"},{id:"oauth.connect",backedBy:"edge",family:"oauth",method:"GET",path:"/oauth/connect/:ticket",summary:"Redeem a one-time connect ticket",description:"The one ticket-redemption door: a connector app link or the Console handoff.",auth:["none","owner_session"],params:W.z.object({ticket:W.z.string()}),response:null,status:302,errors:["expired","not_found"],launch:"future"},...[["oauthAuthorizationServer","oauth-authorization-server","OAuth server metadata","RFC 8414"],["oauthProtectedResource","oauth-protected-resource","Protected resource metadata","RFC 9728"],["mcp","mcp.json","MCP server discovery","MCP discovery"],["agentJwks","agent-jwks.json","Agent public keys (JWKS)","RFC 7517"],["httpMessageSignaturesDirectory","http-message-signatures-directory","Web Bot Auth key directory","Web Bot Auth (HTTP message signatures directory)"]].map(([e,t,r,i])=>({id:`wellKnown.${e}`,backedBy:"edge",family:"well-known",method:"GET",path:`/.well-known/${t}`,summary:r,auth:["none"],response:Xn,status:200,errors:[],launch:"on",externalSpec:i})),{id:"public.tapRegistry.agent",backedBy:"authority",family:"public",method:"GET",path:"/v1/tap/registry/agents/:tapAgentId",summary:"Resolve a Trusted Agent Protocol agent",description:"A merchant contract; the path is kept.",auth:["none"],params:W.z.object({tapAgentId:W.z.string()}),response:Xn,status:200,errors:["not_found"],launch:"on",externalSpec:"Visa Trusted Agent Protocol registry"},{id:"public.tapRegistry.key",backedBy:"authority",family:"public",method:"GET",path:"/v1/tap/registry/keys/:jkt",summary:"Resolve a TAP signing key by thumbprint",auth:["none"],params:W.z.object({jkt:W.z.string()}),response:Xn,status:200,errors:["not_found"],launch:"on",externalSpec:"Visa Trusted Agent Protocol registry"},{id:"public.cliFailure.report",backedBy:"edge",family:"public",method:"POST",path:"/v1/cli/failure-event",summary:"Report a CLI or MCP step that failed on the person\u2019s machine",description:"Fire-and-forget, so a failure that never reached Visa (an unreadable keychain, a crash) can be found by its reference. Unauthenticated on purpose: a CLI whose keychain cannot be read must still report it; an agent token, if sent and current, adds the owner. A closed shape of bounded codes (no prompt, argument, path, email or free text); at most 2048 bytes; rate limited per client address (30 a minute) in its own bucket. 204 on success; an invalid report is invalid_request naming the first offending field (`cli_failure_event_<field>`).",auth:["none","agent_token"],body:Me.CliFailureReport,response:null,status:204,errors:["invalid_request","rate_limited"],launch:"on"},{id:"public.openapi",backedBy:"edge",family:"public",method:"GET",path:"/openapi.json",summary:"This contract as OpenAPI 3.1",auth:["none"],response:Xn,status:200,errors:[],launch:"on"},{id:"public.health",backedBy:"edge",family:"public",method:"GET",path:"/health",summary:"Readiness of the public API (its own stores) and its build",description:"Returns 200 when this service can reach its own Redis and Postgres, or 503 with the same health shape when it cannot. It never reflects Authority or any other service, so no service waits on another to start. `commit` names the deployed build (null when unknown).",auth:["none"],response:W.z.object({status:W.z.enum(["ok","degraded"]),cutover:W.z.literal("B"),commit:W.z.string().regex(/^[0-9a-f]{7,40}$/).nullable(),checks:W.z.object({redis:W.z.enum(["ok","unavailable"]),postgres:W.z.enum(["ok","unavailable"])})}),status:200,errors:[],launch:"on"}])});var Bs=j(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.MCP_DESCRIPTION_BUDGET=Qn.MCP_TOOLS=void 0;Qn.mcpToolDescriptors=ET;var te=Je(),wt=it(),ei=ct(),AT=dr(),df=["agent_signature"],pf=["oauth_token","app_token"],Qr=e=>({laptop:{available:!0,auth:df,identityCustody:"device",moneyCustody:"none",approval:"none",note:e},hosted:{available:!0,auth:pf,identityCustody:"turnkey",moneyCustody:"none",approval:"none",note:e}}),Fn={agent:te.z.string().min(1).max(128).optional().clone().register(wt.apiMetadata,{description:"The agent\u2019s name or id, needed only when this computer or credential holds more than one; never guessed."})},lf=te.z.object({target:te.z.string().clone().register(wt.apiMetadata,{description:"An http(s) URL that answers 402 with a Tempo charge."}),max:te.z.string().clone().register(wt.apiMetadata,{description:"Hard ceiling as a decimal string in the charge asset."}),description:te.z.string().optional().clone().register(wt.apiMetadata,{description:"What it is for, shown to the owner at approval and kept with the payment as its context."}),original:AT.OriginalHostedPurchaseContext.optional(),request_id:ei.Id,method:te.z.enum(["GET","POST"]).optional(),body:te.z.string().optional(),...Fn}),xT=te.z.object({request_id:ei.Id.clone().register(wt.apiMetadata,{description:"New UUID per purchase. Send the same request_id and arguments again to continue it (after the owner approves, or an unknown outcome): it is never paid twice."}),tempoChallenge:te.z.string().min(1).max(8192).clone().register(wt.apiMetadata,{description:'REQUIRED to pay. The merchant 402 `WWW-Authenticate: Payment` header value offering a Tempo charge (method="tempo"), verbatim. Visa pays a fresh charge for no more than this amount, to this payee only.'}),resource:te.z.string().min(1).max(2048).clone().register(wt.apiMetadata,{description:"The https URL that answered the 402; shown to the owner."}),request:te.z.object({method:te.z.string().nullable().optional(),headers:te.z.array(te.z.tuple([te.z.string(),te.z.string().max(1024)])).max(32).nullable().optional(),bodyBase64:te.z.string().nullable().optional()}).optional().clone().register(wt.apiMetadata,{description:"The request Visa replays after approval. Omit for a plain GET; otherwise send the original method (GET, HEAD, POST, PUT, PATCH or DELETE) and bodyBase64. Headers are public [name, value] pairs; credentials are never replayed."}),narrative:te.z.object({userRequest:te.z.string().min(1).max(2e3),product:te.z.string().min(1).max(512),category:te.z.string(),purpose:te.z.string().min(1).max(512).optional(),quantity:te.z.number().int().min(1).max(1e6).optional(),expectedResult:te.z.string().min(1).max(512).optional(),recurring:te.z.boolean().optional(),initiator:te.z.string().optional(),discoveredVia:te.z.string().optional(),alternativesConsidered:te.z.number().int().min(0).max(1e3).optional()}).strict().clone().register(wt.apiMetadata,{description:"REQUIRED. What the user asked for and what this buys, as the owner reads it on the approval card. userRequest, product and category are required; category is one of api_inference, api_data, compute_storage, media_content, software_subscription, digital_goods, physical_goods, service_booking, donation_tip, other. Keep personal details out of product, purpose and expectedResult."}),...Fn}).strict();Qn.MCP_TOOLS=[{name:"status",operations:["agent.status.get"],description:"Who this agent is, each capability\u2019s readiness (supported \u2192 configured \u2192 authorized \u2192 funded \u2192 ready) and the next step with who must take it. Call first. READ-ONLY.",input:te.z.object(Fn),annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1},surfaces:Qr()},{name:"connect",operations:["agent.setups.start","agent.setups.get","agent.setups.claim"],description:"Connect this computer as an agent, add another agent (another: true), or replace one agent\u2019s key (mode: replace, with agent when this computer holds several). Returns one owner link and short code; this computer picks up approval automatically. Call status for progress. Never use it to repair an existing agent.",input:te.z.object({mode:te.z.enum(["new","replace"]).optional(),setup:te.z.string().optional().clone().register(wt.apiMetadata,{description:"A setup key the owner started in the Console."}),another:te.z.boolean().optional().clone().register(wt.apiMetadata,{description:"Set up one more agent on this computer, with its own key and limits. Without it, connect resumes or answers the agent already here."}),...Fn}),annotations:{idempotentHint:!0},surfaces:{laptop:{available:!0,auth:["setup_secret","agent_signature"],identityCustody:"device",moneyCustody:"none",approval:"none",note:"Creates the installation key in the OS key store; the owner approves in their browser."},hosted:{available:!1,auth:[],identityCustody:"none",moneyCustody:"none",approval:"none",note:"A hosted agent is set up by OAuth consent (oauth.authorize), not by a tool."}}},{name:"discover",operations:["agent.merchants.search"],description:"Search paid services with `query` (Mercator: each result\u2019s url, method and input schema), or price one URL\u2019s live charge with `target` (and its `method`/`body`). READ-ONLY: signs and spends nothing; listed prices are advisory. Paying always needs an explicit max.",input:te.z.object({query:te.z.string().optional(),target:te.z.url().optional(),method:te.z.enum(["GET","POST"]).optional(),body:te.z.string().optional(),limit:te.z.number().int().min(1).max(50).optional(),...Fn}),annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!0},surfaces:Qr()},{name:"pay",operations:["agent.payments.create","agent.payments.credential"],description:"Pay a merchant from the owner\u2019s wallet (MPP on Tempo), through the owner. Send `tempoChallenge`, the merchant 402 `WWW-Authenticate: Payment` header value offering a Tempo charge, exactly as you received it, with `resource` (the https URL that answered 402), `request` for anything but a plain GET, a `narrative`, and a new `request_id`. This returns an owner-approval link: nothing is spent until the owner approves. Then call `payment_status` with `wait: 240` straight away, and when it reports the approval, call pay again with the same arguments: that call pays once and returns the merchant\u2019s answer. Never poll in a loop, never ask the owner whether they approved, never invent missing fields. MOVES REAL MONEY. Reply in a line or two.",input:xT,laptopInput:lf.extend({max:lf.shape.max.optional()}),laptopDescription:"Pay a supported URL with an explicit max and a new request_id per purchase; reuse the same request_id and arguments to recover it, never pay it twice. Omit max for a read-only price preview: nothing is signed, funded or paid. A phrase as target searches services instead and pays nothing. Native paying remains gated. Reply in a line or two.",annotations:{destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},surfaces:{laptop:{available:!0,auth:df,identityCustody:"device",moneyCustody:"owner_wallet_via_slipgate",approval:"grant_mode",note:"Co-signs two of two: the CLI admits its own prepared charge, verifies and votes on the provider activity, then resumes. Tempo only at launch: card paying is cut from the launch build (A1)."},hosted:{available:!0,auth:pf,identityCustody:"turnkey",moneyCustody:"owner_wallet_via_slipgate",approval:"every_payment",note:"Every hosted payment needs the owner\u2019s fresh web approval at launch, whatever the grant mode or controls (A2); hosted autonomy waits for a connector-side signing key. Replay body and headers are forwarded in memory and never stored. Supported original signing context follows the private approval-review data policy. Tempo only (A1)."}}},{name:"payment_status",operations:["agent.payments.get"],description:'Read one purchase by id. With `wait` (up to 240 s) this call blocks until the purchase changes, for example the owner approving or declining, and then answers: one call, no polling loop. An unknown outcome is never "nothing was paid". READ-ONLY.',input:te.z.object({id:ei.Id,wait:te.z.number().int().min(0).max(240).optional(),...Fn}),laptopInput:te.z.object({id:ei.Id,wait:te.z.number().int().min(0).max(30).optional(),...Fn}),laptopDescription:'Read one purchase by id, optionally waiting up to 30 s for it to change. An unknown outcome is never "nothing was paid". READ-ONLY.',annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1},surfaces:Qr()},{name:"payment_cancel",operations:["agent.payments.cancel"],description:"Cancel a purchase that has not executed. A purchase already submitted settles or reconciles instead.",input:te.z.object({id:ei.Id,...Fn}),annotations:{destructiveHint:!0,idempotentHint:!0},surfaces:Qr()},{name:"history",operations:["agent.payments.list"],description:"This agent\u2019s purchases on every rail, newest first. READ-ONLY.",input:te.z.object({limit:te.z.number().int().min(1).max(100).optional(),...Fn}),annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1},surfaces:Qr()}];Qn.MCP_DESCRIPTION_BUDGET=3e3;function ET(e){return Qn.MCP_TOOLS.filter(t=>t.surfaces[e].available).map(t=>{let{$schema:r,...i}=te.z.toJSONSchema(e==="laptop"?t.laptopInput??t.input:t.input,{target:"draft-2020-12",unrepresentable:"any"});return{name:t.name,description:e==="laptop"?t.laptopDescription??t.description:t.description,input_schema:i,annotations:t.annotations}})}});var yf=j(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.jsonSchema=Bn;ni.successOutcomes=vf;ni.buildOpenApi=qT;var Gs=Je(),go=it(),er=no(),ff=Bs(),mo=Un(),ti="#/components/schemas/",DT=["get","put","post","patch","delete"],NT={owner_session:{type:"apiKey",in:"cookie",name:"visa_owner_session",description:"Owner Console session cookie. Every write also sends X-CSRF-Token with the csrf_token from owner.session.verify or owner.session.get."},owner_exit_session:{type:"apiKey",in:"cookie",name:"visa_owner_session",description:"The same owner cookie in its reduced exit scope (stop spending, withdraw, export, close). Writes send X-CSRF-Token as for owner_session."},agent_signature:{type:"http",scheme:"signature",description:"HTTP message signature (RFC 9421) by the agent installation key, plus the CLI version header."},agent_token:{type:"http",scheme:"bearer",description:"Short-lived agent access token from POST /agent/v1/token."},oauth_token:{type:"oauth2",flows:{authorizationCode:{authorizationUrl:"/oauth/authorize",tokenUrl:"/oauth/token",refreshUrl:"/oauth/token",scopes:{}}}},app_token:{type:"http",scheme:"bearer",description:"Owner-minted app token for one agent (REST apps)."},setup_secret:{type:"http",scheme:"Setup",description:"One-time setup secret returned by POST /agent/v1/setups, sent as Authorization: Setup <secret> (never in the URL)."},operator_session:{type:"apiKey",in:"cookie",name:"visa_operator_session",description:"Operator session from admin.session.start (current valid product owner session, owner CSRF and live operator membership). Cookie only (HttpOnly, Secure, SameSite=Strict, Path=/admin/v1); writes send X-CSRF-Token with the csrf_token from admin.session.start; operator membership is re-checked on every request."}};function CT(e){return(0,go.apiMetadataOf)(e)?.id}function Bn(e){let t=CT(e);if(t)return{$ref:`${ti}${t}`};let r=Gs.z.toJSONSchema(e,{metadata:go.apiMetadata,target:"draft-2020-12",unrepresentable:"any"}),i=r.$defs??{};for(let n of Object.keys(i))if(!MT().has(n))throw new Error(`unregistered shared schema ${n}`);return delete r.$defs,delete r.$schema,JSON.parse(JSON.stringify(r).replaceAll('"#/$defs/',`"${ti}`))}var mf=null;function MT(){return mf??=new Set(Object.keys(_f())),mf}function _f(){let e=Gs.z.toJSONSchema(go.apiMetadata,{metadata:go.apiMetadata,target:"draft-2020-12",unrepresentable:"any",uri:r=>`${ti}${r}`}).schemas,t={};for(let r of Object.keys(e).sort()){let{$schema:i,$id:n,...a}=e[r];t[r]=a}return t}function RT(e){let t=[],r=e.params?.shape??{};for(let i of(0,mo.pathParams)(e.path)){let n=r[i]??Gs.z.string();t.push({name:i,in:"path",required:!0,schema:Bn(n)})}for(let[i,n]of Object.entries(e.query?.shape??{})){let a=n;t.push({name:i,in:"query",required:!a.safeParse(void 0).success,schema:Bn(a)})}return t}function vf(e){let t=[],r=e.response&&e.status!==204&&e.status!==302;t.push({status:e.status,description:e.summary,schema:r?Bn(e.response):null});for(let i of e.variants??[])t.push({status:i.status,description:i.description,schema:Bn(i.response)});for(let i of e.errors){let n=er.ERROR_FAMILIES[i].status;n>=200&&n<300&&t.push({status:n,description:`${i}: ${er.ERROR_FAMILIES[i].message} The body is ${e.errorResponse?"the declared refusal":"a Problem"}; never read it as a failure.`,schema:e.errorResponse?Bn(e.errorResponse):{$ref:`${ti}Problem`}})}return t}function UT(e){let t=new Map;for(let i of vf(e)){let n=t.get(i.status)??[];n.push(i),t.set(i.status,n)}let r={};for(let i of[...t.keys()].sort((n,a)=>n-a)){let n=t.get(i),a=n.flatMap(s=>s.schema?[s.schema]:[]),o={description:n.map(s=>s.description).join(" Or: ")};if(a.length>0){let s=e.id==="owner.activity.export";o.content={[s?"text/csv":"application/json"]:{schema:a.length===1?a[0]:{oneOf:a}}}}r[String(i)]=o}if(e.errorResponse){let i=Bn(e.errorResponse);for(let n of e.errors){let a=er.ERROR_FAMILIES[n].status;a<400||(r[String(a)]={description:"Declared native transport refusal. Branch on code; preserve the original request.",content:{"application/json":{schema:i}}})}for(let n of["4XX","5XX"])r[n]={description:"Declared native transport refusal.",content:{"application/json":{schema:i}}}}else(!e.externalSpec||e.family==="mcp")&&(r["4XX"]={$ref:"#/components/responses/Refused"},r["5XX"]={$ref:"#/components/responses/Unavailable"});return r}function gf(e){return{description:e,headers:{"Retry-After":{description:"Seconds to wait, sent with rate_limited.",schema:{type:"integer",minimum:0}}},content:{"application/json":{schema:{$ref:`${ti}Problem`}}}}}function ZT(e){let t=Bn(e),r=t.oneOf??t.anyOf;if(!r)return t;let i=r[0]?.properties,n=Object.fromEntries(Object.entries(i??{}).filter(([a,o])=>r.every(s=>JSON.stringify(s.properties?.[a])===JSON.stringify(o))));return Object.keys(n).length>0&&(t.properties=n),t}function hf(e){let t={operationId:e.id,tags:[e.family],summary:e.summary};e.description&&(t.description=e.description);let r=RT(e);r.length>0&&(t.parameters=r),e.body&&(t.requestBody={required:!e.body.isOptional(),content:{[e.bodyType??"application/json"]:{schema:ZT(e.body)}}}),t.responses=UT(e);let i=e.auth.filter(n=>n!=="none");return t.security=[...i.map(n=>({[n]:[]})),...e.auth.includes("none")?[{}]:[]],t["x-launch"]=e.launch,e.errors.length>0&&(t["x-error-families"]=[...e.errors]),e.signed&&(t["x-owner-signature"]=!0),e.idempotency&&(t["x-idempotency"]=e.idempotency),e.controls&&(t["x-controls"]=[...e.controls]),t["x-backed-by"]=e.backedBy??"authority",e.externalSpec&&(t["x-external-spec"]=e.externalSpec),t}function qT(e){er.Problem;let t={};for(let i of e){if(!(0,mo.operationPathMatchesFamily)(i))throw new Error(`${i.id}: ${i.path} is outside ${mo.FAMILY_PREFIX[i.family]}`);let n=(0,mo.openApiPath)(i.path),a=t[n]??={},o=(s,c)=>{if(a[s])throw new Error(`duplicate ${s.toUpperCase()} ${i.path}`);a[s]=c};if(i.method==="ALL"){let s=hf(i);o("post",s),o("get",{...s,operationId:`${i.id}.stream`,summary:"Open the server event stream",requestBody:void 0,responses:{200:{description:"Server-sent events.",content:{"text/event-stream":{schema:{type:"string"}}}},"4XX":{$ref:"#/components/responses/Refused"},"5XX":{$ref:"#/components/responses/Unavailable"}}}),o("delete",{...s,operationId:`${i.id}.end`,summary:"End the MCP session",requestBody:void 0,responses:{204:{description:"Session ended."},"4XX":{$ref:"#/components/responses/Refused"},"5XX":{$ref:"#/components/responses/Unavailable"}}})}else o(i.method.toLowerCase(),hf(i))}let r={};for(let i of Object.keys(t).sort()){let n={};for(let a of DT)t[i][a]&&(n[a]=t[i][a]);r[i]=n}return{openapi:"3.1.0",info:{title:"Visa CLI target API",version:"1.0.0-draft",description:"The target contract from the clean-slate plan v4. Not served yet. Families: /owner/v1, /agent/v1, /admin/v1, /mcp, /oauth, /.well-known and the public registry."},servers:[{url:"/",description:"The Auth edge of each environment (the only public API host)."}],paths:r,components:{schemas:_f(),responses:{Refused:gf("Refused. Branch on `code` (an error family)."),Unavailable:gf("Unavailable or internal error.")},securitySchemes:NT},"x-error-families":Object.fromEntries(er.WIRE_ERROR_FAMILIES.map(i=>[i,{status:er.ERROR_FAMILIES[i].status,retryable:er.ERROR_FAMILIES[i].retryable,kind:er.ERROR_FAMILIES[i].kind}])),"x-mcp":{descriptionBudget:ff.MCP_DESCRIPTION_BUDGET,tools:ff.MCP_TOOLS.map(i=>({name:i.name,operations:[...i.operations],description:i.description,annotations:i.annotations,inputSchema:Bn(i.input),surfaces:i.surfaces}))}}}});var bf=j(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.RECOVERY_RESPONSIBILITIES=void 0;Gn.executionDecision=LT;Gn.replacementAllowed=VT;Gn.dispatchRecovery=FT;Gn.hostedResumeDecision=BT;Gn.ownerApprovalRequired=GT;function LT(e){return e.chain==="landed"?{action:"settle"}:e.signature==="never_created"?e.provider_void?{action:"close",evidence:"provider_void"}:e.past_valid_before?{action:"close",evidence:"expired_unsigned"}:{action:"keep_open"}:e.signature==="pending_at_provider"&&e.provider_void?{action:"close",evidence:"provider_void"}:e.past_valid_before&&e.chain==="not_landed_final"?{action:"close",evidence:"expired_on_chain"}:e.past_valid_before?{action:"fence"}:{action:"keep_open"}}function VT(e){return e.action==="close"}function FT(e){return e.locator_recorded?"read_recorded_activity":e.readback==="found"?"bind_found_activity":"fenced_unknown"}function BT(e){return e.credential_released?e.supplied==="request"?"refuse_credential_released":e.supplied==="receipt"&&e.merchant_verified_receipt===!0?"retrieve_from_merchant":"paid_result_unavailable":e.supplied==="request"?"requote_must_match_retained_facts":"still_waiting"}Gn.RECOVERY_RESPONSIBILITIES={visa:"Keeps only RETAINED_PAYMENT_FACTS; never re-sends a released credential; fails closed.",caller:"Keeps its own request and the merchant receipt or job reference if it wants its result back.",merchant:"Answers a receipt or job-reference lookup for a paid request and treats a repeated paid request idempotently."};function GT(e){return e.surface==="hosted"?!0:!(e.mode==="within_limit"&&e.within_limit_control_enabled&&e.within_limits)}});var zf=j(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.SETUP_AUTH_SCHEME=Se.AGENT_SIGNATURE_MAX_AGE_SECONDS=Se.AGENT_SIGNATURE_ALG=Se.CLI_VERSION_HEADER=Se.AGENT_SIGNATURE_LABEL=void 0;Se.agentSignatureParams=Js;Se.agentSignatureBase=KT;Se.agentSignatureHeaders=HT;Se.parseAgentSignature=YT;Se.setupClaimMessage=XT;Se.setupResumeMessage=QT;Se.AGENT_SIGNATURE_LABEL="visa";Se.CLI_VERSION_HEADER="x-visa-cli-version";Se.AGENT_SIGNATURE_ALG="ed25519";Se.AGENT_SIGNATURE_MAX_AGE_SECONDS=120;Se.SETUP_AUTH_SCHEME="Setup";var wf=["@method","@target-uri","content-digest",Se.CLI_VERSION_HEADER],$f=["@method","@target-uri",Se.CLI_VERSION_HEADER],JT=/^[A-Za-z0-9_-]{16,64}$/,WT=/^[A-Za-z0-9_-]{43}$/;function Js(e,t){if(!Number.isSafeInteger(t.created)||t.created<0)throw new Error("agent_signature_created_invalid");if(!JT.test(t.nonce))throw new Error("agent_signature_nonce_invalid");if(!WT.test(t.keyid))throw new Error("agent_signature_keyid_invalid");return`(${(e?wf:$f).map(i=>`"${i}"`).join(" ")});created=${t.created};nonce="${t.nonce}";keyid="${t.keyid}";alg="${Se.AGENT_SIGNATURE_ALG}"`}function KT(e,t){if(/[\r\n]/.test(e.cliVersion)||/[\r\n]/.test(e.targetUri))throw new Error("agent_signature_component_invalid");let r=[`"@method": ${e.method.toUpperCase()}`,`"@target-uri": ${e.targetUri}`];if(e.contentDigest!==void 0){if(!/^sha-256=:[A-Za-z0-9+/]{43}=:$/.test(e.contentDigest))throw new Error("agent_signature_digest_invalid");r.push(`"content-digest": ${e.contentDigest}`)}return r.push(`"${Se.CLI_VERSION_HEADER}": ${e.cliVersion}`),r.push(`"@signature-params": ${Js(e.contentDigest!==void 0,t)}`),r.join(`
58
- `)}function HT(e,t,r){return{"signature-input":`${Se.AGENT_SIGNATURE_LABEL}=${Js(e,t)}`,signature:`${Se.AGENT_SIGNATURE_LABEL}=:${r}:`}}function YT(e){let t=e.signatureInput?.trim()??"",r=e.signature?.trim()??"",i=`${Se.AGENT_SIGNATURE_LABEL}=`;if(!t.startsWith(i)||!r.startsWith(i))return null;let n=/^\(([^)]*)\);created=(\d{1,12});nonce="([A-Za-z0-9_-]{16,64})";keyid="([A-Za-z0-9_-]{43})";alg="ed25519"$/.exec(t.slice(i.length)),a=/^:([A-Za-z0-9+/]{86}==):$/.exec(r.slice(i.length));if(!n||!a)return null;let o=n[1],s=o===wf.map(c=>`"${c}"`).join(" ");return!s&&o!==$f.map(c=>`"${c}"`).join(" ")?null:{hasBody:s,created:Number(n[2]),nonce:n[3],keyid:n[4],signature:a[1]}}function XT(e){return`visa-setup-claim:${e}`}function QT(e){return`visa-setup-resume:v1:${e.jkt}:${e.setupId??"-"}:${e.nonce}:${e.issuedAt}`}});var Of=j(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.DeviceApproverPhaseStatement=fr.DeviceApproverRoster=void 0;var H=Je(),If=ct(),Ie=H.z.string().min(1),Ks=H.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),Sf=H.z.strictObject({kty:H.z.literal("OKP"),crv:H.z.literal("Ed25519"),x:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/)}),ho=H.z.strictObject({policyName:Ie,effect:H.z.enum(["EFFECT_ALLOW","EFFECT_DENY"]),consensus:Ie,condition:Ie,notes:H.z.string()});fr.DeviceApproverRoster=H.z.array(H.z.strictObject({approverId:Ie,installationId:Ie,identityKeyId:Ie,identityGeneration:Ks,identityJkt:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/),publicJwk:Sf,provider:H.z.literal("turnkey"),providerUserRef:H.z.string(),state:H.z.enum(["pending","active","removing"])})).max(8);var Ws=H.z.strictObject({userName:Ie,apiKeys:H.z.tuple([H.z.strictObject({apiKeyName:Ie,publicKey:Ie,curveType:H.z.enum(["API_KEY_CURVE_ED25519","API_KEY_CURVE_P256"])})]),authenticators:H.z.tuple([]),oauthProviders:H.z.tuple([]),userTags:H.z.tuple([])}),eA=H.z.discriminatedUnion("type",[H.z.strictObject({type:H.z.enum(["ACTIVITY_TYPE_CREATE_USERS_V3","ACTIVITY_TYPE_CREATE_USERS_V4"]),parameters:H.z.strictObject({users:H.z.union([H.z.tuple([Ws]),H.z.tuple([Ws,Ws])])})}),H.z.strictObject({type:H.z.literal("ACTIVITY_TYPE_CREATE_POLICIES"),parameters:H.z.strictObject({policies:H.z.union([H.z.tuple([ho]),H.z.tuple([ho,ho])])})}),H.z.strictObject({type:H.z.literal("ACTIVITY_TYPE_UPDATE_POLICY_V2"),parameters:H.z.strictObject({policyId:Ie,policyName:Ie,policyEffect:H.z.enum(["EFFECT_ALLOW","EFFECT_DENY"]),policyCondition:Ie,policyConsensus:Ie,policyNotes:H.z.string().optional()})})]);fr.DeviceApproverPhaseStatement=H.z.strictObject({kind:H.z.literal("device_approver"),operation_id:Ie,step_no:H.z.number().int().min(2).max(6),action:H.z.enum(If.DEVICE_APPROVER_ACTIONS),recorded_body_hash:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable(),recorded_activity_ref:Ie.nullable(),intent:H.z.strictObject({fence:H.z.strictObject({ownerId:Ie,ownerSecurityEpoch:H.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),agentId:Ie,setupId:Ie,operationId:Ie,installationId:Ie,walletKeyId:Ie,walletGeneration:Ks,identityKeyId:Ie,identityGeneration:Ks,identityJkt:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/),installationPublicJwk:Sf,organizationId:Ie,ownerUserId:Ie,rosterHash:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/)}),stepNo:H.z.union([H.z.literal(2),H.z.literal(3),H.z.literal(4),H.z.literal(5),H.z.literal(6)]),accessKeyId:Ie,accessKeyAddress:H.z.string().regex(/^0x[0-9a-fA-F]{40}$/),stampPublicKey:H.z.string().regex(/^0[23][0-9a-fA-F]{64}$/),roster:fr.DeviceApproverRoster,action:H.z.enum(If.DEVICE_APPROVER_ACTIONS),request:eA,previousPolicy:ho.nullable().optional(),previousPolicyHash:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/).optional(),targetPolicyRef:Ie.optional()})}).superRefine((e,t)=>{let r=e.intent,i={create_device_approver_guard:2,create_device_approver_user:3,create_tempo_signer_guard:4,create_tempo_signer_user:5,create_device_approver_policy:6,update_device_approver_policy:6},n=e.action.endsWith("_user")?"ACTIVITY_TYPE_CREATE_USERS_V3":e.action==="update_device_approver_policy"?"ACTIVITY_TYPE_UPDATE_POLICY_V2":"ACTIVITY_TYPE_CREATE_POLICIES";(e.operation_id!==r.fence.operationId||e.action!==r.action||e.step_no!==r.stepNo||e.step_no!==i[e.action]||r.request.type!==n&&!(n==="ACTIVITY_TYPE_CREATE_USERS_V3"&&r.request.type==="ACTIVITY_TYPE_CREATE_USERS_V4")||e.recorded_activity_ref!==null&&e.recorded_body_hash===null||(e.action==="update_device_approver_policy"?r.previousPolicy===void 0||!r.previousPolicyHash||!r.targetPolicyRef||r.request.type!=="ACTIVITY_TYPE_UPDATE_POLICY_V2"||r.request.parameters.policyId!==r.targetPolicyRef||r.previousPolicy===null&&!e.recorded_body_hash:r.previousPolicy!==void 0||r.previousPolicyHash!==void 0||r.targetPolicyRef!==void 0))&&t.addIssue({code:"custom",message:"The device approver phase is inconsistent."})})});var xf=j(K=>{"use strict";var tA=K&&K.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),$t=K&&K.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&tA(t,e,r)};Object.defineProperty(K,"__esModule",{value:!0});K.apiMetadataOf=K.successOutcomes=K.buildOpenApi=K.PUBLIC_OPERATIONS=K.OWNER_OPERATIONS=K.AGENT_OPERATIONS=K.ADMIN_OPERATIONS=K.mcpToolDescriptors=K.MCP_DESCRIPTION_BUDGET=K.MCP_TOOLS=K.CliFailureReport=K.CLI_FAILURE_SURFACES=K.CLI_FAILURE_STEPS=K.CLI_FAILURE_PLATFORMS=K.CLI_FAILURE_KINDS=K.CLI_FAILURE_EVENT_MAX_BYTES=K.MCP_TOOL_CEILING=K.PRODUCT_ROUTE_CEILING=K.OPERATIONS=void 0;K.operationById=rA;K.countByFamily=iA;K.productOperationCount=aA;var kf=nf();Object.defineProperty(K,"ADMIN_OPERATIONS",{enumerable:!0,get:function(){return kf.ADMIN_OPERATIONS}});var Pf=of();Object.defineProperty(K,"AGENT_OPERATIONS",{enumerable:!0,get:function(){return Pf.AGENT_OPERATIONS}});var jf=cf();Object.defineProperty(K,"OWNER_OPERATIONS",{enumerable:!0,get:function(){return jf.OWNER_OPERATIONS}});var Tf=Fs();Object.defineProperty(K,"PUBLIC_OPERATIONS",{enumerable:!0,get:function(){return Tf.PUBLIC_OPERATIONS}});var nA=Un();K.OPERATIONS=[...jf.OWNER_OPERATIONS,...Pf.AGENT_OPERATIONS,...kf.ADMIN_OPERATIONS,...Tf.PUBLIC_OPERATIONS];function rA(e){return K.OPERATIONS.find(t=>t.id===e)}function iA(){let e={owner:0,agent:0,admin:0,mcp:0,oauth:0,"well-known":0,public:0};for(let t of K.OPERATIONS)e[t.family]+=1;return e}function aA(){return K.OPERATIONS.filter(e=>nA.PRODUCT_FAMILIES.includes(e.family)).length}K.PRODUCT_ROUTE_CEILING=77;K.MCP_TOOL_CEILING=7;$t(no(),K);var Tr=Fs();Object.defineProperty(K,"CLI_FAILURE_EVENT_MAX_BYTES",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_EVENT_MAX_BYTES}});Object.defineProperty(K,"CLI_FAILURE_KINDS",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_KINDS}});Object.defineProperty(K,"CLI_FAILURE_PLATFORMS",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_PLATFORMS}});Object.defineProperty(K,"CLI_FAILURE_STEPS",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_STEPS}});Object.defineProperty(K,"CLI_FAILURE_SURFACES",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_SURFACES}});Object.defineProperty(K,"CliFailureReport",{enumerable:!0,get:function(){return Tr.CliFailureReport}});$t(Un(),K);$t(ct(),K);$t(dr(),K);$t(xs(),K);var Hs=Bs();Object.defineProperty(K,"MCP_TOOLS",{enumerable:!0,get:function(){return Hs.MCP_TOOLS}});Object.defineProperty(K,"MCP_DESCRIPTION_BUDGET",{enumerable:!0,get:function(){return Hs.MCP_DESCRIPTION_BUDGET}});Object.defineProperty(K,"mcpToolDescriptors",{enumerable:!0,get:function(){return Hs.mcpToolDescriptors}});var Af=yf();Object.defineProperty(K,"buildOpenApi",{enumerable:!0,get:function(){return Af.buildOpenApi}});Object.defineProperty(K,"successOutcomes",{enumerable:!0,get:function(){return Af.successOutcomes}});$t(bf(),K);$t(zf(),K);$t(Of(),K);$t(Es(),K);$t(Ns(),K);var oA=it();Object.defineProperty(K,"apiMetadataOf",{enumerable:!0,get:function(){return oA.apiMetadataOf}});$t(Kr(),K)});var Ef=j((Ax,sA)=>{sA.exports={name:"@visa/cli",version:"5.0.0-rc.413",description:"Visa CLI runtime for stable agent identity and separately authorized payment capabilities",bin:{"visa-cli":"./bin/visa-cli.js",visa:"./bin/visa-cli.js","visa-runtime-converge":"./dist/managed-runtime/resolve-and-update.mjs","visa-tool":"./bin/visa-tool.js"},scripts:{"sync:server-json":"node scripts/sync-server-json.mjs","check:server-json":"node scripts/sync-server-json.mjs --check",prebuild:"node scripts/sync-server-json.mjs",build:"pnpm test:types && node esbuild.config.js",prepack:"node scripts/sync-server-json.mjs --check",dev:"tsc --watch",pretest:"pnpm build",start:"node dist/mcp-server/index.js",test:"jest --config jest.config.js","test:types":"tsc -p tsconfig.test.json","pretest:unit":"pnpm test:types","test:unit":"jest --config jest.config.js","pretest:unit:watch":"pnpm test:types","test:unit:watch":"jest --config jest.config.js --watch","pretest:unit:coverage":"pnpm test:types","test:unit:coverage":"jest --config jest.config.js --coverage","test:smoke":"VISA_AUTH_URL=https://auth.visacli.sh jest --config jest.smoke.config.js","test:packed":"node scripts/packed-cli-smoke.mjs","test:e2e":"jest --config jest.e2e.config.js","test:all":"npm run test:unit && npm run test:e2e",prepublishOnly:"npm run build && npm test",lint:"eslint src/**/*.ts",format:'prettier --write "src/**/*.ts"',"format:check":'prettier --check "src/**/*.ts"'},keywords:["visa","checkout","mcp","ai-agent","payments","click-to-pay","usdc","stablecoin"],author:"Visa Crypto Labs",license:"SEE LICENSE IN LICENSE",dependencies:{"@modelcontextprotocol/server":"2.0.0",commander:"^12.1.0",punycode:"^2.3.1"},devDependencies:{"@types/express":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^22.20.5","@typescript-eslint/eslint-plugin":"^8.68.0","@typescript-eslint/parser":"^8.68.0","@visa/financial-core":"workspace:*","@visa/identity":"workspace:*","@visa/contracts":"workspace:*","@visa/observability":"workspace:*","@visa/shared":"workspace:*","@visa/wallet":"workspace:*",esbuild:"^0.28.1",eslint:"^10.0.2",express:"^4.21.0",jest:"^30.3.0",prettier:"^3.9.6","ts-jest":"^29.4.12",typescript:"^5.7.0",viem:"^2.56.0"},engines:{node:">=20.0.0"},mcpName:"io.github.visa-crypto-labs/visa-cli",files:["bin/visa-cli.js","bin/visa-tool.js","dist/","install.ps1","install.sh","server.json","README.md"]}});var Bf=j(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.AGENT_SKILL_VERSION=void 0;gr.agentSkill=SA;gr.AGENT_SKILL_VERSION=1;function SA({channel:e,headless:t}){let r=t?"VISA_RUNTIME_CUSTODY_PROFILE=headless ":"",i=[`If \`visa-tool\` is not found, this computer was rebuilt. Reinstall it: \`npm install -g @visa/cli@${e}\`. The agent and the owner's approval are kept on this computer, so do not set it up again unless \`status\` says so.`,...t?["Start every Visa command with `VISA_RUNTIME_CUSTODY_PROFILE=headless`: this computer has no keyring, so the agent's key is a private file."]:[],`Run \`${r}visa-tool --list\`. It gives the current rules and tools; follow them. Do not copy them into this file: they change with updates. If its \`skill_version\` is higher than ${gr.AGENT_SKILL_VERSION}, ask the owner for the new Visa skill from the Visa Console.`];return["---","name: visa","description: Pay for things through this computer's Visa agent, within the limits its owner approved. Use for Visa status, finding merchants, paying, and checking or cancelling a payment.","---","","# Visa","",`This computer is a Visa agent: its owner approved it in their browser and set its limits. Use it through the \`visa-tool\` command in the shell. This is version ${gr.AGENT_SKILL_VERSION} of this skill.`,"","## Every time, before using Visa","",...i.map((n,a)=>`${a+1}. ${n}`),"","## Calling a tool","",`\`${r}visa-tool <tool> '<json arguments>'\` prints the tool's answer as JSON, and exits 1 when the tool refused. Call \`status\` first.`,"","## When something is not finished","",`- \`status\` says the setup's pickup is interrupted (this computer was rebuilt while the owner was approving): run \`${r}visa connect --no-open --wait 0\`. It resumes the same setup.`,...e==="rc"?["- This is a release candidate: every tool but `status` and `connect` needs the access code. When a call asks for `VISA_RC_CODE`, ask the owner for the code and run that call once more with `VISA_RC_CODE=<code>` in front. This computer remembers it after that."]:[],"- A refusal: follow its `fix` and `nextAction`. For `update_required`, run `visa update`.","- Give the owner any approval link and code exactly as returned. Never open a link or approve anything yourself.",""].join(`
59
- `)}});var TA={};om(TA,{USAGE:()=>au,agentSkillFor:()=>Xf,callTool:()=>Hf,listTools:()=>Yf,main:()=>jA});module.exports=sm(TA);var Jf=require("child_process"),Wf=hr(require("path"));var du=require("node:async_hooks"),$o=require("node:crypto");var um=new du.AsyncLocalStorage,lu=null;function cm(){return(0,$o.randomBytes)(4).toString("hex")}function lm(e,t){return{reference:cm(),surface:e,step:t,reported:new Set}}function zo(){let e=um.getStore();return e||(lu??=lm("cli","other"),lu)}function pu(){return zo().reference}var _o=hr(xf()),Cx=Ef().version,Df={policy_screening_blocked:{message:"Payments to this recipient are blocked by payment screening.",fix:"Do not retry, switch agents or switch payment methods; tell the owner."},policy_screening_not_configured:{message:"Payment screening is not available, so wallet payments are refused.",fix:"Retrying will not help until Visa restores screening; tell the owner."},connection_changed_while_reporting:{message:"This agent changed while connect was reporting it (the owner may have removed it), so nothing was reported as connected.",fix:"Do not repeat this call. Check status: if the owner removed the agent, ask whether to connect a new one with visa connect."},withdrawal_screening_blocked:{message:"Withdrawals to this address are blocked by payment screening.",fix:"Choose another address; do not retry this one."}},vo=class extends Error{constructor(r,i,n,a,o=null,s=null){super(Df[i]?.message??_o.ERROR_FAMILIES[r]?.message??`Visa refused this request (${r}).`);this.code=r;this.detail=i;this.status=n;this.retryable=a;this.nextAction=o;this.retryAfterSeconds=s}code;detail;status;retryable;nextAction;retryAfterSeconds;name="AgentApiError";get fix(){return Df[this.detail]?.fix??_o.ERROR_FAMILIES[this.code]?.fix??null}};var Xs={x402_retired:{kind:"caller",fix:null,nextAction:"Read the saved outcome with history. Preserve unresolved evidence and do not pay the same purchase again."},update_required:{kind:"caller",fix:"npm install -g @visa/cli@rc",nextAction:"Upgrade Visa CLI to the minimum compatible version or newer, then retry the command."},session_required:{kind:"caller",fix:"agent_enroll",nextAction:"Run visa connect (shell) or call agent_enroll (MCP) and complete the browser sign-in. Both resume where they left off. Retry the original command after that."},identity_required:{kind:"caller",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Call agent_enroll or run visa connect, open the printed link, enter the code there, and have the owner approve this computer and its limits."},legacy_door_removed:{kind:"caller",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Call agent_enroll or run visa connect, open the printed link, and have the owner approve this computer and its limits; then pay with the pay tool. Do not retry the removed command. Nothing was signed, paired or paid."},agent_selection_required:{kind:"caller",fix:null,nextAction:"Retry the command with one exact agent id from the executable choices in the error."},invalid_argument:{kind:"caller",fix:null,nextAction:"Correct the invalid argument named in the error, then retry the command once. Do not escalate this as a platform incident."},rate_limited:{kind:"caller",fix:"sleep <retry-after-seconds>",nextAction:"Wait the number of seconds the error names (its Retry-After), then retry the same request once. Do not retry sooner or switch agents to get around the limit."},activity_entry_not_found:{kind:"caller",fix:"history",nextAction:"Call history for the same agent and find the entry by its exact id in that list, or read the visa://receipt/<id> resource."},wallet_network_mismatch:{kind:"caller",fix:"discover",nextAction:"Nothing was reserved, signed or paid. This merchant offers no OUSD payment on Tempo, which this wallet needs. Choose a merchant that accepts Tempo; do not retry the same request unchanged."},agent_operations_cli_upgrade_required:{kind:"caller",fix:null,nextAction:"Update Visa CLI to the version the error names or newer, restart the agent session, and retry once. The payment was not sent."},agent_operation_forbidden:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This owner, agent or payment method is not allowed to make this payment. Ask the owner to check the agent in the Visa Console; do not retry another way."},runtime_context_not_found:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa cannot find this agent's setup for this computer. Ask the owner to check or renew the agent in the Visa Console before retrying."},product_policy_not_active:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Resume the owner-approved setup for this agent; do not retry the payment unchanged."},runtime_spend_session_not_active:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Resume the owner-approved setup for this agent; do not retry the payment unchanged."},runtime_spend_attenuation_not_active:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's spending limits are not in place yet. Resume the owner-approved setup for this agent; do not retry the payment unchanged."},runtime_revoked:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's access on this computer was turned off. Do not reuse it; ask the owner to approve this computer again if access should continue.",remedy:{path:"/agent/enroll/agents",label:"Check the agent in the Console"}},certified_runtime_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This payment needs the owner's approval of this agent's wallet on this computer. Ask the owner to approve it, then retry once."},runtime_certificate_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The owner's approval of this agent's wallet on this computer is no longer valid. Ask the owner to renew it; do not retry unchanged."},runtime_delegation_missing:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Ask the owner to finish it before retrying.",remedy:{path:"/agent/enroll/agents",label:"Finish the agent's wallet setup"}},runtime_delegation_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The owner's approval for this agent's wallet has expired. Ask the owner to renew it before retrying.",remedy:{path:"/agent/enroll/agents",label:"Renew the agent's approval"}},runtime_authority_unavailable:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Visa could not check this agent's permissions. Tell the human, and do not retry or pay another way until Visa is working again."},universal_required_managed_only:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Ask the owner to finish wallet setup before retrying."},wallet_authority_cli_upgrade_required:{kind:"caller",fix:null,nextAction:"Upgrade the CLI to the minimum version named by the server, restart this agent session, and retry once. Nothing was signed or paid."},tap_signature_required:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Escalate to a human. This agent could not prove who it is to the merchant. Nothing was paid. Do not retry the request or the payment without that proof."},wallet_owner_approval_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. Show the owner details.approval.url as is; they approve before details.approval.expiresAt. Call pay again with the same target, max, body and economicIntentId every 15-30 s until it goes through. If the approval expires, stop."},wallet_owner_approval_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. The owner's approval for this payment expired before it went through. Stop: do not call pay again with this economicIntentId. Only if the owner still wants it, start a new payment with a new economicIntentId."},attestation_key_drift:{kind:"caller",fix:"visa connect",nextAction:"This computer's Visa sign-in no longer matches the account (a new machine, a wiped keychain or a restored backup). Set the agent up again with visa connect, then retry."},rc_access_required:{kind:"platform",escalation:"awaiting_human",fix:"export VISA_RC_CODE=<access code>",nextAction:"This preview build of Visa CLI needs an access code. Set VISA_RC_CODE, then retry. Ask your Visa contact for the code; do not guess it."},early_access_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Escalate to a human: an admin must enable this tool for the account. Do not retry until they confirm."},card_checkout_not_on_pay:{kind:"caller",fix:"purchase_create",nextAction:"Nothing was charged. This URL is an ordinary card checkout, which pay cannot do (pay spends from the agent's wallet). Use purchase_create, then purchase_retrieve. Do not retry this target on pay."},card_draw_not_live:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Escalate to a human now. Card payments are not available yet, and nothing on this computer can change that. Do not retry."},checkout_review_refused:{kind:"caller",fix:null,nextAction:"Nothing was charged. This checkout is not supported yet. Choose another checkout, or tell the human; do not retry unchanged."},checkout_action_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was charged and no payment credential was requested. Ask the human to complete the named verification step, then retry the review once."},checkout_mandate_blocked:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was charged. Ask the owner to approve a card allowance that covers this merchant, amount and currency, then start a new review. Do not raise limits yourself."},card_mandate_activation_uncertain:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was charged and no budget is usable: the card network did not confirm the owner's approval. Do not start another approval; ask the owner to check the budget in the Visa Console and approve a fresh one once this one ends."},ucp_platform_profile_unavailable:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Do not retry this checkout. Checkout with this merchant is not available right now; tell the human."},wallet_capability_unavailable:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Escalate to a human now. Wallet payments are not available in this version. Do not retry."},surface_disabled:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Escalate to a human now. Visa has this feature switched off right now, and nothing on this computer changes that. Do not retry."},wallet_grant_required:{kind:"platform",escalation:"awaiting_human",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"The owner has not approved this agent's wallet yet. Call agent_enroll, or ask the owner to run visa connect, and have them approve this computer and its limits; then retry.",remedy:{path:"/agent/enroll/agents",label:"Approve this agent in the Console"}},wallet_credential_required:{kind:"platform",escalation:"awaiting_human",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Call agent_enroll, or ask the owner to run visa connect for this agent, and have them approve this computer and its limits; then retry. Setting up the agent alone does not let it pay.",remedy:{path:"/agent/enroll/agents",label:"Approve this agent in the Console"}},grant_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was reserved, signed or charged. The owner's spending approval for this agent has expired. Ask the owner to renew it in the Visa Console (Limits), then retry the same payment once. Do not create a new agent.",remedy:{path:"/agent/enroll/limits",label:"Renew the agent's approval"}},managed_limits_owner_controlled:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. Only the owner sets this agent's limits. Read them with get_status, then ask the owner to change them in the Visa Console (Limits).",remedy:{path:"/agent/enroll/limits",label:"Change the agent's limits"}},agent_paused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Ask the owner to resume this exact agent in the Visa Console (Agents). Retry only after get_status reports it ready; do not create a replacement credential while the agent is paused.",remedy:{path:"/agent/enroll/agents",label:"Resume the agent in the Console"}},owner_declined:{kind:"caller",fix:null,nextAction:"The owner declined this payment; don't retry it. Nothing was charged. Tell the owner and move on; only if they ask for it again, start a new payment (a new economicIntentId or a new purchase), which asks them again."},setup_declined:{kind:"caller",fix:null,nextAction:"The owner declined this setup, so no agent was connected; don't retry it. Tell the owner, and only if they ask for it again start a new setup (agent_enroll with restart:true, or `visa connect --restart`), which asks them again."},owner_withdrawal_pending:{kind:"caller",fix:null,nextAction:"Nothing was signed or paid. The owner is withdrawing from this wallet and that transfer is still settling (at most about ten minutes). Retry the same payment in a minute; the budget is unchanged."},operator_daily_cap_reached:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The 24-hour spending limit is reached, so this attempt was not signed. Try the same purchase later, once older spending leaves the 24-hour window or the limit is raised. Do not loop, or switch agents or payment methods to get around it."},operator_daily_cap_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not read the 24-hour spending limit, so this attempt was not signed. Tell the human; retry the same purchase later, once the limit can be read. Do not switch agents or payment methods."},kill_switch_engaged:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa has paused these payments for now, or could not confirm they are open. Nothing was paid. Tell the owner and try the same purchase again later; do not loop, pay another way, or create a replacement."},agent_revoked:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The owner removed this agent. Do not retry or reuse it; ask the owner whether to set up a new agent.",remedy:{path:"/agent/enroll/agents",label:"Connect a new agent in the Console"}},device_key_replaced:{kind:"platform",escalation:"awaiting_human",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Nothing was paid. This agent now runs on another computer, which replaced this computer's keys. Do not retry here. To use this computer too, call agent_enroll (or ask the owner to run visa connect) and approve it as a new agent."},agent_stale:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not confirm this agent is still active. Ask the owner to check it in the Visa Console and approve it again before retrying.",remedy:{path:"/agent/enroll/agents",label:"Check the agent in the Console"}},agent_lifecycle_unknown:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Visa could not confirm this agent's status. Tell the human, and do not retry a payment until get_status reports the agent ready."},wallet_delivery_required:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This agent's wallet setup did not finish. Ask the owner to run visa connect again and re-approve this computer and its limits before paying. Do not create a wallet yourself.",remedy:{path:"/agent/enroll/agents",label:"Reconnect this agent in the Console"}},wallet_authority_revoked:{kind:"caller",fix:"get_status",nextAction:"This wallet can no longer make payments; it is kept so its balance and receipts can be read. Check it with get_status or history, and do not retry a payment until the owner approves a new wallet."},wallet_authority_replacement_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent was set up by an older Visa CLI. Update Visa CLI, then set the agent up again with visa connect."},wallet_policy_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed. Ask the owner to set per-payment and daily limits in the Visa Console (Limits), then retry once. Limits are checked before anything is signed.",remedy:{path:"/agent/enroll/limits",label:"Set spending caps in the Console"}},wallet_funding_required:{kind:"caller",fix:"get_status",nextAction:"Ask the owner to add OUSD on Tempo to their wallet before paying: the Visa Console shows the wallet's address and balance under Payments.",remedy:{path:"/agent/enroll/payments",label:"Add funds to the wallet"}},wallet_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Ask the owner to finish wallet setup in the Visa Console (their account has no wallet yet), then try again. Do not keep polling: this cannot finish until the wallet exists.",remedy:{path:"/agent/enroll/payments",label:"Finish wallet setup"}},checkout_agent_access_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Escalate to a human: agent checkout is not turned on for this account. Do not retry until they confirm it is."},unknown_tool:{kind:"caller",fix:null,nextAction:"Call tools/list and use one of the tools it lists. The tool you asked for does not exist."},handoff_not_found:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"That setup code was not found or was mistyped. Ask the human for a new setup code from the Visa Console; do not retry this one."},handoff_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"That setup code expired. Ask the human to create a new setup code in the Visa Console."},handoff_already_redeemed:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"That setup code was already used. Ask the human to create a new setup code in the Visa Console."},no_paired_agent:{kind:"caller",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"No agent is set up on this computer. Call agent_enroll or run visa connect, and have the owner approve it first."},agent_id_required:{kind:"caller",fix:null,nextAction:"Pass the agentId of the agent this is for."},already_terminal:{kind:"caller",fix:null,nextAction:"This was already finished or cancelled. Nothing more is needed."},purchase_transport_uncertain:{kind:"caller",fix:null,nextAction:"Wait briefly, then repeat the same purchase call with the same arguments, request key and purchase ID: the first request may have gone through, and repeating recovers it. Do not cancel, create a replacement or press Pay at the merchant again."},purchase_refused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa refused this purchase. Keep the original purchase and request key, and tell the human. A refusal is not permission to create a replacement or press Pay at the merchant again."},recovery_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Inspect the original purchase and checkout with the owner or support. Preserve the purchase ID and request key. Do not create a replacement, release uncertain liability or submit Pay again."},card_recovery_unconfigured:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase cannot be recovered right now. Ask support to look at it before retrying the same request. Keep the purchase ID; do not create another purchase or press Pay at the merchant again."},card_recovery_original_not_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The first attempt at this purchase is still open. Retrieve the same purchase without include:card and follow its next step; do not force recovery, create another purchase or press Pay at the merchant again."},card_recovery_liability_present:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The first attempt at this purchase is not settled yet. Ask support to look at it and the existing checkout. Do not release funds, ask for new card details or press Pay at the merchant again."},card_recovery_issuance_conflict:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase's records disagree, so it was stopped. Ask support to look at the original purchase. Do not create another purchase or press Pay at the merchant again."},card_recovery_proof_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase could not be recovered. Ask support to look at it; do not replay the same request, set the agent up again or press Pay at the merchant again."},card_purchase_quarantined:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase is on hold for review. Ask support to look at it and the existing checkout. Do not create another purchase or press Pay at the merchant again."},card_credential_not_available:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Card details are not available for this purchase right now. Retrieve the same purchase without include:card and follow its next step. Do not recreate the purchase or press Pay at the merchant again."},purchase_submission_observed:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase was already reported as submitted. Check the existing merchant checkout and report its current state on the same purchase. Do not ask for new card details or press Pay at the merchant again."},protected_card_request_invalid:{kind:"caller",fix:null,nextAction:"The saved purchase request is no longer valid, usually because it expired. Retrieve the same purchase and follow its next step; if it reads expired, run purchase_create again with the same saved request. Do not create a replacement by hand."},protected_card_delivery_conflict:{kind:"caller",fix:null,nextAction:"The saved purchase request was changed after it started. Retrieve the same purchase and follow its next step; do not edit or replay the saved request."},protected_card_authority_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not issue card details right now. Nothing was issued. Wait a moment and retrieve the same purchase; recovery continues on Visa's side."},purchase_cancelled:{kind:"caller",fix:null,nextAction:"This purchase was cancelled; it accepts no new credential. Create a new purchase for a fresh checkout if the buyer still wants it. Do not click merchant Pay."},card_intent_unobserved:{kind:"caller",fix:null,nextAction:"The owner's card allowance for this agent is not active yet. Follow next.open_url so the owner finishes card setup, then retry the same checkout."},card_intent_mandate_exists:{kind:"caller",fix:null,nextAction:"The owner's current approval already has a card allowance in progress. Wait for it to finish (or ask the owner to check the limits page), then retry the same checkout."},card_intent_conflict:{kind:"caller",fix:null,nextAction:"A different card approval request already uses this id. Read the current status instead of sending an edited request."},card_vic_provider_refused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The card network refused to issue card details. Ask the owner or support to check the original purchase before retrying; its hold may not be released yet. Do not create a replacement purchase or press Pay at the merchant again."},terms_conflict:{kind:"caller",fix:null,nextAction:"This request conflicts with the checkout already in progress. Retrieve the original purchase and compare the exact final terms. Do not change the request key or checkout ID to get around it."},card_checkout_expired:{kind:"caller",fix:null,nextAction:"The checkout price expired. Check the original purchase before getting a new final price from the merchant. Do not reuse old terms or change the request key or checkout ID to get around it."},card_mandate_expired:{kind:"caller",fix:null,nextAction:"The agent's card allowance lapsed (each lasts 7 days) and Visa is renewing it under the owner's existing approval. Wait afterMs, then run purchase_create again the same way. Do not involve the owner or create a replacement purchase."},card_allowance_preparing:{kind:"caller",fix:null,nextAction:"Visa is issuing this agent's card allowance under the owner's existing approval. Wait afterMs and run the same purchase create again; the wait loop does this for you. Do not involve the owner or create a replacement purchase."},protected_card_instrument_inactive:{kind:"platform",escalation:"awaiting_human",fix:"purchase_create",nextAction:"The owner replaced or removed the saved card this agent used. Call purchase_create again with the saved resumeId: it returns one open_url the owner opens to reconnect the agent to their current card. Do not ask for card details or press Pay again."},card_reservation_expired:{kind:"caller",fix:null,nextAction:"This purchase's hold expired. Retrieve the same purchase and follow its next step; do not replay old request data or create a replacement to hide an unfinished attempt."},card_merchant_country_mismatch:{kind:"caller",fix:null,nextAction:"Use the merchant's real country everywhere in the checkout terms. Keep the existing purchase; do not change keys to get around a terms conflict."},protected_grant_proof_mismatch:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not confirm this agent's approval. Ask the owner or support to check it; do not retry unchanged or create a replacement."},purchase_resume_invalid:{kind:"caller",fix:null,nextAction:"Use the exact saved purchase resume reference by itself; do not combine it with a new request. Preserve the original purchase and merchant checkout."},purchase_draft_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The saved purchase request is damaged or changed. Stop and ask support to recover the original draft; do not overwrite it, invent new terms or click merchant Pay again."},purchase_draft_not_found:{kind:"caller",fix:null,nextAction:"Use the original device and exact saved resume reference. Locate the existing draft before continuing; do not recreate the request or click merchant Pay again."},purchase_draft_agent_invalid:{kind:"caller",fix:null,nextAction:"Pick the existing agent by its exact id and resume the original purchase. Do not set up a new agent or purchase."},purchase_draft_agent_mismatch:{kind:"caller",fix:null,nextAction:"Resume this draft with the same protected agent it already selected. Do not switch agents, replace the draft or click merchant Pay again."},purchase_draft_owner_mismatch:{kind:"caller",fix:null,nextAction:"Sign in as the owner who started this draft on the original device, then resume that same draft. Do not transfer it to another owner or create a replacement purchase."},purchase_draft_owner_required:{kind:"caller",fix:null,nextAction:"Finish the returned owner sign-in step, then resume the same saved purchase. Do not start another setup or purchase."},purchase_draft_busy:{kind:"caller",fix:null,nextAction:"Wait for the current Visa purchase call to finish, then repeat the same resume reference. Do not run concurrent purchase calls, create a replacement or click merchant Pay again."},purchase_not_found:{kind:"caller",fix:null,nextAction:"Check the original purchase ID and selected agent. Recover the existing purchase record; do not mint a replacement merely because a read could not find it."},invalid_contract:{kind:"caller",fix:null,nextAction:"Correct the request using the declared tool schema, then retry only with valid input. Never fabricate facts or change existing payment identifiers to bypass their commitment."},invalid_amount:{kind:"caller",fix:null,nextAction:"Give a positive amount in the units the tool asks for, within its total and precision limits. Never change ids to get around an existing payment."},invalid_currency:{kind:"caller",fix:null,nextAction:"Use the currency required by the selected payment profile. Do not infer merchant country from currency."},unsupported_version:{kind:"caller",fix:null,nextAction:"Use a supported version. Check the tool's schema or update Visa CLI, then retry the same operation without changing its existing ids."},keychain_not_found:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This Mac user has no login keychain, so no agent key was stored or read. Ask the owner to restore or create their login keychain in Keychain Access, then retry. On a server with no keychain, set VISA_RUNTIME_CUSTODY_PROFILE=headless."},custody_store_unreadable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa CLI could not read this agent's key on this computer (its permissions or the disk), so nothing was signed or changed. Ask the owner to fix read access to Visa CLI's files, then retry. Do not set the agent up again: the key may still be there."},credential_store_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This computer's Visa sign-in could not be read: the keychain or keyring is locked, did not answer in time, or secret-tool is missing on Linux. Nothing was sent. Ask the owner to unlock it (or install secret-tool), then retry once."},keychain_locked_or_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The Mac login keychain is locked, so this agent's key could not be read. Nothing was signed or sent. Ask the owner to unlock it (log in to the Mac, or open Keychain Access), then retry once."},custody_unavailable:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This agent's key is not on this computer (it was set up by an older Visa CLI or elsewhere). Nothing was signed. Ask the owner to update Visa CLI (npm i -g @visa/cli@rc), run visa connect here, and approve the new agent."},protected_card_enrollment_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. The owner must verify a payment card once for this account. Ask them to sign in to the Visa Console and finish the Verify your card step, then retry once.",remedy:{path:"/agent/enroll?enrollCard=1",label:"Verify a payment card"}},financial_rollout_approval_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. This account is not approved for payments yet. Tell the owner; do not retry until they confirm it was approved."},key_purpose_mismatch:{kind:"platform",escalation:"awaiting_human",fix:"npm i -g @visa/cli@rc",nextAction:"Visa CLI used the wrong key for this, so nothing was signed or sent. This is a Visa CLI bug or a version mismatch: ask the owner to update Visa CLI, then retry once. If it happens again on the latest version, report it."},legacy_custody_profile_required:{kind:"platform",escalation:"awaiting_human",fix:"npm i -g @visa/cli@rc",nextAction:"Visa CLI used the wrong key for this, so nothing was signed or sent. This is a Visa CLI bug or a version mismatch: ask the owner to update Visa CLI, then retry once. If it happens again on the latest version, report it."},identity_binding_mismatch:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This request named a different agent than the key on this computer, so nothing was signed. Read get_status, then retry once with that agent's id; if it happens again, tell the owner."},proof_time_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This computer's clock is wrong, so nothing was signed or sent. Ask the owner to set the clock to update automatically, then retry once."},secret_service_locked_or_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The desktop keyring is locked, so the agent's key could not be read. Ask the owner to unlock it; on a machine with no desktop (SSH, WSL, a server), set VISA_RUNTIME_CUSTODY_PROFILE=headless and run visa connect. Do not retry on your own."},secret_service_unavailable:{kind:"platform",escalation:"awaiting_human",fix:"VISA_RUNTIME_CUSTODY_PROFILE=headless visa connect",nextAction:"This computer has no desktop keyring (for example over SSH), so the agent's key could not be read. Set VISA_RUNTIME_CUSTODY_PROFILE=headless and run visa connect, or unlock the keyring in a desktop session. Do not retry on your own."},secret_service_timeout:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The Linux Secret Service did not answer Visa CLI in time, usually because an unlock prompt is waiting. Ask the owner to answer or unlock the keyring, then retry once."},dpapi_locked_or_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Windows would not open this agent's key, usually because this is a different Windows user than the one that set it up. Ask the owner to run Visa CLI as that user; do not retry on your own."},enrollment_device_approval_pending:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This computer's setup is waiting for the owner to approve the device, and starting another would strand it. Run visa connect (without --restart) to reopen the approval and ask the owner to approve it."},enrollment_expired:{kind:"caller",fix:"visa connect --restart",nextAction:"This approval link expired. Run `visa connect --restart` (agent_enroll: restart:true) for a new link, and give the owner the new link and code."},enrollment_owner_mismatch:{kind:"platform",escalation:"awaiting_human",fix:"visa connect --restart (keep the signed-in account) or visa disconnect --all, then visa connect (switch accounts)",nextAction:"Nothing was connected: this agent belongs to another Visa account. Let the owner choose: visa connect --restart keeps the signed-in account; visa disconnect --all, then visa connect, switches accounts (it removes Visa from every AI client)."},wallet_key_setup_pending:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This agent is connected but cannot pay yet: its key on the owner's Tempo wallet is not set up. The owner's approval page or the Visa Console finishes it (asking for OUSD first if the wallet is empty). Then call get_status. Do not use --restart.",remedy:{path:"/agent/enroll/payments",label:"Finish the wallet in Payments"}},unspecified_error:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Tell the human what failed and give them the reference. Do not retry this automatically."},tempo_over_max:{kind:"caller",fix:null,nextAction:"Nothing was signed or paid. The charge costs more than max: raise max only if the human agreed to that price, otherwise stop."},tempo_budget_refused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. The owner's spending budget or per-payment limit does not allow this payment. Ask the human to raise it in the Visa Console; do not retry until they have.",remedy:{path:"/agent/enroll/limits",label:"Change the agent's limits"}},tempo_chain_limit:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. This agent's weekly safety limit on the Tempo wallet is used up; it refills on a weekly schedule shown in the Visa Console. Do not retry before then; tell the human if the purchase cannot wait.",remedy:{path:"/agent/enroll/limits",label:"Change the agent's limits"}},tempo_charge_expired:{kind:"caller",fix:"pay",nextAction:"Nothing was paid. The merchant charge expired before it was signed. Call pay again for the same target to get a fresh charge."},tempo_payment_unclear:{kind:"caller",fix:"pay",nextAction:"The payment may have gone through (charged: null). Do not start a new purchase. Call pay again with the same economicIntentId in about a minute: it reports whether the payment landed and pays only if it did not."},atum_payment_unclear:{kind:"caller",fix:"pay",nextAction:"The payment may have gone through. Call pay again with the same economicIntentId, request, intent and max to recover it. Do not start a new purchase or pay another way. If it cannot be recovered, keep the purchase id and tell the human."},atum_unavailable:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Payments to this merchant are not available right now. No new payment was signed."},tempo_payment_in_progress:{kind:"caller",fix:"pay",nextAction:"Another call is paying this exact purchase right now. Do not pay again; call pay again with the same economicIntentId in a minute to read its outcome."},tempo_payment_refused:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Nothing was signed or paid. Visa refused this Tempo payment before signing. Tell the human and stop; do not retry."},tempo_charge_mismatch:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. The merchant's Tempo charge does not match what this payment allows (payee, currency or paying account), checked on this machine. Do not retry; tell the human."},tempo_not_enabled:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. This agent's wallet setup is not finished. Ask the owner to open Payments in the Visa Console, where the wallet finishes setting up once it has funds. Then call pay again with the same economicIntentId.",remedy:{path:"/agent/enroll/payments",label:"Finish the wallet in Payments"}},tempo_unavailable:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Nothing was paid. Visa has wallet payments switched off right now. Tell the human; do not retry until Visa turns them on, and do not look for another way to pay this merchant."},merchant_not_supported:{kind:"caller",fix:null,nextAction:"Nothing was charged. This merchant offers no payment this wallet can make. Choose a merchant that accepts payment on Tempo."},merchant_unreachable:{kind:"caller",fix:null,nextAction:"Nothing was charged. The merchant URL could not be reached to read its price. Check the URL, then call pay again with the same economicIntentId."},merchant_refused:{kind:"caller",fix:null,nextAction:"Nothing was signed or paid. The merchant refused this request: check the URL, method and body, and do not retry it unchanged."},purchase_on_retired_rail:{kind:"caller",fix:null,nextAction:"Nothing was paid. This purchase used a payment method that was retired. Do not pay it again: check history for its outcome, and use a new economicIntentId only for a genuinely new purchase."},tempo_owner_approval_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. The owner asked to approve each wallet payment, and this one could not be sent to them yet. Call pay again with the same economicIntentId: it asks the owner and returns the approval link. If it keeps failing, ask the human."}},Rx=Object.keys(Xs);function Ys(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(Xs,e)}function uA(e){return e.remedy?{remedyPath:e.remedy.path,remedyLabel:e.remedy.label}:{}}function mr(e,t={}){let r=Xs[e],i=t.fix!==void 0?t.fix:r.fix;if(r.kind==="platform"&&r.escalation!=="awaiting_human"&&i!==null)throw new Error(`agent-contract: ${r.escalation} code "${e}" cannot carry a fix \u2014 no command resolves it`);return{code:e,kind:r.kind,fix:i,nextAction:t.nextAction??r.nextAction,...t.agentId?{agentId:t.agentId}:{},...uA(r)}}var Ar=class extends Error{diagnostic;details;constructor(t,r,i={}){super(t),this.name="AgentContractError";let n=i.agentId??(typeof i.details?.agentId=="string"?i.details.agentId:void 0);this.diagnostic=mr(r,{...i,...n?{agentId:n}:{}}),this.details=i.details}get code(){return this.diagnostic.code}};function Qs(e){if(e instanceof Ar)return e.diagnostic;if(e&&typeof e=="object"){let t=e,r=typeof t.agentId=="string"?t.agentId:t.details&&typeof t.details=="object"&&typeof t.details.agentId=="string"?t.details.agentId:void 0,i=r?{agentId:r}:{},n=e.underlying;if(n instanceof Ar)return n.diagnostic;let a=n?.code;if(a==="agent_paused"||a==="agent_revoked"||a==="device_key_replaced"||a==="grant_expired")return mr(a,i);let o=e.code??e.errorCode;if(Ys(o))return mr(o,i);if(typeof o=="string"){let c=o.toLowerCase();if(Ys(c))return mr(c,i)}let s=e.message;return Ys(s)?mr(s,i):mr("unspecified_error",i)}return mr("unspecified_error")}var at=hr(require("fs")),tu=hr(require("path")),Nf=hr(require("os"));var eu=tu.join(Nf.homedir(),".visa-mcp"),ri=tu.join(eu,"mcp-server.log"),cA=5*1024*1024,ii=null;function lA(){at.existsSync(eu)||at.mkdirSync(eu,{recursive:!0,mode:448})}function dA(){if(!ii){if(lA(),at.existsSync(ri)&&at.statSync(ri).size>cA){let r=ri+".1";at.existsSync(r)&&at.unlinkSync(r),at.renameSync(ri,r)}let e=at.createWriteStream(ri,{flags:"a"});e.on?.("error",()=>{ii===e&&(ii=null)}),ii=e}return ii}function pA(){try{return zo().surface}catch{return"cli"}}function fA(e){return(e==="WARN"||e==="ERROR")&&pA()!=="cli"||process.env.VISA_CLI_DEBUG==="1"}var mA=300,gA=2e3;function hA(e){let t=e.code;return{name:e.name,message:e.message.slice(0,mA),...typeof t=="string"||typeof t=="number"?{code:t}:{},...e.stack?{stack:e.stack.slice(0,gA)}:{}}}function _A(e){if(typeof e=="string")return e;try{return JSON.stringify(e,(r,i)=>i instanceof Error?hA(i):i,2)??""}catch{try{return String(e)}catch{return"[unserializable]"}}}function vA(){try{return`[ref:${pu()}] `}catch{return""}}function yo(e,...t){let r=new Date().toISOString(),i=t.map(_A).join(" "),n=`[${r}] [${e}] ${vA()}${i}
60
- `;fA(e)&&process.stderr.write(n),dA().write(n)}var Cf={debug:(...e)=>yo("DEBUG",...e),info:(...e)=>yo("INFO",...e),warn:(...e)=>yo("WARN",...e),error:(...e)=>yo("ERROR",...e)};var qf=Symbol.for("visa.cli.writtenForPeople"),Lf=300,tr=class extends Error{constructor(t,r){super(t,r),this.name="PlainError",yA(this)}};function yA(e){try{e&&typeof e=="object"&&Object.isExtensible(e)&&Object.defineProperty(e,qf,{value:!0,enumerable:!1})}catch{}return e}var bA=[Ar,vo];function wA(e){return!(e instanceof Error)||!e.message.trim()?!1:e[qf]===!0?!0:bA.some(t=>e instanceof t)}var ru={x402_retired:"This payment method is no longer offered.",update_required:"This version of Visa CLI is too old for this.",session_required:"This computer is not signed in to Visa.",identity_required:"This computer has no Visa agent set up yet.",legacy_door_removed:"That command was removed from Visa CLI.",agent_selection_required:"More than one agent matches, so none was picked.",invalid_argument:"One of the values given is not valid.",rate_limited:"Too many requests in a short time.",activity_entry_not_found:"That payment was not found.",wallet_network_mismatch:"This merchant does not accept a payment this wallet can make.",agent_operations_cli_upgrade_required:"This version of Visa CLI is too old to pay.",agent_operation_forbidden:"This agent is not allowed to make this payment.",runtime_context_not_found:"Visa could not find this agent's setup on this computer.",product_policy_not_active:"This agent's wallet setup is not finished.",runtime_spend_session_not_active:"This agent's wallet setup is not finished.",runtime_spend_attenuation_not_active:"This agent's spending limits are not set up yet.",runtime_revoked:"This agent's access on this computer was turned off.",certified_runtime_required:"The owner has not approved this agent's wallet on this computer yet.",runtime_certificate_invalid:"This agent's wallet approval on this computer has expired.",runtime_delegation_missing:"This agent's wallet setup is not finished.",runtime_delegation_expired:"This agent's wallet approval has expired.",runtime_authority_unavailable:"Visa could not check this agent's permissions right now.",universal_required_managed_only:"This agent's wallet setup is not finished.",wallet_authority_cli_upgrade_required:"This version of Visa CLI is too old to pay.",tap_signature_required:"This agent could not prove who it is to the merchant.",wallet_owner_approval_required:"This payment needs the owner's approval.",wallet_owner_approval_expired:"The owner's approval for this payment expired.",attestation_key_drift:"This computer's Visa sign-in no longer matches the account.",rc_access_required:"This preview build of Visa CLI needs an access code.",early_access_required:"This feature is not turned on for this account.",card_checkout_not_on_pay:"This is a card checkout, which pay cannot complete.",card_draw_not_live:"Card payments are not available yet.",checkout_review_refused:"This checkout is not supported.",checkout_action_required:"This checkout needs a verification step first.",checkout_mandate_blocked:"The owner's card approval does not cover this purchase.",card_mandate_activation_uncertain:"The card network did not confirm the owner's approval.",ucp_platform_profile_unavailable:"Checkout with this merchant is not available right now.",wallet_capability_unavailable:"Wallet payments are not available in this version.",surface_disabled:"This feature is switched off right now.",wallet_grant_required:"The owner has not approved this agent's wallet yet.",wallet_credential_required:"The owner has not approved this agent to pay yet.",grant_expired:"The owner's spending approval for this agent has expired.",managed_limits_owner_controlled:"Only the owner can change this agent's limits.",agent_paused:"The owner paused this agent.",owner_declined:"The owner declined this payment.",setup_declined:"The owner declined this setup.",owner_withdrawal_pending:"A withdrawal from this wallet is still going through.",operator_daily_cap_reached:"The daily spending limit has been reached.",operator_daily_cap_unavailable:"Visa could not check the daily spending limit.",kill_switch_engaged:"Visa has paused these payments for now.",agent_revoked:"The owner removed this agent.",device_key_replaced:"This agent now runs on another computer.",agent_stale:"Visa could not confirm this agent is still active.",agent_lifecycle_unknown:"Visa could not confirm this agent's status.",wallet_delivery_required:"This agent's wallet setup did not finish.",wallet_authority_revoked:"This wallet can no longer make payments.",wallet_authority_replacement_required:"This agent was set up by an older Visa CLI.",wallet_policy_required:"This agent has no spending limits yet.",wallet_funding_required:"The wallet does not have enough funds.",wallet_unavailable:"The owner's wallet is not set up yet.",checkout_agent_access_required:"Agent checkout is not turned on for this account.",unknown_tool:"That tool does not exist.",handoff_not_found:"That setup code was not found.",handoff_expired:"That setup code expired.",handoff_already_redeemed:"That setup code was already used.",no_paired_agent:"This computer has no Visa agent set up yet.",agent_id_required:"An agent id is needed for this.",already_terminal:"This was already finished or cancelled.",purchase_transport_uncertain:"Visa did not answer in time, so the purchase may or may not have gone through.",purchase_refused:"Visa refused this purchase.",recovery_required:"This purchase needs support to look at it.",card_recovery_unconfigured:"This purchase cannot be recovered right now.",card_recovery_original_not_expired:"The first attempt at this purchase is still open.",card_recovery_liability_present:"The first attempt at this purchase is not settled yet.",card_recovery_issuance_conflict:"This purchase's records disagree, so it was stopped.",card_recovery_proof_invalid:"This purchase could not be recovered.",card_purchase_quarantined:"This purchase is on hold for review.",card_credential_not_available:"Card details are not available for this purchase right now.",purchase_submission_observed:"This purchase was already submitted.",protected_card_request_invalid:"The saved purchase request is no longer valid.",protected_card_delivery_conflict:"The saved purchase request was changed.",protected_card_authority_unavailable:"Visa could not issue card details right now.",purchase_cancelled:"This purchase was cancelled.",card_intent_unobserved:"The owner's card approval for this agent is not active yet.",card_intent_mandate_exists:"A card approval for this agent is already in progress.",card_intent_conflict:"A different card approval already uses this id.",card_vic_provider_refused:"The card network refused to issue card details.",terms_conflict:"This purchase does not match the checkout already in progress.",card_checkout_expired:"The checkout price expired.",card_mandate_expired:"The agent's card allowance lapsed and is being renewed.",card_allowance_preparing:"The agent's card allowance is still being set up.",protected_card_instrument_inactive:"The owner's saved card changed.",card_reservation_expired:"This purchase's hold expired.",card_merchant_country_mismatch:"The merchant country does not match the checkout.",protected_grant_proof_mismatch:"Visa could not confirm this agent's approval.",purchase_resume_invalid:"That saved purchase reference is not valid.",purchase_draft_invalid:"The saved purchase request is damaged.",purchase_draft_not_found:"That saved purchase was not found on this computer.",purchase_draft_agent_invalid:"The agent named for this purchase is not valid.",purchase_draft_agent_mismatch:"This purchase belongs to a different agent.",purchase_draft_owner_mismatch:"This purchase was started by a different Visa account.",purchase_draft_owner_required:"The owner needs to sign in to continue this purchase.",purchase_draft_busy:"Another purchase call is still running.",purchase_not_found:"That purchase was not found.",invalid_contract:"The request is not in the expected form.",invalid_amount:"The amount is not valid.",invalid_currency:"The currency is not valid for this payment.",unsupported_version:"This request uses a version Visa CLI does not support.",keychain_not_found:"This Mac user has no login keychain.",custody_store_unreadable:"Visa CLI could not read this agent's key on this computer.",credential_store_unavailable:"Visa CLI could not read this computer's Visa sign-in.",keychain_locked_or_unavailable:"The Mac login keychain is locked.",custody_unavailable:"This agent's key is not on this computer.",protected_card_enrollment_required:"The owner has not verified a payment card yet.",financial_rollout_approval_required:"This account is not approved for payments yet.",key_purpose_mismatch:"Visa CLI used the wrong key for this.",legacy_custody_profile_required:"Visa CLI used the wrong key for this.",identity_binding_mismatch:"This request named a different agent than the key on this computer.",proof_time_invalid:"This computer's clock is wrong.",secret_service_locked_or_unavailable:"The desktop keyring is locked.",secret_service_unavailable:"No desktop keyring is available on this computer.",secret_service_timeout:"The desktop keyring did not answer in time.",dpapi_locked_or_unavailable:"Windows would not open this agent's key for this user.",enrollment_device_approval_pending:"This computer's setup is still waiting for the owner's approval.",enrollment_expired:"The approval link expired.",enrollment_owner_mismatch:"This agent belongs to a different Visa account than the one signed in here.",wallet_key_setup_pending:"This agent's wallet key is not set up yet.",unspecified_error:"Something unexpected went wrong.",tempo_over_max:"The price is higher than the maximum allowed.",tempo_budget_refused:"The owner's limits do not allow this payment.",tempo_chain_limit:"This agent's weekly wallet limit is used up.",tempo_charge_expired:"The merchant's charge expired.",tempo_payment_unclear:"The payment may have gone through.",atum_payment_unclear:"The payment may have gone through.",atum_unavailable:"This payment method is not available.",tempo_payment_in_progress:"This purchase is already being paid.",tempo_payment_refused:"Visa refused this payment.",tempo_charge_mismatch:"The merchant's charge does not match this payment.",tempo_not_enabled:"This agent's wallet setup is not finished.",tempo_unavailable:"Wallet payments are switched off right now.",merchant_not_supported:"This merchant has no payment this wallet can make.",merchant_unreachable:"The merchant could not be reached.",merchant_refused:"The merchant refused this request.",purchase_on_retired_rail:"This purchase used a payment method that was retired.",tempo_owner_approval_required:"This payment needs the owner's approval."},Mf="Visa could not be reached. Check your internet connection and try again.",Rf="Visa did not answer in time. Try again in a few minutes.",Vf="Visa is having trouble right now. Try again in a few minutes.";function $A(e){let t=e&&typeof e=="object"?e.name:void 0;return typeof t=="string"?t:""}function zA(e){let t=$A(e);if(t==="AbortError"||t==="TimeoutError")return Rf;if(t==="ProtectedAuthorityTransportError"){let i=e.reason;return i==="timeout"?Rf:i==="response"?Vf:Mf}let r=e?.cause;return t==="TypeError"&&r&&typeof r=="object"&&typeof r.code=="string"?Mf:null}function IA(e){return e>=500||e===408||e===425?Vf:e===429?ru.rate_limited:e===404?"That was not found.":e===403?"This account is not allowed to do that.":e===409?"This conflicts with something already in progress.":e>=400?"Visa could not accept this request.":null}function iu(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=100&&t<=599?t:null}var Uf=new WeakSet;function nu(e){let t=[],r=e?.cause;for(let i=0;i<4&&r&&typeof r=="object";i+=1){let n=r,a=[typeof n.name=="string"?n.name:null,typeof n.message=="string"?n.message:null,typeof n.code=="string"||typeof n.code=="number"?`(${n.code})`:null].filter(Boolean).join(" ");a&&t.push(a.slice(0,Lf)),r=n.cause}return t}function bo(e){return typeof e=="string"&&e?e.slice(0,Lf):void 0}function Zf(e,t,r,i=!1){try{let n=e&&typeof e=="object"?e:{};if(i&&!bo(n.detail)&&nu(e).length===0)return;if(e&&typeof e=="object"){if(Uf.has(e))return;Uf.add(e)}Cf.warn("failure:detail",{code:t.code,name:e instanceof Error?e.name:typeof e,...iu(e)!==null?{status:iu(e)}:{},...typeof n.code=="string"?{thrownCode:n.code.slice(0,64)}:{},message:bo(e instanceof Error?e.message:String(e)),...bo(n.detail)?{detail:bo(n.detail)}:{},...nu(e).length?{causes:nu(e)}:{},shown:r})}catch{}}function Ff(e,t={}){let r;try{r=Qs(e)}catch{r=Qs(void 0)}if(wA(e)){let n=e.message.trim();return Zf(e,r,n,!0),n}let i=(r.code!=="unspecified_error"?ru[r.code]:null)??zA(e)??IA(iu(e)??0)??t.fallback??ru.unspecified_error;return Zf(e,r,i),i}var wo=hr(Bf());function Gf(e){return e.includes("-rc.")?"rc":"latest"}var Jx=process.platform==="win32"?"visa-cli.cmd":"visa-cli";var OA="5.0.0-rc.413",au="Usage: visa-tool <tool> ['<json arguments>'], visa-tool --list, or visa-tool --skill",kA=3e5,PA=3e3;async function Kf(e,t,r){let i=(0,Jf.spawn)(process.execPath,[e],{env:t,stdio:["pipe","pipe","pipe"]}),n=new Map,a="",o=null,s=new Promise((w,z)=>{o=z});s.catch(()=>{}),i.stderr.resume(),i.on("error",()=>o?.(new tr("The Visa MCP server could not be started."))),i.on("exit",()=>o?.(new tr("The Visa MCP server stopped before it answered. Its log is ~/.visa-mcp/mcp-server.log."))),i.stdout.on("data",w=>{a+=w;let z;for(;(z=a.indexOf(`
57
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let s=o[1];if(t===o[0]){a(o);continue}if(e.external){let d=e.external.registry.get(o[0])?.id;if(t!==o[0]&&d){a(o);continue}}if(e.metadataRegistry.get(o[0])?.id){a(o);continue}if(s.cycle){a(o);continue}if(s.count>1&&e.reused==="ref"){a(o);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Md(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let i of t){if(!i||typeof i!="object")return;Md(i);let n=Object.keys(i);if(n.length!==1||n[0]!=="type")return;let a=i.type;for(let o of Array.isArray(a)?a:[a]){if(typeof o!="string")return;r.includes(o)||r.push(o)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Rd=new Set(["type","properties","required","additionalProperties"]),Nd=["oneOf","anyOf"];function Cd(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function rs(e){let t=[];for(let a of e){if(typeof a!="object"||a.type!=="object")return null;for(let o in a)if(!Rd.has(o))return null;t.push(a)}let r={},i=new Set;for(let a of t){for(let o in a.properties){if(Object.prototype.hasOwnProperty.call(r,o))continue;let s=[];for(let d of t){let p=d.properties?.[o]??Cd(d);p!=null&&(s.some(_=>JSON.stringify(_)===JSON.stringify(p))||s.push(p))}let c=s.length===1?s[0]:rs(s)??{allOf:s};(0,is.assignProp)(r,o,c)}for(let o of a.required??[])i.add(o)}let n={type:"object",properties:r};if(i.size&&(n.required=[...i]),t.every(a=>a.additionalProperties===!1))n.additionalProperties=!1;else{let a=[];for(let o of t){let s=Cd(o);s&&!a.some(c=>JSON.stringify(c)===JSON.stringify(s))&&a.push(s)}a.length===1?n.additionalProperties=a[0]:a.length>1&&(n.additionalProperties={allOf:a})}return n}function PO(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Rd)if(n in e)return;let r=t.filter(n=>Nd.some(a=>Array.isArray(n[a]))),i=null;if(!r.length)i=rs(t);else{let n=r[0],a=Nd.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let o=t.filter(c=>c!==n),s=n[a].map(c=>rs([...o,c]));if(s.some(c=>!c))return;i={[a]:s}}i&&(delete e.allOf,Zr(e,i))}function ss(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=s=>{let c=e.seen.get(s);if(c.ref===null)return;let d=c.def??c.schema,p={...d},_=c.ref;if(c.ref=null,_){i(_);let w=e.seen.get(_),z=w.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(z)):Zr(d,z),Zr(d,p),s._zod.parent===_)for(let q in d)q==="$ref"||q==="allOf"||q in p||delete d[q];if(z.$ref&&w.def)for(let q in d)q==="$ref"||q==="allOf"||q in w.def&&JSON.stringify(d[q])===JSON.stringify(w.def[q])&&delete d[q]}let b=s._zod.parent;if(b&&b!==_){i(b);let w=e.seen.get(b);if(w?.schema.$ref&&(d.$ref=w.schema.$ref,w.def))for(let z in d)z==="$ref"||z==="allOf"||z in w.def&&JSON.stringify(d[z])===JSON.stringify(w.def[z])&&delete d[z]}e.override({zodSchema:s,jsonSchema:d,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())i(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())Md(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let c of e.seen.values())for(let d of[c.schema,c.def]){let p=d?.allOf;if(!Array.isArray(p))continue;let _=s.get(p);_?_.push(d):s.set(p,[d])}for(let c of e.intersections)for(let d of s.get(c)??[])PO(d)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Zr(n,r.defId?r.schema:r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&n.id===a&&delete n.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let c=s[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,(0,is.assignProp)(o,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?n.$defs=o:n.definitions=o);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:(0,st.createStandardJSONSchemaMethod)(t,"input",e.processors),output:(0,st.createStandardJSONSchemaMethod)(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Ye(i.element,r);if(i.type==="set")return Ye(i.valueType,r);if(i.type==="lazy")return Ye(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Ye(i.innerType,r);if(i.type==="intersection")return Ye(i.left,r)||Ye(i.right,r);if(i.type==="record"||i.type==="map")return Ye(i.keyType,r)||Ye(i.valueType,r);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ye(i.in,r)||Ye(i.out,r);if(i.type==="object"){for(let n in i.shape)if(Ye(i.shape[n],r))return!0;return!1}if(i.type==="union"){for(let n of i.options)if(Ye(n,r))return!0;return!1}if(i.type==="tuple"){for(let n of i.items)if(Ye(n,r))return!0;return!!(i.rest&&Ye(i.rest,r))}return!1}var jO=(e,t={})=>r=>{let i=as({...r,processors:t});return Na(e,i),os(i,e),ss(i,e)};st.createToJSONSchemaMethod=jO;var TO=(e,t,r={})=>i=>{let{libraryOptions:n,target:a}=i??{},o=as({...n??{},target:a,io:t,processors:r});return Na(e,o),os(o,e),ss(o,e)};st.createStandardJSONSchemaMethod=TO});var Vr=j(k=>{"use strict";var AO=k&&k.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),xO=k&&k.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EO=k&&k.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&AO(t,e,r);return xO(t,e),t};Object.defineProperty(k,"__esModule",{value:!0});k.allProcessors=k.lazyProcessor=k.optionalProcessor=k.promiseProcessor=k.readonlyProcessor=k.pipeProcessor=k.catchProcessor=k.prefaultProcessor=k.defaultProcessor=k.nonoptionalProcessor=k.nullableProcessor=k.recordProcessor=k.tupleProcessor=k.intersectionProcessor=k.unionProcessor=k.objectProcessor=k.arrayProcessor=k.setProcessor=k.mapProcessor=k.transformProcessor=k.functionProcessor=k.customProcessor=k.successProcessor=k.fileProcessor=k.templateLiteralProcessor=k.nanProcessor=k.literalProcessor=k.enumProcessor=k.dateProcessor=k.unknownProcessor=k.anyProcessor=k.neverProcessor=k.voidProcessor=k.undefinedProcessor=k.nullProcessor=k.symbolProcessor=k.bigintProcessor=k.booleanProcessor=k.numberProcessor=k.stringProcessor=void 0;k.toJSONSchema=wk;var Ud=EO(yr()),ne=qr(),Ca=Z(),DO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},NO=(e,t,r,i)=>{let n=r;n.type="string";let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:d,laxFormat:p}=e._zod.bag;if(typeof a=="number"&&(n.minLength=a),typeof o=="number"&&(n.maxLength=o),s&&(n.format=DO[s]??s,n.format===""&&delete n.format,(s==="time"||p)&&delete n.format),d&&(n.contentEncoding=d),c&&c.size>0){let _=[...c];_.length===1?n.pattern=_[0].source:_.length>1&&(n.allOf=[..._.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}};k.stringProcessor=NO;var CO=(e,t,r,i)=>{let n=r,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:p}=e._zod.bag;typeof s=="string"&&s.includes("int")?n.type="integer":n.type="number";let _=typeof p=="number"&&p>=(a??Number.NEGATIVE_INFINITY),b=typeof d=="number"&&d<=(o??Number.POSITIVE_INFINITY),w=t.target==="draft-04"||t.target==="openapi-3.0";_?w?(n.minimum=p,n.exclusiveMinimum=!0):n.exclusiveMinimum=p:typeof a=="number"&&(n.minimum=a),b?w?(n.maximum=d,n.exclusiveMaximum=!0):n.exclusiveMaximum=d:typeof o=="number"&&(n.maximum=o),typeof c=="number"&&(Number.isFinite(c)&&c!==0?n.multipleOf=Math.abs(c):(0,ne.handleUnrepresentable)(e,t,n,i,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))};k.numberProcessor=CO;var MO=(e,t,r,i)=>{r.type="boolean"};k.booleanProcessor=MO;var RO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"BigInt cannot be represented in JSON Schema")};k.bigintProcessor=RO;var UO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Symbols cannot be represented in JSON Schema")};k.symbolProcessor=UO;var ZO=(e,t,r,i)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};k.nullProcessor=ZO;var qO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Undefined cannot be represented in JSON Schema")};k.undefinedProcessor=qO;var LO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Void cannot be represented in JSON Schema")};k.voidProcessor=LO;var VO=(e,t,r,i)=>{r.not={}};k.neverProcessor=VO;var FO=(e,t,r,i)=>{};k.anyProcessor=FO;var BO=(e,t,r,i)=>{};k.unknownProcessor=BO;var GO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Date cannot be represented in JSON Schema")};k.dateProcessor=GO;var JO=(e,t,r,i)=>{let n=e._zod.def,a=(0,Ca.getEnumValues)(n.entries);if(a.length===0){r.not={};return}a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),r.enum=a};k.enumProcessor=JO;var WO=(e,t,r,i)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let a=[];for(let o of n.values)if(o===void 0){if((0,ne.handleUnrepresentable)(e,t,r,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if((0,ne.handleUnrepresentable)(e,t,r,i,"BigInt literals cannot be represented in JSON Schema"))return;a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let o=a[0];r.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[o]:r.const=o}else a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),a.every(o=>typeof o=="boolean")&&(r.type="boolean"),a.every(o=>o===null)&&(r.type="null"),r.enum=a};k.literalProcessor=WO;var KO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"NaN cannot be represented in JSON Schema")};k.nanProcessor=KO;var HO=(e,t,r,i)=>{let n=r,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=a.source};k.templateLiteralProcessor=HO;var YO=(e,t,r,i)=>{let n=r,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(n,a)):(Object.assign(n,a),n.anyOf=c.map(d=>({contentMediaType:d}))):Object.assign(n,a)};k.fileProcessor=YO;var XO=(e,t,r,i)=>{r.type="boolean"};k.successProcessor=XO;var QO=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Custom types cannot be represented in JSON Schema")};k.customProcessor=QO;var ek=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Function types cannot be represented in JSON Schema")};k.functionProcessor=ek;var tk=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Transforms cannot be represented in JSON Schema")};k.transformProcessor=tk;var nk=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Map cannot be represented in JSON Schema")};k.mapProcessor=nk;var rk=(e,t,r,i)=>{(0,ne.handleUnrepresentable)(e,t,r,i,"Set cannot be represented in JSON Schema")};k.setProcessor=rk;var ik=(e,t,r,i)=>{let n=r,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o=="number"&&(n.minItems=o),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=(0,ne.process)(a.element,t,{...i,path:[...i.path,"items"]})};k.arrayProcessor=ik;function Lr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Lr(t.out):t.type==="catch"?Lr(t.innerType):e._zod.optin}var ak=(e,t,r,i)=>{let n=r,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&(0,ne.handleUnrepresentable)(e,t,n,i,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let p in o)(0,Ca.assignProp)(n.properties,p,(0,ne.process)(o[p],t,{...i,path:[...i.path,"properties",p]}));let c=new Set(Object.keys(o)),d=new Set([...c].filter(p=>{let _=a.shape[p];return t.io==="input"?Lr(_)===void 0:_._zod.optout===void 0}));d.size>0&&(n.required=Array.from(d)),a.catchall?._zod.def.type==="never"?n.additionalProperties=!1:a.catchall?a.catchall&&(n.additionalProperties=(0,ne.process)(a.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)};k.objectProcessor=ak;var ok=(e,t,r,i)=>{let n=e._zod.def,a=n.inclusive===!1,o=n.options.map((s,c)=>(0,ne.process)(s,t,{...i,path:[...i.path,a?"oneOf":"anyOf",c]}));a?r.oneOf=o:r.anyOf=o};k.unionProcessor=ok;var sk=(e,t,r,i)=>{let n=e._zod.def,a=(0,ne.process)(n.left,t,{...i,path:[...i.path,"allOf",0]}),o=(0,ne.process)(n.right,t,{...i,path:[...i.path,"allOf",1]}),s=d=>"allOf"in d&&Object.keys(d).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];r.allOf=c,t.intersections.push(c)};k.intersectionProcessor=sk;var uk=(e,t,r,i)=>{let n=r,a=e._zod.def;n.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=a.items.map((N,q)=>(0,ne.process)(N,t,{...i,path:[...i.path,o,q]})),d=a.rest?(0,ne.process)(a.rest,t,{...i,path:[...i.path,s,...t.target==="openapi-3.0"?[a.items.length]:[]]}):null,p=a.items.length;for(;p>0;){let N=a.items[p-1];if(!(t.io==="input"?Lr(N)!==void 0:N._zod.optout==="optional"))break;p--}let _=a.items.length,b=!a.rest;t.target==="draft-2020-12"?(n.prefixItems=c,b?n.items=!1:d&&(n.items=d),p>0&&(n.minItems=p),b&&(n.maxItems=_)):t.target==="openapi-3.0"?(n.items={anyOf:c},d&&n.items.anyOf.push(d),p>0&&(n.minItems=p),b&&(n.maxItems=_)):(n.items=c,b?n.additionalItems=!1:d&&(n.additionalItems=d),p>0&&(n.minItems=p),b&&(n.maxItems=_));let{minimum:w,maximum:z}=e._zod.bag;typeof w=="number"&&(n.minItems=w),typeof z=="number"&&(n.maxItems=z)};k.tupleProcessor=uk;function us(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let z=e.get(t)?.def;if(!z)return t;let N=us(e,z,r);return N===z?t:N}for(let z of["anyOf","oneOf"]){let N=t[z];if(!Array.isArray(N))continue;let q=N.map(_e=>us(e,_e,r));q.some((_e,Y)=>_e!==N[Y])&&(t={...t,[z]:q})}let i=Array.isArray(t.type)?t.type:[t.type],n=!i.includes("string")&&i.some(z=>z==="number"||z==="integer"),a=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!a?.some(z=>typeof z=="number"))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:p,format:_,id:b,...w}=t;return w.enum?w.enum=w.enum.map(z=>typeof z=="number"?String(z):z):typeof w.const=="number"&&(w.const=String(w.const)),n&&(w.type="string",a||(w.pattern=(i.includes("number")?Ud.number:Ud.integer).source)),w}var cs=new WeakMap;function ck(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let r=new Map;for(let i of cs.get(e)??[]){let n=e.seen.get(i),a=(n?.def??n?.schema)?.propertyNames;if(!a||a===!0||r.has(a))continue;let o=us(t,a,new Set);o!==a&&r.set(a,o)}if(r.size)for(let i of e.seen.values())for(let n of[i.schema,i.def]){let a=n&&r.get(n.propertyNames);a&&(n.propertyNames=a)}}var lk=(e,t,r,i)=>{let n=r,a=e._zod.def;n.type="object";let o=a.keyType,c=o._zod.bag?.patterns;if(a.mode==="loose"&&c&&c.size>0){let _=(0,ne.process)(a.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});n.patternProperties={};for(let b of c)(0,Ca.assignProp)(n.patternProperties,b.source,_)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=(0,ne.process)(a.keyType,t,{...i,path:[...i.path,"propertyNames"]});let _=cs.get(t);_||(_=[],cs.set(t,_),t.deferred.push(()=>ck(t))),_.push(e)}n.additionalProperties=(0,ne.process)(a.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let d=o._zod.values,p=t.io==="input"&&Lr(a.valueType)!==void 0;if(d&&!a.partial&&!p){let _=[...d].filter(b=>typeof b=="string"||typeof b=="number");_.length>0&&(n.required=_.map(String))}};k.recordProcessor=lk;var dk=(e,t,r,i)=>{let n=e._zod.def,a=(0,ne.process)(n.innerType,t,i),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=n.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]};k.nullableProcessor=dk;var pk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType};k.nonoptionalProcessor=pk;var ls=Symbol();function Zd(e,t,r,i,n){let a=!1,o=JSON.stringify(e,(s,c)=>typeof c!="bigint"?c:(a=!0,null));return a?((0,ne.handleUnrepresentable)(t,r,i,n,"BigInt defaults cannot be represented in JSON Schema"),ls):JSON.parse(o)}var fk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType;let o=Zd(n.defaultValue,e,t,r,i);o!==ls&&(r.default=o)};k.defaultProcessor=fk;var mk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);if(a.ref=n.innerType,t.io!=="input")return;let o=Zd(n.defaultValue,e,t,r,i);o!==ls&&(r._prefault=o)};k.prefaultProcessor=mk;var gk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType;let o;try{o=n.catchValue(void 0)}catch{(0,ne.handleUnrepresentable)(e,t,r,i,"Dynamic catch values are not supported in JSON Schema");return}r.default=o};k.catchProcessor=gk;var hk=(e,t,r,i)=>{let n=e._zod.def,a=n.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?a?n.out:n.in:n.out;(0,ne.process)(o,t,i);let s=t.seen.get(e);s.ref=o};k.pipeProcessor=hk;var _k=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType,r.readOnly=!0};k.readonlyProcessor=_k;var vk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType};k.promiseProcessor=vk;var yk=(e,t,r,i)=>{let n=e._zod.def;(0,ne.process)(n.innerType,t,i);let a=t.seen.get(e);a.ref=n.innerType};k.optionalProcessor=yk;var bk=(e,t,r,i)=>{let n=e._zod.innerType;(0,ne.process)(n,t,i);let a=t.seen.get(e);a.ref=n};k.lazyProcessor=bk;k.allProcessors={string:k.stringProcessor,number:k.numberProcessor,boolean:k.booleanProcessor,bigint:k.bigintProcessor,symbol:k.symbolProcessor,null:k.nullProcessor,undefined:k.undefinedProcessor,void:k.voidProcessor,never:k.neverProcessor,any:k.anyProcessor,unknown:k.unknownProcessor,date:k.dateProcessor,enum:k.enumProcessor,literal:k.literalProcessor,nan:k.nanProcessor,template_literal:k.templateLiteralProcessor,file:k.fileProcessor,success:k.successProcessor,custom:k.customProcessor,function:k.functionProcessor,transform:k.transformProcessor,map:k.mapProcessor,set:k.setProcessor,array:k.arrayProcessor,object:k.objectProcessor,union:k.unionProcessor,intersection:k.intersectionProcessor,tuple:k.tupleProcessor,record:k.recordProcessor,nullable:k.nullableProcessor,nonoptional:k.nonoptionalProcessor,default:k.defaultProcessor,prefault:k.prefaultProcessor,catch:k.catchProcessor,pipe:k.pipeProcessor,readonly:k.readonlyProcessor,promise:k.promiseProcessor,optional:k.optionalProcessor,lazy:k.lazyProcessor};function wk(e,t){if("_idmap"in e){let i=e,n=(0,ne.initializeContext)({...t,processors:k.allProcessors}),a={};for(let c of i._idmap.entries()){let[d,p]=c;(0,ne.process)(p,n)}let o={},s={registry:i,uri:t?.uri,defs:a};n.external=s;for(let c of i._idmap.entries()){let[d,p]=c;(0,ne.extractDefs)(n,p),(0,Ca.assignProp)(o,d,(0,ne.finalize)(n,p))}if(Object.keys(a).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:a}}return{schemas:o}}let r=(0,ne.initializeContext)({...t,processors:k.allProcessors});return(0,ne.process)(e,r),(0,ne.extractDefs)(r,e),(0,ne.finalize)(r,e)}});var qd=j(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.JSONSchemaGenerator=void 0;var $k=Vr(),Ma=qr(),ds=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=(0,Ma.initializeContext)({processors:$k.allProcessors,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return(0,Ma.process)(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,(0,Ma.extractDefs)(this.ctx,t);let i=(0,Ma.finalize)(this.ctx,t),{"~standard":n,...a}=i;return a}};Ra.JSONSchemaGenerator=ds});var Vd=j(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0})});var nt=j(de=>{"use strict";var Fd=de&&de.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),zk=de&&de.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),dt=de&&de.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Fd(t,e,r)},Ua=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Fd(t,e,r);return zk(t,e),t};Object.defineProperty(de,"__esModule",{value:!0});de.JSONSchema=de.JSONSchemaGenerator=de.toJSONSchema=de.locales=de.regexes=de.toZod=de.util=void 0;dt(Kn(),de);dt(Do(),de);dt(xo(),de);dt(Nr(),de);dt(Wo(),de);dt(li(),de);dt(qo(),de);de.util=Ua(Z());var Ik=Z();Object.defineProperty(de,"toZod",{enumerable:!0,get:function(){return Ik.toZod}});de.regexes=Ua(yr());de.locales=Ua(Xo());dt(Mr(),de);dt(pi(),de);dt(jd(),de);dt(Ed(),de);dt(qr(),de);var Sk=Vr();Object.defineProperty(de,"toJSONSchema",{enumerable:!0,get:function(){return Sk.toJSONSchema}});var Ok=qd();Object.defineProperty(de,"JSONSchemaGenerator",{enumerable:!0,get:function(){return Ok.JSONSchemaGenerator}});de.JSONSchema=Ua(Vd())});var Za=j(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.slugify=J.toUpperCase=J.toLowerCase=J.trim=J.normalize=J.overwrite=J.mime=J.properties=J.property=J.endsWith=J.startsWith=J.includes=J.uppercase=J.lowercase=J.regex=J.length=J.minLength=J.maxLength=J.size=J.minSize=J.maxSize=J.multipleOf=J.nonnegative=J.nonpositive=J.negative=J.positive=J.gte=J.gt=J.lte=J.lt=void 0;var ye=nt();Object.defineProperty(J,"lt",{enumerable:!0,get:function(){return ye._lt}});Object.defineProperty(J,"lte",{enumerable:!0,get:function(){return ye._lte}});Object.defineProperty(J,"gt",{enumerable:!0,get:function(){return ye._gt}});Object.defineProperty(J,"gte",{enumerable:!0,get:function(){return ye._gte}});Object.defineProperty(J,"positive",{enumerable:!0,get:function(){return ye._positive}});Object.defineProperty(J,"negative",{enumerable:!0,get:function(){return ye._negative}});Object.defineProperty(J,"nonpositive",{enumerable:!0,get:function(){return ye._nonpositive}});Object.defineProperty(J,"nonnegative",{enumerable:!0,get:function(){return ye._nonnegative}});Object.defineProperty(J,"multipleOf",{enumerable:!0,get:function(){return ye._multipleOf}});Object.defineProperty(J,"maxSize",{enumerable:!0,get:function(){return ye._maxSize}});Object.defineProperty(J,"minSize",{enumerable:!0,get:function(){return ye._minSize}});Object.defineProperty(J,"size",{enumerable:!0,get:function(){return ye._size}});Object.defineProperty(J,"maxLength",{enumerable:!0,get:function(){return ye._maxLength}});Object.defineProperty(J,"minLength",{enumerable:!0,get:function(){return ye._minLength}});Object.defineProperty(J,"length",{enumerable:!0,get:function(){return ye._length}});Object.defineProperty(J,"regex",{enumerable:!0,get:function(){return ye._regex}});Object.defineProperty(J,"lowercase",{enumerable:!0,get:function(){return ye._lowercase}});Object.defineProperty(J,"uppercase",{enumerable:!0,get:function(){return ye._uppercase}});Object.defineProperty(J,"includes",{enumerable:!0,get:function(){return ye._includes}});Object.defineProperty(J,"startsWith",{enumerable:!0,get:function(){return ye._startsWith}});Object.defineProperty(J,"endsWith",{enumerable:!0,get:function(){return ye._endsWith}});Object.defineProperty(J,"property",{enumerable:!0,get:function(){return ye._property}});Object.defineProperty(J,"properties",{enumerable:!0,get:function(){return ye._properties}});Object.defineProperty(J,"mime",{enumerable:!0,get:function(){return ye._mime}});Object.defineProperty(J,"overwrite",{enumerable:!0,get:function(){return ye._overwrite}});Object.defineProperty(J,"normalize",{enumerable:!0,get:function(){return ye._normalize}});Object.defineProperty(J,"trim",{enumerable:!0,get:function(){return ye._trim}});Object.defineProperty(J,"toLowerCase",{enumerable:!0,get:function(){return ye._toLowerCase}});Object.defineProperty(J,"toUpperCase",{enumerable:!0,get:function(){return ye._toUpperCase}});Object.defineProperty(J,"slugify",{enumerable:!0,get:function(){return ye._slugify}})});var ps=j(pt=>{"use strict";var kk=pt&&pt.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Pk=pt&&pt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Jd=pt&&pt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kk(t,e,r);return Pk(t,e),t};Object.defineProperty(pt,"__esModule",{value:!0});pt.ZodRealError=pt.ZodError=void 0;var La=Jd(nt()),jk=nt(),Bd=Jd(Z()),Gd=new WeakSet([Object.prototype,Error.prototype]);function qa(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=r(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var Wd=(e,t)=>{jk.$ZodError.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Gd.has(r)||(Gd.add(r),qa(r,"format",i=>n=>La.formatError(i,n)),qa(r,"flatten",i=>n=>La.flattenError(i,n)),qa(r,"addIssue",i=>n=>{i.issues.push(n),i.message=JSON.stringify(i.issues,Bd.jsonStringifyReplacer,2)}),qa(r,"addIssues",i=>n=>{i.issues.push(...n),i.message=JSON.stringify(i.issues,Bd.jsonStringifyReplacer,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};pt.ZodError=La.$constructor("ZodError",Wd);pt.ZodRealError=La.$constructor("ZodError",Wd,void 0,{Parent:Error})});var fs=j(pe=>{"use strict";var Tk=pe&&pe.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Ak=pe&&pe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),xk=pe&&pe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Tk(t,e,r);return Ak(t,e),t};Object.defineProperty(pe,"__esModule",{value:!0});pe.safeDecodeAsync=pe.safeEncodeAsync=pe.safeDecode=pe.safeEncode=pe.decodeAsync=pe.encodeAsync=pe.decode=pe.encode=pe.validateAsync=pe.validate=pe.safeParseAsync=pe.safeParse=pe.parseAsync=pe.parse=void 0;var ft=xk(nt()),mt=ps();pe.parse=ft._parse(mt.ZodRealError);pe.parseAsync=ft._parseAsync(mt.ZodRealError);pe.safeParse=ft._safeParse(mt.ZodRealError);pe.safeParseAsync=ft._safeParseAsync(mt.ZodRealError);var Kd=nt();Object.defineProperty(pe,"validate",{enumerable:!0,get:function(){return Kd.validate}});Object.defineProperty(pe,"validateAsync",{enumerable:!0,get:function(){return Kd.validateAsync}});pe.encode=ft._encode(mt.ZodRealError);pe.decode=ft._decode(mt.ZodRealError);pe.encodeAsync=ft._encodeAsync(mt.ZodRealError);pe.decodeAsync=ft._decodeAsync(mt.ZodRealError);pe.safeEncode=ft._safeEncode(mt.ZodRealError);pe.safeDecode=ft._safeDecode(mt.ZodRealError);pe.safeEncodeAsync=ft._safeEncodeAsync(mt.ZodRealError);pe.safeDecodeAsync=ft._safeDecodeAsync(mt.ZodRealError)});var Hn=j(l=>{"use strict";var Ek=l&&l.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Dk=l&&l.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Ga=l&&l.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ek(t,e,r);return Dk(t,e),t},Nk=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l,"__esModule",{value:!0});l.ZodTuple=l.ZodIntersection=l.ZodDiscriminatedUnion=l.ZodXor=l.ZodUnion=l.ZodObject=l.ZodArray=l.ZodDate=l.ZodVoid=l.ZodNever=l.ZodUnknown=l.ZodAny=l.ZodNull=l.ZodUndefined=l.ZodSymbol=l.ZodBigIntFormat=l.ZodBigInt=l.ZodBoolean=l.ZodNumberFormat=l.ZodNumber=l.ZodCustomStringFormat=l.ZodJWT=l.ZodCreditCard=l.ZodE164=l.ZodBase64URL=l.ZodBase64=l.ZodCIDRv6=l.ZodCIDRv4=l.ZodIPv6=l.ZodMAC=l.ZodIPv4=l.ZodKSUID=l.ZodXID=l.ZodULID=l.ZodCUID2=l.ZodCUID=l.ZodNanoID=l.ZodEmoji=l.ZodURL=l.ZodUUID=l.ZodGUID=l.ZodEmail=l.ZodISODuration=l.ZodISOTime=l.ZodISODate=l.ZodISODateTime=l.ZodStringFormat=l.ZodString=l._ZodString=l.ZodType=void 0;l.stringbool=l.meta=l.describe=l.ZodCustom=l.ZodFunction=l.ZodPromise=l.ZodLazy=l.ZodTemplateLiteral=l.ZodReadonly=l.ZodPreprocess=l.ZodCodec=l.ZodPipe=l.ZodNaN=l.ZodCatch=l.ZodSuccess=l.ZodNonOptional=l.ZodPrefault=l.ZodDefault=l.ZodNullable=l.ZodExactOptional=l.ZodOptional=l.ZodTransform=l.ZodFile=l.ZodLiteral=l.ZodEnum=l.ZodSet=l.ZodMap=l.ZodRecord=void 0;l.string=Va;l.email=Rk;l.guid=Uk;l.uuid=Zk;l.uuidv4=qk;l.uuidv6=Lk;l.uuidv7=Vk;l.url=Fk;l.httpUrl=Bk;l.emoji=Gk;l.nanoid=Jk;l.cuid=Wk;l.cuid2=Kk;l.ulid=Hk;l.xid=Yk;l.ksuid=Xk;l.ipv4=Qk;l.mac=eP;l.ipv6=tP;l.cidrv4=nP;l.cidrv6=rP;l.base64=iP;l.base64url=aP;l.e164=oP;l.creditCard=sP;l.jwt=uP;l.stringFormat=cP;l.hostname=lP;l.hex=dP;l.hash=pP;l.number=Hd;l.int=gs;l.float32=fP;l.float64=mP;l.int32=gP;l.uint32=hP;l.boolean=Yd;l.bigint=_P;l.int64=vP;l.uint64=yP;l.symbol=bP;l.undefined=wP;l.null=Xd;l.any=$P;l.unknown=Sr;l.never=_s;l.void=zP;l.date=IP;l.array=Ja;l.keyof=SP;l.object=OP;l.strictObject=kP;l.looseObject=PP;l.union=vs;l.xor=jP;l.discriminatedUnion=TP;l.intersection=Qd;l.tuple=ep;l.record=tp;l.partialRecord=AP;l.looseRecord=xP;l.map=EP;l.set=DP;l.enum=ys;l.nativeEnum=NP;l.literal=CP;l.file=MP;l.transform=bs;l.optional=Fa;l.exactOptional=np;l.nullable=Ba;l.nullish=RP;l._default=rp;l.prefault=ip;l.nonoptional=ap;l.success=UP;l.catch=op;l.nan=ZP;l.pipe=hs;l.codec=qP;l.invertCodec=LP;l.readonly=sp;l.templateLiteral=VP;l.lazy=up;l.promise=FP;l._function=Wa;l.function=Wa;l._function=Wa;l.function=Wa;l.check=BP;l.custom=GP;l.refine=cp;l.superRefine=lp;l.instanceof=JP;l.json=KP;l.preprocess=HP;var f=Ga(nt()),ce=nt(),se=Ga(Vr()),ms=qr(),Ck=Nk(Ko()),ae=Ga(Za()),gt=Ga(fs());function Mk(){f.globalConfig.localeError||f.config((0,Ck.default)())}function ur(){f.globalConfig.memoizer||f.config({memoizer:f.memoizer()})}l.ZodType=f.$constructor("ZodType",(e,t)=>(Mk(),f.$ZodType.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ce.util.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return f.clone(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cp(e,t))},superRefine(e,t){return this.check(lp(e,t))},overwrite(e){return this.check(ae.overwrite(e))},optional(){return Fa(this)},exactOptional(){return np(this)},nullable(){return Ba(this)},nullish(){return Fa(Ba(this))},nonoptional(e){return ap(this,e)},array(){return Ja(this)},or(e){return vs([this,e])},and(e){return Qd(this,e)},transform(e){return hs(this,bs(e))},default(e){return rp(this,e)},prefault(e){return ip(this,e)},catch(e){return op(this,e)},pipe(e){return hs(this,e)},readonly(){return sp(this)},describe(e){let t=this.clone();return f.globalRegistry.add(t,{description:e}),t},meta(...e){if(e.length===0)return f.globalRegistry.get(this);let t=this.clone();return f.globalRegistry.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ce.util.hide(this,"~standard",{...f.standardProps(this),jsonSchema:{input:(0,ms.createStandardJSONSchemaMethod)(this,"input"),output:(0,ms.createStandardJSONSchemaMethod)(this,"output")}})},set"~standard"(e){ce.util.own(this,"~standard",e)},parse:function e(t,r){return gt.parse(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await gt.parseAsync(this,t,r,{callee:e})},safeParse(e,t){return gt.safeParse(this,e,t)},async safeParseAsync(e,t){return gt.safeParseAsync(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ce.util.own(this,"spa",e)},encode:function e(t,r){return gt.encode(this,t,r,{callee:e})},decode:function e(t,r){return gt.decode(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await gt.encodeAsync(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await gt.decodeAsync(this,t,r,{callee:e})},safeEncode(e,t){return gt.safeEncode(this,e,t)},safeDecode(e,t){return gt.safeDecode(this,e,t)},async safeEncodeAsync(e,t){return gt.safeEncodeAsync(this,e,t)},async safeDecodeAsync(e,t){return gt.safeDecodeAsync(this,e,t)},toJSONSchema(e){return(0,ms.createToJSONSchemaMethod)(this,{})(e)},get description(){return f.globalRegistry.get(this)?.description},get _def(){return this._zod.def}});l._ZodString=f.$constructor("_ZodString",(e,t)=>{f.$ZodString.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.stringProcessor(e,i,n,a);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null},{regex(...e){return this.check(ae.regex(...e))},includes(...e){return this.check(ae.includes(...e))},startsWith(...e){return this.check(ae.startsWith(...e))},endsWith(...e){return this.check(ae.endsWith(...e))},min(...e){return this.check(ae.minLength(...e))},max(...e){return this.check(ae.maxLength(...e))},length(...e){return this.check(ae.length(...e))},nonempty(...e){return this.check(ae.minLength(1,...e))},lowercase(e){return this.check(ae.lowercase(e))},uppercase(e){return this.check(ae.uppercase(e))},trim(){return this.check(ae.trim())},normalize(...e){return this.check(ae.normalize(...e))},toLowerCase(){return this.check(ae.toLowerCase())},toUpperCase(){return this.check(ae.toUpperCase())},slugify(){return this.check(ae.slugify())}});l.ZodString=f.$constructor("ZodString",(e,t)=>{f.$ZodString.init(e,t),l._ZodString.init(e,t)},{email(e){return this.check(f._email(l.ZodEmail,e))},url(e){return this.check(f._url(l.ZodURL,e))},jwt(e){return this.check(f._jwt(l.ZodJWT,e))},emoji(e){return this.check(f._emoji(l.ZodEmoji,e))},guid(e){return this.check(f._guid(l.ZodGUID,e))},uuid(e){return this.check(f._uuid(l.ZodUUID,e))},uuidv4(e){return this.check(f._uuidv4(l.ZodUUID,e))},uuidv6(e){return this.check(f._uuidv6(l.ZodUUID,e))},uuidv7(e){return this.check(f._uuidv7(l.ZodUUID,e))},nanoid(e){return this.check(f._nanoid(l.ZodNanoID,e))},cuid(e){return this.check(f._cuid(l.ZodCUID,e))},cuid2(e){return this.check(f._cuid2(l.ZodCUID2,e))},ulid(e){return this.check(f._ulid(l.ZodULID,e))},base64(e){return this.check(f._base64(l.ZodBase64,e))},base64url(e){return this.check(f._base64url(l.ZodBase64URL,e))},xid(e){return this.check(f._xid(l.ZodXID,e))},ksuid(e){return this.check(f._ksuid(l.ZodKSUID,e))},ipv4(e){return this.check(f._ipv4(l.ZodIPv4,e))},ipv6(e){return this.check(f._ipv6(l.ZodIPv6,e))},cidrv4(e){return this.check(f._cidrv4(l.ZodCIDRv4,e))},cidrv6(e){return this.check(f._cidrv6(l.ZodCIDRv6,e))},e164(e){return this.check(f._e164(l.ZodE164,e))},datetime(e){return this.check(f._isoDateTime(l.ZodISODateTime,e))},date(e){return this.check(f._isoDate(l.ZodISODate,e))},time(e){return this.check(f._isoTime(l.ZodISOTime,e))},duration(e){return this.check(f._isoDuration(l.ZodISODuration,e))}});function Va(e){return f._string(l.ZodString,e)}l.ZodStringFormat=f.$constructor("ZodStringFormat",(e,t)=>{f.$ZodStringFormat.init(e,t),l._ZodString.init(e,t)});l.ZodISODateTime=f.$constructor("ZodISODateTime",(e,t)=>{f.$ZodISODateTime.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodISODate=f.$constructor("ZodISODate",(e,t)=>{f.$ZodISODate.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodISOTime=f.$constructor("ZodISOTime",(e,t)=>{f.$ZodISOTime.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodISODuration=f.$constructor("ZodISODuration",(e,t)=>{f.$ZodISODuration.init(e,t),l.ZodStringFormat.init(e,t)});l.ZodEmail=f.$constructor("ZodEmail",(e,t)=>{f.$ZodEmail.init(e,t),l.ZodStringFormat.init(e,t)});function Rk(e){return f._email(l.ZodEmail,e)}l.ZodGUID=f.$constructor("ZodGUID",(e,t)=>{f.$ZodGUID.init(e,t),l.ZodStringFormat.init(e,t)});function Uk(e){return f._guid(l.ZodGUID,e)}l.ZodUUID=f.$constructor("ZodUUID",(e,t)=>{f.$ZodUUID.init(e,t),l.ZodStringFormat.init(e,t)});function Zk(e){return f._uuid(l.ZodUUID,e)}function qk(e){return f._uuidv4(l.ZodUUID,e)}function Lk(e){return f._uuidv6(l.ZodUUID,e)}function Vk(e){return f._uuidv7(l.ZodUUID,e)}l.ZodURL=f.$constructor("ZodURL",(e,t)=>{f.$ZodURL.init(e,t),l.ZodStringFormat.init(e,t)});function Fk(e){return f._url(l.ZodURL,e)}function Bk(e){return f._url(l.ZodURL,{protocol:f.regexes.httpProtocol,hostname:f.regexes.domain,...ce.util.normalizeParams(e)})}l.ZodEmoji=f.$constructor("ZodEmoji",(e,t)=>{f.$ZodEmoji.init(e,t),l.ZodStringFormat.init(e,t)});function Gk(e){return f._emoji(l.ZodEmoji,e)}l.ZodNanoID=f.$constructor("ZodNanoID",(e,t)=>{f.$ZodNanoID.init(e,t),l.ZodStringFormat.init(e,t)});function Jk(e){return f._nanoid(l.ZodNanoID,e)}l.ZodCUID=f.$constructor("ZodCUID",(e,t)=>{f.$ZodCUID.init(e,t),l.ZodStringFormat.init(e,t)});function Wk(e){return f._cuid(l.ZodCUID,e)}l.ZodCUID2=f.$constructor("ZodCUID2",(e,t)=>{f.$ZodCUID2.init(e,t),l.ZodStringFormat.init(e,t)});function Kk(e){return f._cuid2(l.ZodCUID2,e)}l.ZodULID=f.$constructor("ZodULID",(e,t)=>{f.$ZodULID.init(e,t),l.ZodStringFormat.init(e,t)});function Hk(e){return f._ulid(l.ZodULID,e)}l.ZodXID=f.$constructor("ZodXID",(e,t)=>{f.$ZodXID.init(e,t),l.ZodStringFormat.init(e,t)});function Yk(e){return f._xid(l.ZodXID,e)}l.ZodKSUID=f.$constructor("ZodKSUID",(e,t)=>{f.$ZodKSUID.init(e,t),l.ZodStringFormat.init(e,t)});function Xk(e){return f._ksuid(l.ZodKSUID,e)}l.ZodIPv4=f.$constructor("ZodIPv4",(e,t)=>{f.$ZodIPv4.init(e,t),l.ZodStringFormat.init(e,t)});function Qk(e){return f._ipv4(l.ZodIPv4,e)}l.ZodMAC=f.$constructor("ZodMAC",(e,t)=>{f.$ZodMAC.init(e,t),l.ZodStringFormat.init(e,t)});function eP(e){return f._mac(l.ZodMAC,e)}l.ZodIPv6=f.$constructor("ZodIPv6",(e,t)=>{f.$ZodIPv6.init(e,t),l.ZodStringFormat.init(e,t)});function tP(e){return f._ipv6(l.ZodIPv6,e)}l.ZodCIDRv4=f.$constructor("ZodCIDRv4",(e,t)=>{f.$ZodCIDRv4.init(e,t),l.ZodStringFormat.init(e,t)});function nP(e){return f._cidrv4(l.ZodCIDRv4,e)}l.ZodCIDRv6=f.$constructor("ZodCIDRv6",(e,t)=>{f.$ZodCIDRv6.init(e,t),l.ZodStringFormat.init(e,t)});function rP(e){return f._cidrv6(l.ZodCIDRv6,e)}l.ZodBase64=f.$constructor("ZodBase64",(e,t)=>{f.$ZodBase64.init(e,t),l.ZodStringFormat.init(e,t)});function iP(e){return f._base64(l.ZodBase64,e)}l.ZodBase64URL=f.$constructor("ZodBase64URL",(e,t)=>{f.$ZodBase64URL.init(e,t),l.ZodStringFormat.init(e,t)});function aP(e){return f._base64url(l.ZodBase64URL,e)}l.ZodE164=f.$constructor("ZodE164",(e,t)=>{f.$ZodE164.init(e,t),l.ZodStringFormat.init(e,t)});function oP(e){return f._e164(l.ZodE164,e)}l.ZodCreditCard=f.$constructor("ZodCreditCard",(e,t)=>{f.$ZodCreditCard.init(e,t),l.ZodStringFormat.init(e,t)});function sP(e){return f._creditCard(l.ZodCreditCard,e)}l.ZodJWT=f.$constructor("ZodJWT",(e,t)=>{f.$ZodJWT.init(e,t),l.ZodStringFormat.init(e,t)});function uP(e){return f._jwt(l.ZodJWT,e)}l.ZodCustomStringFormat=f.$constructor("ZodCustomStringFormat",(e,t)=>{f.$ZodCustomStringFormat.init(e,t),l.ZodStringFormat.init(e,t)});function cP(e,t,r={}){return f._stringFormat(l.ZodCustomStringFormat,e,t,r)}function lP(e){return f._stringFormat(l.ZodCustomStringFormat,"hostname",f.regexes.hostname,e)}function dP(e){return f._stringFormat(l.ZodCustomStringFormat,"hex",f.regexes.hex,e)}function pP(e,t){let r=t?.enc??"hex",i=`${e}_${r}`,n=f.regexes[i];if(!n)throw new Error(`Unrecognized hash format: ${i}`);return f._stringFormat(l.ZodCustomStringFormat,i,n,t)}l.ZodNumber=f.$constructor("ZodNumber",(e,t)=>{f.$ZodNumber.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.numberProcessor(e,i,n,a);let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null},{gt(e,t){return this.check(ae.gt(e,t))},gte(e,t){return this.check(ae.gte(e,t))},min(e,t){return this.check(ae.gte(e,t))},lt(e,t){return this.check(ae.lt(e,t))},lte(e,t){return this.check(ae.lte(e,t))},max(e,t){return this.check(ae.lte(e,t))},int(e){return this.check(gs(e))},safe(e){return this.check(gs(e))},positive(e){return this.check(ae.gt(0,e))},nonnegative(e){return this.check(ae.gte(0,e))},negative(e){return this.check(ae.lt(0,e))},nonpositive(e){return this.check(ae.lte(0,e))},multipleOf(e,t){return this.check(ae.multipleOf(e,t))},step(e,t){return this.check(ae.multipleOf(e,t))},finite(){return this}});function Hd(e){return f._number(l.ZodNumber,e)}l.ZodNumberFormat=f.$constructor("ZodNumberFormat",(e,t)=>{f.$ZodNumberFormat.init(e,t),l.ZodNumber.init(e,t)});function gs(e){return f._int(l.ZodNumberFormat,e)}function fP(e){return f._float32(l.ZodNumberFormat,e)}function mP(e){return f._float64(l.ZodNumberFormat,e)}function gP(e){return f._int32(l.ZodNumberFormat,e)}function hP(e){return f._uint32(l.ZodNumberFormat,e)}l.ZodBoolean=f.$constructor("ZodBoolean",(e,t)=>{f.$ZodBoolean.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.booleanProcessor(e,r,i,n)});function Yd(e){return f._boolean(l.ZodBoolean,e)}l.ZodBigInt=f.$constructor("ZodBigInt",(e,t)=>{f.$ZodBigInt.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.bigintProcessor(e,i,n,a);let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null},{gte(e,t){return this.check(ae.gte(e,t))},min(e,t){return this.check(ae.gte(e,t))},gt(e,t){return this.check(ae.gt(e,t))},lt(e,t){return this.check(ae.lt(e,t))},lte(e,t){return this.check(ae.lte(e,t))},max(e,t){return this.check(ae.lte(e,t))},positive(e){return this.check(ae.gt(BigInt(0),e))},negative(e){return this.check(ae.lt(BigInt(0),e))},nonpositive(e){return this.check(ae.lte(BigInt(0),e))},nonnegative(e){return this.check(ae.gte(BigInt(0),e))},multipleOf(e,t){return this.check(ae.multipleOf(e,t))}});function _P(e){return f._bigint(l.ZodBigInt,e)}l.ZodBigIntFormat=f.$constructor("ZodBigIntFormat",(e,t)=>{f.$ZodBigIntFormat.init(e,t),l.ZodBigInt.init(e,t)});function vP(e){return f._int64(l.ZodBigIntFormat,e)}function yP(e){return f._uint64(l.ZodBigIntFormat,e)}l.ZodSymbol=f.$constructor("ZodSymbol",(e,t)=>{f.$ZodSymbol.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.symbolProcessor(e,r,i,n)});function bP(e){return f._symbol(l.ZodSymbol,e)}l.ZodUndefined=f.$constructor("ZodUndefined",(e,t)=>{f.$ZodUndefined.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.undefinedProcessor(e,r,i,n)});function wP(e){return f._undefined(l.ZodUndefined,e)}l.ZodNull=f.$constructor("ZodNull",(e,t)=>{f.$ZodNull.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nullProcessor(e,r,i,n)});function Xd(e){return f._null(l.ZodNull,e)}l.ZodAny=f.$constructor("ZodAny",(e,t)=>{f.$ZodAny.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.anyProcessor(e,r,i,n)});function $P(){return f._any(l.ZodAny)}l.ZodUnknown=f.$constructor("ZodUnknown",(e,t)=>{f.$ZodUnknown.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.unknownProcessor(e,r,i,n)});function Sr(){return f._unknown(l.ZodUnknown)}l.ZodNever=f.$constructor("ZodNever",(e,t)=>{f.$ZodNever.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.neverProcessor(e,r,i,n)});function _s(e){return f._never(l.ZodNever,e)}l.ZodVoid=f.$constructor("ZodVoid",(e,t)=>{f.$ZodVoid.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.voidProcessor(e,r,i,n)});function zP(e){return f._void(l.ZodVoid,e)}l.ZodDate=f.$constructor("ZodDate",(e,t)=>{f.$ZodDate.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.dateProcessor(e,i,n,a),e.min=(i,n)=>e.check(ae.gte(i,n)),e.max=(i,n)=>e.check(ae.lte(i,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function IP(e){return f._date(l.ZodDate,e)}l.ZodArray=f.$constructor("ZodArray",(e,t)=>{ur(),f.$ZodArray.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.arrayProcessor(e,r,i,n),e.element=t.element},{min(e,t){return this.check(ae.minLength(e,t))},nonempty(e){return this.check(ae.minLength(1,e))},max(e,t){return this.check(ae.maxLength(e,t))},length(e,t){return this.check(ae.length(e,t))},unwrap(){return this.element}});function Ja(e,t){return f._array(l.ZodArray,e,t)}function SP(e){let t=e._zod.def.shape;return ys(Object.keys(t))}l.ZodObject=f.$constructor("ZodObject",(e,t)=>{ur(),f.$ZodObjectJIT.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.objectProcessor(e,r,i,n),ce.util.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ys(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Sr()})},loose(){return this.clone({...this._zod.def,catchall:Sr()})},strict(){return this.clone({...this._zod.def,catchall:_s()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ce.util.extend(this,e)},safeExtend(e){return ce.util.safeExtend(this,e)},merge(e){return ce.util.merge(this,e)},pick(e){return ce.util.pick(this,e)},omit(e){return ce.util.omit(this,e)},partial(...e){return ce.util.partial(l.ZodOptional,this,e[0])},exactPartial(...e){return ce.util.partial(l.ZodExactOptional,this,e[0],"exactPartial")},required(...e){return ce.util.required(l.ZodNonOptional,this,e[0])}});function OP(e,t){let r={type:"object",shape:e??{},...ce.util.normalizeParams(t)};return new l.ZodObject(r)}function kP(e,t){return new l.ZodObject({type:"object",shape:e,catchall:_s(),...ce.util.normalizeParams(t)})}function PP(e,t){return new l.ZodObject({type:"object",shape:e,catchall:Sr(),...ce.util.normalizeParams(t)})}l.ZodUnion=f.$constructor("ZodUnion",(e,t)=>{f.$ZodUnion.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.unionProcessor(e,r,i,n),e.options=t.options});function vs(e,t){return new l.ZodUnion({type:"union",options:e,...ce.util.normalizeParams(t)})}l.ZodXor=f.$constructor("ZodXor",(e,t)=>{l.ZodUnion.init(e,t),f.$ZodXor.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.unionProcessor(e,r,i,n),e.options=t.options});function jP(e,t){return new l.ZodXor({type:"union",options:e,inclusive:!1,...ce.util.normalizeParams(t)})}l.ZodDiscriminatedUnion=f.$constructor("ZodDiscriminatedUnion",(e,t)=>{l.ZodUnion.init(e,t),f.$ZodDiscriminatedUnion.init(e,t)});function TP(e,t,r){return new l.ZodDiscriminatedUnion({type:"union",options:t,discriminator:e,...ce.util.normalizeParams(r)})}l.ZodIntersection=f.$constructor("ZodIntersection",(e,t)=>{f.$ZodIntersection.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.intersectionProcessor(e,r,i,n)});function Qd(e,t){return new l.ZodIntersection({type:"intersection",left:e,right:t})}l.ZodTuple=f.$constructor("ZodTuple",(e,t)=>{ur(),f.$ZodTuple.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.tupleProcessor(e,r,i,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new l.ZodOptional({type:"optional",innerType:t}))})}});function ep(e,t,r){let i=t instanceof f.$ZodType,n=i?r:t,a=i?t:null;return new l.ZodTuple({type:"tuple",items:e,rest:a,...ce.util.normalizeParams(n)})}l.ZodRecord=f.$constructor("ZodRecord",(e,t)=>{ur(),f.$ZodRecord.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.recordProcessor(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType});function tp(e,t,r){return!t||!t._zod?new l.ZodRecord({type:"record",keyType:Va(),valueType:e,...ce.util.normalizeParams(t)}):new l.ZodRecord({type:"record",keyType:e,valueType:t,...ce.util.normalizeParams(r)})}function AP(e,t,r){return new l.ZodRecord({type:"record",keyType:e,valueType:t,...ce.util.normalizeParams(r),partial:!0})}function xP(e,t,r){return new l.ZodRecord({type:"record",keyType:e,valueType:t,mode:"loose",...ce.util.normalizeParams(r)})}l.ZodMap=f.$constructor("ZodMap",(e,t)=>{ur(),f.$ZodMap.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.mapProcessor(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(f._minSize(...r)),e.nonempty=r=>e.check(f._minSize(1,r)),e.max=(...r)=>e.check(f._maxSize(...r)),e.size=(...r)=>e.check(f._size(...r))});function EP(e,t,r){return new l.ZodMap({type:"map",keyType:e,valueType:t,...ce.util.normalizeParams(r)})}l.ZodSet=f.$constructor("ZodSet",(e,t)=>{ur(),f.$ZodSet.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.setProcessor(e,r,i,n),e.min=(...r)=>e.check(f._minSize(...r)),e.nonempty=r=>e.check(f._minSize(1,r)),e.max=(...r)=>e.check(f._maxSize(...r)),e.size=(...r)=>e.check(f._size(...r))});function DP(e,t){return new l.ZodSet({type:"set",valueType:e,...ce.util.normalizeParams(t)})}l.ZodEnum=f.$constructor("ZodEnum",(e,t)=>{f.$ZodEnum.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(i,n,a)=>se.enumProcessor(e,i,n,a),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(i,n)=>{let a={};for(let o of i)if(r.has(o))a[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new l.ZodEnum({...t,checks:[],...ce.util.normalizeParams(n),entries:a})},e.exclude=(i,n)=>{let a={...t.entries};for(let o of i)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new l.ZodEnum({...t,checks:[],...ce.util.normalizeParams(n),entries:a})}});function ys(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new l.ZodEnum({type:"enum",entries:r,...ce.util.normalizeParams(t)})}function NP(e,t){return new l.ZodEnum({type:"enum",entries:e,...ce.util.normalizeParams(t)})}l.ZodLiteral=f.$constructor("ZodLiteral",(e,t)=>{f.$ZodLiteral.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.literalProcessor(e,r,i,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function CP(e,t){return new l.ZodLiteral({type:"literal",values:Array.isArray(e)?e:[e],...ce.util.normalizeParams(t)})}l.ZodFile=f.$constructor("ZodFile",(e,t)=>{f.$ZodFile.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.fileProcessor(e,r,i,n),e.min=(r,i)=>e.check(f._minSize(r,i)),e.max=(r,i)=>e.check(f._maxSize(r,i)),e.mime=(r,i)=>e.check(f._mime(Array.isArray(r)?r:[r],i))});function MP(e){return f._file(l.ZodFile,e)}l.ZodTransform=f.$constructor("ZodTransform",(e,t)=>{ur(),f.$ZodTransform.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.transformProcessor(e,r,i,n),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new f.$ZodEncodeError(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(ce.util.issue(a,r.value,t));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=r.value),o.inst??(o.inst=e),r.issues.push(ce.util.issue(o))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(a=>(r.value=a,r)):(r.value=n,r)}});function bs(e){return new l.ZodTransform({type:"transform",transform:e})}l.ZodOptional=f.$constructor("ZodOptional",(e,t)=>{f.$ZodOptional.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.optionalProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Fa(e){return new l.ZodOptional({type:"optional",innerType:e})}l.ZodExactOptional=f.$constructor("ZodExactOptional",(e,t)=>{f.$ZodExactOptional.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.optionalProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function np(e){return new l.ZodExactOptional({type:"optional",innerType:e})}l.ZodNullable=f.$constructor("ZodNullable",(e,t)=>{f.$ZodNullable.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nullableProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Ba(e){return new l.ZodNullable({type:"nullable",innerType:e})}function RP(e){return Fa(Ba(e))}l.ZodDefault=f.$constructor("ZodDefault",(e,t)=>{f.$ZodDefault.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.defaultProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rp(e,t){return new l.ZodDefault({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.util.shallowClone(t)}})}l.ZodPrefault=f.$constructor("ZodPrefault",(e,t)=>{f.$ZodPrefault.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.prefaultProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function ip(e,t){return new l.ZodPrefault({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.util.shallowClone(t)}})}l.ZodNonOptional=f.$constructor("ZodNonOptional",(e,t)=>{f.$ZodNonOptional.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nonoptionalProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function ap(e,t){return new l.ZodNonOptional({type:"nonoptional",innerType:e,...ce.util.normalizeParams(t)})}l.ZodSuccess=f.$constructor("ZodSuccess",(e,t)=>{f.$ZodSuccess.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.successProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function UP(e){return new l.ZodSuccess({type:"success",innerType:e})}l.ZodCatch=f.$constructor("ZodCatch",(e,t)=>{f.$ZodCatch.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.catchProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function op(e,t){return new l.ZodCatch({type:"catch",innerType:e,catchValue:typeof t=="function"?t:f.util.constantCatch(t)})}l.ZodNaN=f.$constructor("ZodNaN",(e,t)=>{f.$ZodNaN.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.nanProcessor(e,r,i,n)});function ZP(e){return f._nan(l.ZodNaN,e)}l.ZodPipe=f.$constructor("ZodPipe",(e,t)=>{f.$ZodPipe.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.pipeProcessor(e,r,i,n),e.in=t.in,e.out=t.out});function hs(e,t){return new l.ZodPipe({type:"pipe",in:e,out:t})}l.ZodCodec=f.$constructor("ZodCodec",(e,t)=>{l.ZodPipe.init(e,t),f.$ZodCodec.init(e,t)});function qP(e,t,r){return new l.ZodCodec({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function LP(e){let t=e._zod.def;return new l.ZodCodec({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}l.ZodPreprocess=f.$constructor("ZodPreprocess",(e,t)=>{l.ZodPipe.init(e,t),f.$ZodPreprocess.init(e,t)});l.ZodReadonly=f.$constructor("ZodReadonly",(e,t)=>{f.$ZodReadonly.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.readonlyProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function sp(e){return new l.ZodReadonly({type:"readonly",innerType:e})}l.ZodTemplateLiteral=f.$constructor("ZodTemplateLiteral",(e,t)=>{f.$ZodTemplateLiteral.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.templateLiteralProcessor(e,r,i,n)});function VP(e,t){return new l.ZodTemplateLiteral({type:"template_literal",parts:e,...ce.util.normalizeParams(t)})}l.ZodLazy=f.$constructor("ZodLazy",(e,t)=>{f.$ZodLazy.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.lazyProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.getter()});function up(e){return new l.ZodLazy({type:"lazy",getter:e})}l.ZodPromise=f.$constructor("ZodPromise",(e,t)=>{f.$ZodPromise.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.promiseProcessor(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function FP(e){return new l.ZodPromise({type:"promise",innerType:e})}l.ZodFunction=f.$constructor("ZodFunction",(e,t)=>{f.$ZodFunction.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.functionProcessor(e,r,i,n)});function Wa(e){return new l.ZodFunction({type:"function",input:Array.isArray(e?.input)?ep(e?.input):e?.input??Ja(Sr()),output:e?.output??Sr()})}l.ZodCustom=f.$constructor("ZodCustom",(e,t)=>{f.$ZodCustom.init(e,t),l.ZodType.init(e,t),e._zod.processJSONSchema=(r,i,n)=>se.customProcessor(e,r,i,n)});function BP(e){let t=new f.$ZodCheck({check:"custom"});return t._zod.check=e,t}function GP(e,t){return f._custom(l.ZodCustom,e??(()=>!0),t)}function cp(e,t={}){return f._refine(l.ZodCustom,e,t)}function lp(e,t){return f._superRefine(e,t)}l.describe=f.describe;l.meta=f.meta;function JP(e,t={}){let r=new l.ZodCustom({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...ce.util.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:r,path:[...r._zod.def.path??[]]})},r}var WP=(...e)=>f._stringbool({Codec:l.ZodCodec,Boolean:l.ZodBoolean,String:l.ZodString},...e);l.stringbool=WP;function KP(e){let t=up(()=>vs([Va(e),Hd(),Yd(),Xd(),Ja(t),tp(Va(),t)]));return t}function HP(e,t){return new l.ZodPreprocess({type:"pipe",in:bs(e),out:t})}});var mp=j(Ze=>{"use strict";var YP=Ze&&Ze.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),XP=Ze&&Ze.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),QP=Ze&&Ze.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&YP(t,e,r);return XP(t,e),t};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ZodFirstPartyTypeKind=Ze.config=Ze.$brand=Ze.ZodIssueCode=void 0;Ze.setErrorMap=ej;Ze.getErrorMap=tj;var pp=QP(nt());Ze.ZodIssueCode={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var fp=nt();Object.defineProperty(Ze,"$brand",{enumerable:!0,get:function(){return fp.$brand}});Object.defineProperty(Ze,"config",{enumerable:!0,get:function(){return fp.config}});function ej(e){pp.config({customError:e})}function tj(){return pp.config().customError}var dp;dp||(Ze.ZodFirstPartyTypeKind=dp={})});var Xa=j(Re=>{"use strict";var nj=Re&&Re.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),rj=Re&&Re.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ij=Re&&Re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nj(t,e,r);return rj(t,e),t};Object.defineProperty(Re,"__esModule",{value:!0});Re.ZodISOTime=Re.ZodISODuration=Re.ZodISODateTime=Re.ZodISODate=void 0;Re.datetime=aj;Re.date=oj;Re.time=sj;Re.duration=uj;var Ka=ij(nt()),Ha=Hn(),Ya=Hn();Object.defineProperty(Re,"ZodISODate",{enumerable:!0,get:function(){return Ya.ZodISODate}});Object.defineProperty(Re,"ZodISODateTime",{enumerable:!0,get:function(){return Ya.ZodISODateTime}});Object.defineProperty(Re,"ZodISODuration",{enumerable:!0,get:function(){return Ya.ZodISODuration}});Object.defineProperty(Re,"ZodISOTime",{enumerable:!0,get:function(){return Ya.ZodISOTime}});function aj(e){return Ka._isoDateTime(Ha.ZodISODateTime,e)}function oj(e){return Ka._isoDate(Ha.ZodISODate,e)}function sj(e){return Ka._isoTime(Ha.ZodISOTime,e)}function uj(e){return Ka._isoDuration(Ha.ZodISODuration,e)}});var vp=j(Cn=>{"use strict";var cj=Cn&&Cn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),lj=Cn&&Cn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$s=Cn&&Cn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cj(t,e,r);return lj(t,e),t};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.fromJSONSchema=wj;var dj=Mr(),ws=Z(),pj=$s(Za()),fj=$s(Xa()),mj=$s(Hn()),B={...mj,...pj,iso:fj},gj=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function hj(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function gp(e,t){return e.map((r,i)=>i<t?r:r.optional())}function _j(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function vj(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===i){let n=r[1]===void 0?void 0:_j(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function yj(e,t){return B.transform(i=>i).check(i=>{let n=i.value;if(!(typeof n!="object"||n===null||Array.isArray(n)))for(let a of Object.getOwnPropertyNames(n)){let o=t.safeParse(a);o.success||i.issues.push({code:"invalid_key",origin:"record",issues:o.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function hp(e,t){if(e!==!1)return e===void 0||e===!0?B.any():rt(e,t)}var bj=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function _p(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return B.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return B.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let a=vj(n,t),o=rt(a,t);return t.refs.set(n,o),t.processing.delete(n),o}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return B.null();if(n.length===0)return B.never();if(n.length===1)return B.literal(n[0]);if(n.every(o=>typeof o=="string"))return B.enum(n);let a=n.map(o=>B.literal(o));return a.length<2?a[0]:B.union([a[0],a[1],...a.slice(2)])}if(e.const!==void 0)return B.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(a=>{let o={...e,type:a};return _p(o,t)});return n.length===0?B.never():n.length===1?n[0]:B.union(n)}if(!r)return B.any();let i;switch(r){case"string":{let n=B.string();if(e.format){let a=e.format;a==="email"?n=n.check(B.email()):a==="uri"||a==="uri-reference"?n=n.check(B.url()):a==="uuid"||a==="guid"?n=n.check(B.uuid()):a==="date-time"?n=n.check(B.iso.datetime({offset:!0})):a==="date"?n=n.check(B.iso.date()):a==="time"?n=n.check(B.regex(bj)):a==="duration"?n=n.check(B.iso.duration()):a==="hostname"?n=n.check(B.hostname()):a==="ipv4"?n=n.check(B.ipv4()):a==="ipv6"?n=n.check(B.ipv6()):a==="mac"?n=n.check(B.mac()):a==="cidr"?n=n.check(B.cidrv4()):a==="cidr-v6"?n=n.check(B.cidrv6()):a==="base64"?n=n.check(B.base64()):a==="base64url"?n=n.check(B.base64url()):a==="e164"?n=n.check(B.e164()):a==="credit_card"?n=n.check(B.creditCard()):a==="jwt"?n=n.check(B.jwt()):a==="emoji"?n=n.check(B.emoji()):a==="nanoid"?n=n.check(B.nanoid()):a==="cuid"?n=n.check(B.cuid()):a==="cuid2"?n=n.check(B.cuid2()):a==="ulid"?n=n.check(B.ulid()):a==="xid"?n=n.check(B.xid()):a==="ksuid"&&(n=n.check(B.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),i=n;break}case"number":case"integer":{let n=r==="integer"?B.number().int():B.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),i=n;break}case"boolean":{i=B.boolean();break}case"null":{i=B.null();break}case"object":{let n={},a=e.properties||{},o=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?rt(e.additionalProperties,t):void 0;for(let[c,d]of Object.entries(a)){let p=rt(d,t);(0,ws.assignProp)(n,c,o.has(c)?p:p.optional())}if(e.patternProperties){let c=e.patternProperties,d=Object.keys(c),p=[];for(let b of d){let w=rt(c[b],t),z=B.string().regex(new RegExp(b));p.push(B.looseRecord(z,w))}let _=[];if(Object.keys(n).length>0&&_.push(B.object(n).passthrough()),_.push(...p),_.length===0)i=B.object({}).passthrough();else if(_.length===1)i=_[0];else{let b=B.intersection(_[0],_[1]);for(let w=2;w<_.length;w++)b=B.intersection(b,_[w]);i=b}if(e.additionalProperties===!1){let b=Object.keys(n),w=d.map(N=>new RegExp(N)),z=i;i=i.check(N=>{if(!(0,ws.isPlainObject)(N.value))return;let q=[];for(let _e of Object.keys(N.value))b.includes(_e)||w.some(Y=>Y.test(_e))||q.push(_e);q.length&&N.issues.push({code:"unrecognized_keys",keys:q,input:N.value,inst:z})})}}else{let c=B.object(n);e.additionalProperties===!1?i=c.strict():s?i=c.catchall(s):i=c.passthrough()}if(e.propertyNames!==void 0&&e.propertyNames!==!0){let c=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;i=yj(i,rt(c,t))}break}case"array":{let n=e.prefixItems,a=e.items;if(n&&Array.isArray(n)){let o=typeof e.minItems=="number"?e.minItems:0,s=n.map(_=>rt(_,t)),c=gp(s,o),d=Array.isArray(a)?void 0:hp(a,t),p=B.tuple(c);i=d?p.rest(d):p,typeof e.minItems=="number"&&(i=i.check(B.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(B.maxLength(e.maxItems)))}else if(Array.isArray(a)){let o=typeof e.minItems=="number"?e.minItems:0,s=a.map(_=>rt(_,t)),c=gp(s,o),d=hp(e.additionalItems,t),p=B.tuple(c);i=d?p.rest(d):p,typeof e.minItems=="number"&&(i=i.check(B.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(B.maxLength(e.maxItems)))}else if(a!==void 0){let o=rt(a,t),s=B.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),i=s}else i=B.array(B.any());break}default:throw new Error(`Unsupported type: ${r}`)}return i}function rt(e,t){if(typeof e=="boolean")return e?B.any():B.never();let r=_p(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(d=>rt(d,t)),c=B.union(s);r=i?B.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(d=>rt(d,t)),c=B.xor(s);r=i?B.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=i?r:B.any();else{let s=i?r:rt(e.allOf[0],t),c=i?0:1;for(let d=c;d<e.allOf.length;d++)s=B.intersection(s,rt(e.allOf[d],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=B.nullable(r)),e.readOnly===!0&&(r=B.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},a=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of a)s in e&&(n[s]=e[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in e&&(n[s]=e[s]);e.propertyNames!==void 0&&e.type==="object"&&e.$ref===void 0&&(n.propertyNames=e.propertyNames);for(let s of Object.keys(e))gj.has(s)||(0,ws.assignProp)(n,s,e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function wj(e,t){if(typeof e=="boolean")return e?B.any():B.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=hj(r,t?.defaultTarget),n=r.$defs||r.definitions||{},a={version:i,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??dj.globalRegistry};return rt(r,a)}});var zs=j(Mn=>{"use strict";var $j=Mn&&Mn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),zj=Mn&&Mn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Ij=Mn&&Mn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&$j(t,e,r);return zj(t,e),t};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.visit=Oj;var Sj=Ij(Nr()),yt=Z(),yp=Symbol("z.visit/resolving");function Oj(e,t){let r=typeof t=="function"?t:(o,s)=>{let c=t[o._zod.def.type];return c?c(o,s):o},i=new Map;function n(o){let s=i.get(o);if(s===yp)return new Sj.$ZodLazy({type:"lazy",getter:()=>i.get(o)});if(s!==void 0)return s;i.set(o,yp);let c=a(o),d=r(c,c!==o);return i.set(o,d),d}function a(o){let s=o._zod.def,c=s.type;switch(c){case"object":{let d=s.shape,p=Object.keys(d),_=!1,b={};for(let z of p){let N=n(d[z]);N!==d[z]&&(_=!0),b[z]=N}let w=s.catchall;return s.catchall&&(w=n(s.catchall),w!==s.catchall&&(_=!0)),_?(0,yt.clone)(o,{...s,shape:b,catchall:w}):o}case"array":{let d=n(s.element);return d===s.element?o:(0,yt.clone)(o,{...s,element:d})}case"tuple":{let d=s.items,p=!1,_=[];for(let w of d){let z=n(w);z!==w&&(p=!0),_.push(z)}let b=s.rest;return s.rest&&(b=n(s.rest),b!==s.rest&&(p=!0)),p?(0,yt.clone)(o,{...s,items:_,rest:b}):o}case"record":case"map":{let d=n(s.keyType),p=n(s.valueType);return d===s.keyType&&p===s.valueType?o:(0,yt.clone)(o,{...s,keyType:d,valueType:p})}case"set":{let d=n(s.valueType);return d===s.valueType?o:(0,yt.clone)(o,{...s,valueType:d})}case"union":{let d=s.options,p=!1,_=[];for(let b of d){let w=n(b);w!==b&&(p=!0),_.push(w)}return p?(0,yt.clone)(o,{...s,options:_}):o}case"intersection":{let d=n(s.left),p=n(s.right);return d===s.left&&p===s.right?o:(0,yt.clone)(o,{...s,left:d,right:p})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let d=n(s.innerType);return d===s.innerType?o:(0,yt.clone)(o,{...s,innerType:d})}case"pipe":{let d=n(s.in),p=n(s.out);return d===s.in&&p===s.out?o:(0,yt.clone)(o,{...s,in:d,out:p})}case"function":{let d=n(s.input),p=n(s.output);return d===s.input&&p===s.output?o:(0,yt.clone)(o,{...s,input:d,output:p})}case"lazy":{let d=s.getter,{_cachedInner:p,..._}=s;return(0,yt.clone)(o,{..._,getter:()=>n(d())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return n(e)}});var bp=j(Rn=>{"use strict";var kj=Rn&&Rn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Pj=Rn&&Rn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),jj=Rn&&Rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kj(t,e,r);return Pj(t,e),t};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.deepPartial=xj;var Tj=zs(),Aj=jj(Hn());function xj(e){return(0,Tj.visit)(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:Aj.union(r.options)}})}});var Ip=j(Tn=>{"use strict";var Ej=Tn&&Tn.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Dj=Tn&&Tn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Nj=Tn&&Tn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ej(t,e,r);return Dj(t,e),t};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.input=Uj;Tn.output=Zj;var wp=Z(),$p=zs(),Cj=Nj(Hn());function Mj(e,t){if(!t?.length)return e;let r=e._zod.def;return(0,wp.clone)(e,(0,wp.mergeDefs)(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function zp(e){return Mj(e.out,e.checks)}function Rj(e){return e.in._zod.traits.has("$ZodTransform")?zp(e):e.in}function Uj(e){return(0,$p.visit)(e,{pipe:t=>Rj(t._zod.def),default:(t,r)=>r?Cj.optional(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function Zj(e){return(0,$p.visit)(e,{pipe:t=>zp(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}});var Op=j(ut=>{"use strict";var qj=ut&&ut.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Lj=ut&&ut.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Sp=ut&&ut.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qj(t,e,r);return Lj(t,e),t};Object.defineProperty(ut,"__esModule",{value:!0});ut.string=Vj;ut.number=Fj;ut.boolean=Bj;ut.bigint=Gj;ut.date=Jj;var Fr=Sp(nt()),Br=Sp(Hn());function Vj(e){return Fr._coercedString(Br.ZodString,e)}function Fj(e){return Fr._coercedNumber(Br.ZodNumber,e)}function Bj(e){return Fr._coercedBoolean(Br.ZodBoolean,e)}function Gj(e){return Fr._coercedBigint(Br.ZodBigInt,e)}function Jj(e){return Fr._coercedDate(Br.ZodDate,e)}});var Is=j(R=>{"use strict";var kp=R&&R.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Wj=R&&R.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Qa=R&&R.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&kp(t,e,r);return Wj(t,e),t},Gr=R&&R.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&kp(t,e,r)};Object.defineProperty(R,"__esModule",{value:!0});R.coerce=R.iso=R.ZodISODuration=R.ZodISOTime=R.ZodISODate=R.ZodISODateTime=R.locales=R.output=R.input=R.deepPartial=R.fromJSONSchema=R.toJSONSchema=R.getDiscriminatedOption=R.ZodCompileUnsupportedError=R.ZodCompileAsyncError=R.compile=R.toZod=R.NEVER=R.util=R.TimePrecision=R.flattenError=R.formatError=R.prettifyError=R.treeifyError=R.regexes=R.clone=R.$brand=R.$input=R.$output=R.memoizer=R.config=R.registry=R.globalRegistry=R.core=void 0;R.core=Qa(nt());Gr(Hn(),R);Gr(Za(),R);Gr(ps(),R);Gr(fs(),R);Gr(mp(),R);var Ne=nt();Object.defineProperty(R,"globalRegistry",{enumerable:!0,get:function(){return Ne.globalRegistry}});Object.defineProperty(R,"registry",{enumerable:!0,get:function(){return Ne.registry}});Object.defineProperty(R,"config",{enumerable:!0,get:function(){return Ne.config}});Object.defineProperty(R,"memoizer",{enumerable:!0,get:function(){return Ne.memoizer}});Object.defineProperty(R,"$output",{enumerable:!0,get:function(){return Ne.$output}});Object.defineProperty(R,"$input",{enumerable:!0,get:function(){return Ne.$input}});Object.defineProperty(R,"$brand",{enumerable:!0,get:function(){return Ne.$brand}});Object.defineProperty(R,"clone",{enumerable:!0,get:function(){return Ne.clone}});Object.defineProperty(R,"regexes",{enumerable:!0,get:function(){return Ne.regexes}});Object.defineProperty(R,"treeifyError",{enumerable:!0,get:function(){return Ne.treeifyError}});Object.defineProperty(R,"prettifyError",{enumerable:!0,get:function(){return Ne.prettifyError}});Object.defineProperty(R,"formatError",{enumerable:!0,get:function(){return Ne.formatError}});Object.defineProperty(R,"flattenError",{enumerable:!0,get:function(){return Ne.flattenError}});Object.defineProperty(R,"TimePrecision",{enumerable:!0,get:function(){return Ne.TimePrecision}});Object.defineProperty(R,"util",{enumerable:!0,get:function(){return Ne.util}});Object.defineProperty(R,"NEVER",{enumerable:!0,get:function(){return Ne.NEVER}});Object.defineProperty(R,"toZod",{enumerable:!0,get:function(){return Ne.toZod}});Object.defineProperty(R,"compile",{enumerable:!0,get:function(){return Ne.compile}});Object.defineProperty(R,"ZodCompileAsyncError",{enumerable:!0,get:function(){return Ne.ZodCompileAsyncError}});Object.defineProperty(R,"ZodCompileUnsupportedError",{enumerable:!0,get:function(){return Ne.ZodCompileUnsupportedError}});Object.defineProperty(R,"getDiscriminatedOption",{enumerable:!0,get:function(){return Ne.getDiscriminatedOption}});var Kj=Vr();Object.defineProperty(R,"toJSONSchema",{enumerable:!0,get:function(){return Kj.toJSONSchema}});var Hj=vp();Object.defineProperty(R,"fromJSONSchema",{enumerable:!0,get:function(){return Hj.fromJSONSchema}});var Yj=bp();Object.defineProperty(R,"deepPartial",{enumerable:!0,get:function(){return Yj.deepPartial}});var Pp=Ip();Object.defineProperty(R,"input",{enumerable:!0,get:function(){return Pp.input}});Object.defineProperty(R,"output",{enumerable:!0,get:function(){return Pp.output}});R.locales=Qa(Xo());var eo=Xa();Object.defineProperty(R,"ZodISODateTime",{enumerable:!0,get:function(){return eo.ZodISODateTime}});Object.defineProperty(R,"ZodISODate",{enumerable:!0,get:function(){return eo.ZodISODate}});Object.defineProperty(R,"ZodISOTime",{enumerable:!0,get:function(){return eo.ZodISOTime}});Object.defineProperty(R,"ZodISODuration",{enumerable:!0,get:function(){return eo.ZodISODuration}});R.iso=Qa(Xa());R.coerce=Qa(Op())});var Je=j(Xe=>{"use strict";var jp=Xe&&Xe.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),Xj=Xe&&Xe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Qj=Xe&&Xe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jp(t,e,r);return Xj(t,e),t},eT=Xe&&Xe.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&jp(t,e,r)};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.default=Xe.z=void 0;var Tp=Qj(Is());Xe.z=Tp;Xe.default=Tp;eT(Is(),Xe)});var it=j(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.apiMetadata=void 0;Or.apiMetadataOf=nT;var tT=Je(),Ss=class extends tT.z.core.$ZodRegistry{owners=new Map;add(t,r){if(r.id!==void 0){if(this.owners.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this.owners.set(r.id,t)}return super.add(t,r)}remove(t){let r=this.get(t)?.id;return r!==void 0&&this.owners.get(r)===t&&this.owners.delete(r),super.remove(t)}clear(){return this.owners.clear(),super.clear()}};Or.apiMetadata=new Ss;function nT(e){return Or.apiMetadata.get(e)}});var ks=j(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.FINANCIAL_RUNTIME_PATH_PREFIX=We.FINANCIAL_RUNTIME_ROUTES=void 0;We.isFinancialRuntimeRequestId=rT;We.financialRuntimeRoutePath=iT;We.financialRuntimeRoute=Os;We.financialRuntimeBodyMismatch=aT;We.nativeAgentFinancialRuntimeAction=oT;function rT(e){return typeof e=="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}var to=["requestId","operationId","agentId","runtimeId","connectorKeyId","grantId","grantVersion","intentHash","issuedAtSec","identitySlip","connectorProof","leaseConnectorProof","signingInput"];We.FINANCIAL_RUNTIME_ROUTES={"device-context":{fields:["requestId","agentId"],id:"requestId",clients:"auth",variants:[["requestId","agentId","runtimeId"]]},"device-handoff-create":{fields:["requestId","proposal","ceremony"],id:"requestId",clients:"auth",variants:[["requestId","proposal","requestPop"]]},"device-handoff-read":{fields:["requestId","proposal"],id:"requestId",clients:"both"},"device-handoff-proof":{fields:["requestId","proposal","childPop"],id:"requestId",clients:"auth"},"device-handoff-prepare":{fields:["requestId","proposal","ownerSession"],id:"requestId",clients:"web",variants:[["requestId","proposal","ownerSession","instrumentId"],["requestId","proposal","ownerSession","instrumentId","certificateExpiresAt"]]},"device-handoff-signatures":{fields:["requestId","proposal","ownerSession","certificate","delegation"],id:"requestId",clients:"web",variants:[["requestId","proposal","ownerSession","certificate"]]},"device-handoff-activate":{fields:["requestId","proposal","ownerSession"],id:"requestId",clients:"web"},"device-prepare":{fields:["ownerSession","requestId","associationId","runtimeId","publicJwk"],id:"requestId",clients:"web"},"device-activate":{fields:["ownerSession","requestId","certificate","delegation","childPop"],id:"requestId",clients:"web"},"device-renew-prepare":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"device-renew-activate":{fields:["ownerSession","requestId","certificate","delegation"],id:"requestId",clients:"web"},lookup:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},pause:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},resume:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"revoke-agent":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"teardown-claim":{fields:["ownerSession","requestId"],id:"requestId",clients:"web"},"teardown-confirm":{fields:["ownerSession","requestId","teardownIds"],id:"requestId",clients:"web"},history:{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},prepare:{fields:["ownerSession","requestId","associationId","custody"],id:"requestId",clients:"web",variants:[["ownerSession","requestId","associationId","custody","runtimeId"]]},"tempo-pay":{fields:["requestId","runtimeId","requestPop","request","intent"],variants:[["requestId","runtimeId","requestPop","request","intent","ownerApproval"],["requestId","runtimeId","requestPop","request","intent","purchaseKey"],["requestId","runtimeId","requestPop","request","intent","ownerApproval","purchaseKey"],["requestId","runtimeId","requestPop","request","intent","merchantUrl"],["requestId","runtimeId","requestPop","request","intent","ownerApproval","merchantUrl"],["requestId","runtimeId","requestPop","request","intent","purchaseKey","merchantUrl"],["requestId","runtimeId","requestPop","request","intent","ownerApproval","purchaseKey","merchantUrl"]],id:"requestId",clients:"auth"},"tempo-history":{fields:["requestId","runtimeId","requestPop","limit"],id:"requestId",clients:"auth"},"tempo-report":{fields:["requestId","runtimeId","requestPop","outcome","txHash"],id:"requestId",clients:"auth"},"tempo-attempt":{fields:["requestId","runtimeId","requestPop","attemptRequestId"],id:"requestId",clients:"auth"},"tempo-context":{nativeAgentOperation:"agent.financialRuntime.context",fields:["requestId","agentId","runtimeId"],id:"requestId",clients:"auth"},"atum-sign":{fields:["requestId","runtimeId","requestPop","request","intent"],variants:[["requestId","runtimeId","requestPop","request","intent","ownerApproval"]],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.sign"},"atum-operation":{fields:["requestId","runtimeId","requestPop","operationRequestId"],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.operation"},"atum-confirm":{fields:["requestId","runtimeId","requestPop","operationRequestId","transactionHash"],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.confirm"},"atum-settle":{fields:["requestId","runtimeId","requestPop","settlement"],id:"requestId",clients:"auth",nativeAgentOperation:"agent.financialRuntime.settle"},"tempo-wallets":{fields:["ownerSession"],id:"correlation",clients:"web",variants:[["ownerSession","keysOnly"]]},"tempo-status":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"tempo-disable":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"tempo-retire-ungranted":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"tempo-cleanup-confirm":{fields:["ownerSession","requestId","accessKeyAddress"],id:"requestId",clients:"web"},"tempo-limit-confirm":{fields:["ownerSession","requestId","agentId","txHash"],id:"requestId",clients:"web"},"tempo-limit-intent":{fields:["ownerSession","requestId","agentId","txHash","raw"],id:"requestId",clients:"web"},"tempo-enroll-prepare":{fields:["ownerSession","requestId","agentId","accessKeyAddress"],id:"requestId",clients:"web"},"tempo-enroll-finish":{fields:["ownerSession","requestId","agentId","accountAddress","accessKeyAddress","accessKeyPublicKey","turnkeyPrivateKeyId","tokenAddress","limitMicros","periodSeconds","expiresAtSeconds","authorizationTxHash"],id:"requestId",clients:"web"},"tempo-hosted-autonomous":{fields:[...to,"terms","request"],variants:[[...to,"terms","request","hostedTap"]],id:"requestId",clients:"none"},"tempo-hosted-context":{fields:["requestId","agentId","runtimeId"],variants:[["requestId","agentId","runtimeId","terms"]],id:"requestId",clients:"none"},"tempo-hosted-prepare":{fields:["requestId","operationId","agentId","runtimeId","terms","request"],id:"requestId",clients:"none"},"tempo-hosted-status":{fields:["requestId","agentId","runtimeId"],id:"requestId",clients:"none"},"tempo-hosted-approved":{fields:["requestId","operationId","agentId","runtimeId","terms","request","ownerApproval"],variants:[[...to,"terms","request","ownerApproval","hostedTap"]],id:"requestId",clients:"none"},"card-hosted-context":{fields:["requestId","agentId","runtimeId"],id:"requestId",clients:"none"},"card-hosted-presence":{fields:[...to],id:"requestId",clients:"none"},"card-hosted-status":{fields:["ownerSession","agentId"],id:"agentId",clients:"web"},"card-hosted-setup":{fields:["ownerSession","requestId","agentId","instrumentId","certificateExpiresAt"],variants:[["ownerSession","requestId","agentId","instrumentId","certificateExpiresAt","signerRequestId"]],id:"requestId",clients:"web"},"card-hosted-activate":{fields:["ownerSession","requestId","certificate"],id:"requestId",clients:"web"},"tempo-connector-autonomy":{fields:["ownerSession","requestId","agentId","statement"],id:"requestId",clients:"web"}};We.FINANCIAL_RUNTIME_PATH_PREFIX="/v1/financial-runtime/";function iT(e){return We.FINANCIAL_RUNTIME_PATH_PREFIX+e}function Os(e){return Object.hasOwn(We.FINANCIAL_RUNTIME_ROUTES,e)?We.FINANCIAL_RUNTIME_ROUTES[e]:null}function aT(e,t){let r=Os(e);if(!r)return`unknown financial-runtime action "${e}"`;if(!t||typeof t!="object"||Array.isArray(t))return`financial-runtime "${e}" body must be an object`;let i=Object.keys(t).sort(),n=[...r.fields].sort();if([n,...(r.variants??[]).map(c=>[...c].sort())].some(c=>c.join(",")===i.join(",")))return null;let o=n.filter(c=>!i.includes(c)),s=i.filter(c=>!n.includes(c));return`financial-runtime "${e}" body`+(o.length?` is missing ${o.join(", ")}`:"")+(o.length&&s.length?" and":"")+(s.length?` carries unexpected ${s.join(", ")}`:"")}function oT(e){if(!e.startsWith(We.FINANCIAL_RUNTIME_PATH_PREFIX))return null;let t=e.slice(We.FINANCIAL_RUNTIME_PATH_PREFIX.length);return Os(t)?.nativeAgentOperation?t:null}});var Un=j(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.AGENT_AUTH=Qe.CSRF_HEADER=Qe.FAMILY_PREFIX=Qe.PRODUCT_FAMILIES=void 0;Qe.defineOperations=sT;Qe.openApiPath=uT;Qe.pathParams=cT;Qe.operationPathMatchesFamily=lT;var Ap=ks();Qe.PRODUCT_FAMILIES=["owner","agent"];Qe.FAMILY_PREFIX={owner:"/owner/v1/",agent:"/agent/v1/",admin:"/admin/v1/",mcp:"/mcp",oauth:"/oauth/","well-known":"/.well-known/",public:"/"};Qe.CSRF_HEADER="X-CSRF-Token";Qe.AGENT_AUTH=["agent_signature","agent_token","oauth_token","app_token"];function sT(e){return e}function uT(e){return e.replace(/:([A-Za-z][A-Za-z0-9_]*)/g,"{$1}")}function cT(e){return[...e.matchAll(/:([A-Za-z][A-Za-z0-9_]*)/g)].map(t=>t[1])}function lT(e){if(e.path.startsWith(Qe.FAMILY_PREFIX[e.family]))return!0;let t=(0,Ap.nativeAgentFinancialRuntimeAction)(e.path);return e.family==="agent"&&e.method==="POST"&&t!==null&&(0,Ap.financialRuntimeRoute)(t)?.nativeAgentOperation===e.id}});var ct=j(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.OwnerStatusWordSchema=I.OWNER_STATUS_WORDS=I.PaymentMoney=I.PaymentFacts=I.EVIDENCE_QUALITY=I.Attempt=I.ProviderEvidence=I.ATTEMPT_CLOSED_EVIDENCE=I.ATTEMPT_STATES=I.ATTEMPT_KINDS=I.PAYMENT_TERMINAL_STATES=I.PAYMENT_STATES=I.Operation=I.OwnerAction=I.WithdrawalTerms=I.TokenRef=I.OperationStep=I.OPERATION_TERMINAL_STATES=I.OPERATION_STEP_STATES=I.OPERATION_STATES=I.FINANCIAL_OPERATION_KINDS=I.OPERATION_STEP_ACTIONS=I.DEVICE_APPROVER_ACTIONS=I.OPERATION_KINDS=I.Readiness=I.Continuation=I.RetryOrExpiry=I.ACTORS=I.CapabilitySchema=I.CAPABILITIES=I.ReadinessLevelSchema=I.READINESS_LADDER=I.PageQuery=I.Page=I.Surface=I.SURFACES=I.Rail=I.RAILS=I.Amount=I.Asset=I.ASSETS=I.Micros=I.Timestamp=I.Id=void 0;I.ownerStatusWord=pT;var C=Je(),Q=it();I.Id=C.z.string().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/).clone().register(Q.apiMetadata,{id:"Id",description:"An opaque identifier: 1\u2013128 ASCII characters, starting alphanumeric, then alphanumeric or . _ : -"});I.Timestamp=C.z.iso.datetime({offset:!1}).clone().register(Q.apiMetadata,{id:"Timestamp",description:"An RFC 3339 timestamp in UTC, with the `Z` designator."});I.Micros=C.z.string().regex(/^(0|[1-9][0-9]{0,24})$/).clone().register(Q.apiMetadata,{id:"Micros",description:"Integer micros (10\u207B\u2076 of one unit of the asset) as a decimal string."});I.ASSETS=["USD","OUSD","USDC.e"];I.Asset=C.z.enum(I.ASSETS).clone().register(Q.apiMetadata,{id:"Asset",description:"USD is the card rail; OUSD and USDC.e are Tempo stablecoins."});I.Amount=C.z.object({micros:I.Micros,asset:I.Asset}).clone().register(Q.apiMetadata,{id:"Amount",description:"An exact amount of one asset."});I.RAILS=["tempo","card"];I.Rail=C.z.enum(I.RAILS).clone().register(Q.apiMetadata,{id:"Rail",description:'How money moves. A field on payments, approvals and grants, never a path. tempo = Tempo MPP from the owner wallet (owner-facing copy says "wallet"); card = a VIC network credential minted from the owner\u2019s enrolled card.'});I.SURFACES=["laptop","hosted"];I.Surface=C.z.enum(I.SURFACES).clone().register(Q.apiMetadata,{id:"Surface",description:"Where the agent runs. laptop = the Visa CLI and its stdio MCP on a computer the owner controls; hosted = a remote connector (OAuth) or REST app."});I.Page=C.z.object({next_cursor:C.z.string().nullable()}).clone().register(Q.apiMetadata,{id:"Page",description:"Cursor pagination. `next_cursor` is null on the last page."});I.PageQuery=C.z.object({cursor:C.z.string().optional(),limit:C.z.coerce.number().int().min(1).max(100).optional()});I.READINESS_LADDER=["supported","configured","authorized","funded","ready"];I.ReadinessLevelSchema=C.z.enum(I.READINESS_LADDER).clone().register(Q.apiMetadata,{id:"ReadinessLevel",description:"supported: this deployment and host can offer it. configured: its prerequisites exist. authorized: the owner granted it to this agent. funded: money is there to use it. ready: this exact operation can proceed. A rung that does not apply to a capability (identity has no funding) is passed through."});I.CAPABILITIES=["identity","tempo","card","tap","hosted_connection"];I.CapabilitySchema=C.z.enum(I.CAPABILITIES).clone().register(Q.apiMetadata,{id:"Capability"});I.ACTORS=["agent","owner","server","operator"];I.RetryOrExpiry=C.z.discriminatedUnion("kind",[C.z.object({kind:C.z.literal("retry"),after_seconds:C.z.number().int().min(0),until:I.Timestamp.nullable()}),C.z.object({kind:C.z.literal("expires"),at:I.Timestamp}),C.z.object({kind:C.z.literal("none")})]).clone().register(Q.apiMetadata,{id:"RetryOrExpiry",description:"retry: the actor may repeat the same request (same identifiers) after the delay, until the deadline. expires: the step lapses at `at`. none: no timing rule (for example a terminal state)."});I.Continuation=C.z.object({actor:C.z.enum(I.ACTORS),next_action:C.z.string().regex(/^[a-z][a-z0-9_]*$/).clone().register(Q.apiMetadata,{description:"A stable machine code for the next step, for example `approve_payment`."}),message:C.z.string().clone().register(Q.apiMetadata,{description:"One plain sentence for the actor."}),url:C.z.url().nullable().clone().register(Q.apiMetadata,{description:"Where the owner acts, when the actor is the owner."}),retry_or_expiry:I.RetryOrExpiry}).clone().register(Q.apiMetadata,{id:"Continuation",description:"What happens next and who does it. Every non-terminal answer carries one; the server decides it and clients only display it."});I.Readiness=C.z.discriminatedUnion("status",[C.z.object({status:C.z.literal("ready"),capability:I.CapabilitySchema,reached:C.z.literal("ready"),continuation:C.z.null()}),C.z.object({status:C.z.literal("incomplete"),capability:I.CapabilitySchema,reached:C.z.enum(["supported","configured","authorized","funded"]).clone().register(Q.apiMetadata,{description:"The highest rung reached so far."}),continuation:I.Continuation.clone().register(Q.apiMetadata,{description:"Required: who climbs the next rung, and how."})}),C.z.object({status:C.z.literal("unsupported"),capability:I.CapabilitySchema,reached:C.z.null(),continuation:C.z.null()})]).clone().register(Q.apiMetadata,{id:"Readiness",description:"ready: nothing left to do. incomplete: a continuation is always given. unsupported: not offered on this deployment or host."});I.OPERATION_KINDS=["wallet_enable","setup","renewal","revocation_teardown","account_closure","account_recovery","provider_cleanup","withdrawal","telemetry_deletion","chain_limit"];I.DEVICE_APPROVER_ACTIONS=["create_device_approver_guard","create_device_approver_user","create_tempo_signer_guard","create_tempo_signer_user","create_device_approver_policy","update_device_approver_policy"];I.OPERATION_STEP_ACTIONS=["revoke_wallet_key","withdraw_tap_entry","remove_custody_user","remove_device_approver","end_card_mandate","remove_card_instrument","end_connector_tokens","delete_provider_data","delete_telemetry","sign_withdrawal","broadcast_withdrawal","sign_key_authorization","sign_tap_enrollment","sign_hosted_identity","sign_chain_limit","sign_renewal","create_owner_wallet","create_owner_identity_root",...I.DEVICE_APPROVER_ACTIONS];I.FINANCIAL_OPERATION_KINDS=["withdrawal"];I.OPERATION_STATES=["pending","running","needs_owner_action","succeeded","failed","cancelled"];I.OPERATION_STEP_STATES=["pending","running","done","failed","skipped"];I.OPERATION_TERMINAL_STATES=["succeeded","failed","cancelled"];I.OperationStep=C.z.object({action:C.z.enum(I.OPERATION_STEP_ACTIONS),state:C.z.enum(I.OPERATION_STEP_STATES),effect:C.z.enum(["removal","owner_signed"]).clone().register(Q.apiMetadata,{description:"removal: revoke or delete only. owner_signed: needs the owner\u2019s signature."}),executor:C.z.enum(["server","owner"]).clone().register(Q.apiMetadata,{description:"server: a removal-only step the server finishes under a narrow delegated permission (revoke, delete). owner: a step that needs the owner\u2019s own signature (P3)."}),external_refs:C.z.array(C.z.object({system:C.z.string(),ref:C.z.string()})).clone().register(Q.apiMetadata,{description:"Transaction hashes and provider ids."}),completed_at:I.Timestamp.nullable(),evidence:C.z.string().nullable().clone().register(Q.apiMetadata,{description:"Verified completion evidence; telemetry alone never counts."})}).clone().register(Q.apiMetadata,{id:"OperationStep"});I.TokenRef=C.z.discriminatedUnion("kind",[C.z.object({kind:C.z.literal("supported"),asset:C.z.enum(["OUSD","USDC.e"])}),C.z.object({kind:C.z.literal("other"),contract_address:C.z.string().regex(/^0x[0-9a-fA-F]{40}$/).clone().register(Q.apiMetadata,{description:"Any other token the wallet holds (unsupported or sent by mistake)."})})]).clone().register(Q.apiMetadata,{id:"TokenRef"});I.WithdrawalTerms=C.z.object({chain_id:C.z.number().int(),to_address:C.z.string().regex(/^0x[0-9a-fA-F]{40}$/),token:I.TokenRef,amount_base_units:C.z.string().regex(/^(0|[1-9][0-9]{0,77})$/).clone().register(Q.apiMetadata,{description:"Exact amount in the token\u2019s own base units, so sub-micro dust is representable."})}).clone().register(Q.apiMetadata,{id:"WithdrawalTerms",description:"The immutable terms of one withdrawal, fixed when the operation is recorded (before any signature or broadcast)."});I.OwnerAction=C.z.object({action:C.z.enum(["sign_withdrawal","sign_key_authorization","sign_tap_enrollment","sign_hosted_identity","sign_chain_limit","sign_renewal","create_owner_wallet","create_owner_identity_root","revoke_wallet_key","remove_custody_user","remove_device_approver",...I.DEVICE_APPROVER_ACTIONS,"revoke_wallet_key","remove_custody_user","remove_device_approver"]),challenge_id:I.Id.clone().register(Q.apiMetadata,{description:"Fetch or renew it with owner.operations.challenge."}),expires_at:I.Timestamp}).clone().register(Q.apiMetadata,{id:"OwnerAction",description:"The owner signature an operation is waiting for."});I.Operation=C.z.object({id:I.Id,kind:C.z.enum(I.OPERATION_KINDS),state:C.z.enum(I.OPERATION_STATES),steps:C.z.array(I.OperationStep),withdrawal:I.WithdrawalTerms.nullable().clone().register(Q.apiMetadata,{description:"Set for kind withdrawal: its immutable terms."}),owner_action:I.OwnerAction.nullable().clone().register(Q.apiMetadata,{description:"Set while state is needs_owner_action."}),needs_attention:C.z.boolean().clone().register(Q.apiMetadata,{description:"Stuck, overdue or unsafe: shown to the owner and in the operator view."}),created_at:I.Timestamp,updated_at:I.Timestamp,continuation:I.Continuation.nullable()}).clone().register(Q.apiMetadata,{id:"Operation",description:"Durable multi-step work. Recorded before any external effect, so status and recovery follow the owner across browsers and devices. Spending shutdown never stops withdrawals, export, reconciliation or cleanup."});I.PAYMENT_STATES=["proposed","awaiting_owner","authorized","submitted","unknown","issued","settled","released","refused","declined","expired","failed"];I.PAYMENT_TERMINAL_STATES=["issued","settled","released","refused","declined","expired","failed"];I.ATTEMPT_KINDS=["quote","approval","execution"];I.ATTEMPT_STATES=["open","approved","declined","admitted","credential_issued","signed","submitted","settled","superseded","expired","refused","failed","unknown"];I.ATTEMPT_CLOSED_EVIDENCE=["expired_unsigned","expired_on_chain","provider_void","declined","refused_before_signing","superseded_quote","settled"];I.ProviderEvidence=C.z.object({provider:C.z.literal("turnkey"),organization_id:C.z.string(),activity_id:C.z.string(),fingerprint:C.z.string(),status:C.z.string().clone().register(Q.apiMetadata,{description:"The provider\u2019s own activity status, as last read by the server."}),observed_at:I.Timestamp}).clone().register(Q.apiMetadata,{id:"ProviderEvidence",description:"The durable locator of the provider signing activity for one execution attempt. Recorded when the activity is created and re-read, never trusted from the client."});I.Attempt=C.z.object({id:I.Id,kind:C.z.enum(I.ATTEMPT_KINDS),state:C.z.enum(I.ATTEMPT_STATES),terms:C.z.object({amount:I.Amount,funding_max:I.Amount.clone().register(Q.apiMetadata,{description:"The most of the funding asset it may consume (a swap\u2019s maxIn)."}),fee_ceiling:I.Amount,merchant:C.z.string(),expires_at:I.Timestamp.clone().register(Q.apiMetadata,{description:"Quote validity or the charge\u2019s valid-before."})}).clone().register(Q.apiMetadata,{description:"The exact terms this attempt binds (its terms_hash). Changed terms need fresh consent."}),terms_hash:C.z.string(),wire_request_id:C.z.uuid().nullable().clone().register(Q.apiMetadata,{description:"Execution attempts: the client-chosen execution id (unique), used as the PoP nonce."}),signing_hash:C.z.string().nullable().clone().register(Q.apiMetadata,{description:"The chain signing payload hash: one charge, one attempt (unique)."}),network_ref:C.z.string().nullable().clone().register(Q.apiMetadata,{description:"Transaction hash once known."}),provider_evidence:I.ProviderEvidence.nullable(),admission_expires_at:I.Timestamp.nullable().clone().register(Q.apiMetadata,{description:"A signed admission is honoured by SlipGate for at most 60 seconds after issue."}),closed_evidence:C.z.enum(I.ATTEMPT_CLOSED_EVIDENCE).nullable(),created_at:I.Timestamp}).clone().register(Q.apiMetadata,{id:"Attempt",description:"One quote, approval or execution of a purchase. A replacement quote stays on the same purchase. Another execution requires the previous one closed with evidence that it can no longer execute. An explicit decline is terminal."});I.EVIDENCE_QUALITY=["proven","conservative_max"];I.PaymentFacts=C.z.object({credential_issued_at:I.Timestamp.nullable(),submission_reported_at:I.Timestamp.nullable(),funds_settled_at:I.Timestamp.nullable(),settlement:C.z.object({kind:C.z.literal("merchant_held"),network_ref:C.z.string().regex(/^0x[0-9a-f]{64}$/)}).strict().nullable().clone().register(Q.apiMetadata,{description:"Independently reconciled receive-policy hold: the recorded debit left the wallet but did not reach the merchant. Recovery eligibility depends on the merchant settings; this is never an unpaid retry or a claim authorization. Null means no retained proof of this cause, not delivery."}),delivery:C.z.enum(["none","delivered","unavailable"]).clone().register(Q.apiMetadata,{description:'Merchant delivery, separate from money. `unavailable` is "paid, result unavailable": Visa stores no request or result content, so recovery runs between the agent and the merchant.'})}).clone().register(Q.apiMetadata,{id:"PaymentFacts"});I.PaymentMoney=C.z.object({authorized:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"What the owner (or their grant) authorized."}),may_still_owe:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"Reserved exposure still unresolved."}),moved:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"What actually left the funding source, where known."}),received:I.Amount.nullable().clone().register(Q.apiMetadata,{description:"Refunds or reversals received back."}),fees:I.Amount.nullable(),evidence_quality:C.z.enum(I.EVIDENCE_QUALITY).clone().register(Q.apiMetadata,{description:"proven, or a conservative maximum (as with a swap\u2019s maxIn)."})}).clone().register(Q.apiMetadata,{id:"PaymentMoney"});I.OWNER_STATUS_WORDS=["Pending","Settling","Completed","Card issued","Cancelled","Failed","Needs attention"];I.OwnerStatusWordSchema=C.z.enum(I.OWNER_STATUS_WORDS).clone().register(Q.apiMetadata,{id:"OwnerStatusWord",description:"The only words the owner sees for a payment."});var dT={proposed:"Pending",awaiting_owner:"Pending",authorized:"Pending",issued:"Card issued",submitted:"Settling",settled:"Completed",released:"Cancelled",refused:"Cancelled",declined:"Cancelled",expired:"Cancelled",failed:"Failed",unknown:"Needs attention"};function pT(e){return e.overdue_operation||e.state==="settled"&&e.delivery==="unavailable"?"Needs attention":dT[e.state]}});var no=j(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.ALWAYS_POSSIBLE=Ce.SPENDING_OFF_REFUSALS=Ce.Problem=Ce.ERROR_STAGES=Ce.WIRE_ERROR_FAMILIES=Ce.ERROR_FAMILY_NAMES=Ce.ERROR_FAMILIES=void 0;var Zn=Je(),Ps=it(),fT=ct();Ce.ERROR_FAMILIES={update_required:{kind:"caller",status:426,retryable:!1,message:"This Visa CLI is older than the server accepts. Update the CLI: npm install -g @visa/cli@rc",fix:"Update Visa CLI, restart the agent session, then retry the same request."},setup_required:{kind:"caller",status:401,retryable:!1,message:"This agent is not connected, signed in or set up here.",fix:"Run visa connect (shell) or call the connect tool (MCP) and have the owner finish the browser step; both resume where they left off. Then retry the original request."},owner_approval_required:{kind:"platform",status:403,retryable:!0,message:"The owner must approve this first.",fix:"Show the owner the approval link in the continuation and wait. Then retry the same request with the same identifiers; do not change it or start a new one."},owner_declined:{kind:"platform",status:403,retryable:!1,message:"The owner declined this.",fix:"Stop. Do not retry it automatically. Tell the owner; only if they ask again, start a new request, which asks them again."},agent_inactive:{kind:"platform",status:403,retryable:!1,message:"This agent cannot act: it is paused, revoked or its keys were replaced.",fix:"Do not retry. Ask the owner to check the agent in the Visa Console: they resume a paused agent, or connect a new one."},grant_required:{kind:"platform",status:403,retryable:!1,message:"This agent has no current spending approval.",fix:"Nothing was charged. Ask the owner to approve or renew the agent\u2019s limits in the Visa Console, then retry the same payment once."},limit_reached:{kind:"platform",status:403,retryable:!1,message:"This payment is over a spending limit.",fix:"Nothing was charged. Try a smaller amount or later, or ask the owner to raise the limit. Do not loop, and do not switch agents or payment methods to get around it."},blocked:{kind:"platform",status:403,retryable:!1,message:"Visa refused this request.",fix:"Tell the owner what was refused. Do not retry, and do not switch agents, payment methods or merchants to get around it."},merchant_unsupported:{kind:"caller",status:422,retryable:!1,message:"This merchant cannot be paid this way.",fix:"Nothing was charged. Do not retry it unchanged: pay a merchant that supports this payment, or tell the human."},invalid_request:{kind:"caller",status:400,retryable:!1,message:"Some details in this request were not valid.",fix:"Correct the request and try again. To check an earlier purchase, use its original reference."},not_found:{kind:"caller",status:404,retryable:!1,message:"Visa could not find that for this agent.",fix:"Check the reference and the selected agent. Do not create a replacement because a read found nothing."},expired:{kind:"caller",status:410,retryable:!1,message:"That request expired before it was completed.",fix:"Check the original request\u2019s outcome first, then start a fresh one."},conflict:{kind:"caller",status:409,retryable:!0,message:"An existing request conflicts with this one.",fix:"Check the original request by its reference; if it is still in progress, wait and retry the same request. Do not start a replacement."},outcome_unknown:{kind:"caller",status:202,retryable:!0,message:"The result of this request is not known yet.",fix:"Do not pay again or create a replacement. Read the original purchase, or repeat the request with the same identifiers, until its outcome is known."},unavailable:{kind:"platform",status:503,retryable:!0,message:"Visa, or a service it depends on, did not answer.",fix:"Check whether the original request went through before trying another payment, and retry later. Do not switch agents or payment methods."},not_enabled:{kind:"platform",status:403,retryable:!1,message:"This feature is not available right now.",fix:"Tell Visa support which feature you tried to use. Retrying or signing in again will not turn it on."},local_keystore:{kind:"platform",status:0,retryable:!0,message:"This computer\u2019s key store could not be used, so nothing was signed or sent.",fix:"Ask the owner to fix the key store on this computer (unlock it, restore access or sync the clock), then retry once."},rate_limited:{kind:"caller",status:429,retryable:!0,message:"Too many requests from this caller right now.",fix:"Wait for the Retry-After time (also in retry_after_seconds), then repeat the same request with the same identifiers. Do not switch agents to get around it."},internal_error:{kind:"platform",status:500,retryable:!1,message:"Visa could not complete this request.",fix:"Tell a human, with the request reference. Do not retry a payment automatically."}};Ce.ERROR_FAMILY_NAMES=Object.keys(Ce.ERROR_FAMILIES);Ce.WIRE_ERROR_FAMILIES=Ce.ERROR_FAMILY_NAMES.filter(e=>Ce.ERROR_FAMILIES[e].status!==0);Ce.ERROR_STAGES=["edge","identity","grant","controls","policy","approval","execution","settlement"];Ce.Problem=Zn.z.object({code:Zn.z.enum(Ce.ERROR_FAMILY_NAMES),detail:Zn.z.string().clone().register(Ps.apiMetadata,{description:"The specific check that refused. Diagnostic only."}),stage:Zn.z.enum(Ce.ERROR_STAGES),message:Zn.z.string(),fix:Zn.z.string(),retryable:Zn.z.boolean(),request_id:Zn.z.string(),retry_after_seconds:Zn.z.number().int().min(0).nullable().clone().register(Ps.apiMetadata,{description:"Set with rate_limited (and mirrored in the Retry-After header)."}),continuation:fT.Continuation.nullable()}).clone().register(Ps.apiMetadata,{id:"Problem",description:"The one refusal shape. Branch on `code` only. Money refusals state whether anything was charged in `message`."});Ce.SPENDING_OFF_REFUSALS={operator_kill_switch:{code:"not_enabled",detail:"spending_admission_off"},owner_stop_all:{code:"blocked",detail:"owner_spending_stopped"}};Ce.ALWAYS_POSSIBLE=["invalid_request","rate_limited","unavailable","internal_error"]});var Kr=j(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.NATIVE_FINANCIAL_OPERATIONS=F.NativeFinancialRefusal=F.NativeAtumSettlementResult=F.NativeAtumSignResult=F.NativeAtumApprovalDetail=F.NativeAtumOperationResult=F.NativeAtumOperation=F.NativeTempoContext=F.NativeAtumSettleInput=F.NativeAtumSettlement=F.NativeAtumConfirmInput=F.NativeAtumOperationInput=F.NativeAtumSignPrivateInput=F.NativeAtumSignInput=F.NativeTempoContextInput=F.NativeAtumOwnerTerms=F.NativeAtumSignRequest=F.NativeAtumSigningOperation=F.NativeAtumDeployment=F.NativeAtumFundingPlan=F.NativeAtumFundingTerms=void 0;var h=Je(),je=it(),xp=ks(),mT=Un(),gT=no(),An=h.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),Ae=h.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i),xe=h.z.string().regex(/^0x[0-9a-fA-F]{40}$/),qn=h.z.string().regex(/^0x[0-9a-fA-F]*$/),Wr=h.z.string().regex(/^0x[0-9a-fA-F]{64}$/),bt=h.z.string().regex(/^(0|[1-9][0-9]{0,15})$/),cr=h.z.json().register(je.apiMetadata,{id:"NativeFinancialJson",description:"Original JSON protocol value. No reconstruction, HTTP body capture, logging or telemetry permission."}),ro=h.z.record(h.z.string(),cr),js=h.z.strictObject({to:xe,data:qn,value:h.z.literal("0x0")}),hT=h.z.strictObject({network:h.z.string(),token:xe,recipient:xe,amount:bt}),Up=h.z.strictObject({url:h.z.string(),method:h.z.enum(["GET","POST"]),bodySha256:h.z.string().regex(/^[0-9a-f]{64}$/).nullable()}),_T=h.z.strictObject({token:xe,maxAmountInMicros:bt});F.NativeAtumFundingTerms=h.z.strictObject({v:h.z.literal(1),agentId:Ae,runtimeId:Ae,economicIntentId:h.z.string(),ownerAccount:xe,fundingAccount:xe,sourceNetwork:h.z.literal("eip155:4217"),sourceToken:h.z.literal("0x20c000000000000000000000b9537d11c60e8b50"),sourceCapMicros:bt,approvalFeeCapMicros:bt,ownerTransferFeeCapMicros:bt,maxOwnerDebitMicros:bt,ownerSwap:_T.optional(),merchant:Up,destination:hT}).register(je.apiMetadata,{id:"NativeAtumFundingTerms"});F.NativeAtumFundingPlan=h.z.strictObject({terms:F.NativeAtumFundingTerms,termsHash:h.z.string().regex(/^[0-9a-f]{64}$/),fundedAmountMicros:bt,ownerDebitCapMicros:bt,ownerTransfer:js,ownerCalls:h.z.array(js),permit2Approval:js}).register(je.apiMetadata,{id:"NativeAtumFundingPlan"});F.NativeAtumDeployment=h.z.strictObject({chainId:h.z.literal(4217),escrow:xe,reserver:xe,releaser:xe}).register(je.apiMetadata,{id:"NativeAtumDeployment"});var Jr=h.z.strictObject({chainId:h.z.number(),maxPriorityFeePerGas:qn,maxFeePerGas:qn,gas:qn,calls:h.z.array(h.z.strictObject({to:xe.nullable(),value:qn,data:qn})),accessList:h.z.array(cr),nonceKey:qn,nonce:qn,validBefore:h.z.number().nullable(),validAfter:h.z.number().nullable(),feeToken:xe.nullable(),feePayer:h.z.boolean(),authorizationList:h.z.array(cr),keyAuthorization:cr}),Zp=h.z.strictObject({witness:h.z.strictObject({depositId:Wr,quoteHash:Wr,depositRequestHash:Wr,destinationHash:Wr,depositor:xe,token:xe,amount:bt,feeAmount:bt,reserver:xe,releaser:xe,settler:xe}),signature:qn});F.NativeAtumSigningOperation=h.z.discriminatedUnion("kind",[h.z.strictObject({kind:h.z.literal("prefund"),transaction:Jr}),h.z.strictObject({kind:h.z.literal("permit2_approval"),transaction:Jr}),h.z.strictObject({kind:h.z.literal("permit2_revoke"),transaction:Jr}),h.z.strictObject({kind:h.z.literal("deposit_witness"),deadline:h.z.number(),escrow:xe,reserver:xe,releaser:xe}),h.z.strictObject({kind:h.z.literal("refund"),transaction:Jr,amountMicros:bt}),h.z.strictObject({kind:h.z.literal("escrow_refund"),transaction:Jr,authorization:Zp})]).register(je.apiMetadata,{id:"NativeAtumSigningOperation"});F.NativeAtumSignRequest=h.z.strictObject({deployment:F.NativeAtumDeployment,plan:F.NativeAtumFundingPlan,operation:F.NativeAtumSigningOperation,keyRef:h.z.strictObject({subOrganizationId:h.z.string(),accessKeyAddress:xe})}).register(je.apiMetadata,{id:"NativeAtumSignRequest"});F.NativeAtumOwnerTerms=h.z.strictObject({v:h.z.literal(1),plan:F.NativeAtumFundingPlan,prefundSigningHash:h.z.string().regex(/^[A-Za-z0-9_-]{43}$/),grantId:Ae,grantVersion:h.z.number().int().positive()}).register(je.apiMetadata,{id:"NativeAtumOwnerTerms"});var io=h.z.string().min(1).max(65536);F.NativeTempoContextInput=h.z.strictObject({requestId:Ae,agentId:Ae,runtimeId:Ae}).register(je.apiMetadata,{id:"NativeTempoContextInput"});var qp={requestId:An,runtimeId:An,requestPop:io,request:F.NativeAtumSignRequest,intent:cr.clone().register(je.apiMetadata,{description:"The original signing context, canonical JSON at most 4096 bytes. Transient replay at this existing boundary; not a capture or telemetry request."})};F.NativeAtumSignInput=h.z.strictObject({...qp,approvalOperationId:Ae.clone().register(je.apiMetadata,{description:"Original public approval lookup reference. Never signed owner authorization."}).optional()}).register(je.apiMetadata,{id:"NativeAtumSignInput"});F.NativeAtumSignPrivateInput=h.z.strictObject({...qp,ownerApproval:h.z.strictObject({statement:io,terms:F.NativeAtumOwnerTerms}).optional()}).register(je.apiMetadata,{id:"NativeAtumSignPrivateInput"});F.NativeAtumOperationInput=h.z.strictObject({requestId:An,runtimeId:An,requestPop:io,operationRequestId:An}).register(je.apiMetadata,{id:"NativeAtumOperationInput"});F.NativeAtumConfirmInput=F.NativeAtumOperationInput.extend({transactionHash:Wr}).register(je.apiMetadata,{id:"NativeAtumConfirmInput"});var vT=h.z.object({version:h.z.string(),request_id:h.z.string(),source:h.z.strictObject({asset_identifier:h.z.string(),account:h.z.string()}),destination:h.z.array(h.z.strictObject({asset_identifier:h.z.string(),account:h.z.string()})),fulfillment_amount:h.z.string(),max_source_amount:h.z.string(),quote_deadline:h.z.string(),fulfillment_deadline:h.z.string(),escrow_contract_address:h.z.string(),fulfillment_proxy:h.z.string(),quote_selector:h.z.string(),fulfillment_verifier:h.z.strictObject({account:h.z.string(),endpoint:h.z.string()}),sender_auth:h.z.strictObject({message_scheme:h.z.string(),signed_messages:h.z.array(h.z.strictObject({message:h.z.string(),message_prehash:h.z.string(),signature:h.z.string()}))}),executor:h.z.strictObject({deposit:h.z.literal("settler"),reserve:h.z.literal("settler"),fulfill:h.z.literal("originator")}),presentation:ro.optional()}).catchall(cr),Ep=h.z.strictObject({scheme:h.z.string(),network:h.z.string(),asset:h.z.string(),amount:h.z.string(),payTo:h.z.string(),maxTimeoutSeconds:h.z.number(),extra:ro}),Dp=h.z.strictObject({request:vT,paymentRequired:h.z.strictObject({x402Version:h.z.number(),error:h.z.string().optional(),resource:h.z.strictObject({url:h.z.string(),description:h.z.string().optional(),mimeType:h.z.string().optional(),serviceName:h.z.string().optional(),tags:h.z.array(h.z.string()).optional(),iconUrl:h.z.string().optional()}),accepts:h.z.array(Ep),extensions:ro.optional()}),requirements:Ep,merchantRequest:Up}),yT=h.z.object({version:h.z.string(),scheme:h.z.literal("EIP-3009"),authorization:h.z.strictObject({message:h.z.string(),message_prehash:h.z.string().optional(),signature:h.z.string(),payload:ro.optional()}),fulfillment_quote_json:h.z.string(),evidence:h.z.strictObject({transaction_id:h.z.string(),log_index:h.z.number()})}).catchall(cr);F.NativeAtumSettlement=h.z.union([h.z.strictObject({operationRequestId:An,abort:h.z.literal(!0)}),h.z.strictObject({operationRequestId:An,prepared:Dp,sourceTransactionHash:h.z.string(),refundAuthorization:Zp}),h.z.strictObject({operationRequestId:An,prepared:Dp,sourceTransactionHash:h.z.string(),fulfillment:yT,destinationTransactionHash:h.z.string()})]).register(je.apiMetadata,{id:"NativeAtumSettlement"});F.NativeAtumSettleInput=h.z.strictObject({requestId:An,runtimeId:An,requestPop:io,settlement:F.NativeAtumSettlement}).register(je.apiMetadata,{id:"NativeAtumSettleInput"});var Np={v:h.z.literal(1),available:h.z.boolean(),swapAvailable:h.z.boolean()};F.NativeTempoContext=h.z.union([h.z.strictObject({...Np,enrolled:h.z.literal(!1)}),h.z.strictObject({...Np,enrolled:h.z.literal(!0),paymentMode:h.z.strictObject({mode:h.z.string(),reason:h.z.string(),reasonText:h.z.string()}).nullable(),budget:h.z.strictObject({remainingMicros:h.z.string(),perTransactionMicros:h.z.string(),expiresAt:h.z.string()}).nullable(),accountAddress:xe,accessKeyAddress:xe,accessKeyPublicKey:h.z.string(),subOrganizationId:h.z.string(),tokenAddress:xe,limitMicros:h.z.string().nullable(),periodSeconds:h.z.number(),expiresAtSeconds:h.z.number(),atum:h.z.strictObject({deployment:F.NativeAtumDeployment,forwardAvailable:h.z.boolean()}).optional()})]).register(je.apiMetadata,{id:"NativeTempoContext"});var Cp=h.z.strictObject({blockNumber:h.z.string().nullable(),blockHash:h.z.string().nullable(),timestamp:h.z.number()}),bT=F.NativeAtumFundingTerms.pick({economicIntentId:!0,ownerAccount:!0,fundingAccount:!0,sourceCapMicros:!0,approvalFeeCapMicros:!0,ownerTransferFeeCapMicros:!0,ownerSwap:!0,destination:!0}).extend({planTermsHash:h.z.string(),fundedAmountMicros:h.z.string(),ownerDebitCapMicros:h.z.string()});F.NativeAtumOperation=h.z.strictObject({v:h.z.literal(1),status:h.z.enum(["admitted","signed","refused","indeterminate","confirmed","expired","not_found","failed"]),operationId:Ae,requestId:Ae,requestHash:h.z.string(),purchaseId:Ae,signingHash:h.z.string(),kind:h.z.enum(["prefund","permit2_approval","permit2_revoke","deposit_witness","refund","escrow_refund"]),attempt:h.z.number().int().positive(),reservedMicros:h.z.string(),destination:h.z.strictObject({network:h.z.string(),token:h.z.string(),recipient:h.z.string(),amountBaseUnits:h.z.string()}),signature:h.z.string().optional(),transactionHash:h.z.string().optional(),activity:h.z.strictObject({organizationId:h.z.string(),activityId:h.z.string(),fingerprint:h.z.string(),validBefore:h.z.string(),status:h.z.string()}).optional(),resumable:h.z.boolean().optional(),nonLandingEvidence:h.z.strictObject({kind:h.z.string(),reference:h.z.string().nullable()}).optional(),receipt:h.z.strictObject({blockNumber:h.z.string().nullable().optional(),blockHash:h.z.string().nullable().optional(),sender:h.z.string().nullable().optional(),reverted:h.z.boolean().nullable().optional(),delivered:h.z.boolean().nullable().optional(),feeMicros:h.z.string().nullable().optional(),status:h.z.literal("expired").optional(),anchor:Cp.optional(),finalized:Cp.optional()}).optional(),request:F.NativeAtumSignRequest.optional(),originalAccessKeyPublicKey:h.z.string().optional(),financial:h.z.strictObject({binding:bT,operation:F.NativeAtumSigningOperation}).optional()}).register(je.apiMetadata,{id:"NativeAtumOperation"});var Lp=h.z.strictObject({v:h.z.literal(1),status:h.z.literal("not_found")});F.NativeAtumOperationResult=h.z.union([F.NativeAtumOperation,Lp]).register(je.apiMetadata,{id:"NativeAtumOperationResult"});F.NativeAtumApprovalDetail=h.z.strictObject({v:h.z.literal(1),approvalId:Ae,purchaseId:Ae,agentId:Ae,runtimeId:Ae,terms:F.NativeAtumOwnerTerms,binding:h.z.strictObject({ownerPrincipalId:Ae,associationId:Ae,associationVersion:h.z.number().int().positive(),agentId:Ae,rootJkt:h.z.string().regex(/^[A-Za-z0-9_-]{43}$/),operationId:Ae}),expiresAt:h.z.iso.datetime()}).register(je.apiMetadata,{id:"NativeAtumApprovalDetail",description:"Original native owner review from the authenticated Money reader. approvalId names the existing approval route; purchaseId and binding.operationId name the original purchase. Exact optional review terms are separately deletable and never telemetry or immutable history. The owner resolves the existing named identity root through the authenticated SDK and verifies its JKT against binding.rootJkt; this record is not authorization."});F.NativeAtumSignResult=h.z.union([F.NativeAtumOperation,h.z.strictObject({v:h.z.literal(1),status:h.z.literal("owner_approval_required"),purchaseId:Ae,approvalId:Ae.optional().clone().register(je.apiMetadata,{description:"Original approval route ID, distinct from the purchase lookup reference. Supplied by the canonical native owner approval receiver."}),agentId:Ae,originalRequest:F.NativeAtumSignRequest,expiresAt:h.z.string(),ownerTerms:F.NativeAtumOwnerTerms})]).register(je.apiMetadata,{id:"NativeAtumSignResult"});var Mp=h.z.enum(["OUSD","USDC.e","USD"]),wT=h.z.strictObject({word:h.z.enum(["Pending","Card issued","Settling","Completed","Cancelled","Failed","Needs attention"]),authorizedMicros:h.z.string(),asset:Mp,mayStillOweMicros:h.z.string(),fundingAsset:Mp,debitedMicros:h.z.string().nullable(),feeMicros:h.z.string().nullable(),movedMicros:h.z.string(),movedQuality:h.z.enum(["proven","conservative_max"]).nullable(),refundedMicros:h.z.string(),received:h.z.enum(["none","available","unavailable"]),settlement:h.z.strictObject({kind:h.z.literal("merchant_held"),networkRef:h.z.string()}).nullable()});F.NativeAtumSettlementResult=h.z.union([Lp,h.z.strictObject({v:h.z.literal(1),status:h.z.literal("pending"),purchaseId:Ae}),h.z.strictObject({v:h.z.literal(1),status:h.z.enum(["completed","refunded","not_funded"]),purchaseId:Ae,accounting:wT})]).register(je.apiMetadata,{id:"NativeAtumSettlementResult"});F.NativeFinancialRefusal=h.z.union([h.z.strictObject({code:h.z.enum(gT.WIRE_ERROR_FAMILIES),detail:h.z.string(),retryable:h.z.boolean(),next_action:h.z.string().optional()}),h.z.strictObject({code:h.z.literal("internal_error"),detail:h.z.literal("unexpected")})]).register(je.apiMetadata,{id:"NativeFinancialRefusal"});var Rp={"tempo-context":{body:F.NativeTempoContextInput,response:F.NativeTempoContext,summary:"Read the current laptop Tempo runtime and native ATUM availability"},"atum-sign":{body:F.NativeAtumSignInput,response:F.NativeAtumSignResult,summary:"Admit or resume the original native ATUM signing operation"},"atum-operation":{body:F.NativeAtumOperationInput,response:F.NativeAtumOperationResult,summary:"Read the original admitted native ATUM operation"},"atum-confirm":{body:F.NativeAtumConfirmInput,response:F.NativeAtumOperationResult,summary:"Reconcile a native ATUM operation against its transaction"},"atum-settle":{body:F.NativeAtumSettleInput,response:F.NativeAtumSettlementResult,summary:"Reconcile original native ATUM settlement or cancellation evidence"}};F.NATIVE_FINANCIAL_OPERATIONS=(0,mT.defineOperations)(Object.keys(Rp).map(e=>{let t=e,r=Rp[t];return{id:xp.FINANCIAL_RUNTIME_ROUTES[t].nativeAgentOperation,family:"agent",method:"POST",path:(0,xp.financialRuntimeRoutePath)(t),...r,auth:["agent_token"],errorResponse:F.NativeFinancialRefusal,status:200,idempotency:"request_id",backedBy:"authority",launch:"on",errors:["setup_required","update_required","agent_inactive","invalid_request","blocked","grant_required","limit_reached","owner_approval_required","owner_declined","expired","not_found","conflict","outcome_unknown","not_enabled","unavailable","rate_limited","internal_error"],description:"Existing laptop-only carrier. Auth verifies the current agent token and immutable installation before signed Authority forwarding. Money verifies the original PoP, signed financial meaning and admission/recovery fences. Public paying pause and effective controls remain enforced; declaration does not activate this route. Request/response transport bound: 262144 bytes. Original private context is not telemetry or HTTP capture."}}))});var xs=j(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.OwnerCleanupIntent=xn.OwnerChainRemovalStatement=xn.OwnerRemovalStatement=void 0;var re=Je(),Fp=it(),lt=ct(),kr=re.z.string().regex(/^[A-Za-z0-9_:.-]{1,128}$/),As=re.z.array(kr).min(1).max(50).refine(e=>new Set(e).size===e.length),$T=re.z.discriminatedUnion("kind",[re.z.strictObject({kind:re.z.literal("key"),agent_id:lt.Id,key_id:lt.Id,installation_id:lt.Id,generation:re.z.number().int().positive(),purpose:re.z.enum(["wallet","identity"]),provider_ref:kr}),re.z.strictObject({kind:re.z.literal("approver"),agent_id:lt.Id,approver_id:lt.Id,installation_id:lt.Id,provider_ref:kr})]),Hr={kind:re.z.literal("owner_provider_removal"),intent_id:lt.Id,operation_id:lt.Id,step_no:re.z.number().int().positive(),action:re.z.enum(["revoke_wallet_key","remove_custody_user","remove_device_approver"]),owner_id:lt.Id,organization_id:kr,owner_user_id:kr,security_epoch:re.z.number().int().nonnegative(),created_at:lt.Timestamp,targets:re.z.array($T).min(1).max(50)},Vp=re.z.strictObject({type:re.z.literal("ACTIVITY_TYPE_DELETE_POLICIES"),parameters:re.z.strictObject({policyIds:As})});xn.OwnerRemovalStatement=re.z.discriminatedUnion("phase",[re.z.strictObject({...Hr,phase:re.z.literal("delete_policies"),request:Vp}),re.z.strictObject({...Hr,phase:re.z.literal("delete_users"),request:re.z.strictObject({type:re.z.literal("ACTIVITY_TYPE_DELETE_USERS"),parameters:re.z.strictObject({userIds:As})})}),re.z.strictObject({...Hr,phase:re.z.literal("delete_denies"),request:Vp}),re.z.strictObject({...Hr,phase:re.z.literal("delete_private_keys"),request:re.z.strictObject({type:re.z.literal("ACTIVITY_TYPE_DELETE_PRIVATE_KEYS"),parameters:re.z.strictObject({privateKeyIds:As,deleteWithoutExport:re.z.literal(!0)})})})]).refine(e=>e.action==="remove_device_approver"?e.targets.length===1&&e.targets[0].kind==="approver"&&(e.phase==="delete_users"||e.phase==="delete_denies"):e.targets.every(t=>t.kind==="key"&&t.purpose===(e.action==="revoke_wallet_key"?"wallet":"identity"))&&(e.action!=="revoke_wallet_key"||e.targets.length===1),{message:"removal action and targets must agree"}).refine(e=>new TextEncoder().encode(JSON.stringify(e)).length<=32768,{message:"removal intent exceeds 32 KiB"}).clone().register(Fp.apiMetadata,{id:"OwnerRemovalStatement"});var Ts=re.z.templateLiteral(["0x",re.z.string()]).refine(e=>/^0x[0-9a-f]{40}$/.test(e),{message:"exact lowercase chain address"});xn.OwnerChainRemovalStatement=re.z.strictObject({...Hr,kind:re.z.literal("owner_wallet_revocation"),phase:re.z.literal("revoke_chain_key"),action:re.z.literal("revoke_wallet_key"),targets:re.z.tuple([re.z.strictObject({kind:re.z.literal("key"),agent_id:lt.Id,key_id:lt.Id,installation_id:lt.Id,generation:re.z.number().int().positive(),purpose:re.z.literal("wallet"),provider_ref:kr})]),account:Ts,access_key:Ts,chain_id:re.z.literal(4217),fee_token:Ts}).refine(e=>new TextEncoder().encode(JSON.stringify(e)).length<=32768,{message:"removal intent exceeds 32 KiB"}).clone().register(Fp.apiMetadata,{id:"OwnerChainRemovalStatement"});xn.OwnerCleanupIntent=re.z.union([xn.OwnerRemovalStatement,xn.OwnerChainRemovalStatement])});var Es=j(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.HostedIdentityChallenge=qe.HostedIdentitySubmission=qe.HostedProviderRequest=qe.TapEnrollmentChallenge=qe.TapEnrollmentSubmission=qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES=void 0;var x=Je(),Gp=it(),Bp=ct();qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES=60*1024;var et=x.z.object({body:x.z.string().min(1).max(32768),stamp:x.z.object({stampHeaderName:x.z.string().min(1).max(64),stampHeaderValue:x.z.string().min(1).max(16384)}).strict()}).strict();qe.TapEnrollmentSubmission=x.z.object({method:x.z.literal("tap_enrollment"),request_id:x.z.string().uuid(),owner_whoami:et,proof:x.z.discriminatedUnion("phase",[x.z.object({phase:x.z.literal("authorizations"),owner_authorization:et,gate_authorization:et,delegation:et}).strict(),x.z.object({phase:x.z.literal("root_challenge"),root_challenge:et}).strict()])}).strict().refine(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES,{message:"TAP original submission exceeds the bounded owner envelope"}).clone().register(Gp.apiMetadata,{id:"TapEnrollmentSubmission",description:"The original owner-stamped TAP protocol requests for the final step of the existing setup operation. Every request is checked against its server-prepared input, recorded before relay and independently read back. Unknown delivery never authorizes a new request."});var Yn={request_id:x.z.string().uuid(),organization_id:Bp.Id,root_key_id:Bp.Id},Ln=x.z.string().max(16384).regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/);qe.TapEnrollmentChallenge=x.z.discriminatedUnion("phase",[x.z.object({...Yn,phase:x.z.literal("authorizations"),owner_authorization_signing_input:Ln,gate_authorization_signing_input:Ln,delegation_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}).strict(),x.z.object({...Yn,phase:x.z.literal("root_challenge"),payload_hex:x.z.string().regex(/^[0-9a-f]{64}$/),expires_at:x.z.number().int().nonnegative()}).strict(),x.z.object({request_id:x.z.string().uuid(),phase:x.z.literal("pending"),reason:x.z.enum(["provider_response_unknown","gate_response_unknown","directory_response_unknown","directory_pending","contact_required","authorization_expired"])}).strict()]).clone().register(Gp.apiMetadata,{id:"TapEnrollmentChallenge",description:"Prepared TAP-only inputs for the existing owner setup tap. Provider-aware preflight checks serialized bodies before owner signing; complete original stamps must still pass the submission bound. Pending names an unfinished obligation and has no new signing input. Neither pending nor a missing directory ID proves enrollment, publication or payment readiness."});var zT=x.z.strictObject({policyName:x.z.string().min(1).max(512),effect:x.z.enum(["EFFECT_ALLOW","EFFECT_DENY"]),consensus:x.z.string().min(1).max(16384),condition:x.z.string().min(1).max(16384),notes:x.z.string().max(1024)});qe.HostedProviderRequest=x.z.discriminatedUnion("type",[x.z.strictObject({type:x.z.enum(["ACTIVITY_TYPE_CREATE_USERS_V3","ACTIVITY_TYPE_CREATE_USERS_V4"]),parameters:x.z.strictObject({users:x.z.tuple([x.z.strictObject({userName:x.z.string().min(1).max(256),apiKeys:x.z.tuple([x.z.strictObject({apiKeyName:x.z.string().min(1).max(256),publicKey:x.z.string().regex(/^0[23][0-9a-f]{64}$/),curveType:x.z.literal("API_KEY_CURVE_P256")})]),authenticators:x.z.tuple([]),oauthProviders:x.z.tuple([]),userTags:x.z.tuple([])})])})}),x.z.strictObject({type:x.z.literal("ACTIVITY_TYPE_CREATE_POLICIES"),parameters:x.z.strictObject({policies:x.z.array(zT).min(1).max(2)})})]);qe.HostedIdentitySubmission=x.z.strictObject({method:x.z.literal("hosted_identity"),request_id:x.z.string().uuid(),owner_whoami:et,proof:x.z.discriminatedUnion("phase",[x.z.strictObject({phase:x.z.literal("principal"),principal:et}),x.z.strictObject({phase:x.z.literal("enrollment_authorization"),owner_authorization:et}),x.z.strictObject({phase:x.z.literal("root_challenge"),root_challenge:et}),x.z.strictObject({phase:x.z.literal("runtime_authorizations"),certificate:et,presence_delegation:et,gate_authorization:et,money_delegation:et}),x.z.strictObject({phase:x.z.literal("wallet_policy"),request:et}),x.z.strictObject({phase:x.z.literal("tap_authorization"),tap_delegation:et})])}).refine(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=qe.TAP_ENROLLMENT_SUBMISSION_MAX_BYTES,{message:"Hosted original submission exceeds the bounded owner envelope"});qe.HostedIdentityChallenge=x.z.discriminatedUnion("phase",[x.z.strictObject({...Yn,phase:x.z.literal("principal"),action:x.z.enum(["create_user","create_policies"]),request:qe.HostedProviderRequest}),x.z.strictObject({...Yn,phase:x.z.literal("enrollment_authorization"),authorization_undispatched:x.z.literal(!0).optional(),owner_authorization_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("root_challenge"),payload_hex:x.z.string().regex(/^[0-9a-f]{64}$/),expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("runtime_authorizations"),certificate_signing_input:Ln,presence_delegation_signing_input:Ln,gate_authorization_signing_input:Ln,money_delegation_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("tap_authorization"),tap_delegation_signing_input:Ln,authorization_expires_at:x.z.number().int().nonnegative()}),x.z.strictObject({...Yn,phase:x.z.literal("wallet_policy"),step_no:x.z.union([x.z.literal(4),x.z.literal(5),x.z.literal(6)]),action:x.z.enum(["create_tempo_signer_guard","create_tempo_signer_user","create_device_approver_policy"]),request:qe.HostedProviderRequest}),x.z.strictObject({request_id:x.z.string().uuid(),phase:x.z.literal("pending"),reason:x.z.enum(["provider_response_unknown","gate_response_unknown","authorization_expired"])})])});var Ns=j(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.ChainLimitScope=Vn.ChainLimitUpdate=Vn.ChainLimitStatement=void 0;var $e=Je(),Jp=it(),so=ct(),ao=$e.z.string().regex(/^0x[0-9a-f]{40}$/),Ds=$e.z.string().regex(/^0x[0-9a-f]{64}$/);Vn.ChainLimitStatement=$e.z.strictObject({kind:$e.z.literal("chain_limit"),operation_id:so.Id,key_id:so.Id,chain_id:$e.z.literal(4217),account:ao,access_key_address:ao,tokens:$e.z.tuple([ao,ao]),limit_micros:so.Micros.refine(e=>BigInt(e)>0n),period_seconds:$e.z.literal(604800),fee:$e.z.literal("owner")}).register(Jp.apiMetadata,{id:"ChainLimitStatement"});var oo={agent_id:so.Id,statement:Vn.ChainLimitStatement};Vn.ChainLimitUpdate=$e.z.discriminatedUnion("phase",[$e.z.strictObject({...oo,phase:$e.z.literal("prepared")}),$e.z.strictObject({...oo,phase:$e.z.literal("pending"),signed_tx:$e.z.string().max(4096).regex(/^0x76(?:[0-9a-f]{2})+$/),tx_hash:Ds,valid_before:$e.z.number().int().positive().max(Number.MAX_SAFE_INTEGER)}),$e.z.strictObject({...oo,phase:$e.z.literal("applied"),tx_hash:Ds}),$e.z.strictObject({...oo,phase:$e.z.literal("not_applied"),tx_hash:Ds,reason:$e.z.enum(["missed","reverted"])})]).register(Jp.apiMetadata,{id:"ChainLimitUpdate"});Vn.ChainLimitScope=$e.z.union([$e.z.strictObject({agentId:$e.z.string().uuid(),grantId:$e.z.string().uuid(),version:$e.z.number().int().positive()}),$e.z.strictObject({operationIds:$e.z.array($e.z.string().uuid()).min(1).max(100)})])});var dr=j(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});m.GrantVersion=m.Grant=m.SetupClaimed=m.SetupClaim=m.OwnerSetupStart=m.AgentSetupStarted=m.AgentSetupStart=m.Setup=m.SETUP_STATES=m.SETUP_KINDS=m.GrantRequest=m.GrantTerms=m.GrantMode=m.GRANT_MODES=m.AgentTokenAlreadyCreated=m.AgentTokenCreated=m.AgentToken=m.Device=m.AgentPatch=m.Agent=m.HostedSetupRecovery=m.Installation=m.AGENT_END_REASONS=m.AGENT_LIFECYCLE=m.DeviceApprover=m.APPROVER_STATES=m.KEY_END_REASONS=m.KEY_LIFECYCLE=m.KEY_CUSTODY=m.Owner=m.OWNER_LIFECYCLE_FROM_TODAY=m.OWNER_ACCESS_FROM_TODAY=m.OWNER_LIFECYCLE=m.OWNER_ACCESS=m.Session=m.SessionSigner=m.SignatureResult=m.OwnerPaymentProgress=m.SignatureSubmission=m.Challenge=m.WalletKeyAuthorizationResume=m.WithdrawalTransaction=m.RecordedOwnerCleanupTransaction=m.WalletKeyChainAuthorizationStatement=m.CardCodeStep=m.CardCodeDelivery=m.ApprovalKind=m.APPROVAL_KINDS=m.CHALLENGE_SIGNERS=m.EVIDENCE_METHODS=void 0;m.Timestamp=m.Id=m.ToolDescriptor=m.ClientEvent=m.MerchantResult=m.AgentStatus=m.WalletSigningContext=m.Console=m.Security=m.SpendingState=m.ActivityList=m.ActivityItem=m.CardEnrollmentAlreadyStarted=m.CardEnrollment=m.Card=m.Withdrawal=m.Wallet=m.Approval=m.CardCredential=m.PaymentReport=m.PaymentList=m.Payment=m.SigningExchange=m.PaymentCreate=m.ApprovalReviewDetail=m.OwnerPreparedPayment=m.OriginalHostedPurchaseContext=m.MerchantReceipt=m.RETAINED_PAYMENT_FACTS=m.ATTEMPT_TERMS_FIELDS=m.PURCHASE_IDENTITY_FIELDS=m.RuntimeAuthorization=m.TapSignatureBasePayload=m.POP_INTENT_CLAIM=m.PreparedCharge=m.ApprovalReviewChargeRequest=m.TempoChargeRequestWire=m.PaymentTarget=m.GrantChange=m.GrantHistory=void 0;var Yp=Kr(),u=Je(),v=it(),IT=xs(),Xr=Es(),ST=Ns(),$=ct();Object.defineProperty(m,"Id",{enumerable:!0,get:function(){return $.Id}});Object.defineProperty(m,"Timestamp",{enumerable:!0,get:function(){return $.Timestamp}});m.EVIDENCE_METHODS=["passkey","owner_jws","email_code","owner_session"];m.CHALLENGE_SIGNERS=["passkey","owner_jws","card_otp","transaction","provider_activity","email_code","tap_enrollment","hosted_identity"];m.APPROVAL_KINDS=["setup","grant","payment","connector_autonomy","replacement","account_closure","agent_reissue","spending_activation","autonomy_increase","contact_email"];m.ApprovalKind=u.z.enum(m.APPROVAL_KINDS).clone().register(v.apiMetadata,{id:"ApprovalKind"});m.CardCodeDelivery=u.z.object({identifier:u.z.string().min(1).max(512).clone().register(v.apiMetadata,{description:"Opaque choice id; owner.cards.collect { send_to } sends a new code there."}),method:u.z.string().clone().register(v.apiMetadata,{description:"How the issuer sends the code, for example OTPSMS or OTPEMAIL."}),value:u.z.string().nullable().clone().register(v.apiMetadata,{description:"Where it goes, already masked by the issuer (a\u2022\u2022\u2022@example.com)."})}).clone().register(v.apiMetadata,{id:"CardCodeDelivery"});m.CardCodeStep=u.z.object({delivery:u.z.array(m.CardCodeDelivery),sent_to:u.z.string().nullable().clone().register(v.apiMetadata,{description:"Where the newest code went, as the issuer masked it; null before any code is sent."}),resend_in_seconds:u.z.number().int().min(0).nullable().clone().register(v.apiMetadata,{description:"Seconds before another code may be requested (each new code invalidates the earlier ones)."})}).clone().register(v.apiMetadata,{id:"CardCodeStep"});m.WalletKeyChainAuthorizationStatement=u.z.strictObject({kind:u.z.literal("wallet_key_chain_authorization"),operation_id:$.Id,key_id:$.Id,account:u.z.string().regex(/^0x[0-9a-fA-F]{40}$/),access_key_address:u.z.string().regex(/^0x[0-9a-fA-F]{40}$/),access_key_public_key:u.z.string().regex(/^(?:0x)?(?:0[23][0-9a-fA-F]{64}|04[0-9a-fA-F]{128})$/),limits:u.z.array(u.z.strictObject({token:u.z.string(),micros:u.z.string().regex(/^(?:0|[1-9][0-9]*)$/),period_seconds:u.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER)})).length(2),expires_at_seconds:u.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),scope:u.z.literal("mpp_only")}).clone().register(v.apiMetadata,{id:"WalletKeyChainAuthorizationStatement"});m.RecordedOwnerCleanupTransaction=u.z.strictObject({raw:u.z.string().regex(/^0x76(?:[0-9a-f]{2})+$/).max(4096),hash:u.z.string().regex(/^0x[0-9a-f]{64}$/),intent:IT.OwnerChainRemovalStatement}).clone().register(v.apiMetadata,{description:"Owner-only original acknowledged revoke bytes and hash; resume these bytes without signing again."});m.WithdrawalTransaction=u.z.object({signed_tx:u.z.string().max(4096).regex(/^0x76(?:[0-9a-f]{2})+$/),tx_hash:u.z.string().regex(/^0x[0-9a-f]{64}$/)}).clone().register(v.apiMetadata,{description:"Owner-only withdrawal bytes durably bound before broadcast. Resume this exact transaction after a lost acknowledgement; this binding does not prove payment."});m.WalletKeyAuthorizationResume=u.z.object({signed_tx:u.z.string().max(16384).regex(/^0x76(?:[0-9a-f]{2})+$/),tx_hash:u.z.string().regex(/^0x[0-9a-f]{64}$/),intent:m.WalletKeyChainAuthorizationStatement.nullable().optional().clone().register(v.apiMetadata,{description:"The existing original chain statement, verified against these recorded bytes and owner-bound stored terms. Null when newer facts cannot establish the original intent; never permission to sign or proof of finalized absence."})}).clone().register(v.apiMetadata,{description:"The original recorded wallet key authorization. Owner-only recovery bytes; neither chain inclusion nor an active grant is implied."});m.Challenge=u.z.object({challenge_id:$.Id,purpose:u.z.enum(["session","setup_approval","grant","payment_approval","wallet_enable","wallet_conversion","withdrawal","card_enrollment","spending_reopen","agent_reissue","account_closure","autonomy_increase","provider_cleanup","contact_email","provider_cleanup"]),approval_kind:m.ApprovalKind.nullable().clone().register(v.apiMetadata,{description:"The approval row this signature creates; null for signatures that are not consents (sign-in, a withdrawal transaction, a wallet key authorisation)."}),signer:u.z.enum(m.CHALLENGE_SIGNERS).clone().register(v.apiMetadata,{description:"How this challenge is answered. passkey: a WebAuthn assertion. owner_jws: a stamped Turnkey activity / owner JWS over the statement. provider_activity: the id of the owner\u2019s own Turnkey activity in which the identity root signed the statement\u2019s money_delegation_signing_input (wallet key authorisation), or the completed deletion activity for the exact OwnerRemovalStatement (provider cleanup). email_code: proof of a contact address only; never a money, setup or autonomy consent. card_otp: the one-time code the card issuer sent the cardholder (card enrollment only; owner.cards.collect sends it). transaction: the owner\u2019s own wallet\u2019s transfer hash (withdrawal), its signed on-chain limit update (sign_chain_limit), the original signed revoke bytes for the exact OwnerChainRemovalStatement (provider_cleanup), or its wallet key authorisation (sign_key_authorization, signed_tx or independently read tx_hash)."}),transaction_modes:u.z.array(u.z.enum(["signed_tx","tx_hash"])).optional().clone().register(v.apiMetadata,{description:"Wallet key authorization only: submit exactly one named field. signed_tx is recorded before dispatch; tx_hash is independently read on chain."}),step_up:u.z.object({accepted:u.z.array(u.z.enum(["email_code","passkey"])).clone().register(v.apiMetadata,{description:"The accepted proof for this contact-email challenge."}),email_code_sent_to:u.z.string().nullable().clone().register(v.apiMetadata,{description:"The masked verified owner email the code was sent to."})}).nullable().optional().clone().register(v.apiMetadata,{description:"Set for the contact-email proof. Console autonomy changes and reopening spending use the current owner session, not this challenge."}),statement:u.z.string().clone().register(v.apiMetadata,{description:"The canonical terms the owner signs: amounts, merchant, limits, expiry. Never request content. The client renders it and checks it against the resource it shows before signing."}),payload:u.z.string().clone().register(v.apiMetadata,{description:"The encoding of `statement` to sign, base64url. The client re-derives it; it never signs bytes it cannot read."}),card_otp:m.CardCodeStep.nullable().optional().clone().register(v.apiMetadata,{description:"Set when signer is card_otp: where the issuer can send the code, and where the newest code went."}),tap_enrollment:Xr.TapEnrollmentChallenge.optional().clone().register(v.apiMetadata,{description:"The exact final TAP setup protocol phase; required only when signer is tap_enrollment."}),hosted_identity:Xr.HostedIdentityChallenge.optional(),resource:u.z.object({type:u.z.string(),id:$.Id}),expires_at:$.Timestamp}).refine(e=>e.signer==="tap_enrollment"==(e.tap_enrollment!==void 0),{message:"tap_enrollment signer requires its exact TAP phase"}).refine(e=>e.signer==="hosted_identity"==(e.hosted_identity!==void 0),{message:"hosted_identity signer requires its exact hosted phase"}).clone().register(v.apiMetadata,{id:"Challenge",description:"Returned with 202 by every owner action that needs the owner\u2019s own signature. Submit it at POST /owner/v1/signatures/{challengeId}; Authority verifies."});m.SignatureSubmission=u.z.discriminatedUnion("method",[Xr.TapEnrollmentSubmission,Xr.HostedIdentitySubmission,u.z.object({method:u.z.enum(["passkey","owner_jws"]),assertion:u.z.string().min(1).clone().register(v.apiMetadata,{description:"The passkey assertion or owner JWS / Turnkey stamp over the statement, base64url."}),terms:Yp.NativeAtumOwnerTerms.optional().clone().register(v.apiMetadata,{description:"Transient exact native original terms resupply with the owner JWS only; Money verifies immutable commitments and current original bindings. Never stored by this submission or used as authority."})}).refine(e=>e.terms===void 0||e.method==="owner_jws",{message:"native terms require the original owner JWS"}),u.z.object({method:u.z.literal("card_otp"),code:u.z.string().min(1).max(32).regex(/^[^\u0000-\u001f\u007f]+$/).clone().register(v.apiMetadata,{description:"The one-time code the card issuer sent the cardholder (card enrollment). Checked by the issuer through the card executor and never stored."})}),u.z.object({method:u.z.literal("provider_activity"),activity_id:u.z.string().regex(/^[A-Za-z0-9_:.-]{1,128}$/).clone().register(v.apiMetadata,{description:"The owner\u2019s Turnkey activity for the challenge: a wallet key money-delegation signature, or the exact deletion in an owner_provider_removal statement. The server reads the activity and independently verifies removal; a client success report is never completion evidence."})}),u.z.object({method:u.z.literal("transaction"),tx_hash:u.z.string().regex(/^0x[0-9a-fA-F]{64}$/).optional().clone().register(v.apiMetadata,{description:"A withdrawal: the hash of the transfer the owner\u2019s own wallet signed and broadcast; Visa holds no signature and confirms it on chain (decided 8 Oct, proposal 5)."}),signed_tx:u.z.string().max(16384).regex(/^0x76(?:[0-9a-f]{2})+$/).optional().clone().register(v.apiMetadata,{description:"The owner root\u2019s signed transaction: wallet key authorization (sign_key_authorization, at most 16384 characters) an owner provider-cleanup revoke (revoke_wallet_key, at most 4096), or an on-chain limit update (sign_chain_limit, at most 4096). Visa verifies and records it before dispatch and recovers the same bytes until the chain answers. The wallet pays the existing fee."})}).refine(e=>e.tx_hash===void 0!=(e.signed_tx===void 0),{message:"exactly one of tx_hash or signed_tx"}),u.z.object({method:u.z.literal("email_code"),code:u.z.string().regex(/^[0-9]{6}$/).clone().register(v.apiMetadata,{description:"The six-digit code sent to the contact address the owner is verifying. Accepted only for contact_email; the approval records the verifier receipt and verification time, never the code."})})]).clone().register(v.apiMetadata,{id:"SignatureSubmission",description:"One answer to one challenge, by the challenge\u2019s signer: a signature (passkey or owner JWS) for consents, the owner\u2019s provider activity for the wallet key authorisation, an email code only for contact_email verification, a card code only for a card_enrollment challenge whose signer is card_otp, a transaction hash for a withdrawal or independently verified wallet key authorization, or original signed transaction bytes for wallet key authorization / provider cleanup / on-chain limit update. Any other pairing is refused."});m.OwnerPaymentProgress=u.z.strictObject({state:u.z.enum(["awaiting_owner","approved","cosign_needed","signed","paid","not_paid","unknown"]),cosign:u.z.strictObject({organization_id:u.z.string().regex(/^[-_A-Za-z0-9]{1,256}$/),activity_id:u.z.string().regex(/^[A-Za-z0-9_:.-]{1,128}$/),fingerprint:u.z.string().min(1).max(256),valid_before:u.z.number().int().positive()}).nullable().clone().register(v.apiMetadata,{description:"While Turnkey waits for the owner\u2019s own vote: the recorded signing activity. The Console reads it with the owner\u2019s session, checks it against the approved charge, and only then approves it. Never voted for automatically."}),reason:u.z.string().regex(/^[a-z0-9_]{1,64}$/).nullable()}).clone().register(v.apiMetadata,{id:"OwnerPaymentProgress",description:"An owner-approved hosted payment after the owner pressed Approve and pay. signed means the payment was signed once and the agent\u2019s app completes it; paid only on chain evidence. Never a receipt by itself. approved means the owner\u2019s signature is recorded and the agent\u2019s own runtime finishes it (a laptop resumes and casts its own vote, as today). Absent while owner-approved paying is paused."});m.SignatureResult=u.z.object({withdrawal_transaction:m.WithdrawalTransaction.nullable().optional(),chain_limit_update:ST.ChainLimitUpdate.optional(),wallet_key_authorization:m.WalletKeyAuthorizationResume.nullable().optional(),challenge_id:$.Id,state:u.z.enum(["pending","accepted","rejected","expired"]),resource:u.z.object({type:u.z.string(),id:$.Id,version:u.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional().clone().register(v.apiMetadata,{description:"Only for an accepted grant with an exact applied receipt: the immutable version this signature applied. Later replacements do not advance it. Absence means application cannot be confirmed from this result; never infer the version from a current grant read."})}),challenge:m.Challenge.nullable().clone().register(v.apiMetadata,{description:"While pending: the full challenge (statement and payload), so any browser can sign it."}),continuation:$.Continuation.nullable(),recorded_transaction:m.RecordedOwnerCleanupTransaction.optional(),native:Yp.NativeAtumApprovalDetail.optional(),progress:m.OwnerPaymentProgress.optional()}).refine(e=>e.resource.version===void 0||e.state==="accepted"&&e.resource.type==="grant",{message:"a version receipt requires an accepted grant"}).clone().register(v.apiMetadata,{id:"SignatureResult"});m.SessionSigner=u.z.object({provider:u.z.literal("turnkey"),organization_id:u.z.string(),user_id:u.z.string()}).clone().register(v.apiMetadata,{id:"SessionSigner",description:"The Turnkey organisation and user the sign-in proved for this session. Owner-signed actions in this session must be signed by this user; the Console never infers it from the owner id."});m.Session=u.z.object({id:$.Id,owner_id:$.Id,scope:u.z.enum(["product","exit"]).clone().register(v.apiMetadata,{description:"exit: product admission is refused but the owner can still withdraw, export and close."}),created_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"Nullable until cutover B: today Auth does not record it for every live session. Required from B."}),expires_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"Nullable until cutover B: today Auth does not record it for every live session. Required from B."}),current:u.z.boolean(),client:u.z.string().nullable().clone().register(v.apiMetadata,{description:"A coarse device description, never a fingerprint."}),last_active_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"When this session last made a request (to the minute); null if never since issue (decided 8 Oct, 10b)."})}).clone().register(v.apiMetadata,{id:"Session",description:"Auth change needed before /owner/v1/sessions serves non-null times: record created_at at issue and expires_at from the session TTL (or the web-session token exp) for every owner session, web and CLI. Sessions issued before that change may lack them, so both stay nullable until cutover B, which rebuilds sessions empty; from B both are required."});m.OWNER_ACCESS=["pending","approved","rejected"];m.OWNER_LIFECYCLE=["active","closing","closed"];m.OWNER_ACCESS_FROM_TODAY=[{today:"ownerAccess v4 (every users.status row approved)",access:"approved"},{today:"ownerAccess revoked (any users.status row rejected)",access:"rejected"},{today:"ownerAccess none with rows (some pending, none rejected)",access:"pending"},{today:"ownerAccess none with no rows",access:null}];m.OWNER_LIFECYCLE_FROM_TODAY=[{today:"no account closure",lifecycle:"active"},{today:"POST /v4/account/close accepted, closure not finished",lifecycle:"closing"},{today:"closure finished (GET /v4/account/closure/:id done)",lifecycle:"closed"}];m.Owner=u.z.object({id:$.Id,wallet_address:u.z.string().regex(/^0x[0-9a-f]{40}$/).nullable().clone().register(v.apiMetadata,{description:"The recorded owner wallet address, published after the owner wallet and identity roots complete custody readback. null until that ceremony completes."}),display_name:u.z.string().nullable(),photo_url:u.z.url().nullable(),contact_email:u.z.string().nullable().clone().register(v.apiMetadata,{description:"A5: the one verified owner email, used only for the TAP directory and essential notices."}),access:u.z.enum(m.OWNER_ACCESS).clone().register(v.apiMetadata,{description:"Whether Visa admits this owner (entry gate: Visa identity plus legal geo-blocking). Mapping from today: see OWNER_ACCESS_FROM_TODAY."}),lifecycle:u.z.enum(m.OWNER_LIFECYCLE).clone().register(v.apiMetadata,{description:"closing: an account_closure operation is running (exit still works). closed: done."}),renewal_due_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"The account's one spending renewal date: every agent's grant ends on it, and one owner tap renews them all for 90 days from that tap. null until the first agent is set up."}),created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Owner"});m.KEY_CUSTODY=["device","enclave","turnkey"];m.KEY_LIFECYCLE=["pending","active","ending","ended"];m.KEY_END_REASONS=["rotated","upgraded","replaced","emergency_replaced","recovered","revoked","agent_ended","expired","abandoned"];m.APPROVER_STATES=["pending","active","removing","removed"];m.DeviceApprover=u.z.object({id:$.Id,installation_id:$.Id.clone().register(v.apiMetadata,{description:"The installation whose device holds the approver credential."}),provider:u.z.literal("turnkey"),state:u.z.enum(m.APPROVER_STATES).clone().register(v.apiMetadata,{description:"pending: created, policy not yet in force. removing: provider removal in flight."}),created_at:$.Timestamp,activated_at:$.Timestamp.nullable(),removed_at:$.Timestamp.nullable()}).clone().register(v.apiMetadata,{id:"DeviceApprover",description:"A provider approver that must vote on this agent\u2019s signing (two of two, at most 8 per agent). Approvers only vote; they never sign. Removed by a remove_device_approver operation step."});m.AGENT_LIFECYCLE=["pending","active","paused","ending","ended"];m.AGENT_END_REASONS=["revoked","owner_closed","setup_abandoned"];m.Installation=u.z.object({id:$.Id,surface:$.Surface,lifecycle:u.z.enum(m.KEY_LIFECYCLE).clone().register(v.apiMetadata,{description:"The lifecycle of this installation\u2019s current key generation."}),end_reason:u.z.enum(m.KEY_END_REASONS).nullable(),key_generation:u.z.number().int().min(1),custody:u.z.enum(m.KEY_CUSTODY).clone().register(v.apiMetadata,{description:"device: an OS key store on the owner\u2019s computer. enclave: a key held by an attested enclave. turnkey: a non-exportable Turnkey-held key."}),client:u.z.string().nullable(),created_at:$.Timestamp,last_used_at:$.Timestamp.nullable()}).clone().register(v.apiMetadata,{id:"Installation",description:"Where the durable agent runs. One active installation per agent is policy; replacing it never loses the agent or resets its grant."});m.HostedSetupRecovery=u.z.strictObject({setup_id:$.Id,operation_id:$.Id,agent_id:$.Id,installation_id:$.Id,organization_id:u.z.string().min(1),owner_user_id:u.z.string().min(1),private_key_name:u.z.string().min(1),wallet_policy:Xr.HostedIdentityChallenge}).clone().register(v.apiMetadata,{id:"HostedSetupRecovery"});m.Agent=u.z.object({id:$.Id,setup_id:$.Id.nullable().optional(),name:u.z.string(),surface:$.Surface,lifecycle:u.z.enum(m.AGENT_LIFECYCLE),end_reason:u.z.enum(m.AGENT_END_REASONS).nullable(),installations:u.z.array(m.Installation),active_installation_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The one installation allowed to act (policy)."}),approvers:u.z.array(m.DeviceApprover).clone().register(v.apiMetadata,{description:"The device-approver roster for laptop co-signing, separate from the active installation."}),tap_agent_id:u.z.string().nullable().clone().register(v.apiMetadata,{description:"The public Trusted Agent Protocol directory id."}),grant_version:u.z.number().int().nullable(),grants:u.z.array(u.z.lazy(()=>m.Grant)).max($.Rail.options.length).optional().clone().register(v.apiMetadata,{description:"Current or latest ended grant per rail. Owner reads always supply an explicit empty collection when none exist; absent means unavailable, never zero permission."}),grant_history:u.z.lazy(()=>m.GrantHistory).optional().clone().register(v.apiMetadata,{description:"A bounded page of immutable terms versions on owner agent detail reads."}),readiness:u.z.array($.Readiness),created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Agent"});m.AgentPatch=u.z.object({name:u.z.string().min(1).max(80).optional(),paused:u.z.boolean().optional()}).clone().register(v.apiMetadata,{id:"AgentPatch"});m.Device=u.z.object({id:$.Id.clone().register(v.apiMetadata,{description:"The app\u2019s own device id (registering it again is idempotent)."}),platform:u.z.enum(["ios"]),app_env:u.z.enum(["preview","production"]).clone().register(v.apiMetadata,{description:"The APNs environment; a sandbox token is never sent to production APNs."}),created_at:$.Timestamp,updated_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Device",description:"A phone registered for the owner\u2019s notifications (proposal 30). Registration only: nothing is sent at launch. The push token is never answered."});m.AgentToken=u.z.object({key_id:$.Id,label:u.z.string().clone().register(v.apiMetadata,{description:"Server-assigned from the app; not set by the owner."}),app:u.z.string().nullable().clone().register(v.apiMetadata,{description:"The app or harness the token is for."}),created_at:$.Timestamp,expires_at:$.Timestamp,last_used_at:$.Timestamp.nullable(),prefix:u.z.string().clone().register(v.apiMetadata,{description:"The non-secret first characters of the token, to tell tokens apart (decided 8 Oct, 10b)."})}).clone().register(v.apiMetadata,{id:"AgentToken"});m.AgentTokenCreated=m.AgentToken.extend({token:u.z.string().clone().register(v.apiMetadata,{description:"Shown once. Visa keeps only a hash."})}).clone().register(v.apiMetadata,{id:"AgentTokenCreated"});var Xp=u.z.literal(!0),Qp=u.z.string().clone().register(v.apiMetadata,{description:"What to do if the first answer was lost."});m.AgentTokenAlreadyCreated=m.AgentToken.extend({already_created:Xp,message:Qp}).clone().register(v.apiMetadata,{id:"AgentTokenAlreadyCreated",description:"This request_id already created this token. Its secret was shown once and is not stored; if it was lost, revoke this token and create a new one."});m.GRANT_MODES=["within_limit","ask_each_time"];m.GrantMode=u.z.enum(m.GRANT_MODES).clone().register(v.apiMetadata,{id:"GrantMode",description:"within_limit: pay without asking up to the limits. ask_each_time: every payment needs an approval (hosted agents default here). Not a versioned term: switching keeps the grant version and its usage."});m.GrantTerms=u.z.object({max_per_payment:$.Amount,max_per_period:$.Amount,period_seconds:u.z.number().int().min(3600).max(2678400),expires_at:$.Timestamp,instrument_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"card: the enrolled card the VIC mandate binds."})}).clone().register(v.apiMetadata,{id:"GrantTerms",description:"The consented, immutable terms of one rail\u2019s grant version. No grant on a rail means zero spend there, never unlimited."});m.GrantRequest=u.z.object({rail:$.Rail,mode:m.GrantMode,terms:m.GrantTerms}).clone().register(v.apiMetadata,{id:"GrantRequest"});m.SETUP_KINDS=["laptop","hosted","card","replacement"];m.SETUP_STATES=["open","claimed","approved","completed","cancelled","expired"];m.Setup=u.z.object({id:$.Id,kind:u.z.enum(m.SETUP_KINDS),agent_id:$.Id.nullable(),installation_id:$.Id.nullable(),state:u.z.enum(m.SETUP_STATES),terminal_joined:u.z.boolean().optional().clone().register(v.apiMetadata,{description:"The laptop installation joined this setup, independently of owner claim."}),replacement_reason:u.z.enum(["planned","emergency"]).nullable().clone().register(v.apiMetadata,{description:"replacement only. emergency: the old keys ended before this setup existed."}),replaces_key_id:$.Id.nullable(),approval_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The owner\u2019s consent for this setup, once approved."}),setup_key:u.z.string().optional().clone().register(v.apiMetadata,{description:"Owner reads only, of a laptop or replacement setup the owner started in the Console that no computer has joined yet: the key in the one command the owner pastes (`visa connect --setup <key>`)."}),owner_url:u.z.url().clone().register(v.apiMetadata,{description:"The Console page where the signed-in owner reviews and signs this setup. Opening it is all the owner does; there is no code to type."}),client:u.z.object({name:u.z.string(),version:u.z.string().nullable()}),requested_grants:u.z.array(m.GrantRequest),operation_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The durable operation that carries this setup."}),expires_at:$.Timestamp,continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"Setup",description:"One setup ceremony, durable across browsers and restarts. It owns the CLI rendezvous (the old login and handoff doors). The original task is kept and resumes after approval."});var Wp={installation_key:u.z.record(u.z.string(),u.z.unknown()).clone().register(v.apiMetadata,{description:"The new installation\u2019s public JWK (Ed25519)."}),client:u.z.object({name:u.z.string(),version:u.z.string()}),setup_key:u.z.string().optional().clone().register(v.apiMetadata,{description:"Join a setup the owner started in the Console (web-start pickup)."}),resume_proof:u.z.object({signature:u.z.string().clone().register(v.apiMetadata,{description:"Ed25519 signature by the installation key, base64url."}),setup_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The open setup being resumed, if the client still knows it."}),nonce:u.z.string().min(16).max(64).clone().register(v.apiMetadata,{description:"Random, single use per installation."}),issued_at:u.z.number().int().clone().register(v.apiMetadata,{description:"Unix seconds; accepted only within 120 s."})}).optional().clone().register(v.apiMetadata,{description:'Required to resume an open setup for this installation key (repeating the same start). Signs exactly "visa-setup-resume:v1:" + jwk_thumbprint + ":" + (setup_id or "-") + ":" + nonce + ":" + issued_at. The request must also match the open setup (same kind and, for a replacement, the same agent); otherwise conflict.'})};m.AgentSetupStart=u.z.discriminatedUnion("kind",[u.z.object({kind:u.z.literal("laptop"),...Wp}),u.z.object({kind:u.z.literal("replacement"),agent_id:$.Id.clone().register(v.apiMetadata,{description:"The durable agent whose installation is replaced."}),...Wp})]).clone().register(v.apiMetadata,{id:"AgentSetupStart"});m.AgentSetupStarted=u.z.object({setup:m.Setup,setup_secret:u.z.string().clone().register(v.apiMetadata,{description:"Shown once; authorizes polling and claim."})}).clone().register(v.apiMetadata,{id:"AgentSetupStarted"});var Cs=u.z.string().clone().register(v.apiMetadata,{description:"The app the owner picked (for example a CLI harness)."}),Ms=$.Id.clone().register(v.apiMetadata,{description:"Client-generated key: repeating a start with the same request_id returns the same setup, never a second one."});m.OwnerSetupStart=u.z.discriminatedUnion("kind",[u.z.object({kind:u.z.literal("laptop"),request_id:Ms,client:Cs}),u.z.object({kind:u.z.literal("hosted"),request_id:Ms,client:Cs}),u.z.object({kind:u.z.literal("replacement"),request_id:Ms,agent_id:$.Id.clone().register(v.apiMetadata,{description:"The durable agent whose installation is replaced."}),replacement_reason:u.z.enum(["planned","emergency"]),client:Cs})]).clone().register(v.apiMetadata,{id:"OwnerSetupStart",description:"Card setups start at POST /owner/v1/cards."});m.SetupClaim=u.z.object({proof:u.z.string().clone().register(v.apiMetadata,{description:"A signature by the installation key over the setup id."})}).clone().register(v.apiMetadata,{id:"SetupClaim"});m.SetupClaimed=u.z.object({agent:m.Agent,installation_id:$.Id,wallet_context:u.z.lazy(()=>m.WalletSigningContext).nullable()}).clone().register(v.apiMetadata,{id:"SetupClaimed"});m.Grant=u.z.object({grant_id:$.Id,agent_id:$.Id,rail:$.Rail,version:u.z.number().int().min(1),mode:m.GrantMode,mode_changed_at:$.Timestamp.nullable(),mode_approval_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"The autonomy_increase approval (current Console product-session consent) consumed by the last widening."}),terms:m.GrantTerms,approval_id:$.Id.clone().register(v.apiMetadata,{description:"The owner consent these terms sit inside."}),lifecycle:u.z.enum(["active","ended"]),end_reason:u.z.enum(["replaced","revoked","expired","agent_ended","owner_closed","recovered"]).nullable(),usage:u.z.object({period_used:$.Amount,period_started_at:$.Timestamp,period_booked:$.Amount.optional(),period_held:$.Amount.optional(),period_remaining:$.Amount.optional(),observed_at:$.Timestamp.optional(),budget_use:u.z.object({spent_pct:u.z.number().int().min(0).max(100),reserved_pct:u.z.number().int().min(0).max(100),used_pct:u.z.number().int().min(0).max(100),tone:u.z.enum(["normal","warning","critical"])}).optional()}).clone().register(v.apiMetadata,{description:"Current rolling usage counted by grant_id across versions. Booked debits plus unresolved holds consume room; refunds never restore it. Missing split facts mean unavailable, never zero. observed_at and period_started_at describe this read, not the creation of an earlier terms version."}),created_at:$.Timestamp,continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"Grant",description:"What one agent may spend on one rail. Narrower terms mint a version that keeps the existing consent; wider terms, a new rail, card or key need fresh consent; a mode change is in place."});m.GrantVersion=m.Grant.pick({grant_id:!0,agent_id:!0,rail:!0,version:!0,terms:!0,approval_id:!0,lifecycle:!0,end_reason:!0,created_at:!0}).extend({key_id:$.Id.nullable()}).clone().register(v.apiMetadata,{id:"GrantVersion",description:"Retained immutable terms and consent of an exact grant version, with its current lifecycle/end reason. No historical mode or usage is inferred."});m.GrantHistory=u.z.object({versions:u.z.array(m.GrantVersion).max(100),truncated:u.z.boolean(),next_cursor:u.z.string().nullable()}).clone().register(v.apiMetadata,{id:"GrantHistory"});m.GrantChange=u.z.object({grant:m.Grant,consent:u.z.enum(["kept","fresh_required"]).clone().register(v.apiMetadata,{description:"kept: the change sits inside what the owner already approved and applied at once. fresh_required: the owner must sign `challenge` first; nothing changed yet."}),challenge:m.Challenge.nullable()}).clone().register(v.apiMetadata,{id:"GrantChange"});m.PaymentTarget=u.z.discriminatedUnion("kind",[u.z.object({kind:u.z.literal("url"),url:u.z.url(),method:u.z.enum(["GET","POST"]).default("GET"),body:u.z.string().optional().clone().register(v.apiMetadata,{description:"Forwarded to the merchant in memory only. Visa stores no request content."})}),u.z.object({kind:u.z.literal("checkout"),merchant:u.z.string(),checkout_url:u.z.url(),amount:$.Amount,country:u.z.string().length(2).optional()})]).clone().register(v.apiMetadata,{id:"PaymentTarget",description:"url: an API that answers HTTP 402 with a Tempo charge (tempo rail). checkout: exact card checkout terms the host established independently (card rail)."});m.TempoChargeRequestWire=u.z.object({tempoTransaction:u.z.record(u.z.string(),u.z.unknown()),charge:u.z.object({chainId:u.z.number().int(),account:u.z.string(),token:u.z.string(),recipient:u.z.string(),amount:u.z.string().regex(/^(0|[1-9][0-9]*)$/),memo:u.z.string(),notAfter:u.z.number().int(),maxNetworkFee:u.z.string().regex(/^(0|[1-9][0-9]*)$/),funding:u.z.object({token:u.z.string(),maxAmount:u.z.string().regex(/^(0|[1-9][0-9]*)$/)}).optional()}),keyRef:u.z.object({subOrganizationId:u.z.string(),accessKeyAddress:u.z.string()})}).clone().register(v.apiMetadata,{id:"TempoChargeRequestWire",description:"Frozen wire: the Tempo charge request exactly as the signing enclave verifies it. Transaction commitments only, never merchant request or result content."});var uo=u.z.string().regex(/^0x(|[1-9a-f][0-9a-f]{0,63})$/),lr=u.z.string().regex(/^0x[0-9a-f]{40}$/),Rs=u.z.string().regex(/^(0|[1-9][0-9]{0,38})$/).refine(e=>BigInt(e)<1n<<128n);m.ApprovalReviewChargeRequest=u.z.strictObject({tempoTransaction:u.z.strictObject({chainId:u.z.literal(4217),maxPriorityFeePerGas:uo,maxFeePerGas:uo,gas:uo,calls:u.z.array(u.z.strictObject({to:lr,value:u.z.literal("0x"),data:u.z.string().regex(/^0x(?:[0-9a-f]{136}|[0-9a-f]{264}|[0-9a-f]{200})$/)})).min(1).max(3),accessList:u.z.tuple([]),nonceKey:uo,nonce:u.z.literal("0x"),validBefore:u.z.number().int().nonnegative().nullable(),validAfter:u.z.number().int().nonnegative().nullable(),feeToken:lr.nullable(),feePayer:u.z.boolean(),authorizationList:u.z.tuple([]),keyAuthorization:u.z.null()}),charge:u.z.strictObject({chainId:u.z.literal(4217),account:lr,token:lr,recipient:lr,amount:Rs,memo:u.z.string().regex(/^0x[0-9a-f]{64}$/),notAfter:u.z.number().int().positive(),maxNetworkFee:Rs,funding:u.z.strictObject({token:lr,maxAmount:Rs}).optional()}),keyRef:u.z.strictObject({subOrganizationId:$.Id,accessKeyAddress:lr})}).clone().register(v.apiMetadata,{id:"ApprovalReviewChargeRequest",description:"The original body-free unsigned Tempo charge, with only the existing canonical transaction/charge/custody fields. Independent wallet verification still checks selectors, charge equality, nonce, fee and time bounds; parsing does not reconstruct or authorize a transaction. Unknown nested fields refuse instead of being stripped."});m.PreparedCharge=u.z.object({request:m.TempoChargeRequestWire,merchant_origin:u.z.url(),method:u.z.enum(["GET","POST"]),endpoint_path:u.z.string().regex(/^\/[^?#]*$/).clone().register(v.apiMetadata,{description:"The path only: no query string."}),mpp:u.z.object({challenge_id:u.z.string().regex(/^[\x21-\x7e]{1,256}$/),realm:u.z.string().regex(/^[\x20-\x7e]{1,256}$/)}).clone().register(v.apiMetadata,{description:"The merchant\u2019s MPP challenge this charge answers (its id and realm). The charge\u2019s memo must be exactly MPP\u2019s anonymous attribution memo for them (hash prefixes only): nothing caller-chosen goes on chain."})}).clone().register(v.apiMetadata,{id:"PreparedCharge",description:"A Tempo charge the laptop prepared locally from the merchant\u2019s 402 using its wallet signing context. The server re-derives the terms and the signing payload from it and checks them against the grant; it never hands the laptop a payload to sign blind."});m.POP_INTENT_CLAIM="int";m.TapSignatureBasePayload=u.z.object({kind:u.z.literal("tap_signature_base"),method:u.z.string().regex(/^[A-Z]{1,16}$/),authority:u.z.string().min(1).max(255),path:u.z.string().regex(/^\/[^\n\r]{0,4095}$/),coveredComponents:u.z.array(u.z.string().min(1).max(64)).min(4).max(8),paymentHeaderName:u.z.enum(["payment-signature","x-payment","authorization"]),paymentHeaderValue:u.z.string().min(1).max(16384),contentDigest:u.z.string().max(256).optional(),created:u.z.number().int(),expires:u.z.number().int(),keyId:u.z.string().regex(/^[A-Za-z0-9_-]{43}$/),nonce:u.z.string().regex(/^[A-Za-z0-9+/]{43}=$/).clone().register(v.apiMetadata,{description:"32 random bytes, base64."}),tag:u.z.literal("agent-payer-auth"),signatureBase:u.z.string().min(1).max(32768)}).clone().register(v.apiMetadata,{id:"TapSignatureBasePayload",description:"The TAP signature base the agent sends the merchant, as the identity gate takes it (frozen wire, its field names). keyId is the agent\u2019s TAP key thumbprint (status `tap`). The gate signs only the base it rebuilds from these fields; expires \u2212 created is at most 480 s."});m.RuntimeAuthorization=u.z.object({pop_jwt:u.z.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).clone().register(v.apiMetadata,{description:'Compact JWS, typ visa-agent-pop+jwt, signed by the installation key (header kid = its JWK thumbprint, cnf.jwk = its public key). Claims: aud visa-tempo-mpp-payment:v1, nonce = the execution\u2019s wire_request_id (the verifier\u2019s financial request id), int = tempoPayIntentHash(financialRequestHash("wallet.tempo.mpp.sign", request), intent), iat within 120 s. A fresh one on every submission.'}),intent:u.z.record(u.z.string(),u.z.unknown()).clone().register(v.apiMetadata,{description:"The JSON object the proof commits to (at most 4 KiB). Forwarded to the verifier in memory and never stored."})}).clone().register(v.apiMetadata,{id:"RuntimeAuthorization"});m.PURCHASE_IDENTITY_FIELDS=["agent_id","request_id","rail","merchant_origin","method","endpoint_path","max"];m.ATTEMPT_TERMS_FIELDS=["amount","asset","funding_asset","recipient","funding_max","fee_ceiling","valid_before","signing_payload"];m.RETAINED_PAYMENT_FACTS=[...m.PURCHASE_IDENTITY_FIELDS,...m.ATTEMPT_TERMS_FIELDS,"state","delivery","network_ref","provider_evidence","timestamps"];var Kp=u.z.uuid().clone().register(v.apiMetadata,{description:"Client-generated UUID for one execution: the verifier\u2019s financial request id and the PoP nonce. The same execution\u2019s retries reuse it; a replacement execution under the same request_id gets a new one."}),Yr={request_id:$.Id.clone().register(v.apiMetadata,{description:"Client idempotency key. New per purchase; unchanged on every later step. It fixes the purchase identity fields."}),agent_id:$.Id.optional().clone().register(v.apiMetadata,{description:"Needed only when the credential holds more than one agent."})},Hp=u.z.string().min(1).max(200).optional().clone().register(v.apiMetadata,{description:"What the purchase is for, used only in this response\u2019s continuation (for the agent to relay at the approval moment). Never stored and never returned by a later read."});m.MerchantReceipt=u.z.object({kind:u.z.enum(["receipt","job_reference"]),value:u.z.string().min(1).max(512)}).clone().register(v.apiMetadata,{id:"MerchantReceipt",description:"What the caller kept from the merchant. Visa asks the merchant to verify it; Visa never keeps request content to compare against."});m.OriginalHostedPurchaseContext=u.z.strictObject({terms:u.z.strictObject({v:u.z.literal(1),resource:u.z.string().max(2048),method:u.z.enum(["GET","HEAD","POST","PUT","PATCH","DELETE"]),bodySha256:u.z.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable(),maxAmountMicros:u.z.string(),recipient:u.z.string(),intent:u.z.record(u.z.string(),u.z.unknown())}),request:u.z.strictObject({method:u.z.enum(["GET","HEAD","POST","PUT","PATCH","DELETE"]),headers:u.z.array(u.z.tuple([u.z.string().refine(e=>/^(accept|accept-language|content-type|user-agent|x-[a-z0-9-]+)$/i.test(e)&&!/^(authorization|cookie|proxy-authorization|payment|x-payment|x-payment-response)$|auth|token|secret|key|session|cookie|signature|credential|password/i.test(e)),u.z.string().max(1024)])).max(32),bodyBase64:u.z.string().regex(/^[A-Za-z0-9+/=_-]*$/).nullable()})}).clone().register(v.apiMetadata,{id:"OriginalHostedPurchaseContext",description:"Original canonical Tempo v1 signing terms and transient public replay request. Consumers check the existing canonical verifier, actual body digest, authenticated purchase and original commitment. Configured private owner approval review may retain only supported exact signing context; other paths remain local/hash-only. Replay body and headers never enter retained state. Missing replay bytes cannot be reconstructed from hashes. Never put this context into URLs, logs or telemetry."});m.OwnerPreparedPayment=u.z.strictObject({ownerId:$.Id,agentId:$.Id,paymentId:$.Id,approvalId:$.Id,executionAttemptId:$.Id,requestedTerms:m.OriginalHostedPurchaseContext.shape.terms,terms:m.OriginalHostedPurchaseContext.shape.terms.extend({v:u.z.literal(2),runtimeId:$.Id,charge:u.z.strictObject({chainId:u.z.literal(4217),account:u.z.string(),accessKeyAddress:u.z.string(),token:u.z.string(),amountMicros:u.z.string().regex(/^[1-9][0-9]*$/),fundingToken:u.z.string().optional(),maxFundingMicros:u.z.string().regex(/^[1-9][0-9]*$/).optional(),memo:u.z.string(),notAfter:u.z.number().int().positive(),maxNetworkFee:u.z.string().regex(/^(0|[1-9][0-9]*)$/),signingHash:u.z.string()})}),request:m.ApprovalReviewChargeRequest,mppChallengeId:m.PreparedCharge.shape.mpp.shape.challenge_id,mppRealm:m.PreparedCharge.shape.mpp.shape.realm,signingInput:u.z.string().min(1),decisionExpiresAt:$.Timestamp}).clone().register(v.apiMetadata,{id:"OwnerPreparedPayment",description:"The original requested terms, exact approved charge and root-signing input from the existing owner approval producer. The client independently verifies these against its original context and current owner facts before signing. This response carries no HTTP replay body or headers. Public owner-approved paying remains paused."});m.ApprovalReviewDetail=u.z.strictObject({requestedTerms:m.OriginalHostedPurchaseContext.shape.terms,prepared:m.OwnerPreparedPayment.optional()}).clone().register(v.apiMetadata,{id:"ApprovalReviewDetail",description:"Private owner-scoped original signing context for the existing approval page. Retention is configurable, initially on; product capture never enables telemetry. No replay HTTP body/headers. Later reads preserve original record bindings and quote/decision expiry. Null detail means no available captured context, not a deletion or renewal claim."});m.PaymentCreate=u.z.discriminatedUnion("step",[u.z.object({step:u.z.literal("prepare"),...Yr,target:m.PaymentTarget,original:m.OriginalHostedPurchaseContext.optional(),max:$.Amount.clone().register(v.apiMetadata,{description:"Hard ceiling. Pricing without paying is a discover call."}),description:Hp}),u.z.object({step:u.z.literal("admit"),...Yr,original:m.OriginalHostedPurchaseContext.optional(),wire_request_id:Kp,charge:m.PreparedCharge,authorization:m.RuntimeAuthorization,max:$.Amount,replaces_attempt_id:$.Id.optional().clone().register(v.apiMetadata,{description:"A re-quote on the same purchase: allowed only once that attempt is closed with evidence it can no longer execute."}),description:Hp}),u.z.object({step:u.z.literal("vote"),...Yr,attempt_id:$.Id.clone().register(v.apiMetadata,{description:"The exact attempt voted on; a vote for a closed attempt has no effect."}),vote:u.z.object({organization_id:u.z.string(),activity_id:u.z.string(),fingerprint:u.z.string(),voted_at:$.Timestamp})}),u.z.object({step:u.z.literal("resume"),...Yr,attempt_id:$.Id.optional().clone().register(v.apiMetadata,{description:"Laptop: the attempt being resumed."}),wire_request_id:Kp.optional().clone().register(v.apiMetadata,{description:"Laptop: the same execution\u2019s wire id."}),charge:m.PreparedCharge.optional().clone().register(v.apiMetadata,{description:"Laptop: identical to the admitted charge."}),authorization:m.RuntimeAuthorization.optional().clone().register(v.apiMetadata,{description:"Laptop: a fresh proof for the same charge."}),target:m.PaymentTarget.optional().clone().register(v.apiMetadata,{description:"Hosted, before any credential was released: the request again. Visa kept no copy and never treats it as the original: the merchant\u2019s fresh charge must match the purchase\u2019s retained payment facts exactly."}),original:m.OriginalHostedPurchaseContext.optional()}),u.z.object({step:u.z.literal("recover"),...Yr,attempt_id:$.Id,receipt:m.MerchantReceipt.optional().clone().register(v.apiMetadata,{description:'Absent when the caller lost its state: the outcome is then "paid, result unavailable".'})})]).clone().register(v.apiMetadata,{id:"PaymentCreate",description:"prepare: hosted, the server runs the 402 exchange. admit: laptop, the agent submits its own prepared charge with its independent proof. vote: the laptop records its vote on one attempt\u2019s provider activity after verifying it. resume: continue after an approval, a vote, a crash or a lost response. recover: after a credential was released, get the result back only through the merchant (receipt or job reference); the credential is never re-sent."});m.SigningExchange=u.z.object({attempt_id:$.Id,wire_request_id:u.z.uuid().clone().register(v.apiMetadata,{description:"The execution\u2019s wire id; the PoP nonce for every retry of it."}),state:u.z.enum(["consensus_needed","signed","expired","refused"]),provider:u.z.literal("turnkey"),organization_id:u.z.string(),activity_id:u.z.string(),fingerprint:u.z.string(),sign_with:u.z.string().clone().register(v.apiMetadata,{description:"The wallet access key the activity signs with."}),valid_before:u.z.number().int(),signature:u.z.string().regex(/^0x[0-9a-f]{130}$/).nullable()}).clone().register(v.apiMetadata,{id:"SigningExchange",description:"The laptop co-signing exchange (two of two). The laptop reads the activity from the provider itself, recomputes the payload from its own prepared charge, checks signer, encoding, organisation and expiry, votes, then resumes. Nothing here is signed on the server\u2019s word."});m.Payment=u.z.object({id:$.Id,request_id:$.Id,agent_id:$.Id,rail:$.Rail,protocol:u.z.enum(["standard","atum"]).optional().clone().register(v.apiMetadata,{description:"How the wallet paid: standard (the merchant\u2019s Tempo charge, MPP) or atum (a native ATUM purchase). Receipts label it; the rail stays the funding rail."}),merchant:u.z.string().clone().register(v.apiMetadata,{description:"The merchant origin."}),method:u.z.enum(["GET","POST"]).nullable(),endpoint_path:u.z.string().nullable(),state:u.z.enum($.PAYMENT_STATES),word:$.OwnerStatusWordSchema,money:$.PaymentMoney,facts:$.PaymentFacts,attempts:u.z.array($.Attempt),signing:m.SigningExchange.nullable().clone().register(v.apiMetadata,{description:"Present while a laptop execution is being co-signed."}),approval_id:$.Id.nullable(),approval:u.z.object({id:$.Id,state:u.z.enum(["requested","approved","declined","expired"]),expires_at:u.z.string().datetime()}).nullable().optional().clone().register(v.apiMetadata,{description:"The persisted owner decision and its original deadline, when approval is needed."}),result:u.z.object({status:u.z.number().int(),content_type:u.z.string().nullable(),body_base64:u.z.string(),truncated:u.z.boolean().clone().register(v.apiMetadata,{description:"True when the merchant\u2019s answer was longer than the hosted limit (1 MB) and only its first part is in body_base64."})}).nullable().clone().register(v.apiMetadata,{description:"Hosted only: the merchant\u2019s answer, returned once in the response that executed the payment and never stored."}),created_at:$.Timestamp,updated_at:$.Timestamp,continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"Payment",description:'The stable purchase identity, described only by payment facts. A quote expiring during review keeps the same purchase; an unknown outcome is never reported as "nothing was paid".'});m.PaymentList=u.z.object({payments:u.z.array(m.Payment),page:$.Page}).clone().register(v.apiMetadata,{id:"PaymentList"});m.PaymentReport=u.z.object({wire_request_id:u.z.uuid().optional().clone().register(v.apiMetadata,{description:"Laptop: the execution being reported."}),network_ref:u.z.string().optional().clone().register(v.apiMetadata,{description:"Laptop: the transaction hash it submitted. Settlement is still read from the chain."}),delivery:u.z.enum(["delivered","unavailable"]).optional(),merchant_reference:u.z.string().max(200).optional(),authorization:u.z.object({pop_jwt:u.z.string().clone().register(v.apiMetadata,{description:"Laptop: compact JWS by the installation key, aud visa-tempo-mpp-report:v1, nonce = the execution\u2019s wire_request_id, int = tempoReportIntentHash(outcome, network_ref)."})}).optional()}).clone().register(v.apiMetadata,{id:"PaymentReport",description:"The agent reports what the merchant delivered. Payment facts are never inferred from it."});m.CardCredential=u.z.object({payment_id:$.Id,network_token:u.z.string(),expiry:u.z.string(),cryptogram:u.z.string(),bound_to:u.z.object({merchant:u.z.string(),expires_at:$.Timestamp})}).clone().register(v.apiMetadata,{id:"CardCredential",description:"A network token and cryptogram for one checkout, never the funding card. Suppressed at launch: how it reaches agents without entering model transcripts is open (decision P1)."});m.Approval=u.z.object({id:$.Id,kind:m.ApprovalKind,payment_id:$.Id.nullable().clone().register(v.apiMetadata,{description:"Set for kind payment."}),agent_id:$.Id.nullable(),subject:u.z.object({type:u.z.enum(["setup","grant","payment_attempt","agent_key","control","owner","agent"]),id:$.Id}),statement:u.z.string().clone().register(v.apiMetadata,{description:"The terms the owner signs (never request content)."}),state:u.z.enum(["requested","approved","declined","expired"]),rail:$.Rail.nullable().clone().register(v.apiMetadata,{description:"Set for kind payment and grant."}),amount:$.Amount.nullable().clone().register(v.apiMetadata,{description:"Set for kind payment."}),merchant:u.z.string().nullable().clone().register(v.apiMetadata,{description:"Set for kind payment."}),endpoint_path:u.z.string().nullable(),evidence:u.z.discriminatedUnion("method",[u.z.object({method:u.z.enum(["passkey","owner_jws"]),signature:u.z.string()}),u.z.object({method:u.z.enum(["email_code","owner_session"]),verification_ref:u.z.string().clone().register(v.apiMetadata,{description:"The verified consent\u2019s non-secret receipt or session/epoch reference; never a code or token."}),verified_at:$.Timestamp})]).nullable().clone().register(v.apiMetadata,{description:"Set once approved: how the owner consented. owner_session only for Console autonomy_increase consent; historical email_code receipts remain readable."}),consumed_at:$.Timestamp.nullable().clone().register(v.apiMetadata,{description:"When the consent was used; each approval is used once."}),expires_at:$.Timestamp,created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Approval",description:"One owner consent of one kind (#10983 approvals). A payment approval is shown by its payment facts (no free-text purpose is kept). Controls are re-checked when the approval is consumed, not only when it is requested."});m.Wallet=u.z.object({state:u.z.enum(["disabled","enabling","enabled","disabling"]),address:u.z.string().nullable(),network:u.z.string().nullable(),balances:u.z.array(u.z.object({asset:$.Asset,micros:$.Micros,spendable:u.z.boolean()})),setup_fee_covered:u.z.boolean().nullable().optional().clone().register(v.apiMetadata,{description:"Authority confirms that the owner wallet covers the existing OUSD setup-fee reserve. null or absent: coverage is unknown, never permission to sign."}),other_tokens:u.z.array(u.z.object({contract_address:u.z.string(),symbol:u.z.string().nullable(),base_units:u.z.string(),decimals:u.z.number().int().nullable()})).clone().register(v.apiMetadata,{description:"Tokens held that cannot be spent here; each can be withdrawn."}),other_tokens_status:u.z.enum(["complete","unavailable"]).clone().register(v.apiMetadata,{description:"complete: other_tokens lists every other token held. unavailable: they could not be discovered, so other_tokens may be missing some (never read as nothing held)."}),readiness:$.Readiness}).clone().register(v.apiMetadata,{id:"Wallet"});m.Withdrawal=u.z.object({request_id:$.Id.clone().register(v.apiMetadata,{description:"Client key: repeating the same request_id returns the same withdrawal operation (after a lost response), never a second one."}),chain_id:u.z.number().int().optional().clone().register(v.apiMetadata,{description:"Default: the wallet\u2019s network."}),to_address:u.z.string().regex(/^0x[0-9a-fA-F]{40}$/),token:$.TokenRef.clone().register(v.apiMetadata,{description:"The exit for unsupported tokens: any token the wallet holds can be withdrawn, independent of what agents may spend."}),amount_base_units:u.z.string().regex(/^(0|[1-9][0-9]{0,77})$/).nullable().clone().register(v.apiMetadata,{description:"In the token\u2019s own base units. null withdraws the whole balance, dust included."})}).clone().register(v.apiMetadata,{id:"Withdrawal"});m.Card=u.z.object({id:$.Id,brand:u.z.string().nullable(),last4:u.z.string().length(4).nullable(),country:u.z.string().regex(/^[A-Z]{2}$/).nullable().clone().register(v.apiMetadata,{description:"Issuing country from the card BIN; null until the issuer attributes are read."}),state:u.z.enum(["collecting","verifying","active","removed","failed"]),is_default:u.z.boolean(),created_at:$.Timestamp}).clone().register(v.apiMetadata,{id:"Card",description:"The owner\u2019s enrolled card. Entered once; agents get grants, never per-agent cards."});m.CardEnrollment=u.z.object({card:m.Card,setup_id:$.Id.clone().register(v.apiMetadata,{description:"The setup of kind card that carries this enrollment."}),collect:u.z.object({vault_id:u.z.string(),environment:u.z.string(),form_token:u.z.string()}).clone().register(v.apiMetadata,{description:"Configuration for the VGS hosted fields. Card numbers never reach Visa servers. form_token is the card executor\u2019s Collect bearer for this setup."})}).clone().register(v.apiMetadata,{id:"CardEnrollment"});m.CardEnrollmentAlreadyStarted=u.z.object({card:m.Card,setup_id:$.Id,already_started:Xp,message:Qp}).clone().register(v.apiMetadata,{id:"CardEnrollmentAlreadyStarted",description:"This request_id already started this enrollment; the card is shown as it is now. The hosted-fields form_token is not stored or shown again: to enter the card, start a new enrollment (a new request_id), which opens a fresh form."});m.ActivityItem=u.z.object({id:$.Id,kind:u.z.enum(["payment","grant","agent","setup","security","operation"]),at:$.Timestamp,agent_id:$.Id.nullable(),title:u.z.string(),word:$.OwnerStatusWordSchema.nullable(),payment:m.Payment.nullable(),authority:u.z.object({action:u.z.string(),actor_kind:u.z.enum(["owner","agent","operator","server"]),subject_type:u.z.string().nullable(),subject_id:u.z.string().nullable(),outcome:u.z.enum(["succeeded","refused","failed"]),reason_code:u.z.string().nullable()}).optional().clone().register(v.apiMetadata,{description:"Actual retained audit metadata. It does not prove a grant version or confer permission."})}).clone().register(v.apiMetadata,{id:"ActivityItem"});m.ActivityList=u.z.object({items:u.z.array(m.ActivityItem),page:$.Page}).clone().register(v.apiMetadata,{id:"ActivityList"});m.SpendingState=u.z.object({state:u.z.enum(["open","stopped"]),changed_at:$.Timestamp.nullable(),continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"SpendingState",description:"The owner\u2019s stop-all switch. Stopping is immediate, from any owner session; reopening needs the current Console product owner session and CSRF protection. Withdrawals, export and cleanup continue while stopped."});m.Security=u.z.object({sessions:u.z.array(m.Session),events:u.z.array(u.z.object({at:$.Timestamp,kind:u.z.string(),detail:u.z.string(),actor:u.z.string(),agent_id:$.Id.nullable().optional().clone().register(v.apiMetadata,{description:"The agent the event is about, when it is about one."})})),devices:u.z.array(m.Device).optional().clone().register(v.apiMetadata,{description:"The phones registered for notifications, newest first (never their tokens): what the owner removes with owner.devices.remove."}),spending:m.SpendingState}).clone().register(v.apiMetadata,{id:"Security",description:"Read from the audit log; its reader is Authority. Events are the newest 100 security events only (sign-in, sign-in methods, agents and their keys, setups, limits, TAP, contact email, spending stop/reopen, recovery), so payments never crowd them out."});var OT=u.z.object({id:$.Id,kind:u.z.string(),title:u.z.string(),since:$.Timestamp});m.Console=u.z.object({owner:m.Owner.extend({eligibility:u.z.enum(["unchecked","eligible","ineligible"]).clone().register(v.apiMetadata,{description:"Stored US-card eligibility, established by eligible US card enrollment and VIC verification. Independent of admission and current card inventory; remains eligible after the last card is removed."})}),readiness:u.z.array($.Readiness),agents:u.z.array(m.Agent).max(100),agents_page:u.z.object({truncated:u.z.boolean(),next_cursor:u.z.string().nullable()}).optional(),wallet:m.Wallet.nullable(),cards:u.z.array(m.Card),pending_approvals:u.z.number().int().min(0),needs_attention:u.z.array(OT),spending:m.SpendingState,payment_availability:u.z.object({tempo:u.z.object({setup_rail_enabled:u.z.boolean().clone().register(v.apiMetadata,{description:"Current Tempo rail switch; custody setup retains its own owner guards."}),admission_enabled:u.z.boolean().clone().register(v.apiMetadata,{description:"Spending admission and Tempo rail are enabled; each payment still checks its current guards."})}),selectable_modes:u.z.object({laptop:u.z.tuple([u.z.literal("ask_each_time"),u.z.literal("within_limit")]),hosted:u.z.tuple([u.z.literal("ask_each_time")])}).clone().register(v.apiMetadata,{description:"Modes the existing grant command can save, separately from executable payments."}),within_limit_available:u.z.object({laptop:u.z.object({tempo:u.z.boolean()}),hosted:u.z.object({tempo:u.z.literal(!1)})}).clone().register(v.apiMetadata,{description:"Shared payment-mode policy allows the mode; admission, stops and grant limits remain separate."}),owner_approved_payments:u.z.object({enabled:u.z.boolean(),reason:u.z.literal("owner_approved_payments_paused").nullable()}),card_payments:u.z.object({enabled:u.z.literal(!1),reason:u.z.literal("card_rail_not_built")})}).clone().register(v.apiMetadata,{description:"Current service and mode availability; wallet custody readiness is independent and this read never authorizes a payment."})}).clone().register(v.apiMetadata,{id:"Console",description:"The screen answer: everything the Console home needs in one read. The server decides what is allowed and what comes next."});m.WalletSigningContext=u.z.object({chain_id:u.z.number().int(),account_address:u.z.string().clone().register(v.apiMetadata,{description:"The owner wallet that pays (charge.account)."}),access_key_address:u.z.string(),access_key_public_key:u.z.string().clone().register(v.apiMetadata,{description:"Used by the transaction serializer; the laptop prepares charges with it."}),sub_organization_id:u.z.string().clone().register(v.apiMetadata,{description:"The provider organisation (keyRef.subOrganizationId)."}),key_generation:u.z.number().int().min(1),limit:$.Amount.clone().register(v.apiMetadata,{description:"The chain-enforced limit mirroring the grant."}),expires_at:$.Timestamp,swap_available:u.z.boolean()}).clone().register(v.apiMetadata,{id:"WalletSigningContext",description:"The current-generation wallet signing context of this installation, bound to its approved key and payer. Everything the laptop needs to prepare a charge before admission."});m.AgentStatus=u.z.object({agent:m.Agent.nullable(),installation_id:$.Id.nullable(),wallet_context:m.WalletSigningContext.nullable(),readiness:u.z.array($.Readiness),min_cli_version:u.z.string(),renewal_due_at:$.Timestamp.nullable().optional().clone().register(v.apiMetadata,{description:"When the owner's spending renewal is due (the account's one date). From 7 days before it, tell the user once per cycle; after it, new payments refuse grant_required (renewal_required) until the owner renews in the Console. Status and cancellation keep working."}),continuation:$.Continuation.nullable()}).clone().register(v.apiMetadata,{id:"AgentStatus",description:"The live oracle for an agent: identity, every capability\u2019s rung and what comes next. Clients trust it over any document."});m.MerchantResult=u.z.object({results:u.z.array(u.z.object({name:u.z.string(),url:u.z.url(),description:u.z.string().nullable(),listed_price:$.Amount.nullable().clone().register(v.apiMetadata,{description:"Advisory; the payment re-prices."}),rails:u.z.array($.Rail),method:u.z.enum(["GET","POST"]).optional(),request_format:u.z.enum(["json","query"]).optional().clone().register(v.apiMetadata,{description:"How the listed input is sent: JSON body or query."}),input:u.z.record(u.z.string(),u.z.unknown()).optional().clone().register(v.apiMetadata,{description:"The provider\u2019s declared input schema (advisory)."}),price_hint:u.z.string().optional().clone().register(v.apiMetadata,{description:"The listing\u2019s free-text price hint (advisory)."}),pricing_dynamic:u.z.boolean().optional(),service_id:u.z.string().optional()})),probe:u.z.object({url:u.z.url(),payable:u.z.boolean(),price:$.Amount.nullable(),rail:$.Rail.nullable()}).nullable()}).clone().register(v.apiMetadata,{id:"MerchantResult",description:"Read-only: searching and probing never spend."});m.ClientEvent=u.z.object({name:u.z.string().regex(/^[a-z][a-z0-9_.]*$/),at:$.Timestamp,attributes:u.z.record(u.z.string(),u.z.union([u.z.string(),u.z.number(),u.z.boolean()]))}).clone().register(v.apiMetadata,{id:"ClientEvent",description:"A closed-schema client event. Never secrets, keys, tokens, card data, passkey material, prompts or request content; filtered before every sink."});m.ToolDescriptor=u.z.object({name:u.z.string(),description:u.z.string(),input_schema:u.z.record(u.z.string(),u.z.unknown())}).clone().register(v.apiMetadata,{id:"ToolDescriptor"})});var nf=j(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.ADMIN_OPERATIONS=fe.PolicyAuditEntry=fe.AuditEntry=fe.MerchantRule=fe.Control=fe.AdminUser=fe.AdminClosedAccount=fe.AdminOperation=void 0;var y=Je(),tt=it(),kT=Un(),Pr=dr(),ue=ct(),ve=["operator_session"];fe.AdminOperation=ue.Operation.extend({owner_id:ue.Id.nullable(),agent_id:ue.Id.nullable(),due_at:ue.Timestamp,next_action:y.z.string().nullable(),waiting_on:y.z.string().nullable().clone().register(tt.apiMetadata,{description:"Why the operation last stopped (its error class), e.g. closure_awaiting_reconciliation."})}).clone().register(tt.apiMetadata,{id:"AdminOperation"});fe.AdminClosedAccount=y.z.object({owner_id:ue.Id,lifecycle:y.z.enum(["closing","closed"]),closed_at:ue.Timestamp.nullable(),closure:fe.AdminOperation.nullable(),wallet:Pr.Wallet.nullable().clone().register(tt.apiMetadata,{description:"Read from the chain now; null when the read failed (never shown as empty)."}),wallet_status:y.z.enum(["read","unavailable","none"]),blockers:y.z.array(y.z.enum(["funds_remain","balance_unavailable","payments_unresolved","withdrawal_open","keys_not_cleared","holdings_unknown"])).clone().register(tt.apiMetadata,{description:"What a closing account still waits on, read now (empty once closed). Funds never hold closure: they stay the owner's exit obligation."})}).clone().register(tt.apiMetadata,{id:"AdminClosedAccount"});fe.AdminUser=Pr.Owner.extend({login:y.z.string(),is_admin:y.z.boolean(),tags:y.z.array(y.z.string()),agents:y.z.number().int(),spent_24h_micros:ue.Micros.optional().clone().register(tt.apiMetadata,{description:"admin.users.get only: what the owner spent and holds against their operator limit in the last 24 hours."})}).clone().register(tt.apiMetadata,{id:"AdminUser"});fe.Control=y.z.object({key:y.z.string(),type:y.z.enum(["capability","spending_limit","agent_override","block"]),scope:y.z.enum(["global","owner","agent"]),subject:ue.Id.nullable(),value:y.z.union([y.z.boolean(),y.z.string()]).nullable().clone().register(tt.apiMetadata,{description:"null = absent (the typed default applies)."}),default_meaning:y.z.string().clone().register(tt.apiMetadata,{description:"capability: deny. spending_limit: zero spend. agent_override: inherit. block: not blocked."}),updated_at:ue.Timestamp.nullable(),updated_by:y.z.string().nullable()}).clone().register(tt.apiMetadata,{id:"Control",description:"A typed control with an explicit default. Precedence global \u2192 owner \u2192 agent; blocks always win; an outage fails closed. Every change is audited."});fe.MerchantRule=y.z.object({origin:y.z.string(),decision:y.z.enum(["allow","block","review"]),reason:y.z.string().max(500).nullable(),reason_code:y.z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),updated_by:y.z.uuid().nullable(),updated_at:ue.Timestamp}).clone().register(tt.apiMetadata,{id:"MerchantRule"});fe.AuditEntry=y.z.object({id:ue.Id,at:ue.Timestamp,actor:y.z.string(),action:y.z.string(),subject:y.z.string().nullable(),detail:y.z.string(),actor_name:y.z.string().nullable().optional(),actor_email:y.z.string().nullable().optional(),owner_id:ue.Id.nullable().optional(),owner_name:y.z.string().nullable().optional(),owner_email:y.z.string().nullable().optional(),agent_id:ue.Id.nullable().optional(),control:y.z.object({key:y.z.string(),scope:y.z.enum(["global","owner","agent"]),agent_id:ue.Id.nullable(),enabled:y.z.boolean().nullable(),limit_micros:y.z.string().nullable()}).optional()}).clone().register(tt.apiMetadata,{id:"AuditEntry"});var ef=y.z.object({decision:y.z.enum(["allow","block","review"]),reason:y.z.string().nullable()}).nullable();fe.PolicyAuditEntry=fe.AuditEntry.extend({change:y.z.enum(["set","clear"]),before:ef,after:ef}).clone().register(tt.apiMetadata,{id:"PolicyAuditEntry"});var tf=y.z.object({login:y.z.string()});fe.ADMIN_OPERATIONS=(0,kT.defineOperations)([{id:"admin.session.start",backedBy:"edge",family:"admin",method:"POST",path:"/admin/v1/session",summary:"Open an operator session",description:"Needs an existing verified product owner session (never the exit session), its X-CSRF-Token, and current operator membership. No second sign-in assertion is required. Sets the visa_operator_session cookie (HttpOnly, Secure, SameSite=Strict, Path=/admin/v1); every admin write then sends X-CSRF-Token with the csrf_token answered here, and operator membership is re-checked on every request.",auth:["owner_session"],body:y.z.object({}).strict(),response:y.z.object({expires_at:ue.Timestamp,csrf_token:y.z.string()}),status:201,errors:["blocked","setup_required"],launch:"on"},{id:"admin.session.end",backedBy:"edge",family:"admin",method:"DELETE",path:"/admin/v1/session",summary:"Operator sign-out",auth:ve,response:null,status:204,errors:[],launch:"on"},{id:"admin.users.list",family:"admin",method:"GET",path:"/admin/v1/users",summary:"List owners",auth:ve,query:ue.PageQuery.extend({q:y.z.string().optional(),access:Pr.Owner.shape.access.optional()}),response:y.z.object({users:y.z.array(fe.AdminUser),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.users.get",family:"admin",method:"GET",path:"/admin/v1/users/:login",summary:"Read one owner",auth:ve,params:tf,response:fe.AdminUser,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"admin.users.update",family:"admin",method:"PATCH",path:"/admin/v1/users/:login",summary:"Change an owner\u2019s access, admin role or tags",description:"Granting admin needs a second admin\u2019s approval (admin requests).",auth:ve,params:tf,body:y.z.object({access:Pr.Owner.shape.access.optional(),is_admin:y.z.boolean().optional(),tags:y.z.array(y.z.string()).optional()}),response:fe.AdminUser,status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"admin.users.bulk",family:"admin",method:"POST",path:"/admin/v1/users/bulk",summary:"Approve or reject several owners",auth:ve,body:y.z.object({logins:y.z.array(y.z.string()).min(1).max(200),access:y.z.enum(["approved","rejected"])}),response:y.z.object({updated:y.z.number().int()}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.adminRequests.list",family:"admin",method:"GET",path:"/admin/v1/admin-requests",summary:"Pending two-admin grant requests",auth:ve,response:y.z.object({requests:y.z.array(y.z.object({id:ue.Id,login:y.z.string(),requested_by:y.z.string(),at:ue.Timestamp}))}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.controls.list",family:"admin",method:"GET",path:"/admin/v1/controls",summary:"Read every control (capabilities, limits, overrides, blocks, kill switch)",auth:ve,query:y.z.object({scope:fe.Control.shape.scope.optional(),subject:ue.Id.optional()}),response:y.z.object({controls:y.z.array(fe.Control)}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.controls.set",family:"admin",method:"PUT",path:"/admin/v1/controls/:key",summary:"Set or clear one control",description:"Setting value null makes the control absent, so its typed default applies. Stopping spending admission is the operator kill switch.",auth:ve,params:y.z.object({key:y.z.string()}),body:y.z.object({scope:fe.Control.shape.scope,subject:ue.Id.nullable(),value:fe.Control.shape.value,reason:y.z.string().min(1)}),response:fe.Control,status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"admin.activation.request",family:"admin",method:"POST",path:"/admin/v1/activation",summary:"Ask to turn spending on after the rebuild (proposal 3)",description:"Creates the spending_activation approval, bound to this operator session and live for ten minutes. Only the named operator may (Dom, 8 Oct); the operator is the session, never the body, and no email code is asked. #10366: a passkey step-up and two-person approval are required before production.",auth:ve,body:y.z.object({}).strict(),response:y.z.object({approval_id:ue.Id,expires_at:ue.Timestamp}),status:202,errors:["setup_required","blocked","invalid_request","conflict"],launch:"on"},{id:"admin.activation.approve",family:"admin",method:"POST",path:"/admin/v1/activation/:approvalId/approve",summary:"Approve the activation from the same session: spending opens, once",description:"Opens spending admission and the Tempo rail in one audited step, once. Only the operator session that asked approves (the approval records it as evidence operator_session). One operator for now (Dom, 8 Oct): the requester approves; #10366: a passkey step-up and two-person approval (approver not the requester, enforced) are required before production. Stopping and reopening are admin.controls.set.",auth:ve,params:y.z.object({approvalId:ue.Id}),body:y.z.object({}).strict(),response:y.z.object({activated:y.z.enum(["now","already"]),approval_id:ue.Id}),status:200,errors:["setup_required","blocked","invalid_request","not_found","expired","conflict"],launch:"on"},{id:"admin.policy.defaults.get",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/defaults",summary:"Read Policy\u2019s default rules",auth:ve,response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"future"},{id:"admin.policy.defaults.set",backedBy:"policy",family:"admin",method:"PUT",path:"/admin/v1/policy/defaults",summary:"Replace Policy\u2019s default rules",auth:ve,body:y.z.record(y.z.string(),y.z.unknown()),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required","conflict"],launch:"future"},{id:"admin.policy.merchants.list",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/merchants",summary:"List merchant rules",auth:ve,query:y.z.object({after:y.z.string().optional()}),response:y.z.object({merchants:y.z.array(fe.MerchantRule),nextAfter:y.z.string().nullable()}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.merchants.set",backedBy:"policy",family:"admin",method:"PUT",path:"/admin/v1/policy/merchants/:origin",summary:"Set a merchant rule",auth:ve,params:y.z.object({origin:y.z.string()}),body:fe.MerchantRule.pick({decision:!0,reason:!0}).partial({reason:!0}).strict(),response:fe.MerchantRule,status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.merchants.remove",backedBy:"policy",family:"admin",method:"DELETE",path:"/admin/v1/policy/merchants/:origin",summary:"Remove a merchant rule",auth:ve,params:y.z.object({origin:y.z.string()}),response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"admin.policy.simulate",backedBy:"policy",family:"admin",method:"POST",path:"/admin/v1/policy/simulate",summary:"Simulate a Policy decision",auth:ve,body:y.z.record(y.z.string(),y.z.unknown()),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"future"},{id:"admin.policy.audit",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/audit",summary:"Policy\u2019s rule-change history, each change with its before and after",auth:ve,query:ue.PageQuery,response:y.z.object({entries:y.z.array(fe.PolicyAuditEntry),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.status",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/screening",summary:"Whether wallet payees are being screened, its settings and the last day",auth:ve,response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.set",backedBy:"policy",family:"admin",method:"PUT",path:"/admin/v1/policy/screening",summary:"Turn screening enforcement on or off, or change its block level and reuse window",auth:ve,body:y.z.object({required:y.z.boolean().optional(),blockLevel:y.z.union([y.z.literal(5),y.z.literal(10),y.z.literal(15)]).optional(),reuseSeconds:y.z.number().int().min(0).max(604800).optional()}),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required","conflict"],launch:"on"},{id:"admin.policy.screening.results",backedBy:"policy",family:"admin",method:"GET",path:"/admin/v1/policy/screening/results",summary:"The screening record: every payment, withdrawal and operator check",auth:ve,query:y.z.object({outcome:y.z.enum(["allow","deny","unavailable","bypass"]).optional(),before:y.z.string().uuid().optional(),limit:y.z.coerce.number().int().min(1).max(500).optional(),scope:y.z.literal("traffic").optional()}),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.check",backedBy:"policy",family:"admin",method:"POST",path:"/admin/v1/policy/screening/check",summary:"What a payment to this address or merchant would meet now: the block list, then TRM; keeps nothing",auth:ve,body:y.z.union([y.z.object({chainId:y.z.union([y.z.literal(4217),y.z.literal(8453)]),address:y.z.string()}),y.z.object({merchantUrl:y.z.string()})]),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.policy.screening.rescreen",backedBy:"policy",family:"admin",method:"POST",path:"/admin/v1/policy/screening/rescreen",summary:"Screen one address now and replace the answer payments reuse",auth:ve,body:y.z.object({chainId:y.z.union([y.z.literal(4217),y.z.literal(8453)]),address:y.z.string()}),response:y.z.record(y.z.string(),y.z.unknown()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.audit.list",family:"admin",method:"GET",path:"/admin/v1/audit",summary:"The append-only audit log",auth:ve,query:ue.PageQuery.extend({subject:y.z.string().optional(),actor_kind:y.z.enum(["owner","agent","operator","server"]).optional()}),response:y.z.object({entries:y.z.array(fe.AuditEntry),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.metrics.get",family:"admin",method:"GET",path:"/admin/v1/metrics",summary:"Operator metrics",auth:ve,response:y.z.record(y.z.string(),y.z.number()),status:200,errors:["setup_required"],launch:"on"},{id:"admin.agents.list",family:"admin",method:"GET",path:"/admin/v1/agents",summary:"List agents across owners",auth:ve,query:ue.PageQuery.extend({login:y.z.string().optional()}),response:y.z.object({agents:y.z.array(Pr.Agent),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.agents.tap",family:"admin",method:"POST",path:"/admin/v1/agents/:agentId/tap",summary:"Retry or reset an agent\u2019s TAP setup",description:"retry: clear the background job\u2019s backoff and list the agent\u2019s TAP key in the directory now. reset: end the TAP key at once (no TAP signature with it from then on), withdraw its directory entry through a provider_cleanup operation, and enroll and list a new one when the deployment can (otherwise the owner\u2019s finish_tap_setup step does). Never moves money. Every action is written to the audit log with the operator and the reason code. Contract proposal 29.",auth:ve,params:y.z.object({agentId:ue.Id}),body:y.z.object({action:y.z.enum(["retry","reset"]),reason:y.z.enum(["stuck_publication","directory_conflict","owner_request","other"])}),response:Pr.Agent,status:200,errors:["setup_required","invalid_request","not_found","agent_inactive","not_enabled"],launch:"on"},{id:"admin.operations.list",family:"admin",method:"GET",path:"/admin/v1/operations",summary:"Operations that need attention, across owners",description:"Stuck, overdue or unsafe operations, each with its owner, age, next action and evidence.",auth:ve,query:ue.PageQuery.extend({needs_attention:y.z.enum(["true","false"]).optional()}),response:y.z.object({operations:y.z.array(fe.AdminOperation),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.operations.resolve",family:"admin",method:"POST",path:"/admin/v1/operations/:id/resolve",summary:"Mark a stuck operation failed or succeeded, on proof",description:"Decision A4: operators never initiate, re-send, change or approve a payment, and there is no operator retry. Financial operations (withdrawal) take money proofs: mark_failed requires Authority to independently verify the bound transaction\u2019s reverted receipt; a missing report, pending receipt or chain outage cannot prove no money moved. mark_succeeded must name the bound transaction and is independently reconciled before success. Non-money operations (cleanup, closure, recovery, telemetry deletion) take removal proofs: mark_succeeded with proof the provider removal is confirmed, mark_failed with proof it was not done. A proof of the wrong kind for the operation is refused (invalid_request). Every resolution is written to the audit log with the operator and the evidence.",auth:ve,params:y.z.object({id:ue.Id}),body:y.z.discriminatedUnion("resolution",[y.z.object({resolution:y.z.literal("mark_failed"),evidence:y.z.object({proves:y.z.enum(["no_money_moved","removal_not_done"]),ref:y.z.string().min(1).clone().register(tt.apiMetadata,{description:"Chain read, provider record or ticket that shows it."})})}),y.z.object({resolution:y.z.literal("mark_succeeded"),evidence:y.z.object({proves:y.z.enum(["money_moved","removal_confirmed"]),ref:y.z.string().min(1).clone().register(tt.apiMetadata,{description:"Transaction hash or provider record that shows it."})})})]),response:fe.AdminOperation,status:200,errors:["setup_required","not_found","conflict","unavailable"],launch:"on"},{id:"admin.payments.attention",family:"admin",method:"GET",path:"/admin/v1/payments/attention",summary:"Payments that need attention, across owners",description:"Purchases whose answer was lost, that are overdue to settle, or whose paid result did not arrive, oldest first. The reconciler resolves them from chain evidence; operators never act on a payment (decision A4), so this is a read.",auth:ve,response:y.z.object({payments:y.z.array(y.z.object({payment_id:ue.Id,owner_id:ue.Id,agent_id:ue.Id,reason:y.z.enum(["outcome_unknown","overdue","paid_result_unavailable","paid_result_overdue"]),state:y.z.string(),age_seconds:y.z.number().int()})),truncated:y.z.boolean()}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.closures.list",family:"admin",method:"GET",path:"/admin/v1/closures",summary:"Closing and closed accounts and the money they still hold",description:"The closed-account obligations list: every closing or closed account with a wallet, its closure operation and its balances read from the chain now. Funds stay the owner's to withdraw from the exit page; operators never move them.",auth:ve,query:ue.PageQuery,response:y.z.object({accounts:y.z.array(fe.AdminClosedAccount),page:ue.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"admin.db.query",family:"admin",method:"POST",path:"/admin/v1/db/query",summary:"Audited read-only SQL",auth:ve,body:y.z.object({sql:y.z.string(),store:y.z.enum(["postgres","redis"]).optional()}),response:y.z.object({rows:y.z.array(y.z.record(y.z.string(),y.z.unknown())),truncated:y.z.boolean()}),status:200,errors:["setup_required","blocked"],launch:"on"}])});var of=j(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.AGENT_OPERATIONS=void 0;var ie=Je(),af=it(),PT=Kr(),ht=Un(),Le=dr(),pr=ct(),Us=ie.z.object({id:pr.Id}),Zs=ie.z.object({id:pr.Id.clone().register(af.apiMetadata,{description:"The agent's request_id for the payment (the key it always holds, even after a lost answer). Visa's payment id is not accepted here."})}),rf=["setup_required","update_required","agent_inactive","grant_required","limit_reached","owner_approval_required","owner_declined","blocked","merchant_unsupported","conflict","outcome_unknown","not_enabled"];co.AGENT_OPERATIONS=(0,ht.defineOperations)([...PT.NATIVE_FINANCIAL_OPERATIONS,{id:"agent.status.get",family:"agent",method:"GET",path:"/agent/v1/status",summary:"Identity, readiness and what comes next",auth:ht.AGENT_AUTH,response:Le.AgentStatus,status:200,errors:["setup_required","update_required"],launch:"on"},{id:"agent.token.create",family:"agent",method:"POST",path:"/agent/v1/token",summary:"Exchange an installation-key proof for a short access token",description:"Exchange a request signed by an active laptop installation key for an agent access token. Hosted agents use OAuth or an owner-issued app token. A CLI session is not an agent token.",auth:["agent_signature"],body:ie.z.object({audience:ie.z.string().optional()}),response:ie.z.object({access_token:ie.z.string(),expires_at:pr.Timestamp}),status:201,errors:["setup_required","update_required","agent_inactive"],launch:"on"},{id:"agent.setups.start",family:"agent",method:"POST",path:"/agent/v1/setups",summary:"Start (or resume) a laptop setup",description:"Returns the owner link. Repeating the same start resumes an interrupted setup. Hosted agents are set up by OAuth, not here.",auth:["none"],body:Le.AgentSetupStart,response:Le.AgentSetupStarted,status:201,errors:["update_required","conflict","blocked"],launch:"on"},{id:"agent.setups.get",family:"agent",method:"GET",path:"/agent/v1/setups/:id",summary:"Poll a setup",auth:["setup_secret"],params:Us,response:Le.Setup,status:200,errors:["not_found","expired"],launch:"on"},{id:"agent.setups.claim",family:"agent",method:"POST",path:"/agent/v1/setups/:id/claim",summary:"Claim an approved setup with the installation key",auth:["setup_secret"],params:Us,body:Le.SetupClaim,response:Le.SetupClaimed,status:200,errors:["not_found","expired","owner_approval_required","owner_declined","conflict"],launch:"on"},{id:"agent.keys.lease",family:"agent",method:"POST",path:"/agent/v1/keys/lease",summary:"Lease the installation for one operation",description:"Today the only operation is `tap_signature_base`: a `visa-agent-runtime-lease+jwt` (at most 120 s) from Authority\u2019s identity lease issuer, for this installation\u2019s TAP authority (contract proposal 28). The agent presents it to agent.keys.tapSign.",auth:["agent_signature","agent_token"],body:ie.z.object({operation:ie.z.literal("tap_signature_base"),request_id:pr.Id}),response:ie.z.object({lease:ie.z.string(),expires_at:pr.Timestamp}),status:201,errors:["setup_required","update_required","agent_inactive","not_enabled"],launch:"on"},{id:"agent.keys.tapSign",family:"agent",method:"POST",path:"/agent/v1/keys/tap-sign",summary:"Sign a merchant request with the agent\u2019s TAP key",description:"The identity gate signs the agent\u2019s TAP signature base (contract proposal 28). request_id is a new UUID per signature (the gate refuses a replay). authorization.lease comes from agent.keys.lease; authorization.pop_jwt is the installation key\u2019s proof: typ visa-agent-pop+jwt, aud urn:visa:tvc:identity-gate, nonce = request_id, int = the payload digest (identityTapPayloadSha256), at most 60 s old. The answer\u2019s signature_input and signature are the Signature-Input and Signature header values (label sig2).",auth:["agent_signature","agent_token"],body:ie.z.object({request_id:ie.z.uuid(),payload:Le.TapSignatureBasePayload,authorization:ie.z.object({lease:ie.z.string(),pop_jwt:ie.z.string()})}),response:ie.z.object({signature:ie.z.string(),signature_input:ie.z.string(),key_id:ie.z.string()}),status:200,errors:["setup_required","update_required","agent_inactive","not_enabled","expired","unavailable"],launch:"on"},{id:"agent.keys.reissue",family:"agent",method:"POST",path:"/agent/v1/keys/reissue",summary:"Pick up an owner-approved key re-issue (#10945)",auth:["agent_signature"],body:ie.z.object({installation_key:ie.z.record(ie.z.string(),ie.z.unknown()),proof:ie.z.string()}),response:ie.z.object({installation_id:pr.Id,key_generation:ie.z.number().int()}),status:200,errors:["setup_required","update_required","agent_inactive","owner_approval_required"],launch:"future"},{id:"agent.payments.create",family:"agent",method:"POST",path:"/agent/v1/payments",summary:"Create, co-sign, resume or recover a purchase",description:'One purchase, several steps, all under the same request_id (purchase identity: PURCHASE_IDENTITY_FIELDS; a different value under the same request_id is a conflict). Hosted (prepare): every payment first answers owner_approval_required (A2: the owner approves each connector payment at launch, whatever the grant mode or controls; ownerApprovalRequired); after approval the server runs the 402 exchange and returns the merchant result once. Laptop (admit \u2192 vote \u2192 resume): the laptop prepares the charge itself from its wallet signing context (agent.status.get), picks a new wire_request_id for this execution, and sends both with its independent proof (RuntimeAuthorization, nonce = wire_request_id); retries of the same execution reuse its wire_request_id, a replacement execution picks a new one under the same request_id; the server adds the delegation, lease and root key, admits it against the grant and controls, commits the attempt and its signing hash before contacting the provider (pre-dispatch fence), and answers with a signing exchange; the laptop verifies and votes directly with the provider on that attempt, records the vote, then resumes with the identical charge and a fresh proof to receive the signature. Recovery: repeating a step with the same request_id and identical terms returns the same attempt; a lost provider response is found again by reading the provider for the exact signing payload, otherwise the attempt stays fenced as unknown (dispatchRecovery). Time alone never closes a signed attempt: it stays fenced until a landed transaction settles it or finalized non-landing or a provider void closes it (executionDecision); only then may admit name it in replaces_attempt_id for a re-quote, which needs fresh consent above the consented terms. Hosted, after a credential was released, the credential is never re-sent: recover asks the merchant to verify the caller\u2019s receipt or job reference, otherwise the outcome is "paid, result unavailable" (hostedResumeDecision). Ask-each-time or over the limit: owner_approval_required, then resume. Spending switched off: the operator kill switch answers not_enabled (spending_admission_off); the owner\u2019s stop-all answers blocked (owner_spending_stopped).',auth:ht.AGENT_AUTH,body:Le.PaymentCreate,response:Le.Payment,status:200,idempotency:"request_id",controls:["spending_admission"],errors:rf,launch:"on"},{id:"agent.payments.list",family:"agent",method:"GET",path:"/agent/v1/payments",summary:"This agent\u2019s purchases, newest first",auth:ht.AGENT_AUTH,query:pr.PageQuery,response:Le.PaymentList,status:200,errors:["setup_required","update_required"],launch:"on"},{id:"agent.payments.get",family:"agent",method:"GET",path:"/agent/v1/payments/:id",summary:"Read a purchase, optionally waiting for it to change",description:"With `wait` (seconds, at most 30) the answer comes as soon as the purchase changes (its state or updated_at), or at the deadline with it unchanged: compare updated_at to tell which. A resolved purchase answers at once. Use it instead of polling in a loop, for example while the owner approves.",auth:ht.AGENT_AUTH,params:Zs,query:ie.z.object({wait:ie.z.coerce.number().int().min(0).max(30).optional()}),response:Le.Payment,status:200,errors:["setup_required","update_required","not_found"],launch:"on"},{id:"agent.payments.cancel",family:"agent",method:"POST",path:"/agent/v1/payments/:id/cancel",summary:"Cancel a purchase that has not executed",auth:ht.AGENT_AUTH,params:Zs,response:Le.Payment,status:200,errors:["setup_required","update_required","not_found","conflict","outcome_unknown"],launch:"on"},{id:"agent.payments.report",family:"agent",method:"POST",path:"/agent/v1/payments/:id/report",summary:"Report what the merchant delivered",auth:ht.AGENT_AUTH,params:Zs,body:Le.PaymentReport,response:Le.Payment,status:200,errors:["setup_required","update_required","not_found","conflict"],launch:"on"},{id:"agent.payments.credential",family:"agent",method:"POST",path:"/agent/v1/payments/:id/credential",summary:"Deliver the card credential for an admitted card purchase",description:"Future, not in the launch build (A1 cut card paying; enrollment, IDV and TAP stay). Before it returns: the testers\u2019 CLI drained and the floor raised, existing card records resolved, enrollment and TAP proven on real Postgres, the code saved on a tagged branch, and the credential-delivery decision (P1). Then: an unsupported card host is refused before any credential is issued.",auth:ht.AGENT_AUTH,params:Us,body:ie.z.object({host:ie.z.string().clone().register(af.apiMetadata,{description:"The agent host, checked against the card host support matrix."})}),response:Le.CardCredential,status:200,controls:["card_payments_enabled","spending_admission"],errors:["setup_required","update_required","not_found","not_enabled","expired","outcome_unknown","merchant_unsupported"],launch:"future"},{id:"agent.merchants.search",family:"agent",method:"GET",path:"/agent/v1/merchants",summary:"Search paid services, or probe one target\u2019s live terms",description:"Read-only: signs and spends nothing. Listed prices are advisory.",auth:ht.AGENT_AUTH,query:ie.z.object({q:ie.z.string().optional(),target:ie.z.url().optional(),limit:ie.z.coerce.number().int().min(1).max(50).optional()}),response:Le.MerchantResult,status:200,errors:["setup_required","update_required","unavailable"],launch:"on"},{id:"agent.events.create",backedBy:"edge",family:"agent",method:"POST",path:"/agent/v1/events",summary:"Send closed-schema client events",auth:[...ht.AGENT_AUTH,"none"],body:ie.z.object({events:ie.z.array(Le.ClientEvent).max(50)}),response:null,status:204,errors:[],launch:"on"},{id:"agent.tools.list",backedBy:"edge",family:"agent",method:"GET",path:"/agent/v1/tools",summary:"The MCP tool catalogue, for REST apps",auth:ht.AGENT_AUTH,response:ie.z.object({tools:ie.z.array(Le.ToolDescriptor)}),status:200,errors:["setup_required"],launch:"on"},{id:"agent.tools.call",family:"agent",method:"POST",path:"/agent/v1/tools/:name",summary:"Call one MCP tool over REST",auth:ht.AGENT_AUTH,params:ie.z.object({name:ie.z.string()}),body:ie.z.record(ie.z.string(),ie.z.unknown()),response:ie.z.record(ie.z.string(),ie.z.unknown()),status:200,errors:[...rf,"not_found"],launch:"on"}])});var cf=j(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.OWNER_OPERATIONS=void 0;var sf=Kr(),T=Je(),Te=it(),jT=Un(),L=dr(),le=ct(),uf=le.Id.clone().register(Te.apiMetadata,{description:"Client-generated retry key, one per owner action: repeating it never creates a second one."}),qs=le.Operation.extend({hosted_setup_recovery:L.HostedSetupRecovery.nullable().optional(),withdrawal_transaction:L.WithdrawalTransaction.nullable().optional(),wallet_key_authorization:L.WalletKeyAuthorizationResume.nullable().optional()}),Ee=["owner_session"],be=["owner_session","owner_exit_session"],jr=T.z.object({agentId:le.Id}),Ke=T.z.object({id:le.Id}),lo=e=>T.z.object({resource:e,challenge:L.Challenge});po.OWNER_OPERATIONS=(0,jT.defineOperations)([{id:"owner.session.start",backedBy:"edge",family:"owner",method:"POST",path:"/owner/v1/session",summary:"Start owner sign-in",description:"Begins Turnkey sign-in and the entry gate (Visa identity plus legal geo-blocking). Returns the challenge to complete at /owner/v1/session/verify.",auth:["none"],body:T.z.object({email:T.z.email().optional(),return_to:T.z.string().optional()}),response:T.z.object({challenge:L.Challenge,terms:T.z.object({bundle_version:T.z.string().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}(\.[0-9]+)?$/).clone().register(Te.apiMetadata,{description:"The legal bundle (Terms of Service and Privacy Notice) the owner accepts."}),terms_path:T.z.string().regex(/^\/legal\/[a-z-]+$/).clone().register(Te.apiMetadata,{description:"The Terms of Service page, on this API\u2019s own origin."}),privacy_path:T.z.string().regex(/^\/legal\/[a-z-]+$/).clone().register(Te.apiMetadata,{description:"The Privacy Notice page, on this API\u2019s own origin."})}).clone().register(Te.apiMetadata,{description:"What signing in accepts; the owner must see both links before verify."})}),status:202,errors:["blocked","not_enabled"],launch:"on"},{id:"owner.session.verify",backedBy:"edge",family:"owner",method:"POST",path:"/owner/v1/session/verify",summary:"Complete owner sign-in",description:"One Turnkey user is one owner, whichever of its sign-in methods (email code, Google, passkey) proved it: owners are keyed by the Turnkey user, never by an email. Refuses invalid_request (terms_acceptance_required) unless accepted_terms names the current legal bundle.",auth:["none"],body:T.z.object({challenge_id:le.Id,assertion:T.z.string(),accepted_terms:T.z.string().clone().register(Te.apiMetadata,{description:"The terms.bundle_version from owner.session.start, sent only when the owner accepted it. Required on every sign-in; recorded once per owner and version."}),identity_token:T.z.string().max(8192).optional().clone().register(Te.apiMetadata,{description:"The Google or Apple ID token of this sign-in, when it used one. Believed only when its signature checks against the provider's published keys and its account is one the signing-in Turnkey user holds; then the owner's name, verified email and Google photo are recorded (a name the owner set is kept). Never required: a sign-in without it, or with one that does not check, proceeds unchanged."})}),response:T.z.object({session:L.Session,owner:L.Owner,csrf_token:T.z.string().clone().register(Te.apiMetadata,{description:"Send it as the X-CSRF-Token header on every owner write in this session."}),signer:L.SessionSigner.nullable().optional().clone().register(Te.apiMetadata,{description:"Who may sign for the owner in this session (INT-3). Absent: not yet named."})}),status:201,errors:["expired","blocked"],launch:"on"},{id:"owner.session.get",backedBy:"edge",family:"owner",method:"GET",path:"/owner/v1/session",summary:"Read the current session",auth:be,response:T.z.object({session:L.Session,owner:L.Owner,csrf_token:T.z.string().clone().register(Te.apiMetadata,{description:"Send it as the X-CSRF-Token header on every owner write in this session."}),signer:L.SessionSigner.nullable().optional().clone().register(Te.apiMetadata,{description:"Who may sign for the owner in this session (INT-3). Absent: not yet named."})}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.session.end",backedBy:"edge",family:"owner",method:"DELETE",path:"/owner/v1/session",summary:"Sign out",auth:be,response:null,status:204,errors:[],launch:"on"},{id:"owner.sessions.list",backedBy:"edge",family:"owner",method:"GET",path:"/owner/v1/sessions",summary:"List the owner\u2019s signed-in sessions",auth:Ee,response:T.z.object({sessions:T.z.array(L.Session)}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.sessions.revoke",backedBy:"edge",family:"owner",method:"DELETE",path:"/owner/v1/sessions/:id",summary:"Revoke one session",auth:Ee,params:Ke,response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"owner.console.get",family:"owner",method:"GET",path:"/owner/v1/console",summary:"The Console screen answer",description:"One read for the Console home: readiness ladder per capability, agents, wallet, cards, pending approvals, needs-attention items and the stop-all state.",auth:be,response:L.Console,status:200,errors:["setup_required"],launch:"on"},{id:"owner.agents.list",family:"owner",method:"GET",path:"/owner/v1/agents",summary:"List agents",auth:be,query:T.z.object({section:T.z.enum(["live","ended"]).optional(),...le.PageQuery.shape}),description:"Live agents by default, including ending agents. The ended section preserves owner history. Each page is bounded to 100 with deterministic ordering and server-projected per-rail grant facts. Cursor pagination: pass next_cursor back as cursor (with the same section); null on the last page.",response:le.Page.extend({agents:T.z.array(L.Agent).max(100),truncated:T.z.boolean().optional()}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.agents.get",family:"owner",method:"GET",path:"/owner/v1/agents/:agentId",summary:"Read one agent",auth:be,params:jr,query:T.z.object({history_cursor:T.z.string().optional(),history_limit:T.z.coerce.number().int().min(1).max(100).optional()}),description:"Includes ended agents and a bounded exact grant terms history page, newest first; pass grant_history.next_cursor back as history_cursor for the next page. History is retained evidence, never active authority.",response:L.Agent,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.agents.update",family:"owner",method:"PATCH",path:"/owner/v1/agents/:agentId",summary:"Rename, pause or resume an agent",description:"Pausing blocks new admissions at once; resuming re-checks the current controls.",auth:Ee,params:jr,body:L.AgentPatch,response:L.Agent,status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"owner.agents.revoke",family:"owner",method:"DELETE",path:"/owner/v1/agents/:agentId",summary:"Revoke an agent",description:"New admissions stop at once. Signed admissions already issued live at most 60 s at SlipGate (a frozen verifier limit). Submitted money settles or reconciles; provider credentials and directory entries are cleaned up by a revocation_teardown operation.",auth:be,params:jr,response:T.z.object({agent:L.Agent,operation:le.Operation}),status:202,errors:["setup_required","not_found"],launch:"on"},{id:"owner.agents.reissue",family:"owner",method:"POST",path:"/owner/v1/agents/:agentId/reissue",summary:"Replace an agent\u2019s installation key (upgrade, planned or emergency)",description:"upgrade (#10945) and planned: a replacement setup the owner signs; the old generation ends when the new installation activates. emergency (device lost): the old installation\u2019s keys end immediately in this request, before any new device exists, and new admissions are refused from then on; the agent stays active with no usable key until the replacement setup completes. Admissions signed before it can still be honoured for up to 60 s at SlipGate, and money already submitted settles or reconciles. Agent identity and grants are kept in every case.",auth:Ee,params:jr,body:T.z.object({reason:T.z.enum(["upgrade","planned","emergency"])}),response:T.z.object({agent:L.Agent,setup:L.Setup,challenge:L.Challenge}),status:202,variants:[{status:200,description:"emergency: the old keys are already ended; the replacement setup is open.",response:T.z.object({agent:L.Agent,ended_installation_id:le.Id,keys_ended_at:le.Timestamp,admissions_honoured_until:le.Timestamp.clone().register(Te.apiMetadata,{description:"At most 60 s after keys_ended_at."}),setup:L.Setup})}],signed:!0,errors:["setup_required","not_found","agent_inactive"],launch:"on"},{id:"owner.tokens.list",family:"owner",method:"GET",path:"/owner/v1/agents/:agentId/tokens",summary:"List an agent\u2019s app tokens",description:"OWNER_OR_EXIT (decided 8 Oct, 10a): a leaving owner can list and then revoke every token of an app (owner.tokens.revoke), so disconnecting an app needs no extra operation.",auth:be,params:jr,response:T.z.object({tokens:T.z.array(L.AgentToken)}),status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.tokens.create",family:"owner",method:"POST",path:"/owner/v1/agents/:agentId/tokens",summary:"Mint an app token for an agent",description:"Send a request_id to retry safely: the same request_id never mints a second token; it answers 200 with the token it created (no secret, which is shown once and never stored) and says to revoke and create again if the secret was lost. The same request_id with a different app is a conflict. Without a request_id, minting again ends the agent\u2019s earlier token for that app.",auth:Ee,params:jr,body:T.z.object({app:T.z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional().clone().register(Te.apiMetadata,{description:"The app or harness the token is for. The label is server-assigned from it."}),request_id:uf.optional()}),response:L.AgentTokenCreated,status:201,variants:[{status:200,description:"A retry with the same request_id: the token it already created, without the secret.",response:L.AgentTokenAlreadyCreated}],idempotency:"request_id",errors:["setup_required","not_found","agent_inactive"],launch:"on"},{id:"owner.tokens.revoke",family:"owner",method:"DELETE",path:"/owner/v1/agents/:agentId/tokens/:keyId",summary:"Revoke an app token",auth:be,params:T.z.object({agentId:le.Id,keyId:le.Id}),response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"owner.setups.start",family:"owner",method:"POST",path:"/owner/v1/setups",summary:"Start a setup from the Console",description:"Laptop: returns the one command the owner pastes; the terminal joins with the setup key. Hosted: returns the connector link.",auth:Ee,body:L.OwnerSetupStart,idempotency:"request_id",response:T.z.object({setup:L.Setup,setup_key:T.z.string().nullable().clone().register(Te.apiMetadata,{description:"Laptop and replacement: the key in the command the owner pastes. Hosted: null (the connector\u2019s sign-in completes it)."})}),status:201,errors:["setup_required","blocked","conflict","not_found","agent_inactive"],launch:"on"},{id:"owner.setups.get",family:"owner",method:"GET",path:"/owner/v1/setups/:id",summary:"Read a setup",auth:Ee,params:Ke,response:L.Setup,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.setups.approve",family:"owner",method:"POST",path:"/owner/v1/setups/:id/approve",summary:"Approve a setup and its first grant",auth:Ee,params:Ke,body:T.z.object({grants:T.z.array(L.GrantRequest)}),response:lo(L.Setup),status:202,signed:!0,errors:["setup_required","not_found","expired","conflict"],launch:"on"},{id:"owner.setups.decline",family:"owner",method:"POST",path:"/owner/v1/setups/:id/decline",summary:"Decline a setup",auth:Ee,params:Ke,response:L.Setup,status:200,errors:["setup_required","not_found","expired"],launch:"on"},{id:"owner.grants.get",family:"owner",method:"GET",path:"/owner/v1/agents/:agentId/grants/:rail",summary:"Read an agent\u2019s current grant on one rail",auth:be,params:T.z.object({agentId:le.Id,rail:le.Rail}),query:T.z.object({grant_id:le.Id.optional().clone().register(Te.apiMetadata,{description:"An exact retained grant identity; combine with version to read its immutable terms without choosing a successor."}),version:T.z.coerce.number().int().min(1).optional().clone().register(Te.apiMetadata,{description:"An immutable terms version. Supply grant_id to disambiguate earlier identities after an ended grant is replaced. Usage and mode on Grant are current read facts, not historical snapshots."})}),response:L.Grant,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.grants.replace",family:"owner",method:"PUT",path:"/owner/v1/agents/:agentId/grants/:rail",summary:"Change a grant\u2019s terms (a new version)",description:"Lower limits or an earlier expiry: a new version that keeps the existing consent, applied at once (200). Higher limits, a later expiry, another period, a first grant on this rail, or a new card or key: fresh consent (202 with a challenge); nothing changes until it is signed. Usage carries across versions. A hosted agent\u2019s grant is always ask_each_time at launch (A2). Card grants are not in the launch build (A1).",auth:Ee,params:T.z.object({agentId:le.Id,rail:le.Rail}),body:T.z.object({terms:L.GrantTerms,mode:L.GrantMode.optional().clone().register(Te.apiMetadata,{description:"First grant only."})}),response:L.GrantChange,status:202,variants:[{status:200,description:"Narrower terms: applied with the existing consent.",response:L.GrantChange}],signed:!0,errors:["setup_required","not_found","agent_inactive","not_enabled"],launch:"on"},{id:"owner.grants.setMode",family:"owner",method:"PATCH",path:"/owner/v1/agents/:agentId/grants/:rail",summary:"Switch within_limit \u21C4 ask_each_time in place",description:"The required grant_id and version name the displayed grant whose terms the owner intends to change. Authority checks that exact grant/version for this owner, agent and rail under the owner lock before any consent or mutation; stale intent refuses conflict. Not a new version: the grant version, its consent and its usage are kept. Narrowing (to ask_each_time) applies at once (200). Widening (to within_limit) is a Console button action from the current product owner session with CSRF protection. It applies at once (200), recording and consuming an autonomy_increase consent; no email code or additional credential. Agent/CLI credentials and exit sessions cannot widen. Hosted agents cannot be widened at launch (A2): every hosted payment needs the owner\u2019s approval until a connector-side signing key exists, so widening a hosted agent is refused (not_enabled, hosted_autonomy_unsupported).",auth:Ee,params:T.z.object({agentId:le.Id,rail:le.Rail}),body:T.z.object({mode:L.GrantMode,grant_id:le.Id.clone().register(Te.apiMetadata,{description:"The displayed Grant.grant_id whose terms the owner intends to change."}),version:T.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).clone().register(Te.apiMetadata,{description:"The displayed Grant.version; must still be current at the effect boundary."})}),response:L.GrantChange,status:200,signed:!0,errors:["setup_required","not_found","agent_inactive","not_enabled","conflict"],launch:"on"},{id:"owner.approvals.list",family:"owner",method:"GET",path:"/owner/v1/approvals",summary:"List approvals waiting for the owner",auth:Ee,query:le.PageQuery.extend({state:T.z.enum(["requested","all"]).optional()}),response:T.z.object({approvals:T.z.array(L.Approval),page:le.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.approvals.get",family:"owner",method:"GET",path:"/owner/v1/approvals/:id",summary:"Read one approval",auth:Ee,params:Ke,response:L.Approval.extend({detail:L.ApprovalReviewDetail.nullable().optional(),native:sf.NativeAtumApprovalDetail.optional(),progress:L.OwnerPaymentProgress.optional()}),status:200,errors:["setup_required","not_found","unavailable","conflict"],launch:"on"},{id:"owner.approvals.approve",family:"owner",method:"POST",path:"/owner/v1/approvals/:id/approve",summary:"Approve one purchase",auth:Ee,params:Ke,body:T.z.object({original:L.OriginalHostedPurchaseContext.optional()}).optional(),response:T.z.union([lo(L.Approval).extend({prepared:L.OwnerPreparedPayment.optional()}),T.z.strictObject({resource:L.Approval,challenge:T.z.null(),native:sf.NativeAtumApprovalDetail})]),status:202,signed:!0,controls:["spending_admission"],errors:["setup_required","not_found","expired","conflict","limit_reached","not_enabled"],launch:"on"},{id:"owner.approvals.decline",family:"owner",method:"POST",path:"/owner/v1/approvals/:id/decline",summary:"Decline one purchase (terminal)",auth:Ee,params:Ke,response:L.Approval,status:200,errors:["setup_required","not_found","expired"],launch:"on"},{id:"owner.wallet.get",family:"owner",method:"GET",path:"/owner/v1/wallet",summary:"Read the owner wallet",auth:be,response:L.Wallet,status:200,errors:["setup_required"],launch:"on"},{id:"owner.wallet.enable",family:"owner",method:"POST",path:"/owner/v1/wallet",summary:"Enable the Tempo wallet",auth:Ee,response:lo(L.Wallet),variants:[{status:200,description:"The wallet is already enabled.",response:L.Wallet}],status:202,signed:!0,errors:["setup_required","conflict","not_enabled"],launch:"on"},{id:"owner.wallet.disable",family:"owner",method:"DELETE",path:"/owner/v1/wallet",summary:"Disable the wallet for spending",description:"Stops agent spending from the wallet. Funds stay withdrawable.",auth:be,response:T.z.object({wallet:L.Wallet,operation:le.Operation.nullable()}),status:202,errors:["setup_required"],launch:"on"},{id:"owner.wallet.withdraw",family:"owner",method:"POST",path:"/owner/v1/wallet/withdrawals",summary:"Withdraw from the wallet",description:"Recorded as a withdrawal operation with its immutable terms before any signature or broadcast. Repeating the same request_id returns the same operation (after a lost response). Another browser or the exit session finds it with owner.operations.list or .get (terms included) and fetches or renews its signing challenge with owner.operations.challenge. Works while spending is stopped. Any token the wallet holds, by contract address, dust included.",auth:be,body:L.Withdrawal,response:T.z.object({operation:le.Operation,challenge:L.Challenge}),status:202,signed:!0,errors:["setup_required","conflict"],launch:"on"},{id:"owner.wallet.withdrawals.cancel",family:"owner",method:"POST",path:"/owner/v1/wallet/withdrawals/:id/cancel",summary:"Cancel an unsigned or reverted withdrawal",description:"Ends a withdrawal waiting for the owner with no bound signed transaction and no unresolved broadcast. A reported transaction permits cancellation only after Authority independently verifies its reverted receipt and clears its binding. The historical hash remains recorded. The owner can then withdraw to another destination. Missing reports, balances and elapsed time never prove that signed bytes are unsent; unresolved or successor-bound transfers refuse cancellation (conflict).",auth:be,params:Ke,response:T.z.object({operation:le.Operation}),status:200,signed:!0,errors:["setup_required","not_found","conflict","unavailable"],launch:"on"},{id:"owner.cards.list",family:"owner",method:"GET",path:"/owner/v1/cards",summary:"List enrolled cards",auth:be,response:T.z.object({cards:T.z.array(L.Card)}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.cards.enroll",family:"owner",method:"POST",path:"/owner/v1/cards",summary:"Start enrolling a card (VGS hosted fields)",description:"Opens a setup of kind card and answers the VGS hosted-fields configuration. Card entry happens once, in VGS hosted fields. One card enrollment runs at a time: starting another ends the earlier unfinished one. Send a request_id to retry safely: the same request_id starts nothing new and answers 200 with that enrollment\u2019s current state and no form token (it is never stored); a new request_id opens a fresh form. To swap cards, enroll the new one, then remove the old one.",auth:Ee,body:T.z.object({request_id:uf.optional()}),response:L.CardEnrollment,status:201,variants:[{status:200,description:"A retry with the same request_id: the enrollment it already started, without a form token.",response:L.CardEnrollmentAlreadyStarted}],idempotency:"request_id",errors:["setup_required","blocked"],launch:"on"},{id:"owner.cards.collect",family:"owner",method:"POST",path:"/owner/v1/cards/:id/collect",summary:"Finish card collection",description:"Receives the VGS alias of the card the owner typed, with the email the card issuer verifies against and the owner\u2019s residency attestation. Reads the issuer attributes and applies the entry rule (a US-issued Visa card): an ineligible card stops here (blocked, `unsupported_issuer_country:<country>` or `unsupported_card_brand`) and nothing is enrolled. An eligible card is enrolled with VIC, the issuer sends a one-time code to its first delivery choice, and the card is answered as `verifying` with a card_enrollment challenge (signer card_otp) naming where the code went and the other choices. Calling it again with only `send_to` sends a new code to that choice (refused rate_limited inside `resend_in_seconds`; each new code invalidates the earlier ones). With only `restart: true` it starts the verification again on the card already collected, after the issuer refused the attempt. Answer the challenge with owner.signatures.submit { method: card_otp, code }; the owner then signs the acceptance with their own key, and only then is the card active and the owner eligible.",auth:Ee,params:Ke,body:T.z.union([T.z.object({aliases:T.z.object({card:T.z.string().min(1).max(256)}),email:T.z.email().max(254),residency_attested:T.z.literal(!0)}),T.z.object({send_to:T.z.string().min(1).max(512).clone().register(Te.apiMetadata,{description:"A delivery choice from the challenge: send a new code there."})}),T.z.object({restart:T.z.literal(!0).clone().register(Te.apiMetadata,{description:"Start the verification again with the card already collected (the owner never types it again): a fresh VIC enrollment, and a code to its first choice."})})]),response:lo(L.Card),status:202,signed:!0,errors:["setup_required","not_found","expired","blocked","conflict","rate_limited"],launch:"on"},{id:"owner.cards.update",family:"owner",method:"PATCH",path:"/owner/v1/cards/:id",summary:"Make a card the default",auth:Ee,params:Ke,body:T.z.object({is_default:T.z.literal(!0)}),response:L.Card,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.cards.remove",family:"owner",method:"DELETE",path:"/owner/v1/cards/:id",summary:"Remove a card",description:"Also revokes the VIC mandates of every grant that used it (a provider_cleanup operation).",auth:be,params:Ke,response:T.z.object({card:L.Card,operation:le.Operation.nullable()}),status:202,errors:["setup_required","not_found"],launch:"on"},{id:"owner.activity.list",family:"owner",method:"GET",path:"/owner/v1/activity",summary:"List activity",auth:be,query:le.PageQuery.extend({agent_id:le.Id.optional(),kind:L.ActivityItem.shape.kind.optional()}),response:L.ActivityList,status:200,errors:["setup_required"],launch:"on"},{id:"owner.activity.get",family:"owner",method:"GET",path:"/owner/v1/activity/:id",summary:"Read one activity item",auth:be,params:Ke,response:L.ActivityItem,status:200,errors:["setup_required","not_found"],launch:"on"},{id:"owner.activity.export",family:"owner",method:"GET",path:"/owner/v1/activity/export",summary:"Export activity as CSV",auth:be,query:T.z.object({from:le.Timestamp.optional(),to:le.Timestamp.optional()}),response:T.z.string().clone().register(Te.apiMetadata,{description:"text/csv"}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.security.get",family:"owner",method:"GET",path:"/owner/v1/security",summary:"Sessions, security history and the stop-all state",auth:be,response:L.Security,status:200,errors:["setup_required"],launch:"on"},{id:"owner.spending.stop",family:"owner",method:"POST",path:"/owner/v1/spending/stop",summary:"Stop all spending now",description:"Takes effect at once. Allowed from the exit session too: a refused or closing owner may always stop spending, withdraw and export. Withdrawals, export and cleanup continue while stopped.",auth:be,response:T.z.object({spending:L.SpendingState}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.spending.reopen",family:"owner",method:"POST",path:"/owner/v1/spending/reopen",summary:"Reopen spending from the Console",description:"A Console button action from the current product owner session with CSRF protection; agent/CLI credentials and exit sessions cannot reopen. Reopens only the owner\u2019s own stop at once, retaining a consumed autonomy_increase consent. No email code or additional credential; an operator stop cannot be lifted.",auth:Ee,response:T.z.object({spending:L.SpendingState,challenge:T.z.null()}),status:200,signed:!0,errors:["setup_required","blocked"],launch:"on"},{id:"owner.account.update",family:"owner",method:"PATCH",path:"/owner/v1/account",summary:"Update the owner profile",auth:Ee,description:"contact_email: null clears the owner\u2019s contact email (proposal 10). Setting one goes through owner.contact.start.",body:T.z.object({display_name:T.z.string().max(80).optional(),photo:T.z.string().optional(),contact_email:T.z.null().optional()}),response:L.Owner,status:200,errors:["setup_required"],launch:"on"},{id:"owner.contact.start",family:"owner",method:"POST",path:"/owner/v1/account/contact",summary:"Prove a contact email address (TAP directory and essential notices)",description:"Sends a one-time code to the address and answers a challenge with signer email_code; the owner submits the code at owner.signatures.submit, and the address becomes contact_email (source owner_code). The code proves the address only: it never approves money, a setup or a grant (proposal 10). Owners whose sign-in provider vouched for an email already have one and are asked only at the TAP step.",auth:Ee,body:T.z.object({email:T.z.email().max(254)}),response:T.z.object({challenge:L.Challenge}),status:202,signed:!0,errors:["setup_required","blocked","unavailable"],launch:"on"},{id:"owner.account.export",family:"owner",method:"POST",path:"/owner/v1/account/export",summary:"Export the owner\u2019s data",auth:be,response:T.z.record(T.z.string(),T.z.unknown()).clone().register(Te.apiMetadata,{description:"The export document (JSON)."}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.devices.register",family:"owner",method:"PUT",path:"/owner/v1/devices/:id",summary:"Register this phone for notifications",description:"Registration only (nothing is sent at launch; it grants no authority). The id is the app\u2019s own: registering again updates the token in place. A token or app install registered under another account moves to this one. At most 20 devices. Works from the exit session, so a pending owner can be told when they are admitted. Closing the account deletes every device.",auth:be,params:Ke,body:T.z.object({platform:T.z.literal("ios"),app_env:T.z.enum(["preview","production"]),token:T.z.string().regex(/^[0-9a-fA-F]{16,200}$/).clone().register(Te.apiMetadata,{description:"The APNs device token (hex)."})}),response:L.Device,status:200,errors:["setup_required","invalid_request","conflict"],launch:"on"},{id:"owner.devices.remove",family:"owner",method:"DELETE",path:"/owner/v1/devices/:id",summary:"Stop notifications to a phone",auth:be,params:Ke,response:null,status:204,errors:["setup_required","not_found"],launch:"on"},{id:"owner.account.close",family:"owner",method:"POST",path:"/owner/v1/account/close",summary:"Close the account",description:"Starts an account_closure operation. It is accepted while money remains, a payment is unresolved or a withdrawal is open: signing it stops all spending at once, and the operation finishes after the reconciler settles payments (next_action reconcile_payments) and the owner withdraws (owner_withdraw). Closing keeps the owner\u2019s custody and exit sign-in, so later funds stay withdrawable; recovery can never revive spending authority. A never-used account (no wallet ever enabled, no agent ever set up) is closed on the owner\u2019s sign-in alone: `challenge` is null and the operation has already started.",auth:be,response:T.z.object({operation:le.Operation,challenge:L.Challenge.nullable()}),status:202,signed:!0,errors:["setup_required","conflict"],launch:"on"},{id:"owner.signatures.submit",family:"owner",method:"POST",path:"/owner/v1/signatures/:challengeId",summary:"Submit the owner\u2019s signature for a challenge",auth:be,params:T.z.object({challengeId:le.Id}),body:L.SignatureSubmission,response:L.SignatureResult,status:200,errors:["setup_required","not_found","expired","conflict","blocked"],launch:"on"},{id:"owner.signatures.get",family:"owner",method:"GET",path:"/owner/v1/signatures/:challengeId",summary:"Read a challenge\u2019s state",auth:be,params:T.z.object({challengeId:le.Id}),response:L.SignatureResult,status:200,errors:["setup_required","not_found","unavailable","conflict"],launch:"on"},{id:"owner.renewal.start",family:"owner",method:"POST",path:"/owner/v1/renewal",summary:"Begin deliberate account spending-consent renewal",description:"Available before the seven-day reminder window. Returns the existing open renewal operation or opens one awaiting the owner\u2019s exact signature through owner.operations.challenge and owner.signatures.submit. Starting changes no consent, budget, hold, key, TAP or bearer authority. Repeat an interrupted start to recover the open operation; after completion, a new start awaits a new signature. Consent ends ninety days from the tap, without carry-over. This operation renews spending consent only; technical authority readiness remains separate.",auth:Ee,response:le.Operation,status:200,errors:["setup_required","blocked","conflict"],launch:"on"},{id:"owner.operations.list",family:"owner",method:"GET",path:"/owner/v1/operations",summary:"List the owner\u2019s operations",description:'`needs_attention=true` is the owner\u2019s "Needs attention" list.',auth:be,query:le.PageQuery.extend({needs_attention:T.z.enum(["true","false"]).optional()}),response:T.z.object({operations:T.z.array(qs),page:le.Page}),status:200,errors:["setup_required"],launch:"on"},{id:"owner.operations.challenge",family:"owner",method:"POST",path:"/owner/v1/operations/:id/challenge",summary:"Fetch or renew the signing challenge an operation is waiting for",description:"For an operation in needs_owner_action: returns the current challenge if it is still valid, or a fresh one for the same step and the same immutable terms if it expired. A recorded wallet key authorization instead returns its original owner-only signed bytes and hash with challenge null, including while running or retained terminal; unknown outcomes never create a new challenge. Never changes the terms and never signs for the owner.",auth:be,params:Ke,response:T.z.object({operation:qs,challenge:L.Challenge.nullable()}),status:200,errors:["setup_required","not_found","conflict"],launch:"on"},{id:"owner.operations.get",family:"owner",method:"GET",path:"/owner/v1/operations/:id",summary:"Read one operation",auth:be,params:Ke,response:qs,status:200,errors:["setup_required","not_found"],launch:"on"}])});var Fs=j(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.PUBLIC_OPERATIONS=Me.CliFailureReport=Me.CLI_FAILURE_EVENT_MAX_BYTES=Me.CLI_FAILURE_PLATFORMS=Me.CLI_FAILURE_KINDS=Me.CLI_FAILURE_STEPS=Me.CLI_FAILURE_SURFACES=void 0;var W=Je(),TT=Un(),Ls=dr(),fo=ct(),Xn=W.z.record(W.z.string(),W.z.unknown()),Vs="RFC 6749 errors: { error, error_description }";Me.CLI_FAILURE_SURFACES=["cli","mcp"];Me.CLI_FAILURE_STEPS=["connect","connect_sign_in","connect_enroll","connect_mount","connect_skill","connect_hud","disconnect","update","statusline","keychain","enrollment_finisher","get_status","agent_enroll","discover","pay","history","purchase_create","purchase_retrieve","purchase_cancel","crash","other"];Me.CLI_FAILURE_KINDS=["caller","platform","unknown"];Me.CLI_FAILURE_PLATFORMS=["darwin","linux","win32","other"];Me.CLI_FAILURE_EVENT_MAX_BYTES=2048;Me.CliFailureReport=W.z.strictObject({reference:W.z.string().regex(/^[0-9a-f]{8}$/),failedRequestId:W.z.uuid().optional(),surface:W.z.enum(Me.CLI_FAILURE_SURFACES),step:W.z.enum(Me.CLI_FAILURE_STEPS),code:W.z.string().regex(/^[a-z][a-z0-9_]{1,63}$/),kind:W.z.enum(Me.CLI_FAILURE_KINDS),httpStatus:W.z.number().int().min(100).max(599).optional(),cliVersion:W.z.string().max(40),platform:W.z.enum(Me.CLI_FAILURE_PLATFORMS),harness:W.z.string().regex(/^[a-z0-9_-]{1,32}$/).optional()});Me.PUBLIC_OPERATIONS=(0,TT.defineOperations)([{id:"mcp.endpoint",backedBy:"edge",family:"mcp",method:"ALL",path:"/mcp",summary:"The MCP server (streamable HTTP)",description:"JSON-RPC over POST; GET opens the event stream and DELETE ends a session. Serves the 7-tool catalogue in mcp.ts, each tool an adapter over an /agent/v1 operation.",auth:["oauth_token","agent_token","app_token"],body:Xn,response:Xn,status:200,errors:["setup_required","update_required"],launch:"on",externalSpec:"Model Context Protocol, streamable HTTP transport"},{id:"oauth.authorize",backedBy:"edge",family:"oauth",method:"GET",path:"/oauth/authorize",summary:"Authorization request (PKCE)",description:"Redirects (302) to the Console consent page (/agent/enroll/connector) with `request_id` in the query string; the Console signs the owner in if needed (the browser holds no Auth session). The request_id identifies one decision and expires after 10 minutes; the page posts it to oauth.decision, and the first owner who decides it binds it (an owner session present at authorize binds it at once). Re-requesting the same parameters issues a fresh request_id.",auth:["none","owner_session"],query:W.z.object({response_type:W.z.literal("code"),client_id:W.z.string(),redirect_uri:W.z.url(),code_challenge:W.z.string(),code_challenge_method:W.z.literal("S256"),scope:W.z.string().optional(),state:W.z.string().optional(),resource:W.z.url().optional()}),response:null,status:302,errors:[],launch:"on",externalSpec:`RFC 6749, RFC 7636. ${Vs}; until the client and redirect_uri are verified the error is answered directly, after that it is redirected to the client's callback. \`resource\` is accepted and not used: the token is bound to one agent.`},{id:"oauth.decision",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/authorize/decision",summary:"The owner\u2019s consent decision; creates the hosted agent and its setup",description:"request_id is the one the consent page received in the query string of the oauth.authorize redirect. deny: 200 with the redirect carrying access_denied. allow carries the original visible ask_each_time Tempo grant; an identical retry retains the same setup and approval. allow: 202 with the hosted setup and its setup_approval challenge; the Console signs it silently with the owner\u2019s browser key (no extra step) through owner.signatures.submit, whose continuation.url is the redirect carrying the code. No code is issued before the owner\u2019s signature over the setup statement is verified (contract proposal 7, decided 8 Oct).",auth:["owner_session"],body:W.z.discriminatedUnion("decision",[W.z.object({request_id:fo.Id,decision:W.z.literal("allow"),agent_id:fo.Id.optional(),grant:Ls.GrantRequest.extend({rail:W.z.literal("tempo"),mode:W.z.literal("ask_each_time")})}),W.z.object({request_id:fo.Id,decision:W.z.literal("deny"),agent_id:fo.Id.optional()})]),response:W.z.object({redirect_to:W.z.url()}),status:200,variants:[{status:202,description:"allow: the owner signs the setup statement; the code follows the signature.",response:W.z.object({setup:Ls.Setup,challenge:Ls.Challenge})}],errors:["setup_required","expired","blocked","invalid_request","conflict"],launch:"on",externalSpec:"RFC 6749 (the consent step). The Console calls it; refusals are the Problem."},{id:"oauth.token",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/token",summary:"Token endpoint (authorization_code, refresh_token)",description:"A refresh keeps the same hosted agent identity.",auth:["none"],bodyType:"application/x-www-form-urlencoded",body:W.z.object({grant_type:W.z.enum(["authorization_code","refresh_token"]),code:W.z.string().optional(),code_verifier:W.z.string().optional(),refresh_token:W.z.string().optional(),client_id:W.z.string(),redirect_uri:W.z.url().optional()}),response:W.z.object({access_token:W.z.string(),token_type:W.z.literal("Bearer"),expires_in:W.z.number().int(),refresh_token:W.z.string().optional(),scope:W.z.string().optional()}),status:200,errors:[],launch:"on",externalSpec:`RFC 6749. ${Vs}`},{id:"oauth.register",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/register",summary:"Dynamic client registration",auth:["none"],body:Xn,response:Xn,status:201,errors:[],launch:"on",externalSpec:`RFC 7591; client ID metadata documents. ${Vs}`},{id:"oauth.revoke",backedBy:"edge",family:"oauth",method:"POST",path:"/oauth/revoke",summary:"Token revocation",auth:["none"],bodyType:"application/x-www-form-urlencoded",body:W.z.object({token:W.z.string(),token_type_hint:W.z.string().optional()}),response:null,status:200,errors:[],launch:"on",externalSpec:"RFC 7009"},{id:"oauth.connect",backedBy:"edge",family:"oauth",method:"GET",path:"/oauth/connect/:ticket",summary:"Redeem a one-time connect ticket",description:"The one ticket-redemption door: a connector app link or the Console handoff.",auth:["none","owner_session"],params:W.z.object({ticket:W.z.string()}),response:null,status:302,errors:["expired","not_found"],launch:"future"},...[["oauthAuthorizationServer","oauth-authorization-server","OAuth server metadata","RFC 8414"],["oauthProtectedResource","oauth-protected-resource","Protected resource metadata","RFC 9728"],["mcp","mcp.json","MCP server discovery","MCP discovery"],["agentJwks","agent-jwks.json","Agent public keys (JWKS)","RFC 7517"],["httpMessageSignaturesDirectory","http-message-signatures-directory","Web Bot Auth key directory","Web Bot Auth (HTTP message signatures directory)"]].map(([e,t,r,i])=>({id:`wellKnown.${e}`,backedBy:"edge",family:"well-known",method:"GET",path:`/.well-known/${t}`,summary:r,auth:["none"],response:Xn,status:200,errors:[],launch:"on",externalSpec:i})),{id:"public.tapRegistry.agent",backedBy:"authority",family:"public",method:"GET",path:"/v1/tap/registry/agents/:tapAgentId",summary:"Resolve a Trusted Agent Protocol agent",description:"A merchant contract; the path is kept.",auth:["none"],params:W.z.object({tapAgentId:W.z.string()}),response:Xn,status:200,errors:["not_found"],launch:"on",externalSpec:"Visa Trusted Agent Protocol registry"},{id:"public.tapRegistry.key",backedBy:"authority",family:"public",method:"GET",path:"/v1/tap/registry/keys/:jkt",summary:"Resolve a TAP signing key by thumbprint",auth:["none"],params:W.z.object({jkt:W.z.string()}),response:Xn,status:200,errors:["not_found"],launch:"on",externalSpec:"Visa Trusted Agent Protocol registry"},{id:"public.cliFailure.report",backedBy:"edge",family:"public",method:"POST",path:"/v1/cli/failure-event",summary:"Report a CLI or MCP step that failed on the person\u2019s machine",description:"Fire-and-forget, so a failure that never reached Visa (an unreadable keychain, a crash) can be found by its reference. Unauthenticated on purpose: a CLI whose keychain cannot be read must still report it; an agent token, if sent and current, adds the owner. A closed shape of bounded codes (no prompt, argument, path, email or free text); at most 2048 bytes; rate limited per client address (30 a minute) in its own bucket. 204 on success; an invalid report is invalid_request naming the first offending field (`cli_failure_event_<field>`).",auth:["none","agent_token"],body:Me.CliFailureReport,response:null,status:204,errors:["invalid_request","rate_limited"],launch:"on"},{id:"public.openapi",backedBy:"edge",family:"public",method:"GET",path:"/openapi.json",summary:"This contract as OpenAPI 3.1",auth:["none"],response:Xn,status:200,errors:[],launch:"on"},{id:"public.health",backedBy:"edge",family:"public",method:"GET",path:"/health",summary:"Readiness of the public API (its own stores) and its build",description:"Returns 200 when this service can reach its own Redis and Postgres, or 503 with the same health shape when it cannot. It never reflects Authority or any other service, so no service waits on another to start. `commit` names the deployed build (null when unknown).",auth:["none"],response:W.z.object({status:W.z.enum(["ok","degraded"]),cutover:W.z.literal("B"),commit:W.z.string().regex(/^[0-9a-f]{7,40}$/).nullable(),checks:W.z.object({redis:W.z.enum(["ok","unavailable"]),postgres:W.z.enum(["ok","unavailable"])})}),status:200,errors:[],launch:"on"}])});var Bs=j(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.MCP_DESCRIPTION_BUDGET=Qn.MCP_TOOLS=void 0;Qn.mcpToolDescriptors=ET;var te=Je(),wt=it(),ei=ct(),AT=dr(),df=["agent_signature"],pf=["oauth_token","app_token"],Qr=e=>({laptop:{available:!0,auth:df,identityCustody:"device",moneyCustody:"none",approval:"none",note:e},hosted:{available:!0,auth:pf,identityCustody:"turnkey",moneyCustody:"none",approval:"none",note:e}}),Fn={agent:te.z.string().min(1).max(128).optional().clone().register(wt.apiMetadata,{description:"The agent\u2019s name or id, needed only when this computer or credential holds more than one; never guessed."})},lf=te.z.object({target:te.z.string().clone().register(wt.apiMetadata,{description:"An http(s) URL that answers 402 with a Tempo charge."}),max:te.z.string().clone().register(wt.apiMetadata,{description:"Hard ceiling as a decimal string in the charge asset."}),description:te.z.string().optional().clone().register(wt.apiMetadata,{description:"What it is for, shown to the owner at approval and kept with the payment as its context."}),original:AT.OriginalHostedPurchaseContext.optional(),request_id:ei.Id,method:te.z.enum(["GET","POST"]).optional(),body:te.z.string().optional(),...Fn}),xT=te.z.object({request_id:ei.Id.clone().register(wt.apiMetadata,{description:"New UUID per purchase. Send the same request_id and arguments again to continue it (after the owner approves, or an unknown outcome): it is never paid twice."}),tempoChallenge:te.z.string().min(1).max(8192).clone().register(wt.apiMetadata,{description:'REQUIRED to pay. The merchant 402 `WWW-Authenticate: Payment` header value offering a Tempo charge (method="tempo"), verbatim. Visa pays a fresh charge for no more than this amount, to this payee only.'}),resource:te.z.string().min(1).max(2048).clone().register(wt.apiMetadata,{description:"The https URL that answered the 402; shown to the owner."}),request:te.z.object({method:te.z.string().nullable().optional(),headers:te.z.array(te.z.tuple([te.z.string(),te.z.string().max(1024)])).max(32).nullable().optional(),bodyBase64:te.z.string().nullable().optional()}).optional().clone().register(wt.apiMetadata,{description:"The request Visa replays after approval. Omit for a plain GET; otherwise send the original method (GET, HEAD, POST, PUT, PATCH or DELETE) and bodyBase64. Headers are public [name, value] pairs; credentials are never replayed."}),narrative:te.z.object({userRequest:te.z.string().min(1).max(2e3),product:te.z.string().min(1).max(512),category:te.z.string(),purpose:te.z.string().min(1).max(512).optional(),quantity:te.z.number().int().min(1).max(1e6).optional(),expectedResult:te.z.string().min(1).max(512).optional(),recurring:te.z.boolean().optional(),initiator:te.z.string().optional(),discoveredVia:te.z.string().optional(),alternativesConsidered:te.z.number().int().min(0).max(1e3).optional()}).strict().clone().register(wt.apiMetadata,{description:"REQUIRED. What the user asked for and what this buys, as the owner reads it on the approval card. userRequest, product and category are required; category is one of api_inference, api_data, compute_storage, media_content, software_subscription, digital_goods, physical_goods, service_booking, donation_tip, other. Keep personal details out of product, purpose and expectedResult."}),...Fn}).strict();Qn.MCP_TOOLS=[{name:"status",operations:["agent.status.get"],description:"Who this agent is, each capability\u2019s readiness (supported \u2192 configured \u2192 authorized \u2192 funded \u2192 ready) and the next step with who must take it. Call first. READ-ONLY.",input:te.z.object(Fn),annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1},surfaces:Qr()},{name:"connect",operations:["agent.setups.start","agent.setups.get","agent.setups.claim"],description:"Connect this computer as an agent, add another agent (another: true), or replace one agent\u2019s key (mode: replace, with agent when this computer holds several). Returns one owner link; this computer picks up approval automatically. Call status for progress. Never use it to repair an existing agent.",input:te.z.object({mode:te.z.enum(["new","replace"]).optional(),setup:te.z.string().optional().clone().register(wt.apiMetadata,{description:"A setup key the owner started in the Console."}),another:te.z.boolean().optional().clone().register(wt.apiMetadata,{description:"Set up one more agent on this computer, with its own key and limits. Without it, connect resumes or answers the agent already here."}),...Fn}),annotations:{idempotentHint:!0},surfaces:{laptop:{available:!0,auth:["setup_secret","agent_signature"],identityCustody:"device",moneyCustody:"none",approval:"none",note:"Creates the installation key in the OS key store; the owner approves in their browser."},hosted:{available:!1,auth:[],identityCustody:"none",moneyCustody:"none",approval:"none",note:"A hosted agent is set up by OAuth consent (oauth.authorize), not by a tool."}}},{name:"discover",operations:["agent.merchants.search"],description:"Search paid services with `query` (Mercator: each result\u2019s url, method and input schema), or price one URL\u2019s live charge with `target` (and its `method`/`body`). READ-ONLY: signs and spends nothing; listed prices are advisory. Paying always needs an explicit max.",input:te.z.object({query:te.z.string().optional(),target:te.z.url().optional(),method:te.z.enum(["GET","POST"]).optional(),body:te.z.string().optional(),limit:te.z.number().int().min(1).max(50).optional(),...Fn}),annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!0},surfaces:Qr()},{name:"pay",operations:["agent.payments.create","agent.payments.credential"],description:"Pay a merchant from the owner\u2019s wallet (MPP on Tempo), through the owner. Send `tempoChallenge`, the merchant 402 `WWW-Authenticate: Payment` header value offering a Tempo charge, exactly as you received it, with `resource` (the https URL that answered 402), `request` for anything but a plain GET, a `narrative`, and a new `request_id`. This returns an owner-approval link: nothing is spent until the owner approves. Then call `payment_status` with `wait: 240` straight away, and when it reports the approval, call pay again with the same arguments: that call pays once and returns the merchant\u2019s answer. Never poll in a loop, never ask the owner whether they approved, never invent missing fields. MOVES REAL MONEY. Reply in a line or two.",input:xT,laptopInput:lf.extend({max:lf.shape.max.optional()}),laptopDescription:"Pay a supported URL with an explicit max and a new request_id per purchase; reuse the same request_id and arguments to recover it, never pay it twice. Omit max for a read-only price preview: nothing is signed, funded or paid. A phrase as target searches services instead and pays nothing. Native paying remains gated. Reply in a line or two.",annotations:{destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},surfaces:{laptop:{available:!0,auth:df,identityCustody:"device",moneyCustody:"owner_wallet_via_slipgate",approval:"grant_mode",note:"Co-signs two of two: the CLI admits its own prepared charge, verifies and votes on the provider activity, then resumes. Tempo only at launch: card paying is cut from the launch build (A1)."},hosted:{available:!0,auth:pf,identityCustody:"turnkey",moneyCustody:"owner_wallet_via_slipgate",approval:"every_payment",note:"Every hosted payment needs the owner\u2019s fresh web approval at launch, whatever the grant mode or controls (A2); hosted autonomy waits for a connector-side signing key. Replay body and headers are forwarded in memory and never stored. Supported original signing context follows the private approval-review data policy. Tempo only (A1)."}}},{name:"payment_status",operations:["agent.payments.get"],description:'Read one purchase by id. With `wait` (up to 240 s) this call blocks until the purchase changes, for example the owner approving or declining, and then answers: one call, no polling loop. An unknown outcome is never "nothing was paid". READ-ONLY.',input:te.z.object({id:ei.Id,wait:te.z.number().int().min(0).max(240).optional(),...Fn}),laptopInput:te.z.object({id:ei.Id,wait:te.z.number().int().min(0).max(30).optional(),...Fn}),laptopDescription:'Read one purchase by id, optionally waiting up to 30 s for it to change. An unknown outcome is never "nothing was paid". READ-ONLY.',annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1},surfaces:Qr()},{name:"payment_cancel",operations:["agent.payments.cancel"],description:"Cancel a purchase that has not executed. A purchase already submitted settles or reconciles instead.",input:te.z.object({id:ei.Id,...Fn}),annotations:{destructiveHint:!0,idempotentHint:!0},surfaces:Qr()},{name:"history",operations:["agent.payments.list"],description:"This agent\u2019s purchases on every rail, newest first. READ-ONLY.",input:te.z.object({limit:te.z.number().int().min(1).max(100).optional(),...Fn}),annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1},surfaces:Qr()}];Qn.MCP_DESCRIPTION_BUDGET=3e3;function ET(e){return Qn.MCP_TOOLS.filter(t=>t.surfaces[e].available).map(t=>{let{$schema:r,...i}=te.z.toJSONSchema(e==="laptop"?t.laptopInput??t.input:t.input,{target:"draft-2020-12",unrepresentable:"any"});return{name:t.name,description:e==="laptop"?t.laptopDescription??t.description:t.description,input_schema:i,annotations:t.annotations}})}});var yf=j(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.jsonSchema=Bn;ni.successOutcomes=vf;ni.buildOpenApi=qT;var Gs=Je(),go=it(),er=no(),ff=Bs(),mo=Un(),ti="#/components/schemas/",DT=["get","put","post","patch","delete"],NT={owner_session:{type:"apiKey",in:"cookie",name:"visa_owner_session",description:"Owner Console session cookie. Every write also sends X-CSRF-Token with the csrf_token from owner.session.verify or owner.session.get."},owner_exit_session:{type:"apiKey",in:"cookie",name:"visa_owner_session",description:"The same owner cookie in its reduced exit scope (stop spending, withdraw, export, close). Writes send X-CSRF-Token as for owner_session."},agent_signature:{type:"http",scheme:"signature",description:"HTTP message signature (RFC 9421) by the agent installation key, plus the CLI version header."},agent_token:{type:"http",scheme:"bearer",description:"Short-lived agent access token from POST /agent/v1/token."},oauth_token:{type:"oauth2",flows:{authorizationCode:{authorizationUrl:"/oauth/authorize",tokenUrl:"/oauth/token",refreshUrl:"/oauth/token",scopes:{}}}},app_token:{type:"http",scheme:"bearer",description:"Owner-minted app token for one agent (REST apps)."},setup_secret:{type:"http",scheme:"Setup",description:"One-time setup secret returned by POST /agent/v1/setups, sent as Authorization: Setup <secret> (never in the URL)."},operator_session:{type:"apiKey",in:"cookie",name:"visa_operator_session",description:"Operator session from admin.session.start (current valid product owner session, owner CSRF and live operator membership). Cookie only (HttpOnly, Secure, SameSite=Strict, Path=/admin/v1); writes send X-CSRF-Token with the csrf_token from admin.session.start; operator membership is re-checked on every request."}};function CT(e){return(0,go.apiMetadataOf)(e)?.id}function Bn(e){let t=CT(e);if(t)return{$ref:`${ti}${t}`};let r=Gs.z.toJSONSchema(e,{metadata:go.apiMetadata,target:"draft-2020-12",unrepresentable:"any"}),i=r.$defs??{};for(let n of Object.keys(i))if(!MT().has(n))throw new Error(`unregistered shared schema ${n}`);return delete r.$defs,delete r.$schema,JSON.parse(JSON.stringify(r).replaceAll('"#/$defs/',`"${ti}`))}var mf=null;function MT(){return mf??=new Set(Object.keys(_f())),mf}function _f(){let e=Gs.z.toJSONSchema(go.apiMetadata,{metadata:go.apiMetadata,target:"draft-2020-12",unrepresentable:"any",uri:r=>`${ti}${r}`}).schemas,t={};for(let r of Object.keys(e).sort()){let{$schema:i,$id:n,...a}=e[r];t[r]=a}return t}function RT(e){let t=[],r=e.params?.shape??{};for(let i of(0,mo.pathParams)(e.path)){let n=r[i]??Gs.z.string();t.push({name:i,in:"path",required:!0,schema:Bn(n)})}for(let[i,n]of Object.entries(e.query?.shape??{})){let a=n;t.push({name:i,in:"query",required:!a.safeParse(void 0).success,schema:Bn(a)})}return t}function vf(e){let t=[],r=e.response&&e.status!==204&&e.status!==302;t.push({status:e.status,description:e.summary,schema:r?Bn(e.response):null});for(let i of e.variants??[])t.push({status:i.status,description:i.description,schema:Bn(i.response)});for(let i of e.errors){let n=er.ERROR_FAMILIES[i].status;n>=200&&n<300&&t.push({status:n,description:`${i}: ${er.ERROR_FAMILIES[i].message} The body is ${e.errorResponse?"the declared refusal":"a Problem"}; never read it as a failure.`,schema:e.errorResponse?Bn(e.errorResponse):{$ref:`${ti}Problem`}})}return t}function UT(e){let t=new Map;for(let i of vf(e)){let n=t.get(i.status)??[];n.push(i),t.set(i.status,n)}let r={};for(let i of[...t.keys()].sort((n,a)=>n-a)){let n=t.get(i),a=n.flatMap(s=>s.schema?[s.schema]:[]),o={description:n.map(s=>s.description).join(" Or: ")};if(a.length>0){let s=e.id==="owner.activity.export";o.content={[s?"text/csv":"application/json"]:{schema:a.length===1?a[0]:{oneOf:a}}}}r[String(i)]=o}if(e.errorResponse){let i=Bn(e.errorResponse);for(let n of e.errors){let a=er.ERROR_FAMILIES[n].status;a<400||(r[String(a)]={description:"Declared native transport refusal. Branch on code; preserve the original request.",content:{"application/json":{schema:i}}})}for(let n of["4XX","5XX"])r[n]={description:"Declared native transport refusal.",content:{"application/json":{schema:i}}}}else(!e.externalSpec||e.family==="mcp")&&(r["4XX"]={$ref:"#/components/responses/Refused"},r["5XX"]={$ref:"#/components/responses/Unavailable"});return r}function gf(e){return{description:e,headers:{"Retry-After":{description:"Seconds to wait, sent with rate_limited.",schema:{type:"integer",minimum:0}}},content:{"application/json":{schema:{$ref:`${ti}Problem`}}}}}function ZT(e){let t=Bn(e),r=t.oneOf??t.anyOf;if(!r)return t;let i=r[0]?.properties,n=Object.fromEntries(Object.entries(i??{}).filter(([a,o])=>r.every(s=>JSON.stringify(s.properties?.[a])===JSON.stringify(o))));return Object.keys(n).length>0&&(t.properties=n),t}function hf(e){let t={operationId:e.id,tags:[e.family],summary:e.summary};e.description&&(t.description=e.description);let r=RT(e);r.length>0&&(t.parameters=r),e.body&&(t.requestBody={required:!e.body.isOptional(),content:{[e.bodyType??"application/json"]:{schema:ZT(e.body)}}}),t.responses=UT(e);let i=e.auth.filter(n=>n!=="none");return t.security=[...i.map(n=>({[n]:[]})),...e.auth.includes("none")?[{}]:[]],t["x-launch"]=e.launch,e.errors.length>0&&(t["x-error-families"]=[...e.errors]),e.signed&&(t["x-owner-signature"]=!0),e.idempotency&&(t["x-idempotency"]=e.idempotency),e.controls&&(t["x-controls"]=[...e.controls]),t["x-backed-by"]=e.backedBy??"authority",e.externalSpec&&(t["x-external-spec"]=e.externalSpec),t}function qT(e){er.Problem;let t={};for(let i of e){if(!(0,mo.operationPathMatchesFamily)(i))throw new Error(`${i.id}: ${i.path} is outside ${mo.FAMILY_PREFIX[i.family]}`);let n=(0,mo.openApiPath)(i.path),a=t[n]??={},o=(s,c)=>{if(a[s])throw new Error(`duplicate ${s.toUpperCase()} ${i.path}`);a[s]=c};if(i.method==="ALL"){let s=hf(i);o("post",s),o("get",{...s,operationId:`${i.id}.stream`,summary:"Open the server event stream",requestBody:void 0,responses:{200:{description:"Server-sent events.",content:{"text/event-stream":{schema:{type:"string"}}}},"4XX":{$ref:"#/components/responses/Refused"},"5XX":{$ref:"#/components/responses/Unavailable"}}}),o("delete",{...s,operationId:`${i.id}.end`,summary:"End the MCP session",requestBody:void 0,responses:{204:{description:"Session ended."},"4XX":{$ref:"#/components/responses/Refused"},"5XX":{$ref:"#/components/responses/Unavailable"}}})}else o(i.method.toLowerCase(),hf(i))}let r={};for(let i of Object.keys(t).sort()){let n={};for(let a of DT)t[i][a]&&(n[a]=t[i][a]);r[i]=n}return{openapi:"3.1.0",info:{title:"Visa CLI target API",version:"1.0.0-draft",description:"The target contract from the clean-slate plan v4. Not served yet. Families: /owner/v1, /agent/v1, /admin/v1, /mcp, /oauth, /.well-known and the public registry."},servers:[{url:"/",description:"The Auth edge of each environment (the only public API host)."}],paths:r,components:{schemas:_f(),responses:{Refused:gf("Refused. Branch on `code` (an error family)."),Unavailable:gf("Unavailable or internal error.")},securitySchemes:NT},"x-error-families":Object.fromEntries(er.WIRE_ERROR_FAMILIES.map(i=>[i,{status:er.ERROR_FAMILIES[i].status,retryable:er.ERROR_FAMILIES[i].retryable,kind:er.ERROR_FAMILIES[i].kind}])),"x-mcp":{descriptionBudget:ff.MCP_DESCRIPTION_BUDGET,tools:ff.MCP_TOOLS.map(i=>({name:i.name,operations:[...i.operations],description:i.description,annotations:i.annotations,inputSchema:Bn(i.input),surfaces:i.surfaces}))}}}});var bf=j(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.RECOVERY_RESPONSIBILITIES=void 0;Gn.executionDecision=LT;Gn.replacementAllowed=VT;Gn.dispatchRecovery=FT;Gn.hostedResumeDecision=BT;Gn.ownerApprovalRequired=GT;function LT(e){return e.chain==="landed"?{action:"settle"}:e.signature==="never_created"?e.provider_void?{action:"close",evidence:"provider_void"}:e.past_valid_before?{action:"close",evidence:"expired_unsigned"}:{action:"keep_open"}:e.signature==="pending_at_provider"&&e.provider_void?{action:"close",evidence:"provider_void"}:e.past_valid_before&&e.chain==="not_landed_final"?{action:"close",evidence:"expired_on_chain"}:e.past_valid_before?{action:"fence"}:{action:"keep_open"}}function VT(e){return e.action==="close"}function FT(e){return e.locator_recorded?"read_recorded_activity":e.readback==="found"?"bind_found_activity":"fenced_unknown"}function BT(e){return e.credential_released?e.supplied==="request"?"refuse_credential_released":e.supplied==="receipt"&&e.merchant_verified_receipt===!0?"retrieve_from_merchant":"paid_result_unavailable":e.supplied==="request"?"requote_must_match_retained_facts":"still_waiting"}Gn.RECOVERY_RESPONSIBILITIES={visa:"Keeps only RETAINED_PAYMENT_FACTS; never re-sends a released credential; fails closed.",caller:"Keeps its own request and the merchant receipt or job reference if it wants its result back.",merchant:"Answers a receipt or job-reference lookup for a paid request and treats a repeated paid request idempotently."};function GT(e){return e.surface==="hosted"?!0:!(e.mode==="within_limit"&&e.within_limit_control_enabled&&e.within_limits)}});var zf=j(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.SETUP_AUTH_SCHEME=Se.AGENT_SIGNATURE_MAX_AGE_SECONDS=Se.AGENT_SIGNATURE_ALG=Se.CLI_VERSION_HEADER=Se.AGENT_SIGNATURE_LABEL=void 0;Se.agentSignatureParams=Js;Se.agentSignatureBase=KT;Se.agentSignatureHeaders=HT;Se.parseAgentSignature=YT;Se.setupClaimMessage=XT;Se.setupResumeMessage=QT;Se.AGENT_SIGNATURE_LABEL="visa";Se.CLI_VERSION_HEADER="x-visa-cli-version";Se.AGENT_SIGNATURE_ALG="ed25519";Se.AGENT_SIGNATURE_MAX_AGE_SECONDS=120;Se.SETUP_AUTH_SCHEME="Setup";var wf=["@method","@target-uri","content-digest",Se.CLI_VERSION_HEADER],$f=["@method","@target-uri",Se.CLI_VERSION_HEADER],JT=/^[A-Za-z0-9_-]{16,64}$/,WT=/^[A-Za-z0-9_-]{43}$/;function Js(e,t){if(!Number.isSafeInteger(t.created)||t.created<0)throw new Error("agent_signature_created_invalid");if(!JT.test(t.nonce))throw new Error("agent_signature_nonce_invalid");if(!WT.test(t.keyid))throw new Error("agent_signature_keyid_invalid");return`(${(e?wf:$f).map(i=>`"${i}"`).join(" ")});created=${t.created};nonce="${t.nonce}";keyid="${t.keyid}";alg="${Se.AGENT_SIGNATURE_ALG}"`}function KT(e,t){if(/[\r\n]/.test(e.cliVersion)||/[\r\n]/.test(e.targetUri))throw new Error("agent_signature_component_invalid");let r=[`"@method": ${e.method.toUpperCase()}`,`"@target-uri": ${e.targetUri}`];if(e.contentDigest!==void 0){if(!/^sha-256=:[A-Za-z0-9+/]{43}=:$/.test(e.contentDigest))throw new Error("agent_signature_digest_invalid");r.push(`"content-digest": ${e.contentDigest}`)}return r.push(`"${Se.CLI_VERSION_HEADER}": ${e.cliVersion}`),r.push(`"@signature-params": ${Js(e.contentDigest!==void 0,t)}`),r.join(`
58
+ `)}function HT(e,t,r){return{"signature-input":`${Se.AGENT_SIGNATURE_LABEL}=${Js(e,t)}`,signature:`${Se.AGENT_SIGNATURE_LABEL}=:${r}:`}}function YT(e){let t=e.signatureInput?.trim()??"",r=e.signature?.trim()??"",i=`${Se.AGENT_SIGNATURE_LABEL}=`;if(!t.startsWith(i)||!r.startsWith(i))return null;let n=/^\(([^)]*)\);created=(\d{1,12});nonce="([A-Za-z0-9_-]{16,64})";keyid="([A-Za-z0-9_-]{43})";alg="ed25519"$/.exec(t.slice(i.length)),a=/^:([A-Za-z0-9+/]{86}==):$/.exec(r.slice(i.length));if(!n||!a)return null;let o=n[1],s=o===wf.map(c=>`"${c}"`).join(" ");return!s&&o!==$f.map(c=>`"${c}"`).join(" ")?null:{hasBody:s,created:Number(n[2]),nonce:n[3],keyid:n[4],signature:a[1]}}function XT(e){return`visa-setup-claim:${e}`}function QT(e){return`visa-setup-resume:v1:${e.jkt}:${e.setupId??"-"}:${e.nonce}:${e.issuedAt}`}});var Of=j(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.DeviceApproverPhaseStatement=fr.DeviceApproverRoster=void 0;var H=Je(),If=ct(),Ie=H.z.string().min(1),Ks=H.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),Sf=H.z.strictObject({kty:H.z.literal("OKP"),crv:H.z.literal("Ed25519"),x:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/)}),ho=H.z.strictObject({policyName:Ie,effect:H.z.enum(["EFFECT_ALLOW","EFFECT_DENY"]),consensus:Ie,condition:Ie,notes:H.z.string()});fr.DeviceApproverRoster=H.z.array(H.z.strictObject({approverId:Ie,installationId:Ie,identityKeyId:Ie,identityGeneration:Ks,identityJkt:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/),publicJwk:Sf,provider:H.z.literal("turnkey"),providerUserRef:H.z.string(),state:H.z.enum(["pending","active","removing"])})).max(8);var Ws=H.z.strictObject({userName:Ie,apiKeys:H.z.tuple([H.z.strictObject({apiKeyName:Ie,publicKey:Ie,curveType:H.z.enum(["API_KEY_CURVE_ED25519","API_KEY_CURVE_P256"])})]),authenticators:H.z.tuple([]),oauthProviders:H.z.tuple([]),userTags:H.z.tuple([])}),eA=H.z.discriminatedUnion("type",[H.z.strictObject({type:H.z.enum(["ACTIVITY_TYPE_CREATE_USERS_V3","ACTIVITY_TYPE_CREATE_USERS_V4"]),parameters:H.z.strictObject({users:H.z.union([H.z.tuple([Ws]),H.z.tuple([Ws,Ws])])})}),H.z.strictObject({type:H.z.literal("ACTIVITY_TYPE_CREATE_POLICIES"),parameters:H.z.strictObject({policies:H.z.union([H.z.tuple([ho]),H.z.tuple([ho,ho])])})}),H.z.strictObject({type:H.z.literal("ACTIVITY_TYPE_UPDATE_POLICY_V2"),parameters:H.z.strictObject({policyId:Ie,policyName:Ie,policyEffect:H.z.enum(["EFFECT_ALLOW","EFFECT_DENY"]),policyCondition:Ie,policyConsensus:Ie,policyNotes:H.z.string().optional()})})]);fr.DeviceApproverPhaseStatement=H.z.strictObject({kind:H.z.literal("device_approver"),operation_id:Ie,step_no:H.z.number().int().min(2).max(6),action:H.z.enum(If.DEVICE_APPROVER_ACTIONS),recorded_body_hash:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable(),recorded_activity_ref:Ie.nullable(),intent:H.z.strictObject({fence:H.z.strictObject({ownerId:Ie,ownerSecurityEpoch:H.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),agentId:Ie,setupId:Ie,operationId:Ie,installationId:Ie,walletKeyId:Ie,walletGeneration:Ks,identityKeyId:Ie,identityGeneration:Ks,identityJkt:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/),installationPublicJwk:Sf,organizationId:Ie,ownerUserId:Ie,rosterHash:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/)}),stepNo:H.z.union([H.z.literal(2),H.z.literal(3),H.z.literal(4),H.z.literal(5),H.z.literal(6)]),accessKeyId:Ie,accessKeyAddress:H.z.string().regex(/^0x[0-9a-fA-F]{40}$/),stampPublicKey:H.z.string().regex(/^0[23][0-9a-fA-F]{64}$/),roster:fr.DeviceApproverRoster,action:H.z.enum(If.DEVICE_APPROVER_ACTIONS),request:eA,previousPolicy:ho.nullable().optional(),previousPolicyHash:H.z.string().regex(/^[A-Za-z0-9_-]{43}$/).optional(),targetPolicyRef:Ie.optional()})}).superRefine((e,t)=>{let r=e.intent,i={create_device_approver_guard:2,create_device_approver_user:3,create_tempo_signer_guard:4,create_tempo_signer_user:5,create_device_approver_policy:6,update_device_approver_policy:6},n=e.action.endsWith("_user")?"ACTIVITY_TYPE_CREATE_USERS_V3":e.action==="update_device_approver_policy"?"ACTIVITY_TYPE_UPDATE_POLICY_V2":"ACTIVITY_TYPE_CREATE_POLICIES";(e.operation_id!==r.fence.operationId||e.action!==r.action||e.step_no!==r.stepNo||e.step_no!==i[e.action]||r.request.type!==n&&!(n==="ACTIVITY_TYPE_CREATE_USERS_V3"&&r.request.type==="ACTIVITY_TYPE_CREATE_USERS_V4")||e.recorded_activity_ref!==null&&e.recorded_body_hash===null||(e.action==="update_device_approver_policy"?r.previousPolicy===void 0||!r.previousPolicyHash||!r.targetPolicyRef||r.request.type!=="ACTIVITY_TYPE_UPDATE_POLICY_V2"||r.request.parameters.policyId!==r.targetPolicyRef||r.previousPolicy===null&&!e.recorded_body_hash:r.previousPolicy!==void 0||r.previousPolicyHash!==void 0||r.targetPolicyRef!==void 0))&&t.addIssue({code:"custom",message:"The device approver phase is inconsistent."})})});var xf=j(K=>{"use strict";var tA=K&&K.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),$t=K&&K.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&tA(t,e,r)};Object.defineProperty(K,"__esModule",{value:!0});K.apiMetadataOf=K.successOutcomes=K.buildOpenApi=K.PUBLIC_OPERATIONS=K.OWNER_OPERATIONS=K.AGENT_OPERATIONS=K.ADMIN_OPERATIONS=K.mcpToolDescriptors=K.MCP_DESCRIPTION_BUDGET=K.MCP_TOOLS=K.CliFailureReport=K.CLI_FAILURE_SURFACES=K.CLI_FAILURE_STEPS=K.CLI_FAILURE_PLATFORMS=K.CLI_FAILURE_KINDS=K.CLI_FAILURE_EVENT_MAX_BYTES=K.MCP_TOOL_CEILING=K.PRODUCT_ROUTE_CEILING=K.OPERATIONS=void 0;K.operationById=rA;K.countByFamily=iA;K.productOperationCount=aA;var kf=nf();Object.defineProperty(K,"ADMIN_OPERATIONS",{enumerable:!0,get:function(){return kf.ADMIN_OPERATIONS}});var Pf=of();Object.defineProperty(K,"AGENT_OPERATIONS",{enumerable:!0,get:function(){return Pf.AGENT_OPERATIONS}});var jf=cf();Object.defineProperty(K,"OWNER_OPERATIONS",{enumerable:!0,get:function(){return jf.OWNER_OPERATIONS}});var Tf=Fs();Object.defineProperty(K,"PUBLIC_OPERATIONS",{enumerable:!0,get:function(){return Tf.PUBLIC_OPERATIONS}});var nA=Un();K.OPERATIONS=[...jf.OWNER_OPERATIONS,...Pf.AGENT_OPERATIONS,...kf.ADMIN_OPERATIONS,...Tf.PUBLIC_OPERATIONS];function rA(e){return K.OPERATIONS.find(t=>t.id===e)}function iA(){let e={owner:0,agent:0,admin:0,mcp:0,oauth:0,"well-known":0,public:0};for(let t of K.OPERATIONS)e[t.family]+=1;return e}function aA(){return K.OPERATIONS.filter(e=>nA.PRODUCT_FAMILIES.includes(e.family)).length}K.PRODUCT_ROUTE_CEILING=77;K.MCP_TOOL_CEILING=7;$t(no(),K);var Tr=Fs();Object.defineProperty(K,"CLI_FAILURE_EVENT_MAX_BYTES",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_EVENT_MAX_BYTES}});Object.defineProperty(K,"CLI_FAILURE_KINDS",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_KINDS}});Object.defineProperty(K,"CLI_FAILURE_PLATFORMS",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_PLATFORMS}});Object.defineProperty(K,"CLI_FAILURE_STEPS",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_STEPS}});Object.defineProperty(K,"CLI_FAILURE_SURFACES",{enumerable:!0,get:function(){return Tr.CLI_FAILURE_SURFACES}});Object.defineProperty(K,"CliFailureReport",{enumerable:!0,get:function(){return Tr.CliFailureReport}});$t(Un(),K);$t(ct(),K);$t(dr(),K);$t(xs(),K);var Hs=Bs();Object.defineProperty(K,"MCP_TOOLS",{enumerable:!0,get:function(){return Hs.MCP_TOOLS}});Object.defineProperty(K,"MCP_DESCRIPTION_BUDGET",{enumerable:!0,get:function(){return Hs.MCP_DESCRIPTION_BUDGET}});Object.defineProperty(K,"mcpToolDescriptors",{enumerable:!0,get:function(){return Hs.mcpToolDescriptors}});var Af=yf();Object.defineProperty(K,"buildOpenApi",{enumerable:!0,get:function(){return Af.buildOpenApi}});Object.defineProperty(K,"successOutcomes",{enumerable:!0,get:function(){return Af.successOutcomes}});$t(bf(),K);$t(zf(),K);$t(Of(),K);$t(Es(),K);$t(Ns(),K);var oA=it();Object.defineProperty(K,"apiMetadataOf",{enumerable:!0,get:function(){return oA.apiMetadataOf}});$t(Kr(),K)});var Ef=j((Ax,sA)=>{sA.exports={name:"@visa/cli",version:"5.0.0-rc.414",description:"Visa CLI runtime for stable agent identity and separately authorized payment capabilities",bin:{"visa-cli":"./bin/visa-cli.js",visa:"./bin/visa-cli.js","visa-runtime-converge":"./dist/managed-runtime/resolve-and-update.mjs","visa-tool":"./bin/visa-tool.js"},scripts:{"sync:server-json":"node scripts/sync-server-json.mjs","check:server-json":"node scripts/sync-server-json.mjs --check",prebuild:"node scripts/sync-server-json.mjs",build:"pnpm test:types && node esbuild.config.js",prepack:"node scripts/sync-server-json.mjs --check",dev:"tsc --watch",pretest:"pnpm build",start:"node dist/mcp-server/index.js",test:"jest --config jest.config.js","test:types":"tsc -p tsconfig.test.json","pretest:unit":"pnpm test:types","test:unit":"jest --config jest.config.js","pretest:unit:watch":"pnpm test:types","test:unit:watch":"jest --config jest.config.js --watch","pretest:unit:coverage":"pnpm test:types","test:unit:coverage":"jest --config jest.config.js --coverage","test:smoke":"VISA_AUTH_URL=https://auth.visacli.sh jest --config jest.smoke.config.js","test:packed":"node scripts/packed-cli-smoke.mjs","test:e2e":"jest --config jest.e2e.config.js","test:all":"npm run test:unit && npm run test:e2e",prepublishOnly:"npm run build && npm test",lint:"eslint src/**/*.ts",format:'prettier --write "src/**/*.ts"',"format:check":'prettier --check "src/**/*.ts"'},keywords:["visa","checkout","mcp","ai-agent","payments","click-to-pay","usdc","stablecoin"],author:"Visa Crypto Labs",license:"SEE LICENSE IN LICENSE",dependencies:{"@modelcontextprotocol/server":"2.0.0",commander:"^12.1.0",punycode:"^2.3.1"},devDependencies:{"@types/express":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^22.20.5","@typescript-eslint/eslint-plugin":"^8.68.0","@typescript-eslint/parser":"^8.68.0","@visa/financial-core":"workspace:*","@visa/identity":"workspace:*","@visa/contracts":"workspace:*","@visa/observability":"workspace:*","@visa/shared":"workspace:*","@visa/wallet":"workspace:*",esbuild:"^0.28.1",eslint:"^10.0.2",express:"^4.21.0",jest:"^30.3.0",prettier:"^3.9.6","ts-jest":"^29.4.12",typescript:"^5.7.0",viem:"^2.56.0"},engines:{node:">=20.0.0"},mcpName:"io.github.visa-crypto-labs/visa-cli",files:["bin/visa-cli.js","bin/visa-tool.js","dist/","install.ps1","install.sh","server.json","README.md"]}});var Bf=j(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.AGENT_SKILL_VERSION=void 0;gr.agentSkill=SA;gr.AGENT_SKILL_VERSION=1;function SA({channel:e,headless:t,accessCode:r,runtime:i}){let n=[...r?[`VISA_RC_CODE=${r}`]:[],...t?["VISA_RUNTIME_CUSTODY_PROFILE=headless"]:[]].join(" "),a=n?`${n} `:"",o=`${i?`VISA_CLI_RUNTIME=${i} `:""}${a}visa connect --no-open --wait 0`,s=[`If \`visa-tool\` is not found, this computer was rebuilt. Reinstall it: \`npm install -g @visa/cli@${e}\`. The agent and the owner's approval are kept on this computer, so do not set it up again unless \`status\` says so.`,...n?[`Start every Visa command with \`${n}\`: ${[...r?["the first is the access code this release candidate needs"]:[],...t?["this computer has no keyring, so the agent's key is a private file"]:[]].join("; ")}.`]:[],`Run \`${a}visa-tool --list\`. It gives the current rules and tools; follow them. Do not copy them into this file: they change with updates. If its \`skill_version\` is higher than ${gr.AGENT_SKILL_VERSION}, ask the owner for the new Visa skill from the Visa Console.`];return["---","name: visa","description: Pay for things through this computer's Visa agent, within the limits its owner approved. Use for Visa status, finding merchants, paying, and checking or cancelling a payment.","---","","# Visa","",`This computer is a Visa agent: its owner approved it in their browser and set its limits. Use it through the \`visa-tool\` command in the shell. This is version ${gr.AGENT_SKILL_VERSION} of this skill.`,"","## Every time, before using Visa","",...s.map((c,d)=>`${d+1}. ${c}`),"","## Calling a tool","",`\`${a}visa-tool <tool> '<json arguments>'\` prints the tool's answer as JSON, and exits 1 when the tool refused. Call \`status\` first.`,"","## When something is not finished","",`- \`status\` says the setup's pickup is interrupted (this computer was rebuilt while the owner was approving): run \`${o}\`. It resumes the same setup.`,...e==="rc"&&!r?["- This is a release candidate: every tool but `status` and `connect` needs the access code. When a call asks for `VISA_RC_CODE`, ask the owner for the code and run that call once more with `VISA_RC_CODE=<code>` in front. This computer remembers it after that."]:[],"- A refusal: follow its `fix` and `nextAction`. For `update_required`, run `visa update`.","- Give the owner any approval link exactly as returned. Never open a link or approve anything yourself.",""].join(`
59
+ `)}});var TA={};om(TA,{USAGE:()=>au,agentSkillFor:()=>Xf,callTool:()=>Hf,listTools:()=>Yf,main:()=>jA});module.exports=sm(TA);var Jf=require("child_process"),Wf=hr(require("path"));var du=require("node:async_hooks"),$o=require("node:crypto");var um=new du.AsyncLocalStorage,lu=null;function cm(){return(0,$o.randomBytes)(4).toString("hex")}function lm(e,t){return{reference:cm(),surface:e,step:t,reported:new Set}}function zo(){let e=um.getStore();return e||(lu??=lm("cli","other"),lu)}function pu(){return zo().reference}var _o=hr(xf()),Cx=Ef().version,Df={policy_screening_blocked:{message:"Payments to this recipient are blocked by payment screening.",fix:"Do not retry, switch agents or switch payment methods; tell the owner."},policy_screening_not_configured:{message:"Payment screening is not available, so wallet payments are refused.",fix:"Retrying will not help until Visa restores screening; tell the owner."},connection_changed_while_reporting:{message:"This agent changed while connect was reporting it (the owner may have removed it), so nothing was reported as connected.",fix:"Do not repeat this call. Check status: if the owner removed the agent, ask whether to connect a new one with visa connect."},withdrawal_screening_blocked:{message:"Withdrawals to this address are blocked by payment screening.",fix:"Choose another address; do not retry this one."}},vo=class extends Error{constructor(r,i,n,a,o=null,s=null){super(Df[i]?.message??_o.ERROR_FAMILIES[r]?.message??`Visa refused this request (${r}).`);this.code=r;this.detail=i;this.status=n;this.retryable=a;this.nextAction=o;this.retryAfterSeconds=s}code;detail;status;retryable;nextAction;retryAfterSeconds;name="AgentApiError";get fix(){return Df[this.detail]?.fix??_o.ERROR_FAMILIES[this.code]?.fix??null}};var Xs={x402_retired:{kind:"caller",fix:null,nextAction:"Read the saved outcome with history. Preserve unresolved evidence and do not pay the same purchase again."},update_required:{kind:"caller",fix:"npm install -g @visa/cli@rc",nextAction:"Upgrade Visa CLI to the minimum compatible version or newer, then retry the command."},session_required:{kind:"caller",fix:"agent_enroll",nextAction:"Run visa connect (shell) or call agent_enroll (MCP) and complete the browser sign-in. Both resume where they left off. Retry the original command after that."},identity_required:{kind:"caller",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Call agent_enroll or run visa connect, open the printed link, and have the owner approve this computer and its limits."},legacy_door_removed:{kind:"caller",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Call agent_enroll or run visa connect, open the printed link, and have the owner approve this computer and its limits; then pay with the pay tool. Do not retry the removed command. Nothing was signed, paired or paid."},agent_selection_required:{kind:"caller",fix:null,nextAction:"Retry the command with one exact agent id from the executable choices in the error."},invalid_argument:{kind:"caller",fix:null,nextAction:"Correct the invalid argument named in the error, then retry the command once. Do not escalate this as a platform incident."},rate_limited:{kind:"caller",fix:"sleep <retry-after-seconds>",nextAction:"Wait the number of seconds the error names (its Retry-After), then retry the same request once. Do not retry sooner or switch agents to get around the limit."},activity_entry_not_found:{kind:"caller",fix:"history",nextAction:"Call history for the same agent and find the entry by its exact id in that list, or read the visa://receipt/<id> resource."},wallet_network_mismatch:{kind:"caller",fix:"discover",nextAction:"Nothing was reserved, signed or paid. This merchant offers no OUSD payment on Tempo, which this wallet needs. Choose a merchant that accepts Tempo; do not retry the same request unchanged."},agent_operations_cli_upgrade_required:{kind:"caller",fix:null,nextAction:"Update Visa CLI to the version the error names or newer, restart the agent session, and retry once. The payment was not sent."},agent_operation_forbidden:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This owner, agent or payment method is not allowed to make this payment. Ask the owner to check the agent in the Visa Console; do not retry another way."},runtime_context_not_found:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa cannot find this agent's setup for this computer. Ask the owner to check or renew the agent in the Visa Console before retrying."},product_policy_not_active:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Resume the owner-approved setup for this agent; do not retry the payment unchanged."},runtime_spend_session_not_active:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Resume the owner-approved setup for this agent; do not retry the payment unchanged."},runtime_spend_attenuation_not_active:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's spending limits are not in place yet. Resume the owner-approved setup for this agent; do not retry the payment unchanged."},runtime_revoked:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's access on this computer was turned off. Do not reuse it; ask the owner to approve this computer again if access should continue.",remedy:{path:"/agent/enroll/agents",label:"Check the agent in the Console"}},certified_runtime_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This payment needs the owner's approval of this agent's wallet on this computer. Ask the owner to approve it, then retry once."},runtime_certificate_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The owner's approval of this agent's wallet on this computer is no longer valid. Ask the owner to renew it; do not retry unchanged."},runtime_delegation_missing:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Ask the owner to finish it before retrying.",remedy:{path:"/agent/enroll/agents",label:"Finish the agent's wallet setup"}},runtime_delegation_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The owner's approval for this agent's wallet has expired. Ask the owner to renew it before retrying.",remedy:{path:"/agent/enroll/agents",label:"Renew the agent's approval"}},runtime_authority_unavailable:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Visa could not check this agent's permissions. Tell the human, and do not retry or pay another way until Visa is working again."},universal_required_managed_only:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent's wallet setup is not finished. Ask the owner to finish wallet setup before retrying."},wallet_authority_cli_upgrade_required:{kind:"caller",fix:null,nextAction:"Upgrade the CLI to the minimum version named by the server, restart this agent session, and retry once. Nothing was signed or paid."},tap_signature_required:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Escalate to a human. This agent could not prove who it is to the merchant. Nothing was paid. Do not retry the request or the payment without that proof."},wallet_owner_approval_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. Show the owner details.approval.url as is; they approve before details.approval.expiresAt. Call pay again with the same target, max, body and economicIntentId every 15-30 s until it goes through. If the approval expires, stop."},wallet_owner_approval_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. The owner's approval for this payment expired before it went through. Stop: do not call pay again with this economicIntentId. Only if the owner still wants it, start a new payment with a new economicIntentId."},attestation_key_drift:{kind:"caller",fix:"visa connect",nextAction:"This computer's Visa sign-in no longer matches the account (a new machine, a wiped keychain or a restored backup). Set the agent up again with visa connect, then retry."},rc_access_required:{kind:"platform",escalation:"awaiting_human",fix:"export VISA_RC_CODE=<access code>",nextAction:"This preview build of Visa CLI needs an access code. Set VISA_RC_CODE, then retry. Ask your Visa contact for the code; do not guess it."},early_access_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Escalate to a human: an admin must enable this tool for the account. Do not retry until they confirm."},card_checkout_not_on_pay:{kind:"caller",fix:"purchase_create",nextAction:"Nothing was charged. This URL is an ordinary card checkout, which pay cannot do (pay spends from the agent's wallet). Use purchase_create, then purchase_retrieve. Do not retry this target on pay."},card_draw_not_live:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Escalate to a human now. Card payments are not available yet, and nothing on this computer can change that. Do not retry."},checkout_review_refused:{kind:"caller",fix:null,nextAction:"Nothing was charged. This checkout is not supported yet. Choose another checkout, or tell the human; do not retry unchanged."},checkout_action_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was charged and no payment credential was requested. Ask the human to complete the named verification step, then retry the review once."},checkout_mandate_blocked:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was charged. Ask the owner to approve a card allowance that covers this merchant, amount and currency, then start a new review. Do not raise limits yourself."},card_mandate_activation_uncertain:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was charged and no budget is usable: the card network did not confirm the owner's approval. Do not start another approval; ask the owner to check the budget in the Visa Console and approve a fresh one once this one ends."},ucp_platform_profile_unavailable:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Do not retry this checkout. Checkout with this merchant is not available right now; tell the human."},wallet_capability_unavailable:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Escalate to a human now. Wallet payments are not available in this version. Do not retry."},surface_disabled:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Escalate to a human now. Visa has this feature switched off right now, and nothing on this computer changes that. Do not retry."},wallet_grant_required:{kind:"platform",escalation:"awaiting_human",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"The owner has not approved this agent's wallet yet. Call agent_enroll, or ask the owner to run visa connect, and have them approve this computer and its limits; then retry.",remedy:{path:"/agent/enroll/agents",label:"Approve this agent in the Console"}},wallet_credential_required:{kind:"platform",escalation:"awaiting_human",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Call agent_enroll, or ask the owner to run visa connect for this agent, and have them approve this computer and its limits; then retry. Setting up the agent alone does not let it pay.",remedy:{path:"/agent/enroll/agents",label:"Approve this agent in the Console"}},grant_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was reserved, signed or charged. The owner's spending approval for this agent has expired. Ask the owner to renew it in the Visa Console (Limits), then retry the same payment once. Do not create a new agent.",remedy:{path:"/agent/enroll/limits",label:"Renew the agent's approval"}},managed_limits_owner_controlled:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. Only the owner sets this agent's limits. Read them with get_status, then ask the owner to change them in the Visa Console (Limits).",remedy:{path:"/agent/enroll/limits",label:"Change the agent's limits"}},agent_paused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Ask the owner to resume this exact agent in the Visa Console (Agents). Retry only after get_status reports it ready; do not create a replacement credential while the agent is paused.",remedy:{path:"/agent/enroll/agents",label:"Resume the agent in the Console"}},owner_declined:{kind:"caller",fix:null,nextAction:"The owner declined this payment; don't retry it. Nothing was charged. Tell the owner and move on; only if they ask for it again, start a new payment (a new economicIntentId or a new purchase), which asks them again."},setup_declined:{kind:"caller",fix:null,nextAction:"The owner declined this setup, so no agent was connected; don't retry it. Tell the owner, and only if they ask for it again start a new setup (agent_enroll with restart:true, or `visa connect --restart`), which asks them again."},owner_withdrawal_pending:{kind:"caller",fix:null,nextAction:"Nothing was signed or paid. The owner is withdrawing from this wallet and that transfer is still settling (at most about ten minutes). Retry the same payment in a minute; the budget is unchanged."},operator_daily_cap_reached:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The 24-hour spending limit is reached, so this attempt was not signed. Try the same purchase later, once older spending leaves the 24-hour window or the limit is raised. Do not loop, or switch agents or payment methods to get around it."},operator_daily_cap_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not read the 24-hour spending limit, so this attempt was not signed. Tell the human; retry the same purchase later, once the limit can be read. Do not switch agents or payment methods."},kill_switch_engaged:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa has paused these payments for now, or could not confirm they are open. Nothing was paid. Tell the owner and try the same purchase again later; do not loop, pay another way, or create a replacement."},agent_revoked:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The owner removed this agent. Do not retry or reuse it; ask the owner whether to set up a new agent.",remedy:{path:"/agent/enroll/agents",label:"Connect a new agent in the Console"}},device_key_replaced:{kind:"platform",escalation:"awaiting_human",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"Nothing was paid. This agent now runs on another computer, which replaced this computer's keys. Do not retry here. To use this computer too, call agent_enroll (or ask the owner to run visa connect) and approve it as a new agent."},agent_stale:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not confirm this agent is still active. Ask the owner to check it in the Visa Console and approve it again before retrying.",remedy:{path:"/agent/enroll/agents",label:"Check the agent in the Console"}},agent_lifecycle_unknown:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Visa could not confirm this agent's status. Tell the human, and do not retry a payment until get_status reports the agent ready."},wallet_delivery_required:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This agent's wallet setup did not finish. Ask the owner to run visa connect again and re-approve this computer and its limits before paying. Do not create a wallet yourself.",remedy:{path:"/agent/enroll/agents",label:"Reconnect this agent in the Console"}},wallet_authority_revoked:{kind:"caller",fix:"get_status",nextAction:"This wallet can no longer make payments; it is kept so its balance and receipts can be read. Check it with get_status or history, and do not retry a payment until the owner approves a new wallet."},wallet_authority_replacement_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This agent was set up by an older Visa CLI. Update Visa CLI, then set the agent up again with visa connect."},wallet_policy_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed. Ask the owner to set per-payment and daily limits in the Visa Console (Limits), then retry once. Limits are checked before anything is signed.",remedy:{path:"/agent/enroll/limits",label:"Set spending caps in the Console"}},wallet_funding_required:{kind:"caller",fix:"get_status",nextAction:"Ask the owner to add OUSD on Tempo to their wallet before paying: the Visa Console shows the wallet's address and balance under Payments.",remedy:{path:"/agent/enroll/payments",label:"Add funds to the wallet"}},wallet_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Ask the owner to finish wallet setup in the Visa Console (their account has no wallet yet), then try again. Do not keep polling: this cannot finish until the wallet exists.",remedy:{path:"/agent/enroll/payments",label:"Finish wallet setup"}},checkout_agent_access_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Escalate to a human: agent checkout is not turned on for this account. Do not retry until they confirm it is."},unknown_tool:{kind:"caller",fix:null,nextAction:"Call tools/list and use one of the tools it lists. The tool you asked for does not exist."},handoff_not_found:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"That setup was not found. Ask the human to start a new setup from the Visa Console; do not retry this one."},handoff_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"That setup expired. Ask the human to start a new setup in the Visa Console."},handoff_already_redeemed:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"That setup was already used. Ask the human to start a new setup in the Visa Console."},no_paired_agent:{kind:"caller",fix:"agent_enroll (MCP) or visa connect (shell)",nextAction:"No agent is set up on this computer. Call agent_enroll or run visa connect, and have the owner approve it first."},agent_id_required:{kind:"caller",fix:null,nextAction:"Pass the agentId of the agent this is for."},already_terminal:{kind:"caller",fix:null,nextAction:"This was already finished or cancelled. Nothing more is needed."},purchase_transport_uncertain:{kind:"caller",fix:null,nextAction:"Wait briefly, then repeat the same purchase call with the same arguments, request key and purchase ID: the first request may have gone through, and repeating recovers it. Do not cancel, create a replacement or press Pay at the merchant again."},purchase_refused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa refused this purchase. Keep the original purchase and request key, and tell the human. A refusal is not permission to create a replacement or press Pay at the merchant again."},recovery_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Inspect the original purchase and checkout with the owner or support. Preserve the purchase ID and request key. Do not create a replacement, release uncertain liability or submit Pay again."},card_recovery_unconfigured:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase cannot be recovered right now. Ask support to look at it before retrying the same request. Keep the purchase ID; do not create another purchase or press Pay at the merchant again."},card_recovery_original_not_expired:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The first attempt at this purchase is still open. Retrieve the same purchase without include:card and follow its next step; do not force recovery, create another purchase or press Pay at the merchant again."},card_recovery_liability_present:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The first attempt at this purchase is not settled yet. Ask support to look at it and the existing checkout. Do not release funds, ask for new card details or press Pay at the merchant again."},card_recovery_issuance_conflict:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase's records disagree, so it was stopped. Ask support to look at the original purchase. Do not create another purchase or press Pay at the merchant again."},card_recovery_proof_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase could not be recovered. Ask support to look at it; do not replay the same request, set the agent up again or press Pay at the merchant again."},card_purchase_quarantined:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase is on hold for review. Ask support to look at it and the existing checkout. Do not create another purchase or press Pay at the merchant again."},card_credential_not_available:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Card details are not available for this purchase right now. Retrieve the same purchase without include:card and follow its next step. Do not recreate the purchase or press Pay at the merchant again."},purchase_submission_observed:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This purchase was already reported as submitted. Check the existing merchant checkout and report its current state on the same purchase. Do not ask for new card details or press Pay at the merchant again."},protected_card_request_invalid:{kind:"caller",fix:null,nextAction:"The saved purchase request is no longer valid, usually because it expired. Retrieve the same purchase and follow its next step; if it reads expired, run purchase_create again with the same saved request. Do not create a replacement by hand."},protected_card_delivery_conflict:{kind:"caller",fix:null,nextAction:"The saved purchase request was changed after it started. Retrieve the same purchase and follow its next step; do not edit or replay the saved request."},protected_card_authority_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not issue card details right now. Nothing was issued. Wait a moment and retrieve the same purchase; recovery continues on Visa's side."},purchase_cancelled:{kind:"caller",fix:null,nextAction:"This purchase was cancelled; it accepts no new credential. Create a new purchase for a fresh checkout if the buyer still wants it. Do not click merchant Pay."},card_intent_unobserved:{kind:"caller",fix:null,nextAction:"The owner's card allowance for this agent is not active yet. Follow next.open_url so the owner finishes card setup, then retry the same checkout."},card_intent_mandate_exists:{kind:"caller",fix:null,nextAction:"The owner's current approval already has a card allowance in progress. Wait for it to finish (or ask the owner to check the limits page), then retry the same checkout."},card_intent_conflict:{kind:"caller",fix:null,nextAction:"A different card approval request already uses this id. Read the current status instead of sending an edited request."},card_vic_provider_refused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The card network refused to issue card details. Ask the owner or support to check the original purchase before retrying; its hold may not be released yet. Do not create a replacement purchase or press Pay at the merchant again."},terms_conflict:{kind:"caller",fix:null,nextAction:"This request conflicts with the checkout already in progress. Retrieve the original purchase and compare the exact final terms. Do not change the request key or checkout ID to get around it."},card_checkout_expired:{kind:"caller",fix:null,nextAction:"The checkout price expired. Check the original purchase before getting a new final price from the merchant. Do not reuse old terms or change the request key or checkout ID to get around it."},card_mandate_expired:{kind:"caller",fix:null,nextAction:"The agent's card allowance lapsed (each lasts 7 days) and Visa is renewing it under the owner's existing approval. Wait afterMs, then run purchase_create again the same way. Do not involve the owner or create a replacement purchase."},card_allowance_preparing:{kind:"caller",fix:null,nextAction:"Visa is issuing this agent's card allowance under the owner's existing approval. Wait afterMs and run the same purchase create again; the wait loop does this for you. Do not involve the owner or create a replacement purchase."},protected_card_instrument_inactive:{kind:"platform",escalation:"awaiting_human",fix:"purchase_create",nextAction:"The owner replaced or removed the saved card this agent used. Call purchase_create again with the saved resumeId: it returns one open_url the owner opens to reconnect the agent to their current card. Do not ask for card details or press Pay again."},card_reservation_expired:{kind:"caller",fix:null,nextAction:"This purchase's hold expired. Retrieve the same purchase and follow its next step; do not replay old request data or create a replacement to hide an unfinished attempt."},card_merchant_country_mismatch:{kind:"caller",fix:null,nextAction:"Use the merchant's real country everywhere in the checkout terms. Keep the existing purchase; do not change keys to get around a terms conflict."},protected_grant_proof_mismatch:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa could not confirm this agent's approval. Ask the owner or support to check it; do not retry unchanged or create a replacement."},purchase_resume_invalid:{kind:"caller",fix:null,nextAction:"Use the exact saved purchase resume reference by itself; do not combine it with a new request. Preserve the original purchase and merchant checkout."},purchase_draft_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The saved purchase request is damaged or changed. Stop and ask support to recover the original draft; do not overwrite it, invent new terms or click merchant Pay again."},purchase_draft_not_found:{kind:"caller",fix:null,nextAction:"Use the original device and exact saved resume reference. Locate the existing draft before continuing; do not recreate the request or click merchant Pay again."},purchase_draft_agent_invalid:{kind:"caller",fix:null,nextAction:"Pick the existing agent by its exact id and resume the original purchase. Do not set up a new agent or purchase."},purchase_draft_agent_mismatch:{kind:"caller",fix:null,nextAction:"Resume this draft with the same protected agent it already selected. Do not switch agents, replace the draft or click merchant Pay again."},purchase_draft_owner_mismatch:{kind:"caller",fix:null,nextAction:"Sign in as the owner who started this draft on the original device, then resume that same draft. Do not transfer it to another owner or create a replacement purchase."},purchase_draft_owner_required:{kind:"caller",fix:null,nextAction:"Finish the returned owner sign-in step, then resume the same saved purchase. Do not start another setup or purchase."},purchase_draft_busy:{kind:"caller",fix:null,nextAction:"Wait for the current Visa purchase call to finish, then repeat the same resume reference. Do not run concurrent purchase calls, create a replacement or click merchant Pay again."},purchase_not_found:{kind:"caller",fix:null,nextAction:"Check the original purchase ID and selected agent. Recover the existing purchase record; do not mint a replacement merely because a read could not find it."},invalid_contract:{kind:"caller",fix:null,nextAction:"Correct the request using the declared tool schema, then retry only with valid input. Never fabricate facts or change existing payment identifiers to bypass their commitment."},invalid_amount:{kind:"caller",fix:null,nextAction:"Give a positive amount in the units the tool asks for, within its total and precision limits. Never change ids to get around an existing payment."},invalid_currency:{kind:"caller",fix:null,nextAction:"Use the currency required by the selected payment profile. Do not infer merchant country from currency."},unsupported_version:{kind:"caller",fix:null,nextAction:"Use a supported version. Check the tool's schema or update Visa CLI, then retry the same operation without changing its existing ids."},keychain_not_found:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This Mac user has no login keychain, so no agent key was stored or read. Ask the owner to restore or create their login keychain in Keychain Access, then retry. On a server with no keychain, set VISA_RUNTIME_CUSTODY_PROFILE=headless."},custody_store_unreadable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Visa CLI could not read this agent's key on this computer (its permissions or the disk), so nothing was signed or changed. Ask the owner to fix read access to Visa CLI's files, then retry. Do not set the agent up again: the key may still be there."},credential_store_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This computer's Visa sign-in could not be read: the keychain or keyring is locked, did not answer in time, or secret-tool is missing on Linux. Nothing was sent. Ask the owner to unlock it (or install secret-tool), then retry once."},keychain_locked_or_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The Mac login keychain is locked, so this agent's key could not be read. Nothing was signed or sent. Ask the owner to unlock it (log in to the Mac, or open Keychain Access), then retry once."},custody_unavailable:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This agent's key is not on this computer (it was set up by an older Visa CLI or elsewhere). Nothing was signed. Ask the owner to update Visa CLI (npm i -g @visa/cli@rc), run visa connect here, and approve the new agent."},protected_card_enrollment_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. The owner must verify a payment card once for this account. Ask them to sign in to the Visa Console and finish the Verify your card step, then retry once.",remedy:{path:"/agent/enroll?enrollCard=1",label:"Verify a payment card"}},financial_rollout_approval_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. This account is not approved for payments yet. Tell the owner; do not retry until they confirm it was approved."},key_purpose_mismatch:{kind:"platform",escalation:"awaiting_human",fix:"npm i -g @visa/cli@rc",nextAction:"Visa CLI used the wrong key for this, so nothing was signed or sent. This is a Visa CLI bug or a version mismatch: ask the owner to update Visa CLI, then retry once. If it happens again on the latest version, report it."},legacy_custody_profile_required:{kind:"platform",escalation:"awaiting_human",fix:"npm i -g @visa/cli@rc",nextAction:"Visa CLI used the wrong key for this, so nothing was signed or sent. This is a Visa CLI bug or a version mismatch: ask the owner to update Visa CLI, then retry once. If it happens again on the latest version, report it."},identity_binding_mismatch:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This request named a different agent than the key on this computer, so nothing was signed. Read get_status, then retry once with that agent's id; if it happens again, tell the owner."},proof_time_invalid:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"This computer's clock is wrong, so nothing was signed or sent. Ask the owner to set the clock to update automatically, then retry once."},secret_service_locked_or_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The desktop keyring is locked, so the agent's key could not be read. Ask the owner to unlock it; on a machine with no desktop (SSH, WSL, a server), set VISA_RUNTIME_CUSTODY_PROFILE=headless and run visa connect. Do not retry on your own."},secret_service_unavailable:{kind:"platform",escalation:"awaiting_human",fix:"VISA_RUNTIME_CUSTODY_PROFILE=headless visa connect",nextAction:"This computer has no desktop keyring (for example over SSH), so the agent's key could not be read. Set VISA_RUNTIME_CUSTODY_PROFILE=headless and run visa connect, or unlock the keyring in a desktop session. Do not retry on your own."},secret_service_timeout:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"The Linux Secret Service did not answer Visa CLI in time, usually because an unlock prompt is waiting. Ask the owner to answer or unlock the keyring, then retry once."},dpapi_locked_or_unavailable:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Windows would not open this agent's key, usually because this is a different Windows user than the one that set it up. Ask the owner to run Visa CLI as that user; do not retry on your own."},enrollment_device_approval_pending:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This computer's setup is waiting for the owner to approve the device, and starting another would strand it. Run visa connect (without --restart) to reopen the approval and ask the owner to approve it."},enrollment_expired:{kind:"caller",fix:"visa connect --restart",nextAction:"This approval link expired. Run `visa connect --restart` (agent_enroll: restart:true) for a new link, and give the owner the new link."},enrollment_owner_mismatch:{kind:"platform",escalation:"awaiting_human",fix:"visa connect --restart (keep the signed-in account) or visa disconnect --all, then visa connect (switch accounts)",nextAction:"Nothing was connected: this agent belongs to another Visa account. Let the owner choose: visa connect --restart keeps the signed-in account; visa disconnect --all, then visa connect, switches accounts (it removes Visa from every AI client)."},wallet_key_setup_pending:{kind:"platform",escalation:"awaiting_human",fix:"visa connect",nextAction:"This agent is connected but cannot pay yet: its key on the owner's Tempo wallet is not set up. The owner's approval page or the Visa Console finishes it (asking for OUSD first if the wallet is empty). Then call get_status. Do not use --restart.",remedy:{path:"/agent/enroll/payments",label:"Finish the wallet in Payments"}},unspecified_error:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Tell the human what failed and give them the reference. Do not retry this automatically."},tempo_over_max:{kind:"caller",fix:null,nextAction:"Nothing was signed or paid. The charge costs more than max: raise max only if the human agreed to that price, otherwise stop."},tempo_budget_refused:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. The owner's spending budget or per-payment limit does not allow this payment. Ask the human to raise it in the Visa Console; do not retry until they have.",remedy:{path:"/agent/enroll/limits",label:"Change the agent's limits"}},tempo_chain_limit:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. This agent's weekly safety limit on the Tempo wallet is used up; it refills on a weekly schedule shown in the Visa Console. Do not retry before then; tell the human if the purchase cannot wait.",remedy:{path:"/agent/enroll/limits",label:"Change the agent's limits"}},tempo_charge_expired:{kind:"caller",fix:"pay",nextAction:"Nothing was paid. The merchant charge expired before it was signed. Call pay again for the same target to get a fresh charge."},tempo_payment_unclear:{kind:"caller",fix:"pay",nextAction:"The payment may have gone through (charged: null). Do not start a new purchase. Call pay again with the same economicIntentId in about a minute: it reports whether the payment landed and pays only if it did not."},atum_payment_unclear:{kind:"caller",fix:"pay",nextAction:"The payment may have gone through. Call pay again with the same economicIntentId, request, intent and max to recover it. Do not start a new purchase or pay another way. If it cannot be recovered, keep the purchase id and tell the human."},atum_unavailable:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Payments to this merchant are not available right now. No new payment was signed."},tempo_payment_in_progress:{kind:"caller",fix:"pay",nextAction:"Another call is paying this exact purchase right now. Do not pay again; call pay again with the same economicIntentId in a minute to read its outcome."},tempo_payment_refused:{kind:"platform",escalation:"unclassified",fix:null,nextAction:"Nothing was signed or paid. Visa refused this Tempo payment before signing. Tell the human and stop; do not retry."},tempo_charge_mismatch:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was signed or paid. The merchant's Tempo charge does not match what this payment allows (payee, currency or paying account), checked on this machine. Do not retry; tell the human."},tempo_not_enabled:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. This agent's wallet setup is not finished. Ask the owner to open Payments in the Visa Console, where the wallet finishes setting up once it has funds. Then call pay again with the same economicIntentId.",remedy:{path:"/agent/enroll/payments",label:"Finish the wallet in Payments"}},tempo_unavailable:{kind:"platform",escalation:"surface_dark",fix:null,nextAction:"Nothing was paid. Visa has wallet payments switched off right now. Tell the human; do not retry until Visa turns them on, and do not look for another way to pay this merchant."},merchant_not_supported:{kind:"caller",fix:null,nextAction:"Nothing was charged. This merchant offers no payment this wallet can make. Choose a merchant that accepts payment on Tempo."},merchant_unreachable:{kind:"caller",fix:null,nextAction:"Nothing was charged. The merchant URL could not be reached to read its price. Check the URL, then call pay again with the same economicIntentId."},merchant_refused:{kind:"caller",fix:null,nextAction:"Nothing was signed or paid. The merchant refused this request: check the URL, method and body, and do not retry it unchanged."},purchase_on_retired_rail:{kind:"caller",fix:null,nextAction:"Nothing was paid. This purchase used a payment method that was retired. Do not pay it again: check history for its outcome, and use a new economicIntentId only for a genuinely new purchase."},tempo_owner_approval_required:{kind:"platform",escalation:"awaiting_human",fix:null,nextAction:"Nothing was paid. The owner asked to approve each wallet payment, and this one could not be sent to them yet. Call pay again with the same economicIntentId: it asks the owner and returns the approval link. If it keeps failing, ask the human."}},Rx=Object.keys(Xs);function Ys(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(Xs,e)}function uA(e){return e.remedy?{remedyPath:e.remedy.path,remedyLabel:e.remedy.label}:{}}function mr(e,t={}){let r=Xs[e],i=t.fix!==void 0?t.fix:r.fix;if(r.kind==="platform"&&r.escalation!=="awaiting_human"&&i!==null)throw new Error(`agent-contract: ${r.escalation} code "${e}" cannot carry a fix \u2014 no command resolves it`);return{code:e,kind:r.kind,fix:i,nextAction:t.nextAction??r.nextAction,...t.agentId?{agentId:t.agentId}:{},...uA(r)}}var Ar=class extends Error{diagnostic;details;constructor(t,r,i={}){super(t),this.name="AgentContractError";let n=i.agentId??(typeof i.details?.agentId=="string"?i.details.agentId:void 0);this.diagnostic=mr(r,{...i,...n?{agentId:n}:{}}),this.details=i.details}get code(){return this.diagnostic.code}};function Qs(e){if(e instanceof Ar)return e.diagnostic;if(e&&typeof e=="object"){let t=e,r=typeof t.agentId=="string"?t.agentId:t.details&&typeof t.details=="object"&&typeof t.details.agentId=="string"?t.details.agentId:void 0,i=r?{agentId:r}:{},n=e.underlying;if(n instanceof Ar)return n.diagnostic;let a=n?.code;if(a==="agent_paused"||a==="agent_revoked"||a==="device_key_replaced"||a==="grant_expired")return mr(a,i);let o=e.code??e.errorCode;if(Ys(o))return mr(o,i);if(typeof o=="string"){let c=o.toLowerCase();if(Ys(c))return mr(c,i)}let s=e.message;return Ys(s)?mr(s,i):mr("unspecified_error",i)}return mr("unspecified_error")}var at=hr(require("fs")),tu=hr(require("path")),Nf=hr(require("os"));var eu=tu.join(Nf.homedir(),".visa-mcp"),ri=tu.join(eu,"mcp-server.log"),cA=5*1024*1024,ii=null;function lA(){at.existsSync(eu)||at.mkdirSync(eu,{recursive:!0,mode:448})}function dA(){if(!ii){if(lA(),at.existsSync(ri)&&at.statSync(ri).size>cA){let r=ri+".1";at.existsSync(r)&&at.unlinkSync(r),at.renameSync(ri,r)}let e=at.createWriteStream(ri,{flags:"a"});e.on?.("error",()=>{ii===e&&(ii=null)}),ii=e}return ii}function pA(){try{return zo().surface}catch{return"cli"}}function fA(e){return(e==="WARN"||e==="ERROR")&&pA()!=="cli"||process.env.VISA_CLI_DEBUG==="1"}var mA=300,gA=2e3;function hA(e){let t=e.code;return{name:e.name,message:e.message.slice(0,mA),...typeof t=="string"||typeof t=="number"?{code:t}:{},...e.stack?{stack:e.stack.slice(0,gA)}:{}}}function _A(e){if(typeof e=="string")return e;try{return JSON.stringify(e,(r,i)=>i instanceof Error?hA(i):i,2)??""}catch{try{return String(e)}catch{return"[unserializable]"}}}function vA(){try{return`[ref:${pu()}] `}catch{return""}}function yo(e,...t){let r=new Date().toISOString(),i=t.map(_A).join(" "),n=`[${r}] [${e}] ${vA()}${i}
60
+ `;fA(e)&&process.stderr.write(n),dA().write(n)}var Cf={debug:(...e)=>yo("DEBUG",...e),info:(...e)=>yo("INFO",...e),warn:(...e)=>yo("WARN",...e),error:(...e)=>yo("ERROR",...e)};var qf=Symbol.for("visa.cli.writtenForPeople"),Lf=300,tr=class extends Error{constructor(t,r){super(t,r),this.name="PlainError",yA(this)}};function yA(e){try{e&&typeof e=="object"&&Object.isExtensible(e)&&Object.defineProperty(e,qf,{value:!0,enumerable:!1})}catch{}return e}var bA=[Ar,vo];function wA(e){return!(e instanceof Error)||!e.message.trim()?!1:e[qf]===!0?!0:bA.some(t=>e instanceof t)}var ru={x402_retired:"This payment method is no longer offered.",update_required:"This version of Visa CLI is too old for this.",session_required:"This computer is not signed in to Visa.",identity_required:"This computer has no Visa agent set up yet.",legacy_door_removed:"That command was removed from Visa CLI.",agent_selection_required:"More than one agent matches, so none was picked.",invalid_argument:"One of the values given is not valid.",rate_limited:"Too many requests in a short time.",activity_entry_not_found:"That payment was not found.",wallet_network_mismatch:"This merchant does not accept a payment this wallet can make.",agent_operations_cli_upgrade_required:"This version of Visa CLI is too old to pay.",agent_operation_forbidden:"This agent is not allowed to make this payment.",runtime_context_not_found:"Visa could not find this agent's setup on this computer.",product_policy_not_active:"This agent's wallet setup is not finished.",runtime_spend_session_not_active:"This agent's wallet setup is not finished.",runtime_spend_attenuation_not_active:"This agent's spending limits are not set up yet.",runtime_revoked:"This agent's access on this computer was turned off.",certified_runtime_required:"The owner has not approved this agent's wallet on this computer yet.",runtime_certificate_invalid:"This agent's wallet approval on this computer has expired.",runtime_delegation_missing:"This agent's wallet setup is not finished.",runtime_delegation_expired:"This agent's wallet approval has expired.",runtime_authority_unavailable:"Visa could not check this agent's permissions right now.",universal_required_managed_only:"This agent's wallet setup is not finished.",wallet_authority_cli_upgrade_required:"This version of Visa CLI is too old to pay.",tap_signature_required:"This agent could not prove who it is to the merchant.",wallet_owner_approval_required:"This payment needs the owner's approval.",wallet_owner_approval_expired:"The owner's approval for this payment expired.",attestation_key_drift:"This computer's Visa sign-in no longer matches the account.",rc_access_required:"This preview build of Visa CLI needs an access code.",early_access_required:"This feature is not turned on for this account.",card_checkout_not_on_pay:"This is a card checkout, which pay cannot complete.",card_draw_not_live:"Card payments are not available yet.",checkout_review_refused:"This checkout is not supported.",checkout_action_required:"This checkout needs a verification step first.",checkout_mandate_blocked:"The owner's card approval does not cover this purchase.",card_mandate_activation_uncertain:"The card network did not confirm the owner's approval.",ucp_platform_profile_unavailable:"Checkout with this merchant is not available right now.",wallet_capability_unavailable:"Wallet payments are not available in this version.",surface_disabled:"This feature is switched off right now.",wallet_grant_required:"The owner has not approved this agent's wallet yet.",wallet_credential_required:"The owner has not approved this agent to pay yet.",grant_expired:"The owner's spending approval for this agent has expired.",managed_limits_owner_controlled:"Only the owner can change this agent's limits.",agent_paused:"The owner paused this agent.",owner_declined:"The owner declined this payment.",setup_declined:"The owner declined this setup.",owner_withdrawal_pending:"A withdrawal from this wallet is still going through.",operator_daily_cap_reached:"The daily spending limit has been reached.",operator_daily_cap_unavailable:"Visa could not check the daily spending limit.",kill_switch_engaged:"Visa has paused these payments for now.",agent_revoked:"The owner removed this agent.",device_key_replaced:"This agent now runs on another computer.",agent_stale:"Visa could not confirm this agent is still active.",agent_lifecycle_unknown:"Visa could not confirm this agent's status.",wallet_delivery_required:"This agent's wallet setup did not finish.",wallet_authority_revoked:"This wallet can no longer make payments.",wallet_authority_replacement_required:"This agent was set up by an older Visa CLI.",wallet_policy_required:"This agent has no spending limits yet.",wallet_funding_required:"The wallet does not have enough funds.",wallet_unavailable:"The owner's wallet is not set up yet.",checkout_agent_access_required:"Agent checkout is not turned on for this account.",unknown_tool:"That tool does not exist.",handoff_not_found:"That setup was not found.",handoff_expired:"That setup expired.",handoff_already_redeemed:"That setup was already used.",no_paired_agent:"This computer has no Visa agent set up yet.",agent_id_required:"An agent id is needed for this.",already_terminal:"This was already finished or cancelled.",purchase_transport_uncertain:"Visa did not answer in time, so the purchase may or may not have gone through.",purchase_refused:"Visa refused this purchase.",recovery_required:"This purchase needs support to look at it.",card_recovery_unconfigured:"This purchase cannot be recovered right now.",card_recovery_original_not_expired:"The first attempt at this purchase is still open.",card_recovery_liability_present:"The first attempt at this purchase is not settled yet.",card_recovery_issuance_conflict:"This purchase's records disagree, so it was stopped.",card_recovery_proof_invalid:"This purchase could not be recovered.",card_purchase_quarantined:"This purchase is on hold for review.",card_credential_not_available:"Card details are not available for this purchase right now.",purchase_submission_observed:"This purchase was already submitted.",protected_card_request_invalid:"The saved purchase request is no longer valid.",protected_card_delivery_conflict:"The saved purchase request was changed.",protected_card_authority_unavailable:"Visa could not issue card details right now.",purchase_cancelled:"This purchase was cancelled.",card_intent_unobserved:"The owner's card approval for this agent is not active yet.",card_intent_mandate_exists:"A card approval for this agent is already in progress.",card_intent_conflict:"A different card approval already uses this id.",card_vic_provider_refused:"The card network refused to issue card details.",terms_conflict:"This purchase does not match the checkout already in progress.",card_checkout_expired:"The checkout price expired.",card_mandate_expired:"The agent's card allowance lapsed and is being renewed.",card_allowance_preparing:"The agent's card allowance is still being set up.",protected_card_instrument_inactive:"The owner's saved card changed.",card_reservation_expired:"This purchase's hold expired.",card_merchant_country_mismatch:"The merchant country does not match the checkout.",protected_grant_proof_mismatch:"Visa could not confirm this agent's approval.",purchase_resume_invalid:"That saved purchase reference is not valid.",purchase_draft_invalid:"The saved purchase request is damaged.",purchase_draft_not_found:"That saved purchase was not found on this computer.",purchase_draft_agent_invalid:"The agent named for this purchase is not valid.",purchase_draft_agent_mismatch:"This purchase belongs to a different agent.",purchase_draft_owner_mismatch:"This purchase was started by a different Visa account.",purchase_draft_owner_required:"The owner needs to sign in to continue this purchase.",purchase_draft_busy:"Another purchase call is still running.",purchase_not_found:"That purchase was not found.",invalid_contract:"The request is not in the expected form.",invalid_amount:"The amount is not valid.",invalid_currency:"The currency is not valid for this payment.",unsupported_version:"This request uses a version Visa CLI does not support.",keychain_not_found:"This Mac user has no login keychain.",custody_store_unreadable:"Visa CLI could not read this agent's key on this computer.",credential_store_unavailable:"Visa CLI could not read this computer's Visa sign-in.",keychain_locked_or_unavailable:"The Mac login keychain is locked.",custody_unavailable:"This agent's key is not on this computer.",protected_card_enrollment_required:"The owner has not verified a payment card yet.",financial_rollout_approval_required:"This account is not approved for payments yet.",key_purpose_mismatch:"Visa CLI used the wrong key for this.",legacy_custody_profile_required:"Visa CLI used the wrong key for this.",identity_binding_mismatch:"This request named a different agent than the key on this computer.",proof_time_invalid:"This computer's clock is wrong.",secret_service_locked_or_unavailable:"The desktop keyring is locked.",secret_service_unavailable:"No desktop keyring is available on this computer.",secret_service_timeout:"The desktop keyring did not answer in time.",dpapi_locked_or_unavailable:"Windows would not open this agent's key for this user.",enrollment_device_approval_pending:"This computer's setup is still waiting for the owner's approval.",enrollment_expired:"The approval link expired.",enrollment_owner_mismatch:"This agent belongs to a different Visa account than the one signed in here.",wallet_key_setup_pending:"This agent's wallet key is not set up yet.",unspecified_error:"Something unexpected went wrong.",tempo_over_max:"The price is higher than the maximum allowed.",tempo_budget_refused:"The owner's limits do not allow this payment.",tempo_chain_limit:"This agent's weekly wallet limit is used up.",tempo_charge_expired:"The merchant's charge expired.",tempo_payment_unclear:"The payment may have gone through.",atum_payment_unclear:"The payment may have gone through.",atum_unavailable:"This payment method is not available.",tempo_payment_in_progress:"This purchase is already being paid.",tempo_payment_refused:"Visa refused this payment.",tempo_charge_mismatch:"The merchant's charge does not match this payment.",tempo_not_enabled:"This agent's wallet setup is not finished.",tempo_unavailable:"Wallet payments are switched off right now.",merchant_not_supported:"This merchant has no payment this wallet can make.",merchant_unreachable:"The merchant could not be reached.",merchant_refused:"The merchant refused this request.",purchase_on_retired_rail:"This purchase used a payment method that was retired.",tempo_owner_approval_required:"This payment needs the owner's approval."},Mf="Visa could not be reached. Check your internet connection and try again.",Rf="Visa did not answer in time. Try again in a few minutes.",Vf="Visa is having trouble right now. Try again in a few minutes.";function $A(e){let t=e&&typeof e=="object"?e.name:void 0;return typeof t=="string"?t:""}function zA(e){let t=$A(e);if(t==="AbortError"||t==="TimeoutError")return Rf;if(t==="ProtectedAuthorityTransportError"){let i=e.reason;return i==="timeout"?Rf:i==="response"?Vf:Mf}let r=e?.cause;return t==="TypeError"&&r&&typeof r=="object"&&typeof r.code=="string"?Mf:null}function IA(e){return e>=500||e===408||e===425?Vf:e===429?ru.rate_limited:e===404?"That was not found.":e===403?"This account is not allowed to do that.":e===409?"This conflicts with something already in progress.":e>=400?"Visa could not accept this request.":null}function iu(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=100&&t<=599?t:null}var Uf=new WeakSet;function nu(e){let t=[],r=e?.cause;for(let i=0;i<4&&r&&typeof r=="object";i+=1){let n=r,a=[typeof n.name=="string"?n.name:null,typeof n.message=="string"?n.message:null,typeof n.code=="string"||typeof n.code=="number"?`(${n.code})`:null].filter(Boolean).join(" ");a&&t.push(a.slice(0,Lf)),r=n.cause}return t}function bo(e){return typeof e=="string"&&e?e.slice(0,Lf):void 0}function Zf(e,t,r,i=!1){try{let n=e&&typeof e=="object"?e:{};if(i&&!bo(n.detail)&&nu(e).length===0)return;if(e&&typeof e=="object"){if(Uf.has(e))return;Uf.add(e)}Cf.warn("failure:detail",{code:t.code,name:e instanceof Error?e.name:typeof e,...iu(e)!==null?{status:iu(e)}:{},...typeof n.code=="string"?{thrownCode:n.code.slice(0,64)}:{},message:bo(e instanceof Error?e.message:String(e)),...bo(n.detail)?{detail:bo(n.detail)}:{},...nu(e).length?{causes:nu(e)}:{},shown:r})}catch{}}function Ff(e,t={}){let r;try{r=Qs(e)}catch{r=Qs(void 0)}if(wA(e)){let n=e.message.trim();return Zf(e,r,n,!0),n}let i=(r.code!=="unspecified_error"?ru[r.code]:null)??zA(e)??IA(iu(e)??0)??t.fallback??ru.unspecified_error;return Zf(e,r,i),i}var wo=hr(Bf());function Gf(e){return e.includes("-rc.")?"rc":"latest"}var Jx=process.platform==="win32"?"visa-cli.cmd":"visa-cli";var OA="5.0.0-rc.414",au="Usage: visa-tool <tool> ['<json arguments>'], visa-tool --list, or visa-tool --skill",kA=3e5,PA=3e3;async function Kf(e,t,r){let i=(0,Jf.spawn)(process.execPath,[e],{env:t,stdio:["pipe","pipe","pipe"]}),n=new Map,a="",o=null,s=new Promise((w,z)=>{o=z});s.catch(()=>{}),i.stderr.resume(),i.on("error",()=>o?.(new tr("The Visa MCP server could not be started."))),i.on("exit",()=>o?.(new tr("The Visa MCP server stopped before it answered. Its log is ~/.visa-mcp/mcp-server.log."))),i.stdout.on("data",w=>{a+=w;let z;for(;(z=a.indexOf(`
61
61
  `))>=0;){let N=a.slice(0,z).trim();if(a=a.slice(z+1),!!N)try{let q=JSON.parse(N);typeof q.id=="number"&&n.get(q.id)?.(q)}catch{}}});let c=0,d=w=>i.stdin.write(`${JSON.stringify({jsonrpc:"2.0",...w})}
62
62
  `),p=(w,z)=>{let N=++c,q=new Promise(_e=>n.set(N,_e));return d({id:N,method:w,params:z}),Promise.race([q,s])},_,b=new Promise((w,z)=>{_=setTimeout(()=>z(new tr("The Visa MCP server did not answer in time.")),kA)});try{let w=async()=>{let z=await p("initialize",{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"visa-tool",version:"1"}});if(z.error)throw new tr("The Visa MCP server refused to start.");d({method:"notifications/initialized"});let N=z.result?.instructions;return r(p,typeof N=="string"?N:"")};return await Promise.race([w(),b])}finally{clearTimeout(_),o=null,i.stdin.end(),setTimeout(()=>i.kill(),PA).unref()}}async function Hf(e,t,r,i=process.env){return Kf(e,i,async n=>{let a=await n("tools/call",{name:t,arguments:r});return a.error?{text:a.error.message??"The tool call failed.",isError:!0}:{text:(a.result?.content??[]).filter(s=>s.type==="text").map(s=>s.text??"").join(`
63
63
  `),isError:a.result?.isError===!0}})}async function Yf(e,t=process.env){return Kf(e,t,async(r,i)=>{let n=await r("tools/list",{});if(n.error)throw new tr("The tool list could not be read.");let a=n.result?.tools??[];return{instructions:i,skill_version:wo.AGENT_SKILL_VERSION,tools:a.map(({name:o,description:s,inputSchema:c})=>({name:o,description:s,inputSchema:c}))}})}function Xf(e,t=process.env){return(0,wo.agentSkill)({channel:Gf(e),headless:t.VISA_RUNTIME_CUSTODY_PROFILE==="headless"})}async function jA(e,t=i=>process.stdout.write(`${i}