@cline/shared 0.0.92 → 0.0.93-nightly.1792117748
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/agent.d.ts +4 -0
- package/dist/automation/index.js +12 -12
- package/dist/db/index.js +5 -5
- package/dist/extensions/contribution-registry.d.ts +18 -0
- package/dist/feature-flags.d.ts +1 -1
- package/dist/hub.d.ts +81 -3
- package/dist/index.browser.d.ts +3 -1
- package/dist/index.browser.js +19 -19
- package/dist/index.d.ts +3 -1
- package/dist/index.js +42 -42
- package/dist/llms/tokens.d.ts +23 -0
- package/dist/providers/defaults.d.ts +6 -2
- package/dist/remote-config/index.js +26 -26
- package/dist/rpc/runtime.d.ts +5 -1
- package/dist/services/telemetry-selfcheck.d.ts +26 -0
- package/dist/services/telemetry.d.ts +2 -0
- package/dist/storage/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function pt(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function $n(e,t="|"){return e.map((n)=>Bn(n)).join(t)}function mt(e,t){if(typeof t==="bigint")return t.toString();return t}class _i{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function ft(e){return new _i(e)}function vi(e){return e===null||e===void 0}function Bt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ti(e,t){let n=e/t,o=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-o)<r)return 0;return n-o}function te(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function be(e){return gt(e._zod.def)??e._zod.def.shape}function Ci(e,t,n){Object.defineProperty(e,t,{get(){let o=n();return te(this,t,o),o},enumerable:!0,configurable:!0})}function ki(e,t,n){if(t in e)te(e,t,n);else e[t]=n}function Oe(e,t,n,o){let r=be(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(r,i);if(!s.enumerable)continue;if(s.get)Ci(e,i,()=>{let a=t._zod.def.shape[i];return o?o(a,i):a});else ki(e,i,o?o(s.value,i):s.value)}}function bp(e,t){for(let n of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,n);if(!o.enumerable)continue;if(o.get)Ci(e,n,()=>t[n]);else ki(e,n,o.value)}}function ne(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Ei(e){return JSON.stringify(e)}function Ri(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ln="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ai=ft(()=>{if(Y.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ze(e){if(Ue(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(Ue(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Dn(e){if(ze(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Ii=new Set(["string","number","symbol"]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ue(e,t,n){let o=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)o._zod.parent=e;return o}function _(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Bn(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function wi(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ut=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Un={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xp(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Oe(i,e,Zt(e,t)),ue(e,ne(n,{shape:i,checks:[]}))}function Zt(e,t){let n=be(e),o=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw Error(`Unrecognized key: "${String(r)}"`);if(t[r])o.push(r)}return o}function Sp(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Zt(e,t)),s={};return Oe(s,e,Reflect.ownKeys(be(e)).filter((a)=>!i.has(a))),ue(e,ne(n,{shape:s,checks:[]}))}function _p(e,t){if(!ze(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=be(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ue(e,ne(e._zod.def,{shape:Pi(e,t)}))}function Pi(e,t){let n={};return Oe(n,e,Reflect.ownKeys(be(e))),bp(n,t),n}function vp(e,t){if(!ze(t))throw Error("Invalid input to safeExtend: expected a plain object");return ue(e,ne(e._zod.def,{shape:Pi(e,t)}))}function Tp(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Oe(n,e,Reflect.ownKeys(be(e))),Oe(n,t,Reflect.ownKeys(be(t)));let o=ne(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ue(e,o)}function Mi(e,t,n,o="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let a=n?new Set(Zt(t,n)):void 0,c={};return Oe(c,t,Reflect.ownKeys(be(t)),e&&((l,d)=>a&&!a.has(d)?l:new e({type:"optional",innerType:l}))),ue(t,ne(t._zod.def,{shape:c,checks:[]}))}function Cp(e,t,n){let o=n?new Set(Zt(t,n)):void 0,r={};return Oe(r,t,Reflect.ownKeys(be(t)),(i,s)=>o&&!o.has(s)?i:new e({type:"nonoptional",innerType:i})),ue(t,ne(t._zod.def,{shape:r}))}function re(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Oi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function de(e,t){return t.map((n)=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function dt(e){return typeof e==="string"?e:e?.message}function Zn(e,t,n){var o;for(let r=t;r<e.length;r++)(o=e[r]).schema??(o.schema=n)}function pe(e,t,n){var o;let r=e.inst?._zod?.traits;if(r?.has("$ZodType"))if(r.has("$ZodCheck"))(o=e).schema??(o.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:dt(e.inst?._zod.def?.error?.(e))??dt(i?.(e))??dt(t?.error?.(e))??dt(n.customError?.(e))??dt(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}var kp=/[\uD800-\uDBFF]/;function Ft(e){let t=e.length;if(!kp.test(e))return t;let n=t;for(let o=0;o<t-1;o++)if((e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320)n--,o++;return n}function Ht(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function zi(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Ne(...e){let[t,n,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:o};return{...t}}function Ni(e,t){for(let n in t){let o=Object.getOwnPropertyDescriptor(t,n);if(o.get)Object.defineProperty(e,n,{...o,enumerable:!1});else Ep(e,n,o.value)}}function xe(e,t,n,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:n}),n}function jt(e,t,n){return xe(e,t,n,!1)}function Fn(e,t){for(let n in e){let o=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return xe(this,n,o(this))},set(r){xe(this,n,r)}})}return t}function Ep(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:xe(this,t,n.bind(this))},set(o){xe(this,t,o)}})}function Rp(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Nn,ke=!1,Ap={configurable:!0,get(){ke=!0;return}};function P(e,t,n){let o=Object.getPrototypeOf(e._zod);if(t in o&&Nn!==e._zod){Nn=void 0;return}Nn=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,Ap);let r=ke;ke=!1;try{let i=n(this);if(ke)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ke=ke||r,i}catch(i){throw delete this[t],ke=ke||r,i}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function Ip(e,t,n,o){let r=Rp(e,t);if(!r)return;Object.defineProperty(r,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:i})}})}var wp="~constantCatch";function $i(e){let t=()=>e;return t[wp]=!0,t}var Li;var Hn={value:void 0,enumerable:!1},Di="captureStackTrace"in Error?Error:null;function Pp(e){let t=Di;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Di=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function h(e,t,n,o){let r={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=r;let s=n,a=s&&new WeakSet;function c(m,f){if(!m._zod){Hn.value=new i(f);try{Object.defineProperty(m,"_zod",Hn)}finally{Hn.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),a){let y=Object.getPrototypeOf(m),S=m._zod.constr.prototype,v=y;while(v&&v!==S)v=Object.getPrototypeOf(v);let k=v??y;if(!a.has(k))a.add(k),Ni(k,s)}let g=p.prototype;for(let y in g){if(!Object.prototype.hasOwnProperty.call(g,y))continue;if(!(y in m))m[y]=g[y].bind(m)}}let l=o?.Parent??Object;class d extends l{}Object.defineProperty(d,"name",{value:e});function p(m){let f=o?.Parent?Pp(d):this;c(f,m);let g=f._zod.deferred;if(g){for(let S of g)S();f._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(f);return f}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:(m)=>{if(o?.Parent&&m instanceof o.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class me extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ht extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Li=globalThis).__zod_globalConfig??(Li.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function Q(e){if(e)Object.assign(Y,e);return Y}function Mp(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,mt,2)),e.message}function Op(e){this._zod.message=e}var zp={get:Mp,set:Op,enumerable:!0,configurable:!0},Vn={value:void 0,enumerable:!1},Bi=new WeakSet([Object.prototype,Error.prototype]),Ui=(e,t)=>{e.name="$ZodError",Vn.value=t,Object.defineProperty(e,"issues",Vn),Vn.value=void 0,Object.defineProperty(e,"message",zp);let n=Object.getPrototypeOf(e);if(!Bi.has(n))Bi.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}})},Zi=h("$ZodError",Ui),qn=h("$ZodError",Ui,void 0,{Parent:Error});function Np(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function Gn(e,t=(n)=>n.message){let n={},o=[];for(let r of e.issues)if(r.path.length>0)Np(n,r.path[0],()=>[]).push(t(r));else o.push(t(r));return{formErrors:o,fieldErrors:n}}function Kn(e,t=(n)=>n.message){let n={_errors:[]},o=(r,i=[])=>{for(let s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;while(l<a.length){let d=a[l],p=l===a.length-1;if(d==="_errors"){if(p)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,d))Object.defineProperty(c,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[d];if(p)m._errors.push(t(s));c=m,l++}}}};return o(e),n}function $p(e){let t=[],n=e.map((o)=>typeof o==="object"?o.key:o);for(let o of n)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function Fi(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${$p(o.path)}`);return t.join(`
|
|
2
|
-
`)}function Vt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yt=(e)=>{let t=(n,o,r,i)=>{let s=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw new me;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>pe(l,s,Q())));throw Ln(c,i?.callee??t),c}return a.value};return t},Wn=yt(qn),bt=(e)=>{let t=async(n,o,r,i)=>{let s=r?{...r,async:!0}:{async:!0},a=n._zod.run({value:o,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>pe(l,s,Q())));throw Ln(c,i?.callee??t),c}return a.value};return t},Jn=bt(qn),qt=(e)=>(t,n,o)=>{let r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new me;return i.issues.length?Hi(e,i.issues,r):{success:!0,data:i.value}};function Hi(e,t,n){let o;return{success:!1,get error(){if(!o)o=new e(t.map((r)=>pe(r,n,Q()))),t=void 0,n=void 0;return o},set error(r){o=r,t=void 0,n=void 0}}}var Gt=(e)=>async(t,n,o)=>{let r=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length?Hi(e,i.issues,r):{success:!0,data:i.value}};var Dp=Symbol.for("zod.compile.invalid"),Bp=Symbol.for("zod.compile.fallback"),Yn=(e,t,n)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Dp)return!0;if(o.definite===!0&&n===void 0)return!1}return Up(e,t,n)};function Up(e,t,n){let o=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,i;if(r)o[Bp]=!0,i=r({value:t,issues:[]},o);else i=e._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new me;return i.issues.length===0}var Xn=async(e,t,n)=>{let o=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},o);if(r instanceof Promise)r=await r;return r.issues.length===0},ji=(e)=>{let t=yt(e),n=(o,r,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,r,a,Vt(n,s))};return n};var Vi=(e)=>{let t=yt(e),n=(o,r,i,s)=>t(o,r,i,Vt(n,s));return n};var qi=(e)=>{let t=bt(e),n=async(o,r,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(o,r,a,Vt(n,s))};return n};var Gi=(e)=>{let t=bt(e),n=async(o,r,i,s)=>await t(o,r,i,Vt(n,s));return n};var Ki=(e)=>(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return qt(e)(t,n,r)};var Wi=(e)=>(t,n,o)=>qt(e)(t,n,o);var Ji=(e)=>async(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return Gt(e)(t,n,r)};var Yi=(e)=>async(t,n,o)=>Gt(e)(t,n,o);var Xi=/^[cC][0-9a-z]{6,}$/,Qi=/^[0-9a-z]+$/,es=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ts=/^[0-9a-vA-V]{20}$/,ns=/^[A-Za-z0-9]{27}$/,os=/^[a-zA-Z0-9_-]{21}$/;function rs(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var is=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ss=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,eo=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var as=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Zp="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function cs(){return new RegExp(Zp,"u")}var us=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ls=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var ds=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ps=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ms=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var gs=/^https?$/,hs=/^\+[1-9]\d{6,14}$/;var ys="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Fp(e){return new RegExp(`^${e}$`)}var bs=Fp(ys);function Qn(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function xs(e){return new RegExp(`^${Qn(e)}$`)}function Ss(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Qn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${n}|${Qn({precision:e.precision})}`:n;return new RegExp(`^${ys}T(?:${o})$`)}var _s=/^[\s\S]{0,}$/;var to=/^-?\d+$/,xt=/^-?\d+(?:\.\d+)?$/,vs=/^(?:true|false)$/i;var Ts=/^[^A-Z]*$/,Cs=/^[^a-z]*$/;var G=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var no=(e)=>{let t=e.value;return!vi(t)&&t.length!==void 0},Kt={number:"number",bigint:"bigint",object:"date"},oo=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=Kt[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:Kt[typeof o.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ro=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=Kt[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:Kt[typeof o.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ks=h("$ZodCheckMultipleOf",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ti(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Es=h("$ZodCheckNumberFormat",(e,t)=>{G.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),o=n?"int":"number",[r,i]=Ut[t.format];e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<r)s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Rs=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=no),e._zod.check=(o)=>{let r=o.value,i=r.length;if((typeof r==="string"&&i>t.maximum?Ft(r):i)<=t.maximum)return;let a=Ht(r);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),As=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=no),e._zod.check=(o)=>{let r=o.value,i=r.length;if((typeof r==="string"&&i>=t.minimum&&i<t.minimum*2?Ft(r):i)>=t.minimum)return;let a=Ht(r);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Is=h("$ZodCheckLengthEquals",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=no),e._zod.check=(o)=>{let r=o.value,i=r.length,s=typeof r==="string"&&i>=t.length&&i<=t.length*2?Ft(r):i;if(s===t.length)return;let a=Ht(r),c=s>t.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),St=h("$ZodCheckStringFormat",(e,t)=>{var n,o;if(G.init(e,t),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),ws=h("$ZodCheckRegex",(e,t)=>{St.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ps=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ts),St.init(e,t)}),Ms=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cs),St.init(e,t)}),Os=h("$ZodCheckIncludes",(e,t)=>{G.init(e,t);let n=Ee(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=o,e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),zs=h("$ZodCheckStartsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`^${Ee(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Ns=h("$ZodCheckEndsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`.*${Ee(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var $s=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class io{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
3
|
-
`).filter((i)=>i),
|
|
1
|
+
function pt(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Ln(e,t="|"){return e.map((n)=>Un(n)).join(t)}function mt(e,t){if(typeof t==="bigint")return t.toString();return t}class vi{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function ft(e){return new vi(e)}function Ti(e){return e===null||e===void 0}function Bt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ci(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<o)return 0;return n-r}function te(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function be(e){return gt(e._zod.def)??e._zod.def.shape}function ki(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return te(this,t,r),r},enumerable:!0,configurable:!0})}function Ei(e,t,n){if(t in e)te(e,t,n);else e[t]=n}function Oe(e,t,n,r){let o=be(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)ki(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a});else Ei(e,i,r?r(s.value,i):s.value)}}function Tp(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)ki(e,n,()=>t[n]);else Ei(e,n,r.value)}}function ne(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ri(e){return JSON.stringify(e)}function Ai(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Dn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var wi=ft(()=>{if(Y.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ze(e){if(Ue(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(Ue(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Bn(e){if(ze(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Ii=new Set(["string","number","symbol"]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ue(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function _(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Un(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Pi(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ut=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Zn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Cp(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Oe(i,e,Zt(e,t)),ue(e,ne(n,{shape:i,checks:[]}))}function Zt(e,t){let n=be(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])r.push(o)}return r}function kp(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Zt(e,t)),s={};return Oe(s,e,Reflect.ownKeys(be(e)).filter((a)=>!i.has(a))),ue(e,ne(n,{shape:s,checks:[]}))}function Ep(e,t){if(!ze(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=be(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ue(e,ne(e._zod.def,{shape:Mi(e,t)}))}function Mi(e,t){let n={};return Oe(n,e,Reflect.ownKeys(be(e))),Tp(n,t),n}function Rp(e,t){if(!ze(t))throw Error("Invalid input to safeExtend: expected a plain object");return ue(e,ne(e._zod.def,{shape:Mi(e,t)}))}function Ap(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Oe(n,e,Reflect.ownKeys(be(e))),Oe(n,t,Reflect.ownKeys(be(t)));let r=ne(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ue(e,r)}function Oi(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Zt(t,n)):void 0,c={};return Oe(c,t,Reflect.ownKeys(be(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),ue(t,ne(t._zod.def,{shape:c,checks:[]}))}function wp(e,t,n){let r=n?new Set(Zt(t,n)):void 0,o={};return Oe(o,t,Reflect.ownKeys(be(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),ue(t,ne(t._zod.def,{shape:o}))}function oe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function zi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function de(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function dt(e){return typeof e==="string"?e:e?.message}function Fn(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;if(o>=0)t.push([o,n])}return t}function Ft(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function pe(e,t,n){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:dt(e.inst?._zod.def?.error?.(e))??dt(i?.(e))??dt(t?.error?.(e))??dt(n.customError?.(e))??dt(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}var Ip=/[\uD800-\uDBFF]/;function Ht(e){let t=e.length;if(!Ip.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function jt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ni(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Ne(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function $i(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else Pp(e,n,r.value)}}function xe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Vt(e,t,n){return xe(e,t,n,!1)}function Hn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return xe(this,n,r(this))},set(o){xe(this,n,o)}})}return t}function Pp(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:xe(this,t,n.bind(this))},set(r){xe(this,t,r)}})}function Mp(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var $n,ke=!1,Op={configurable:!0,get(){ke=!0;return}};function P(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&$n!==e._zod){$n=void 0;return}$n=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Op);let o=ke;ke=!1;try{let i=n(this);if(ke)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ke=ke||o,i}catch(i){throw delete this[t],ke=ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function zp(e,t,n,r){let o=Mp(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Np="~constantCatch";function Li(e){let t=()=>e;return t[Np]=!0,t}var Di;var jn={value:void 0,enumerable:!1},Bi="captureStackTrace"in Error?Error:null;function $p(e){let t=Bi;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Bi=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function h(e,t,n,r){let o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(m,f){if(!m._zod){jn.value=new i(f);try{Object.defineProperty(m,"_zod",jn)}finally{jn.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),a){let y=Object.getPrototypeOf(m),S=m._zod.constr.prototype,v=y;while(v&&v!==S)v=Object.getPrototypeOf(v);let k=v??y;if(!a.has(k))a.add(k),$i(k,s)}let g=p.prototype;for(let y in g){if(!Object.prototype.hasOwnProperty.call(g,y))continue;if(!(y in m))m[y]=g[y].bind(m)}}let u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(m){let f=r?.Parent?$p(l):this;c(f,m);let g=f._zod.deferred;if(g){for(let S of g)S();f._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(f);return f}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:(m)=>{if(r?.Parent&&m instanceof r.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class me extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ht extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Di=globalThis).__zod_globalConfig??(Di.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function Q(e){if(e)Object.assign(Y,e);return Y}function Lp(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,mt,2)),e.message}function Dp(e){this._zod.message=e}var Bp={get:Lp,set:Dp,enumerable:!0,configurable:!0},qn={value:void 0,enumerable:!1},Ui=new WeakSet([Object.prototype,Error.prototype]),Zi=(e,t)=>{e.name="$ZodError",qn.value=t,Object.defineProperty(e,"issues",qn),qn.value=void 0,Object.defineProperty(e,"message",Bp);let n=Object.getPrototypeOf(e);if(!Ui.has(n))Ui.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},Fi=h("$ZodError",Zi),Gn=h("$ZodError",Zi,void 0,{Parent:Error});function Up(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function Kn(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)Up(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function Wn(e,t=(n)=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,u=0;while(u<a.length){let l=a[u],p=u===a.length-1;if(l==="_errors"){if(p)c._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];if(p)m._errors.push(t(s));c=m,u++}}}};return r(e),n}function Zp(e){let t=[],n=e.map((r)=>typeof r==="object"?r.key:r);for(let r of n)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function Hi(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)if(t.push(`✖ ${r.message}`),r.path?.length)t.push(` → at ${Zp(r.path)}`);return t.join(`
|
|
2
|
+
`)}function qt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yt=(e)=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new me;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((u)=>pe(u,s,Q())));throw Dn(c,i?.callee??t),c}return a.value};return t},Jn=yt(Gn),bt=(e)=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((u)=>pe(u,s,Q())));throw Dn(c,i?.callee??t),c}return a.value};return t},Yn=bt(Gn),Gt=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new me;return i.issues.length?ji(e,i.issues,o):{success:!0,data:i.value}};function ji(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((o)=>pe(o,n,Q()))),t=void 0,n=void 0;return r},set error(o){r=o,t=void 0,n=void 0}}}var Kt=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?ji(e,i.issues,o):{success:!0,data:i.value}};var Hp=Symbol.for("zod.compile.invalid"),jp=Symbol.for("zod.compile.fallback"),Xn=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Hp)return!0;if(r.definite===!0&&n===void 0)return!1}return Vp(e,t,n)};function Vp(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[jp]=!0,i=o({value:t,issues:[]},r);else i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new me;return i.issues.length===0}var Qn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},Vi=(e)=>{let t=yt(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,qt(n,s))};return n};var qi=(e)=>{let t=yt(e),n=(r,o,i,s)=>t(r,o,i,qt(n,s));return n};var Gi=(e)=>{let t=bt(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,qt(n,s))};return n};var Ki=(e)=>{let t=bt(e),n=async(r,o,i,s)=>await t(r,o,i,qt(n,s));return n};var Wi=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Gt(e)(t,n,o)};var Ji=(e)=>(t,n,r)=>Gt(e)(t,n,r);var Yi=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Kt(e)(t,n,o)};var Xi=(e)=>async(t,n,r)=>Kt(e)(t,n,r);var Qi=/^[cC][0-9a-z]{6,}$/,es=/^[0-9a-z]+$/,ts=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ns=/^[0-9a-vA-V]{20}$/,rs=/^[A-Za-z0-9]{27}$/,os=/^[a-zA-Z0-9_-]{21}$/;function is(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ss=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var as=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tr=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var cs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var qp="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function us(){return new RegExp(qp,"u")}var ls=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ds=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var ps=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ms=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var hs=/^https?$/,ys=/^\+[1-9]\d{6,14}$/;var bs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Gp(e){return new RegExp(`^${e}$`)}var xs=Gp(bs);function er(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ss(e){return new RegExp(`^${er(e)}$`)}function _s(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${er({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${er({precision:e.precision})}`:n;return new RegExp(`^${bs}T(?:${r})$`)}var vs=/^[\s\S]{0,}$/;var nr=/^-?\d+$/,xt=/^-?\d+(?:\.\d+)?$/,Ts=/^(?:true|false)$/i;var Cs=/^[^A-Z]*$/,ks=/^[^a-z]*$/;var G=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var rr=(e)=>{let t=e.value;return!Ti(t)&&t.length!==void 0},Wt={number:"number",bigint:"bigint",object:"date"},or=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=Wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:Wt[typeof r.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=Wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:Wt[typeof r.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Es=h("$ZodCheckMultipleOf",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ci(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Rs=h("$ZodCheckNumberFormat",(e,t)=>{G.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=Ut[t.format];e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var As=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=rr),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ht(o):i)<=t.maximum)return;let a=jt(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ws=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=rr),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ht(o):i)>=t.minimum)return;let a=jt(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Is=h("$ZodCheckLengthEquals",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=rr),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ht(o):i;if(s===t.length)return;let a=jt(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),St=h("$ZodCheckStringFormat",(e,t)=>{var n,r;if(G.init(e,t),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),Ps=h("$ZodCheckRegex",(e,t)=>{St.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ms=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Cs),St.init(e,t)}),Os=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ks),St.init(e,t)}),zs=h("$ZodCheckIncludes",(e,t)=>{G.init(e,t);let n=Ee(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ns=h("$ZodCheckStartsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`^${Ee(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),$s=h("$ZodCheckEndsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`.*${Ee(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var Ls=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class sr{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
3
|
+
`).filter((i)=>i),r=Math.min(...n.map((i)=>i.length-i.trimStart().length)),o=n.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
4
|
${t.join(`
|
|
5
5
|
`)}
|
|
6
|
-
};`)(...Object.values(this.closed))}}var Ds={major:4,minor:6,patch:5};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ds;let o=e._zod.def.checks,r=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of r)for(let s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let d=re(a),p;for(let m of c){if(m._zod.def.when){if(Oi(a))continue;if(!m._zod.def.when(a))continue}else if(d)continue;let f=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new me;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await g,a.issues.length===f)return;if(Zn(a.issues,f,e),!d)d=re(a,f)});else{if(a.issues.length===f)continue;if(Zn(a.issues,f,e),!d)d=re(a,f)}}if(p)return p.then(()=>a);return a},s=(a,c,l)=>{if(re(a))return a.aborted=!0,a;let d=i(c,r,l);if(d instanceof Promise){if(l.async===!1)throw new me;return d.then((p)=>e._zod.parse(p,l))}return e._zod.parse(d,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let d=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(d instanceof Promise)return d.then((p)=>s(p,a,c));return s(d,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new me;return l.then((d)=>i(d,r,c))}return i(l,r,c)}}},{get "~standard"(){return jt(this,"~standard",ao(this))},set "~standard"(e){xe(this,"~standard",e)}}),Xs=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>pe(n,t,Q()))}:{value:e.value};async function Hp(e,t){let n={async:!0};return Xs(await e._zod.run({value:t,issues:[]},n),n)}function ao(e){return{validate:(t)=>{let n={async:!1};try{let o=e._zod.run({value:t,issues:[]},n);if(!(o instanceof Promise))return Xs(o,n)}catch(o){}return Hp(e,t)},vendor:"zod",version:1}}var Xt=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??_s,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),U=h("$ZodStringFormat",(e,t)=>{St.init(e,t),Xt.init(e,t)}),Qs=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ss),U.init(e,t)}),ea=h("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=eo(o))}else t.pattern??(t.pattern=eo());U.init(e,t)}),ta=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=as),U.init(e,t)}),na=1,Jt=2;function oa(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function jp(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return oa(e)||Jt;return Vp(e,t)}function Vp(e,t){if(!t.normalize&&t.protocol?.source===gs.source&&!/^https?:\/\//i.test(e))return na;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Jt}return new URL(e)}catch{return Jt}}var qp=/[\t\n\r]/g;function Bs(e){return e.replace(qp,"")}function Gp(e,t){return t.lastIndex=0,t.test(e.hostname)}function Kp(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ra=h("$ZodURL",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{try{let o=n.value.trim(),r=jp(o,t);if(r===na){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(r===Jt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(r===!0){n.value=Bs(o);return}if(t.hostname&&!Gp(r,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!Kp(r,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?r.href:Bs(o);return}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ia=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cs()),U.init(e,t)}),sa=h("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?os:rs(t.length)),U.init(e,t)}),aa=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Xi),U.init(e,t)}),ca=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qi),U.init(e,t)}),ua=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=es),U.init(e,t)}),la=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ts),U.init(e,t)}),da=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ns),U.init(e,t)}),pa=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ss(t)),U.init(e,t)}),ma=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bs),U.init(e,t)}),fa=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xs(t)),U.init(e,t)}),ga=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=is),U.init(e,t)}),ha=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=us),U.init(e,t)}),Wp=/^[0-9a-fA-F:.]+$/;function ya(e){if(!Wp.test(e))return!1;return oa(`http://[${e}]`)}var ba=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ls),U.init(e,t),e._zod.check=(n)=>{if(!ya(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var xa=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ds),U.init(e,t)});function Jp(e){let t=e.split("/");if(t.length!==2)return!1;let[n,o]=t;if(!o)return!1;let r=Number(o);if(`${r}`!==o)return!1;if(r<0||r>128)return!1;return ya(n)}var Sa=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ps),U.init(e,t),e._zod.check=(n)=>{if(!Jp(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function _a(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var co=/^[0-9a-zA-Z+/]*={0,2}$/,va=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=co),U.init(e,t),e._zod.check=(n)=>{if(_a(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Qt=/^[A-Za-z0-9_-]*$/;function Yp(e){if(!Qt.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return _a(n)}var Ta=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qt),U.init(e,t),e._zod.check=(n)=>{if(Yp(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ca=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hs),U.init(e,t)});function Xp(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[o]=n;if(!o)return!1;let r=JSON.parse(atob(o));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var ka=h("$ZodJWT",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{if(Xp(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var uo=h("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=xt,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?String(r):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),Ea=h("$ZodNumberFormat",(e,t)=>{Es.init(e,t),uo.init(e,t)}),Ra=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=vs,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});var Aa=h("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=(n)=>n}),Ia=h("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),wa=h("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),Pa=h("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let r=n.value,i=r instanceof Date;if(i&&!Number.isNaN(r.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Us(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}var Ma=h("$ZodArray",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(o,r)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),o;o.value=n?n.alloc(e,o,Array(i.length),r):Array(i.length);let s=[],a=r?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],d=t.element._zod.run({value:l,issues:[]},r);if(d instanceof Promise)s.push(d.then((p)=>Us(p,o,c)));else if(Us(d,o,c),a&&d.issues.length!==0&&re(d))break}if(s.length)return Promise.all(s).then(()=>o);return o}});function Yt(e,t,n,o,r,i){let s=n in o,a=i==="optional";if(!s&&a&&r==="optional")return;if(e.issues.length){if(r!==void 0&&a&&!s)return;t.issues.push(...de(n,e.issues))}if(!s&&r===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(s||r==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var Qp=[];function Oa(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),o=n.length?n:Qp,r=o.length?[...t,...o]:t;for(let s of r)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=wi(e.shape);return{...e,allKeys:r,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function za(e,t,n,o,r,i,s){let a=[],c=r.keySet,l=r.catchall._zod,d=l.def.type,{optin:p,optout:m}=l,f=0;for(let g in t){if(s&&n.issues.length!==f){if(re(n,f))break;f=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){if(d==="never")a.push(g);continue}if(d==="never"){a.push(g);continue}let y=l.run({value:t[g],issues:[]},o);if(y instanceof Promise)e.push(y.then((S)=>Yt(S,n,g,t,p,m)));else Yt(y,n,g,t,p,m)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var em=h("$ZodObject",(e,t)=>{z.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),o=n?.get?n.get.raw:t.shape??{};if(o){let l=()=>{let d={...o};return Object.defineProperty(t,"shape",{value:d}),l.raw=d,d};l.raw=o,Object.defineProperty(t,"shape",{get:l})}let r=ft(()=>Oa(t));P(e,"propValues",(l)=>{let d=l.def.shape,p={};for(let m in d){let f=d[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(p,m))te(p,m,new Set);for(let g of f.values)p[m].add(g);if(f.optin!==void 0)p[m].add(void 0)}}return p});let i=Ue,s=t.catchall,a,c=Y.memoizer;c?.attach(e),e._zod.parse=(l,d)=>{a??(a=r.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=c?c.alloc(e,l,{},d):{};let m=[],f=a.shape,g=d?.abortEarly,y=l.issues.length;for(let S of a.allKeys){if(g&&l.issues.length!==y){if(re(l,y))break;y=l.issues.length}if(S==="__proto__")continue;let v=f[S],k=v._zod.optin,M=v._zod.optout,R=v._zod.run({value:p[S],issues:[]},d);if(R instanceof Promise)m.push(R.then((B)=>Yt(B,l,S,p,k,M)));else Yt(R,l,S,p,k,M)}if(!s)return m.length?Promise.all(m).then(()=>l):l;return za(m,p,l,d,r.value,e,g===!0)}}),Na=h("$ZodObjectJIT",(e,t)=>{em.init(e,t);let n=e._zod.parse,o=ft(()=>Oa(t)),r=Y.memoizer,i=(f)=>{let g=o.value,y=g.symbolKeys,S=new io(["payload","ctx"],{shape:f,inst:e,memo:r,syms:y}),v=(B)=>`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`,k=(B,A)=>`
|
|
6
|
+
};`)(...Object.values(this.closed))}}var Bs={major:4,minor:6,patch:7};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Bs;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=oe(a),p;for(let m of c){if(m._zod.def.when){if(zi(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new me;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await g,a.issues.length===f)return;if(Ft(a.issues,f,e),!l)l=oe(a,f)});else{if(a.issues.length===f)continue;if(Ft(a.issues,f,e),!l)l=oe(a,f)}}if(p)return p.then(()=>a);return a},s=(a,c,u)=>{if(oe(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new me;return l.then((p)=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((p)=>s(p,a,c));return s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new me;return u.then((l)=>i(l,o,c))}return i(u,o,c)}}},{get "~standard"(){return Vt(this,"~standard",cr(this))},set "~standard"(e){xe(this,"~standard",e)}}),Qs=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>pe(n,t,Q()))}:{value:e.value};async function Kp(e,t){let n={async:!0};return Qs(await e._zod.run({value:t,issues:[]},n),n)}function cr(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Qs(r,n)}catch(r){}return Kp(e,t)},vendor:"zod",version:1}}var Qt=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??vs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),U=h("$ZodStringFormat",(e,t)=>{St.init(e,t),Qt.init(e,t)}),ea=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=as),U.init(e,t)}),ta=h("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tr(r))}else t.pattern??(t.pattern=tr());U.init(e,t)}),na=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cs),U.init(e,t)}),ra=1,Yt=2;function oa(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Wp(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return oa(e)||Yt;return Jp(e,t)}function Jp(e,t){if(!t.normalize&&t.protocol?.source===hs.source&&!/^https?:\/\//i.test(e))return ra;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Yt}return new URL(e)}catch{return Yt}}var Yp=/[\t\n\r]/g;function Us(e){return e.replace(Yp,"")}function Xp(e,t){return t.lastIndex=0,t.test(e.hostname)}function Qp(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ia=h("$ZodURL",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=Wp(r,t);if(o===ra){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Yt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Us(r);return}if(t.hostname&&!Xp(o,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!Qp(o,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?o.href:Us(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),sa=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=us()),U.init(e,t)}),aa=h("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?os:is(t.length)),U.init(e,t)}),ca=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qi),U.init(e,t)}),ua=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=es),U.init(e,t)}),la=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ts),U.init(e,t)}),da=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ns),U.init(e,t)}),pa=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=rs),U.init(e,t)}),ma=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_s(t)),U.init(e,t)}),fa=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xs),U.init(e,t)}),ga=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ss(t)),U.init(e,t)}),ha=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ss),U.init(e,t)}),ya=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ls),U.init(e,t)}),em=/^[0-9a-fA-F:.]+$/;function ba(e){if(!em.test(e))return!1;return oa(`http://[${e}]`)}var xa=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ds),U.init(e,t),e._zod.check=(n)=>{if(!ba(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var Sa=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ps),U.init(e,t)});function tm(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return ba(n)}var _a=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ms),U.init(e,t),e._zod.check=(n)=>{if(!tm(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function va(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ur=/^[0-9a-zA-Z+/]*={0,2}$/,Ta=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ur),U.init(e,t),e._zod.check=(n)=>{if(va(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),en=/^[A-Za-z0-9_-]*$/;function nm(e){if(!en.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return va(n)}var Ca=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=en),U.init(e,t),e._zod.check=(n)=>{if(nm(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ka=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ys),U.init(e,t)});function rm(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Ea=h("$ZodJWT",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{if(rm(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var lr=h("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let o=n.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Ra=h("$ZodNumberFormat",(e,t)=>{Rs.init(e,t),lr.init(e,t)}),Aa=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=Ts,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let o=n.value;if(typeof o==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}});var wa=h("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=(n)=>n}),Ia=h("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Pa=h("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),Ma=h("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let o=n.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function om(e,t){let n=Fn(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of Fn(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Ft(i.issues,l,e),i}}return o(i,s)}}var im=(e)=>Array.isArray(e)?e.length:-1;function Zs(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}var Oa=h("$ZodArray",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then((p)=>Zs(p,r,c)));else if(Zs(l,r,c),a&&l.issues.length!==0&&oe(l))break}if(s.length)return Promise.all(s).then(()=>r);return r},om(e,im)});function Xt(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...de(n,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var sm=[];function za(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:sm,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Pi(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Na(e,t,n,r,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:p,optout:m}=u,f=0;for(let g in t){if(s&&n.issues.length!==f){if(oe(n,f))break;f=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){if(l==="never")a.push(g);continue}if(l==="never"){a.push(g);continue}let y=u.run({value:t[g],issues:[]},r);if(y instanceof Promise)e.push(y.then((S)=>Xt(S,n,g,t,p,m)));else Xt(y,n,g,t,p,m)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var am=h("$ZodObject",(e,t)=>{z.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let u=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let o=ft(()=>za(t));P(e,"propValues",(u)=>{let l=u.def.shape,p={};for(let m in l){let f=l[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(p,m))te(p,m,new Set);for(let g of f.values)p[m].add(g);if(f.optin!==void 0)p[m].add(void 0)}}return p});let i=Ue,s=t.catchall,a,c=Y.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],f=a.shape,g=l?.abortEarly,y=u.issues.length;for(let S of a.allKeys){if(g&&u.issues.length!==y){if(oe(u,y))break;y=u.issues.length}if(S==="__proto__")continue;let v=f[S],k=v._zod.optin,M=v._zod.optout,R=v._zod.run({value:p[S],issues:[]},l);if(R instanceof Promise)m.push(R.then((B)=>Xt(B,u,S,p,k,M)));else Xt(R,u,S,p,k,M)}if(!s)return m.length?Promise.all(m).then(()=>u):u;return Na(m,p,u,l,o.value,e,g===!0)}}),$a=h("$ZodObjectJIT",(e,t)=>{am.init(e,t);let n=e._zod.parse,r=ft(()=>za(t)),o=Y.memoizer,i=(f)=>{let g=r.value,y=g.symbolKeys,S=new sr(["payload","ctx"],{shape:f,inst:e,memo:o,syms:y}),v=(B)=>`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`,k=(B,A)=>`
|
|
7
7
|
let ${B}_ab = false;
|
|
8
8
|
for (let i = 0; i < ${B}.issues.length; i++) {
|
|
9
9
|
const iss = ${B}.issues[i];
|
|
@@ -14,7 +14,7 @@ ${t.join(`
|
|
|
14
14
|
if (${B}_ab && ctx && ctx.abortEarly) {
|
|
15
15
|
payload.value = newResult;
|
|
16
16
|
return payload;
|
|
17
|
-
}`;S.write("const input = payload.value;");let M=Object.create(null),R=0;for(let B of g.allKeys)M[B]=`key_${R++}`;S.write(
|
|
17
|
+
}`;S.write("const input = payload.value;");let M=Object.create(null),R=0;for(let B of g.allKeys)M[B]=`key_${R++}`;S.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let B of g.allKeys){if(B==="__proto__")continue;let A=M[B],J=typeof B==="symbol"?`syms[${y.indexOf(B)}]`:Ri(B),Te=`${J} in input`,Me=f[B],ct=Me?._zod?.optin,ut=ct!==void 0,zn=Me?._zod?.optout==="optional";if(S.write(`const ${A} = ${v(J)};`),ut&&zn){let lt=ct==="optional"?`${A}_present`:`${A}.value !== undefined || ${A}_present`;S.write(`
|
|
18
18
|
const ${A}_present = ${Te};
|
|
19
19
|
if (!${A}.issues.length || ${A}_present) {
|
|
20
20
|
if (${A}.issues.length) {${k(A,J)}
|
|
@@ -53,21 +53,21 @@ ${t.join(`
|
|
|
53
53
|
if (${A}.value !== undefined || ${Te}) {
|
|
54
54
|
newResult[${J}] = ${A}.value;
|
|
55
55
|
}
|
|
56
|
-
`)}return S.write("payload.value = newResult;"),S.write("return payload;"),S.compile()},s,a=Ue,c=!Y.jitless,d=c&&Ai.value,p=t.catchall,m;e._zod.parse=(f,g)=>{m??(m=o.value);let y=f.value;if(!a(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f;if(c&&d&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(f=s(f,g),!p)return f;return za([],y,f,g,m,e,g?.abortEarly===!0)}return n(f,g)}});function Zs(e,t,n,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let r=e.filter((i)=>!re(i));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>pe(s,o,Q())))}),t}var lo=h("$ZodUnion",(e,t)=>{z.init(e,t),P(e,"optin",(o)=>o.def.options.some((r)=>r._zod.optin==="defaulted")?"defaulted":o.def.options.some((r)=>r._zod.optin!==void 0)?"optional":void 0),P(e,"optout",(o)=>o.def.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),P(e,"values",(o)=>{if(o.def.options.every((r)=>r._zod.values))return new Set(o.def.options.flatMap((r)=>Array.from(r._zod.values)));return}),P(e,"pattern",(o)=>{if(o.def.options.every((r)=>r._zod.pattern)){let r=o.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${r.map((i)=>Bt(i.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,r)=>{if(n)return n(o,r);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},r);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return Zs(s,o,e,r);return Promise.all(s).then((a)=>Zs(a,o,e,r))}});function tm(e){let t=new Map;for(let n of e.options){let o=n._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let r of o)if(t.has(r)){if(r!==void 0)throw Error(`Duplicate discriminator value "${String(r)}"`);t.set(r,null)}else t.set(r,n)}return t}var $a=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lo.init(e,t);let n=e._zod.parse;P(e,"propValues",(r)=>{let i={},s=0;for(let a of r.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${r.def.options.indexOf(a)}"`);if(c[r.def.discriminator]?.has(void 0))s++;for(let[l,d]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))te(i,l,new Set);for(let p of d)i[l].add(p)}}if(!r.def.unionFallback&&s>1)i[r.def.discriminator]?.delete(void 0);return i}),t.options.forEach((r,i)=>{let s=gt(r._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let o=ft(()=>tm(t));e._zod.parse=(r,i)=>{let s=r.value;if(!Ue(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;let a=s?.[t.discriminator],c=o.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(r,i);if(t.unionFallback||i.direction==="backward")return n(r,i);return r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter((l)=>o.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),r}}),La=h("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value,i=t.left._zod.run({value:r,issues:[]},o),s=t.right._zod.run({value:r,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>Fs(n,c,l));return Fs(n,i,s)}});function so(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ze(e)&&ze(t)){let n=Object.keys(t),o=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),r={...e,...t};if(Object.prototype.hasOwnProperty.call(r,"__proto__"))delete r.__proto__;for(let i of o){if(i==="__proto__")continue;let s=so(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t[o],s=so(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Fs(e,t,n){let o=new Map,r,i=new Map,s=(l,d)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)r??(r=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let m=String(l.path[0]);if(!i.has(m))i.set(m,l);p=[m]}else return!1;for(let m of p){if(!o.has(m))o.set(m,{});o.get(m)[d]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of n.issues)if(!s(l,"r"))e.issues.push(l);let a=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=r?a.filter((d)=>r.keys.includes(d)):[];if(l.length)e.issues.push({...r,keys:l});for(let d of a)if(!l.includes(d)&&i.has(d))e.issues.push(i.get(d))}let c=so(t.value,n.value);if(!c.valid){if(re(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var po=h("$ZodTuple",(e,t)=>{z.init(e,t);let n=t.items,o=Y.memoizer;o?.attach(e),e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=o?o.alloc(e,r,[],i):[];let a=[],c=Hs(n,"optin"),l=Hs(n,"optout");if(!t.rest){if(s.length<c)return r.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),r;if(s.length>n.length)r.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let d=Array(n.length),p=t.rest?i?.abortEarly:void 0,m=!1;for(let f=0;f<n.length;f++){let g=n[f]._zod.run({value:s[f],issues:[]},i);if(g instanceof Promise)a.push(g.then((y)=>{d[f]=y}));else if(d[f]=g,p&&!m&&g.issues.length)m=re(g)}if(t.rest&&!m){let f=n.length-1,g=s.slice(n.length),y=r.issues.length;for(let S of g){if(p&&r.issues.length!==y){if(re(r,y))break;y=r.issues.length}f++;let v=t.rest._zod.run({value:S,issues:[]},i);if(v instanceof Promise)a.push(v.then((k)=>js(k,r,f)));else js(v,r,f)}}if(a.length)return Promise.all(a).then(()=>Vs(d,r,n,s,l));return Vs(d,r,n,s,l)}});function Hs(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function js(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}function Vs(e,t,n,o,r){for(let i=0;i<n.length;i++){let s=e[i],a=i<o.length;if(!a&&i>=r&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=r){t.value.length=i;break}t.issues.push(...de(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=o.length;i--)if(n[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var Da=h("$ZodRecord",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(o,r)=>{let i=o.value;if(!ze(i))return o.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),o;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){o.value=n?n.alloc(e,o,{},r):{};let c=new Set;for(let d of a)if(typeof d==="string"||typeof d==="number"||typeof d==="symbol"){if(c.add(typeof d==="number"?d.toString():d),d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},r);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((g)=>pe(g,r,Q())),input:d,path:[d],inst:e});continue}let m=p.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[d],issues:[]},r);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)o.issues.push(...de(d,g.issues));o.value[m]=g.value}));else{if(f.issues.length)o.issues.push(...de(d,f.issues));o.value[m]=f.value}}let l;for(let d in i)if(!c.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;o.value[d]=i[d]}else l=l??[],l.push(d);if(l&&l.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{o.value=n?n.alloc(e,o,{},r):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let d=t.keyType._zod.run({value:l,issues:[]},r);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&xt.test(l)&&d.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},r);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)d=g}if(d.issues.length){if(t.mode==="loose")o.value[l]=i[l];else if(a)c=c??[],c.push(l);else o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>pe(g,r,Q())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},r);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)o.issues.push(...de(l,g.issues));o.value[m]=g.value}));else{if(f.issues.length)o.issues.push(...de(l,f.issues));o.value[m]=f.value}}if(c&&c.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>o);return o}});var Ba=h("$ZodEnum",(e,t)=>{z.init(e,t);let n=pt(t.entries),o=new Set(n);e._zod.values=o,P(e,"pattern",(r)=>{let i=pt(r.def.entries).filter((s)=>Ii.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Ee(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{let s=r.value;if(o.has(s))return r;return r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Ua=h("$ZodLiteral",(e,t)=>{z.init(e,t);let n=new Set(t.values);e._zod.values=n,P(e,"pattern",(o)=>{let r=o.def.values;return new RegExp(r.length?`^(${r.map((i)=>typeof i==="string"?Ee(i):i?Ee(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,r)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}});var Za=h("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",Y.memoizer?.guard(e),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ht(e.constructor.name);let r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then((s)=>(n.value=s,n));if(r instanceof Promise)throw new me;return n.value=r,n}});function qs(e,t){return e.value=t.issues.length?void 0:t.value,e}var mo=h("$ZodOptional",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",P(e,"values",(n)=>{let o=n.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),P(e,"pattern",(n)=>{let o=n.def.innerType._zod.pattern;return o?new RegExp(`^(${Bt(o.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let r=t.innerType._zod.run({value:n.value,issues:[]},o);if(r instanceof Promise)return r.then((i)=>qs(n,i));return qs(n,r)}return t.innerType._zod.run(n,o)}}),Fa=h("$ZodExactOptional",(e,t)=>{mo.init(e,t),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),Ha=h("$ZodNullable",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(e,"pattern",(n)=>{let o=n.def.innerType._zod.pattern;return o?new RegExp(`^(${Bt(o.source)}|null)$`):void 0}),P(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>{if(n.value===null)return n;return t.innerType._zod.run(n,o)}}),ja=h("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Gs(i,t));return Gs(r,t)}});function Gs(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Va=h("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,o)}}),qa=h("$ZodNonOptional",(e,t)=>{z.init(e,t),P(e,"values",(n)=>{let o=n.def.innerType._zod.values;return o?new Set([...o].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(n,o)=>{let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Ks(i,e));return Ks(r,e)}});function Ks(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Ws(e,t,n,o){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((r)=>pe(r,o,Q()))},input:e.value}),e}var Ga=h("$ZodCatch",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run({value:n.value,issues:[]},o);if(r instanceof Promise)return r.then((i)=>Ws(n,i,t,o));return Ws(n,r,t,o)}});var fo=h("$ZodPipe",(e,t)=>{z.init(e,t),P(e,"values",(n)=>n.def.in._zod.values),P(e,"optin",(n)=>n.def.in._zod.optin),P(e,"optout",(n)=>n.def.out._zod.optout),P(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>Wt(s,t.in,o));return Wt(i,t.in,o)}let r=t.in._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Wt(i,t.out,o));return Wt(r,t.out,o)}});function Wt(e,t,n){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var Ka=h("$ZodPreprocess",(e,t)=>{fo.init(e,t)}),Wa=h("$ZodReadonly",(e,t)=>{z.init(e,t),P(e,"propValues",(n)=>n.def.innerType._zod.propValues),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"optin",(n)=>n.def.innerType?._zod?.optin),P(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then(Js);return Js(r)}});function Js(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ja=h("$ZodFunction",(e,t)=>(z.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...o){let r=e._def.input?Wn(e._def.input,o):o,i=Reflect.apply(n,this,r);if(e._def.output)return Wn(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...o){let r=e._def.input?await Jn(e._def.input,o):o,i=await Reflect.apply(n,this,r);if(e._def.output)return await Jn(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,o)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let o=e.constructor;if(Array.isArray(n[0]))return new o({type:"function",input:new po({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new o({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),Ya=h("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>Promise.resolve(n.value).then((r)=>t.innerType._zod.run({value:r,issues:[]},o))});var Xa=h("$ZodCustom",(e,t)=>{G.init(e,t),z.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=(n)=>{let o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((i)=>Ys(i,n,o,e));Ys(r,n,o,e);return}});function Ys(e,t,n,o){if(!e){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)r.params=o._zod.def.params;t.issues.push(Ne(r))}}class ec extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ho="~memo",Qa=[];function tc(e){return e!==null&&typeof e==="object"}function go(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var nc=new WeakMap,_t=0,nn=1,vt=2;function on(e,t,n){let o=nc.get(e);if(o!==void 0)return o?vt:_t;if(t.has(e))return vt;t.add(e);let r=_t,i=(d)=>{if(r!==vt&&d?._zod){let p=on(d,t,n);if(p>r)r=p}},s=(d,p)=>{let m=_t;for(let f of Reflect.ownKeys(d)){let g=Object.getOwnPropertyDescriptor(d,f);if(p&&!g.enumerable)continue;let y=g.get?nn:g.value?._zod?on(g.value,t,n):_t;if(y>m)m=y}return m},a=(d)=>{if(d>r)r=d},c=e._zod.def,l=c.type;switch(l){case"object":{let d=gt(c);a(d?s(d,!0):nn),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let d of c.items)i(d);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let d of c.options)i(d);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let d=c._cachedInner??(n?e._zod.innerType:void 0);a(d?on(d,t,!1):nn);break}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":break;default:for(let d in c){let p=Object.getOwnPropertyDescriptor(c,d);if(!p||p.get)continue;let m=p.value;if(!m||typeof m!=="object")continue;if(m._zod)i(m);else if(Array.isArray(m))for(let f of m)i(f)}}return t.delete(e),nm(e,r)}function nm(e,t){if(t!==nn)nc.set(e,t===vt);return t}function om(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var en,tn=[],rm={alloc(e,t,n){let o=en;if(!o)return n;en=void 0;let r={value:n,issues:null};return o.set(t.value,r),tn.push(r),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,o=(r,i)=>{if(i.direction!=="backward"&&im(i,r.value))throw new ec;return n(r,i)};if(e._zod.parse=o,e._zod.run===n)e._zod.run=o})},attach(e){var t;let n,o=!1,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(n===void 0){let v=on(e,new Set,!1);if(v===_t){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(v===vt||o)n=!0;else o=!0}let d=c.value;if(!tc(d))return s(c,l);let p=l[ho];if(!p)p={buckets:new WeakMap,backEdges:void 0},l[ho]=p;let m;if(r===l)m=i;else m=om(p,e),r=l,i=m;let f=m.get(d);if(f){if(c.value=f.value,f.issues){if(f.issues.length)c.issues.push(...go(f.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value);return c}en=m;let g=tn.length,y=s(c,l);en=void 0;let S=tn.length>g?tn.pop():void 0;if(y instanceof Promise)return y.then((v)=>{if(S)S.issues=v.issues.length?go(v.issues):Qa;return v});if(S)S.issues=y.issues.length?go(y.issues):Qa;return y};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function yo(){return rm}function im(e,t){let n=e[ho]?.backEdges;return n!==void 0&&tc(t)&&n.has(t)}var sm=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function r(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=r(i.expected),a=zi(i.input),c=r(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Bn(i.values[0])}`;return`Invalid option: expected one of ${$n(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${$n(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function bo(){return{localeError:sm()}}var oc;class rc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function ic(){return new rc}(oc=globalThis).__zod_globalRegistry??(oc.__zod_globalRegistry=ic());var Re=globalThis.__zod_globalRegistry;function sc(e){if(e.checks)e.checks=[...e.checks];return e}function ac(e,t){return new e(sc({type:"string",..._(t)}))}function cc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function uc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function lc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function fc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function gc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function hc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function yc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function bc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function xc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Sc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function _c(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function vc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Tc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Cc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function kc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Rc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Ac(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Ic(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function wc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Pc(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Mc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Oc(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function zc(e,t){return new e(sc({type:"number",checks:[],..._(t)}))}function Nc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function $c(e,t){return new e({type:"boolean",..._(t)})}function Lc(e){return new e({type:"unknown"})}function Dc(e,t){return new e({type:"never",..._(t)})}function Bc(e,t){return new e({type:"void",..._(t)})}function Uc(e,t){return new e({type:"date",..._(t)})}function rn(e,t){return new oo({check:"less_than",..._(t),value:e,inclusive:!1})}function Fe(e,t){return new oo({check:"less_than",..._(t),value:e,inclusive:!0})}function sn(e,t){return new ro({check:"greater_than",..._(t),value:e,inclusive:!1})}function He(e,t){return new ro({check:"greater_than",..._(t),value:e,inclusive:!0})}function an(e,t){return new ks({check:"multiple_of",..._(t),value:e})}function cn(e,t){return new Rs({check:"max_length",..._(t),maximum:e})}function je(e,t){return new As({check:"min_length",..._(t),minimum:e})}function un(e,t){return new Is({check:"length_equals",..._(t),length:e})}function xo(e,t){return new ws({check:"string_format",format:"regex",..._(t),pattern:e})}function So(e){return new Ps({check:"string_format",format:"lowercase",..._(e)})}function _o(e){return new Ms({check:"string_format",format:"uppercase",..._(e)})}function vo(e,t){return new Os({check:"string_format",format:"includes",..._(t),includes:e})}function To(e,t){return new zs({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Co(e,t){return new Ns({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Ae(e){return new $s({check:"overwrite",tx:e})}function ko(e){return Ae((t)=>t.normalize(e))}function Eo(){return Ae((e)=>e.trim())}function Ro(){return Ae((e)=>e.toLowerCase())}function Ao(){return Ae((e)=>e.toUpperCase())}function Io(){return Ae((e)=>Ri(e))}function Zc(e,t,n){return new e({type:"array",element:t,..._(n)})}function Fc(e,t,n){let o=_(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Hc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function jc(e,t){let n=am((o)=>(o.addIssue=(r)=>{if(typeof r==="string")o.issues.push(Ne(r,o.value,n._zod.def));else{let i=r;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=o.value;i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),o.issues.push(Ne(i))}},e(o.value,o)),t);return n}function am(e,t){let n=new G({check:"custom",..._(t)});return n._zod.check=e,n}function Tt(e,...t){for(let n of t)for(let o of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,o))te(e,o,n[o]);return e}function kt(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Re,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 q(e,t,n,o,r){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:r}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(r);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var o;let r=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,n.schemaPath.includes(e))i.cycle=n.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let m=s.schema,f=t.processors[r.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);f(e,t,m,d)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,d),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Tt(s.schema,c);if(t.io==="input"&&X(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Vc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Et(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=o.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let r=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??((g)=>g);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${Vc(f)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+Vc(d)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=r(s);if(a.def={...a.schema},l)a.defId=l;let d=a.schema;for(let p in d)delete d[p];d.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
56
|
+
`)}return S.write("payload.value = newResult;"),S.write("return payload;"),S.compile()},s,a=Ue,c=!Y.jitless,l=c&&wi.value,p=t.catchall,m;e._zod.parse=(f,g)=>{m??(m=r.value);let y=f.value;if(!a(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f;if(c&&l&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(f=s(f,g),!p)return f;return Na([],y,f,g,m,e,g?.abortEarly===!0)}return n(f,g)}});function Fs(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!oe(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>pe(s,r,Q())))}),t}var dr=h("$ZodUnion",(e,t)=>{z.init(e,t),P(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),P(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),P(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),P(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Bt(i.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return Fs(s,r,e,o);return Promise.all(s).then((a)=>Fs(a,r,e,o))}});function cm(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var La=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,dr.init(e,t);let n=e._zod.parse;P(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,u))te(i,u,new Set);for(let p of l)i[u].add(p)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=gt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=ft(()=>cm(t));e._zod.parse=(o,i)=>{let s=o.value;if(!Ue(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return n(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((u)=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o}}),Da=h("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>Hs(n,c,u));return Hs(n,i,s)}});function ar(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ze(e)&&ze(t)){let n=Object.keys(t),r=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=ar(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=ar(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Hs(e,t,n){let r=new Map,o,i=new Map,s=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!i.has(m))i.set(m,u);p=[m]}else return!1;for(let m of p){if(!r.has(m))r.set(m,{});r.get(m)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of n.issues)if(!s(u,"r"))e.issues.push(u);let a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of a)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let c=ar(t.value,n.value);if(!c.valid){if(oe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var pr=h("$ZodTuple",(e,t)=>{z.init(e,t);let n=t.items,r=Y.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=js(n,"optin"),u=js(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>n.length)o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=Array(n.length),p=t.rest?i?.abortEarly:void 0,m=!1;for(let f=0;f<n.length;f++){let g=n[f]._zod.run({value:s[f],issues:[]},i);if(g instanceof Promise)a.push(g.then((y)=>{l[f]=y}));else if(l[f]=g,p&&!m&&g.issues.length)m=oe(g)}if(t.rest&&!m){let f=n.length-1,g=s.slice(n.length),y=o.issues.length;for(let S of g){if(p&&o.issues.length!==y){if(oe(o,y))break;y=o.issues.length}f++;let v=t.rest._zod.run({value:S,issues:[]},i);if(v instanceof Promise)a.push(v.then((k)=>Vs(k,o,f)));else Vs(v,o,f)}}if(a.length)return Promise.all(a).then(()=>qs(l,o,n,s,u));return qs(l,o,n,s,u)}});function js(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Vs(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}function qs(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...de(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length;i--)if(n[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var Ba=h("$ZodRecord",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!ze(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((g)=>pe(g,o,Q())),input:l,path:[l],inst:e});continue}let m=p.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)r.issues.push(...de(l,g.issues));r.value[m]=g.value}));else{if(f.issues.length)r.issues.push(...de(l,f.issues));r.value[m]=f.value}}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else u=u??[],u.push(l);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&xt.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)l=g}if(l.issues.length){if(t.mode==="loose")r.value[u]=i[u];else if(a)c=c??[],c.push(u);else r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((g)=>pe(g,o,Q())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[u],issues:[]},o);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)r.issues.push(...de(u,g.issues));r.value[m]=g.value}));else{if(f.issues.length)r.issues.push(...de(u,f.issues));r.value[m]=f.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}});var Ua=h("$ZodEnum",(e,t)=>{z.init(e,t);let n=pt(t.entries),r=new Set(n);e._zod.values=r,P(e,"pattern",(o)=>{let i=pt(o.def.entries).filter((s)=>Ii.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Ee(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),Za=h("$ZodLiteral",(e,t)=>{z.init(e,t);let n=new Set(t.values);e._zod.values=n,P(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?Ee(i):i?Ee(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(n.has(i))return r;return r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}});var Fa=h("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",Y.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ht(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(n.value=s,n));if(o instanceof Promise)throw new me;return n.value=o,n}});function Gs(e,t){return e.value=t.issues.length?void 0:t.value,e}var mr=h("$ZodOptional",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",P(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),P(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Bt(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>Gs(n,i));return Gs(n,o)}return t.innerType._zod.run(n,r)}}),Ha=h("$ZodExactOptional",(e,t)=>{mr.init(e,t),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ja=h("$ZodNullable",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Bt(r.source)}|null)$`):void 0}),P(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),Va=h("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>Ks(i,t));return Ks(o,t)}});function Ks(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var qa=h("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),Ga=h("$ZodNonOptional",(e,t)=>{z.init(e,t),P(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>Ws(i,e));return Ws(o,e)}});function Ws(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Js(e,t,n,r){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>pe(o,r,Q()))},input:e.value}),e}var Ka=h("$ZodCatch",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>Js(n,i,t,r));return Js(n,o,t,r)}});var fr=h("$ZodPipe",(e,t)=>{z.init(e,t),P(e,"values",(n)=>n.def.in._zod.values),P(e,"optin",(n)=>n.def.in._zod.optin),P(e,"optout",(n)=>n.def.out._zod.optout),P(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>Jt(s,t.in,r));return Jt(i,t.in,r)}let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>Jt(i,t.out,r));return Jt(o,t.out,r)}});function Jt(e,t,n){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var Wa=h("$ZodPreprocess",(e,t)=>{fr.init(e,t)}),Ja=h("$ZodReadonly",(e,t)=>{z.init(e,t),P(e,"propValues",(n)=>n.def.innerType._zod.propValues),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"optin",(n)=>n.def.innerType?._zod?.optin),P(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then(Ys);return Ys(o)}});function Ys(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ya=h("$ZodFunction",(e,t)=>(z.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Jn(e._def.input,r):r,i=Reflect.apply(n,this,o);if(e._def.output)return Jn(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Yn(e._def.input,r):r,i=await Reflect.apply(n,this,o);if(e._def.output)return await Yn(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let r=e.constructor;if(Array.isArray(n[0]))return new r({type:"function",input:new pr({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new r({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),Xa=h("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},r))});var Qa=h("$ZodCustom",(e,t)=>{G.init(e,t),z.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then((i)=>Xs(i,n,r,e));Xs(o,n,r,e);return}});function Xs(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;t.issues.push(Ne(o))}}class tc extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var hr="~memo",ec=[];function nc(e){return e!==null&&typeof e==="object"}function gr(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var rc=new WeakMap,_t=0,rn=1,vt=2;function on(e,t,n){let r=rc.get(e);if(r!==void 0)return r?vt:_t;if(t.has(e))return vt;t.add(e);let o=_t,i=(l)=>{if(o!==vt&&l?._zod){let p=on(l,t,n);if(p>o)o=p}},s=(l,p)=>{let m=_t;for(let f of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,f);if(p&&!g.enumerable)continue;let y=g.get?rn:g.value?._zod?on(g.value,t,n):_t;if(y>m)m=y}return m},a=(l)=>{if(l>o)o=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=gt(c);a(l?s(l,!0):rn),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?on(l,t,!1):rn);break}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":break;default:for(let l in c){let p=Object.getOwnPropertyDescriptor(c,l);if(!p||p.get)continue;let m=p.value;if(!m||typeof m!=="object")continue;if(m._zod)i(m);else if(Array.isArray(m))for(let f of m)i(f)}}return t.delete(e),um(e,o)}function um(e,t){if(t!==rn)rc.set(e,t===vt);return t}function lm(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var tn,nn=[],dm={alloc(e,t,n){let r=tn;if(!r)return n;tn=void 0;let o={value:n,issues:null};return r.set(t.value,o),nn.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&pm(i,o.value))throw new tc;return n(o,i)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(n===void 0){let v=on(e,new Set,!1);if(v===_t){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,u)}if(v===vt||r)n=!0;else r=!0}let l=c.value;if(!nc(l))return s(c,u);let p=u[hr];if(!p)p={buckets:new WeakMap,backEdges:void 0},u[hr]=p;let m;if(o===u)m=i;else m=lm(p,e),o=u,i=m;let f=m.get(l);if(f){if(c.value=f.value,f.issues){if(f.issues.length)c.issues.push(...gr(f.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value);return c}tn=m;let g=nn.length,y=s(c,u);tn=void 0;let S=nn.length>g?nn.pop():void 0;if(y instanceof Promise)return y.then((v)=>{if(S)S.issues=v.issues.length?gr(v.issues):ec;return v});if(S)S.issues=y.issues.length?gr(y.issues):ec;return y};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function yr(){return dm}function pm(e,t){let n=e[hr]?.backEdges;return n!==void 0&&nc(t)&&n.has(t)}var mm=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=Ni(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Un(i.values[0])}`;return`Invalid option: expected one of ${Ln(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Ln(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function br(){return{localeError:mm()}}var oc;class ic{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function sc(){return new ic}(oc=globalThis).__zod_globalRegistry??(oc.__zod_globalRegistry=sc());var Re=globalThis.__zod_globalRegistry;function ac(e){if(e.checks)e.checks=[...e.checks];return e}function cc(e,t){return new e(ac({type:"string",..._(t)}))}function uc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function lc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function gc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function hc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function yc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function bc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function xc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Sc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function _c(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function vc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Tc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Cc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function kc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Ec(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Rc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Ac(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function wc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Ic(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function Pc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Mc(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Oc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function zc(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Nc(e,t){return new e(ac({type:"number",checks:[],..._(t)}))}function $c(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Lc(e,t){return new e({type:"boolean",..._(t)})}function Dc(e){return new e({type:"unknown"})}function Bc(e,t){return new e({type:"never",..._(t)})}function Uc(e,t){return new e({type:"void",..._(t)})}function Zc(e,t){return new e({type:"date",..._(t)})}function sn(e,t){return new or({check:"less_than",..._(t),value:e,inclusive:!1})}function Fe(e,t){return new or({check:"less_than",..._(t),value:e,inclusive:!0})}function an(e,t){return new ir({check:"greater_than",..._(t),value:e,inclusive:!1})}function He(e,t){return new ir({check:"greater_than",..._(t),value:e,inclusive:!0})}function cn(e,t){return new Es({check:"multiple_of",..._(t),value:e})}function un(e,t){return new As({check:"max_length",..._(t),maximum:e})}function je(e,t){return new ws({check:"min_length",..._(t),minimum:e})}function ln(e,t){return new Is({check:"length_equals",..._(t),length:e})}function xr(e,t){return new Ps({check:"string_format",format:"regex",..._(t),pattern:e})}function Sr(e){return new Ms({check:"string_format",format:"lowercase",..._(e)})}function _r(e){return new Os({check:"string_format",format:"uppercase",..._(e)})}function vr(e,t){return new zs({check:"string_format",format:"includes",..._(t),includes:e})}function Tr(e,t){return new Ns({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Cr(e,t){return new $s({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Ae(e){return new Ls({check:"overwrite",tx:e})}function kr(e){return Ae((t)=>t.normalize(e))}function Er(){return Ae((e)=>e.trim())}function Rr(){return Ae((e)=>e.toLowerCase())}function Ar(){return Ae((e)=>e.toUpperCase())}function wr(){return Ae((e)=>Ai(e))}function Fc(e,t,n){return new e({type:"array",element:t,..._(n)})}function Hc(e,t,n){let r=_(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function jc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function Vc(e,t){let n=fm((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Ne(o,r.value,n._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Ne(i))}},e(r.value,r)),t);return n}function fm(e,t){let n=new G({check:"custom",..._(t)});return n._zod.check=e,n}function Tt(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))te(e,r,n[r]);return e}function kt(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Re,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 q(e,t,n,r,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,n.schemaPath.includes(e))i.cycle=n.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,f=t.processors[o.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,l),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Tt(s.schema,c);if(t.io==="input"&&X(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function qc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Et(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??((g)=>g);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${qc(f)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+qc(l)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
57
57
|
|
|
58
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Kc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let o of t){if(!o||typeof o!=="object")return;Kc(o);let r=Object.keys(o);if(r.length!==1||r[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!n.includes(s))n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Wc=new Set(["type","properties","required","additionalProperties"]),qc=["oneOf","anyOf"];function Gc(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function wo(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Wc.has(s))return null;t.push(i)}let n={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let l of t){let d=l.properties?.[s]??Gc(l);if(d===null||d===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(d)))a.push(d)}let c=a.length===1?a[0]:wo(a)??{allOf:a};te(n,s,c)}for(let s of i.required??[])o.add(s)}let r={type:"object",properties:n};if(o.size)r.required=[...o];if(t.every((i)=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let s of t){let a=Gc(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)r.additionalProperties=i[0];else if(i.length>1)r.additionalProperties={allOf:i}}return r}function cm(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of Wc)if(r in e)return;let n=t.filter((r)=>qc.some((i)=>Array.isArray(r[i]))),o=null;if(!n.length)o=wo(t);else{let r=n[0],i=qc.find((c)=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let s=t.filter((c)=>c!==r),a=r[i].map((c)=>wo([...s,c]));if(a.some((c)=>!c))return;o={[i]:a}}if(!o)return;delete e.allOf,Tt(e,o)}function Rt(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,d={...l},p=c.ref;if(c.ref=null,p){o(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(g);else Tt(l,g);if(Tt(l,d),a._zod.parent===p)for(let S in l){if(S==="$ref"||S==="allOf")continue;if(!(S in d))delete l[S]}if(g.$ref&&f.def)for(let S in l){if(S==="$ref"||S==="allOf")continue;if(S in f.def&&JSON.stringify(l[S])===JSON.stringify(f.def[S]))delete l[S]}}let m=a._zod.parent;if(m&&m!==p){o(m);let f=e.seen.get(m);if(f?.schema.$ref){if(l.$ref=f.schema.$ref,f.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g]))delete l[g]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())o(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Kc(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let d=l?.allOf;if(!Array.isArray(d))continue;let p=a.get(d);if(p)p.push(l);else a.set(d,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])cm(l)}}let r={};if(e.target==="draft-2020-12")r.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")r.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")r.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Tt(r,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&r.id===i)delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;te(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")r.$defs=s;else r.definitions=s;try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ct(t,"input",e.processors),output:Ct(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function X(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return X(o.element,n);if(o.type==="set")return X(o.valueType,n);if(o.type==="lazy")return X(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return X(o.innerType,n);if(o.type==="intersection")return X(o.left,n)||X(o.right,n);if(o.type==="record"||o.type==="map")return X(o.keyType,n)||X(o.valueType,n);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return X(o.in,n)||X(o.out,n)}if(o.type==="object"){for(let r in o.shape)if(X(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(let r of o.options)if(X(r,n))return!0;return!1}if(o.type==="tuple"){for(let r of o.items)if(X(r,n))return!0;if(o.rest&&X(o.rest,n))return!0;return!1}return!1}var Jc=(e,t={})=>(n)=>{let o=kt({...n,processors:t});return D(e,o),Et(o,e),Rt(o,e)},Ct=(e,t,n={})=>(o)=>{let{libraryOptions:r,target:i}=o??{},s=kt({...r??{},target:i,io:t,processors:n});return D(e,s),Et(s,e),Rt(s,e)};var Ve=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},qe=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Yc=(e,t)=>{Ve(e,"minimum",t),qe(e,"maximum",t)},nu=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ou=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ru=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},iu=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Xc=(e,t)=>Ve(e,"minimum",t.minimum),Qc=(e,t)=>qe(e,"maximum",t.maximum),eu=(e)=>(t,n)=>{iu(t,n.format);let[o,r]=e[n.format];Ve(t,"minimum",o),qe(t,"maximum",r)},um={greater_than:(e,t)=>Ve(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>qe(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>nu(e,t.value),number_format:eu(Ut),bigint_format:eu(Un),min_length:Xc,max_length:Qc,length_equals:(e,t)=>Yc(e,t.length),min_size:Xc,max_size:Qc,size_equals:(e,t)=>Yc(e,t.size),string_format:(e,t)=>{if(iu(e,t.format),t.pattern)ou(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>ru(e,t.mime)};function W(e){let t={},n=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of o)um[i._zod.def.check]?.(t,i._zod.def);let r=e._zod.bag;if(r.minimum!==void 0)Ve(t,"minimum",r.minimum);if(r.exclusiveMinimum!==void 0)Ve(t,"exclusiveMinimum",r.exclusiveMinimum);if(r.maximum!==void 0)qe(t,"maximum",r.maximum);if(r.exclusiveMaximum!==void 0)qe(t,"exclusiveMaximum",r.exclusiveMaximum);if(r.multipleOf!==void 0)nu(t,r.multipleOf);if(r.format!==void 0){if(t.format??(t.format=r.format),r.format.includes("int"))t.isInt=!0}if(r.mime)ru(t,r.mime);for(let i of r.patterns??[])ou(t,i);return t}var lm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dm=new Map([[co,ms],[Qt,fs]]),su=(e)=>dm.get(e)??e,Oo=(e,t,n,o)=>{let r=n;r.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:d}=W(e);if(typeof i==="number")r.minLength=i;if(typeof s==="number")r.maxLength=s;if(a){if(r.format=lm[a]??a,r.format==="")delete r.format;if(a==="time"||d)delete r.format}if(l)r.contentEncoding=l;if(c&&c.size>0){let p=[...c].map(su);if(p.length===1)r.pattern=p[0].source;else if(p.length>1)r.allOf=[...p.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},zo=(e,t,n,o)=>{let r=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:d}=W(e);r.type=d?"integer":"number";let p=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),m=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(f)r.minimum=l,r.exclusiveMinimum=!0;else r.exclusiveMinimum=l;else if(typeof i==="number")r.minimum=i;if(m)if(f)r.maximum=c,r.exclusiveMaximum=!0;else r.exclusiveMaximum=c;else if(typeof s==="number")r.maximum=s;if(a){let g=new Set;for(let v of a)if(Number.isFinite(v)&&v!==0)g.add(Math.abs(v));else q(e,t,r,o,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[y,...S]=g;if(y!==void 0)r.multipleOf=y;if(S.length)r.allOf=[...r.allOf??[],...S.map((v)=>({multipleOf:v}))]}},No=(e,t,n,o)=>{n.type="boolean"},au=(e,t,n,o)=>{q(e,t,n,o,"BigInt cannot be represented in JSON Schema")},cu=(e,t,n,o)=>{q(e,t,n,o,"Symbols cannot be represented in JSON Schema")},uu=(e,t,n,o)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},lu=(e,t,n,o)=>{q(e,t,n,o,"Undefined cannot be represented in JSON Schema")},$o=(e,t,n,o)=>{q(e,t,n,o,"Void cannot be represented in JSON Schema")},Lo=(e,t,n,o)=>{n.not={}},du=(e,t,n,o)=>{},Do=(e,t,n,o)=>{},Bo=(e,t,n,o)=>{q(e,t,n,o,"Date cannot be represented in JSON Schema")},Uo=(e,t,n,o)=>{let r=e._zod.def,i=pt(r.entries);if(i.length===0){n.not={};return}if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";n.enum=i},Zo=(e,t,n,o)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let i=[];for(let s of r.values)if(s===void 0){if(q(e,t,n,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(q(e,t,n,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[s];else n.const=s}else{if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";if(i.every((s)=>typeof s==="boolean"))n.type="boolean";if(i.every((s)=>s===null))n.type="null";n.enum=i}},pu=(e,t,n,o)=>{q(e,t,n,o,"NaN cannot be represented in JSON Schema")},mu=(e,t,n,o)=>{let r=n,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},fu=(e,t,n,o)=>{let r=n;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=W(e);if(i!==void 0)r.minLength=i;if(s!==void 0)r.maxLength=s;if(!a)return;if(a.length===0)r.not={};else if(a.length===1)r.contentMediaType=a[0];else r.anyOf=a.map((c)=>({contentMediaType:c}))},gu=(e,t,n,o)=>{n.type="boolean"},Fo=(e,t,n,o)=>{q(e,t,n,o,"Custom types cannot be represented in JSON Schema")},Ho=(e,t,n,o)=>{q(e,t,n,o,"Function types cannot be represented in JSON Schema")},jo=(e,t,n,o)=>{q(e,t,n,o,"Transforms cannot be represented in JSON Schema")},hu=(e,t,n,o)=>{q(e,t,n,o,"Map cannot be represented in JSON Schema")},yu=(e,t,n,o)=>{q(e,t,n,o,"Set cannot be represented in JSON Schema")},Vo=(e,t,n,o)=>{let r=n,i=e._zod.def,{minimum:s,maximum:a}=W(e);if(typeof s==="number")r.minItems=s;if(typeof a==="number")r.maxItems=a;r.type="array",r.items=D(i.element,t,{...o,path:[...o.path,"items"]})};function At(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return At(t.out);if(t.type==="catch")return At(t.innerType);return e._zod.optin}var qo=(e,t,n,o)=>{let r=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&q(e,t,r,o,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let l in s)te(r.properties,l,D(s[l],t,{...o,path:[...o.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let d=i.shape[l];if(t.io==="input"?At(d)===void 0:d._zod.optout===void 0)c.push(l)}if(c.length>0)r.required=c;if(i.catchall?._zod.def.type==="never")r.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")r.additionalProperties=!1}else if(i.catchall)r.additionalProperties=D(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Go=(e,t,n,o)=>{let r=e._zod.def,i=r.inclusive===!1,s=r.options.map((a,c)=>D(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));if(i)n.oneOf=s;else n.anyOf=s},Ko=(e,t,n,o)=>{let r=e._zod.def,i=D(r.left,t,{...o,path:[...o.path,"allOf",0]}),s=D(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Wo=(e,t,n,o)=>{let r=n,i=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((y,S)=>D(y,t,{...o,path:[...o.path,s,S]})),l=i.rest?D(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,d=i.items.length;while(d>0){let y=i.items[d-1];if(!(t.io==="input"?At(y)!==void 0:y._zod.optout==="optional"))break;d--}let p=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(r.prefixItems=c,m)r.items=!1;else if(l)r.items=l;if(d>0)r.minItems=d;if(m)r.maxItems=p}else if(t.target==="openapi-3.0"){if(r.items={anyOf:c},l)r.items.anyOf.push(l);if(d>0)r.minItems=d;if(m)r.maxItems=p}else{if(r.items=c,m)r.additionalItems=!1;else if(l)r.additionalItems=l;if(d>0)r.minItems=d;if(m)r.maxItems=p}let{minimum:f,maximum:g}=W(e);if(typeof f==="number")r.minItems=f;if(typeof g==="number")r.maxItems=g};function Po(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Po(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let S=y.map((v)=>Po(e,v,n));if(S.some((v,k)=>v!==y[k]))t={...t,[g]:S}}let o=Array.isArray(t.type)?t.type:[t.type],r=!o.includes("string")&&o.some((g)=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!i?.some((g)=>typeof g==="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:d,format:p,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof f.const==="number")f.const=String(f.const);if(!r)return f;if(f.type="string",!i)f.pattern=(o.includes("number")?xt:to).source;return f}var Mo=new WeakMap;function pm(e){let t=new Map;for(let o of e.seen.values())if(o.def&&!t.has(o.schema))t.set(o.schema,o);let n=new Map;for(let o of Mo.get(e)??[]){let r=e.seen.get(o),i=(r?.def??r?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Po(t,i,new Set);if(s!==i)n.set(i,s)}if(!n.size)return;for(let o of e.seen.values())for(let r of[o.schema,o.def]){let i=r&&n.get(r.propertyNames);if(i)r.propertyNames=i}}var Jo=(e,t,n,o)=>{let r=n,i=e._zod.def;r.type="object";let s=i.keyType,a=W(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let d=D(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(let p of a)te(r.patternProperties,su(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=D(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let d=Mo.get(t);if(!d)d=[],Mo.set(t,d),t.deferred.push(()=>pm(t));d.push(e)}r.additionalProperties=D(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&At(i.valueType)!==void 0;if(c&&!i.partial&&!l){let d=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)r.required=d.map(String)}},Yo=(e,t,n,o)=>{let r=e._zod.def,i=D(r.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=r.innerType,n.nullable=!0;else n.anyOf=[i,{type:"null"}]},Xo=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},Qo=Symbol();function bu(e,t,n,o,r){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return q(t,n,o,r,"BigInt defaults cannot be represented in JSON Schema"),Qo}var er=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType;let s=bu(r.defaultValue,e,t,n,o);if(s!==Qo)n.default=s},tr=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);if(i.ref=r.innerType,t.io!=="input")return;let s=bu(r.defaultValue,e,t,n,o);if(s!==Qo)n._prefault=s},nr=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{q(e,t,n,o,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},or=(e,t,n,o)=>{let r=e._zod.def,i=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?r.out:r.in:r.out;D(s,t,o);let a=t.seen.get(e);a.ref=s},rr=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,n.readOnly=!0},ir=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},ln=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},xu=(e,t,n,o)=>{let r=e._zod.innerType;D(r,t,o);let i=t.seen.get(e);i.ref=r},tu={string:Oo,number:zo,boolean:No,bigint:au,symbol:cu,null:uu,undefined:lu,void:$o,never:Lo,any:du,unknown:Do,date:Bo,enum:Uo,literal:Zo,nan:pu,template_literal:mu,file:fu,success:gu,custom:Fo,function:Ho,transform:jo,map:hu,set:yu,array:Vo,object:qo,union:Go,intersection:Ko,tuple:Wo,record:Jo,nullable:Yo,nonoptional:Xo,default:er,prefault:tr,catch:nr,pipe:or,readonly:rr,promise:ir,optional:ln,lazy:xu};function Su(e,t){if("_idmap"in e){let o=e,r=kt({...t,processors:tu}),i={};for(let c of o._idmap.entries()){let[l,d]=c;D(d,r)}let s={},a={registry:o,uri:t?.uri,defs:i};r.external=a;for(let c of o._idmap.entries()){let[l,d]=c;Et(r,d),te(s,l,Rt(r,d))}if(Object.keys(i).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=kt({...t,processors:tu});return D(e,n),Et(n,e),Rt(n,e)}var _u=new WeakSet([Object.prototype,Error.prototype]);function pn(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=n(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var _m=(e,t)=>{Zi.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(_u.has(n))return;_u.add(n),pn(n,"format",(o)=>(r)=>Kn(o,r)),pn(n,"flatten",(o)=>(r)=>Gn(o,r)),pn(n,"addIssue",(o)=>(r)=>{o.issues.push(r),o.message=JSON.stringify(o.issues,mt,2)}),pn(n,"addIssues",(o)=>(r)=>{o.issues.push(...r),o.message=JSON.stringify(o.issues,mt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var oe=h("ZodError",_m,void 0,{Parent:Error});var vu=yt(oe),Tu=bt(oe),Cu=qt(oe),ku=Gt(oe),Eu=ji(oe),Ru=Vi(oe),Au=qi(oe),Iu=Gi(oe),wu=Ki(oe),Pu=Wi(oe),Mu=Ji(oe),Ou=Yi(oe);function Tm(){if(!Y.localeError)Q(bo())}function It(){if(!Y.memoizer)Q({memoizer:yo()})}var N=h("ZodType",(e,t)=>(Tm(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ne(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(kf(e,t))},superRefine(e,t){return this.check(Ef(e,t))},overwrite(e){return this.check(Ae(e))},optional(){return $u(this)},exactOptional(){return df(this)},nullable(){return Lu(this)},nullish(){return $u(Lu(this))},nonoptional(e){return yf(this,e)},array(){return E(this)},or(e){return Ge([this,e])},and(e){return sf(this,e)},transform(e){return Du(this,Fu(e))},default(e){return ff(this,e)},prefault(e){return hf(this,e)},catch(e){return xf(this,e)},pipe(e){return Du(this,e)},readonly(){return vf(this)},describe(e){let t=this.clone();return Re.add(t,{description:e}),t},meta(...e){if(e.length===0)return Re.get(this);let t=this.clone();return Re.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 jt(this,"~standard",{...ao(this),jsonSchema:{input:Ct(this,"input"),output:Ct(this,"output")}})},set "~standard"(e){xe(this,"~standard",e)},parse:function e(t,n){return vu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Tu(this,t,n,{callee:e})},safeParse(e,t){return Cu(this,e,t)},async safeParseAsync(e,t){return ku(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xe(this,"spa",e)},validate(e,t){return Yn(this,e,t)},validateAsync(e,t){return Xn(this,e,t)},encode:function e(t,n){return Eu(this,t,n,{callee:e})},decode:function e(t,n){return Ru(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Au(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Iu(this,t,n,{callee:e})},safeEncode(e,t){return wu(this,e,t)},safeDecode(e,t){return Pu(this,e,t)},async safeEncodeAsync(e,t){return Mu(this,e,t)},async safeDecodeAsync(e,t){return Ou(this,e,t)},toJSONSchema(e){return Jc(this,{})(e)},get description(){return Re.get(this)?.description},get _def(){return this._zod.def}}),Bu=h("_ZodString",(e,t)=>{Xt.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Oo(e,n,o,r)},Fn({format:(e)=>W(e).format??null,minLength:(e)=>W(e).minimum??null,maxLength:(e)=>W(e).maximum??null},{regex(...e){return this.check(xo(...e))},includes(...e){return this.check(vo(...e))},startsWith(...e){return this.check(To(...e))},endsWith(...e){return this.check(Co(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(cn(...e))},length(...e){return this.check(un(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(So(e))},uppercase(e){return this.check(_o(e))},trim(){return this.check(Eo())},normalize(...e){return this.check(ko(...e))},toLowerCase(){return this.check(Ro())},toUpperCase(){return this.check(Ao())},slugify(){return this.check(Io())}})),Cm=h("ZodString",(e,t)=>{Xt.init(e,t),Bu.init(e,t)},{email(e){return this.check(cc(Im,e))},url(e){return this.check(fc(Pm,e))},jwt(e){return this.check(Ic(qm,e))},emoji(e){return this.check(gc(Mm,e))},guid(e){return this.check(uc(wm,e))},uuid(e){return this.check(lc(mn,e))},uuidv4(e){return this.check(dc(mn,e))},uuidv6(e){return this.check(pc(mn,e))},uuidv7(e){return this.check(mc(mn,e))},nanoid(e){return this.check(hc(Om,e))},cuid(e){return this.check(yc(zm,e))},cuid2(e){return this.check(bc(Nm,e))},ulid(e){return this.check(xc($m,e))},base64(e){return this.check(Ec(Hm,e))},base64url(e){return this.check(Rc(jm,e))},xid(e){return this.check(Sc(Lm,e))},ksuid(e){return this.check(_c(Dm,e))},ipv4(e){return this.check(vc(Bm,e))},ipv6(e){return this.check(Tc(Um,e))},cidrv4(e){return this.check(Cc(Zm,e))},cidrv6(e){return this.check(kc(Fm,e))},e164(e){return this.check(Ac(Vm,e))},datetime(e){return this.check(wc(km,e))},date(e){return this.check(Pc(Em,e))},time(e){return this.check(Mc(Rm,e))},duration(e){return this.check(Oc(Am,e))}});function u(e){return ac(Cm,e)}var F=h("ZodStringFormat",(e,t)=>{U.init(e,t),Bu.init(e,t)}),km=h("ZodISODateTime",(e,t)=>{pa.init(e,t),F.init(e,t)}),Em=h("ZodISODate",(e,t)=>{ma.init(e,t),F.init(e,t)}),Rm=h("ZodISOTime",(e,t)=>{fa.init(e,t),F.init(e,t)}),Am=h("ZodISODuration",(e,t)=>{ga.init(e,t),F.init(e,t)}),Im=h("ZodEmail",(e,t)=>{ta.init(e,t),F.init(e,t)});var wm=h("ZodGUID",(e,t)=>{Qs.init(e,t),F.init(e,t)});var mn=h("ZodUUID",(e,t)=>{ea.init(e,t),F.init(e,t)});var Pm=h("ZodURL",(e,t)=>{ra.init(e,t),F.init(e,t)});var Mm=h("ZodEmoji",(e,t)=>{ia.init(e,t),F.init(e,t)});var Om=h("ZodNanoID",(e,t)=>{sa.init(e,t),F.init(e,t)});var zm=h("ZodCUID",(e,t)=>{aa.init(e,t),F.init(e,t)});var Nm=h("ZodCUID2",(e,t)=>{ca.init(e,t),F.init(e,t)});var $m=h("ZodULID",(e,t)=>{ua.init(e,t),F.init(e,t)});var Lm=h("ZodXID",(e,t)=>{la.init(e,t),F.init(e,t)});var Dm=h("ZodKSUID",(e,t)=>{da.init(e,t),F.init(e,t)});var Bm=h("ZodIPv4",(e,t)=>{ha.init(e,t),F.init(e,t)});var Um=h("ZodIPv6",(e,t)=>{ba.init(e,t),F.init(e,t)});var Zm=h("ZodCIDRv4",(e,t)=>{xa.init(e,t),F.init(e,t)});var Fm=h("ZodCIDRv6",(e,t)=>{Sa.init(e,t),F.init(e,t)});var Hm=h("ZodBase64",(e,t)=>{va.init(e,t),F.init(e,t)});var jm=h("ZodBase64URL",(e,t)=>{Ta.init(e,t),F.init(e,t)});var Vm=h("ZodE164",(e,t)=>{Ca.init(e,t),F.init(e,t)});var qm=h("ZodJWT",(e,t)=>{ka.init(e,t),F.init(e,t)});var Uu=h("ZodNumber",(e,t)=>{uo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>zo(e,n,o,r),e.isFinite=!0},Fn({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=W(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=W(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=W(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>W(e).format??null},{gt(e,t){return this.check(sn(e,t))},gte(e,t){return this.check(He(e,t))},min(e,t){return this.check(He(e,t))},lt(e,t){return this.check(rn(e,t))},lte(e,t){return this.check(Fe(e,t))},max(e,t){return this.check(Fe(e,t))},int(e){return this.check(zu(e))},safe(e){return this.check(zu(e))},positive(e){return this.check(sn(0,e))},nonnegative(e){return this.check(He(0,e))},negative(e){return this.check(rn(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(an(e,t))},step(e,t){return this.check(an(e,t))},finite(){return this}}));function x(e){return zc(Uu,e)}var Gm=h("ZodNumberFormat",(e,t)=>{Ea.init(e,t),Uu.init(e,t)});function zu(e){return Nc(Gm,e)}var Km=h("ZodBoolean",(e,t)=>{Ra.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>No(e,n,o,r)});function w(e){return $c(Km,e)}var Wm=h("ZodUnknown",(e,t)=>{Aa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Do(e,n,o,r)});function K(){return Lc(Wm)}var Jm=h("ZodNever",(e,t)=>{Ia.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Lo(e,n,o,r)});function Ym(e){return Dc(Jm,e)}var Xm=h("ZodVoid",(e,t)=>{wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>$o(e,n,o,r)});function Qm(e){return Bc(Xm,e)}var ef=h("ZodDate",(e,t)=>{Pa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Bo(e,n,o,r),e.min=(n,o)=>e.check(He(n,o)),e.max=(n,o)=>e.check(Fe(n,o))},Fn({minDate:(e)=>{let{minimum:t}=W(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=W(e);return t?new Date(t):null}},{}));function fn(e){return Uc(ef,e)}var tf=h("ZodArray",(e,t)=>{It(),Ma.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Vo(e,n,o,r),e.element=t.element},{min(e,t){return this.check(je(e,t))},nonempty(e){return this.check(je(1,e))},max(e,t){return this.check(cn(e,t))},length(e,t){return this.check(un(e,t))},unwrap(){return this.element}});function E(e,t){return Zc(tf,e,t)}var nf=h("ZodObject",(e,t)=>{It(),Na.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qo(e,n,o,r),Ip(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return I(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ne(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ne(this._zod.def,{catchall:K()}))},loose(){return this.clone(ne(this._zod.def,{catchall:K()}))},strict(){return this.clone(ne(this._zod.def,{catchall:Ym()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return _p(this,e)},safeExtend(e){return vp(this,e)},merge(e){return Tp(this,e)},pick(e){return xp(this,e)},omit(e){return Sp(this,e)},partial(...e){return Mi(cr,this,e[0])},exactPartial(...e){return Mi(Hu,this,e[0],"exactPartial")},required(...e){return Cp(ju,this,e[0])}});function b(e,t){let n={type:"object",shape:e??{},..._(t)};return new nf(n)}var Zu=h("ZodUnion",(e,t)=>{lo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Go(e,n,o,r),e.options=t.options});function Ge(e,t){return new Zu({type:"union",options:e,..._(t)})}var of=h("ZodDiscriminatedUnion",(e,t)=>{Zu.init(e,t),$a.init(e,t)});function ar(e,t,n){return new of({type:"union",options:t,discriminator:e,..._(n)})}var rf=h("ZodIntersection",(e,t)=>{La.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ko(e,n,o,r)});function sf(e,t){return new rf({type:"intersection",left:e,right:t})}var af=h("ZodTuple",(e,t)=>{It(),po.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Wo(e,n,o,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new cr({type:"optional",innerType:t}))})}});function cf(e,t,n){let o=t instanceof z,r=o?n:t;return new af({type:"tuple",items:e,rest:o?t:null,..._(r)})}var Nu=h("ZodRecord",(e,t)=>{It(),Da.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Jo(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function j(e,t,n){if(!t||!t._zod)return new Nu({type:"record",keyType:u(),valueType:e,..._(t)});return new Nu({type:"record",keyType:e,valueType:t,..._(n)})}var sr=h("ZodEnum",(e,t)=>{Ba.init(e,t),N.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Uo(e,o,r,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{let i={};for(let s of o)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new sr({...t,checks:[],..._(r),entries:i})},e.exclude=(o,r)=>{let i={...t.entries};for(let s of o)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new sr({...t,checks:[],..._(r),entries:i})}});function I(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new sr({type:"enum",entries:n,..._(t)})}var uf=h("ZodLiteral",(e,t)=>{Ua.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Zo(e,n,o,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V(e,t){return new uf({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}var lf=h("ZodTransform",(e,t)=>{It(),Za.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>jo(e,n,o,r),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ht(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Ne(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=e),n.issues.push(Ne(s))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((i)=>(n.value=i,n));return n.value=r,n}});function Fu(e){return new lf({type:"transform",transform:e})}var cr=h("ZodOptional",(e,t)=>{mo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ln(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new cr({type:"optional",innerType:e})}var Hu=h("ZodExactOptional",(e,t)=>{Fa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ln(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function df(e){return new Hu({type:"optional",innerType:e})}var pf=h("ZodNullable",(e,t)=>{Ha.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Yo(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new pf({type:"nullable",innerType:e})}var mf=h("ZodDefault",(e,t)=>{ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>er(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ff(e,t){return new mf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}var gf=h("ZodPrefault",(e,t)=>{Va.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>tr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function hf(e,t){return new gf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}var ju=h("ZodNonOptional",(e,t)=>{qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Xo(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function yf(e,t){return new ju({type:"nonoptional",innerType:e,..._(t)})}var bf=h("ZodCatch",(e,t)=>{Ga.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>nr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xf(e,t){return new bf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:$i(t)})}var Vu=h("ZodPipe",(e,t)=>{fo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>or(e,n,o,r),e.in=t.in,e.out=t.out});function Du(e,t){return new Vu({type:"pipe",in:e,out:t})}var Sf=h("ZodPreprocess",(e,t)=>{Vu.init(e,t),Ka.init(e,t)}),_f=h("ZodReadonly",(e,t)=>{Wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>rr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function vf(e){return new _f({type:"readonly",innerType:e})}var Tf=h("ZodPromise",(e,t)=>{Ya.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ir(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ur(e){return new Tf({type:"promise",innerType:e})}var Cf=h("ZodFunction",(e,t)=>{Ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ho(e,n,o,r)});function gn(e){return new Cf({type:"function",input:Array.isArray(e?.input)?cf(e?.input):e?.input??E(K()),output:e?.output??K()})}var qu=h("ZodCustom",(e,t)=>{Xa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Fo(e,n,o,r)});function se(e,t){return Fc(qu,e??(()=>!0),t)}function kf(e,t={}){return Hc(qu,e,t)}function Ef(e,t){return jc(e,t)}function Gu(e,t){return new Sf({type:"pipe",in:Fu(e),out:t})}var hn=["none","minimal","low","medium","high","xhigh","max"],lr=I(hn),yn=lr.exclude(["none"]),Rf=I([...hn,"default"]).nullable(),dr=ar("type",[b({type:V("toggle")}).strict(),b({type:V("effort"),values:E(Rf)}).strict(),b({type:V("budget_tokens"),min:x().min(-1).optional(),max:x().min(0).optional()}).strict().refine((e)=>e.min===void 0||e.max===void 0||e.min<=e.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var Ku=I(["default","openai-responses","r1"]),Af={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},Wu=I(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Ju=I(["active","preview","deprecated","legacy"]),Yu=b({input:x().optional(),output:x().optional(),cacheWrite:x().optional(),cacheRead:x().optional()}),Xu=b({maxBudget:x().optional(),outputPrice:x().optional(),thinkingLevel:I(["low","high"]).optional()}),Qu=b({reasoningDefaultOn:w().optional(),apiProtocol:I(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(K()),pr=I(["text","image","audio","video","pdf"]),el=b({input:E(pr),output:E(pr)});function tl(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var nl=I(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function If(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function wf(e){return(e.operation===void 0||e.operation==="language")&&tl(e.modalities)}var ol=I(["batch","streaming"]);function Pf(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function Mf(e){return e.operation==="image-generation"}function mr(e,t,n){let o=e.capabilities;if(o===void 0||o.length===0)return n?.assumeWhenUnspecified??!1;return o.includes(t)}function Of(e){return mr(e,"tools",{assumeWhenUnspecified:!0})}function zf(e){return mr(e,"images",{assumeWhenUnspecified:!0})}var bn=b({id:u(),name:u().optional(),description:u().optional(),maxTokens:x().optional(),contextWindow:x().optional(),maxInputTokens:x().optional(),capabilities:E(Wu).optional(),operation:nl.optional(),operationModes:E(ol).optional(),modalities:el.optional(),reasoningOptions:E(dr).optional(),apiFormat:Ku.optional(),systemRole:I(["system","developer"]).optional(),temperature:x().optional(),pricing:Yu.optional(),thinkingConfig:Xu.optional(),status:Ju.optional(),deprecationNotice:u().optional(),replacedBy:u().optional(),releaseDate:u().optional(),deprecationDate:u().optional(),family:u().optional(),metadata:Qu.optional()});var Nf="This tool call was rejected by the user and not executed.",$f="NOT a tool or system failure. Clarify with user before proceeding.",fr=b({id:u(),name:u(),execution:I(["client","provider"]).optional(),input:K(),output:K(),error:u().optional(),durationMs:x(),startedAt:fn(),endedAt:fn()});var Lf=I(["completed","max_iterations","aborted","mistake_limit","error"]),Df=b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()}),sv=b({text:u(),usage:Df,messages:E(se()),toolCalls:E(fr),iterations:x(),finishReason:Lf,model:b({id:u(),provider:u(),info:bn.optional()}),startedAt:fn(),endedAt:fn(),durationMs:x()}),av=b({distinctId:u().optional(),sessionId:u().optional(),providerId:u(),modelId:u(),apiKey:u().optional(),baseUrl:u().url().optional(),headers:j(u(),u()).optional(),knownModels:j(u(),bn).optional(),providerConfig:K().optional(),initialMessages:E(se()).optional(),systemPrompt:u(),tools:E(se()),modelTools:E(se()).optional(),maxIterations:x().positive().optional(),maxParallelToolCalls:x().int().positive().default(8),maxTokensPerTurn:x().positive().optional(),temperature:x().nonnegative().optional(),apiTimeoutMs:x().positive().default(180000),userFileContentLoader:gn().input([u()]).output(ur(u())).optional(),toolContextMetadata:j(u(),K()).optional(),execution:b({maxConsecutiveMistakes:x().int().positive().optional(),reminderAfterIterations:x().nonnegative().optional(),reminderText:u().optional(),loopDetection:Ge([V(!1),b({softThreshold:x().int().positive().optional(),hardThreshold:x().int().positive().optional()})]).optional()}).optional(),reasoningEffort:yn.optional(),thinkingBudgetTokens:x().positive().optional(),thinking:w().optional(),onEvent:gn().input([se()]).output(Qm()).optional(),hooks:se().optional(),parentAgentId:u().optional(),extensions:E(se()).optional(),hookErrorMode:I(["ignore","throw"]).default("ignore"),toolPolicies:j(u(),b({enabled:w().optional(),autoApprove:w().optional()})).optional(),requestToolApproval:gn().input([b({sessionId:u(),agentId:u(),conversationId:u(),iteration:x(),toolCallId:u(),toolName:u(),input:K(),policy:b({enabled:w().optional(),autoApprove:w().optional()}).default({})})]).output(Ge([b({approved:w(),reason:u().optional()}),ur(b({approved:w(),reason:u().optional()}))])).optional(),onConsecutiveMistakeLimitReached:gn().input([b({iteration:x().int().positive(),consecutiveMistakes:x().int().positive(),maxConsecutiveMistakes:x().int().positive(),reason:I(["api_error","invalid_tool_call","tool_execution_failed"]),details:u().optional()})]).output(Ge([b({action:V("continue"),guidance:u().optional()}),b({action:V("stop"),reason:u().optional()}),ur(Ge([b({action:V("continue"),guidance:u().optional()}),b({action:V("stop"),reason:u().optional()})]))])).optional(),logger:se().optional(),extensionContext:se().optional(),abortSignal:se().optional()});var rl=I(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),il=b({id:u().optional(),label:u().optional(),role:u().optional(),participantKey:u().optional(),participantLabel:u().optional(),platformUserId:u().optional(),metadata:j(u(),K()).optional()}),sl=b({source:u(),sourceEvent:u(),threadId:u(),channelId:u(),isDM:w(),sessionId:u().optional(),workspaceRoot:u().optional(),metadata:j(u(),K()).optional()}),Bf=b({actor:il,context:sl,payload:j(u(),K()).optional()}),Uf=b({action:I(["allow","deny"]).default("allow"),message:u().optional(),reason:u().optional(),metadata:j(u(),K()).optional()}),Zf=b({adapter:u(),botUserName:u().optional(),event:rl,payload:j(u(),K()),ts:u()});var al=[{name:"discord",description:"Discord interactions and gateway bridge backed by RPC runtime sessions"},{name:"gchat",description:"Google Chat webhook bridge backed by RPC runtime sessions"},{name:"linear",description:"Linear webhook bridge backed by RPC runtime sessions"},{name:"slack",description:"Slack webhook/socket bridge backed by RPC runtime sessions"},{name:"telegram",description:"Bridge Telegram bot messages into RPC chat sessions"},{name:"whatsapp",description:"Bridge WhatsApp webhook messages into RPC chat sessions"}];function cl(){return al.map((e)=>({...e}))}function ul(e,t){let n=e.includeWhen;if(!n)return!0;let o=t[n.flag]??"";if(n.equals!==void 0&&o!==n.equals)return!1;if(n.notEquals!==void 0&&o===n.notEquals)return!1;return!0}function Ff(e,t,n){let o={};for(let i of e.fields){let s=t[i.flag];o[i.flag]=typeof s==="string"?s.trim():i.initialValue??""}let r=[];for(let i of e.fields){if(!ul(i,o))continue;let s=o[i.flag]??"";if(!s){if(i.required)throw Error(`${i.label} is required`);continue}r.push(i.flag,s)}if(n?.enabled===!0&&e.security){let i={};for(let s of e.security.fields){let a=n.values[s.key]?.trim();if(!a)throw Error(s.requiredMessage);let c=s.validate?.(a);if(c)throw Error(c);i[s.key]=a}r.push(...e.security.buildArgs(i))}return r}function Hf(e,t){if(t.has(e))return{managed:!0,consumesNext:!0};for(let n of t)if(e.startsWith(`${n}=`))return{managed:!0,consumesNext:!1};return{managed:!1,consumesNext:!1}}function jf(e,t,n,o){let r=new Set([...e.fields.flatMap((s)=>[s.flag,...s.aliases??[]]),...e.derivedReconnectFlags??[]]);if(o.replaceSecurityArgs)for(let s of e.security?.argumentFlags??[])r.add(s);let i=[];for(let s=0;s<t.length;s+=1){let a=t[s]??"",c=Hf(a,r);if(!c.managed){i.push(a);continue}if(c.consumesNext)s+=1}return[...i,...n]}function Vf(e=ll){let t=new Set(cl().map((n)=>n.name));return e.filter((n)=>t.has(n.id)).map((n)=>({id:n.id,name:n.name,type:n.type,hint:n.hint,fields:n.fields.map((o)=>({flag:o.flag,label:o.label,placeholder:o.placeholder,required:o.required,help:o.help,initialValue:o.initialValue,options:o.options,includeWhen:o.includeWhen})),security:n.security?{prompt:n.security.prompt,fields:n.security.fields.map((o)=>({key:o.key,label:o.label,placeholder:o.placeholder,help:o.help,requiredMessage:o.requiredMessage}))}:void 0}))}function qf(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function Gf(e){return/^T[A-Z0-9]+$/.test(e)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function Kf(e){return/^[UW][A-Z0-9]+$/.test(e)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var ll=[{id:"telegram",name:"Telegram",type:"polling",hint:"Easiest to set up. No public URL needed.",derivedReconnectFlags:["-m","--bot-username"],fields:[{flag:"-k",aliases:["--bot-token"],label:"Bot token",placeholder:"7123456789:AAH...",required:!0,help:["Open Telegram and start a chat with @BotFather","Send /newbot and follow the prompts","BotFather gives you this after creating the bot","It looks like 7123456789:AAHxxx..."]}],security:{prompt:"By default, anyone who finds your bot can message it and run tasks on your machine. Restrict access to your Telegram user ID?",fields:[{key:"userId",label:"Your Telegram user ID",placeholder:"123456789",help:["Message @userinfobot on Telegram","It will reply with your numeric user ID"],requiredMessage:"User ID is required to restrict access",validate:qf}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:e})=>["--allowed-user-id",e??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:Gf},{key:"userId",label:"Allowed Slack member ID",placeholder:"U01ABC123",help:["Click a user's name in Slack, then View full profile","Click ... and Copy member ID"],requiredMessage:"Member ID is required to restrict access",validate:Kf}],argumentFlags:["--hook-command"],buildArgs:({teamId:e,userId:t})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${e}:user:${t}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var dl=[];function gr(e){dl.push(e)}async function Wf(){let e=dl.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var Jf=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],Yf=new Set(Jf);function fl(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function pl(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function ml(e){if(!Array.isArray(e))return;let t=e.filter((n)=>typeof n==="string").map((n)=>n.trim()).filter((n)=>n.length>0);return t.length>0?t:void 0}function gl(e){let t=ml(e.providerIds),n=ml(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function Xf(e,t){let n=fl(e,t),o=e.manifest;if(!o||typeof o!=="object")throw Error(`Invalid manifest for extension "${n}": manifest is required`);if(!Array.isArray(o.capabilities)||o.capabilities.length===0)throw Error(`Invalid manifest for extension "${n}": capabilities must be a non-empty array`);let r=new Set;for(let a of o.capabilities){if(!Yf.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);r.add(a)}if(Object.hasOwn(o,"providerIds")&&!pl(o.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(o,"modelIds")&&!pl(o.modelIds))throw Error(`Invalid manifest for extension "${n}": modelIds must be a string array when provided`);let i=r.has("hooks");if(e.hooks!==void 0&&!i)throw Error(`Invalid manifest for extension "${n}": runtime hooks require the "hooks" capability`);return{capabilities:r,raw:gl(o)}}function Qf(e,t){if(!e||typeof e!=="object")throw Error(`Invalid automation event contribution for extension "${t}": expected object`);let n=typeof e.eventType==="string"?e.eventType.trim():"",o=typeof e.source==="string"?e.source.trim():"";if(!n)throw Error(`Invalid automation event contribution for extension "${t}": eventType is required`);if(!o)throw Error(`Invalid automation event contribution for extension "${t}": source is required`);return{...e,eventType:n,source:o,examples:e.examples?[...e.examples]:void 0,metadata:e.metadata?{...e.metadata}:void 0}}class hr{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(e={}){this.extensions=e.extensions??[],this.setupContext=e.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((e,t)=>({extension:e,order:t,manifest:{capabilities:new Set,raw:e.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((e)=>({...e,manifest:Xf(e.extension,e.order)})),this.phase="setup"}async setup(e={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let t,n=[];for(let o of this.normalized){let{extension:r}=o;if(r.disabled)continue;let i=fl(r,o.order),s={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},a={registerTool:(l)=>s.tools.push(l),registerCommand:(l)=>s.commands.push(l),registerRule:(l)=>{if(!o.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${i}": registerRule requires the "rules" capability`);s.rules.push(l)},registerMessageBuilder:(l)=>s.messageBuilder.push(l),registerProvider:(l)=>s.providers.push(l),registerAutomationEventType:(l)=>{if(!o.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${i}": registerAutomationEventType requires the "automationEvents" capability`);s.automationEventTypes.push(Qf(l,i))},registerMcpServer:(l)=>{if(!o.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${i}": registerMcpServer requires the "mcp" capability`);s.mcpServers.push({...l,metadata:{...l.metadata??{},source:"plugin",plugin:i}})}},c=o.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await r.setup?.(a,c),n.push(s)}catch(l){if(e.tolerateSetupErrors!==!0)throw l;t??=l}}if(t&&e.tolerateSetupErrors!==!0)throw t;for(let o of n)this.registry.tools.push(...o.tools),this.registry.commands.push(...o.commands),this.registry.rules.push(...o.rules),this.registry.messageBuilder.push(...o.messageBuilder),this.registry.providers.push(...o.providers),this.registry.automationEventTypes.push(...o.automationEventTypes),this.registry.mcpServers.push(...o.mcpServers);if(this.phase="activate",t)throw t}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(e={}){this.resolve(),this.validate();try{await this.setup(e)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((e,t)=>e.order-t.order).map(({extension:e})=>e)}}function eg(e={}){return new hr(e)}var tg=[".js",".ts"];var Ke={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},ng={[Ke.CLINE_PASS]:!1,[Ke.CODE_CLOUD_AGENTS]:!1,[Ke.CODE_ONBOARDING_GITHUB]:!1,[Ke.CLINE_COMPOSIO_BETA]:!1},og=Object.values(Ke);var hl=I(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),$e=j(u(),u()),rg=b({toolName:u(),parameters:$e}),ig=b({toolName:u(),parameters:$e,result:u(),success:w(),executionTimeMs:x()}),sg=b({prompt:u(),attachments:E(u())}),ag=b({taskMetadata:$e}),cg=b({taskMetadata:$e,previousState:$e}),ug=b({taskMetadata:$e}),lg=b({taskMetadata:$e}),dg=b({taskId:u(),ulid:u(),contextSize:x(),compactionStrategy:u(),previousApiReqIndex:x(),tokensIn:x(),tokensOut:x(),tokensInCache:x(),tokensOutCache:x(),deletedRangeStart:x(),deletedRangeEnd:x(),contextJsonPath:u(),contextRawPath:u()}),yl=b({clineVersion:u(),hookName:hl,timestamp:u(),taskId:u(),sessionContext:b({rootSessionId:u().optional(),hookLogPath:u().optional()}).optional(),workspaceRoots:E(u()),workspaceInfo:se().optional(),userId:u(),agent_id:u(),parent_agent_id:u().nullable(),iteration:x().optional(),reason:u().optional(),tool_call:b({id:u(),name:u(),input:K()}).optional(),tool_result:se().optional(),turn:K().optional(),error:b({name:u(),message:u(),stack:u().optional()}).optional(),preToolUse:rg.optional(),postToolUse:ig.optional(),userPromptSubmit:sg.optional(),taskStart:ag.optional(),taskResume:cg.optional(),taskCancel:ug.optional(),taskComplete:lg.optional(),preCompact:dg.optional()}).passthrough();function pg(e){let t=yl.safeParse(e);if(!t.success)return;return t.data}var _v="v1",vv="v1",Tv="v1",Cv=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","stream.replay"];function xn(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function kv(e,t="v1"){let n=xn(e.protocolVersion),o=xn(t);if(n===void 0||o===void 0)return{compatible:!1,reason:"missing_protocol"};let r=xn(e.minClientProtocolVersion)??n,i=xn(e.maxClientProtocolVersion)??n;return o>=r&&o<=i?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var Ev="approval.respond",Rv="0",Av="__hubScheduleRunAt",bl=["act","plan","yolo"];function mg(e){return bl.some((t)=>t===e)}function Iv(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(mg(n))return n;throw Error(`mode must be one of: ${bl.join(", ")}`)}var fg=30000,wv=5000;function gg(e){switch(e){case"run.start":case"session.send_input":return null;default:return fg}}function Pv(e,t){return t===void 0?gg(e):t}var hg=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],yg=new Set(hg);function Mv(e){return typeof e==="string"&&yg.has(e)}var Ov="tool_executor.",zv="custom_tool.",Nv="hook.",$v="compaction.compact",Lv="checkpoint.create",Dv="mistake_limit.decide",Bv="user_instructions.snapshot";function Uv(e){let t=e.activeSessionCount;if(typeof t!=="number"||t<=0)return"active sessions from other Cline clients";let n=`${t} active session${t===1?"":"s"}`,o=e.participantClientCount;if(typeof o!=="number"||o<=0)return n;return`${n} from ${o} connected Cline client${o===1?"":"s"}`}function yr(e,t){return`<file_content path="${e}">
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Wc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!=="object")return;Wc(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!n.includes(s))n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Jc=new Set(["type","properties","required","additionalProperties"]),Gc=["oneOf","anyOf"];function Kc(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ir(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Jc.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Kc(u);if(l===null||l===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Ir(a)??{allOf:a};te(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size)o.required=[...r];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Kc(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function gm(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Jc)if(o in e)return;let n=t.filter((o)=>Gc.some((i)=>Array.isArray(o[i]))),r=null;if(!n.length)r=Ir(t);else{let o=n[0],i=Gc.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter((c)=>c!==o),a=o[i].map((c)=>Ir([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,Tt(e,r)}function Rt(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){r(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(g);else Tt(u,g);if(Tt(u,l),a._zod.parent===p)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(!(S in l))delete u[S]}if(g.$ref&&f.def)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(S in f.def&&JSON.stringify(u[S])===JSON.stringify(f.def[S]))delete u[S]}}let m=a._zod.parent;if(m&&m!==p){r(m);let f=e.seen.get(m);if(f?.schema.$ref){if(u.$ref=f.schema.$ref,f.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g]))delete u[g]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Wc(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);if(p)p.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])gm(u)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Tt(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;te(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ct(t,"input",e.processors),output:Ct(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function X(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return X(r.element,n);if(r.type==="set")return X(r.valueType,n);if(r.type==="lazy")return X(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return X(r.innerType,n);if(r.type==="intersection")return X(r.left,n)||X(r.right,n);if(r.type==="record"||r.type==="map")return X(r.keyType,n)||X(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return X(r.in,n)||X(r.out,n)}if(r.type==="object"){for(let o in r.shape)if(X(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(X(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(X(o,n))return!0;if(r.rest&&X(r.rest,n))return!0;return!1}return!1}var Yc=(e,t={})=>(n)=>{let r=kt({...n,processors:t});return D(e,r),Et(r,e),Rt(r,e)},Ct=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=kt({...o??{},target:i,io:t,processors:n});return D(e,s),Et(s,e),Rt(s,e)};var Ve=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},qe=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Xc=(e,t)=>{Ve(e,"minimum",t),qe(e,"maximum",t)},ru=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ou=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},iu=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},su=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Qc=(e,t)=>Ve(e,"minimum",t.minimum),eu=(e,t)=>qe(e,"maximum",t.maximum),tu=(e)=>(t,n)=>{su(t,n.format);let[r,o]=e[n.format];Ve(t,"minimum",r),qe(t,"maximum",o)},hm={greater_than:(e,t)=>Ve(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>qe(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>ru(e,t.value),number_format:tu(Ut),bigint_format:tu(Zn),min_length:Qc,max_length:eu,length_equals:(e,t)=>Xc(e,t.length),min_size:Qc,max_size:eu,size_equals:(e,t)=>Xc(e,t.size),string_format:(e,t)=>{if(su(e,t.format),t.pattern)ou(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>iu(e,t.mime)};function W(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)hm[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)Ve(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)Ve(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)qe(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)qe(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)ru(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)iu(t,o.mime);for(let i of o.patterns??[])ou(t,i);return t}var ym={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bm=new Map([[ur,fs],[en,gs]]),au=(e)=>bm.get(e)??e,Or=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=W(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=ym[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let p=[...c].map(au);if(p.length===1)o.pattern=p[0].source;else if(p.length>1)o.allOf=[...p.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},zr=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=W(e);o.type=l?"integer":"number";let p=typeof u==="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(f)o.minimum=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;else if(typeof i==="number")o.minimum=i;if(m)if(f)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let g=new Set;for(let v of a)if(Number.isFinite(v)&&v!==0)g.add(Math.abs(v));else q(e,t,o,r,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[y,...S]=g;if(y!==void 0)o.multipleOf=y;if(S.length)o.allOf=[...o.allOf??[],...S.map((v)=>({multipleOf:v}))]}},Nr=(e,t,n,r)=>{n.type="boolean"},cu=(e,t,n,r)=>{q(e,t,n,r,"BigInt cannot be represented in JSON Schema")},uu=(e,t,n,r)=>{q(e,t,n,r,"Symbols cannot be represented in JSON Schema")},lu=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},du=(e,t,n,r)=>{q(e,t,n,r,"Undefined cannot be represented in JSON Schema")},$r=(e,t,n,r)=>{q(e,t,n,r,"Void cannot be represented in JSON Schema")},Lr=(e,t,n,r)=>{n.not={}},pu=(e,t,n,r)=>{},Dr=(e,t,n,r)=>{},Br=(e,t,n,r)=>{q(e,t,n,r,"Date cannot be represented in JSON Schema")},Ur=(e,t,n,r)=>{let o=e._zod.def,i=pt(o.entries);if(i.length===0){n.not={};return}if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";n.enum=i},Zr=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(q(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(q(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[s];else n.const=s}else{if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";if(i.every((s)=>typeof s==="boolean"))n.type="boolean";if(i.every((s)=>s===null))n.type="null";n.enum=i}},mu=(e,t,n,r)=>{q(e,t,n,r,"NaN cannot be represented in JSON Schema")},fu=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},gu=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=W(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},hu=(e,t,n,r)=>{n.type="boolean"},Fr=(e,t,n,r)=>{q(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Hr=(e,t,n,r)=>{q(e,t,n,r,"Function types cannot be represented in JSON Schema")},jr=(e,t,n,r)=>{q(e,t,n,r,"Transforms cannot be represented in JSON Schema")},yu=(e,t,n,r)=>{q(e,t,n,r,"Map cannot be represented in JSON Schema")},bu=(e,t,n,r)=>{q(e,t,n,r,"Set cannot be represented in JSON Schema")},Vr=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=W(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=D(i.element,t,{...r,path:[...r.path,"items"]})};function At(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return At(t.out);if(t.type==="catch")return At(t.innerType);return e._zod.optin}var qr=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&q(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)te(o.properties,u,D(s[u],t,{...r,path:[...r.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?At(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=D(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},Gr=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)n.oneOf=s;else n.anyOf=s},Kr=(e,t,n,r)=>{let o=e._zod.def,i=D(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=D(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Wr=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((y,S)=>D(y,t,{...r,path:[...r.path,s,S]})),u=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let y=i.items[l-1];if(!(t.io==="input"?At(y)!==void 0:y._zod.optout==="optional"))break;l--}let p=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,m)o.items=!1;else if(u)o.items=u;if(l>0)o.minItems=l;if(m)o.maxItems=p}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(l>0)o.minItems=l;if(m)o.maxItems=p}else{if(o.items=c,m)o.additionalItems=!1;else if(u)o.additionalItems=u;if(l>0)o.minItems=l;if(m)o.maxItems=p}let{minimum:f,maximum:g}=W(e);if(typeof f==="number")o.minItems=f;if(typeof g==="number")o.maxItems=g};function Pr(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Pr(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let S=y.map((v)=>Pr(e,v,n));if(S.some((v,k)=>v!==y[k]))t={...t,[g]:S}}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some((g)=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((g)=>typeof g==="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:p,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof f.const==="number")f.const=String(f.const);if(!o)return f;if(f.type="string",!i)f.pattern=(r.includes("number")?xt:nr).source;return f}var Mr=new WeakMap;function xm(e){let t=new Map;for(let r of e.seen.values())if(r.def&&!t.has(r.schema))t.set(r.schema,r);let n=new Map;for(let r of Mr.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Pr(t,i,new Set);if(s!==i)n.set(i,s)}if(!n.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);if(i)o.propertyNames=i}}var Jr=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=W(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)te(o.patternProperties,au(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Mr.get(t);if(!l)l=[],Mr.set(t,l),t.deferred.push(()=>xm(t));l.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&At(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(l.length>0)o.required=l.map(String)}},Yr=(e,t,n,r)=>{let o=e._zod.def,i=D(o.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,n.nullable=!0;else n.anyOf=[i,{type:"null"}]},Xr=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},Qr=Symbol();function xu(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return q(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),Qr}var eo=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=xu(o.defaultValue,e,t,n,r);if(s!==Qr)n.default=s},to=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=xu(o.defaultValue,e,t,n,r);if(s!==Qr)n._prefault=s},no=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{q(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},ro=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;D(s,t,r);let a=t.seen.get(e);a.ref=s},oo=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},io=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},dn=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},Su=(e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},nu={string:Or,number:zr,boolean:Nr,bigint:cu,symbol:uu,null:lu,undefined:du,void:$r,never:Lr,any:pu,unknown:Dr,date:Br,enum:Ur,literal:Zr,nan:mu,template_literal:fu,file:gu,success:hu,custom:Fr,function:Hr,transform:jr,map:yu,set:bu,array:Vr,object:qr,union:Gr,intersection:Kr,tuple:Wr,record:Jr,nullable:Yr,nonoptional:Xr,default:eo,prefault:to,catch:no,pipe:ro,readonly:oo,promise:io,optional:dn,lazy:Su};function _u(e,t){if("_idmap"in e){let r=e,o=kt({...t,processors:nu}),i={};for(let c of r._idmap.entries()){let[u,l]=c;D(l,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[u,l]=c;Et(o,l),te(s,u,Rt(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=kt({...t,processors:nu});return D(e,n),Et(n,e),Rt(n,e)}var vu=new WeakSet([Object.prototype,Error.prototype]);function mn(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var Am=(e,t)=>{Fi.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(vu.has(n))return;vu.add(n),mn(n,"format",(r)=>(o)=>Wn(r,o)),mn(n,"flatten",(r)=>(o)=>Kn(r,o)),mn(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,mt,2)}),mn(n,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,mt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var re=h("ZodError",Am,void 0,{Parent:Error});var Tu=yt(re),Cu=bt(re),ku=Gt(re),Eu=Kt(re),Ru=Vi(re),Au=qi(re),wu=Gi(re),Iu=Ki(re),Pu=Wi(re),Mu=Ji(re),Ou=Yi(re),zu=Xi(re);function Im(){if(!Y.localeError)Q(br())}function wt(){if(!Y.memoizer)Q({memoizer:yr()})}var N=h("ZodType",(e,t)=>(Im(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ne(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Mf(e,t))},superRefine(e,t){return this.check(Of(e,t))},overwrite(e){return this.check(Ae(e))},optional(){return Lu(this)},exactOptional(){return bf(this)},nullable(){return Du(this)},nullish(){return Lu(Du(this))},nonoptional(e){return Cf(this,e)},array(){return E(this)},or(e){return Ge([this,e])},and(e){return mf(this,e)},transform(e){return Bu(this,Hu(e))},default(e){return _f(this,e)},prefault(e){return Tf(this,e)},catch(e){return Ef(this,e)},pipe(e){return Bu(this,e)},readonly(){return wf(this)},describe(e){let t=this.clone();return Re.add(t,{description:e}),t},meta(...e){if(e.length===0)return Re.get(this);let t=this.clone();return Re.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 Vt(this,"~standard",{...cr(this),jsonSchema:{input:Ct(this,"input"),output:Ct(this,"output")}})},set "~standard"(e){xe(this,"~standard",e)},parse:function e(t,n){return Tu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Cu(this,t,n,{callee:e})},safeParse(e,t){return ku(this,e,t)},async safeParseAsync(e,t){return Eu(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xe(this,"spa",e)},validate(e,t){return Xn(this,e,t)},validateAsync(e,t){return Qn(this,e,t)},encode:function e(t,n){return Ru(this,t,n,{callee:e})},decode:function e(t,n){return Au(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await wu(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Iu(this,t,n,{callee:e})},safeEncode(e,t){return Pu(this,e,t)},safeDecode(e,t){return Mu(this,e,t)},async safeEncodeAsync(e,t){return Ou(this,e,t)},async safeDecodeAsync(e,t){return zu(this,e,t)},toJSONSchema(e){return Yc(this,{})(e)},get description(){return Re.get(this)?.description},get _def(){return this._zod.def}}),Uu=h("_ZodString",(e,t)=>{Qt.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Or(e,n,r,o)},Hn({format:(e)=>W(e).format??null,minLength:(e)=>W(e).minimum??null,maxLength:(e)=>W(e).maximum??null},{regex(...e){return this.check(xr(...e))},includes(...e){return this.check(vr(...e))},startsWith(...e){return this.check(Tr(...e))},endsWith(...e){return this.check(Cr(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(un(...e))},length(...e){return this.check(ln(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(Sr(e))},uppercase(e){return this.check(_r(e))},trim(){return this.check(Er())},normalize(...e){return this.check(kr(...e))},toLowerCase(){return this.check(Rr())},toUpperCase(){return this.check(Ar())},slugify(){return this.check(wr())}})),Pm=h("ZodString",(e,t)=>{Qt.init(e,t),Uu.init(e,t)},{email(e){return this.check(uc($m,e))},url(e){return this.check(gc(Dm,e))},jwt(e){return this.check(Ic(Qm,e))},emoji(e){return this.check(hc(Bm,e))},guid(e){return this.check(lc(Lm,e))},uuid(e){return this.check(dc(fn,e))},uuidv4(e){return this.check(pc(fn,e))},uuidv6(e){return this.check(mc(fn,e))},uuidv7(e){return this.check(fc(fn,e))},nanoid(e){return this.check(yc(Um,e))},cuid(e){return this.check(bc(Zm,e))},cuid2(e){return this.check(xc(Fm,e))},ulid(e){return this.check(Sc(Hm,e))},base64(e){return this.check(Rc(Jm,e))},base64url(e){return this.check(Ac(Ym,e))},xid(e){return this.check(_c(jm,e))},ksuid(e){return this.check(vc(Vm,e))},ipv4(e){return this.check(Tc(qm,e))},ipv6(e){return this.check(Cc(Gm,e))},cidrv4(e){return this.check(kc(Km,e))},cidrv6(e){return this.check(Ec(Wm,e))},e164(e){return this.check(wc(Xm,e))},datetime(e){return this.check(Pc(Mm,e))},date(e){return this.check(Mc(Om,e))},time(e){return this.check(Oc(zm,e))},duration(e){return this.check(zc(Nm,e))}});function d(e){return cc(Pm,e)}var F=h("ZodStringFormat",(e,t)=>{U.init(e,t),Uu.init(e,t)}),Mm=h("ZodISODateTime",(e,t)=>{ma.init(e,t),F.init(e,t)}),Om=h("ZodISODate",(e,t)=>{fa.init(e,t),F.init(e,t)}),zm=h("ZodISOTime",(e,t)=>{ga.init(e,t),F.init(e,t)}),Nm=h("ZodISODuration",(e,t)=>{ha.init(e,t),F.init(e,t)}),$m=h("ZodEmail",(e,t)=>{na.init(e,t),F.init(e,t)});var Lm=h("ZodGUID",(e,t)=>{ea.init(e,t),F.init(e,t)});var fn=h("ZodUUID",(e,t)=>{ta.init(e,t),F.init(e,t)});var Dm=h("ZodURL",(e,t)=>{ia.init(e,t),F.init(e,t)});var Bm=h("ZodEmoji",(e,t)=>{sa.init(e,t),F.init(e,t)});var Um=h("ZodNanoID",(e,t)=>{aa.init(e,t),F.init(e,t)});var Zm=h("ZodCUID",(e,t)=>{ca.init(e,t),F.init(e,t)});var Fm=h("ZodCUID2",(e,t)=>{ua.init(e,t),F.init(e,t)});var Hm=h("ZodULID",(e,t)=>{la.init(e,t),F.init(e,t)});var jm=h("ZodXID",(e,t)=>{da.init(e,t),F.init(e,t)});var Vm=h("ZodKSUID",(e,t)=>{pa.init(e,t),F.init(e,t)});var qm=h("ZodIPv4",(e,t)=>{ya.init(e,t),F.init(e,t)});var Gm=h("ZodIPv6",(e,t)=>{xa.init(e,t),F.init(e,t)});var Km=h("ZodCIDRv4",(e,t)=>{Sa.init(e,t),F.init(e,t)});var Wm=h("ZodCIDRv6",(e,t)=>{_a.init(e,t),F.init(e,t)});var Jm=h("ZodBase64",(e,t)=>{Ta.init(e,t),F.init(e,t)});var Ym=h("ZodBase64URL",(e,t)=>{Ca.init(e,t),F.init(e,t)});var Xm=h("ZodE164",(e,t)=>{ka.init(e,t),F.init(e,t)});var Qm=h("ZodJWT",(e,t)=>{Ea.init(e,t),F.init(e,t)});var Zu=h("ZodNumber",(e,t)=>{lr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zr(e,n,r,o),e.isFinite=!0},Hn({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=W(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=W(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=W(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>W(e).format??null},{gt(e,t){return this.check(an(e,t))},gte(e,t){return this.check(He(e,t))},min(e,t){return this.check(He(e,t))},lt(e,t){return this.check(sn(e,t))},lte(e,t){return this.check(Fe(e,t))},max(e,t){return this.check(Fe(e,t))},int(e){return this.check(Nu(e))},safe(e){return this.check(Nu(e))},positive(e){return this.check(an(0,e))},nonnegative(e){return this.check(He(0,e))},negative(e){return this.check(sn(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(cn(e,t))},step(e,t){return this.check(cn(e,t))},finite(){return this}}));function x(e){return Nc(Zu,e)}var ef=h("ZodNumberFormat",(e,t)=>{Ra.init(e,t),Zu.init(e,t)});function Nu(e){return $c(ef,e)}var tf=h("ZodBoolean",(e,t)=>{Aa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nr(e,n,r,o)});function I(e){return Lc(tf,e)}var nf=h("ZodUnknown",(e,t)=>{wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dr(e,n,r,o)});function K(){return Dc(nf)}var rf=h("ZodNever",(e,t)=>{Ia.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lr(e,n,r,o)});function of(e){return Bc(rf,e)}var sf=h("ZodVoid",(e,t)=>{Pa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$r(e,n,r,o)});function af(e){return Uc(sf,e)}var cf=h("ZodDate",(e,t)=>{Ma.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Br(e,n,r,o),e.min=(n,r)=>e.check(He(n,r)),e.max=(n,r)=>e.check(Fe(n,r))},Hn({minDate:(e)=>{let{minimum:t}=W(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=W(e);return t?new Date(t):null}},{}));function gn(e){return Zc(cf,e)}var uf=h("ZodArray",(e,t)=>{wt(),Oa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vr(e,n,r,o),e.element=t.element},{min(e,t){return this.check(je(e,t))},nonempty(e){return this.check(je(1,e))},max(e,t){return this.check(un(e,t))},length(e,t){return this.check(ln(e,t))},unwrap(){return this.element}});function E(e,t){return Fc(uf,e,t)}var lf=h("ZodObject",(e,t)=>{wt(),$a.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qr(e,n,r,o),zp(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return w(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ne(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ne(this._zod.def,{catchall:K()}))},loose(){return this.clone(ne(this._zod.def,{catchall:K()}))},strict(){return this.clone(ne(this._zod.def,{catchall:of()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return Ep(this,e)},safeExtend(e){return Rp(this,e)},merge(e){return Ap(this,e)},pick(e){return Cp(this,e)},omit(e){return kp(this,e)},partial(...e){return Oi(co,this,e[0])},exactPartial(...e){return Oi(ju,this,e[0],"exactPartial")},required(...e){return wp(Vu,this,e[0])}});function b(e,t){let n={type:"object",shape:e??{},..._(t)};return new lf(n)}var Fu=h("ZodUnion",(e,t)=>{dr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gr(e,n,r,o),e.options=t.options});function Ge(e,t){return new Fu({type:"union",options:e,..._(t)})}var df=h("ZodDiscriminatedUnion",(e,t)=>{Fu.init(e,t),La.init(e,t)});function ao(e,t,n){return new df({type:"union",options:t,discriminator:e,..._(n)})}var pf=h("ZodIntersection",(e,t)=>{Da.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kr(e,n,r,o)});function mf(e,t){return new pf({type:"intersection",left:e,right:t})}var ff=h("ZodTuple",(e,t)=>{wt(),pr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wr(e,n,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new co({type:"optional",innerType:t}))})}});function gf(e,t,n){let r=t instanceof z,o=r?n:t;return new ff({type:"tuple",items:e,rest:r?t:null,..._(o)})}var $u=h("ZodRecord",(e,t)=>{wt(),Ba.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jr(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function j(e,t,n){if(!t||!t._zod)return new $u({type:"record",keyType:d(),valueType:e,..._(t)});return new $u({type:"record",keyType:e,valueType:t,..._(n)})}var so=h("ZodEnum",(e,t)=>{Ua.init(e,t),N.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Ur(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new so({...t,checks:[],..._(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new so({...t,checks:[],..._(o),entries:i})}});function w(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new so({type:"enum",entries:n,..._(t)})}var hf=h("ZodLiteral",(e,t)=>{Za.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zr(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V(e,t){return new hf({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}var yf=h("ZodTransform",(e,t)=>{wt(),Fa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jr(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ht(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Ne(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=e),n.issues.push(Ne(s))}};let o=t.transform(n.value,n);if(o instanceof Promise)return o.then((i)=>(n.value=i,n));return n.value=o,n}});function Hu(e){return new yf({type:"transform",transform:e})}var co=h("ZodOptional",(e,t)=>{mr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new co({type:"optional",innerType:e})}var ju=h("ZodExactOptional",(e,t)=>{Ha.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bf(e){return new ju({type:"optional",innerType:e})}var xf=h("ZodNullable",(e,t)=>{ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Du(e){return new xf({type:"nullable",innerType:e})}var Sf=h("ZodDefault",(e,t)=>{Va.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _f(e,t){return new Sf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Bn(t)}})}var vf=h("ZodPrefault",(e,t)=>{qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>to(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Tf(e,t){return new vf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Bn(t)}})}var Vu=h("ZodNonOptional",(e,t)=>{Ga.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Cf(e,t){return new Vu({type:"nonoptional",innerType:e,..._(t)})}var kf=h("ZodCatch",(e,t)=>{Ka.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>no(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ef(e,t){return new kf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Li(t)})}var qu=h("ZodPipe",(e,t)=>{fr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ro(e,n,r,o),e.in=t.in,e.out=t.out});function Bu(e,t){return new qu({type:"pipe",in:e,out:t})}var Rf=h("ZodPreprocess",(e,t)=>{qu.init(e,t),Wa.init(e,t)}),Af=h("ZodReadonly",(e,t)=>{Ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function wf(e){return new Af({type:"readonly",innerType:e})}var If=h("ZodPromise",(e,t)=>{Xa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>io(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new If({type:"promise",innerType:e})}var Pf=h("ZodFunction",(e,t)=>{Ya.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hr(e,n,r,o)});function hn(e){return new Pf({type:"function",input:Array.isArray(e?.input)?gf(e?.input):e?.input??E(K()),output:e?.output??K()})}var Gu=h("ZodCustom",(e,t)=>{Qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fr(e,n,r,o)});function se(e,t){return Hc(Gu,e??(()=>!0),t)}function Mf(e,t={}){return jc(Gu,e,t)}function Of(e,t){return Vc(e,t)}function Ku(e,t){return new Rf({type:"pipe",in:Hu(e),out:t})}var yn=["none","minimal","low","medium","high","xhigh","max"],lo=w(yn),bn=lo.exclude(["none"]),zf=w([...yn,"default"]).nullable(),po=ao("type",[b({type:V("toggle")}).strict(),b({type:V("effort"),values:E(zf)}).strict(),b({type:V("budget_tokens"),min:x().min(-1).optional(),max:x().min(0).optional()}).strict().refine((e)=>e.min===void 0||e.max===void 0||e.min<=e.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var Wu=w(["default","openai-responses","r1"]),Nf={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},Ju=w(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Yu=w(["active","preview","deprecated","legacy"]),Xu=b({input:x().optional(),output:x().optional(),cacheWrite:x().optional(),cacheRead:x().optional()}),Qu=b({maxBudget:x().optional(),outputPrice:x().optional(),thinkingLevel:w(["low","high"]).optional()}),el=b({reasoningDefaultOn:I().optional(),apiProtocol:w(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(K()),mo=w(["text","image","audio","video","pdf"]),tl=b({input:E(mo),output:E(mo)});function nl(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var rl=w(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function $f(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function Lf(e){return(e.operation===void 0||e.operation==="language")&&nl(e.modalities)}var ol=w(["batch","streaming"]);function Df(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function Bf(e){return e.operation==="image-generation"}function fo(e,t,n){let r=e.capabilities;if(r===void 0||r.length===0)return n?.assumeWhenUnspecified??!1;return r.includes(t)}function Uf(e){return fo(e,"tools",{assumeWhenUnspecified:!0})}function Zf(e){return fo(e,"images",{assumeWhenUnspecified:!0})}var xn=b({id:d(),name:d().optional(),description:d().optional(),maxTokens:x().optional(),contextWindow:x().optional(),maxInputTokens:x().optional(),capabilities:E(Ju).optional(),operation:rl.optional(),operationModes:E(ol).optional(),modalities:tl.optional(),reasoningOptions:E(po).optional(),apiFormat:Wu.optional(),systemRole:w(["system","developer"]).optional(),temperature:x().optional(),pricing:Xu.optional(),thinkingConfig:Qu.optional(),status:Yu.optional(),deprecationNotice:d().optional(),replacedBy:d().optional(),releaseDate:d().optional(),deprecationDate:d().optional(),family:d().optional(),metadata:el.optional()});var Ff="This tool call was rejected by the user and not executed.",Hf="NOT a tool or system failure. Clarify with user before proceeding.",go=b({id:d(),name:d(),execution:w(["client","provider"]).optional(),input:K(),output:K(),error:d().optional(),durationMs:x(),startedAt:gn(),endedAt:gn()});var jf=w(["completed","max_iterations","aborted","mistake_limit","error"]),Vf=b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()}),fv=b({text:d(),usage:Vf,messages:E(se()),toolCalls:E(go),iterations:x(),finishReason:jf,model:b({id:d(),provider:d(),info:xn.optional()}),startedAt:gn(),endedAt:gn(),durationMs:x()}),gv=b({distinctId:d().optional(),sessionId:d().optional(),providerId:d(),modelId:d(),apiKey:d().optional(),baseUrl:d().url().optional(),headers:j(d(),d()).optional(),knownModels:j(d(),xn).optional(),providerConfig:K().optional(),initialMessages:E(se()).optional(),systemPrompt:d(),tools:E(se()),modelTools:E(se()).optional(),maxIterations:x().positive().optional(),maxParallelToolCalls:x().int().positive().default(8),maxTokensPerTurn:x().positive().optional(),temperature:x().nonnegative().optional(),apiTimeoutMs:x().positive().default(180000),userFileContentLoader:hn().input([d()]).output(uo(d())).optional(),toolContextMetadata:j(d(),K()).optional(),execution:b({maxConsecutiveMistakes:x().int().positive().optional(),reminderAfterIterations:x().nonnegative().optional(),reminderText:d().optional(),loopDetection:Ge([V(!1),b({softThreshold:x().int().positive().optional(),hardThreshold:x().int().positive().optional()})]).optional()}).optional(),reasoningEffort:bn.optional(),thinkingBudgetTokens:x().positive().optional(),thinking:I().optional(),onEvent:hn().input([se()]).output(af()).optional(),hooks:se().optional(),parentAgentId:d().optional(),extensions:E(se()).optional(),hookErrorMode:w(["ignore","throw"]).default("ignore"),toolPolicies:j(d(),b({enabled:I().optional(),autoApprove:I().optional()})).optional(),requestToolApproval:hn().input([b({sessionId:d(),agentId:d(),conversationId:d(),iteration:x(),toolCallId:d(),toolName:d(),input:K(),policy:b({enabled:I().optional(),autoApprove:I().optional()}).default({})})]).output(Ge([b({approved:I(),reason:d().optional()}),uo(b({approved:I(),reason:d().optional()}))])).optional(),onConsecutiveMistakeLimitReached:hn().input([b({iteration:x().int().positive(),consecutiveMistakes:x().int().positive(),maxConsecutiveMistakes:x().int().positive(),reason:w(["api_error","invalid_tool_call","tool_execution_failed"]),details:d().optional()})]).output(Ge([b({action:V("continue"),guidance:d().optional()}),b({action:V("stop"),reason:d().optional()}),uo(Ge([b({action:V("continue"),guidance:d().optional()}),b({action:V("stop"),reason:d().optional()})]))])).optional(),logger:se().optional(),extensionContext:se().optional(),abortSignal:se().optional()});var il=w(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),sl=b({id:d().optional(),label:d().optional(),role:d().optional(),participantKey:d().optional(),participantLabel:d().optional(),platformUserId:d().optional(),metadata:j(d(),K()).optional()}),al=b({source:d(),sourceEvent:d(),threadId:d(),channelId:d(),isDM:I(),sessionId:d().optional(),workspaceRoot:d().optional(),metadata:j(d(),K()).optional()}),qf=b({actor:sl,context:al,payload:j(d(),K()).optional()}),Gf=b({action:w(["allow","deny"]).default("allow"),message:d().optional(),reason:d().optional(),metadata:j(d(),K()).optional()}),Kf=b({adapter:d(),botUserName:d().optional(),event:il,payload:j(d(),K()),ts:d()});var cl=[{name:"discord",description:"Discord interactions and gateway bridge backed by RPC runtime sessions"},{name:"gchat",description:"Google Chat webhook bridge backed by RPC runtime sessions"},{name:"linear",description:"Linear webhook bridge backed by RPC runtime sessions"},{name:"slack",description:"Slack webhook/socket bridge backed by RPC runtime sessions"},{name:"telegram",description:"Bridge Telegram bot messages into RPC chat sessions"},{name:"whatsapp",description:"Bridge WhatsApp webhook messages into RPC chat sessions"}];function ul(){return cl.map((e)=>({...e}))}function ll(e,t){let n=e.includeWhen;if(!n)return!0;let r=t[n.flag]??"";if(n.equals!==void 0&&r!==n.equals)return!1;if(n.notEquals!==void 0&&r===n.notEquals)return!1;return!0}function Wf(e,t,n){let r={};for(let i of e.fields){let s=t[i.flag];r[i.flag]=typeof s==="string"?s.trim():i.initialValue??""}let o=[];for(let i of e.fields){if(!ll(i,r))continue;let s=r[i.flag]??"";if(!s){if(i.required)throw Error(`${i.label} is required`);continue}o.push(i.flag,s)}if(n?.enabled===!0&&e.security){let i={};for(let s of e.security.fields){let a=n.values[s.key]?.trim();if(!a)throw Error(s.requiredMessage);let c=s.validate?.(a);if(c)throw Error(c);i[s.key]=a}o.push(...e.security.buildArgs(i))}return o}function Jf(e,t){if(t.has(e))return{managed:!0,consumesNext:!0};for(let n of t)if(e.startsWith(`${n}=`))return{managed:!0,consumesNext:!1};return{managed:!1,consumesNext:!1}}function Yf(e,t,n,r){let o=new Set([...e.fields.flatMap((s)=>[s.flag,...s.aliases??[]]),...e.derivedReconnectFlags??[]]);if(r.replaceSecurityArgs)for(let s of e.security?.argumentFlags??[])o.add(s);let i=[];for(let s=0;s<t.length;s+=1){let a=t[s]??"",c=Jf(a,o);if(!c.managed){i.push(a);continue}if(c.consumesNext)s+=1}return[...i,...n]}function Xf(e=dl){let t=new Set(ul().map((n)=>n.name));return e.filter((n)=>t.has(n.id)).map((n)=>({id:n.id,name:n.name,type:n.type,hint:n.hint,fields:n.fields.map((r)=>({flag:r.flag,label:r.label,placeholder:r.placeholder,required:r.required,help:r.help,initialValue:r.initialValue,options:r.options,includeWhen:r.includeWhen})),security:n.security?{prompt:n.security.prompt,fields:n.security.fields.map((r)=>({key:r.key,label:r.label,placeholder:r.placeholder,help:r.help,requiredMessage:r.requiredMessage}))}:void 0}))}function Qf(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function eg(e){return/^T[A-Z0-9]+$/.test(e)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function tg(e){return/^[UW][A-Z0-9]+$/.test(e)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var dl=[{id:"telegram",name:"Telegram",type:"polling",hint:"Easiest to set up. No public URL needed.",derivedReconnectFlags:["-m","--bot-username"],fields:[{flag:"-k",aliases:["--bot-token"],label:"Bot token",placeholder:"7123456789:AAH...",required:!0,help:["Open Telegram and start a chat with @BotFather","Send /newbot and follow the prompts","BotFather gives you this after creating the bot","It looks like 7123456789:AAHxxx..."]}],security:{prompt:"By default, anyone who finds your bot can message it and run tasks on your machine. Restrict access to your Telegram user ID?",fields:[{key:"userId",label:"Your Telegram user ID",placeholder:"123456789",help:["Message @userinfobot on Telegram","It will reply with your numeric user ID"],requiredMessage:"User ID is required to restrict access",validate:Qf}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:e})=>["--allowed-user-id",e??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:eg},{key:"userId",label:"Allowed Slack member ID",placeholder:"U01ABC123",help:["Click a user's name in Slack, then View full profile","Click ... and Copy member ID"],requiredMessage:"Member ID is required to restrict access",validate:tg}],argumentFlags:["--hook-command"],buildArgs:({teamId:e,userId:t})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${e}:user:${t}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var pl=[];function ho(e){pl.push(e)}async function ng(){let e=pl.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var rg=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],og=new Set(rg);function gl(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function ml(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function fl(e){if(!Array.isArray(e))return;let t=e.filter((n)=>typeof n==="string").map((n)=>n.trim()).filter((n)=>n.length>0);return t.length>0?t:void 0}function hl(e){let t=fl(e.providerIds),n=fl(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function ig(e,t){let n=gl(e,t),r=e.manifest;if(!r||typeof r!=="object")throw Error(`Invalid manifest for extension "${n}": manifest is required`);if(!Array.isArray(r.capabilities)||r.capabilities.length===0)throw Error(`Invalid manifest for extension "${n}": capabilities must be a non-empty array`);let o=new Set;for(let a of r.capabilities){if(!og.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);o.add(a)}if(Object.hasOwn(r,"providerIds")&&!ml(r.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(r,"modelIds")&&!ml(r.modelIds))throw Error(`Invalid manifest for extension "${n}": modelIds must be a string array when provided`);let i=o.has("hooks");if(e.hooks!==void 0&&!i)throw Error(`Invalid manifest for extension "${n}": runtime hooks require the "hooks" capability`);return{capabilities:o,raw:hl(r)}}function sg(e,t){if(!e||typeof e!=="object")throw Error(`Invalid automation event contribution for extension "${t}": expected object`);let n=typeof e.eventType==="string"?e.eventType.trim():"",r=typeof e.source==="string"?e.source.trim():"";if(!n)throw Error(`Invalid automation event contribution for extension "${t}": eventType is required`);if(!r)throw Error(`Invalid automation event contribution for extension "${t}": source is required`);return{...e,eventType:n,source:r,examples:e.examples?[...e.examples]:void 0,metadata:e.metadata?{...e.metadata}:void 0}}class yo{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(e={}){this.extensions=e.extensions??[],this.setupContext=e.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((e,t)=>({extension:e,order:t,manifest:{capabilities:new Set,raw:e.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((e)=>({...e,manifest:ig(e.extension,e.order)})),this.phase="setup"}async setup(e={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let t,n=[];for(let r of this.normalized){let{extension:o}=r;if(o.disabled)continue;let i=gl(o,r.order),s={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},a={registerTool:(u)=>s.tools.push(u),registerCommand:(u)=>s.commands.push(u),registerRule:(u)=>{if(!r.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${i}": registerRule requires the "rules" capability`);s.rules.push(u)},registerMessageBuilder:(u)=>s.messageBuilder.push(u),registerProvider:(u)=>s.providers.push(u),registerAutomationEventType:(u)=>{if(!r.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${i}": registerAutomationEventType requires the "automationEvents" capability`);s.automationEventTypes.push(sg(u,i))},registerMcpServer:(u)=>{if(!r.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${i}": registerMcpServer requires the "mcp" capability`);s.mcpServers.push({...u,metadata:{...u.metadata??{},source:"plugin",plugin:i}})}},c=r.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await o.setup?.(a,c),n.push(s)}catch(u){if(e.tolerateSetupErrors!==!0)throw u;t??=u}}if(t&&e.tolerateSetupErrors!==!0)throw t;for(let r of n)this.registry.tools.push(...r.tools),this.registry.commands.push(...r.commands),this.registry.rules.push(...r.rules),this.registry.messageBuilder.push(...r.messageBuilder),this.registry.providers.push(...r.providers),this.registry.automationEventTypes.push(...r.automationEventTypes),this.registry.mcpServers.push(...r.mcpServers);if(this.phase="activate",t)throw t}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(e={}){this.resolve(),this.validate();try{await this.setup(e)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((e,t)=>e.order-t.order).map(({extension:e})=>e)}}function ag(e={}){return new yo(e)}var cg=[".js",".ts"];var Ke={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},ug={[Ke.CLINE_PASS]:!1,[Ke.CODE_CLOUD_AGENTS]:!1,[Ke.CODE_ONBOARDING_GITHUB]:!1,[Ke.CLINE_COMPOSIO_BETA]:!1},lg=Object.values(Ke);var yl=w(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),$e=j(d(),d()),dg=b({toolName:d(),parameters:$e}),pg=b({toolName:d(),parameters:$e,result:d(),success:I(),executionTimeMs:x()}),mg=b({prompt:d(),attachments:E(d())}),fg=b({taskMetadata:$e}),gg=b({taskMetadata:$e,previousState:$e}),hg=b({taskMetadata:$e}),yg=b({taskMetadata:$e}),bg=b({taskId:d(),ulid:d(),contextSize:x(),compactionStrategy:d(),previousApiReqIndex:x(),tokensIn:x(),tokensOut:x(),tokensInCache:x(),tokensOutCache:x(),deletedRangeStart:x(),deletedRangeEnd:x(),contextJsonPath:d(),contextRawPath:d()}),bl=b({clineVersion:d(),hookName:yl,timestamp:d(),taskId:d(),sessionContext:b({rootSessionId:d().optional(),hookLogPath:d().optional()}).optional(),workspaceRoots:E(d()),workspaceInfo:se().optional(),userId:d(),agent_id:d(),parent_agent_id:d().nullable(),iteration:x().optional(),reason:d().optional(),tool_call:b({id:d(),name:d(),input:K()}).optional(),tool_result:se().optional(),turn:K().optional(),error:b({name:d(),message:d(),stack:d().optional()}).optional(),preToolUse:dg.optional(),postToolUse:pg.optional(),userPromptSubmit:mg.optional(),taskStart:fg.optional(),taskResume:gg.optional(),taskCancel:hg.optional(),taskComplete:yg.optional(),preCompact:bg.optional()}).passthrough();function xg(e){let t=bl.safeParse(e);if(!t.success)return;return t.data}var wv="v1",Iv="v1",Pv="v1",Mv=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","plugins.list","plugins.status","plugins.reload","stream.replay"];function Sn(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function Ov(e,t="v1"){let n=Sn(e.protocolVersion),r=Sn(t);if(n===void 0||r===void 0)return{compatible:!1,reason:"missing_protocol"};let o=Sn(e.minClientProtocolVersion)??n,i=Sn(e.maxClientProtocolVersion)??n;return r>=o&&r<=i?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var zv="approval.respond",Nv="0",$v="__hubScheduleRunAt",xl=["act","plan","yolo"];function Sg(e){return xl.some((t)=>t===e)}function Lv(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(Sg(n))return n;throw Error(`mode must be one of: ${xl.join(", ")}`)}var _g=30000,Dv=5000;function vg(e){switch(e){case"run.start":case"session.send_input":return null;default:return _g}}function Bv(e,t){return t===void 0?vg(e):t}var Tg=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],Cg=new Set(Tg);function Uv(e){return typeof e==="string"&&Cg.has(e)}var Zv="tool_executor.",Fv="custom_tool.",Hv="hook.",jv="compaction.compact",Vv="checkpoint.create",qv="mistake_limit.decide",Gv="user_instructions.snapshot";function Kv(e){let t=e.activeSessionCount;if(typeof t!=="number"||t<=0)return"active sessions from other Cline clients";let n=`${t} active session${t===1?"":"s"}`,r=e.participantClientCount;if(typeof r!=="number"||r<=0)return n;return`${n} from ${r} connected Cline client${r===1?"":"s"}`}function bo(e,t){return`<file_content path="${e}">
|
|
59
59
|
${t}
|
|
60
|
-
</file_content>`}function bg(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function xg(e,t){return`<user_command slash="${t}">${e}</user_command>`}var Sg=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function _g(e){let t=Sg.exec(e??"");return t?t[1]:void 0}function vg(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function Tg(){let e=null;return{record(t,n){if(t===n)return;if(e){e=e.from===n?null:{from:e.from,to:n};return}e={from:t,to:n}},consume(){let t=e;return e=null,t}}}function Cg(e,t){let n=e.trim(),o=new RegExp(`^<${t}\\b([^>]*)>([\\s\\S]*?)<\\/${t}>$`,"i").exec(n);if(!o)return;return{attrs:o[1]??"",content:o[2]??""}}function kg(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function xl(e){if(!e?.trim())return;let t=Cg(e,"user_command");if(!t)return;let n=kg(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function Sl(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let o=kl(t,n);t=(o!==t?o:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function _l(e){if(!e?.trim())return"";return Eg(e,"mode_notice").trim()}function Eg(e,t){let n=`<${t}>`,o=`</${t}>`,r=e,i=r.indexOf(n);while(i!==-1){let s=r.indexOf(o,i+n.length);if(s===-1)break;r=r.slice(0,i)+r.slice(s+o.length),i=r.indexOf(n,i)}return r}function br(e){let t=_l(Sl(e)),n=xl(e);if(!n)return t;if(n.slash.toLowerCase()==="team"){let r=t.toLowerCase().startsWith("spawn a team of agents for the following task:")?t.slice(46).trim():t;return r?`/team ${r}`:"/team"}return t?`/${n.slash} ${t}`:`/${n.slash}`}var vl=240,Tl=480;function Cl(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function Rg(e){return Cl(br(e),vl)}function Ag(e,t){let n=t?.trim()??"",o=e.toLowerCase(),r=o==="user"||o==="session"?br(n):n;return Cl(r,Tl)}function kl(e,t){if(!e?.trim())return"";if(!t)return e;let n=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"g");return e.replace(n,"$1")}var We="[media omitted: invalid or exceeds size limit]",Je="[Image attached — this model cannot view images]",El=I(["image","audio","video","file"]),Rl=ar("type",[b({type:V("base64"),data:u().min(1)}),b({type:V("url"),url:u().url().refine((e)=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Generated media URLs must use HTTP or HTTPS")}),b({type:V("artifact"),artifactId:u().min(1)})]);function Al(e){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";return"file"}var Il=b({id:u().min(1),modality:El,mediaType:u().min(1),source:Rl,name:u().min(1).optional(),sizeBytes:x().int().nonnegative().optional()}).refine((e)=>Al(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function Ig(e){return Il.safeParse(e).success}function wg(e){return Al(e)}var _n=["image/png","image/jpeg","image/gif","image/webp"],xr=5242880,fe=xr,Se=6291456,wl=8388608;function Pg(e){return e.length}function Sr(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function Mg(e=xr){return Math.floor(e*3/4)}function _r(e){return Math.ceil(e/3)*4}function vr(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??fe,maxImageDecodedBytes:e.maxImageDecodedBytes??Se,maxTotalMediaBytes:e.maxTotalMediaBytes??wl}}function vn(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function Sn(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function wt(e,t,n,o){let r=vr(n);if(e>r.maxImageEncodedBytes){let i={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${r.maxImageEncodedBytes} byte encoded limit`};return Sn(o,i.reason),i}if(t>r.maxImageDecodedBytes){let i={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${r.maxImageDecodedBytes} byte decoded limit`};return Sn(o,i.reason),i}if(o.totalEncodedBytes+e>r.maxTotalMediaBytes){let i={ok:!1,reason:"total_limit",message:`Image media exceeds the ${r.maxTotalMediaBytes} byte total media limit`};return Sn(o,i.reason),i}return o.totalEncodedBytes+=e,o.keptImages+=1,null}function Pl(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function Og(e){return e.length>0&&Tr(e,0,e.length)}function zg(e,t,n){let o=Ml(e),r=o.end-o.start;if(r===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let i=vr(t);if(n.totalEncodedBytes+r>i.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${i.maxTotalMediaBytes} byte total media limit`};if(!Tr(e,o.start,o.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let s=e.slice(o.start,o.end);return n.totalEncodedBytes+=r,{ok:!0,base64:s,encodedBytes:r,decodedBytes:Sr(s)}}function Tr(e,t,n){let o=n-t;if(o%4!==0)return!1;let r=n;if(o>=2&&e.charCodeAt(n-2)===61&&e.charCodeAt(n-1)===61)r-=2;else if(o>=1&&e.charCodeAt(n-1)===61)r-=1;for(let i=t;i<r;i++)if(!Pl(e.charCodeAt(i)))return!1;for(let i=r;i<n;i++)if(e.charCodeAt(i)!==61)return!1;return!0}function Ng(e,t,n){return n-t>=5&&(e.charCodeAt(t)|32)===100&&(e.charCodeAt(t+1)|32)===97&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===97&&e.charCodeAt(t+4)===58}function Ml(e){let t=0,n=e.length;while(t<n&&/\s/.test(e[t]??""))t+=1;while(n>t&&/\s/.test(e[n-1]??""))n-=1;return{start:t,end:n}}function $g(e,t,n){if(!Ng(e,t,n))return;let o=t+5,r=e.indexOf(",",o);if(r===-1||r>=n)return;if(r-o>128)return;let i=e.slice(o,r).toLowerCase(),s=";base64";if(!i.endsWith(s))return;let a=i.slice(0,-s.length);if(!a||a.includes(";"))return;return{mediaType:a,base64Start:r+1,base64End:n}}function Ol(e,t,n={}){let o=n.maxEncodedBytes??fe,r=n.maxDecodedBytes??Se,i=new Set(n.supportedMediaTypes??_n),s=e?.toLowerCase(),a=Ml(t),{start:c,end:l}=a,d=$g(t,a.start,a.end);if(d){if(s&&s!==d.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${d.mediaType}`};s=d.mediaType,c=d.base64Start,l=d.base64End}if(!s||!i.has(s))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=l-c;if(p===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(p>o)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${o} byte encoded limit`};if(!Tr(t,c,l))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let m=t.slice(c,l),f=Sr(m);if(f>r)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${r} byte decoded limit`};return{ok:!0,mediaType:s,base64:m,encodedBytes:p,decodedBytes:f}}function Pt(e,t,n,o){let r=Ol(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!r.ok)return Sn(o,r.reason),r;let i=wt(r.encodedBytes,r.decodedBytes,n,o);if(i)return i;return r}function ae(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var Mt="ERROR: EMPTY CONTENT",Lg="[image attached]",Dg="[generated image]";function Bg(e){return`[generated ${e}]`}function Tn(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function Cr(e,t){let n=e[e.length-1];if(t.role==="tool"&&n?.role==="tool"&&Array.isArray(n.content)&&Array.isArray(t.content)){n.content.push(...t.content);return}e.push(t)}function Ug(e){if(!Array.isArray(e)||e.length===0)return!1;return e.every((t)=>{if(!t||typeof t!=="object")return!1;let n=t;if(n.type==="text")return typeof n.text==="string";if(n.type==="image")return typeof n.data==="string"&&typeof n.mediaType==="string";return!1})}function Le(){return{type:"text",text:We}}function zl(e){return wt(fe,0,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},e)===null}function $l(e){try{return new URL(e).protocol}catch{return}}function kr(e,t){let n=Pt(e.mediaType,e.data,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!n.ok)return Le();return Ll(n.base64,n.mediaType)}function Ll(e,t){return{type:"file",data:{type:"data",data:e},mediaType:t}}function Ye(e,t){return{type:"file",data:e,mediaType:t??"image"}}function Er(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let s=Pt(e.mediaType,e.image.href,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!s.ok)return Le();return Ye(`data:${s.mediaType};base64,${s.base64}`,s.mediaType)}if(e.image.protocol!=="http:"&&e.image.protocol!=="https:")return Le();if(!zl(t))return Le();return Ye(e.image,e.mediaType)}if(typeof e.image==="string"){let s=$l(e.image);if(s==="http:"||s==="https:"){if(!zl(t))return Le();return Ye(e.image,e.mediaType)}let a=s==="data:",c=Pt(e.mediaType??(a?void 0:"image/png"),e.image,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!c.ok)return Le();return Ye(a?`data:${c.mediaType};base64,${c.base64}`:c.base64,c.mediaType)}let n=e.image.byteLength,o=_r(n),r=e.mediaType?.toLowerCase()??"image/png";if(!_n.includes(r)||wt(o,n,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t))return Le();return Ye(e.image,r)}function Zg(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function Nl(e,t,n){if(!Zg(e,n))return Tn(e);if(e.modality==="image"){if(e.source.type==="artifact")return Tn(e);return Er({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return Tn(e);if(e.source.type==="url"){let o=$l(e.source.url);if(o!=="http:"&&o!=="https:"&&o!=="data:")return Tn(e)}return Ye(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function Rr(e,t,n,o){let{hoistImages:r,inlineImagePlaceholder:i}=o;if(e==null||typeof e!=="object")return{value:e,changed:!1,mediaChanged:!1};if(Array.isArray(e)){let d=[],p=!1,m=!1;for(let f of e){if(f&&typeof f==="object"){let y=f;if(y.type==="image"&&typeof y.data==="string"&&typeof y.mediaType==="string"){if(!r){d.push(i),p=!0,m=!0;continue}let S={type:"image",data:y.data,mediaType:y.mediaType},v=kr(S,n);if(v.type==="file")t.push({type:"image",data:v.data.data,mediaType:v.mediaType});else d.push(v.text);p=!0,m=!0;continue}if(y.type==="image"){d.push(We),p=!0,m=!0;continue}if(y.type==="text"&&typeof y.text==="string"){d.push(y.text),p=!0;continue}}let g=Rr(f,t,n,o);d.push(g.value),p||=g.changed,m||=g.mediaChanged}return{value:p?d:e,changed:p,mediaChanged:m}}let s=e;if(s.type==="image"){if(typeof s.data==="string"&&typeof s.mediaType==="string"){if(!r)return{value:i,changed:!0,mediaChanged:!0};let d={type:"image",data:s.data,mediaType:s.mediaType},p=kr(d,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:Lg,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:We,changed:!0,mediaChanged:!0}}let a={},c=!1,l=!1;for(let[d,p]of Object.entries(s)){let m=Rr(p,t,n,o);a[d]=m.value,c||=m.changed,l||=m.mediaChanged}return{value:c?a:e,changed:c,mediaChanged:l}}function Ot(e){if(typeof e==="string")return ae(e);if(Array.isArray(e))return e.map((t)=>Ot(t));if(e!==null&&typeof e==="object"){let t=e,n={};for(let[o,r]of Object.entries(t))n[o]=Ot(r);return n}return e}function Dl(e,t=!1,n=vn(),o){let r=o?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:ae(e)};if(!t&&Ug(e))return{type:"content",value:e.map((i)=>i.type==="image"?r?kr(i,n):{type:"text",text:Je}:{type:"text",text:ae(i.text)})};if(e!==null&&typeof e==="object"){let i=[],s=Rr(e,i,n,{hoistImages:!t&&r,inlineImagePlaceholder:r?We:Je});if(!t&&i.length>0)return{type:"content",value:[{type:"text",text:typeof s.value==="string"?ae(s.value):JSON.stringify(Ot(s.value))},...i.map((c)=>Ll(c.data,c.mediaType))]};if(s.mediaChanged)return{type:t?"error-json":"json",value:Ot(s.value)}}if(e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="object")return{type:t?"error-json":"json",value:Ot(e)};return{type:t?"error-text":"text",value:ae(String(e))}}function Fg(e,t,n){let o=n?.assistantToolCallArgKey??"input",r=n?.supportedInputModalities,i=!r||r.includes("image"),s=[],a=vn(),c=[],l=()=>c.splice(0).map((p)=>p.type==="image"?i?Er(p,a):{type:"text",text:Je}:Nl(p.media,a,r));if(typeof e==="string"&&e.trim().length>0||Array.isArray(e)&&e.length>0)s.push({role:"system",content:typeof e==="string"?ae(e):e});for(let d of t){let p=d.content;if(typeof p==="string"){let y=d.role==="user"&&c.length>0?l():[];if(y.length>0){s.push({role:d.role,content:[{type:"text",text:p.trim().length>0?ae(p):Mt},...y]});continue}if(p.trim().length===0){s.push({role:d.role,content:[{type:"text",text:Mt}]});continue}s.push({role:d.role,content:ae(p)});continue}let m=[],f=[];if(p.length===0){s.push({role:d.role,content:[{type:"text",text:Mt}]});continue}for(let y of p)switch(y.type){case"text":m.push({type:"text",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"reasoning":m.push({type:"reasoning",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"image":if(d.role==="assistant")c.push(y),m.push({type:"text",text:Dg});else m.push(i?Er(y,a):{type:"text",text:Je});break;case"media":if(d.role==="assistant")c.push(y),m.push({type:"text",text:Bg(y.media.modality)});else m.push(Nl(y.media,a,r));break;case"file":m.push({type:"text",text:yr(y.path,ae(y.content))});break;case"tool-call":if(d.role==="assistant")m.push({type:"tool-call",toolCallId:y.toolCallId,toolName:y.toolName,[o]:y.input,...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"tool-result":{f.push({type:"tool-result",toolCallId:y.toolCallId,toolName:y.toolName,output:Dl(y.output,y.isError??!1,a,{supportsImages:i})});break}}let g=f.length>0;if(d.role==="user"&&!g&&c.length>0)m.push(...l());if(m.length>0&&m.every((y)=>y.type==="text"&&typeof y.text==="string"&&y.text.trim().length===0))m.splice(0,m.length,{type:"text",text:Mt});if(m.length>0)Cr(s,{role:d.role,content:m});if(g)Cr(s,{role:"tool",content:f})}if(c.length>0)Cr(s,{role:"user",content:l()});return s}var Kv=["show","hide","subscription"];function Bl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Hg(e,t){if(!e&&!t)return;let n=e?.metadata,o=t?.metadata,r={...e??{},...t??{}};if(Bl(n)&&Bl(o))r.metadata={...n,...o};return r}var Yv=["web_search","image_generation"],Xv=["web_search"];var zt={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},jg=void 0;function Vg(e,t){if(typeof e==="string"&&e.toLowerCase()in zt)return e.toLowerCase();return t?void 0:void 0}function Ul(e,t){let n=typeof e==="string"?e.toLowerCase():void 0;if(n&&n in zt)return zt[n];if(t?.fallbackEffort)return zt[t.fallbackEffort];return}function qg(e){let t=Ul(e.effort,{fallbackEffort:e.fallbackEffort});if(t===void 0)return;if(t<=0)return 0;let n=e.minimumBudget??1;if(e.maxBudget<n)return;let o=e.scaleTokens??e.maxBudget;return Math.min(Math.max(Math.floor(o*t),n),e.maxBudget)}function Gg(e){return e instanceof Error?{name:e.name,message:e.message}:e}var Kg=3;function Zl(e){return Math.max(1,Math.ceil(e/3))}function Ar(e){let t=new WeakSet;try{return JSON.stringify(e,(n,o)=>{if(typeof o==="bigint")return o.toString();if(typeof o!=="object"||o===null)return o;if(t.has(o))return"[Circular]";return t.add(o),o})??""}catch{return String(e??"")}}function Wg(e){let t;try{t=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools})}catch{t=[Ar(e.systemPrompt),Ar(e.messages),Ar(e.tools)].join(`
|
|
61
|
-
`)}return
|
|
62
|
-
+`.includes(e)}function
|
|
63
|
-
+`.includes(e)}function
|
|
64
|
-
`||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function _e(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function
|
|
65
|
-
`,r:"\r",t:"\t"};function
|
|
66
|
-
`)t++;return!0}return!1}function
|
|
60
|
+
</file_content>`}function kg(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function Eg(e,t){return`<user_command slash="${t}">${e}</user_command>`}var Rg=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function Ag(e){let t=Rg.exec(e??"");return t?t[1]:void 0}function wg(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function Ig(){let e=null;return{record(t,n){if(t===n)return;if(e){e=e.from===n?null:{from:e.from,to:n};return}e={from:t,to:n}},consume(){let t=e;return e=null,t}}}function Pg(e,t){let n=e.trim(),r=new RegExp(`^<${t}\\b([^>]*)>([\\s\\S]*?)<\\/${t}>$`,"i").exec(n);if(!r)return;return{attrs:r[1]??"",content:r[2]??""}}function Mg(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function Sl(e){if(!e?.trim())return;let t=Pg(e,"user_command");if(!t)return;let n=Mg(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function _l(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let r=El(t,n);t=(r!==t?r:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function vl(e){if(!e?.trim())return"";return Og(e,"mode_notice").trim()}function Og(e,t){let n=`<${t}>`,r=`</${t}>`,o=e,i=o.indexOf(n);while(i!==-1){let s=o.indexOf(r,i+n.length);if(s===-1)break;o=o.slice(0,i)+o.slice(s+r.length),i=o.indexOf(n,i)}return o}function xo(e){let t=vl(_l(e)),n=Sl(e);if(!n)return t;if(n.slash.toLowerCase()==="team"){let o=t.toLowerCase().startsWith("spawn a team of agents for the following task:")?t.slice(46).trim():t;return o?`/team ${o}`:"/team"}return t?`/${n.slash} ${t}`:`/${n.slash}`}var Tl=240,Cl=480;function kl(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function zg(e){return kl(xo(e),Tl)}function Ng(e,t){let n=t?.trim()??"",r=e.toLowerCase(),o=r==="user"||r==="session"?xo(n):n;return kl(o,Cl)}function El(e,t){if(!e?.trim())return"";if(!t)return e;let n=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"g");return e.replace(n,"$1")}var We="[media omitted: invalid or exceeds size limit]",Je="[Image attached — this model cannot view images]",Rl=w(["image","audio","video","file"]),Al=ao("type",[b({type:V("base64"),data:d().min(1)}),b({type:V("url"),url:d().url().refine((e)=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Generated media URLs must use HTTP or HTTPS")}),b({type:V("artifact"),artifactId:d().min(1)})]);function wl(e){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";return"file"}var Il=b({id:d().min(1),modality:Rl,mediaType:d().min(1),source:Al,name:d().min(1).optional(),sizeBytes:x().int().nonnegative().optional()}).refine((e)=>wl(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function $g(e){return Il.safeParse(e).success}function Lg(e){return wl(e)}var vn=["image/png","image/jpeg","image/gif","image/webp"],So=5242880,fe=So,Se=6291456,Pl=8388608;function Dg(e){return e.length}function _o(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function Bg(e=So){return Math.floor(e*3/4)}function vo(e){return Math.ceil(e/3)*4}function To(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??fe,maxImageDecodedBytes:e.maxImageDecodedBytes??Se,maxTotalMediaBytes:e.maxTotalMediaBytes??Pl}}function Tn(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function _n(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function It(e,t,n,r){let o=To(n);if(e>o.maxImageEncodedBytes){let i={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${o.maxImageEncodedBytes} byte encoded limit`};return _n(r,i.reason),i}if(t>o.maxImageDecodedBytes){let i={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${o.maxImageDecodedBytes} byte decoded limit`};return _n(r,i.reason),i}if(r.totalEncodedBytes+e>o.maxTotalMediaBytes){let i={ok:!1,reason:"total_limit",message:`Image media exceeds the ${o.maxTotalMediaBytes} byte total media limit`};return _n(r,i.reason),i}return r.totalEncodedBytes+=e,r.keptImages+=1,null}function Ml(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function Ug(e){return e.length>0&&Co(e,0,e.length)}function Zg(e,t,n){let r=Ol(e),o=r.end-r.start;if(o===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let i=To(t);if(n.totalEncodedBytes+o>i.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${i.maxTotalMediaBytes} byte total media limit`};if(!Co(e,r.start,r.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let s=e.slice(r.start,r.end);return n.totalEncodedBytes+=o,{ok:!0,base64:s,encodedBytes:o,decodedBytes:_o(s)}}function Co(e,t,n){let r=n-t;if(r%4!==0)return!1;let o=n;if(r>=2&&e.charCodeAt(n-2)===61&&e.charCodeAt(n-1)===61)o-=2;else if(r>=1&&e.charCodeAt(n-1)===61)o-=1;for(let i=t;i<o;i++)if(!Ml(e.charCodeAt(i)))return!1;for(let i=o;i<n;i++)if(e.charCodeAt(i)!==61)return!1;return!0}function Fg(e,t,n){return n-t>=5&&(e.charCodeAt(t)|32)===100&&(e.charCodeAt(t+1)|32)===97&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===97&&e.charCodeAt(t+4)===58}function Ol(e){let t=0,n=e.length;while(t<n&&/\s/.test(e[t]??""))t+=1;while(n>t&&/\s/.test(e[n-1]??""))n-=1;return{start:t,end:n}}function Hg(e,t,n){if(!Fg(e,t,n))return;let r=t+5,o=e.indexOf(",",r);if(o===-1||o>=n)return;if(o-r>128)return;let i=e.slice(r,o).toLowerCase(),s=";base64";if(!i.endsWith(s))return;let a=i.slice(0,-s.length);if(!a||a.includes(";"))return;return{mediaType:a,base64Start:o+1,base64End:n}}function zl(e,t,n={}){let r=n.maxEncodedBytes??fe,o=n.maxDecodedBytes??Se,i=new Set(n.supportedMediaTypes??vn),s=e?.toLowerCase(),a=Ol(t),{start:c,end:u}=a,l=Hg(t,a.start,a.end);if(l){if(s&&s!==l.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${l.mediaType}`};s=l.mediaType,c=l.base64Start,u=l.base64End}if(!s||!i.has(s))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=u-c;if(p===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(p>r)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${r} byte encoded limit`};if(!Co(t,c,u))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let m=t.slice(c,u),f=_o(m);if(f>o)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${o} byte decoded limit`};return{ok:!0,mediaType:s,base64:m,encodedBytes:p,decodedBytes:f}}function Pt(e,t,n,r){let o=zl(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!o.ok)return _n(r,o.reason),o;let i=It(o.encodedBytes,o.decodedBytes,n,r);if(i)return i;return o}function ae(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var Mt="ERROR: EMPTY CONTENT",jg="[image attached]",Vg="[generated image]";function qg(e){return`[generated ${e}]`}function Cn(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function ko(e,t){let n=e[e.length-1];if(t.role==="tool"&&n?.role==="tool"&&Array.isArray(n.content)&&Array.isArray(t.content)){n.content.push(...t.content);return}e.push(t)}function Gg(e){if(!Array.isArray(e)||e.length===0)return!1;return e.every((t)=>{if(!t||typeof t!=="object")return!1;let n=t;if(n.type==="text")return typeof n.text==="string";if(n.type==="image")return typeof n.data==="string"&&typeof n.mediaType==="string";return!1})}function Le(){return{type:"text",text:We}}function Nl(e){return It(fe,0,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},e)===null}function Ll(e){try{return new URL(e).protocol}catch{return}}function Eo(e,t){let n=Pt(e.mediaType,e.data,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!n.ok)return Le();return Dl(n.base64,n.mediaType)}function Dl(e,t){return{type:"file",data:{type:"data",data:e},mediaType:t}}function Ye(e,t){return{type:"file",data:e,mediaType:t??"image"}}function Ro(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let s=Pt(e.mediaType,e.image.href,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!s.ok)return Le();return Ye(`data:${s.mediaType};base64,${s.base64}`,s.mediaType)}if(e.image.protocol!=="http:"&&e.image.protocol!=="https:")return Le();if(!Nl(t))return Le();return Ye(e.image,e.mediaType)}if(typeof e.image==="string"){let s=Ll(e.image);if(s==="http:"||s==="https:"){if(!Nl(t))return Le();return Ye(e.image,e.mediaType)}let a=s==="data:",c=Pt(e.mediaType??(a?void 0:"image/png"),e.image,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!c.ok)return Le();return Ye(a?`data:${c.mediaType};base64,${c.base64}`:c.base64,c.mediaType)}let n=e.image.byteLength,r=vo(n),o=e.mediaType?.toLowerCase()??"image/png";if(!vn.includes(o)||It(r,n,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t))return Le();return Ye(e.image,o)}function Kg(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function $l(e,t,n){if(!Kg(e,n))return Cn(e);if(e.modality==="image"){if(e.source.type==="artifact")return Cn(e);return Ro({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return Cn(e);if(e.source.type==="url"){let r=Ll(e.source.url);if(r!=="http:"&&r!=="https:"&&r!=="data:")return Cn(e)}return Ye(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function Ao(e,t,n,r){let{hoistImages:o,inlineImagePlaceholder:i}=r;if(e==null||typeof e!=="object")return{value:e,changed:!1,mediaChanged:!1};if(Array.isArray(e)){let l=[],p=!1,m=!1;for(let f of e){if(f&&typeof f==="object"){let y=f;if(y.type==="image"&&typeof y.data==="string"&&typeof y.mediaType==="string"){if(!o){l.push(i),p=!0,m=!0;continue}let S={type:"image",data:y.data,mediaType:y.mediaType},v=Eo(S,n);if(v.type==="file")t.push({type:"image",data:v.data.data,mediaType:v.mediaType});else l.push(v.text);p=!0,m=!0;continue}if(y.type==="image"){l.push(We),p=!0,m=!0;continue}if(y.type==="text"&&typeof y.text==="string"){l.push(y.text),p=!0;continue}}let g=Ao(f,t,n,r);l.push(g.value),p||=g.changed,m||=g.mediaChanged}return{value:p?l:e,changed:p,mediaChanged:m}}let s=e;if(s.type==="image"){if(typeof s.data==="string"&&typeof s.mediaType==="string"){if(!o)return{value:i,changed:!0,mediaChanged:!0};let l={type:"image",data:s.data,mediaType:s.mediaType},p=Eo(l,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:jg,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:We,changed:!0,mediaChanged:!0}}let a={},c=!1,u=!1;for(let[l,p]of Object.entries(s)){let m=Ao(p,t,n,r);a[l]=m.value,c||=m.changed,u||=m.mediaChanged}return{value:c?a:e,changed:c,mediaChanged:u}}function Ot(e){if(typeof e==="string")return ae(e);if(Array.isArray(e))return e.map((t)=>Ot(t));if(e!==null&&typeof e==="object"){let t=e,n={};for(let[r,o]of Object.entries(t))n[r]=Ot(o);return n}return e}function Bl(e,t=!1,n=Tn(),r){let o=r?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:ae(e)};if(!t&&Gg(e))return{type:"content",value:e.map((i)=>i.type==="image"?o?Eo(i,n):{type:"text",text:Je}:{type:"text",text:ae(i.text)})};if(e!==null&&typeof e==="object"){let i=[],s=Ao(e,i,n,{hoistImages:!t&&o,inlineImagePlaceholder:o?We:Je});if(!t&&i.length>0)return{type:"content",value:[{type:"text",text:typeof s.value==="string"?ae(s.value):JSON.stringify(Ot(s.value))},...i.map((c)=>Dl(c.data,c.mediaType))]};if(s.mediaChanged)return{type:t?"error-json":"json",value:Ot(s.value)}}if(e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="object")return{type:t?"error-json":"json",value:Ot(e)};return{type:t?"error-text":"text",value:ae(String(e))}}function Wg(e,t,n){let r=n?.assistantToolCallArgKey??"input",o=n?.supportedInputModalities,i=!o||o.includes("image"),s=[],a=Tn(),c=[],u=()=>c.splice(0).map((p)=>p.type==="image"?i?Ro(p,a):{type:"text",text:Je}:$l(p.media,a,o));if(typeof e==="string"&&e.trim().length>0||Array.isArray(e)&&e.length>0)s.push({role:"system",content:typeof e==="string"?ae(e):e});for(let l of t){let p=l.content;if(typeof p==="string"){let y=l.role==="user"&&c.length>0?u():[];if(y.length>0){s.push({role:l.role,content:[{type:"text",text:p.trim().length>0?ae(p):Mt},...y]});continue}if(p.trim().length===0){s.push({role:l.role,content:[{type:"text",text:Mt}]});continue}s.push({role:l.role,content:ae(p)});continue}let m=[],f=[];if(p.length===0){s.push({role:l.role,content:[{type:"text",text:Mt}]});continue}for(let y of p)switch(y.type){case"text":m.push({type:"text",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"reasoning":m.push({type:"reasoning",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"image":if(l.role==="assistant")c.push(y),m.push({type:"text",text:Vg});else m.push(i?Ro(y,a):{type:"text",text:Je});break;case"media":if(l.role==="assistant")c.push(y),m.push({type:"text",text:qg(y.media.modality)});else m.push($l(y.media,a,o));break;case"file":m.push({type:"text",text:bo(y.path,ae(y.content))});break;case"tool-call":if(l.role==="assistant")m.push({type:"tool-call",toolCallId:y.toolCallId,toolName:y.toolName,[r]:y.input,...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"tool-result":{f.push({type:"tool-result",toolCallId:y.toolCallId,toolName:y.toolName,output:Bl(y.output,y.isError??!1,a,{supportsImages:i})});break}}let g=f.length>0;if(l.role==="user"&&!g&&c.length>0)m.push(...u());if(m.length>0&&m.every((y)=>y.type==="text"&&typeof y.text==="string"&&y.text.trim().length===0))m.splice(0,m.length,{type:"text",text:Mt});if(m.length>0)ko(s,{role:l.role,content:m});if(g)ko(s,{role:"tool",content:f})}if(c.length>0)ko(s,{role:"user",content:u()});return s}var nT=["show","hide","subscription"];function Ul(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Jg(e,t){if(!e&&!t)return;let n=e?.metadata,r=t?.metadata,o={...e??{},...t??{}};if(Ul(n)&&Ul(r))o.metadata={...n,...r};return o}var iT=["web_search","image_generation"],sT=["web_search"];var zt={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},Yg=void 0;function Xg(e,t){if(typeof e==="string"&&e.toLowerCase()in zt)return e.toLowerCase();return t?void 0:void 0}function Zl(e,t){let n=typeof e==="string"?e.toLowerCase():void 0;if(n&&n in zt)return zt[n];if(t?.fallbackEffort)return zt[t.fallbackEffort];return}function Qg(e){let t=Zl(e.effort,{fallbackEffort:e.fallbackEffort});if(t===void 0)return;if(t<=0)return 0;let n=e.minimumBudget??1;if(e.maxBudget<n)return;let r=e.scaleTokens??e.maxBudget;return Math.min(Math.max(Math.floor(r*t),n),e.maxBudget)}function eh(e){return e instanceof Error?{name:e.name,message:e.message}:e}var th=3;function Fl(e){return Math.max(1,Math.ceil(e/3))}var Hl=1600;function jl(){let e=0;return{replacer:(n,r)=>{if(r===null||typeof r!=="object"||r.type!=="image")return r;let o=r;if(typeof o.data==="string")return e+=1,{...o,data:""};if("image"in o)return e+=1,{...o,image:""};return r},imageCount:()=>e}}function wo(e){let t=new WeakSet;try{return JSON.stringify(e,(n,r)=>{if(typeof r==="bigint")return r.toString();if(typeof r!=="object"||r===null)return r;if(t.has(r))return"[Circular]";return t.add(r),r})??""}catch{return String(e??"")}}function nh(e){let{replacer:t,imageCount:n}=jl(),r,o=0;try{r=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools},t),o=n()}catch{r=[wo(e.systemPrompt),wo(e.messages),wo(e.tools)].join(`
|
|
61
|
+
`)}return Fl(r.length)+o*Hl}var rh={debug:()=>{},log:()=>{},error:()=>{}};var pT=60,mT=1,fT=3600;function oh(e){return typeof e==="number"&&Number.isFinite(e)}function ih(e){return Math.min(Math.max(e,1),3600)}function gT(e){if(!oh(e))return 60;return ih(e)}function hT(e,t,n){let r=n?` (${n})`:"",o=Math.round(t/100)/10;return`MCP request to "${e}"${r} timed out after ${o}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function sh(e){if(e instanceof Error)return e.message;return String(e)}function ah(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return""}class we extends Error{constructor(e,t){super(`${e} at position ${t}`);this.position=t}}function Vl(e){return/^[0-9A-Fa-f]$/.test(e)}function ve(e){return e>="0"&&e<="9"}function ql(e){return e>=" "}function Qe(e){return`,:[]/{}()
|
|
62
|
+
+`.includes(e)}function Io(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"}function kn(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var Po=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Mo=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Oo(e){return`,[]/{}
|
|
63
|
+
+`.includes(e)}function zo(e){return et(e)||ch.test(e)}var ch=/^[[{\w-]$/;function No(e){return e===`
|
|
64
|
+
`||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function _e(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function Gl(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function Kl(e,t){let n=e.charCodeAt(t);return n===160||n===6158||n>=8192&&n<=8203||n===8239||n===8287||n===12288||n===65279}function et(e){return $o(e)||En(e)}function $o(e){return e==='"'||e==="“"||e==="”"}function Lo(e){return e==='"'}function En(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function Do(e){return e==="'"}function tt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=e.lastIndexOf(t);return r!==-1?e.substring(0,r)+(n?"":e.substring(r+1)):e}function ce(e,t){let n=e.length;if(!_e(e,n-1))return e+t;while(_e(e,n-1))n--;return e.substring(0,n)+t+e.substring(n)}function Wl(e,t,n){return e.substring(0,t)+e.substring(t+n)}function Jl(e){return/[,\n][ \t\r]*$/.test(e)}var uh={""":'"',"&":"&","<":"<",">":">","'":"'"},Bo=12;function Uo(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),r=uh[n];if(r!==void 0)return{char:r,length:n.length};if(e.charAt(1)==="#"){let o=e.substring(2,t),i=o.charAt(0)==="x"||o.charAt(0)==="X",s=i?o.substring(1):o;if(s.length>0){let a=Number.parseInt(s,i?16:10);if(!Number.isNaN(a)&&a>=0&&a<=1114111)return{char:String.fromCodePoint(a),length:n.length}}}return null}function Yl(e){return e!==null&&e.char==='"'}function Xl(e){return e!==null&&e.char==="'"}function Xe(e,t){let n=0;for(let r=0;r<e.length;r++)if(e.charAt(r)===t)n++;return n}function Ql(e,t){switch(t){case")":return Xe(e,"(")>Xe(e,")");case"]":return Xe(e,"[")>Xe(e,"]");case"}":return Xe(e,"{")>Xe(e,"}");default:return!1}}var ed={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},lh={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
65
|
+
`,r:"\r",t:"\t"};function Zo(e){let t=0,n="";if(u(["```","[```","{```"]),!i())Sp();u(["```","```]","```}"]);let o=p(",");if(o)s();if(zo(e[t])&&Jl(n)){if(!o)n=ce(n,",");v()}else if(o)n=tt(n,",");while(e[t]==="}"||e[t]==="]")t++,s();if(t>=e.length)return n;lt();function i(){s();let T=y()||S()||k()||R()||B()||J(!1)||Te();return s(),T}function s(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,C=t,O=a(T);do if(O=c(),O)O=a(T);while(O);return t>C}function a(T){let C=T?_e:Gl,O="";while(!0)if(C(e,t))O+=e[t],t++;else if(Kl(e,t))O+=" ",t++;else break;if(O.length>0)return n+=O,!0;return!1}function c(){if(e[t]==="/"&&e[t+1]==="*"){while(t<e.length&&!dh(e,t))t++;return t+=2,!0}if(e[t]==="/"&&e[t+1]==="/"){while(t<e.length&&e[t]!==`
|
|
66
|
+
`)t++;return!0}return!1}function u(T){if(l(T)){if(Io(e[t]))while(t<e.length&&kn(e[t]))t++;return s(),!0}return!1}function l(T){a(!0);for(let C of T){let O=t+C.length;if(e.slice(t,O)===C)return t=O,!0}return!1}function p(T){if(e[t]===T)return n+=e[t],t++,!0;return!1}function m(T){if(e[t]===T)return t++,!0;return!1}function f(){return m("\\")}function g(){if(s(),e[t]==="."&&e[t+1]==="."&&e[t+2]===".")return t+=3,s(),m(","),!0;return!1}function y(){if(e[t]==="{"){if(n+="{",t++,s(),m(","))s();let T=!0;while(t<e.length&&e[t]!=="}"){let C;if(!T){if(C=p(","),!C)n=ce(n,",");s()}else C=!0;if(g(),!(k()||J(!0))){if(e[t]==="}"||e[t]==="{"||e[t]==="]"||e[t]==="["||e[t]===void 0){if(!T)n=tt(n,",")}else _p();break}s();let he=p(":"),Be=t>=e.length;if(!he)if(zo(e[t])||Be)n=ce(n,":");else xi();if(!i())if(he||Be)n+="null";else xi();T=!1}if(e[t]==="}")n+="}",t++;else n=ce(n,"}");return!0}return!1}function S(){if(e[t]==="["){if(n+="[",t++,s(),m(","))s();let T=!0;while(t<e.length&&e[t]!=="]"){if(!T){if(!p(","))n=ce(n,",")}if(g(),!i()){if(!T)n=tt(n,",");break}T=!1}if(e[t]==="]")n+="]",t++;else n=ce(n,"]");return!0}return!1}function v(){let T=!0,C=!0;while(C){if(!T){if(!p(","))n=ce(n,",")}else T=!1;C=i()}if(!C)n=tt(n,",");n=`[
|
|
67
67
|
${n}
|
|
68
|
-
]`}function k(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,O=e[t]==="\\";if(O){if(t++,!et(e[t]))lt()}let he=e[t]==="&"?
|
|
69
|
-
`)L+="\\n",t+=2;else L+=H,t+=2}else{let H=e.charAt(t);if(H==='"'&&e[t-1]!=="\\")L+=`\\${H}`,t++;else if(
|
|
70
|
-
`;break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;case"0":n+="\x00";break;case"a":n+="\x07";break;case"e":n+=t==="core"?"\x1B":"e";break;default:n+=i}
|
|
68
|
+
]`}function k(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,O=e[t]==="\\";if(O){if(t++,!et(e[t]))lt()}let he=e[t]==="&"?Uo(e.slice(t,t+Bo)):null,Be=Yl(he)||Xl(he);if(et(e[t])||Be){let Si=Lo(e[t])?Lo:Do(e[t])?Do:En(e[t])?En:$o,Lt=t,Dt=n.length,L='"';t+=Be&&he?he.length:1;while(!0){if(t>=e.length){let H=Me(t-1);if(!T&&Qe(e.charAt(H)))return t=Lt,n=n.substring(0,Dt),k(!0);return L=ce(L,'"'),n+=L,!0}if(t===C)return L=ce(L,'"'),n+=L,!0;let ye=Be&&e[t]==="&"?Uo(e.slice(t,t+Bo)):null;if(ye&&he?ye.char===he.char:Si(e[t])){let H=t,Nn=L.length;if(L+='"',t+=ye?ye.length:1,n+=L,s(!1),T||t>=e.length||Qe(e[t])&&!Ql(L,e[t])||et(e[t])&&!ct(t)||ve(e[t]))return M(),!0;if(e[t]==="\\")lt();let Ce=Me(H-1),_i=e.charAt(Ce);if(_i===",")return t=Lt,n=n.substring(0,Dt),k(!1,Ce);if(Qe(_i))return t=Lt,n=n.substring(0,Dt),k(!0);n=n.substring(0,Dt),t=H+(ye?ye.length:1),L=`${L.substring(0,Nn)}\\${L.substring(Nn)}`}else if(T&&Oo(e[t])){if(e[t-1]===":"&&Po.test(e.substring(Lt+1,t+2)))while(t<e.length&&Mo.test(e[t]))L+=e[t],t++;return L=ce(L,'"'),n+=L,M(),!0}else if(ye){let H=ye.char;if(H==='"')L+="\\\"";else if(No(H))L+=ed[H];else L+=H;t+=ye.length}else if(e[t]==="\\"){let H=e.charAt(t+1);if(lh[H]!==void 0)L+=e.slice(t,t+2),t+=2;else if(H==="u"){let Ce=2;while(Ce<6&&Vl(e[t+Ce]))Ce++;if(Ce===6)L+=e.slice(t,t+6),t+=6;else if(t+Ce>=e.length)t=e.length;else vp()}else if(H===`
|
|
69
|
+
`)L+="\\n",t+=2;else L+=H,t+=2}else{let H=e.charAt(t);if(H==='"'&&e[t-1]!=="\\")L+=`\\${H}`,t++;else if(No(H))L+=ed[H],t++;else{if(!ql(H))zn(H);L+=H,t++}}if(O)f()}}return!1}function M(){let T=!1;s();while(e[t]==="+"){T=!0,t++,s(),n=tt(n,'"',!0);let C=n.length;if(k())n=Wl(n,C,1);else n=ce(n,'"')}return T}function R(){let T=t,C="",O=!1;if(e[t]==="-"){if(C+=e[t],t++,!ve(e[t])&&ut())C+="0"}if(e[t]==="0"&&ve(e[t+1]))O=!0;while(ve(e[t]))C+=e[t],t++;if(e[t]==="."){if(C===""||C==="-")C+="0";if(C+=e[t],t++,!ve(e[t]))C+="0";while(ve(e[t]))C+=e[t],t++}if(t>T){if(e[t]==="e"||e[t]==="E"){if(C==="-")O=!0;if(C+=e[t],t++,e[t]==="-"||e[t]==="+")C+=e[t],t++;if(!ve(e[t]))C+="0";while(ve(e[t]))C+=e[t],t++}if(!ut())return t=T,!1;return n+=O?`"${e.substring(T,t)}"`:C,!0}return!1}function B(){return A("true","true")||A("false","false")||A("null","null")||A("True","true")||A("False","false")||A("None","null")}function A(T,C){if(e.slice(t,t+T.length)===T&&!kn(e[t+T.length]))return n+=C,t+=T.length,!0;return!1}function J(T){let C=t;if(Io(e[t])){while(t<e.length&&kn(e[t]))t++;let O=t;while(_e(e,O))O++;if(e[O]==="("){if(t=O+1,i(),e[t]===")"){if(t++,e[t]===";")t++}return!0}}while(t<e.length&&!Oo(e[t])&&!et(e[t])&&(!T||e[t]!==":"))t++;if(e[t-1]===":"&&Po.test(e.substring(C,t+2)))while(t<e.length&&Mo.test(e[t]))t++;if(t>C){while(_e(e,t-1)&&t>0)t--;let O=e.slice(C,t);if(n+=O==="undefined"?"null":JSON.stringify(O),e[t]==='"')t++;return!0}}function Te(){if(e[t]==="/"){let T=t;t++;while(t<e.length&&(e[t]!=="/"||e[t-1]==="\\"))t++;return t++,n+=JSON.stringify(e.substring(T,t)),!0}}function Me(T){let C=T;while(C>0&&_e(e,C))C--;return C}function ct(T){let C=T+1;while(C<e.length&&_e(e,C))C++;return C>=e.length||Qe(e[C])}function ut(){return t>=e.length||Qe(e[t])||_e(e,t)}function zn(T){throw new we(`Invalid character ${JSON.stringify(T)}`,t)}function lt(){throw new we(`Unexpected character ${JSON.stringify(e[t])}`,t)}function Sp(){throw new we("Unexpected end of json string",e.length)}function _p(){throw new we("Object key expected",t)}function xi(){throw new we("Colon expected",t)}function vp(){let T=e.slice(t,t+6);throw new we(`Invalid unicode character "${T}"`,t)}}function dh(e,t){return e[t]==="*"&&e[t+1]==="/"}function ph(e){let t=!1,n=!1,r=!1;for(let o=0;o<e.length;o+=1){let i=e[o];if(r){r=!1;continue}if(i==="\\"){r=!0;continue}if(!n&&i==='"')t=!t;else if(!t&&i==="'")n=!n}return t||n}var mh=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function fh(e){let t=e.match(mh);if(!t)return;let[,n,r]=t,o=r.trim();if(!o)return;let i=o[0];if(i==='"'||i==="{"||i==="["||o==="true"||o==="false"||o==="null"||Number.isFinite(Number(o)))return;return JSON.parse(`{"${n}":${JSON.stringify(o)}}`)}function gh(e){if(typeof e!=="string")return e;let t=e.trimStart();if(t[0]!=="{"&&t[0]!=="[")return e;try{return JSON.parse(t)}catch{}if(!ph(t))try{return JSON.parse(Zo(t))}catch{}return fh(t)??e}function hh(e){let t=new WeakSet;try{return JSON.stringify(e,(r,o)=>{if(typeof o==="bigint")return o.toString();if(o&&typeof o==="object"){if(t.has(o))return"[Circular]";t.add(o)}return o})??"null"}catch{return String(e)}}function yh(e){try{return JSON.parse(e)}catch{return}}function nt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function bh(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function Fo(e,t){if(bh(e).includes(t))return!0;for(let r of["anyOf","oneOf","allOf"]){let o=e[r];if(Array.isArray(o)&&o.some((i)=>nt(i)&&Fo(i,t)))return!0}return!1}function xh(e,t){if(typeof e!=="string")return e;let n=e.trim(),r=Fo(t,"array"),o=Fo(t,"object");if((!r||!n.startsWith("["))&&(!o||!n.startsWith("{")))return e;try{let i=JSON.parse(n);if(Array.isArray(i))return r?i:e;if(nt(i))return o?i:e;return e}catch{return e}}function Ho(e,t){let n=xh(e,t);if(Array.isArray(n)){let s=t.items;if(!nt(s))return n;let a=!1,c=n.map((u)=>{let l=Ho(u,s);return a||=l!==u,l});return a?c:n}if(!nt(n))return n;let r=t.properties;if(!nt(r))return n;let o=!1,i={...n};for(let[s,a]of Object.entries(r)){if(!(s in n)||!nt(a))continue;let c=Ho(n[s],a);if(c!==n[s])i[s]=c,o=!0}return o?i:n}function Sh(e){if(typeof globalThis.atob==="function")try{let t=globalThis.atob(e),n=Uint8Array.from(t,(r)=>r.charCodeAt(0));return new TextDecoder().decode(n)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(e,"base64").toString("utf8")}catch{return null}return null}function _h(e){let t=e?.trim();if(!t)return null;try{let n=t.split(".");if(n.length!==3)return null;let r=n[1];if(!r)return null;let o=r.replace(/-/g,"+").replace(/_/g,"/"),i=o.padEnd(o.length+(4-o.length%4)%4,"="),s=Sh(i);return s?JSON.parse(s):null}catch{return null}}function vh(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}import Th from"node:path";function Ch(e){return e.split(Th.sep).join("/")}function td(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function kh(e){return e==="win32"?"powershell":"/bin/bash"}function jo(e){let t=td(e);if(rt(e)!==void 0)return"powershell";if(t==="cmd"||t==="cmd.exe")return"cmd";if(t==="wsl"||t==="wsl.exe")return"wsl";return"posix"}var Eh=new Set(["-nologo","-noninteractive","-noprofile"]),Rh="-noprofile";function Ah(e,t){let n="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="`"&&r+1<e.length){let i=e[r+1];if(i==="u"&&t==="core"&&e[r+2]==="{"){let s=e.indexOf("}",r+3),a=s>r+3?e.slice(r+3,s):"",c=Number.parseInt(a,16);if(a.length<=6&&/^[0-9a-fA-F]+$/.test(a)&&c<=1114111){n+=String.fromCodePoint(c),r=s;continue}}switch(i){case"n":n+=`
|
|
70
|
+
`;break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;case"0":n+="\x00";break;case"a":n+="\x07";break;case"e":n+=t==="core"?"\x1B":"e";break;default:n+=i}r++;continue}if(o==='"'&&e[r+1]==='"'){n+='"',r++;continue}n+=o}return n}function wh(e){let t=e[0];if(t!=="'"&&t!=='"')return;for(let n=1;n<e.length;n++){let r=e[n];if(t==='"'&&r==="`"){n++;continue}if(r===t){if(e[n+1]===t){n++;continue}if(e.slice(n+1).trim()!=="")return;return{quote:t,body:e.slice(1,n)}}}return}function rt(e){let t=td(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function Ih(e,t){let n=wh(e);if(!n)return;let r=(n.quote==="'"?n.body.replaceAll("''","'"):Ah(n.body,t)).trim();return r.length>0?r:void 0}function Ph(e,t){let n=/^[ \t]*(?:&[ \t]*(?:"([^"$`]*)"|'((?:[^']|'')*)')|(?:&[ \t]*)?([^\s$`"';&|<>(){}#@,]+))[ \t]+([\S\s]*)$/.exec(e);if(!n)return;let r=n[1]??n[2]?.replaceAll("''","'")??n[3],o=rt(t);if(!o||!rt(r))return;let i=n[4],s=!1;for(;;){let a=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(i);if(!a)return;let c=a[1].toLowerCase();if(c==="-command"){let u=s?Ih(a[2],o):void 0;return u===void 0?void 0:{executable:r,script:u}}if(!Eh.has(c))return;if(c===Rh)s=!0;i=a[2]}}function Mh(e,t){if(!/[\\/:]/.test(t)&&rt(t)===rt(e))return e;return t}function nd(e,t){switch(jo(e)){case"powershell":{let n={executable:e,script:t};for(;;){let r=Ph(n.script,n.executable);if(!r)break;n={executable:Mh(e,r.executable),script:r.script}}return{executable:n.executable,args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$ErrorActionPreference='Stop';$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:n.script}}case"cmd":return{executable:e,args:["/d","/s","/c",t]};case"wsl":return{executable:e,args:["bash","-c",t]};case"posix":return{executable:e,args:["-c",t]}}}function Oh(e,t){if(jo(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return nd(e,t).args}function zh(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function Nh(e){let t=e?.trim();return t?t:void 0}function rd(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function $h(e,t="/",n=100){if(!e||e.length<=n)return e||"";let r=e.split(t)?.shift()?.trim()?.slice(0,n-1);return r?`${r}…`:rd(e,n)}function Lh(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function Dh(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Bh(e){if(!e)return"(unknown-date)";let t=new Date(e);if(Number.isNaN(t.getTime()))return e;return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function Uh(e){let t=Math.max(0,Math.floor(e/1000)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),i=t%60;if(n>0)return`${n}d ${r}h`;if(r>0)return`${r}h ${o}m`;if(o>0)return`${o}m ${i}s`;return`${i}s`}function Zh(e,t){let n=e.safeParse(t);if(!n.success)throw Error(Hi(n.error));return n.data}function Vo(e){return _u(e)}function qo(e){return e==="cline"||e==="cline-pass"}var od=`You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.
|
|
71
71
|
|
|
72
72
|
Always gather all the necessary context before starting to work on a task. For example, if you are generating a unit test or new code, make sure you understand the requirement, the naming conventions, frameworks and libraries used and aligned in the current codebase, and the environment and commands used to run and test the code etc. Always validate the new unit test at the end including running the code if possible for live feedback.
|
|
73
73
|
Review each question carefully and answer it with detailed, accurate information.
|
|
@@ -102,7 +102,7 @@ When you have completed the task, please provide a summary of what you did and a
|
|
|
102
102
|
|
|
103
103
|
If user asked a simple question without any coding context, answer it directly without using any tools.
|
|
104
104
|
{{CLINE_RULES}}
|
|
105
|
-
{{CLINE_METADATA}}`;var
|
|
105
|
+
{{CLINE_METADATA}}`;var id=`You are Cline, a careful and helpful coding agent that works in the background.
|
|
106
106
|
You are tasked to solve an issue reported by the user who you cannot communicate with directly.
|
|
107
107
|
Your goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.
|
|
108
108
|
|
|
@@ -141,9 +141,9 @@ IMPORTANT:
|
|
|
141
141
|
- When you call 'submit_and_exit', set 'verified' to true only if your tool output shows the requirements are met; otherwise set it to false.
|
|
142
142
|
- Response without the submit_and_exit tool call will considered not completed and the task will continue.
|
|
143
143
|
{{CLINE_RULES}}
|
|
144
|
-
{{CLINE_METADATA}}`;var
|
|
144
|
+
{{CLINE_METADATA}}`;var Go={ACT:od,YOLO:id};var Ko="# Workspace Configuration",ad=`# Plan / Act Modes
|
|
145
145
|
|
|
146
|
-
User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,
|
|
146
|
+
User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,cd=`# Plan Mode
|
|
147
147
|
|
|
148
148
|
You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
|
|
149
149
|
|
|
@@ -154,37 +154,37 @@ You are in Plan mode. Your role is to explore, analyze, and plan -- not to execu
|
|
|
154
154
|
- Do NOT edit files, write code, run destructive commands, or make any changes
|
|
155
155
|
- Do NOT implement anything -- focus on understanding and alignment first
|
|
156
156
|
|
|
157
|
-
The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,
|
|
157
|
+
The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,ud=`${cd}
|
|
158
158
|
|
|
159
|
-
Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,
|
|
159
|
+
Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,ld=`${cd}
|
|
160
160
|
|
|
161
|
-
Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function
|
|
162
|
-
${
|
|
163
|
-
${
|
|
161
|
+
Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function Fh(e){let t=e.indexOf("://");if(t<1)return e;let n=t+3,r=n;while(r<e.length){let i=e[r];if(i==="/"||i==="?"||i==="#"||i.charCodeAt(0)<=32)break;r++}let o=e.lastIndexOf("@",r-1);if(o<n)return e;return e.slice(0,n)+e.slice(o+1)}function Hh(e){return JSON.stringify({workspaces:{[e.rootPath]:{hint:e.hint,associatedRemoteUrls:e.associatedRemoteUrls?.map(Fh),latestGitCommitHash:e.latestGitCommitHash,latestGitBranchName:e.latestGitBranchName}}},null,2)}function sd(e,t,n){if(n?.trim()?.includes(Ko))return n.trim();let r=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
|
|
162
|
+
${Ko}
|
|
163
|
+
${r}`}function jh(e){let{ide:t="Terminal Shell",mode:n,platform:r="unknown",workspaceName:o,metadata:i,rules:s,overridePrompt:a,providerId:c,planModeSwitchTool:u=!0}=e,l=e.workspaceRoot??e.rootPath??"",p=qo(c||"");if(a?.trim()){let g=a.trim();if(p&&i?.trim()&&!g.includes(Ko))return`${g}
|
|
164
164
|
|
|
165
|
-
${
|
|
165
|
+
${sd(l,o,i)}`.trim();return g}let m=n==="yolo"?Go.YOLO:Go.ACT,f=[s,n==="yolo"?void 0:ad,n==="plan"?u?ud:ld:void 0].filter(Boolean).join(`
|
|
166
166
|
|
|
167
|
-
`);return m.replace("{{PLATFORM_NAME}}",
|
|
168
|
-
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery){if(this.service==="s3"&&!v.has("X-Amz-Expires"))v.set("X-Amz-Expires","86400");v.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),v.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),v.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(M){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");if(!g)this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/");this.encodedPath=
|
|
167
|
+
`);return m.replace("{{PLATFORM_NAME}}",r).replace("{{CWD}}",l).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?sd(l,o,i):"").replace("{{CLINE_RULES}}",f).trim()}function Vh(e){return e?.metadata?.apiKeyOptional===!0}function qh(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var Gh="anthropic/claude-sonnet-5.5";import ge from"node:fs/promises";import Wo from"node:path";async function Kh(e){try{return await ge.access(e),!0}catch{return!1}}class Jo{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await ge.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await ge.mkdir(Wo.dirname(this.filePath),{recursive:!0}),await ge.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await ge.rm(this.filePath,{force:!0})}}class Rn{async writeText(e,t){await ge.mkdir(Wo.dirname(e),{recursive:!0}),await ge.writeFile(e,t,"utf8")}async remove(e){await ge.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Kh(e))return;let t=await ge.readdir(e);await Promise.all(t.map((n)=>ge.rm(Wo.join(e,n),{recursive:!0,force:!0})))}}import{createHmac as Xh}from"node:crypto";import{basename as Qh}from"node:path";var Xo=new TextEncoder,Wh={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},Jh=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class An{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:o,cache:i,retries:s,initRetryMs:a}){if(e==null)throw TypeError("accessKeyId is a required option");if(t==null)throw TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=r,this.region=o,this.cache=i||new Map,this.retries=s!=null?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){let{method:o,url:i,headers:s,body:a}=e;if(t=Object.assign({method:o,url:i,headers:s},t),t.body==null&&s.has("Content-Type"))t.body=a!=null&&s.has("X-Amz-Content-Sha256")?a:await e.clone().arrayBuffer();e=i}let n=new fd(Object.assign({url:e.toString()},t,this,t&&t.aws)),r=Object.assign({},t,await n.sign());delete r.aws;try{return new Request(r.url.toString(),r)}catch(o){if(o instanceof TypeError)return new Request(r.url.toString(),Object.assign({duplex:"half"},r));throw o}}async fetch(e,t){for(let n=0;n<=this.retries;n++){let r=fetch(await this.sign(e,t));if(n===this.retries)return r;let o=await r;if(o.status<500&&o.status!==429)return o;await new Promise((i)=>setTimeout(i,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class fd{constructor({method:e,url:t,headers:n,body:r,accessKeyId:o,secretAccessKey:i,sessionToken:s,service:a,region:c,cache:u,datetime:l,signQuery:p,appendSessionToken:m,allHeaders:f,singleEncode:g}){if(t==null)throw TypeError("url is a required option");if(o==null)throw TypeError("accessKeyId is a required option");if(i==null)throw TypeError("secretAccessKey is a required option");this.method=e||(r?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=r,this.accessKeyId=o,this.secretAccessKey=i,this.sessionToken=s;let y,S;if(!a||!c)[y,S]=Yh(this.url,this.headers);if(this.service=a||y||"",this.region=c||S||"us-east-1",this.cache=u||new Map,this.datetime=l||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=p,this.appendSessionToken=m||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256"))this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let v=this.signQuery?this.url.searchParams:this.headers;if(v.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)v.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((M)=>f||!Jh.has(M)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((M)=>M+":"+(M==="host"?this.url.host:(this.headers.get(M)||"").replace(/\s+/g," "))).join(`
|
|
168
|
+
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery){if(this.service==="s3"&&!v.has("X-Amz-Expires"))v.set("X-Amz-Expires","86400");v.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),v.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),v.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(M){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");if(!g)this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/");this.encodedPath=md(this.encodedPath);let k=new Set;this.encodedSearch=[...this.url.searchParams].filter(([M])=>{if(!M)return!1;if(this.service==="s3"){if(k.has(M))return!1;k.add(M)}return!0}).map((M)=>M.map((R)=>md(encodeURIComponent(R)))).sort(([M,R],[B,A])=>M<B?-1:M>B?1:R<A?-1:R>A?1:0).map((M)=>M.join("=")).join("&")}async sign(){if(this.signQuery){if(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken)this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)}else this.headers.set("Authorization",await this.authHeader());return{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join(),n=this.cache.get(t);if(!n){let r=await Nt("AWS4"+this.secretAccessKey,e),o=await Nt(r,this.region),i=await Nt(o,this.service);n=await Nt(i,"aws4_request"),this.cache.set(t,n)}return Yo(await Nt(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Yo(await dd(await this.canonicalString()))].join(`
|
|
169
169
|
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
|
|
170
170
|
`,this.signedHeaders,await this.hexBodyHash()].join(`
|
|
171
|
-
`)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!=="string"&&!("byteLength"in this.body))throw Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=
|
|
172
|
-
`),c=`/${e}${
|
|
173
|
-
`),
|
|
171
|
+
`)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!=="string"&&!("byteLength"in this.body))throw Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=Yo(await dd(this.body||""))}return e}}async function Nt(e,t){let n=await crypto.subtle.importKey("raw",typeof e==="string"?Xo.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,Xo.encode(t))}async function dd(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?Xo.encode(e):e)}var pd=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Yo(e){let t=new Uint8Array(e),n="";for(let r=0;r<t.length;r++){let o=t[r];n+=pd[o>>>4&15],n+=pd[o&15]}return n}function md(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function Yh(e,t){let{hostname:n,pathname:r}=e;if(n.endsWith(".on.aws")){let a=n.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return a!=null?["lambda",a[1]||""]:["",""]}if(n.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(n.endsWith(".backblazeb2.com")){let a=n.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return a!=null?["s3",a[1]||""]:["",""]}let o=n.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),i=o&&o[1]||"",s=o&&o[2];if(s==="us-gov")s="us-gov-west-1";else if(s==="s3"||s==="s3-accelerate")s="us-east-1",i="s3";else if(i==="iot")if(n.startsWith("iot."))i="execute-api";else if(n.startsWith("data.jobs.iot."))i="iot-jobs-data";else i=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(i==="autoscaling"){let a=(t.get("X-Amz-Target")||"").split(".")[0];if(a==="AnyScaleFrontendService")i="application-autoscaling";else if(a==="AnyScaleScalingPlannerFrontendService")i="autoscaling-plans"}else if(s==null&&i.startsWith("s3-"))s=i.slice(3).replace(/^fips-|^external-1/,""),i="s3";else if(i.endsWith("-fips"))i=i.slice(0,-5);else if(s&&/-\d$/.test(i)&&!/-\d$/.test(s))[i,s]=[s,i];return[Wh[i]||i,s||""]}var hd="enterprise.blobUpload",wn=new Map;function Qo(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function yd(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function ey(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return Qo("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return Qo("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return Qo("azure",e.azureAccessSettings);return}function bd(e){return ey(e?.enterpriseTelemetry?.promptUploading)}function ty(e,t){let n=bd(e);if(!n)return;return{version:1,storage:yd(n),userDistinctId:t}}function ny(e,t,n){let r=bd(t);if(!r){wn.delete(e);return}return wn.set(e,r),{version:1,storage:yd(r),userDistinctId:n}}function ry(e){wn.delete(e)}function xd(e,t,n){let r=`${t}/${n}`;return{async write(o,i){let s=await e.fetch(`${r}/${o}`,{method:"PUT",body:i,headers:{"Content-Type":"application/json; charset=utf-8"}});if(!s.ok)throw Error(`Failed to write ${o}: ${s.status}`)}}}function oy(e){let{bucket:t,accessKeyId:n,secretAccessKey:r}=e;if(!t||!n||!r)return;let o=e.region||"us-east-1",i=e.endpoint||`https://s3.${o}.amazonaws.com`;return xd(new An({region:o,accessKeyId:n,secretAccessKey:r}),i,t)}function iy(e){let{accountId:t,endpoint:n,bucket:r,accessKeyId:o,secretAccessKey:i}=e;if(!n&&!t||!r||!o||!i)return;return xd(new An({accessKeyId:o,secretAccessKey:i}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,r)}function sy(e,t,n,r,o){let i=o["Content-Length"]||"",s=o["Content-Type"]||"",a=Object.entries(o).filter(([m])=>m.toLowerCase().startsWith("x-ms-")).sort(([m],[f])=>m.toLowerCase().localeCompare(f.toLowerCase())).map(([m,f])=>`${m.toLowerCase()}:${f}`).join(`
|
|
172
|
+
`),c=`/${e}${r}`,u=[n,"","",i,"",s,"","","","","","",a,c].join(`
|
|
173
|
+
`),l=Buffer.from(t,"base64"),p=Xh("sha256",l).update(u,"utf8").digest("base64");return`SharedKey ${e}:${p}`}function ay(e){let{accessKeyId:t,secretAccessKey:n,bucket:r}=e;if(!t||!n||!r)return;let o=e.endpoint||`https://${t}.blob.core.windows.net`;return{async write(i,s){let a=`/${r}/${i}`,c=new Date().toUTCString(),u=Buffer.from(s,"utf8"),l={"x-ms-date":c,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":u.byteLength.toString()};l.Authorization=sy(t,n,"PUT",a,l);let p=await fetch(`${o}${a}`,{method:"PUT",body:u,headers:l});if(!p.ok){let m=await p.text().catch(()=>"");throw Error(`Failed to write ${i}: ${p.status} ${m}`.trim())}}}}function cy(e){if(e.adapterType==="s3")return oy(e);if(e.adapterType==="r2")return iy(e);if(e.adapterType==="azure")return ay(e);return}function gd(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Sd(e){let t=e?.metadata?.[hd];if(!gd(t))return;let n=t.storage;if(!gd(n))return;let r=n.adapterType;if(r!=="s3"&&r!=="r2"&&r!=="azure")return;if(typeof n.bucket!=="string")return;return{version:1,storage:{adapterType:r,bucket:n.bucket,region:typeof n.region==="string"?n.region:void 0,endpoint:typeof n.endpoint==="string"?n.endpoint:void 0,accountId:typeof n.accountId==="string"?n.accountId:void 0},keyPrefix:typeof t.keyPrefix==="string"?t.keyPrefix:void 0,userDistinctId:typeof t.userDistinctId==="string"?t.userDistinctId:void 0}}function uy(e,t,n){return["sessions",n.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":Qh(t)].filter((i)=>Boolean(i?.trim())).join("/")}function ly(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:n,contents:r,row:o}){let i=Sd(o);if(!i)return;let s=wn.get(t);if(!s)return;let a=JSON.stringify(s),c=e.get(a);if(!c){if(c=cy(s),!c)return;e.set(a,c)}await c.write(uy(t,n,i),r)}}}function ei(e,t,n){return{id:`remote-config:${e}:${n}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var dy="remote://";function _d(e){let t="",n=!1;for(let r of e.trim().toLowerCase()){let o=r.charCodeAt(0);if(o>=97&&o<=122||o>=48&&o<=57||r==="."||r==="_"||r==="-"){if(n&&t&&t[t.length-1]!=="-")t+="-";n=!1,t+=r}else n=!0;if(t.length>=80)break}while(t.endsWith("-"))t=t.slice(0,-1);while(t.startsWith("-"))t=t.slice(1);return t||"item"}function py(e){let t=e?.globalRules?.map((r,o)=>ei("rule",r,`${o}`))??[],n=e?.globalWorkflows?.map((r,o)=>ei("workflow",r,`${o}`))??[];return[...t,...n]}function my(e){return[...py(e.remoteConfig),...e.managedInstructions??[]]}function fy(e){return e.map((t)=>{let n=`## ${t.name}`,r=t.alwaysEnabled?`_Always enabled_
|
|
174
174
|
`:"";return`${n}
|
|
175
175
|
|
|
176
|
-
${
|
|
176
|
+
${r}${t.contents.trim()}`}).join(`
|
|
177
177
|
|
|
178
|
-
`)}function ei(e,t){return e.filter((n)=>n.kind===t)}class ti{async materialize(e){let t=sy(e.bundle),n=ei(t,"rule"),o=ei(t,"workflow"),r=ei(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let i=[];if(n.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,ay(n)),i.push(...n.map((s)=>({kind:s.kind,filePath:e.paths.rulesFilePath,id:s.id,name:s.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let s of o){let a=`${e.paths.workflowsPath}/${bd(s.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}for(let s of r){let a=`${e.paths.skillsPath}/${bd(s.name)}/SKILL.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:i},null,2)),{paths:e.paths,rulesFilePath:n.length>0?e.paths.rulesFilePath:void 0,files:i}}}import rt from"node:path";var cy="remote-config";function ni(e){let t=e.pluginName??cy,n=rt.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:n,workflowsPath:rt.join(n,"workflows"),skillsPath:rt.join(n,"skills"),bundleCachePath:rt.join(n,"cache","bundle.json"),manifestPath:rt.join(n,"managed.json"),rulesFilePath:rt.join(n,"rules.md")}}function xd(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function uy(e){if(!e)return;return{enabled:e.openTelemetryEnabled??!1,metricsExporter:e.openTelemetryMetricsExporter,logsExporter:e.openTelemetryLogsExporter,otlpProtocol:e.openTelemetryOtlpProtocol,otlpEndpoint:e.openTelemetryOtlpEndpoint,otlpHeaders:e.openTelemetryOtlpHeaders,otlpMetricsProtocol:e.openTelemetryOtlpMetricsProtocol,otlpMetricsEndpoint:e.openTelemetryOtlpMetricsEndpoint,otlpMetricsHeaders:e.openTelemetryOtlpMetricsHeaders,otlpLogsProtocol:e.openTelemetryOtlpLogsProtocol,otlpLogsEndpoint:e.openTelemetryOtlpLogsEndpoint,otlpLogsHeaders:e.openTelemetryOtlpLogsHeaders,metricExportInterval:e.openTelemetryMetricExportInterval,otlpInsecure:e.openTelemetryOtlpInsecure,logBatchSize:e.openTelemetryLogBatchSize,logBatchTimeout:e.openTelemetryLogBatchTimeout,logMaxQueueSize:e.openTelemetryLogMaxQueueSize}}function _d(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function we(e,t){let n=e[t];return typeof n==="string"?n:void 0}function Sd(e,t){let n=e[t];return typeof n==="boolean"?n:void 0}function In(e,t){let n=e[t];return typeof n==="number"&&Number.isFinite(n)?n:void 0}function oi(e,t){let n=e[t];if(!_d(n))return;let o=Object.entries(n).filter((r)=>typeof r[1]==="string");return o.length>0?Object.fromEntries(o):void 0}function ly(e){if(!_d(e))return;let t={enabled:Sd(e,"enabled"),metricsExporter:we(e,"metricsExporter"),logsExporter:we(e,"logsExporter"),otlpProtocol:we(e,"otlpProtocol"),otlpEndpoint:we(e,"otlpEndpoint"),otlpHeaders:oi(e,"otlpHeaders"),otlpMetricsProtocol:we(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:we(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:oi(e,"otlpMetricsHeaders"),otlpLogsProtocol:we(e,"otlpLogsProtocol"),otlpLogsEndpoint:we(e,"otlpLogsEndpoint"),otlpLogsHeaders:oi(e,"otlpLogsHeaders"),metricExportInterval:In(e,"metricExportInterval"),otlpInsecure:Sd(e,"otlpInsecure"),logBatchSize:In(e,"logBatchSize"),logBatchTimeout:In(e,"logBatchTimeout"),logMaxQueueSize:In(e,"logMaxQueueSize")};return Object.values(t).some((n)=>n!==void 0)?t:void 0}class ri{name="remote-config";resolveTelemetry(e,t){return{...uy(e.remoteConfig),...ly(e.telemetry)}}}async function dy(e){let t=ni(e),n=e.artifactStore??new En;await n.removeChildren(t.workflowsPath),await n.removeChildren(t.skillsPath),await n.remove(t.rulesFilePath),await n.remove(t.manifestPath),await n.remove(t.bundleCachePath)}function vd(e){return e?.claims}function Td(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function py(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class Cd{options;constructor(e){this.options=e}async sync(e){let t=await this.options.controlPlane.fetchBundle({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger});if(!t)throw Error("Remote config control plane returned no bundle");await this.options.bundleStore.write(t);let n=await this.options.materializer.materialize({bundle:t,paths:e.paths,artifactStore:this.options.artifactStore}),o=this.options.telemetryAdapter?await this.options.telemetryAdapter.resolveTelemetry(t,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger}):void 0,r=vd(t),i=Td(r,this.options);return{bundle:t,materialized:n,telemetry:o,roles:i,claims:r}}}function my(e){let t=e?.name??"remote-config";return{name:t,manifest:{capabilities:["providers"]},async setup(n,o){n.registerProvider?.({name:t,description:"Remote-config managed runtime integration"}),await e?.setup?.(n,o)}}}async function fy(e){let t=ni({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new Wr(t.bundleCachePath),o=e.artifactStore??new En,r=e.materializer??new ti,i=e.telemetryAdapter??new ri,s,a,c=[],l,d=!1,p=!1;if(e.controlPlane){let f=new Cd({controlPlane:e.controlPlane,bundleStore:n,artifactStore:o,materializer:r,telemetryAdapter:i,claimsMapper:e.claimsMapper,logger:e.logger});try{let g=await f.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});s=g.bundle,a=g.telemetry,c=g.roles,l=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)s=await n.read(),d=Boolean(s);if(!s)throw g}}else if(e.useCachedBundle!==!1)s=await n.read(),d=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let f=py(s,t);if(await n.write(f),!p)await r.materialize({bundle:f,paths:t,artifactStore:o});l??=vd(f),c=c.length>0?c:Td(l,e),a??=await i.resolveTelemetry(f,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),s=f}let m=xd(t);return{pluginName:t.pluginName,pluginDefinition:my({name:t.pluginName}),paths:t,bundle:s,telemetry:a,roles:c,claims:l,usedCachedBundle:d,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}var kd=b({id:u(),temperature:x().optional(),maxTokens:x().optional(),contextWindow:x().optional(),inputPrice:x().optional(),outputPrice:x().optional(),supportsImages:w().optional()}),Ed=b({models:E(kd).optional(),openAiBaseUrl:u().optional(),openAiHeaders:j(u(),u()).optional(),azureApiVersion:u().optional(),azureIdentity:w().optional()}),Rd=b({id:u(),thinkingBudgetTokens:x().optional()}),Ad=b({name:u(),baseModelId:u(),thinkingBudgetTokens:x().optional()}),Id=b({models:E(Rd).optional(),customModels:E(Ad).optional(),awsRegion:u().optional(),awsUseCrossRegionInference:w().optional(),awsUseGlobalInference:w().optional(),awsBedrockUsePromptCache:w().optional(),awsBedrockEndpoint:u().optional()}),wd=b({id:u()}),Pd=b({models:E(wd).optional()}),Md=b({id:u(),thinkingBudgetTokens:x().optional()}),Od=b({models:E(Md).optional(),vertexProjectId:u().optional(),vertexRegion:u().optional()}),zd=b({id:u(),thinkingBudgetTokens:x().optional(),promptCachingEnabled:w().optional()}),Nd=b({models:E(zd).optional(),baseUrl:u().optional()}),$d=b({id:u(),thinkingBudgetTokens:x().optional()}),Ld=b({models:E($d).optional(),baseUrl:u().optional()}),gy=b({OpenAiCompatible:Ed.optional(),AwsBedrock:Id.optional(),Cline:Pd.optional(),Vertex:Od.optional(),LiteLLM:Nd.optional(),Anthropic:Ld.optional()}),Dd=b({id:u()}),Bd=b({name:u(),url:u(),alwaysEnabled:w().optional(),headers:j(u(),u()).optional()}),ii=b({alwaysEnabled:w(),name:u(),contents:u()}),wn=b({bucket:u(),accessKeyId:u(),secretAccessKey:u(),region:u().optional(),endpoint:u().optional(),accountId:u().optional()}),Ud=b({enabled:w().optional(),type:Ge([V("s3_access_keys"),V("r2_access_keys"),V("azure_access_keys")]).optional(),s3AccessSettings:wn.optional(),r2AccessSettings:wn.optional(),azureAccessSettings:wn.optional()}),Zd=b({promptUploading:Ud.optional()}),hy=b({version:u(),providerSettings:gy.optional(),telemetryEnabled:w().optional(),kanbanEnabled:w().optional(),mcpMarketplaceEnabled:w().optional(),allowedMCPServers:E(Dd).optional(),remoteMCPServers:E(Bd).optional(),blockPersonalRemoteMCPServers:w().optional(),yoloModeAllowed:w().optional(),openTelemetryEnabled:w().optional(),openTelemetryMetricsExporter:u().optional(),openTelemetryLogsExporter:u().optional(),openTelemetryOtlpProtocol:u().optional(),openTelemetryOtlpEndpoint:u().optional(),openTelemetryOtlpHeaders:j(u(),u()).optional(),openTelemetryOtlpMetricsProtocol:u().optional(),openTelemetryOtlpMetricsEndpoint:u().optional(),openTelemetryOtlpMetricsHeaders:j(u(),u()).optional(),openTelemetryOtlpLogsProtocol:u().optional(),openTelemetryOtlpLogsEndpoint:u().optional(),openTelemetryOtlpLogsHeaders:j(u(),u()).optional(),openTelemetryMetricExportInterval:x().optional(),openTelemetryOtlpInsecure:w().optional(),openTelemetryLogBatchSize:x().optional(),openTelemetryLogBatchTimeout:x().optional(),openTelemetryLogMaxQueueSize:x().optional(),enterpriseTelemetry:Zd.optional(),globalRules:E(ii).optional(),globalWorkflows:E(ii).optional()}),yy=j(u(),u());var by=25463,xy=25466,Sy=4317;var _y="127.0.0.1:4317";var vy=I(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),Ty=I(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Cy=I(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var ky="runtime.team.progress.v1",Ey="runtime.team.lifecycle.v1";import{basename as Ry}from"node:path";var Pn="CLINE_BUILD_ENV",Fd="CLINE_DEBUG_HOST",Hd="CLINE_DEBUG_PORT_BASE";function jd(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function Ay(e){for(let t=0;t<e.length;t+=1){let n=e[t]?.trim();if(!n)continue;if(n==="--conditions"&&e[t+1]?.trim()==="development")return!0;if(n.startsWith("--conditions=")&&n.slice(13).split(",").map((o)=>o.trim()).includes("development"))return!0}return!1}function Iy(e){if(!e?.trim())return!1;let t=Ry(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function wy(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function Py(e){return e.some((t)=>t==="--enable-source-maps")}function My(e){return e[Fd]?.trim()||"127.0.0.1"}function Oy(e){let t=e[Hd]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function zy(e){switch(e){case"rpc":return 0;case"hook":return 1;case"plugin-sandbox":return 2;case"connector":return 3;case"sandbox":return 4;default:return 9}}function si(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,o=jd(t[Pn]);if(o)return o;let r=t.NODE_ENV?.trim().toLowerCase();if(r==="production")return"production";if(r==="development")return"development";return Ay(n)?"development":"production"}function Ny(e=process.env,t={}){if(jd(e[Pn]))return e;return{...e,[Pn]:si({env:e,execArgv:t.execArgv})}}function $y(e,t={}){if(e.length===0||!Iy(e[0]))return[...e];if(si(t)!=="development")return[...e];let n=t.env??process.env,o=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],r=[];if(!wy(o)){let i=My(n),s=Oy(n),a=s===void 0?0:s+zy(t.debugRole);r.push(`--inspect=${i}:${a}`)}if(!Py(o))r.push("--enable-source-maps");return[e[0],...r,...e.slice(1)]}function Ly(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function Vd(){return globalThis}function Dy(e){Vd().__clineClientIdentity=e}function By(){return Vd().__clineClientIdentity}var Uy="CLINE_ENVIRONMENT",Zy="CLINE_ENVIRONMENT_OVERRIDE",ai={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},Fy="production";function qd(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function Gd(){if(typeof process>"u"||!process?.env)return{};return process.env}function Kd(){let e=Gd();return qd(e.CLINE_ENVIRONMENT_OVERRIDE)??qd(e.CLINE_ENVIRONMENT)??"production"}function Hy(e){if(typeof e==="string")return ai[e];return ai[Kd()]}function jy(e,t){if(t.CLINE_API_BASE_URL)e={...e,apiBaseUrl:t.CLINE_API_BASE_URL,mcpBaseUrl:`${t.CLINE_API_BASE_URL}/v1/mcp`};return e}function Vy(e){let t=Hy(e);return jy(t,Gd())}var qy="CLINE_RUN_AS_HUB_DAEMON",Gy="CLINE_CONNECTOR_CLI_LAUNCH",Ky="CLINE_CONNECTOR_STARTING_INSTANCE",Wy="CLINE_CONNECTOR_SUPERVISED",ci;function Jy(e=process.env){return ci=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,ci}function Yy(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return ci??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function Xy(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var ui;function Qy(e=process.env){return ui=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,ui}function eb(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return ui??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function tb(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function nb(e=process.env){let t=e.CLINE_CONNECTOR_STARTING_INSTANCE;if(!t)return;try{let n=JSON.parse(t);if(typeof n.channel!=="string"||!n.channel.trim()||typeof n.instanceId!=="string"||!n.instanceId.trim())return;return{channel:n.channel,instanceId:n.instanceId}}catch{return}}function ob(e=process.env){let t=e.CLINE_CONNECTOR_CLI_LAUNCH;if(!t)return;try{let n=JSON.parse(t);if(typeof n.launcher!=="string"||!n.launcher.trim()||!Array.isArray(n.connectArgsPrefix)||!n.connectArgsPrefix.every((o)=>typeof o==="string")||typeof n.cwd!=="string"||!n.cwd.trim())return;return{launcher:n.launcher,connectArgsPrefix:n.connectArgsPrefix,cwd:n.cwd}}catch{return}}var rb=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],Jd=["localhost","127.0.0.1","::1","[::1]"];function ib(e){for(let t of rb){let n=e[t]?.trim();if(n)return n}return}function li(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function sb(e,t){let n=[],o=new Set;for(let r of[...li(e),...li(t),...Jd]){let i=r.toLowerCase();if(i!=="*"&&!o.has(i))o.add(i),n.push(r)}return n.join(",")}function Wd(e){return li(e).includes("*")}function ab(e=process.env){if(!ib(e))return;let t=Wd(e.NO_PROXY),n=Wd(e.no_proxy);if(t&&n)return;let o=sb(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=o;if(!n)e.no_proxy=o}var cb="NoDefaultCurrentDirectoryInExePath";function ub(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var lb="agent.reasoning.unexpected_tokens",db="task.provider_request_started",pb="task.provider_stream_started",mb="task.first_chunk_received",fb="task.provider_stream_failed",gb="task.cancelled",hb="task.max_tokens_recovery",yb=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],bb="sdk.error";var De=new Map;function xb(){De.clear()}function Sb(e,t){let n=typeof t.error_message==="string"?t.error_message:"";return[e,t.component,t.operation,t.error_type,t.error_code??"",t.error_status??"",n.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function _b(e){let t=Date.now(),n=De.get(e);if(n&&t-n.startMs<3600000){if(n.emitted<5)return n.emitted+=1,{emit:!0,suppressed:0};return n.suppressed+=1,{emit:!1,suppressed:n.suppressed}}let o=n?.suppressed??0;if(De.delete(e),De.size>=512){let r=De.keys().next();if(!r.done)De.delete(r.value)}return De.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:o}}function vb(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:pi({sessionId:t.sessionId,agentId:t.agentId,runId:t.runId,iteration:t.iteration,providerId:t.providerId,modelId:t.modelId,requestedThinking:t.requestedThinking,reasoningTokenCount:t.reasoningTokenCount})})}function Tb(e,t){if(!e)return;e.capture({event:t.event,properties:pi({sessionId:t.sessionId,ulid:t.ulid??t.sessionId,agentId:t.agentId,conversationId:t.conversationId,runId:t.runId,iteration:t.iteration,provider:t.providerId,providerId:t.providerId,model:t.modelId,modelId:t.modelId,phase:t.phase,durationMs:t.durationMs,eventType:t.eventType,...t.error===void 0?{}:mi(t.error,t.messageLimit),error_class:t.errorClass})})}function Cb(e,t){if(!e)return!1;let n=t.event??"sdk.error",o=Yd(t),r=0;try{let i=_b(Sb(n,o));if(!i.emit)return!0;r=i.suppressed}catch{}return e.capture({event:n,properties:r>0?{...o,suppressed_count:r}:o}),!0}function Yd(e){return pi({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...mi(e.error,e.messageLimit,e.errorMessage)})}function pi(e){let t={};for(let[n,o]of Object.entries(e))if(o!==void 0)t[n]=o;return t}function mi(e,t=500,n){let o=Rb(e)?e:void 0,r=e instanceof Error?e:void 0,i=$t(n)??$t(r?.message)??$t(o?.message)??Ab(e)??"Unknown error",s=Ib(o?.code),a=di(o?.status)??di(o?.statusCode)??di(o?.responseStatus);return{error_type:r?.name?.trim()||$t(o?.name)||r?.constructor?.name||"Error",error_message:Eb(kb(i),t),...s!==void 0?{error_code:s}:{},...a!==void 0?{error_status:a}:{}}}function kb(e){return e.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function Eb(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function Rb(e){return typeof e==="object"&&e!==null}function $t(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function Ab(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:$t(t)}function Ib(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function di(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var fi="_clineOtlpTraceRelay";function wb(e){e[fi]=!0}function Pb(e){return!!e&&typeof e==="object"&&e[fi]===!0}function Xd(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let o=n.indexOf("=");if(o<=0)return;try{let r=decodeURIComponent(n.substring(0,o).trim()),i=decodeURIComponent(n.substring(o+1).trim());if(!r||!i)return;t[r]=i}catch{}}),t}function Mb(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?Xd(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function Qd(e={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...e}}function Ob(e={}){return{...Mb(),...e,metadata:Qd(e.metadata)}}function ep(e){let t=e?.trim();return t?t:void 0}function zb(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let o=ep(n.rootSessionId);if(!o)return;return{rootSessionId:o}}function Nb(e){return ep(e?.rootSessionId)}import{webcrypto as tp}from"node:crypto";var $b=128,Pe,it;function Lb(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Pe||Pe.length<e)Pe=Buffer.allocUnsafe(e*$b),tp.getRandomValues(Pe),it=0;else if(it+e>Pe.length)tp.getRandomValues(Pe),it=0}catch(t){throw Pe=void 0,t}it+=e}function Db(e){return Lb(e|=0),Pe.subarray(it-e,it)}function Bb(e,t,n){let o=256-256%e.length;if(o===256){let i=e.length-1;return(s=t)=>{if(!s)return"";let a="";while(!0){let c=n(s),l=s;while(l--)if(a+=e[c[l]&i],a.length>=s)return a}}}let r=Math.ceil(409.6*t/o);return(i=t)=>{if(!i)return"";let s="";while(!0){let a=n(r),c=r;while(c--)if(a[c]<o){if(s+=e[a[c]%e.length],s.length>=i)return s}}}}function np(e,t=21){return Bb(e,t,Db)}function Ub(e="",t=""){let n=np("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var Zb=["idle","running","pending","completed","failed","cancelled"];var gi=["rules","skills","workflows","plugins","hooks"],op=gi,Fb=new Set(gi);function rp(e){return typeof e==="string"&&Fb.has(e)}function Hb(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(rp);return[...new Set(t)]}function jb(e,t){return new Set(e??op).has(t)}var Vb=b({rootPath:u().min(1),hint:u().min(1).optional(),associatedRemoteUrls:E(u().min(1)).optional(),latestGitCommitHash:u().min(1).optional(),latestGitBranchName:u().min(1).optional()}),qb=b({currentWorkspacePath:u().min(1).optional(),workspaces:j(u().min(1),Vb)});function jC(){return{workspaces:{}}}function VC(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return qb.parse(n)}var Gb="workspaces",Kb="chat";function Wb(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),o=t.startsWith("/");if(!n&&!o)return!1;let r=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),i=r.at(-1)??"",s=r.at(-2)??"",a=r.at(-3)??"";return(r.at(-4)??"")===".cline"&&a==="data"&&s==="workspaces"&&i==="chat"}var Jb=["current_state","boundary_analysis","interface_proposal"],WC=3600000,JC=240,YC=400,le=Gu((e)=>e instanceof Date?e.toISOString():e,u().datetime()),st=I(["pending","in_progress","blocked","completed"]),ip=I(["queued","running","completed","failed","cancelled","interrupted"]),Mn=I(["draft","in_review","finalized"]),Yb=b({agentId:u(),role:I(["lead","teammate"]),description:u().optional(),status:I(["idle","running","stopped"])}),XC=b({agentId:u(),rolePrompt:u(),modelId:u().optional(),maxIterations:x().optional()});function Z(e){return Gu((t)=>t===null?void 0:t,e.optional())}var QC=b({agentId:u().min(1).describe("Teammate identifier"),rolePrompt:u().min(1).describe("System prompt describing teammate role")}).strict(),ek=b({agentId:u().min(1).describe("Teammate identifier"),reason:Z(u().min(1)).describe("Optional shutdown reason")}),tk=b({}),Xb={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},nk={create:["status","taskId","summary","reason"]},ok=b({action:I(["create","list","claim","complete","block"]),title:Z(u().min(1)).describe("Task title"),description:Z(u().min(1)).describe("Task details"),dependsOn:Z(E(u().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:Z(u().min(1)).describe("Optional assignee"),status:Z(I(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:Z(u()).describe("Task ID"),summary:Z(u().min(1)).describe("Completion summary"),reason:Z(u().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of Xb[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),rk=b({agentId:u().describe("Teammate agent ID"),task:u().min(1).describe("Task instructions for the teammate"),taskId:Z(u()).describe("Optional shared task list ID"),runMode:Z(I(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:Z(w()).describe("If true, continue the teammate conversation; otherwise start fresh")}),ik=b({status:Z(I(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:Z(u().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:Z(w()).describe("Include completed/failed runs (default true)")}),sk=b({runId:u().min(1).describe("Run ID"),reason:Z(u().min(1)).describe("Optional cancellation reason")}),ak=b({runId:Z(u().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),ck=b({toAgentId:u().min(1).describe("Recipient agent ID"),subject:u().min(1).describe("Message subject"),body:u().min(1).describe("Message body"),taskId:Z(u().min(1)).describe("Optional task ID context")}),uk=b({subject:u().min(1).describe("Message subject"),body:u().min(1).describe("Message body"),taskId:Z(u().min(1)).describe("Optional task ID context")}),lk=b({unreadOnly:Z(w()).describe("Only unread messages for read action (default true)")}),dk=b({kind:I(["progress","handoff","blocked","decision","done","error"]),summary:u().min(1).describe("Update summary"),taskId:Z(u().min(1)).describe("Optional task ID context"),evidence:Z(E(u().min(1))).describe("Optional evidence links/snippets"),nextAction:Z(u().min(1)).describe("Planned next step")}),pk=b({}),mk=b({title:u().describe("Outcome title"),requiredSections:E(u()).default(Jb).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),fk=b({outcomeId:u().describe("Outcome ID"),section:u().describe("Section name"),sourceRunId:Z(u()).describe("Optional source run ID"),content:u().describe("Section fragment content")}),gk=b({fragmentId:u().describe("Fragment ID"),approved:w().describe("Review decision")}),hk=b({outcomeId:u().describe("Outcome ID")}),yk=b({}),bk=b({teamId:u(),teamName:u(),members:E(Yb),taskCounts:j(st,x()),unreadMessages:x(),missionLogEntries:x(),activeRuns:x(),queuedRuns:x(),outcomeCounts:j(Mn,x())}),Qb=b({id:u(),title:u(),description:u(),status:st,createdAt:le,updatedAt:le,createdBy:u(),assignee:u().optional(),dependsOn:E(u()),summary:u().optional(),isReady:w(),blockedBy:E(u())}),xk=ar("action",[b({action:V("create"),taskId:u(),status:st,ignoredFields:E(u()).optional(),note:u().optional()}),b({action:V("list"),tasks:E(Qb)}),b({action:V("claim"),taskId:u(),status:st,nextStep:u()}),b({action:V("complete"),taskId:u(),status:st}),b({action:V("block"),taskId:u(),status:st})]),Sk=b({agentId:u(),mode:I(["sync","async"]),status:I(["dispatched","running","queued","joined"]),dispatched:w(),message:u(),deduped:w().optional(),runId:u().optional(),text:u().optional(),iterations:x().optional()}),ex=b({textPreview:u(),iterations:x(),finishReason:u(),durationMs:x(),usage:b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()})}),_k=b({id:u(),agentId:u(),taskId:u().optional(),status:ip,messagePreview:u(),priority:x(),retryCount:x(),maxRetries:x(),nextAttemptAt:le.optional(),continueConversation:w().optional(),startedAt:le,endedAt:le.optional(),leaseOwner:u().optional(),heartbeatAt:le.optional(),lastProgressAt:le.optional(),lastProgressMessage:u().optional(),currentActivity:u().optional(),error:u().optional(),resultSummary:ex.optional()}),vk=b({id:u(),teamId:u(),fromAgentId:u(),toAgentId:u(),subject:u(),body:u(),taskId:u().optional(),sentAt:le,readAt:le.optional()}),Tk=b({id:u(),teamId:u(),title:u(),status:Mn,requiredSections:E(u()),createdBy:u(),createdAt:le,finalizedAt:le.optional()}),Ck=b({outcomeId:u(),status:Mn,requiredSections:E(u())}),kk=b({agentId:u(),status:u()}),Ek=b({runId:u(),status:ip}),Rk=b({id:u(),toAgentId:u()}),Ak=b({delivered:x()}),Ik=b({id:u()}),wk=b({status:u()}),Pk=b({fragmentId:u(),status:u()}),Mk=b({outcomeId:u(),status:Mn});var tx;((R)=>{R.TaskStart="task_start";R.TaskEnd="task_end";R.AgentEvent="agent_event";R.TeammateSpawned="teammate_spawned";R.TeammateShutdown="teammate_shutdown";R.TeamTaskUpdated="team_task_updated";R.TeamMessage="team_message";R.TeamMissionLog="team_mission_log";R.TeamTaskCompleted="team_task_completed";R.RunStarted="run_started";R.RunQueued="run_queued";R.RunProgress="run_progress";R.RunCompleted="run_completed";R.RunFailed="run_failed";R.RunCancelled="run_cancelled";R.RunInterrupted="run_interrupted";R.OutcomeCreated="outcome_created";R.OutcomeFragmentAttached="outcome_fragment_attached";R.OutcomeFragmentReviewed="outcome_fragment_reviewed";R.OutcomeFinalized="outcome_finalized"})(tx||={});function nx(e){let{$schema:t,...n}=e;if(typeof n.type==="string")return n;if("properties"in n||"required"in n||"additionalProperties"in n)return{type:"object",...n};for(let o of["oneOf","anyOf","allOf"]){let r=n[o];if(!Array.isArray(r)||r.length===0)continue;if(o==="allOf"){if(r.some((a)=>a&&typeof a==="object"&&a.type==="object"))return{type:"object",...n};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(r.every((s)=>s&&typeof s==="object"&&s.type==="object"))return{type:"object",...n};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${o}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return n}function ox(e){let t=nx(e.inputSchema instanceof N?jr(e.inputSchema):e.inputSchema);return{name:e.name,resultPolicy:e.resultPolicy,description:e.description,inputSchema:t,lifecycle:e.lifecycle,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var sp=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function rx(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return sp.some((n)=>t.includes(n))}import{existsSync as ix,mkdirSync as sx,readFileSync as ax,writeFileSync as cx}from"node:fs";import{dirname as ux,resolve as lx}from"node:path";var dx=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),px=["id","balance","cost","secret"];function mx(e){let t=e.toLowerCase();if(dx.has(t))return!0;for(let n of px){if(t===n)return!0;if(t.endsWith(n)&&t.length>n.length){let o=t[t.length-n.length-1];if(o==="_"||o==="-")return!0;let r=e[e.length-n.length];if(r&&r===r.toUpperCase()&&r!==r.toLowerCase())return!0}if(t.endsWith(`_${n}`))return!0}return!1}var fx=[{pattern:/AKIA[A-Z0-9]{16}/g,replacement:"AKIA_REDACTED"},{pattern:/\/Users\/[A-Za-z0-9._-]+/g,replacement:"/Users/REDACTED_USER"},{pattern:/\/home\/[A-Za-z0-9._-]+/g,replacement:"/home/REDACTED_USER"}];function cp(e){let t=e;for(let{pattern:n,replacement:o}of fx)t=t.replace(n,o);return t}function hi(e){if(Array.isArray(e))return e.map(hi);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>gx(t,n)).map(([t,n])=>[t,hi(n)]))}function gx(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function ap(e){return JSON.stringify(hi(e))}var hx=[{pattern:/tasks\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+\/api_conversation_history/g,replacement:"tasks/usr-test/taskid/api_conversation_history"},{pattern:/\/(org|usr|mbr|ses|gen|req|msg|tsk|sch|exe|srv|cli|wkr|evt|sub|tkn)-[A-Za-z0-9]{10,}(?=[/?#]|$)/g,replacement:"/$1-REDACTED"}];function yi(e){let t=e;for(let{pattern:n,replacement:o}of hx)t=t.replace(n,o);return t}function at(e){if(e===null||e===void 0)return e;if(typeof e==="string"){try{let t=JSON.parse(e);if(typeof t==="object"&&t!==null)return JSON.stringify(at(t))}catch{}return cp(e)}if(Array.isArray(e))return e.map(at);if(typeof e==="object"){let t={};for(let[n,o]of Object.entries(e))if(mx(n)&&(typeof o==="string"||typeof o==="number"))t[n]="REDACTED";else t[n]=at(o);return t}return e}function yx(e){let t=new URLSearchParams(e),n=Array.from(t.entries());if(n.length===0||n.some(([r])=>r.length===0))return;let o={};for(let[r,i]of n){let s=o[r];if(s===void 0)o[r]=i;else if(Array.isArray(s))s.push(i);else o[r]=[s,i]}return o}function bx(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function up(e,t){try{return ap(at(JSON.parse(e)))}catch{if(bx(t)){let n=yx(e);if(n)return ap(at(n))}return cp(e)}}function xx(e,t){let n={...e},o=t&&e.body!==void 0?up(e.body,e.requestContentType):void 0;if(delete n.body,delete n.requestContentType,o!==void 0)n.requestBody=o;if(typeof n.path==="string")n.path=yi(n.path);if(n.response!==void 0)n.response=at(n.response);return n}function lp(e){try{let t=new URL(e),n=`${t.protocol}//${t.host}`,o=t.pathname+t.search;return{scope:n,path:o}}catch{return{scope:"",path:e}}}function dp(e){if(typeof e==="string")return e;if(e instanceof URL)return e.toString();if(e&&typeof e.url==="string")return e.url;return String(e)}function pp(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function Sx(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function mp(e,t){let n=Sx(t?.headers);if(n)return n;if(t?.body instanceof URLSearchParams)return"application/x-www-form-urlencoded;charset=UTF-8";if(e instanceof Request)return e.headers.get("content-type")??void 0;return}async function fp(e,t){if(t?.body){if(typeof t.body==="string")return t.body;if(t.body instanceof URLSearchParams)return t.body.toString();if(t.body instanceof ArrayBuffer)return new TextDecoder().decode(t.body);if(ArrayBuffer.isView(t.body))return new TextDecoder().decode(new Uint8Array(t.body.buffer,t.body.byteOffset,t.body.byteLength));return}if(e instanceof Request)try{return await e.clone().text()}catch{return}return}function _x(e){if(!e)return null;if(!process.env.CLINE_VCR_CASSETTE)return process.stderr.write(`[VCR] No CLINE_VCR_CASSETTE: requests will not be recorded or played back.
|
|
178
|
+
`)}function ti(e,t){return e.filter((n)=>n.kind===t)}class ni{async materialize(e){let t=my(e.bundle),n=ti(t,"rule"),r=ti(t,"workflow"),o=ti(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let i=[];if(n.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,fy(n)),i.push(...n.map((s)=>({kind:s.kind,filePath:e.paths.rulesFilePath,id:s.id,name:s.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let s of r){let a=`${e.paths.workflowsPath}/${_d(s.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}for(let s of o){let a=`${e.paths.skillsPath}/${_d(s.name)}/SKILL.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:i},null,2)),{paths:e.paths,rulesFilePath:n.length>0?e.paths.rulesFilePath:void 0,files:i}}}import ot from"node:path";var gy="remote-config";function ri(e){let t=e.pluginName??gy,n=ot.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:n,workflowsPath:ot.join(n,"workflows"),skillsPath:ot.join(n,"skills"),bundleCachePath:ot.join(n,"cache","bundle.json"),manifestPath:ot.join(n,"managed.json"),rulesFilePath:ot.join(n,"rules.md")}}function vd(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function hy(e){if(!e)return;return{enabled:e.openTelemetryEnabled??!1,metricsExporter:e.openTelemetryMetricsExporter,logsExporter:e.openTelemetryLogsExporter,otlpProtocol:e.openTelemetryOtlpProtocol,otlpEndpoint:e.openTelemetryOtlpEndpoint,otlpHeaders:e.openTelemetryOtlpHeaders,otlpMetricsProtocol:e.openTelemetryOtlpMetricsProtocol,otlpMetricsEndpoint:e.openTelemetryOtlpMetricsEndpoint,otlpMetricsHeaders:e.openTelemetryOtlpMetricsHeaders,otlpLogsProtocol:e.openTelemetryOtlpLogsProtocol,otlpLogsEndpoint:e.openTelemetryOtlpLogsEndpoint,otlpLogsHeaders:e.openTelemetryOtlpLogsHeaders,metricExportInterval:e.openTelemetryMetricExportInterval,otlpInsecure:e.openTelemetryOtlpInsecure,logBatchSize:e.openTelemetryLogBatchSize,logBatchTimeout:e.openTelemetryLogBatchTimeout,logMaxQueueSize:e.openTelemetryLogMaxQueueSize}}function Cd(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ie(e,t){let n=e[t];return typeof n==="string"?n:void 0}function Td(e,t){let n=e[t];return typeof n==="boolean"?n:void 0}function In(e,t){let n=e[t];return typeof n==="number"&&Number.isFinite(n)?n:void 0}function oi(e,t){let n=e[t];if(!Cd(n))return;let r=Object.entries(n).filter((o)=>typeof o[1]==="string");return r.length>0?Object.fromEntries(r):void 0}function yy(e){if(!Cd(e))return;let t={enabled:Td(e,"enabled"),metricsExporter:Ie(e,"metricsExporter"),logsExporter:Ie(e,"logsExporter"),otlpProtocol:Ie(e,"otlpProtocol"),otlpEndpoint:Ie(e,"otlpEndpoint"),otlpHeaders:oi(e,"otlpHeaders"),otlpMetricsProtocol:Ie(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:Ie(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:oi(e,"otlpMetricsHeaders"),otlpLogsProtocol:Ie(e,"otlpLogsProtocol"),otlpLogsEndpoint:Ie(e,"otlpLogsEndpoint"),otlpLogsHeaders:oi(e,"otlpLogsHeaders"),metricExportInterval:In(e,"metricExportInterval"),otlpInsecure:Td(e,"otlpInsecure"),logBatchSize:In(e,"logBatchSize"),logBatchTimeout:In(e,"logBatchTimeout"),logMaxQueueSize:In(e,"logMaxQueueSize")};return Object.values(t).some((n)=>n!==void 0)?t:void 0}class ii{name="remote-config";resolveTelemetry(e,t){return{...hy(e.remoteConfig),...yy(e.telemetry)}}}async function by(e){let t=ri(e),n=e.artifactStore??new Rn;await n.removeChildren(t.workflowsPath),await n.removeChildren(t.skillsPath),await n.remove(t.rulesFilePath),await n.remove(t.manifestPath),await n.remove(t.bundleCachePath)}function kd(e){return e?.claims}function Ed(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function xy(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class Rd{options;constructor(e){this.options=e}async sync(e){let t=await this.options.controlPlane.fetchBundle({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger});if(!t)throw Error("Remote config control plane returned no bundle");await this.options.bundleStore.write(t);let n=await this.options.materializer.materialize({bundle:t,paths:e.paths,artifactStore:this.options.artifactStore}),r=this.options.telemetryAdapter?await this.options.telemetryAdapter.resolveTelemetry(t,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger}):void 0,o=kd(t),i=Ed(o,this.options);return{bundle:t,materialized:n,telemetry:r,roles:i,claims:o}}}function Sy(e){let t=e?.name??"remote-config";return{name:t,manifest:{capabilities:["providers"]},async setup(n,r){n.registerProvider?.({name:t,description:"Remote-config managed runtime integration"}),await e?.setup?.(n,r)}}}async function _y(e){let t=ri({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new Jo(t.bundleCachePath),r=e.artifactStore??new Rn,o=e.materializer??new ni,i=e.telemetryAdapter??new ii,s,a,c=[],u,l=!1,p=!1;if(e.controlPlane){let f=new Rd({controlPlane:e.controlPlane,bundleStore:n,artifactStore:r,materializer:o,telemetryAdapter:i,claimsMapper:e.claimsMapper,logger:e.logger});try{let g=await f.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});s=g.bundle,a=g.telemetry,c=g.roles,u=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)s=await n.read(),l=Boolean(s);if(!s)throw g}}else if(e.useCachedBundle!==!1)s=await n.read(),l=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let f=xy(s,t);if(await n.write(f),!p)await o.materialize({bundle:f,paths:t,artifactStore:r});u??=kd(f),c=c.length>0?c:Ed(u,e),a??=await i.resolveTelemetry(f,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),s=f}let m=vd(t);return{pluginName:t.pluginName,pluginDefinition:Sy({name:t.pluginName}),paths:t,bundle:s,telemetry:a,roles:c,claims:u,usedCachedBundle:l,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}var Ad=b({id:d(),temperature:x().optional(),maxTokens:x().optional(),contextWindow:x().optional(),inputPrice:x().optional(),outputPrice:x().optional(),supportsImages:I().optional()}),wd=b({models:E(Ad).optional(),openAiBaseUrl:d().optional(),openAiHeaders:j(d(),d()).optional(),azureApiVersion:d().optional(),azureIdentity:I().optional()}),Id=b({id:d(),thinkingBudgetTokens:x().optional()}),Pd=b({name:d(),baseModelId:d(),thinkingBudgetTokens:x().optional()}),Md=b({models:E(Id).optional(),customModels:E(Pd).optional(),awsRegion:d().optional(),awsUseCrossRegionInference:I().optional(),awsUseGlobalInference:I().optional(),awsBedrockUsePromptCache:I().optional(),awsBedrockEndpoint:d().optional()}),Od=b({id:d()}),zd=b({models:E(Od).optional()}),Nd=b({id:d(),thinkingBudgetTokens:x().optional()}),$d=b({models:E(Nd).optional(),vertexProjectId:d().optional(),vertexRegion:d().optional()}),Ld=b({id:d(),thinkingBudgetTokens:x().optional(),promptCachingEnabled:I().optional()}),Dd=b({models:E(Ld).optional(),baseUrl:d().optional()}),Bd=b({id:d(),thinkingBudgetTokens:x().optional()}),Ud=b({models:E(Bd).optional(),baseUrl:d().optional()}),vy=b({OpenAiCompatible:wd.optional(),AwsBedrock:Md.optional(),Cline:zd.optional(),Vertex:$d.optional(),LiteLLM:Dd.optional(),Anthropic:Ud.optional()}),Zd=b({id:d()}),Fd=b({name:d(),url:d(),alwaysEnabled:I().optional(),headers:j(d(),d()).optional()}),si=b({alwaysEnabled:I(),name:d(),contents:d()}),Pn=b({bucket:d(),accessKeyId:d(),secretAccessKey:d(),region:d().optional(),endpoint:d().optional(),accountId:d().optional()}),Hd=b({enabled:I().optional(),type:Ge([V("s3_access_keys"),V("r2_access_keys"),V("azure_access_keys")]).optional(),s3AccessSettings:Pn.optional(),r2AccessSettings:Pn.optional(),azureAccessSettings:Pn.optional()}),jd=b({promptUploading:Hd.optional()}),Ty=b({version:d(),providerSettings:vy.optional(),telemetryEnabled:I().optional(),kanbanEnabled:I().optional(),mcpMarketplaceEnabled:I().optional(),allowedMCPServers:E(Zd).optional(),remoteMCPServers:E(Fd).optional(),blockPersonalRemoteMCPServers:I().optional(),yoloModeAllowed:I().optional(),openTelemetryEnabled:I().optional(),openTelemetryMetricsExporter:d().optional(),openTelemetryLogsExporter:d().optional(),openTelemetryOtlpProtocol:d().optional(),openTelemetryOtlpEndpoint:d().optional(),openTelemetryOtlpHeaders:j(d(),d()).optional(),openTelemetryOtlpMetricsProtocol:d().optional(),openTelemetryOtlpMetricsEndpoint:d().optional(),openTelemetryOtlpMetricsHeaders:j(d(),d()).optional(),openTelemetryOtlpLogsProtocol:d().optional(),openTelemetryOtlpLogsEndpoint:d().optional(),openTelemetryOtlpLogsHeaders:j(d(),d()).optional(),openTelemetryMetricExportInterval:x().optional(),openTelemetryOtlpInsecure:I().optional(),openTelemetryLogBatchSize:x().optional(),openTelemetryLogBatchTimeout:x().optional(),openTelemetryLogMaxQueueSize:x().optional(),enterpriseTelemetry:jd.optional(),globalRules:E(si).optional(),globalWorkflows:E(si).optional()}),Cy=j(d(),d());var ky=25463,Ey=25466,Ry=4317;var Ay="127.0.0.1:4317";var wy=w(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),Iy=w(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Py=w(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var My="runtime.team.progress.v1",Oy="runtime.team.lifecycle.v1";import{basename as zy}from"node:path";var Mn="CLINE_BUILD_ENV",Vd="CLINE_DEBUG_HOST",qd="CLINE_DEBUG_PORT_BASE";function Gd(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function Ny(e){for(let t=0;t<e.length;t+=1){let n=e[t]?.trim();if(!n)continue;if(n==="--conditions"&&e[t+1]?.trim()==="development")return!0;if(n.startsWith("--conditions=")&&n.slice(13).split(",").map((r)=>r.trim()).includes("development"))return!0}return!1}function $y(e){if(!e?.trim())return!1;let t=zy(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function Ly(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function Dy(e){return e.some((t)=>t==="--enable-source-maps")}function By(e){return e[Vd]?.trim()||"127.0.0.1"}function Uy(e){let t=e[qd]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function Zy(e){switch(e){case"rpc":return 0;case"hook":return 1;case"plugin-sandbox":return 2;case"connector":return 3;case"sandbox":return 4;default:return 9}}function ai(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,r=Gd(t[Mn]);if(r)return r;let o=t.NODE_ENV?.trim().toLowerCase();if(o==="production")return"production";if(o==="development")return"development";return Ny(n)?"development":"production"}function Fy(e=process.env,t={}){if(Gd(e[Mn]))return e;return{...e,[Mn]:ai({env:e,execArgv:t.execArgv})}}function Hy(e,t={}){if(e.length===0||!$y(e[0]))return[...e];if(ai(t)!=="development")return[...e];let n=t.env??process.env,r=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],o=[];if(!Ly(r)){let i=By(n),s=Uy(n),a=s===void 0?0:s+Zy(t.debugRole);o.push(`--inspect=${i}:${a}`)}if(!Dy(r))o.push("--enable-source-maps");return[e[0],...o,...e.slice(1)]}function jy(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function Kd(){return globalThis}function Vy(e){Kd().__clineClientIdentity=e}function qy(){return Kd().__clineClientIdentity}var Gy="CLINE_ENVIRONMENT",Ky="CLINE_ENVIRONMENT_OVERRIDE",ci={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},Wy="production";function Wd(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function Jd(){if(typeof process>"u"||!process?.env)return{};return process.env}function Yd(){let e=Jd();return Wd(e.CLINE_ENVIRONMENT_OVERRIDE)??Wd(e.CLINE_ENVIRONMENT)??"production"}function Jy(e){if(typeof e==="string")return ci[e];return ci[Yd()]}function Yy(e,t){if(t.CLINE_API_BASE_URL)e={...e,apiBaseUrl:t.CLINE_API_BASE_URL,mcpBaseUrl:`${t.CLINE_API_BASE_URL}/v1/mcp`};return e}function Xy(e){let t=Jy(e);return Yy(t,Jd())}var Qy="CLINE_RUN_AS_HUB_DAEMON",eb="CLINE_CONNECTOR_CLI_LAUNCH",tb="CLINE_CONNECTOR_STARTING_INSTANCE",nb="CLINE_CONNECTOR_SUPERVISED",ui;function rb(e=process.env){return ui=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,ui}function ob(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return ui??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function ib(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var li;function sb(e=process.env){return li=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,li}function ab(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return li??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function cb(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function ub(e=process.env){let t=e.CLINE_CONNECTOR_STARTING_INSTANCE;if(!t)return;try{let n=JSON.parse(t);if(typeof n.channel!=="string"||!n.channel.trim()||typeof n.instanceId!=="string"||!n.instanceId.trim())return;return{channel:n.channel,instanceId:n.instanceId}}catch{return}}function lb(e=process.env){let t=e.CLINE_CONNECTOR_CLI_LAUNCH;if(!t)return;try{let n=JSON.parse(t);if(typeof n.launcher!=="string"||!n.launcher.trim()||!Array.isArray(n.connectArgsPrefix)||!n.connectArgsPrefix.every((r)=>typeof r==="string")||typeof n.cwd!=="string"||!n.cwd.trim())return;return{launcher:n.launcher,connectArgsPrefix:n.connectArgsPrefix,cwd:n.cwd}}catch{return}}var db=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],Qd=["localhost","127.0.0.1","::1","[::1]"];function pb(e){for(let t of db){let n=e[t]?.trim();if(n)return n}return}function di(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function mb(e,t){let n=[],r=new Set;for(let o of[...di(e),...di(t),...Qd]){let i=o.toLowerCase();if(i!=="*"&&!r.has(i))r.add(i),n.push(o)}return n.join(",")}function Xd(e){return di(e).includes("*")}function fb(e=process.env){if(!pb(e))return;let t=Xd(e.NO_PROXY),n=Xd(e.no_proxy);if(t&&n)return;let r=mb(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=r;if(!n)e.no_proxy=r}var gb="NoDefaultCurrentDirectoryInExePath";function hb(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var yb="agent.reasoning.unexpected_tokens",bb="task.provider_request_started",xb="task.provider_stream_started",Sb="task.first_chunk_received",_b="task.provider_stream_failed",vb="task.cancelled",Tb="task.max_tokens_recovery",Cb=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],kb="sdk.error";var De=new Map;function Eb(){De.clear()}function Rb(e,t){let n=typeof t.error_message==="string"?t.error_message:"";return[e,t.component,t.operation,t.error_type,t.error_code??"",t.error_status??"",n.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function Ab(e){let t=Date.now(),n=De.get(e);if(n&&t-n.startMs<3600000){if(n.emitted<5)return n.emitted+=1,{emit:!0,suppressed:0};return n.suppressed+=1,{emit:!1,suppressed:n.suppressed}}let r=n?.suppressed??0;if(De.delete(e),De.size>=512){let o=De.keys().next();if(!o.done)De.delete(o.value)}return De.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:r}}function wb(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:mi({sessionId:t.sessionId,agentId:t.agentId,runId:t.runId,iteration:t.iteration,providerId:t.providerId,modelId:t.modelId,requestedThinking:t.requestedThinking,reasoningTokenCount:t.reasoningTokenCount})})}function Ib(e,t){if(!e)return;e.capture({event:t.event,properties:mi({sessionId:t.sessionId,modelRequestId:t.modelRequestId,ulid:t.ulid??t.sessionId,agentId:t.agentId,conversationId:t.conversationId,runId:t.runId,iteration:t.iteration,provider:t.providerId,providerId:t.providerId,model:t.modelId,modelId:t.modelId,phase:t.phase,durationMs:t.durationMs,eventType:t.eventType,...t.error===void 0?{}:fi(t.error,t.messageLimit),error_class:t.errorClass})})}function Pb(e,t){if(!e)return!1;let n=t.event??"sdk.error",r=np(t),o=0;try{let i=Ab(Rb(n,r));if(!i.emit)return!0;o=i.suppressed}catch{}return e.capture({event:n,properties:o>0?{...r,suppressed_count:o}:r}),!0}function np(e){return mi({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...fi(e.error,e.messageLimit,e.errorMessage)})}function mi(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0)t[n]=r;return t}function fi(e,t=500,n){let r=ep(e)?e:void 0,o=e instanceof Error?e:void 0,i=$t(n)??$t(o?.message)??$t(r?.message)??zb(e)??"Unknown error",s=tp(r?.code),a=[],c=new Set([e]),u=r?.cause;while(ep(u)&&!c.has(u)&&a.length<8)c.add(u),a.push(u),u=u.cause;let l=a.map((m)=>tp(m.code)).find((m)=>m!==void 0),p=pi(r?.status)??pi(r?.statusCode)??pi(r?.responseStatus);return{error_type:o?.name?.trim()||$t(r?.name)||o?.constructor?.name||"Error",error_message:Ob(Mb(i),t),...s!==void 0?{error_code:s}:{},...l!==void 0?{error_cause_code:l}:{},...typeof r?.isRetryable==="boolean"?{error_retryable:r.isRetryable}:{},...p!==void 0?{error_status:p}:{}}}function Mb(e){return e.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function Ob(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function ep(e){return typeof e==="object"&&e!==null}function $t(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function zb(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:$t(t)}function tp(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function pi(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var gi="_clineOtlpTraceRelay";function Nb(e){e[gi]=!0}function $b(e){return!!e&&typeof e==="object"&&e[gi]===!0}function rp(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let r=n.indexOf("=");if(r<=0)return;try{let o=decodeURIComponent(n.substring(0,r).trim()),i=decodeURIComponent(n.substring(r+1).trim());if(!o||!i)return;t[o]=i}catch{}}),t}function Lb(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?rp(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function op(e={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...e}}function Db(e={}){return{...Lb(),...e,metadata:op(e.metadata)}}var Bb=new Set(["http:","https:"]);function Ub(e){if(!e)return"";try{let t=new URL(e);return Bb.has(t.protocol)&&t.host?t.host:"invalid-endpoint-url"}catch{return"invalid-endpoint-url"}}function Zb(e){return{telemetry_selfcheck:!0,enabled:e.enabled===!0,otlp_endpoint_host:Ub(e.otlpEndpoint),logs_exporter:e.logsExporter??"",metrics_exporter:e.metricsExporter??""}}function ip(e){let t=e?.trim();return t?t:void 0}function Fb(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let r=ip(n.rootSessionId);if(!r)return;return{rootSessionId:r}}function Hb(e){return ip(e?.rootSessionId)}import{webcrypto as sp}from"node:crypto";var jb=128,Pe,it;function Vb(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Pe||Pe.length<e)Pe=Buffer.allocUnsafe(e*jb),sp.getRandomValues(Pe),it=0;else if(it+e>Pe.length)sp.getRandomValues(Pe),it=0}catch(t){throw Pe=void 0,t}it+=e}function qb(e){return Vb(e|=0),Pe.subarray(it-e,it)}function Gb(e,t,n){let r=256-256%e.length;if(r===256){let i=e.length-1;return(s=t)=>{if(!s)return"";let a="";while(!0){let c=n(s),u=s;while(u--)if(a+=e[c[u]&i],a.length>=s)return a}}}let o=Math.ceil(409.6*t/r);return(i=t)=>{if(!i)return"";let s="";while(!0){let a=n(o),c=o;while(c--)if(a[c]<r){if(s+=e[a[c]%e.length],s.length>=i)return s}}}}function ap(e,t=21){return Gb(e,t,qb)}function Kb(e="",t=""){let n=ap("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var Wb=["idle","running","pending","completed","failed","cancelled"];var hi=["rules","skills","workflows","plugins","hooks"],cp=hi,Jb=new Set(hi);function up(e){return typeof e==="string"&&Jb.has(e)}function Yb(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(up);return[...new Set(t)]}function Xb(e,t){return new Set(e??cp).has(t)}var Qb=b({rootPath:d().min(1),hint:d().min(1).optional(),associatedRemoteUrls:E(d().min(1)).optional(),latestGitCommitHash:d().min(1).optional(),latestGitBranchName:d().min(1).optional()}),ex=b({currentWorkspacePath:d().min(1).optional(),workspaces:j(d().min(1),Qb)});function QC(){return{workspaces:{}}}function ek(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return ex.parse(n)}var tx="workspaces",nx="chat";function rx(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),r=t.startsWith("/");if(!n&&!r)return!1;let o=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),i=o.at(-1)??"",s=o.at(-2)??"",a=o.at(-3)??"";return(o.at(-4)??"")===".cline"&&a==="data"&&s==="workspaces"&&i==="chat"}var ox=["current_state","boundary_analysis","interface_proposal"],ok=3600000,ik=240,sk=400,le=Ku((e)=>e instanceof Date?e.toISOString():e,d().datetime()),st=w(["pending","in_progress","blocked","completed"]),lp=w(["queued","running","completed","failed","cancelled","interrupted"]),On=w(["draft","in_review","finalized"]),ix=b({agentId:d(),role:w(["lead","teammate"]),description:d().optional(),status:w(["idle","running","stopped"])}),ak=b({agentId:d(),rolePrompt:d(),modelId:d().optional(),maxIterations:x().optional()});function Z(e){return Ku((t)=>t===null?void 0:t,e.optional())}var ck=b({agentId:d().min(1).describe("Teammate identifier"),rolePrompt:d().min(1).describe("System prompt describing teammate role")}).strict(),uk=b({agentId:d().min(1).describe("Teammate identifier"),reason:Z(d().min(1)).describe("Optional shutdown reason")}),lk=b({}),sx={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},dk={create:["status","taskId","summary","reason"]},pk=b({action:w(["create","list","claim","complete","block"]),title:Z(d().min(1)).describe("Task title"),description:Z(d().min(1)).describe("Task details"),dependsOn:Z(E(d().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:Z(d().min(1)).describe("Optional assignee"),status:Z(w(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:Z(d()).describe("Task ID"),summary:Z(d().min(1)).describe("Completion summary"),reason:Z(d().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of sx[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),mk=b({agentId:d().describe("Teammate agent ID"),task:d().min(1).describe("Task instructions for the teammate"),taskId:Z(d()).describe("Optional shared task list ID"),runMode:Z(w(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:Z(I()).describe("If true, continue the teammate conversation; otherwise start fresh")}),fk=b({status:Z(w(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:Z(d().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:Z(I()).describe("Include completed/failed runs (default true)")}),gk=b({runId:d().min(1).describe("Run ID"),reason:Z(d().min(1)).describe("Optional cancellation reason")}),hk=b({runId:Z(d().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),yk=b({toAgentId:d().min(1).describe("Recipient agent ID"),subject:d().min(1).describe("Message subject"),body:d().min(1).describe("Message body"),taskId:Z(d().min(1)).describe("Optional task ID context")}),bk=b({subject:d().min(1).describe("Message subject"),body:d().min(1).describe("Message body"),taskId:Z(d().min(1)).describe("Optional task ID context")}),xk=b({unreadOnly:Z(I()).describe("Only unread messages for read action (default true)")}),Sk=b({kind:w(["progress","handoff","blocked","decision","done","error"]),summary:d().min(1).describe("Update summary"),taskId:Z(d().min(1)).describe("Optional task ID context"),evidence:Z(E(d().min(1))).describe("Optional evidence links/snippets"),nextAction:Z(d().min(1)).describe("Planned next step")}),_k=b({}),vk=b({title:d().describe("Outcome title"),requiredSections:E(d()).default(ox).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),Tk=b({outcomeId:d().describe("Outcome ID"),section:d().describe("Section name"),sourceRunId:Z(d()).describe("Optional source run ID"),content:d().describe("Section fragment content")}),Ck=b({fragmentId:d().describe("Fragment ID"),approved:I().describe("Review decision")}),kk=b({outcomeId:d().describe("Outcome ID")}),Ek=b({}),Rk=b({teamId:d(),teamName:d(),members:E(ix),taskCounts:j(st,x()),unreadMessages:x(),missionLogEntries:x(),activeRuns:x(),queuedRuns:x(),outcomeCounts:j(On,x())}),ax=b({id:d(),title:d(),description:d(),status:st,createdAt:le,updatedAt:le,createdBy:d(),assignee:d().optional(),dependsOn:E(d()),summary:d().optional(),isReady:I(),blockedBy:E(d())}),Ak=ao("action",[b({action:V("create"),taskId:d(),status:st,ignoredFields:E(d()).optional(),note:d().optional()}),b({action:V("list"),tasks:E(ax)}),b({action:V("claim"),taskId:d(),status:st,nextStep:d()}),b({action:V("complete"),taskId:d(),status:st}),b({action:V("block"),taskId:d(),status:st})]),wk=b({agentId:d(),mode:w(["sync","async"]),status:w(["dispatched","running","queued","joined"]),dispatched:I(),message:d(),deduped:I().optional(),runId:d().optional(),text:d().optional(),iterations:x().optional()}),cx=b({textPreview:d(),iterations:x(),finishReason:d(),durationMs:x(),usage:b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()})}),Ik=b({id:d(),agentId:d(),taskId:d().optional(),status:lp,messagePreview:d(),priority:x(),retryCount:x(),maxRetries:x(),nextAttemptAt:le.optional(),continueConversation:I().optional(),startedAt:le,endedAt:le.optional(),leaseOwner:d().optional(),heartbeatAt:le.optional(),lastProgressAt:le.optional(),lastProgressMessage:d().optional(),currentActivity:d().optional(),error:d().optional(),resultSummary:cx.optional()}),Pk=b({id:d(),teamId:d(),fromAgentId:d(),toAgentId:d(),subject:d(),body:d(),taskId:d().optional(),sentAt:le,readAt:le.optional()}),Mk=b({id:d(),teamId:d(),title:d(),status:On,requiredSections:E(d()),createdBy:d(),createdAt:le,finalizedAt:le.optional()}),Ok=b({outcomeId:d(),status:On,requiredSections:E(d())}),zk=b({agentId:d(),status:d()}),Nk=b({runId:d(),status:lp}),$k=b({id:d(),toAgentId:d()}),Lk=b({delivered:x()}),Dk=b({id:d()}),Bk=b({status:d()}),Uk=b({fragmentId:d(),status:d()}),Zk=b({outcomeId:d(),status:On});var ux;((R)=>{R.TaskStart="task_start";R.TaskEnd="task_end";R.AgentEvent="agent_event";R.TeammateSpawned="teammate_spawned";R.TeammateShutdown="teammate_shutdown";R.TeamTaskUpdated="team_task_updated";R.TeamMessage="team_message";R.TeamMissionLog="team_mission_log";R.TeamTaskCompleted="team_task_completed";R.RunStarted="run_started";R.RunQueued="run_queued";R.RunProgress="run_progress";R.RunCompleted="run_completed";R.RunFailed="run_failed";R.RunCancelled="run_cancelled";R.RunInterrupted="run_interrupted";R.OutcomeCreated="outcome_created";R.OutcomeFragmentAttached="outcome_fragment_attached";R.OutcomeFragmentReviewed="outcome_fragment_reviewed";R.OutcomeFinalized="outcome_finalized"})(ux||={});function lx(e){let{$schema:t,...n}=e;if(typeof n.type==="string")return n;if("properties"in n||"required"in n||"additionalProperties"in n)return{type:"object",...n};for(let r of["oneOf","anyOf","allOf"]){let o=n[r];if(!Array.isArray(o)||o.length===0)continue;if(r==="allOf"){if(o.some((a)=>a&&typeof a==="object"&&a.type==="object"))return{type:"object",...n};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(o.every((s)=>s&&typeof s==="object"&&s.type==="object"))return{type:"object",...n};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${r}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return n}function dx(e){let t=lx(e.inputSchema instanceof N?Vo(e.inputSchema):e.inputSchema);return{name:e.name,resultPolicy:e.resultPolicy,description:e.description,inputSchema:t,lifecycle:e.lifecycle,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var dp=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function px(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return dp.some((n)=>t.includes(n))}import{existsSync as mx,mkdirSync as fx,readFileSync as gx,writeFileSync as hx}from"node:fs";import{dirname as yx,resolve as bx}from"node:path";var xx=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),Sx=["id","balance","cost","secret"];function _x(e){let t=e.toLowerCase();if(xx.has(t))return!0;for(let n of Sx){if(t===n)return!0;if(t.endsWith(n)&&t.length>n.length){let r=t[t.length-n.length-1];if(r==="_"||r==="-")return!0;let o=e[e.length-n.length];if(o&&o===o.toUpperCase()&&o!==o.toLowerCase())return!0}if(t.endsWith(`_${n}`))return!0}return!1}var vx=[{pattern:/AKIA[A-Z0-9]{16}/g,replacement:"AKIA_REDACTED"},{pattern:/\/Users\/[A-Za-z0-9._-]+/g,replacement:"/Users/REDACTED_USER"},{pattern:/\/home\/[A-Za-z0-9._-]+/g,replacement:"/home/REDACTED_USER"}];function mp(e){let t=e;for(let{pattern:n,replacement:r}of vx)t=t.replace(n,r);return t}function yi(e){if(Array.isArray(e))return e.map(yi);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>Tx(t,n)).map(([t,n])=>[t,yi(n)]))}function Tx(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function pp(e){return JSON.stringify(yi(e))}var Cx=[{pattern:/tasks\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+\/api_conversation_history/g,replacement:"tasks/usr-test/taskid/api_conversation_history"},{pattern:/\/(org|usr|mbr|ses|gen|req|msg|tsk|sch|exe|srv|cli|wkr|evt|sub|tkn)-[A-Za-z0-9]{10,}(?=[/?#]|$)/g,replacement:"/$1-REDACTED"}];function bi(e){let t=e;for(let{pattern:n,replacement:r}of Cx)t=t.replace(n,r);return t}function at(e){if(e===null||e===void 0)return e;if(typeof e==="string"){try{let t=JSON.parse(e);if(typeof t==="object"&&t!==null)return JSON.stringify(at(t))}catch{}return mp(e)}if(Array.isArray(e))return e.map(at);if(typeof e==="object"){let t={};for(let[n,r]of Object.entries(e))if(_x(n)&&(typeof r==="string"||typeof r==="number"))t[n]="REDACTED";else t[n]=at(r);return t}return e}function kx(e){let t=new URLSearchParams(e),n=Array.from(t.entries());if(n.length===0||n.some(([o])=>o.length===0))return;let r={};for(let[o,i]of n){let s=r[o];if(s===void 0)r[o]=i;else if(Array.isArray(s))s.push(i);else r[o]=[s,i]}return r}function Ex(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function fp(e,t){try{return pp(at(JSON.parse(e)))}catch{if(Ex(t)){let n=kx(e);if(n)return pp(at(n))}return mp(e)}}function Rx(e,t){let n={...e},r=t&&e.body!==void 0?fp(e.body,e.requestContentType):void 0;if(delete n.body,delete n.requestContentType,r!==void 0)n.requestBody=r;if(typeof n.path==="string")n.path=bi(n.path);if(n.response!==void 0)n.response=at(n.response);return n}function gp(e){try{let t=new URL(e),n=`${t.protocol}//${t.host}`,r=t.pathname+t.search;return{scope:n,path:r}}catch{return{scope:"",path:e}}}function hp(e){if(typeof e==="string")return e;if(e instanceof URL)return e.toString();if(e&&typeof e.url==="string")return e.url;return String(e)}function yp(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function Ax(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function bp(e,t){let n=Ax(t?.headers);if(n)return n;if(t?.body instanceof URLSearchParams)return"application/x-www-form-urlencoded;charset=UTF-8";if(e instanceof Request)return e.headers.get("content-type")??void 0;return}async function xp(e,t){if(t?.body){if(typeof t.body==="string")return t.body;if(t.body instanceof URLSearchParams)return t.body.toString();if(t.body instanceof ArrayBuffer)return new TextDecoder().decode(t.body);if(ArrayBuffer.isView(t.body))return new TextDecoder().decode(new Uint8Array(t.body.buffer,t.body.byteOffset,t.body.byteLength));return}if(e instanceof Request)try{return await e.clone().text()}catch{return}return}function wx(e){if(!e)return null;if(!process.env.CLINE_VCR_CASSETTE)return process.stderr.write(`[VCR] No CLINE_VCR_CASSETTE: requests will not be recorded or played back.
|
|
179
179
|
`),null;if(e!=="record"&&e!=="playback")process.stderr.write(`[VCR] Invalid CLINE_VCR value: "${e}". Expected "record" or "playback".
|
|
180
|
-
`),process.exit(1);let t=
|
|
181
|
-
`);let c=!1;
|
|
182
|
-
`);return}let
|
|
183
|
-
`)})}function
|
|
180
|
+
`),process.exit(1);let t=bx(process.env.CLINE_VCR_CASSETTE),n=process.env.CLINE_VCR_FILTER??"",r=process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="1"||process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="true";return{mode:e,cassettePath:t,filter:n,includeRequestBody:r}}function Ix(e,t,n){let r=[],o=[],i=globalThis.fetch;function s(l){if(l.finalized)return;l.finalized=!0;let p=new TextDecoder,m=l.chunks.map((g)=>p.decode(g,{stream:!0})).join("")+p.decode(),f;try{f=JSON.parse(m)}catch{f=m}r.push({scope:l.scope,method:l.method,path:l.path,body:l.body,requestContentType:l.requestContentType,status:l.status,response:f,responseIsBinary:!1,contentType:l.contentType})}globalThis.fetch=Object.assign(async(l,p)=>{let m=hp(l),f=yp(l,p),{scope:g,path:y}=gp(m),S=await xp(l,p),v=bp(l,p),k=await i(l,p);if(t&&!y.includes(t))return k;let M=k.headers.get("content-type")??void 0;if(!k.body)return r.push({scope:g,method:f,path:y,body:S??"",requestContentType:v,status:k.status,response:"",responseIsBinary:!1,contentType:M}),k;let R={scope:g,method:f,path:y,body:S??"",requestContentType:v,status:k.status,contentType:M,chunks:[],finalized:!1};o.push(R);let B=k.body,A=new TransformStream({transform(Te,Me){R.chunks.push(Te),Me.enqueue(Te)},flush(){s(R)}}),J=B.pipeThrough(A);return new Response(J,{status:k.status,statusText:k.statusText,headers:k.headers})},{preconnect:(l)=>{}});let a=t?`matching path "*${t}*"`:"all paths";process.stderr.write(`[VCR] Recording HTTP requests (${a}). Cassette will be saved to: ${e}
|
|
181
|
+
`);let c=!1;ho(()=>{if(c)return;c=!0,globalThis.fetch=i;for(let m of o)s(m);if(r.length===0){process.stderr.write(`[VCR] No HTTP requests${t?` matching "${t}"`:""} were recorded.
|
|
182
|
+
`);return}let l=yx(e);fx(l,{recursive:!0});let p=r.map((m)=>Rx(m,n));hx(e,JSON.stringify(p,null,2)),process.stderr.write(`[VCR] Saved ${p.length} recorded HTTP interaction(s) to ${e}
|
|
183
|
+
`)})}function Px(e){let t=[],n=e.split(/\n\n/);for(let r of n){let o=r.trim();if(o)t.push(`${o}
|
|
184
184
|
|
|
185
|
-
`)}return t}function
|
|
185
|
+
`)}return t}function Mx(e,t){let n=new TextEncoder,r=0;return new ReadableStream({async pull(o){if(r>=e.length){o.close();return}if(r>0&&t>0)await new Promise((s)=>setTimeout(s,t));let i=e[r];if(i===void 0){o.close();return}o.enqueue(n.encode(i)),r+=1}})}async function Ox(e){if(e.recording.requestBody===void 0)return;let t=await xp(e.requestInput,e.requestInit),n=bp(e.requestInput,e.requestInit),r=fp(t??"",n);if(r!==e.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${e.method} ${e.path}.
|
|
186
186
|
expected: ${e.recording.requestBody}
|
|
187
|
-
actual: ${
|
|
188
|
-
Re-record the cassette if the request change is intentional.`)}function
|
|
189
|
-
`),process.exit(1);let n=JSON.parse(
|
|
190
|
-
`)}function Rx(e){let t=_x(e);if(!t)return;if(t.mode==="record")vx(t.cassettePath,t.filter,t.includeRequestBody);else Ex(t.cassettePath,t.filter)}export{lb as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,yy as APIKeySchema,sp as AUTH_ERROR_PATTERNS,av as AgentConfigSchema,Lf as AgentFinishReasonSchema,sv as AgentResultSchema,Df as AgentUsageSchema,Dd as AllowedMCPServerSchema,$d as AnthropicModelSchema,Ld as AnthropicSchema,Af as ApiFormat,Ku as ApiFormatSchema,Ad as AwsBedrockCustomModelSchema,Rd as AwsBedrockModelSchema,Id as AwsBedrockSettingsSchema,Kg as CHARS_PER_TOKEN,Pn as CLINE_BUILD_ENV_ENV,Kb as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,Gy as CLINE_CONNECTOR_CLI_LAUNCH_ENV,Ky as CLINE_CONNECTOR_STARTING_INSTANCE_ENV,Wy as CLINE_CONNECTOR_SUPERVISED_ENV,Fd as CLINE_DEBUG_HOST_ENV,Hd as CLINE_DEBUG_PORT_BASE_ENV,Uh as CLINE_DEFAULT_MODEL_ID,_y as CLINE_DEFAULT_RPC_ADDRESS,Sy as CLINE_DEFAULT_RPC_PORT,ai as CLINE_ENVIRONMENTS,Uy as CLINE_ENVIRONMENT_ENV,Zy as CLINE_ENVIRONMENT_OVERRIDE_ENV,xy as CLINE_HUB_DEV_PORT,by as CLINE_HUB_PORT,qy as CLINE_RUN_AS_HUB_DAEMON_ENV,Gb as CLINE_WORKSPACES_DIRECTORY_NAME,Xv as CONFIGURABLE_MODEL_TOOL_NAMES,al as CONNECTOR_CATALOG,ll as CONNECTOR_PLATFORMS,yb as CORE_SPAWN_REASONS,_v as CURRENT_HUB_PROTOCOL_VERSION,wd as ClineModelSchema,Pd as ClineSettingsSchema,Uf as ConnectorAuthorizationDecisionSchema,Bf as ConnectorAuthorizationRequestSchema,il as ConnectorEventActorSchema,sl as ConnectorEventContextSchema,rl as ConnectorHookEventNameSchema,Zf as ConnectorHookEventSchema,hr as ContributionRegistry,Fy as DEFAULT_CLINE_ENVIRONMENT,xr as DEFAULT_MAX_IMAGE_BASE64_BYTES,Se as DEFAULT_MAX_IMAGE_DECODED_BYTES,fe as DEFAULT_MAX_IMAGE_ENCODED_BYTES,wl as DEFAULT_MAX_TOTAL_MEDIA_BYTES,rT as DEFAULT_MCP_TIMEOUT_SECONDS,Jb as DEFAULT_OUTCOME_REQUIRED_SECTIONS,jg as DEFAULT_REASONING_EFFORT,op as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,Mt as EMPTY_CONTENT_TEXT,Zd as EnterpriseTelemetrySchema,og as FEATURE_FLAGS,Ke as FeatureFlag,ng as FeatureFlagDefaultValue,El as GeneratedMediaModalitySchema,Il as GeneratedMediaSchema,Rl as GeneratedMediaSourceSchema,ii as GlobalInstructionsFileSchema,Cv as HUB_CAPABILITIES,Lv as HUB_CHECKPOINT_CAPABILITY,Ev as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,wv as HUB_COMMAND_SLOW_LOG_MS,$v as HUB_COMPACTION_CAPABILITY,zv as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,fg as HUB_DEFAULT_COMMAND_TIMEOUT_MS,Nv as HUB_HOOK_CAPABILITY_PREFIX,Dv as HUB_MISTAKE_LIMIT_CAPABILITY,bl as HUB_SCHEDULE_MODES,Ov as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,hg as HUB_TOOL_EXECUTOR_NAMES,Bv as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,hl as HookEventNameSchema,yl as HookEventPayloadSchema,We as IMAGE_OMITTED_PLACEHOLDER,Je as IMAGE_UNSUPPORTED_PLACEHOLDER,Jd as LOOPBACK_NO_PROXY_HOSTS,zd as LiteLLMModelSchema,Nd as LiteLLMSchema,Tv as MAX_CLIENT_HUB_PROTOCOL_VERSION,sT as MAX_MCP_TIMEOUT_SECONDS,vv as MIN_CLIENT_HUB_PROTOCOL_VERSION,iT as MIN_MCP_TIMEOUT_SECONDS,Yv as MODEL_TOOL_NAMES,rd as MODE_TAG_INSTRUCTIONS,Wu as ModelCapabilitySchema,bn as ModelInfoSchema,Qu as ModelMetadataSchema,el as ModelModalitiesSchema,pr as ModelModalitySchema,ol as ModelOperationModeSchema,nl as ModelOperationSchema,Yu as ModelPricingSchema,dr as ModelReasoningOptionSchema,Ju as ModelStatusSchema,cb as NO_DEFAULT_CURRENT_DIRECTORY_IN_EXE_PATH_ENV,Rv as ONE_TIME_SCHEDULE_CRON_PATTERN,Av as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,fi as OTLP_TRACE_RELAY_MARKER,kd as OpenAiCompatibleModelSchema,Ed as OpenAiCompatibleSchema,sd as PLAN_MODE_INSTRUCTIONS,ad as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,tg as PLUGIN_FILE_EXTENSIONS,Ud as PromptUploadingSchema,vy as ProviderCapabilitySchema,Cy as ProviderClientSchema,Ty as ProviderProtocolSchema,zt as REASONING_EFFORT_RATIOS,hn as REASONING_LEVELS,md as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,ry as REMOTE_URI_SCHEME,gi as RUNTIME_CONFIG_EXTENSION_KINDS,yn as ReasoningEffortSchema,lr as ReasoningLevelSchema,hy as RemoteConfigSchema,Bd as RemoteMCPServerSchema,wn as S3AccessKeySettingsSchema,bb as SDK_ERROR_TELEMETRY_EVENT,Tl as SESSION_SEARCH_PREVIEW_MAX_LENGTH,vl as SESSION_SEARCH_TITLE_MAX_LENGTH,Zb as SESSION_STATUS_VALUES,_n as SUPPORTED_IMAGE_MEDIA_TYPES,gb as TASK_CANCELLED_EVENT,mb as TASK_FIRST_CHUNK_RECEIVED_EVENT,hb as TASK_MAX_TOKENS_RECOVERY_EVENT,db as TASK_PROVIDER_REQUEST_STARTED_EVENT,fb as TASK_PROVIDER_STREAM_FAILED_EVENT,pb as TASK_PROVIDER_STREAM_STARTED_EVENT,WC as TEAM_AWAIT_TIMEOUT_MS,Ey as TEAM_LIFECYCLE_EVENT_TYPE,ky as TEAM_PROGRESS_EVENT_TYPE,JC as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,YC as TEAM_RUN_TEXT_PREVIEW_LIMIT,nk as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,$f as TOOL_REJECTION_SUFFIX,fk as TeamAttachOutcomeFragmentInputSchema,ak as TeamAwaitRunsInputSchema,uk as TeamBroadcastInputSchema,Ak as TeamBroadcastToolResultSchema,sk as TeamCancelRunInputSchema,Ek as TeamCancelRunToolResultSchema,pk as TeamCleanupInputSchema,wk as TeamCleanupToolResultSchema,mk as TeamCreateOutcomeInputSchema,Ck as TeamCreateOutcomeToolResultSchema,hk as TeamFinalizeOutcomeInputSchema,Mk as TeamFinalizeOutcomeToolResultSchema,yk as TeamListOutcomesInputSchema,ik as TeamListRunsInputSchema,vk as TeamMailboxMessageToolResultSchema,tx as TeamMessageType,dk as TeamMissionLogInputSchema,Ik as TeamMissionLogToolResultSchema,Pk as TeamOutcomeFragmentToolResultSchema,Tk as TeamOutcomeToolResultSchema,lk as TeamReadMailboxInputSchema,gk as TeamReviewOutcomeFragmentInputSchema,ex as TeamRunResultSummarySchema,rk as TeamRunTaskInputSchema,Sk as TeamRunTaskToolResultSchema,_k as TeamRunToolSummarySchema,ck as TeamSendMessageInputSchema,Rk as TeamSendMessageToolResultSchema,ek as TeamShutdownTeammateInputSchema,kk as TeamSimpleAgentStatusToolResultSchema,QC as TeamSpawnTeammateInputSchema,tk as TeamStatusInputSchema,bk as TeamStatusToolResultSchema,ok as TeamTaskInputSchema,Qb as TeamTaskListItemToolResultSchema,xk as TeamTaskToolResultSchema,XC as TeamTeammateSpecSchema,Xu as ThinkingConfigSchema,fr as ToolCallRecordSchema,Kv as USAGE_COST_DISPLAYS,Nf as USER_REJECTED_TOOL_REASON,Md as VertexModelSchema,Od as VertexSettingsSchema,Vb as WorkspaceInfoSchema,qb as WorkspaceManifestSchema,$y as augmentNodeCommandForDebug,Lh as buildClineSystemPrompt,Ff as buildConnectorConnectArgs,Kh as buildRemoteConfigSessionBlobUploadMetadata,Yd as buildSdkErrorProperties,vb as captureAgentUnexpectedReasoningTokens,Cb as captureSdkError,Tb as captureTaskLifecycleEvent,Jy as claimHubDaemonProcess,Qy as claimSupervisedConnectorProcess,Xg as clampMcpTimeoutSeconds,dy as clearMaterializedRemoteConfigRuntime,Jh as clearRemoteConfigSessionBlobUpload,Vf as connectorChannelsFromPlatforms,Ob as createClineTelemetryServiceConfig,Qd as createClineTelemetryServiceMetadata,eg as createContributionRegistry,vn as createMediaBudgetState,Tg as createModeSwitchNoticeTracker,oy as createRemoteConfigSessionMessagesArtifactUploader,Ub as createSessionId,ox as createTool,fh as decodeJwtPayload,Uv as describeOutdatedHubSessions,ub as disableCurrentDirectoryExecutableSearch,Wf as disposeAll,jC as emptyWorkspaceManifest,ab as ensureLoopbackProxyBypass,Wg as estimateRequestInputTokens,Zl as estimateTokens,br as formatDisplayUserInput,yr as formatFileContentBlock,Mh as formatHumanReadableDate,cT as formatMcpTimeoutErrorMessage,Fg as formatMessagesForAiSdk,vg as formatModeSwitchNotice,Ag as formatSessionSearchPreview,Rg as formatSessionSearchTitle,Oh as formatUptime,xg as formatUserCommandBlock,bg as formatUserInputBlock,wg as generatedMediaModalityFromMediaType,By as getClineClientIdentity,Vy as getClineEnvironmentConfig,gg as getDefaultHubCommandTimeoutMs,bh as getDefaultShell,eh as getErrorCode,Qg as getErrorMessage,ot as getPowerShellEdition,Eh as getShellArgs,Ql as getShellInvocation,Hr as getShellKind,jb as hasRuntimeConfigExtension,Sr as imageBase64DecodedByteLength,Pg as imageBase64EncodedByteLength,_r as imageBase64LengthForDecodedBytes,Mg as imageFileMaxDecodedBytesForBase64Limit,Rx as initVcr,Pl as isBase64Char,Ly as isBunEmbeddedModulePath,Og as isCanonicalBase64,wf as isChatCompatibleModel,Wb as isChatWorkspacePath,Vr as isClineProvider,Ig as isGeneratedMedia,Yy as isHubDaemonProcess,kv as isHubProtocolCompatible,mg as isHubScheduleMode,Mv as isHubToolExecutorName,rx as isLikelyAuthError,Yg as isMcpTimeoutConfigured,Pb as isOtlpTraceRelayProvider,rp as isRuntimeConfigExtensionKind,eb as isSupervisedConnectorProcess,If as isTranscriptionModel,cl as listConnectorCatalog,wb as markOtlpTraceRelayProvider,wh as maskSecret,jf as mergeConnectorConnectArgs,Hg as mergeModelOptions,mr as modelHasCapability,Pf as modelProducesImages,zf as modelSupportsImageInput,Of as modelSupportsToolCalling,Jg as noopBasicLogger,Fr as normalizeJsonLikeStringsForSchema,gl as normalizePluginManifest,mi as normalizeSdkError,Sl as normalizeUserInput,gh as omitUndefinedValues,pg as parseHookEventPayload,ch as parseJsonStream,Hb as parseRuntimeConfigExtensions,xl as parseUserCommandEnvelope,_g as parseUserInputMode,fy as prepareRemoteConfigRuntime,$h as processWorkspaceInfo,ob as readConnectorCliLaunchSpec,Iv as readHubScheduleMode,yd as readRemoteConfigSessionBlobUploadMetadata,nb as readStartingConnectorInstance,gr as registerDisposable,Wh as registerRemoteConfigSessionBlobUpload,wt as reserveImageMediaBytes,xb as resetSdkErrorRateLimiterForTests,si as resolveClineBuildEnv,Kd as resolveClineEnvironment,Vg as resolveEffectiveReasoningEffort,zb as resolveHookSessionContext,Pv as resolveHubCommandTimeoutMs,aT as resolveMcpTimeoutSeconds,vr as resolveMediaBudget,Dh as resolveProviderApiKeyOptional,Bh as resolveProviderLocalCli,qg as resolveReasoningBudgetFromRatio,Ul as resolveReasoningEffortRatio,Nb as resolveRootSessionId,lh as safeJsonParse,uh as safeJsonStringify,Rh as sanitizeFileName,ae as sanitizeSurrogates,Gg as serializeAbortReason,Dy as setClineClientIdentity,Xy as setConnectorCliLaunchSpec,tb as setStartingConnectorInstance,ul as shouldIncludeConnectorField,_l as stripModeNotices,Ph as stripUtf8Bom,tl as supportsChatModalities,Dl as toAiSdkToolResultOutput,yh as toPosixSeparators,Ah as trimNonEmpty,Ih as truncateSplit,ed as truncateStr,VC as upsertWorkspaceInfo,Mf as usesImageGenerationOperation,zg as validateAndReserveBase64Media,Pt as validateAndReserveImageMedia,Ol as validateImageMedia,zh as validateWithZod,Ny as withResolvedClineBuildEnv,kl as xmlTagsRemoval,jr as zodToJsonSchema};
|
|
187
|
+
actual: ${r}
|
|
188
|
+
Re-record the cassette if the request change is intentional.`)}function zx(e,t){if(!mx(e))process.stderr.write(`[VCR] Cassette file not found: ${e}
|
|
189
|
+
`),process.exit(1);let n=JSON.parse(gx(e,"utf-8")),r=Number.parseInt(process.env.CLINE_VCR_SSE_DELAY??"100",10),o=Array(n.length).fill(!1),i=globalThis.fetch;globalThis.fetch=Object.assign(async(a,c)=>{let u=hp(a),l=yp(a,c),{path:p}=gp(u),m=bi(p);if(t&&!p.includes(t))return i(a,c);let f=n.findIndex((g,y)=>{if(o[y])return!1;let S=bi(g.path);return g.method.toUpperCase()===l&&S===m});if(f>=0){let g=n[f];if(!g)return i(a,c);await Ox({recording:g,requestInput:a,requestInit:c,method:l,path:m}),o[f]=!0;let y=typeof g.response==="string"?g.response:JSON.stringify(g.response),S=new Headers;if(g.contentType)S.set("content-type",g.contentType);else if(typeof g.response==="string"&&g.response.trimStart().startsWith("data:"))S.set("content-type","text/event-stream");else if(typeof g.response==="object")S.set("content-type","application/json");let v=S.get("content-type")?.includes("text/event-stream")??!1;if(v)S.set("cache-control","no-cache"),S.set("connection","keep-alive");if(v&&typeof g.response==="string"){let k=Px(g.response);if(k.length>1){let M=Mx(k,r);return new Response(M,{status:g.status,headers:S})}}return new Response(y,{status:g.status,headers:S})}if(!t)throw Error(`[VCR] No matching recording for ${l} ${u} (path: ${m}). ${n.length} recording(s) loaded from ${e}.`);return i(a,c)},{preconnect:(a)=>{}});let s=t?`(only paths matching "*${t}*", all other requests go through normally)`:"(all requests intercepted)";process.stderr.write(`[VCR] Playing back ${n.length} recorded HTTP interaction(s) from ${e} ${s}
|
|
190
|
+
`)}function Nx(e){let t=wx(e);if(!t)return;if(t.mode==="record")Ix(t.cassettePath,t.filter,t.includeRequestBody);else zx(t.cassettePath,t.filter)}export{yb as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,Cy as APIKeySchema,dp as AUTH_ERROR_PATTERNS,gv as AgentConfigSchema,jf as AgentFinishReasonSchema,fv as AgentResultSchema,Vf as AgentUsageSchema,Zd as AllowedMCPServerSchema,Bd as AnthropicModelSchema,Ud as AnthropicSchema,Nf as ApiFormat,Wu as ApiFormatSchema,Pd as AwsBedrockCustomModelSchema,Id as AwsBedrockModelSchema,Md as AwsBedrockSettingsSchema,th as CHARS_PER_TOKEN,Mn as CLINE_BUILD_ENV_ENV,nx as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,eb as CLINE_CONNECTOR_CLI_LAUNCH_ENV,tb as CLINE_CONNECTOR_STARTING_INSTANCE_ENV,nb as CLINE_CONNECTOR_SUPERVISED_ENV,Vd as CLINE_DEBUG_HOST_ENV,qd as CLINE_DEBUG_PORT_BASE_ENV,Gh as CLINE_DEFAULT_MODEL_ID,Ay as CLINE_DEFAULT_RPC_ADDRESS,Ry as CLINE_DEFAULT_RPC_PORT,ci as CLINE_ENVIRONMENTS,Gy as CLINE_ENVIRONMENT_ENV,Ky as CLINE_ENVIRONMENT_OVERRIDE_ENV,Ey as CLINE_HUB_DEV_PORT,ky as CLINE_HUB_PORT,Qy as CLINE_RUN_AS_HUB_DAEMON_ENV,tx as CLINE_WORKSPACES_DIRECTORY_NAME,sT as CONFIGURABLE_MODEL_TOOL_NAMES,cl as CONNECTOR_CATALOG,dl as CONNECTOR_PLATFORMS,Cb as CORE_SPAWN_REASONS,wv as CURRENT_HUB_PROTOCOL_VERSION,Od as ClineModelSchema,zd as ClineSettingsSchema,Gf as ConnectorAuthorizationDecisionSchema,qf as ConnectorAuthorizationRequestSchema,sl as ConnectorEventActorSchema,al as ConnectorEventContextSchema,il as ConnectorHookEventNameSchema,Kf as ConnectorHookEventSchema,yo as ContributionRegistry,Wy as DEFAULT_CLINE_ENVIRONMENT,So as DEFAULT_MAX_IMAGE_BASE64_BYTES,Se as DEFAULT_MAX_IMAGE_DECODED_BYTES,fe as DEFAULT_MAX_IMAGE_ENCODED_BYTES,Pl as DEFAULT_MAX_TOTAL_MEDIA_BYTES,pT as DEFAULT_MCP_TIMEOUT_SECONDS,ox as DEFAULT_OUTCOME_REQUIRED_SECTIONS,Yg as DEFAULT_REASONING_EFFORT,cp as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,Mt as EMPTY_CONTENT_TEXT,Hl as ESTIMATED_TOKENS_PER_IMAGE,jd as EnterpriseTelemetrySchema,lg as FEATURE_FLAGS,Ke as FeatureFlag,ug as FeatureFlagDefaultValue,Rl as GeneratedMediaModalitySchema,Il as GeneratedMediaSchema,Al as GeneratedMediaSourceSchema,si as GlobalInstructionsFileSchema,Mv as HUB_CAPABILITIES,Vv as HUB_CHECKPOINT_CAPABILITY,zv as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Dv as HUB_COMMAND_SLOW_LOG_MS,jv as HUB_COMPACTION_CAPABILITY,Fv as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,_g as HUB_DEFAULT_COMMAND_TIMEOUT_MS,Hv as HUB_HOOK_CAPABILITY_PREFIX,qv as HUB_MISTAKE_LIMIT_CAPABILITY,xl as HUB_SCHEDULE_MODES,Zv as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,Tg as HUB_TOOL_EXECUTOR_NAMES,Gv as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,yl as HookEventNameSchema,bl as HookEventPayloadSchema,We as IMAGE_OMITTED_PLACEHOLDER,Je as IMAGE_UNSUPPORTED_PLACEHOLDER,Qd as LOOPBACK_NO_PROXY_HOSTS,Ld as LiteLLMModelSchema,Dd as LiteLLMSchema,Pv as MAX_CLIENT_HUB_PROTOCOL_VERSION,fT as MAX_MCP_TIMEOUT_SECONDS,Iv as MIN_CLIENT_HUB_PROTOCOL_VERSION,mT as MIN_MCP_TIMEOUT_SECONDS,iT as MODEL_TOOL_NAMES,ad as MODE_TAG_INSTRUCTIONS,Ju as ModelCapabilitySchema,xn as ModelInfoSchema,el as ModelMetadataSchema,tl as ModelModalitiesSchema,mo as ModelModalitySchema,ol as ModelOperationModeSchema,rl as ModelOperationSchema,Xu as ModelPricingSchema,po as ModelReasoningOptionSchema,Yu as ModelStatusSchema,gb as NO_DEFAULT_CURRENT_DIRECTORY_IN_EXE_PATH_ENV,Nv as ONE_TIME_SCHEDULE_CRON_PATTERN,$v as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,gi as OTLP_TRACE_RELAY_MARKER,Ad as OpenAiCompatibleModelSchema,wd as OpenAiCompatibleSchema,ud as PLAN_MODE_INSTRUCTIONS,ld as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,cg as PLUGIN_FILE_EXTENSIONS,Hd as PromptUploadingSchema,wy as ProviderCapabilitySchema,Py as ProviderClientSchema,Iy as ProviderProtocolSchema,zt as REASONING_EFFORT_RATIOS,yn as REASONING_LEVELS,hd as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,dy as REMOTE_URI_SCHEME,hi as RUNTIME_CONFIG_EXTENSION_KINDS,bn as ReasoningEffortSchema,lo as ReasoningLevelSchema,Ty as RemoteConfigSchema,Fd as RemoteMCPServerSchema,Pn as S3AccessKeySettingsSchema,kb as SDK_ERROR_TELEMETRY_EVENT,Cl as SESSION_SEARCH_PREVIEW_MAX_LENGTH,Tl as SESSION_SEARCH_TITLE_MAX_LENGTH,Wb as SESSION_STATUS_VALUES,vn as SUPPORTED_IMAGE_MEDIA_TYPES,vb as TASK_CANCELLED_EVENT,Sb as TASK_FIRST_CHUNK_RECEIVED_EVENT,Tb as TASK_MAX_TOKENS_RECOVERY_EVENT,bb as TASK_PROVIDER_REQUEST_STARTED_EVENT,_b as TASK_PROVIDER_STREAM_FAILED_EVENT,xb as TASK_PROVIDER_STREAM_STARTED_EVENT,ok as TEAM_AWAIT_TIMEOUT_MS,Oy as TEAM_LIFECYCLE_EVENT_TYPE,My as TEAM_PROGRESS_EVENT_TYPE,ik as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,sk as TEAM_RUN_TEXT_PREVIEW_LIMIT,dk as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,Hf as TOOL_REJECTION_SUFFIX,Tk as TeamAttachOutcomeFragmentInputSchema,hk as TeamAwaitRunsInputSchema,bk as TeamBroadcastInputSchema,Lk as TeamBroadcastToolResultSchema,gk as TeamCancelRunInputSchema,Nk as TeamCancelRunToolResultSchema,_k as TeamCleanupInputSchema,Bk as TeamCleanupToolResultSchema,vk as TeamCreateOutcomeInputSchema,Ok as TeamCreateOutcomeToolResultSchema,kk as TeamFinalizeOutcomeInputSchema,Zk as TeamFinalizeOutcomeToolResultSchema,Ek as TeamListOutcomesInputSchema,fk as TeamListRunsInputSchema,Pk as TeamMailboxMessageToolResultSchema,ux as TeamMessageType,Sk as TeamMissionLogInputSchema,Dk as TeamMissionLogToolResultSchema,Uk as TeamOutcomeFragmentToolResultSchema,Mk as TeamOutcomeToolResultSchema,xk as TeamReadMailboxInputSchema,Ck as TeamReviewOutcomeFragmentInputSchema,cx as TeamRunResultSummarySchema,mk as TeamRunTaskInputSchema,wk as TeamRunTaskToolResultSchema,Ik as TeamRunToolSummarySchema,yk as TeamSendMessageInputSchema,$k as TeamSendMessageToolResultSchema,uk as TeamShutdownTeammateInputSchema,zk as TeamSimpleAgentStatusToolResultSchema,ck as TeamSpawnTeammateInputSchema,lk as TeamStatusInputSchema,Rk as TeamStatusToolResultSchema,pk as TeamTaskInputSchema,ax as TeamTaskListItemToolResultSchema,Ak as TeamTaskToolResultSchema,ak as TeamTeammateSpecSchema,Qu as ThinkingConfigSchema,go as ToolCallRecordSchema,nT as USAGE_COST_DISPLAYS,Ff as USER_REJECTED_TOOL_REASON,Nd as VertexModelSchema,$d as VertexSettingsSchema,Qb as WorkspaceInfoSchema,ex as WorkspaceManifestSchema,Hy as augmentNodeCommandForDebug,jh as buildClineSystemPrompt,Wf as buildConnectorConnectArgs,ty as buildRemoteConfigSessionBlobUploadMetadata,np as buildSdkErrorProperties,Zb as buildTelemetrySelfcheckReport,wb as captureAgentUnexpectedReasoningTokens,Pb as captureSdkError,Ib as captureTaskLifecycleEvent,rb as claimHubDaemonProcess,sb as claimSupervisedConnectorProcess,ih as clampMcpTimeoutSeconds,by as clearMaterializedRemoteConfigRuntime,ry as clearRemoteConfigSessionBlobUpload,Xf as connectorChannelsFromPlatforms,Db as createClineTelemetryServiceConfig,op as createClineTelemetryServiceMetadata,ag as createContributionRegistry,jl as createImageAwareReplacer,Tn as createMediaBudgetState,Ig as createModeSwitchNoticeTracker,ly as createRemoteConfigSessionMessagesArtifactUploader,Kb as createSessionId,dx as createTool,_h as decodeJwtPayload,Kv as describeOutdatedHubSessions,hb as disableCurrentDirectoryExecutableSearch,ng as disposeAll,QC as emptyWorkspaceManifest,fb as ensureLoopbackProxyBypass,nh as estimateRequestInputTokens,Fl as estimateTokens,xo as formatDisplayUserInput,bo as formatFileContentBlock,Bh as formatHumanReadableDate,hT as formatMcpTimeoutErrorMessage,Wg as formatMessagesForAiSdk,wg as formatModeSwitchNotice,Ng as formatSessionSearchPreview,zg as formatSessionSearchTitle,Uh as formatUptime,Eg as formatUserCommandBlock,kg as formatUserInputBlock,Lg as generatedMediaModalityFromMediaType,qy as getClineClientIdentity,Xy as getClineEnvironmentConfig,vg as getDefaultHubCommandTimeoutMs,kh as getDefaultShell,ah as getErrorCode,sh as getErrorMessage,rt as getPowerShellEdition,Oh as getShellArgs,nd as getShellInvocation,jo as getShellKind,Xb as hasRuntimeConfigExtension,_o as imageBase64DecodedByteLength,Dg as imageBase64EncodedByteLength,vo as imageBase64LengthForDecodedBytes,Bg as imageFileMaxDecodedBytesForBase64Limit,Nx as initVcr,Ml as isBase64Char,jy as isBunEmbeddedModulePath,Ug as isCanonicalBase64,Lf as isChatCompatibleModel,rx as isChatWorkspacePath,qo as isClineProvider,$g as isGeneratedMedia,ob as isHubDaemonProcess,Ov as isHubProtocolCompatible,Sg as isHubScheduleMode,Uv as isHubToolExecutorName,px as isLikelyAuthError,oh as isMcpTimeoutConfigured,$b as isOtlpTraceRelayProvider,up as isRuntimeConfigExtensionKind,ab as isSupervisedConnectorProcess,$f as isTranscriptionModel,ul as listConnectorCatalog,Nb as markOtlpTraceRelayProvider,Lh as maskSecret,Yf as mergeConnectorConnectArgs,Jg as mergeModelOptions,fo as modelHasCapability,Df as modelProducesImages,Zf as modelSupportsImageInput,Uf as modelSupportsToolCalling,rh as noopBasicLogger,Ho as normalizeJsonLikeStringsForSchema,hl as normalizePluginManifest,fi as normalizeSdkError,_l as normalizeUserInput,vh as omitUndefinedValues,xg as parseHookEventPayload,gh as parseJsonStream,Yb as parseRuntimeConfigExtensions,Sl as parseUserCommandEnvelope,Ag as parseUserInputMode,_y as prepareRemoteConfigRuntime,Hh as processWorkspaceInfo,lb as readConnectorCliLaunchSpec,Lv as readHubScheduleMode,Sd as readRemoteConfigSessionBlobUploadMetadata,ub as readStartingConnectorInstance,ho as registerDisposable,ny as registerRemoteConfigSessionBlobUpload,It as reserveImageMediaBytes,Eb as resetSdkErrorRateLimiterForTests,ai as resolveClineBuildEnv,Yd as resolveClineEnvironment,Xg as resolveEffectiveReasoningEffort,Fb as resolveHookSessionContext,Bv as resolveHubCommandTimeoutMs,gT as resolveMcpTimeoutSeconds,To as resolveMediaBudget,Vh as resolveProviderApiKeyOptional,qh as resolveProviderLocalCli,Qg as resolveReasoningBudgetFromRatio,Zl as resolveReasoningEffortRatio,Hb as resolveRootSessionId,yh as safeJsonParse,hh as safeJsonStringify,zh as sanitizeFileName,ae as sanitizeSurrogates,eh as serializeAbortReason,Vy as setClineClientIdentity,ib as setConnectorCliLaunchSpec,cb as setStartingConnectorInstance,ll as shouldIncludeConnectorField,vl as stripModeNotices,Dh as stripUtf8Bom,nl as supportsChatModalities,Bl as toAiSdkToolResultOutput,Ch as toPosixSeparators,Nh as trimNonEmpty,$h as truncateSplit,rd as truncateStr,ek as upsertWorkspaceInfo,Bf as usesImageGenerationOperation,Zg as validateAndReserveBase64Media,Pt as validateAndReserveImageMedia,zl as validateImageMedia,Zh as validateWithZod,Fy as withResolvedClineBuildEnv,El as xmlTagsRemoval,Vo as zodToJsonSchema};
|