@gperezmz/bb-plugin-thread-glance 0.2.1 → 0.2.2

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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/app.css +1 -1
  3. package/dist/app.js +29 -29
  4. package/dist/app.meta.json +1 -1
  5. package/dist/server.js +1 -1
  6. package/dist/server.js.map +2 -2
  7. package/dist/server.meta.json +1 -1
  8. package/features/thread-list/components/FoldRows.tsx +12 -11
  9. package/features/thread-list/components/GroupSection.tsx +131 -102
  10. package/features/thread-list/components/ThreadDetails.tsx +2 -3
  11. package/features/thread-list/components/ThreadList.tsx +10 -9
  12. package/features/thread-list/components/ThreadRowView.tsx +22 -18
  13. package/features/thread-list/components/Toolbar.tsx +1 -1
  14. package/features/thread-list/components/controller.ts +2 -0
  15. package/features/thread-list/components/glyphs.tsx +19 -1
  16. package/features/thread-list/data/{useNeedsYouHold.ts → useAttentionHold.ts} +5 -5
  17. package/features/thread-list/model/{needs-you.ts → attention.ts} +24 -24
  18. package/features/thread-list/model/counters.ts +3 -3
  19. package/features/thread-list/model/details.ts +1 -1
  20. package/features/thread-list/model/expansion.ts +10 -10
  21. package/features/thread-list/model/families.ts +26 -22
  22. package/features/thread-list/model/layout.ts +0 -43
  23. package/features/thread-list/model/notes.ts +37 -4
  24. package/features/thread-list/model/settings.ts +1 -1
  25. package/features/thread-list/model/share.ts +3 -3
  26. package/features/thread-list/model/state.ts +1 -1
  27. package/features/thread-list/model/toggles.ts +7 -5
  28. package/features/thread-list/model/view.ts +68 -47
  29. package/features/thread-list/testing/fixtures.ts +3 -3
  30. package/package.json +1 -1
  31. package/server/cli.ts +1 -1
  32. package/shared/preferences.ts +2 -2
  33. package/skills/thread-glance/SKILL.md +4 -4
  34. package/features/thread-list/components/Rails.tsx +0 -27
@@ -3,7 +3,7 @@
3
3
  "sdkVersion": "0.5.9",
4
4
  "artifactFormatVersion": 1,
5
5
  "pluginId": "thread-glance",
6
- "pluginVersion": "0.2.1",
6
+ "pluginVersion": "0.2.2",
7
7
  "builtWith": {
8
8
  "bbVersion": "0.43.4",
9
9
  "pluginSdkVersion": "0.5.9"
package/dist/server.js CHANGED
@@ -65,7 +65,7 @@ ${a}`:a:"",f=Function,p=`return (input) => {
65
65
  ${a}
66
66
  }`,d;try{d=new f(...u,p)(...c)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}s(Gn,"compileFn");function S(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}s(S,"addConstant");function Ge(e,t){return e.definite=!1,S(e,t)}s(Ge,"addUserConstant");function k(e){return`v${e.varCounter++}`}s(k,"newVar");function Gh(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return Y;let n=r;return n.issues.length===0?n.value:Y}s(Gh,"runtimeRun");function W(e,t,r,n,o=!0){let i=e.content.length,u=t.constants.size,c=t.constantCounter,a=t.varCounter;try{return V(e,t,r,n,o)}catch(l){if(!(l instanceof Z)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>u){let f=Array.from(t.constants.keys()).slice(u);for(let p of f)t.constants.delete(p)}return t.constantCounter=c,t.varCounter=a,qh(e,t,r,n)}}s(W,"compileChild");function qh(e,t,r,n){t.definite=!1;let o=S(t,r),i=S(t,Gh),u=k(t);return e.write(`const ${u} = ${i}(${o}, ${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}s(qh,"emitRuntimeIsland");var Wh=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Xh(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let u of o){let c=u._zod.def;if(c.when&&!Wh.has(c.check))throw new Z('check with a custom "when" condition');switch(c.check){case"greater_than":Hh(e,t,c,i);break;case"less_than":Yh(e,t,c,i);break;case"multiple_of":Qh(e,t,c,i);break;case"number_format":Mf(e,c,i);break;case"min_length":{let a=Be(c.minimum,"min_length"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length < ${c.minimum*2}`);e.write(`if (${l} < ${a}) return INVALID;`);break}case"max_length":{let a=Be(c.maximum,"max_length"),l=qu(e,t,i,`${i}.length > ${a}`);e.write(`if (${l} > ${a}) return INVALID;`);break}case"length_equals":{let a=Be(c.length,"length_equals"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length <= ${c.length*2}`);e.write(`if (${l} !== ${a}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Be(c.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Be(c.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Be(c.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Ff(e,t,c,i);break;case"custom":i=ig(e,t,u,i);break;case"bigint_format":eg(e,c,i);break;case"mime_type":tg(e,t,c,i);break;case"property":ng(e,t,c,i);break;case"properties":rg(e,t,c,i);break;case"overwrite":{let a=k(t);og(e,t,u,i,a),i=a;break}default:throw new Z(`check type ${c.check}`)}}return i}s(Xh,"generateChecks");function qu(e,t,r,n){let o=S(t,Me),i=k(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}s(qu,"codePointLengthVar");function Be(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Z(`${t} bound of type ${typeof e}`);return`${e}`}s(Be,"numericOperand");function Vf(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Z("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Z("comparison check with Invalid Date bound");return S(e,t)}throw new Z(`comparison check bound of type ${typeof t}`)}s(Vf,"comparisonOperand");function Hh(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${Vf(t,r.value)}) return INVALID;`)}s(Hh,"generateGreaterThanCheck");function Yh(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Vf(t,r.value)}) return INVALID;`)}s(Yh,"generateLessThanCheck");function Qh(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=S(t,qt);e.write(`if (${o}(${n}, ${Be(r.value,"multiple_of")}) !== 0) return INVALID;`)}}s(Qh,"generateMultipleOfCheck");function Mf(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new Z(`number format ${n}`)}}s(Mf,"generateNumberFormatCheck");function eg(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new Z(`bigint format ${n}`)}}s(eg,"generateBigIntFormatCheck");function tg(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=S(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}s(tg,"generateMimeTypeCheck");function rg(e,t,r,n){if(r.when)throw new Z('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let u=typeof i=="symbol"?S(t,i):X(i),c=k(t);e.write(`const ${c} = ${n}[${u}];`),W(e,t,o[i],c,!1)}}s(rg,"generatePropertiesChecks");function ng(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;V(e,t,r.schema,o)}s(ng,"generatePropertyCheck");function og(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(qe(i))throw new pe("z.compile: async overwrite transforms are not supported");let u=S(t,i);e.write(`const ${o} = ${u}(${n});`)}s(og,"generateOverwriteCheck");function Wu(){throw new ne}s(Wu,"throwAsync");function Yu(e){this.issues.push(e)}s(Yu,"pushIssue");function ig(e,t,r,n){let o=r._zod.def;if(o.fn){if(qe(o.fn))throw new pe("z.compile: async .refine() predicates are not supported");let i=Ge(t,o.fn),u=S(t,Wu),c=k(t);return e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`),n}if(r._zod.check){if(qe(r._zod.check))throw new pe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=Ge(t,s(l=>{let f={value:l,issues:[],addIssue:Yu};return i(f)instanceof Promise&&Wu(),f.issues.length===0?f.value:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}throw new Z("custom check without a predicate or check function")}s(ig,"generateCustomRefineCheck");var sg=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function Ff(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=S(t,dr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=S(t,An);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=S(t,Nn),f=S(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=S(t,pr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=S(t,Pn);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=S(t,On);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=S(t,Zn);return e.write(`if (!${l}(${n})) return INVALID;`),n}let u=r;if(i==="url"||i==="httpurl"||u.normalize||u.hostname!==void 0||u.protocol!==void 0){let l=S(t,kn),f=S(t,r),p=k(t),d=k(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),u.hostname!==void 0){let y=S(t,zn);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(u.protocol!==void 0){let y=S(t,Sn);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=k(t),g=u.normalize?`${d}.href`:`${S(t,fr)}(${p})`;return e.write(`const ${m} = ${g};`),m}let c=r.fn;if(c){if(qe(c))throw new Z(`async string format ${i}`);let l=S(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(sg.has(i)&&r.pattern){let l=S(t,r.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${n})) return INVALID;`),n}let a=r.format;switch(a){case"regex":throw new Z("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${X(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${n}.slice(0, ${l.length}) !== ${X(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${n}.slice(-${l.length}) !== ${X(l)}) return INVALID;`);break}default:throw new Z(`string format ${a}`)}return n}s(Ff,"generateStringFormatCheck");function V(e,t,r,n,o=!0){let i=r._zod.def,u=i.type;if(i.coerce)throw new Z(`coercion (z.coerce.${u}())`);let c=o||!!i.checks?.length,a;switch(u){case"string":a=ug(e,t,r,n,c);break;case"number":a=cg(e,r,n);break;case"boolean":a=ag(e,n);break;case"bigint":a=lg(e,r,n);break;case"symbol":a=fg(e,n);break;case"undefined":a=pg(e,n);break;case"null":a=dg(e,n);break;case"any":case"unknown":a=n;break;case"never":e.write("return INVALID;"),a=n;break;case"void":a=mg(e,n);break;case"nan":a=hg(e,n);break;case"date":a=gg(e,n);break;case"object":a=yg(e,t,r,n,c);break;case"optional":a=_g(e,t,r,n,c);break;case"nullable":a=bg(e,t,r,n,c);break;case"array":a=vg(e,t,r,n,c);break;case"literal":a=xg(e,t,r,n);break;case"enum":a=kg(e,t,r,n);break;case"readonly":{let l=Rf(e,t,r,n),f=k(t);e.write(`const ${f} = Object.freeze(${l});`),a=f;break}case"success":Rf(e,t,r,n),a="true";break;case"default":case"prefault":a=zg(e,t,r,n);break;case"nonoptional":a=Sg(e,t,r,n);break;case"tuple":a=Pg(e,t,r,n);break;case"union":a=Ig(e,t,r,n);break;case"intersection":a=Zg(e,t,r,n);break;case"record":a=Ng(e,t,r,n);break;case"map":a=Cg(e,t,r,n);break;case"set":a=Tg(e,t,r,n);break;case"file":a=Dg(e,n);break;case"template_literal":a=Rg(e,t,r,n);break;case"lazy":a=Lg(e,t,r,n);break;case"pipe":a=jg(e,t,r,n);break;case"custom":a=Vg(e,t,r,n);break;case"transform":a=Kg(e,t,r,n);break;case"catch":a=Fg(e,t,r,n);break;default:throw new Z(`schema type ${u}`)}return a===null?null:Xh(e,t,r,a)}s(V,"generateCheck");function ug(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:Ff(e,t,i,n,o)}s(ug,"generateStringCheck");function cg(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&Mf(e,{format:n.format},r),r}s(cg,"generateNumberCheck");function ag(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(ag,"generateBooleanCheck");function lg(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}s(lg,"generateBigIntCheck");function fg(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(fg,"generateSymbolCheck");function pg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(pg,"generateUndefinedCheck");function dg(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(dg,"generateNullCheck");function mg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(mg,"generateVoidCheck");function hg(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(hg,"generateNaNCheck");function gg(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(gg,"generateDateCheck");function yg(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let u=i.shape,c=Object.keys(u),a=Object.getOwnPropertySymbols(u),l=a.length?[...c,...a]:c,f=s(x=>typeof x=="symbol"?S(t,x):X(x),"keyExpr"),p=s(x=>typeof x=="symbol"?`[${f(x)}]`:X(x),"propKey"),d=u;if(c.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let x of l){let I=d[x],E=f(x),j=k(t);if(e.write(`const ${j} = ${n}[${E}];`),I._zod.optin!==void 0){let N=k(t);e.write(`let ${N} = (() => {`),e.indented(q=>{let Jt=W(q,t,I,j);q.write(`return ${Jt};`)}),e.write("})();"),I._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(q=>{q.write(`if (${E} in ${n}) return INVALID;`),q.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),m.set(x,N)}else{wg(I)&&e.write(`if (!(${E} in ${n})) return INVALID;`);let N=W(e,t,I,j,o);N!==null&&m.set(x,N)}}let g=i.catchall,y="none";if(g){let x=g._zod.def.type;if(x==="never"){let I=c.map(E=>`k !== ${X(E)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(E=>{E.write(`if (${I}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let $=k(t),z=l.some(x=>Df(d[x])||Xu(d[x]));if(!o){if(y==="schema"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`);let E=k(t);I.write(`const ${E} = ${n}[k];`),W(I,t,g,E,!1)}),e.write("}")}return null}if(z){e.write(`const ${$} = {};`);for(let x of l){let I=f(x),E=m.get(x);Xu(d[x])?e.write(`if (${I} in ${n}) ${$}[${I}] = ${E};`):Df(d[x])?e.write(`if (${E} !== undefined || ${I} in ${n}) ${$}[${I}] = ${E};`):e.write(`${$}[${I}] = ${E};`)}}else{let x=l.map(I=>`${p(I)}: ${m.get(I)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(y!=="none"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{if(I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`),y==="passthrough")I.write(`${$}[k] = ${n}[k];`);else{let E=k(t);I.write(`const ${E} = ${n}[k];`);let j=W(I,t,g,E);I.write(`${$}[k] = ${j};`)}}),e.write("}")}return $}s(yg,"generateObjectCheck");function _g(e,t,r,n,o=!0){let i=r._zod.def;if($g(r))return V(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let c=k(t),a=k(t);return e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`const ${a} = (() => {`),l.indented(f=>{let p=V(f,t,i.innerType,n);f.write(`return ${p};`)}),l.write("})();"),l.write(`if (${a} !== INVALID) ${c} = ${a};`)}),e.write("} else {"),e.indented(l=>{let f=V(l,t,i.innerType,n);l.write(`${c} = ${f};`)}),e.write("}"),c}let u=o?k(t):null;return u&&e.write(`let ${u};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(_g,"generateOptionalCheck");function $g(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s($g,"isExactOptional");function wg(e){return e._zod.optin===void 0&&Je(e)}s(wg,"requiresPresenceCheck");function Je(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Je(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Je(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Je):!0;case"intersection":return!t.left||!t.right?!0:Je(t.left)&&Je(t.right);case"pipe":return t.in?Je(t.in):!0;default:return!0}}s(Je,"fastPathAcceptsAbsence");function Xu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Xu,"dropsWhenAbsent");function Df(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&$t(e)}s(Df,"mayOmitUndefined");function $t(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?$t(t.innerType):!0;case"union":return t.options?t.options.some($t):!0;case"intersection":return!t.left||!t.right||$t(t.left)||$t(t.right);case"pipe":return t.out?$t(t.out):!0;default:return!0}}s($t,"mayOutputUndefined");function bg(e,t,r,n,o=!0){let i=r._zod.def,u=o?k(t):null;return u&&e.write(`let ${u} = null;`),e.write(`if (${n} !== null) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(bg,"generateNullableCheck");function vg(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`);let u=o?k(t):null,c=k(t),a=k(t);return u&&e.write(`const ${u} = new Array(${n}.length);`),e.write(`for (let ${c} = 0; ${c} < ${n}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${a} = ${n}[${c}];`);let f=W(l,t,i.element,a,o);u&&f!==null&&l.write(`${u}[${c}] = ${f};`)}),e.write("}"),u}s(vg,"generateArrayCheck");function xg(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}let u=i[0];if(typeof u=="number"&&Number.isNaN(u)){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}if(typeof u=="string")e.write(`if (${n} !== ${X(u)}) return INVALID;`);else if(typeof u=="number"||typeof u=="boolean")e.write(`if (${n} !== ${u}) return INVALID;`);else if(u===null)e.write(`if (${n} !== null) return INVALID;`);else if(u===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof u=="bigint")e.write(`if (${n} !== ${u}n) return INVALID;`);else throw new Z(`literal type ${typeof u}`);return n}s(xg,"generateLiteralCheck");function kg(e,t,r,n){let o=r._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=S(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}s(kg,"generateEnumCheck");function Rf(e,t,r,n){let o=r._zod.def;return V(e,t,o.innerType,n)}s(Rf,"generateWrapperCheck");function zg(e,t,r,n){let o=r._zod.def,u=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!u)return V(e,t,o.innerType,n);let a=S(t,u),l=k(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${a}();`),V(e,t,o.innerType,l)}let c=k(t);if(u){let a=S(t,u),l=S(t,Wt);e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(f=>{f.write(`${c} = ${l}(${a}());`)}),e.write("} else {"),e.indented(f=>{let p=V(f,t,o.innerType,n);f.write(`${c} = ${p} === undefined ? ${l}(${a}()) : ${p};`)}),e.write("}")}else e.write(`let ${c};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let l=V(a,t,o.innerType,n);a.write(`${c} = ${l};`)}),e.write("}");return c}s(zg,"generateDefaultCheck");function Sg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.innerType,n),u=k(t);return e.write(`const ${u} = ${i};`),e.write(`if (${u} === undefined) return INVALID;`),u}s(Sg,"generateNonOptionalCheck");function Pg(e,t,r,n){let o=r._zod.def,i=o.items,u=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let c=Lf(i,"optin"),a=Lf(i,"optout");u?e.write(`if (${n}.length < ${c}) return INVALID;`):e.write(`if (${n}.length < ${c} || ${n}.length > ${i.length}) return INVALID;`);let l=k(t);e.write(`const ${l} = [];`);for(let f=0;f<i.length;f++){let p=i[f];if(f>=a)e.write(`if (${l}.length === ${f}) {`),e.indented(d=>{d.write(`if (${f} < ${n}.length) {`),d.indented(m=>{let g=k(t);m.write(`const ${g} = ${n}[${f}];`);let y=W(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Xu(p)){m.write(`${l}.length = ${f};`);return}let g=k(t),y=k(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented($=>{let z=W($,t,p,g);$.write(`return ${z};`)}),m.write("})();"),m.write(`if (${y} === INVALID || ${y} === undefined) ${l}.length = ${f};`),m.write(`else ${l}[${f}] = ${y};`)}),d.write("}")}),e.write("}");else{let d=k(t);e.write(`const ${d} = ${n}[${f}];`);let m=W(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(u){let f=k(t),p=k(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let m=W(d,t,u,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}s(Pg,"generateTupleCheck");function Lf(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}s(Lf,"getTupleOptStart");function Ig(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Ag(e,t,o,n);if(o.inclusive===!1)throw new Z("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return V(e,t,i[0],n);if(i.every(a=>a._zod.def.type==="literal"&&!a._zod.def.checks?.length)){let a=new Set(i.flatMap(f=>f._zod.def.values)),l=S(t,a);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let c=k(t);e.write(`let ${c};`);for(let a=0;a<i.length;a++){let l=i[a];a===0?e.write(`${c} = (() => {`):e.write(`if (${c} === INVALID) ${c} = (() => {`),e.indented(f=>{let p=V(f,t,l,n);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${c} === INVALID) return INVALID;`),c}s(Ig,"generateUnionCheck");function Ag(e,t,r,n){if(r.unionFallback)throw new Z("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=k(t),i=k(t);e.write(`const ${o} = ${n}?.[${X(r.discriminator)}];`),e.write(`let ${i};`);let u=!0,c=new Set;for(let a of r.options){let l=a._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new Z("discriminated union option without static discriminator values");for(let d of l){if(c.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);c.add(d)}let f=Array.from(l,d=>Og(t,o,d)),p=u?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=V(d,t,a,n);d.write(`${i} = ${m};`)}),e.write("}"),u=!1}return e.write("else { return INVALID; }"),i}s(Ag,"generateDiscriminatedUnionCheck");function Og(e,t,r){if(typeof r=="string")return`${t} === ${X(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=S(e,r);return`${t} === ${n}`}throw new Z(`literal discriminator value ${String(r)}`)}s(Og,"literalEquality");function Zg(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=W(e,t,o.left,n),u=W(e,t,o.right,n),c=S(t,yt),a=k(t);return e.write(`const ${a} = ${c}(${i}, ${u});`),e.write(`if (!${a}.valid) return INVALID;`),`${a}.data`}s(Zg,"generateIntersectionCheck");function Ng(e,t,r,n){let o=r._zod.def,i=S(t,ce);e.write(`if (!${i}(${n})) return INVALID;`);let u=k(t),c=k(t),a=k(t);e.write(`const ${u} = {};`);let l=o,f=l.partial?void 0:o.keyType._zod.values;if(f){let m=[];for(let y of f){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new Z(`record key value ${String(y)}`);let $=typeof y=="number"?y.toString():y;if($==="__proto__")throw new Z('record key "__proto__"');m.push($);let z=S(t,y),x=V(e,t,o.keyType,z),I=k(t);e.write(`const ${I} = ${n}[${Eg(t,$)}];`);let E=W(e,t,o.valueType,I);e.write(`${u}[${x}] = ${E};`)}let g=S(t,new Set(m));return e.write(`for (const ${c} in ${n}) {`),e.indented(y=>{y.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?y.write(`if (${c} !== "__proto__") ${u}[${c}] = ${n}[${c}];`):y.write("return INVALID;")}),e.write("}"),u}let p=o.keyType._zod.def;if(!(p.type==="string"&&p.format===void 0&&!p.coerce&&(p.checks?.length??0)===0)){let m=o.mode==="loose",g=Gn(o.keyType);g.definite===!1&&(t.definite=!1);let y=S(t,g),$=S(t,be),z=k(t);return jf(e,t,n,c,x=>{x.write(`let ${z} = ${y}(${c});`),x.write(`if (${z} === INVALID && typeof ${c} === "string" && ${$}.test(${c})) ${z} = ${y}(Number(${c}));`),m?x.write(`if (${z} === INVALID) { ${u}[${c}] = ${n}[${c}]; continue; }`):x.write(`if (${z} === INVALID) return INVALID;`),x.write(`if (${z} === "__proto__") continue;`);let I=k(t);x.write(`const ${I} = ${n}[${c}];`);let E=W(x,t,o.valueType,I);x.write(`${u}[${z}] = ${E};`)}),u}return jf(e,t,n,c,m=>{m.write(`const ${a} = ${n}[${c}];`);let g=W(m,t,o.valueType,a);m.write(`${u}[${c}] = ${g};`)},"return INVALID;"),u}s(Ng,"generateRecordCheck");function jf(e,t,r,n,o,i){let u=S(t,Object.prototype.propertyIsEnumerable),c=k(t),a=k(t),l=k(t);e.write(`const ${c} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${a} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${a}[${l}];`),f.write(`if (${n} === "__proto__" || !${u}.call(${r}, ${n})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${c}[${l}];`),f.write(`if (!${u}.call(${r}, ${n})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(jf,"emitOwnKeys");function Eg(e,t){return typeof t=="string"?X(t):S(e,t)}s(Eg,"literalPropertyKey");function Cg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`);let i=k(t),u=k(t),c=k(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${u}, ${c}] of ${n}) {`),e.indented(a=>{let l=V(a,t,o.keyType,u),f=V(a,t,o.valueType,c);a.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(Cg,"generateMapCheck");function Tg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`);let i=k(t),u=k(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${u} of ${n}) {`),e.indented(c=>{let a=V(c,t,o.valueType,u);c.write(`${i}.add(${a});`)}),e.write("}"),i}s(Tg,"generateSetCheck");function Dg(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(Dg,"generateFileCheck");function Rg(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=S(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}s(Rg,"generateTemplateLiteralCheck");function Lg(e,t,r,n){let o=r._zod.def,i=Ge(t,o.getter),u=S(t,{parser:null});e.write(`if (!${u}.parser) {`),e.indented(a=>{a.write(`const inner = ${i}();`),a.write(`${u}.parser = function(input) {`),a.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),a.write("};")}),e.write("}");let c=k(t);return e.write(`const ${c} = ${u}.parser(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(Lg,"generateLazyCheck");function jg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.in,n);if(o.transform){if(qe(o.transform))throw new pe("z.compile: async transforms in pipes are not supported");let u=o.transform,a=Ge(t,s(f=>{let p={value:f,issues:[],addIssue:Yu},d=u(f,p);return d instanceof Promise?Y:p.issues.length===0?d:Y},"helperFn")),l=k(t);return e.write(`const ${l} = ${a}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),V(e,t,o.out,l)}else return V(e,t,o.out,i)}s(jg,"generatePipeCheck");function qe(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(qe,"isAsyncFunction");function Vg(e,t,r,n){let o=r._zod.def;if(o.fn){if(qe(o.fn))throw new pe("z.compile: async custom predicates are not supported");let i=Ge(t,o.fn),u=S(t,Wu),c=k(t);e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`)}else throw new Z("custom schema without a predicate function");return n}s(Vg,"generateCustomCheck");function Mg(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return Y;let o=n;return o.issues.length===0?o.value:t()}s(Mg,"runtimeCatch");function Fg(e,t,r,n){let o=r._zod.def;if(!o.catchValue[en])throw new Z("catch with a callback (only a constant catch value compiles)",!1);let i=k(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=W(l,t,o.innerType,n);l.write(`return ${f};`)}),e.write("})();");let u=S(t,o.innerType),c=Ge(t,o.catchValue),a=S(t,Mg);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${a}(${u}, ${c}, ${n});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(Fg,"generateCatchCheck");function Kg(e,t,r,n){let o=r._zod.def;if(o.transform){if(qe(o.transform))throw new pe("z.compile: async transforms are not supported");let i=o.transform,c=Ge(t,s(l=>{let f={value:l,issues:[],addIssue:Yu},p=i(l,f);return p instanceof Promise?Y:f.issues.length===0?p:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}return n}s(Kg,"generateTransformCheck");function qn(e){return e.checks&&(e.checks=[...e.checks]),e}s(qn,"snapshotChecks");function Qu(e,t){return new e(qn({type:"string",..._(t)}))}s(Qu,"_string");function ec(e,t){return new e(qn({type:"string",coerce:!0,..._(t)}))}s(ec,"_coercedString");function Wn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}s(Wn,"_email");function Xn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}s(Xn,"_guid");function Hn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}s(Hn,"_uuid");function Yn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}s(Yn,"_uuidv4");function Qn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}s(Qn,"_uuidv6");function eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}s(eo,"_uuidv7");function kr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}s(kr,"_url");function to(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}s(to,"_emoji");function ro(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}s(ro,"_nanoid");function no(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}s(no,"_cuid");function oo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}s(oo,"_cuid2");function io(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}s(io,"_ulid");function so(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}s(so,"_xid");function uo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}s(uo,"_ksuid");function co(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}s(co,"_ipv4");function ao(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}s(ao,"_ipv6");function tc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}s(tc,"_mac");function lo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}s(lo,"_cidrv4");function fo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}s(fo,"_cidrv6");function po(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}s(po,"_base64");function mo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}s(mo,"_base64url");function ho(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}s(ho,"_e164");function rc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}s(rc,"_creditCard");function nc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}s(nc,"_iban");function go(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}s(go,"_jwt");var oc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function zr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}s(zr,"_isoDateTime");function Sr(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}s(Sr,"_isoDate");function Pr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}s(Pr,"_isoTime");function Ir(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}s(Ir,"_isoDuration");function ic(e,t){return new e(qn({type:"number",checks:[],..._(t)}))}s(ic,"_number");function sc(e,t){return new e(qn({type:"number",coerce:!0,checks:[],..._(t)}))}s(sc,"_coercedNumber");function uc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}s(uc,"_int");function cc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}s(cc,"_float32");function ac(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}s(ac,"_float64");function lc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}s(lc,"_int32");function fc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}s(fc,"_uint32");function pc(e,t){return new e({type:"boolean",..._(t)})}s(pc,"_boolean");function dc(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}s(dc,"_coercedBoolean");function mc(e,t){return new e({type:"bigint",..._(t)})}s(mc,"_bigint");function hc(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}s(hc,"_coercedBigint");function gc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}s(gc,"_int64");function yc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}s(yc,"_uint64");function _c(e,t){return new e({type:"symbol",..._(t)})}s(_c,"_symbol");function $c(e,t){return new e({type:"undefined",..._(t)})}s($c,"_undefined");function wc(e,t){return new e({type:"null",..._(t)})}s(wc,"_null");function bc(e){return new e({type:"any"})}s(bc,"_any");function vc(e){return new e({type:"unknown"})}s(vc,"_unknown");function xc(e,t){return new e({type:"never",..._(t)})}s(xc,"_never");function kc(e,t){return new e({type:"void",..._(t)})}s(kc,"_void");function zc(e,t){return new e({type:"date",..._(t)})}s(zc,"_date");function Sc(e,t){return new e({type:"date",coerce:!0,..._(t)})}s(Sc,"_coercedDate");function Pc(e,t){return new e({type:"nan",..._(t)})}s(Pc,"_nan");function me(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!1})}s(me,"_lt");function se(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!0})}s(se,"_lte");function he(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!1})}s(he,"_gt");function ue(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!0})}s(ue,"_gte");function yo(e){return he(0,e)}s(yo,"_positive");function _o(e){return me(0,e)}s(_o,"_negative");function $o(e){return se(0,e)}s($o,"_nonpositive");function wo(e){return ue(0,e)}s(wo,"_nonnegative");function Ae(e,t){return new fs({check:"multiple_of",..._(t),value:e})}s(Ae,"_multipleOf");function Oe(e,t){return new ms({check:"max_size",..._(t),maximum:e})}s(Oe,"_maxSize");function ge(e,t){return new hs({check:"min_size",..._(t),minimum:e})}s(ge,"_minSize");function We(e,t){return new gs({check:"size_equals",..._(t),size:e})}s(We,"_size");function Xe(e,t){return new ys({check:"max_length",..._(t),maximum:e})}s(Xe,"_maxLength");function ve(e,t){return new _s({check:"min_length",..._(t),minimum:e})}s(ve,"_minLength");function He(e,t){return new $s({check:"length_equals",..._(t),length:e})}s(He,"_length");function wt(e,t){return new ws({check:"string_format",format:"regex",..._(t),pattern:e})}s(wt,"_regex");function bt(e){return new bs({check:"string_format",format:"lowercase",..._(e)})}s(bt,"_lowercase");function vt(e){return new vs({check:"string_format",format:"uppercase",..._(e)})}s(vt,"_uppercase");function xt(e,t){return new xs({check:"string_format",format:"includes",..._(t),includes:e})}s(xt,"_includes");function kt(e,t){return new ks({check:"string_format",format:"starts_with",..._(t),prefix:e})}s(kt,"_startsWith");function zt(e,t){return new zs({check:"string_format",format:"ends_with",..._(t),suffix:e})}s(zt,"_endsWith");function bo(e,t,r){return new Ss({check:"property",property:e,schema:t,..._(r)})}s(bo,"_property");function St(e,t){return new Ps({check:"properties",shape:e,..._(t)})}s(St,"_properties");function Pt(e,t){return new Is({check:"mime_type",mime:e,..._(t)})}s(Pt,"_mime");function de(e){return new As({check:"overwrite",tx:e})}s(de,"_overwrite");function It(e){return de(t=>t.normalize(e))}s(It,"_normalize");function At(){return de(e=>e.trim())}s(At,"_trim");function Ot(){return de(e=>e.toLowerCase())}s(Ot,"_toLowerCase");function Zt(){return de(e=>e.toUpperCase())}s(Zt,"_toUpperCase");function Nt(){return de(e=>pi(e))}s(Nt,"_slugify");function Ic(e,t,r){return new e({type:"array",element:t,..._(r)})}s(Ic,"_array");function Ug(e,t,r){return new e({type:"union",options:t,..._(r)})}s(Ug,"_union");function Bg(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}s(Bg,"_xor");function Jg(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}s(Jg,"_discriminatedUnion");function Gg(e,t,r){return new e({type:"intersection",left:t,right:r})}s(Gg,"_intersection");function qg(e,t,r,n){let o=r instanceof P,i=o?n:r,u=o?r:null;return new e({type:"tuple",items:t,rest:u,..._(i)})}s(qg,"_tuple");function Wg(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}s(Wg,"_record");function Xg(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}s(Xg,"_map");function Hg(e,t,r){return new e({type:"set",valueType:t,..._(r)})}s(Hg,"_set");function Yg(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}s(Yg,"_enum");function Qg(e,t,r){return new e({type:"enum",entries:t,..._(r)})}s(Qg,"_nativeEnum");function ey(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}s(ey,"_literal");function Ac(e,t){return new e({type:"file",..._(t)})}s(Ac,"_file");function ty(e,t){return new e({type:"transform",transform:t})}s(ty,"_transform");function ry(e,t){return new e({type:"optional",innerType:t})}s(ry,"_optional");function ny(e,t){return new e({type:"nullable",innerType:t})}s(ny,"_nullable");function oy(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Wt(r)}})}s(oy,"_default");function iy(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}s(iy,"_nonoptional");function sy(e,t){return new e({type:"success",innerType:t})}s(sy,"_success");function uy(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:$i(r)})}s(uy,"_catch");function cy(e,t,r){return new e({type:"pipe",in:t,out:r})}s(cy,"_pipe");function ay(e,t){return new e({type:"readonly",innerType:t})}s(ay,"_readonly");function ly(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}s(ly,"_templateLiteral");function fy(e,t){return new e({type:"lazy",getter:t})}s(fy,"_lazy");function py(e,t){return new e({type:"promise",innerType:t})}s(py,"_promise");function Oc(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}s(Oc,"_custom");function Zc(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}s(Zc,"_refine");function Nc(e,t){let r=Kf(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ft(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ft(i))}},e(n.value,n)),t);return r}s(Nc,"_superRefine");function Kf(e,t){let r=new L({check:"custom",..._(t)});return r._zod.check=e,r}s(Kf,"_check");function Ec(e){let t=new L({check:"describe"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,description:e})}],t._zod.check=()=>{},t}s(Ec,"describe");function Cc(e){let t=new L({check:"meta"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,...e})}],t._zod.check=()=>{},t}s(Cc,"meta");function Tc(e,t){let r=_(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),u=new Set(o),c=e.Codec??yr,a=e.Boolean??hr,l=e.String??Ue,f=new l({type:"string",error:r.error}),p=new a({type:"boolean",error:r.error}),d=new c({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:u.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...u],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!0?n[0]||"true":o[0]||"false"),"reverseTransform"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}s(Tc,"_stringbool");function Ye(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}s(Ye,"_stringFormat");function Ar(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&J(e,n,r[n]);return e}s(Ar,"assignProps");function Ze(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??G,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}}s(Ze,"initializeContext");function K(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}s(K,"handleUnrepresentable");function D(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let u={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,u),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)u.schema=c;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,f);else{let d=u.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,f)}let p=e._zod.parent;p&&(u.ref||(u.ref=p),D(p,t,f),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Ar(u.schema,a),t.io==="input"&&Q(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&"_prefault"in u.schema&&((n=u.schema).default??(n.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}s(D,"processSchema");function Uf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(Uf,"encodeJSONPointerSegment");function Ne(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let u of e.seen.entries()){let c=e.metadataRegistry.get(u[0])?.id;if(c){let a=n.get(c);if(a&&a!==u[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,u[0])}}let o=s(u=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(u[0])?.id,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Uf(m)}`}}let a="#",l=`${a}/${c}/`;if(u[1]===r&&!u[1].schema.id)return{ref:a};let f=u[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+Uf(f)}},"makeURI"),i=s(u=>{if(u[1].schema.$ref)return;let c=u[1],{ref:a,defId:l}=o(u);c.def={...c.schema},l&&(c.defId=l);let f=c.schema;for(let p in f)delete f[p];f.$ref=a},"extractToDef");if(e.cycles==="throw")for(let u of e.seen.entries()){let c=u[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
67
67
 
68
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of e.seen.entries()){let c=u[1];if(t===u[0]){i(u);continue}if(e.external){let l=e.external.registry.get(u[0])?.id;if(t!==u[0]&&l){i(u);continue}}if(e.metadataRegistry.get(u[0])?.id){i(u);continue}if(c.cycle){i(u);continue}c.count>1&&e.reused==="ref"&&i(u)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Ne,"extractDefs");function Gf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Gf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let u of Array.isArray(i)?i:[i]){if(typeof u!="string")return;r.includes(u)||r.push(u)}}delete e.anyOf,e.type=r.length===1?r[0]:r}s(Gf,"compactTypeUnion");var qf=new Set(["type","properties","required","additionalProperties"]),Bf=["oneOf","anyOf"];function Jf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Jf,"undeclaredConstraint");function Dc(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let u in i)if(!qf.has(u))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let u in i.properties){if(Object.prototype.hasOwnProperty.call(r,u))continue;let c=[];for(let l of t){let f=l.properties?.[u]??Jf(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let a=c.length===1?c[0]:Dc(c)??{allOf:c};J(r,u,a)}for(let u of i.required??[])n.add(u)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let u of t){let c=Jf(u);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(Dc,"foldObjects");function dy(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of qf)if(o in e)return;let r=t.filter(o=>Bf.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dc(t);else{let o=r[0],i=Bf.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let u=t.filter(a=>a!==o),c=o[i].map(a=>Dc([...u,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Ar(e,n))}s(dy,"foldIntersection");function Ee(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(c=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,f={...l},p=a.ref;if(a.ref=null,p){n(p);let m=e.seen.get(p),g=m.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)):Ar(l,g),Ar(l,f),c._zod.parent===p)for(let $ in l)$==="$ref"||$==="allOf"||$ in f||delete l[$];if(g.$ref&&m.def)for(let $ in l)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(l[$])===JSON.stringify(m.def[$])&&delete l[$]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g])&&delete l[g]}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Gf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let f=l?.allOf;if(!Array.isArray(f))continue;let p=c.get(f);p?p.push(l):c.set(f,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])dy(l)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Ar(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let u=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(u,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?o.$defs=u:o.definitions=u);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Et(t,"input",e.processors),output:Et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}s(Ee,"finalize");function Q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(n.in,r)||Q(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;return!!(n.rest&&Q(n.rest,r))}return!1}s(Q,"isTransforming");var Rc=s((e,t={})=>r=>{let n=Ze({...r,processors:t});return D(e,n),Ne(n,e),Ee(n,e)},"createToJSONSchemaMethod"),Et=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},u=Ze({...o??{},target:i,io:t,processors:r});return D(e,u),Ne(u,e),Ee(u,e)},"createStandardJSONSchemaMethod");var Ct=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),Tt=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),Wf=s((e,t)=>{Ct(e,"minimum",t),Tt(e,"maximum",t)},"narrowBoth"),Qf=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),ep=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),tp=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),rp=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Xf=s((e,t)=>Ct(e,"minimum",t.minimum),"minContributor"),Hf=s((e,t)=>Tt(e,"maximum",t.maximum),"maxContributor"),Yf=s(e=>(t,r)=>{rp(t,r.format);let[n,o]=e[r.format];Ct(t,"minimum",n),Tt(t,"maximum",o)},"formatContributor"),my={greater_than:s((e,t)=>Ct(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Tt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Qf(e,t.value),"multiple_of"),number_format:Yf(Ht),bigint_format:Yf(Yt),min_length:Xf,max_length:Hf,length_equals:s((e,t)=>Wf(e,t.length),"length_equals"),min_size:Xf,max_size:Hf,size_equals:s((e,t)=>Wf(e,t.size),"size_equals"),string_format:s((e,t)=>{rp(e,t.format),t.pattern&&ep(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},"string_format"),mime_type:s((e,t)=>tp(e,t.mime),"mime_type")};function U(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)my[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Ct(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Ct(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Tt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Tt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Qf(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&tp(t,o.mime);for(let i of o.patterns??[])ep(t,i);return t}s(U,"aggregateChecks");var hy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gy=new Map([[In,Bi],[mr,Ji]]),np=s(e=>gy.get(e)??e,"exactPattern"),Vc=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:u,format:c,patterns:a,contentEncoding:l,laxFormat:f}=U(e);if(typeof i=="number"&&(o.minLength=i),typeof u=="number"&&(o.maxLength=u),c&&(o.format=hy[c]??c,o.format===""&&delete o.format,(c==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let p=[...a].map(np);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},"stringProcessor"),Mc=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:u,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:f}=U(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof a=="number"&&a<=(u??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p?m?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof u=="number"&&(o.maximum=u),c){let g=new Set;for(let z of c)Number.isFinite(z)&&z!==0?g.add(Math.abs(z)):K(e,t,o,n,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[y,...$]=g;y!==void 0&&(o.multipleOf=y),$.length&&(o.allOf=[...o.allOf??[],...$.map(z=>({multipleOf:z}))])}},"numberProcessor"),Fc=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),Kc=s((e,t,r,n)=>{K(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Uc=s((e,t,r,n)=>{K(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Bc=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Jc=s((e,t,r,n)=>{K(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Gc=s((e,t,r,n)=>{K(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),qc=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Wc=s((e,t,r,n)=>{},"anyProcessor"),Xc=s((e,t,r,n)=>{},"unknownProcessor"),Hc=s((e,t,r,n)=>{K(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Yc=s((e,t,r,n)=>{let o=e._zod.def,i=ut(o.entries);if(i.length===0){r.not={};return}i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Qc=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let u of o.values)if(u===void 0){if(K(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof u=="bigint"){if(K(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(u))}else i.push(u);if(i.length!==0)if(i.length===1){let u=i[0];r.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[u]:r.const=u}else i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),i.every(u=>typeof u=="boolean")&&(r.type="boolean"),i.every(u=>u===null)&&(r.type="null"),r.enum=i},"literalProcessor"),ea=s((e,t,r,n)=>{K(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),ta=s((e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),ra=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:u,mime:c}=U(e);i!==void 0&&(o.minLength=i),u!==void 0&&(o.maxLength=u),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},"fileProcessor"),na=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),oa=s((e,t,r,n)=>{K(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),ia=s((e,t,r,n)=>{K(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),sa=s((e,t,r,n)=>{K(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),ua=s((e,t,r,n)=>{K(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),ca=s((e,t,r,n)=>{K(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),aa=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:u,maximum:c}=U(e);typeof u=="number"&&(o.minItems=u),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=D(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");function Or(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Or(t.out):t.type==="catch"?Or(t.innerType):e._zod.optin}s(Or,"inputOptin");var la=s((e,t,r,n)=>{let o=r,i=e._zod.def,u=i.shape;if(Object.getOwnPropertySymbols(u).length&&K(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in u)J(o.properties,l,D(u[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(u)){let f=i.shape[l];(t.io==="input"?Or(f)===void 0:f._zod.optout===void 0)&&a.push(l)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),xo=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,u=o.options.map((c,a)=>D(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=u:r.anyOf=u},"unionProcessor"),fa=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,"allOf",0]}),u=D(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),a=[...c(i)?i.allOf:[i],...c(u)?u.allOf:[u]];r.allOf=a,t.intersections.push(a)},"intersectionProcessor"),pa=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let u=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,$)=>D(y,t,{...n,path:[...n.path,u,$]})),l=i.rest?D(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let y=i.items[f-1];if(!(t.io==="input"?Or(y)!==void 0:y._zod.optout==="optional"))break;f--}let p=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,d?o.items=!1:l&&(o.items=l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:a},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):(o.items=a,d?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),d&&(o.maxItems=p));let{minimum:m,maximum:g}=U(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function Lc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Lc(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let $=y.map(z=>Lc(e,z,r));$.some((z,x)=>z!==y[x])&&(t={...t,[g]:$})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.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:u,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:f,format:p,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?be:ur).source)),m}s(Lc,"stringifyKeyNames");var jc=new WeakMap;function yy(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of jc.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let u=Lc(t,i,new Set);u!==i&&r.set(i,u)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}s(yy,"rewriteKeyNames");var da=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let u=i.keyType,c=U(u).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=D(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)J(o.patternProperties,np(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let f=jc.get(t);f||(f=[],jc.set(t,f),t.deferred.push(()=>yy(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=u._zod.values,l=t.io==="input"&&Or(i.valueType)!==void 0;if(a&&!i.partial&&!l){let f=[...a].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(o.required=f.map(String))}},"recordProcessor"),ma=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),ha=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),ga=Symbol();function op(e,t,r,n,o){let i=!1,u=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(K(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ga):JSON.parse(u)}s(op,"serializeDefaultValue");var ya=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u=op(o.defaultValue,e,t,r,n);u!==ga&&(r.default=u)},"defaultProcessor"),_a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let u=op(o.defaultValue,e,t,r,n);u!==ga&&(r._prefault=u)},"prefaultProcessor"),$a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{K(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=u},"catchProcessor"),wa=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),u=t.io==="input"?i?o.out:o.in:o.out;D(u,t,n);let c=t.seen.get(e);c.ref=u},"pipeProcessor"),ba=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},"readonlyProcessor"),va=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),ko=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),xa=s((e,t,r,n)=>{let o=e._zod.innerType;D(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),vo={string:Vc,number:Mc,boolean:Fc,bigint:Kc,symbol:Uc,null:Bc,undefined:Jc,void:Gc,never:qc,any:Wc,unknown:Xc,date:Hc,enum:Yc,literal:Qc,nan:ea,template_literal:ta,file:ra,success:na,custom:oa,function:ia,transform:sa,map:ua,set:ca,array:aa,object:la,union:xo,intersection:fa,tuple:pa,record:da,nullable:ma,nonoptional:ha,default:ya,prefault:_a,catch:$a,pipe:wa,readonly:ba,promise:va,optional:ko,lazy:xa};function zo(e,t){if("_idmap"in e){let n=e,o=Ze({...t,processors:vo}),i={};for(let a of n._idmap.entries()){let[l,f]=a;D(f,o)}let u={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[l,f]=a;Ne(o,f),J(u,l,Ee(o,f))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[a]:i}}return{schemas:u}}let r=Ze({...t,processors:vo});return D(e,r),Ne(r,e),Ee(r,e)}s(zo,"toJSONSchema");var So=class{static{s(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Ze({processors:vo,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return D(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ne(this.ctx,t);let n=Ee(this.ctx,t),{"~standard":o,...i}=n;return i}};var ip={};var Kt={};_e(Kt,{ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>rt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>nt,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,codec:()=>dd,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,float32:()=>jp,float64:()=>Vp,function:()=>yd,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,literal:()=>cd,looseObject:()=>ed,looseRecord:()=>od,mac:()=>kp,map:()=>id,meta:()=>bd,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,never:()=>Xo,nonoptional:()=>ml,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>et,partialRecord:()=>nd,pipe:()=>Oo,prefault:()=>dl,preprocess:()=>zd,promise:()=>gd,readonly:()=>bl,record:()=>rl,refine:()=>Pl,set:()=>sd,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,transform:()=>Yo,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>Qe,url:()=>mp,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,void:()=>Wp,xid:()=>bp,xor:()=>td});var Po={};_e(Po,{endsWith:()=>zt,gt:()=>he,gte:()=>ue,includes:()=>xt,length:()=>He,lowercase:()=>bt,lt:()=>me,lte:()=>se,maxLength:()=>Xe,maxSize:()=>Oe,mime:()=>Pt,minLength:()=>ve,minSize:()=>ge,multipleOf:()=>Ae,negative:()=>_o,nonnegative:()=>wo,nonpositive:()=>$o,normalize:()=>It,overwrite:()=>de,positive:()=>yo,properties:()=>St,property:()=>bo,regex:()=>wt,size:()=>We,slugify:()=>Nt,startsWith:()=>kt,toLowerCase:()=>Ot,toUpperCase:()=>Zt,trim:()=>At,uppercase:()=>vt});var sp=new WeakSet([Object.prototype,Error.prototype]);function Io(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}s(Io,"_lazyMethod");var up=s((e,t)=>{zi.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);sp.has(r)||(sp.add(r),Io(r,"format",n=>o=>nr(n,o)),Io(r,"flatten",n=>o=>rr(n,o)),Io(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ct,2)}),Io(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ct,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),$y=h("ZodError",up),ie=h("ZodError",up,void 0,{Parent:Error});var ka=pt(ie),za=dt(ie),Sa=mt(ie),Pa=ht(ie),Ia=on(ie),Aa=sn(ie),Oa=un(ie),Za=cn(ie),Na=an(ie),Ea=ln(ie),Ca=fn(ie),Ta=pn(ie);function by(){B.localeError||M(vr())}s(by,"_ensureDefaultLocale");function tt(){B.memoizer||M({memoizer:br()})}s(tt,"_ensureDefaultMemoizer");var A=h("ZodType",(e,t)=>(by(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return C(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pl(e,t))},superRefine(e,t){return this.check(Il(e,t))},overwrite(e){return this.check(de(e))},optional(){return et(this)},exactOptional(){return cl(this)},nullable(){return Nr(this)},nullish(){return et(Nr(this))},nonoptional(e){return ml(this,e)},array(){return Tr(this)},or(e){return Ft([this,e])},and(e){return Qa(this,e)},transform(e){return Oo(this,Yo(e))},default(e){return fl(this,e)},prefault(e){return dl(this,e)},catch(e){return yl(this,e)},pipe(e){return Oo(this,e)},readonly(){return bl(this)},describe(e){let t=this.clone();return G.add(t,{description:e}),t},meta(...e){if(e.length===0)return G.get(this);let t=this.clone();return G.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 v.hide(this,"~standard",{...xn(this),jsonSchema:{input:Et(this,"input"),output:Et(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:s(function e(t,r){return ka(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await za(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return Sa(this,e,t)},async safeParseAsync(e,t){return Pa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return or(this,e,t)},validateAsync(e,t){return ir(this,e,t)},encode:s(function e(t,r){return Ia(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return Aa(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await Oa(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await Za(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return Na(this,e,t)},safeDecode(e,t){return Ea(this,e,t)},async safeEncodeAsync(e,t){return Ca(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),Zo=h("_ZodString",(e,t)=>{Ue.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o)},v.derived({format:s(e=>U(e).format??null,"format"),minLength:s(e=>U(e).minimum??null,"minLength"),maxLength:s(e=>U(e).maximum??null,"maxLength")},{regex(...e){return this.check(wt(...e))},includes(...e){return this.check(xt(...e))},startsWith(...e){return this.check(kt(...e))},endsWith(...e){return this.check(zt(...e))},min(...e){return this.check(ve(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(He(...e))},nonempty(...e){return this.check(ve(1,...e))},lowercase(e){return this.check(bt(e))},uppercase(e){return this.check(vt(e))},trim(){return this.check(At())},normalize(...e){return this.check(It(...e))},toLowerCase(){return this.check(Ot())},toUpperCase(){return this.check(Zt())},slugify(){return this.check(Nt())}})),Lt=h("ZodString",(e,t)=>{Ue.init(e,t),Zo.init(e,t)},{email(e){return this.check(Wn(No,e))},url(e){return this.check(kr(Er,e))},jwt(e){return this.check(go(qo,e))},emoji(e){return this.check(to(Co,e))},guid(e){return this.check(Xn(Eo,e))},uuid(e){return this.check(Hn(ye,e))},uuidv4(e){return this.check(Yn(ye,e))},uuidv6(e){return this.check(Qn(ye,e))},uuidv7(e){return this.check(eo(ye,e))},nanoid(e){return this.check(ro(To,e))},cuid(e){return this.check(no(Do,e))},cuid2(e){return this.check(oo(Ro,e))},ulid(e){return this.check(io(Lo,e))},base64(e){return this.check(po(Bo,e))},base64url(e){return this.check(mo(Jo,e))},xid(e){return this.check(so(jo,e))},ksuid(e){return this.check(uo(Vo,e))},ipv4(e){return this.check(co(Mo,e))},ipv6(e){return this.check(ao(Fo,e))},cidrv4(e){return this.check(lo(Ko,e))},cidrv6(e){return this.check(fo(Uo,e))},e164(e){return this.check(ho(Go,e))},datetime(e){return this.check(zr(Ce,e))},date(e){return this.check(Sr(Te,e))},time(e){return this.check(Pr(De,e))},duration(e){return this.check(Ir(Re,e))}});function Zr(e){return Qu(Lt,e)}s(Zr,"string");var R=h("ZodStringFormat",(e,t)=>{T.init(e,t),Zo.init(e,t)}),Ce=h("ZodISODateTime",(e,t)=>{Bs.init(e,t),R.init(e,t)}),Te=h("ZodISODate",(e,t)=>{Js.init(e,t),R.init(e,t)}),De=h("ZodISOTime",(e,t)=>{Gs.init(e,t),R.init(e,t)}),Re=h("ZodISODuration",(e,t)=>{qs.init(e,t),R.init(e,t)}),No=h("ZodEmail",(e,t)=>{Cs.init(e,t),R.init(e,t)});function cp(e){return Wn(No,e)}s(cp,"email");var Eo=h("ZodGUID",(e,t)=>{Ns.init(e,t),R.init(e,t)});function ap(e){return Xn(Eo,e)}s(ap,"guid");var ye=h("ZodUUID",(e,t)=>{Es.init(e,t),R.init(e,t)});function lp(e){return Hn(ye,e)}s(lp,"uuid");function fp(e){return Yn(ye,e)}s(fp,"uuidv4");function pp(e){return Qn(ye,e)}s(pp,"uuidv6");function dp(e){return eo(ye,e)}s(dp,"uuidv7");var Er=h("ZodURL",(e,t)=>{Rs.init(e,t),R.init(e,t)});function mp(e){return kr(Er,e)}s(mp,"url");function hp(e){return kr(Er,{protocol:sr,hostname:qi,...v.normalizeParams(e)})}s(hp,"httpUrl");var Co=h("ZodEmoji",(e,t)=>{Ls.init(e,t),R.init(e,t)});function gp(e){return to(Co,e)}s(gp,"emoji");var To=h("ZodNanoID",(e,t)=>{js.init(e,t),R.init(e,t)});function yp(e){return ro(To,e)}s(yp,"nanoid");var Do=h("ZodCUID",(e,t)=>{Vs.init(e,t),R.init(e,t)});function _p(e){return no(Do,e)}s(_p,"cuid");var Ro=h("ZodCUID2",(e,t)=>{Ms.init(e,t),R.init(e,t)});function $p(e){return oo(Ro,e)}s($p,"cuid2");var Lo=h("ZodULID",(e,t)=>{Fs.init(e,t),R.init(e,t)});function wp(e){return io(Lo,e)}s(wp,"ulid");var jo=h("ZodXID",(e,t)=>{Ks.init(e,t),R.init(e,t)});function bp(e){return so(jo,e)}s(bp,"xid");var Vo=h("ZodKSUID",(e,t)=>{Us.init(e,t),R.init(e,t)});function vp(e){return uo(Vo,e)}s(vp,"ksuid");var Mo=h("ZodIPv4",(e,t)=>{Ws.init(e,t),R.init(e,t)});function xp(e){return co(Mo,e)}s(xp,"ipv4");var Da=h("ZodMAC",(e,t)=>{Hs.init(e,t),R.init(e,t)});function kp(e){return tc(Da,e)}s(kp,"mac");var Fo=h("ZodIPv6",(e,t)=>{Xs.init(e,t),R.init(e,t)});function zp(e){return ao(Fo,e)}s(zp,"ipv6");var Ko=h("ZodCIDRv4",(e,t)=>{Ys.init(e,t),R.init(e,t)});function Sp(e){return lo(Ko,e)}s(Sp,"cidrv4");var Uo=h("ZodCIDRv6",(e,t)=>{Qs.init(e,t),R.init(e,t)});function Pp(e){return fo(Uo,e)}s(Pp,"cidrv6");var Bo=h("ZodBase64",(e,t)=>{eu.init(e,t),R.init(e,t)});function Ip(e){return po(Bo,e)}s(Ip,"base64");var Jo=h("ZodBase64URL",(e,t)=>{tu.init(e,t),R.init(e,t)});function Ap(e){return mo(Jo,e)}s(Ap,"base64url");var Go=h("ZodE164",(e,t)=>{ru.init(e,t),R.init(e,t)});function Op(e){return ho(Go,e)}s(Op,"e164");var Ra=h("ZodCreditCard",(e,t)=>{nu.init(e,t),R.init(e,t)});function Zp(e){return rc(Ra,e)}s(Zp,"creditCard");var La=h("ZodIBAN",(e,t)=>{ou.init(e,t),R.init(e,t)});function Np(e){return nc(La,e)}s(Np,"iban");var qo=h("ZodJWT",(e,t)=>{iu.init(e,t),R.init(e,t)});function Ep(e){return go(qo,e)}s(Ep,"jwt");var rt=h("ZodCustomStringFormat",(e,t)=>{su.init(e,t),R.init(e,t)});function Cp(e,t,r={}){return Ye(rt,e,t,r)}s(Cp,"stringFormat");function Tp(e){return Ye(rt,"hostname",Gi,e)}s(Tp,"hostname");function Dp(e){return Ye(rt,"hex",cs,e)}s(Dp,"hex");function Rp(e){return Ye(rt,"currency_code",Xi,e)}s(Rp,"currencyCode");function Lp(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=le[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Ye(rt,n,o,t)}s(Lp,"hash");var jt=h("ZodNumber",(e,t)=>{En.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},v.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=U(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=U(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=U(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>U(e).format??null,"format")},{gt(e,t){return this.check(he(e,t))},gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},int(e){return this.check(Ao(e))},safe(e){return this.check(Ao(e))},positive(e){return this.check(he(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(me(0,e))},nonpositive(e){return this.check(se(0,e))},multipleOf(e,t){return this.check(Ae(e,t))},step(e,t){return this.check(Ae(e,t))},finite(){return this}}));function ja(e){return ic(jt,e)}s(ja,"number");var nt=h("ZodNumberFormat",(e,t)=>{uu.init(e,t),jt.init(e,t)});function Ao(e){return uc(nt,e)}s(Ao,"int");function jp(e){return cc(nt,e)}s(jp,"float32");function Vp(e){return ac(nt,e)}s(Vp,"float64");function Mp(e){return lc(nt,e)}s(Mp,"int32");function Fp(e){return fc(nt,e)}s(Fp,"uint32");var Vt=h("ZodBoolean",(e,t)=>{hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function Va(e){return pc(Vt,e)}s(Va,"boolean");var Mt=h("ZodBigInt",(e,t)=>{Cn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o)},v.derived({minValue:s(e=>U(e).minimum??null,"minValue"),maxValue:s(e=>U(e).maximum??null,"maxValue"),format:s(e=>U(e).format??null,"format")},{gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},gt(e,t){return this.check(he(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},positive(e){return this.check(he(BigInt(0),e))},negative(e){return this.check(me(BigInt(0),e))},nonpositive(e){return this.check(se(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,t){return this.check(Ae(e,t))}}));function Kp(e){return mc(Mt,e)}s(Kp,"bigint");var Wo=h("ZodBigIntFormat",(e,t)=>{cu.init(e,t),Mt.init(e,t)});function Up(e){return gc(Wo,e)}s(Up,"int64");function Bp(e){return yc(Wo,e)}s(Bp,"uint64");var Ma=h("ZodSymbol",(e,t)=>{au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uc(e,r,n,o)});function Jp(e){return _c(Ma,e)}s(Jp,"symbol");var Fa=h("ZodUndefined",(e,t)=>{lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o)});function Gp(e){return $c(Fa,e)}s(Gp,"_undefined");var Ka=h("ZodNull",(e,t)=>{fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o)});function Ua(e){return wc(Ka,e)}s(Ua,"_null");var Ba=h("ZodAny",(e,t)=>{pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function qp(){return bc(Ba)}s(qp,"any");var Ja=h("ZodUnknown",(e,t)=>{du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o)});function Qe(){return vc(Ja)}s(Qe,"unknown");var Ga=h("ZodNever",(e,t)=>{mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function Xo(e){return xc(Ga,e)}s(Xo,"never");var qa=h("ZodVoid",(e,t)=>{hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o)});function Wp(e){return kc(qa,e)}s(Wp,"_void");var Cr=h("ZodDate",(e,t)=>{gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.min=(r,n)=>e.check(ue(r,n)),e.max=(r,n)=>e.check(se(r,n))},v.derived({minDate:s(e=>{let{minimum:t}=U(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=U(e);return t?new Date(t):null},"maxDate")},{}));function Xp(e){return zc(Cr,e)}s(Xp,"date");var Wa=h("ZodArray",(e,t)=>{tt(),yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ve(e,t))},nonempty(e){return this.check(ve(1,e))},max(e,t){return this.check(Xe(e,t))},length(e,t){return this.check(He(e,t))},unwrap(){return this.element}});function Tr(e,t){return Ic(Wa,e,t)}s(Tr,"array");function Hp(e){let t=e._zod.def.shape;return Ho(Object.keys(t))}s(Hp,"keyof");var Dr=h("ZodObject",(e,t)=>{tt(),_u.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ho(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Xo()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Lr,this,e[0])},exactPartial(...e){return v.partial(Qo,this,e[0],"exactPartial")},required(...e){return v.required(ei,this,e[0])}});function Yp(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Dr(r)}s(Yp,"object");function Qp(e,t){return new Dr({type:"object",shape:e,catchall:Xo(),...v.normalizeParams(t)})}s(Qp,"strictObject");function ed(e,t){return new Dr({type:"object",shape:e,catchall:Qe(),...v.normalizeParams(t)})}s(ed,"looseObject");var Rr=h("ZodUnion",(e,t)=>{gr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function Ft(e,t){return new Rr({type:"union",options:e,...v.normalizeParams(t)})}s(Ft,"union");var Xa=h("ZodXor",(e,t)=>{Rr.init(e,t),$u.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function td(e,t){return new Xa({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}s(td,"xor");var Ha=h("ZodDiscriminatedUnion",(e,t)=>{Rr.init(e,t),bu.init(e,t)});function rd(e,t,r){return new Ha({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}s(rd,"discriminatedUnion");var Ya=h("ZodIntersection",(e,t)=>{vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r,n,o)});function Qa(e,t){return new Ya({type:"intersection",left:e,right:t})}s(Qa,"intersection");var el=h("ZodTuple",(e,t)=>{tt(),Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Lr({type:"optional",innerType:t}))})}});function tl(e,t,r){let n=t instanceof P,o=n?r:t,i=n?t:null;return new el({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}s(tl,"tuple");var Dt=h("ZodRecord",(e,t)=>{tt(),xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>da(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function rl(e,t,r){return!t||!t._zod?new Dt({type:"record",keyType:Zr(),valueType:e,...v.normalizeParams(t)}):new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}s(rl,"record");function nd(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}s(nd,"partialRecord");function od(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}s(od,"looseRecord");var nl=h("ZodMap",(e,t)=>{tt(),ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ua(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function id(e,t,r){return new nl({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}s(id,"map");var ol=h("ZodSet",(e,t)=>{tt(),zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca(e,r,n,o),e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function sd(e,t){return new ol({type:"set",valueType:e,...v.normalizeParams(t)})}s(sd,"set");var Rt=h("ZodEnum",(e,t)=>{Su.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Yc(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let u of n)if(r.has(u))i[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let u of n)if(r.has(u))delete i[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})}});function Ho(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rt({type:"enum",entries:r,...v.normalizeParams(t)})}s(Ho,"_enum");function ud(e,t){return new Rt({type:"enum",entries:e,...v.normalizeParams(t)})}s(ud,"nativeEnum");var il=h("ZodLiteral",(e,t)=>{Pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function cd(e,t){return new il({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}s(cd,"literal");var sl=h("ZodFile",(e,t)=>{Iu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ra(e,r,n,o),e.min=(r,n)=>e.check(ge(r,n)),e.max=(r,n)=>e.check(Oe(r,n)),e.mime=(r,n)=>e.check(Pt(Array.isArray(r)?r:[r],n))});function ad(e){return Ac(sl,e)}s(ad,"file");var ul=h("ZodTransform",(e,t)=>{tt(),Au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let u=i;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),"input"in u||(u.input=r.value),u.inst??(u.inst=e),r.issues.push(v.issue(u))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Yo(e){return new ul({type:"transform",transform:e})}s(Yo,"transform");var Lr=h("ZodOptional",(e,t)=>{Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function et(e){return new Lr({type:"optional",innerType:e})}s(et,"optional");var Qo=h("ZodExactOptional",(e,t)=>{Ou.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new Qo({type:"optional",innerType:e})}s(cl,"exactOptional");var al=h("ZodNullable",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ma(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new al({type:"nullable",innerType:e})}s(Nr,"nullable");function ld(e){return et(Nr(e))}s(ld,"nullish");var ll=h("ZodDefault",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fl(e,t){return new ll({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(fl,"_default");var pl=h("ZodPrefault",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dl(e,t){return new pl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(dl,"prefault");var ei=h("ZodNonOptional",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ha(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new ei({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}s(ml,"nonoptional");var hl=h("ZodSuccess",(e,t)=>{Tu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>na(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fd(e){return new hl({type:"success",innerType:e})}s(fd,"success");var gl=h("ZodCatch",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yl(e,t){return new gl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}s(yl,"_catch");var _l=h("ZodNaN",(e,t)=>{Ru.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ea(e,r,n,o)});function pd(e){return Pc(_l,e)}s(pd,"nan");var jr=h("ZodPipe",(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wa(e,r,n,o),e.in=t.in,e.out=t.out});function Oo(e,t){return new jr({type:"pipe",in:e,out:t})}s(Oo,"pipe");var Vr=h("ZodCodec",(e,t)=>{jr.init(e,t),yr.init(e,t)});function dd(e,t,r){return new Vr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(dd,"codec");function md(e){let t=e._zod.def;return new Vr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(md,"invertCodec");var $l=h("ZodPreprocess",(e,t)=>{jr.init(e,t),Lu.init(e,t)}),wl=h("ZodReadonly",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ba(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new wl({type:"readonly",innerType:e})}s(bl,"readonly");var vl=h("ZodTemplateLiteral",(e,t)=>{Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ta(e,r,n,o)});function hd(e,t){return new vl({type:"template_literal",parts:e,...v.normalizeParams(t)})}s(hd,"templateLiteral");var xl=h("ZodLazy",(e,t)=>{_r.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xa(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function kl(e){return new xl({type:"lazy",getter:e})}s(kl,"lazy");var zl=h("ZodPromise",(e,t)=>{Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gd(e){return new zl({type:"promise",innerType:e})}s(gd,"promise");var Sl=h("ZodFunction",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ia(e,r,n,o)});function yd(e){return new Sl({type:"function",input:Array.isArray(e?.input)?tl(e?.input):e?.input??Tr(Qe()),output:e?.output??Qe()})}s(yd,"_function");var Mr=h("ZodCustom",(e,t)=>{Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oa(e,r,n,o)});function _d(e){let t=new L({check:"custom"});return t._zod.check=e,t}s(_d,"check");function $d(e,t){return Oc(Mr,e??(()=>!0),t)}s($d,"custom");function Pl(e,t={}){return Zc(Mr,e,t)}s(Pl,"refine");function Il(e,t){return Nc(e,t)}s(Il,"superRefine");var wd=Ec,bd=Cc,Al=h("ZodInstanceOf",(e,t)=>{Mr.init(e,t)},{properties(e,t){return this.check(St(e,t))}});function vd(e,t={}){let r=new Al({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...v.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}s(vd,"_instanceof");var xd=s((...e)=>Tc({Codec:Vr,Boolean:Vt,String:Lt},...e),"stringbool");function kd(e){let t=kl(()=>Ft([Zr(e),ja(),Va(),Ua(),Tr(t),rl(Zr(),t)]));return t}s(kd,"json");function zd(e,t){return new $l({type:"pipe",in:Yo(e),out:t})}s(zd,"preprocess");var vy={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function xy(e){M({customError:e})}s(xy,"setErrorMap");function ky(){return M().customError}s(ky,"getErrorMap");var Ol;Ol||(Ol={});var Fr={};_e(Fr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,date:()=>Sy,datetime:()=>zy,duration:()=>Iy,time:()=>Py});function zy(e){return zr(Ce,e)}s(zy,"datetime");function Sy(e){return Sr(Te,e)}s(Sy,"date");function Py(e){return Pr(De,e)}s(Py,"time");function Iy(e){return Ir(Re,e)}s(Iy,"duration");var w={...Kt,...Po,iso:Fr},Ay=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Oy(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(Oy,"detectVersion");function Sd(e,t){return e.map((r,n)=>n<t?r:r.optional())}s(Sd,"applyMinItems");function Zy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(Zy,"decodeJSONPointerSegment");function Ny(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:Zy(r[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}s(Ny,"resolveRef");function Ey(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&n.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let u of i){let c=t.keySchema.safeParse(u);c.success||n.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:u,path:[u],continue:!0})}}).pipe(e)}s(Ey,"checkObjectGuards");function Zl(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let u of e){let c=Zl(u,t);if(c===null)return null;i.push(c)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let u=Zl(e[i],t);if(u===null)return null;o.push(`${i.length}:${i}=${u}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(Zl,"canonicalKey");var Cy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Ty=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Kr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Kr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Cy.has(t)?Kr(r):!Ty.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Kr))}s(Kr,"containsRef");function Pd(e){return e===1?"element":"elements"}s(Pd,"plural");function Dy(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let u=0;u<o.length;u++){let c=Zl(o[u],new Set);if(c===null)continue;let a=i.get(c);if(a===void 0){i.set(c,u);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${u} duplicates the one at index ${a}`,input:o,path:[u],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,u=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let a of o)if(t.containsSchema.safeParse(a).success&&++c>=u)break;c<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Pd(i)}; found ${c}`,input:o,continue:!0}),t.maxContains!==void 0&&c>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Pd(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(Dy,"checkArrayGuards");function Id(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ee(e,t)}s(Id,"getTupleRest");var Ry=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ad(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return w.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return w.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=Ny(o,t),u=ee(i,t);return t.refs.set(o,u),t.processing.delete(o),u}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return w.null();if(o.length===0)return w.never();if(o.length===1)return w.literal(o[0]);if(o.every(u=>typeof u=="string"))return w.enum(o);let i=o.map(u=>w.literal(u));return i.length<2?i[0]:w.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let u={...e,type:i};return Ad(u,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!r)return w.any();let n;switch(r){case"string":{let o=w.string();if(e.format){let i=e.format;i==="email"?o=o.check(w.email()):i==="uri"||i==="uri-reference"?o=o.check(w.url()):i==="uuid"||i==="guid"?o=o.check(w.uuid()):i==="date-time"?o=o.check(w.iso.datetime({offset:!0})):i==="date"?o=o.check(w.iso.date()):i==="time"?o=o.check(w.regex(Ry)):i==="duration"?o=o.check(w.iso.duration()):i==="hostname"?o=o.check(w.hostname()):i==="ipv4"?o=o.check(w.ipv4()):i==="ipv6"?o=o.check(w.ipv6()):i==="mac"?o=o.check(w.mac()):i==="cidr"?o=o.check(w.cidrv4()):i==="cidr-v6"?o=o.check(w.cidrv6()):i==="base64"?o=o.check(w.base64()):i==="base64url"?o=o.check(w.base64url()):i==="e164"?o=o.check(w.e164()):i==="credit_card"?o=o.check(w.creditCard()):i==="iban"?o=o.check(w.iban()):i==="jwt"?o=o.check(w.jwt()):i==="emoji"?o=o.check(w.emoji()):i==="nanoid"?o=o.check(w.nanoid()):i==="cuid"?o=o.check(w.cuid()):i==="cuid2"?o=o.check(w.cuid2()):i==="ulid"?o=o.check(w.ulid()):i==="xid"?o=o.check(w.xid()):i==="ksuid"&&(o=o.check(w.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),n=o;break}case"number":case"integer":{let o=r==="integer"?w.number().int():w.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),n=o;break}case"boolean":{n=w.boolean();break}case"null":{n=w.null();break}case"object":{let o={},i=e.properties||{},u=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?ee(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=ee(d,t);J(o,p,u.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let $=ee(p[y],t),z=w.string().regex(new RegExp(y));m.push(w.looseRecord(z,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)n=w.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)y=w.intersection(y,g[$]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),$=d.map(x=>new RegExp(x)),z=n;n=n.check(x=>{if(!ce(x.value))return;let I=[];for(let E of Object.keys(x.value))y.includes(E)||$.some(j=>j.test(E))||I.push(E);I.length&&x.issues.push({code:"unrecognized_keys",keys:I,input:x.value,inst:z})})}}else{let p=w.object(o);e.additionalProperties===!1?n=p.strict():c?n=p.catchall(c):n=p.passthrough()}let a=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,f=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(a||l!==void 0||f!==void 0){let p;if(a){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=ee(d,t)}n=Ey(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let u=typeof e.minItems=="number"?e.minItems:0,c=o.map(p=>ee(p,t)),a=Sd(c,u),l=Array.isArray(i)?void 0:Id(i,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let u=typeof e.minItems=="number"?e.minItems:0,c=i.map(p=>ee(p,t)),a=Sd(c,u),l=Id(e.additionalItems,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let u=ee(i,t),c=w.array(u);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),n=c}else n=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=Dy(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return n}s(Ad,"convertBaseSchema");function ee(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r=Ad(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>ee(l,t)),a=w.union(c);r=n?w.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>ee(l,t)),a=w.xor(c);r=n?w.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:w.any();else{let c=n?r:ee(e.allOf[0],t),a=n?0:1;for(let l=a;l<e.allOf.length;l++)c=w.intersection(c,ee(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=w.nullable(r)),e.readOnly===!0&&(r=w.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(o[c]=e[c]);let u=["contentEncoding","contentMediaType","contentSchema"];for(let c of u)c in e&&(o[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Kr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(o[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Kr(e.contains)&&(o.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(o[c]=e[c])}for(let c of Object.keys(e))Ay.has(c)||J(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}s(ee,"convertSchema");function Od(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=Oy(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??G};return ee(r,i)}s(Od,"fromJSONSchema");var Zd=Symbol("z.visit/resolving");function Ur(e,t){let r=typeof t=="function"?t:(u,c)=>{let a=t[u._zod.def.type];return a?a(u,c):u},n=new Map;function o(u){let c=n.get(u);if(c===Zd)return new _r({type:"lazy",getter:s(()=>n.get(u),"getter")});if(c!==void 0)return c;n.set(u,Zd);let a=i(u),l=r(a,a!==u);return n.set(u,l),l}s(o,"run");function i(u){let c=u._zod.def,a=c.type;switch(a){case"object":{let l=c.shape,f=Object.keys(l),p=!1,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?C(u,{...c,shape:d,catchall:m}):u}case"array":{let l=o(c.element);return l===c.element?u:C(u,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?C(u,{...c,items:p,rest:d}):u}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?u:C(u,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?u:C(u,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?C(u,{...c,options:p}):u}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?u:C(u,{...c,left:l,right:f})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=o(c.innerType);return l===c.innerType?u:C(u,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?u:C(u,{...c,in:l,out:f})}case"function":{let l=o(c.input),f=o(c.output);return l===c.input&&f===c.output?u:C(u,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return C(u,{...p,getter:s(()=>o(l()),"getter")})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return u;default:return u}}return s(i,"mapInner"),o(e)}s(Ur,"visit");function Nd(e){return Ur(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:Ft(r.options)},"union")})}s(Nd,"deepPartial");function Ly(e,t){if(!t?.length)return e;let r=e._zod.def;return C(e,fe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}s(Ly,"withChecks");function Ed(e){return Ly(e.out,e.checks)}s(Ed,"outSide");function jy(e){return e.in._zod.traits.has("$ZodTransform")?Ed(e):e.in}s(jy,"inSide");function Cd(e){return Ur(e,{pipe:s(t=>jy(t._zod.def),"pipe"),default:s((t,r)=>r?et(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}s(Cd,"input");function Td(e){return Ur(e,{pipe:s(t=>Ed(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}s(Td,"output");var Nl={};_e(Nl,{bigint:()=>Ky,boolean:()=>Fy,date:()=>Uy,number:()=>My,string:()=>Vy});function Vy(e){return ec(Lt,e)}s(Vy,"string");function My(e){return sc(jt,e)}s(My,"number");function Fy(e){return dc(Vt,e)}s(Fy,"boolean");function Ky(e){return hc(Mt,e)}s(Ky,"bigint");function Uy(e){return Sc(Cr,e)}s(Uy,"date");var El=1e4,Dd=b.string().min(1).max(1024),ke=b.array(Dd).max(El),By=b.enum(["project","chronological","machine"]),Jy=b.enum(["updated","created","alpha","none"]),Gy=b.enum(["default","ascending","descending"]),qy=b.enum(["active","archived"]),Wy=b.enum(["muted","colour","hidden"]),Xy=b.enum(["blocked","everything"]),Hy=b.array(b.union([b.literal("threads"),Dd.regex(/^(project|section|machine):\S+$/)])).max(El).transform(e=>[...new Set(e)]);function F(e,t,r){return{schema:e,defaultValue:t,description:r}}s(F,"define");var ot={threadLifecycles:F(b.array(qy).min(1).max(2).refine(e=>new Set(e).size===e.length,"Lifecycles must be unique"),["active"],'Threads shown: ["active"], ["archived"] or both. At least one is required.'),organizationMode:F(By,"project","How top-level groups are formed: project, chronological (custom sections) or machine."),environmentGrouping:F(b.boolean(),!1,"Worktrees as folders: whether sibling threads sharing a worktree environment fold into a folder row."),chronologicalSort:F(Jy,"updated","Sort field inside a group: updated, created or alpha. none is read as updated."),sortDirection:F(Gy,"default","Sort direction: ascending or descending. A saved default reads as the field's own direction (descending for dates, ascending for alpha)."),sectionOrder:F(ke,["pinned","projects","threads"],"Top-level group order when organized by project."),manualSectionOrder:F(ke,["pinned","sections","threads"],"Top-level group order when organized chronologically."),machineSectionOrder:F(ke,["pinned","machines","threads"],"Top-level group order when organized by machine."),hiddenGroups:F(Hy,[],"Groups moved into More: threads, project:<id>, section:<id> or machine:<id>."),collapsedSections:F(b.array(b.enum(["pinned","threads"])).max(El),[],"Built-in groups (pinned, threads) that are collapsed."),collapsedProjects:F(ke,[],"Project ids whose group is collapsed."),collapsedThreadSections:F(ke,[],"Custom section keys (section:<id>) whose group is collapsed."),collapsedMachines:F(ke,[],"Machine ids whose group is collapsed."),collapsedEnvironments:F(ke,[],"Environment ids whose folder row is collapsed."),foldOlder:F(b.boolean(),!0,"Collapse older threads: whether each group's quiet roots past its 5 newest fold behind an N older row."),workingFirst:F(b.boolean(),!1,"Working threads first: whether working threads sort first under Updated, as bb's list does."),expandedOlder:F(ke,[],"Group ids and parent thread ids whose N older fold the user opened."),expandedChildren:F(ke,[],"Parent thread ids whose chip the user opened."),showPullRequests:F(b.boolean(),!0,"Whether rows show a pull request badge."),childAttention:F(Xy,"blocked","Needs you counts every child: blocked counts a child thread that waits on you, is offline or has an orphaned failure; everything also counts every failed or finished-unread child. The same children stay out of a family's older fold, as running ones do."),harnessIcon:F(Wy,"muted","How rows draw the harness logo: muted (monochrome), colour (the provider's tint) or hidden.")},ze=Object.keys(ot);function Cl(e){return Object.hasOwn(ot,e)}s(Cl,"isPreferenceKey");function it(e){return structuredClone(ot[e].defaultValue)}s(it,"preferenceDefault");function Rd(){return Object.fromEntries(ze.map(e=>[e,it(e)]))}s(Rd,"defaultPreferences");function Tl(e){return ot[e].description}s(Tl,"describePreference");function ti(e,t){let r=ot[e].schema.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,message:r.error.issues.map(n=>n.message).join("; ")}}s(ti,"parsePreference");function Dl(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};let t=e,r={};for(let[n,o]of Object.entries(t)){if(n==="collapsedThreads"||!Cl(n))continue;let u=ti(n,n==="environmentGrouping"&&o==="auto"?!1:o);u.success&&(r[n]=u.value)}return r}s(Dl,"mapBbPreferences");var ww=b.object({density:b.enum(["compact","comfortable"]).catch("compact")});var ri=b.record(b.string(),b.number()),Ld=b.object({startedAt:ri,finishedAt:ri,pendingAt:ri,seenAt:ri}),Br=140,Rl=b.object({kind:b.enum(["question","approval","plan","input","failed","done"]),text:b.string().max(Br),at:b.number()}),ni=b.object({pending:Rl.optional(),failed:Rl.optional(),done:Rl.optional()}),Le={preferences:"preferences",stamps:"stamps",scheduled:"scheduled",notes:"notes"};var Jr=b.enum(ze),Qy=b.object(Object.fromEntries(ze.map(e=>[e,ot[e].schema]))),e_=b.record(b.string(),b.number()),jd=b.array(b.string().min(1).max(1024)).max(1e4),Vd=Yy({listPreferences:{input:b.null(),output:b.object({preferences:Qy}).strict()},setPreference:{input:b.object({key:Jr,value:b.unknown()}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},resetPreference:{input:b.object({key:Jr}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},importPreferences:{input:b.object({bbMirror:b.unknown().nullable()}).strict(),output:b.object({status:b.enum(["already-imported","imported","defaults"]),source:b.enum(["local-storage","cli","none"]).nullable(),keys:b.array(Jr)}).strict()},listStamps:{input:b.null(),output:b.object({stamps:Ld}).strict()},markSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({at:b.number()}).strict()},clearSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({ok:b.literal(!0)}).strict()},listNotes:{input:b.null(),output:b.object({notes:b.record(b.string(),ni)}).strict()},listScheduled:{input:b.null(),output:b.object({status:b.enum(["ready","error"]),scheduled:e_}).strict()}});import{PluginCliError as Fd,cliCommand as ii,defineCli as r_}from"@get-bb/plugin-sdk";var t_="preference:";function oi(e){return`${t_}${e}`}s(oi,"preferenceKvKey");var Gr=class extends Error{static{s(this,"PreferenceValidationError")}key;detail;constructor(t,r){super(`Invalid value for ${t}: ${r}`),this.name="PreferenceValidationError",this.key=t,this.detail=r}};function Md(e){let{kv:t}=e.storage;function r(o,i){let u={key:o,value:i};e.realtime.publish(Le.preferences,u)}s(r,"publish");async function n(o){let i=await t.get(oi(o));if(i===void 0)return it(o);let u=ti(o,i);return u.success?u.value:(e.log.warn(`stored preference ${o} is invalid (${u.message}); using the default`),it(o))}return s(n,"read"),{read:n,async readAll(){let o=Rd();return await Promise.all(ze.map(async i=>{o[i]=await n(i)})),o},async isStored(o){return await t.get(oi(o))!==void 0},async write(o,i){let u=ti(o,i);if(!u.success)throw new Gr(o,u.message);return await t.set(oi(o),u.value),r(o,u.value),u.value},async reset(o){await t.delete(oi(o));let i=it(o);return r(o,i),i}}}s(Md,"createPreferenceStore");function n_(e){try{return JSON.parse(e)}catch{return e}}s(n_,"parseCliValue");function Ll(e){if(Cl(e))return e;throw new Fd(`Unknown preference: ${e}`,{code:"unknown_preference",hint:`Known preferences: ${ze.join(", ")}.`})}s(Ll,"requirePreferenceKey");var si={type:"boolean",description:"Emit machine-readable JSON"},jl={name:"key",description:"Preference name",required:!0};function Kd(e){function t(r,n,o){return o?JSON.stringify({key:r,value:n}):`${r} = ${JSON.stringify(n)}`}return s(t,"keyValueOutput"),r_({name:"thread-glance",summary:"Inspect and change the Thread Glance sidebar's layout preferences",description:"Organization, sort, group order, hidden and collapsed groups, child-thread folding and which child threads Needs you counts, for the Thread Glance sidebar. Values are JSON; a bare word is read as a string.",commands:{"prefs list":ii({summary:"List every preference and its current value",options:{json:si},async run(r){let n=await e.readAll();return r.options.json?{exitCode:0,stdout:JSON.stringify(n)}:{exitCode:0,stdout:ze.map(i=>`${i} ${JSON.stringify(n[i])} ${Tl(i)}`).join(`
68
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of e.seen.entries()){let c=u[1];if(t===u[0]){i(u);continue}if(e.external){let l=e.external.registry.get(u[0])?.id;if(t!==u[0]&&l){i(u);continue}}if(e.metadataRegistry.get(u[0])?.id){i(u);continue}if(c.cycle){i(u);continue}c.count>1&&e.reused==="ref"&&i(u)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Ne,"extractDefs");function Gf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Gf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let u of Array.isArray(i)?i:[i]){if(typeof u!="string")return;r.includes(u)||r.push(u)}}delete e.anyOf,e.type=r.length===1?r[0]:r}s(Gf,"compactTypeUnion");var qf=new Set(["type","properties","required","additionalProperties"]),Bf=["oneOf","anyOf"];function Jf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Jf,"undeclaredConstraint");function Dc(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let u in i)if(!qf.has(u))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let u in i.properties){if(Object.prototype.hasOwnProperty.call(r,u))continue;let c=[];for(let l of t){let f=l.properties?.[u]??Jf(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let a=c.length===1?c[0]:Dc(c)??{allOf:c};J(r,u,a)}for(let u of i.required??[])n.add(u)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let u of t){let c=Jf(u);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(Dc,"foldObjects");function dy(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of qf)if(o in e)return;let r=t.filter(o=>Bf.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dc(t);else{let o=r[0],i=Bf.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let u=t.filter(a=>a!==o),c=o[i].map(a=>Dc([...u,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Ar(e,n))}s(dy,"foldIntersection");function Ee(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(c=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,f={...l},p=a.ref;if(a.ref=null,p){n(p);let m=e.seen.get(p),g=m.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)):Ar(l,g),Ar(l,f),c._zod.parent===p)for(let $ in l)$==="$ref"||$==="allOf"||$ in f||delete l[$];if(g.$ref&&m.def)for(let $ in l)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(l[$])===JSON.stringify(m.def[$])&&delete l[$]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g])&&delete l[g]}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Gf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let f=l?.allOf;if(!Array.isArray(f))continue;let p=c.get(f);p?p.push(l):c.set(f,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])dy(l)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Ar(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let u=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(u,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?o.$defs=u:o.definitions=u);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Et(t,"input",e.processors),output:Et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}s(Ee,"finalize");function Q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(n.in,r)||Q(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;return!!(n.rest&&Q(n.rest,r))}return!1}s(Q,"isTransforming");var Rc=s((e,t={})=>r=>{let n=Ze({...r,processors:t});return D(e,n),Ne(n,e),Ee(n,e)},"createToJSONSchemaMethod"),Et=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},u=Ze({...o??{},target:i,io:t,processors:r});return D(e,u),Ne(u,e),Ee(u,e)},"createStandardJSONSchemaMethod");var Ct=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),Tt=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),Wf=s((e,t)=>{Ct(e,"minimum",t),Tt(e,"maximum",t)},"narrowBoth"),Qf=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),ep=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),tp=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),rp=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Xf=s((e,t)=>Ct(e,"minimum",t.minimum),"minContributor"),Hf=s((e,t)=>Tt(e,"maximum",t.maximum),"maxContributor"),Yf=s(e=>(t,r)=>{rp(t,r.format);let[n,o]=e[r.format];Ct(t,"minimum",n),Tt(t,"maximum",o)},"formatContributor"),my={greater_than:s((e,t)=>Ct(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Tt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Qf(e,t.value),"multiple_of"),number_format:Yf(Ht),bigint_format:Yf(Yt),min_length:Xf,max_length:Hf,length_equals:s((e,t)=>Wf(e,t.length),"length_equals"),min_size:Xf,max_size:Hf,size_equals:s((e,t)=>Wf(e,t.size),"size_equals"),string_format:s((e,t)=>{rp(e,t.format),t.pattern&&ep(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},"string_format"),mime_type:s((e,t)=>tp(e,t.mime),"mime_type")};function U(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)my[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Ct(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Ct(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Tt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Tt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Qf(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&tp(t,o.mime);for(let i of o.patterns??[])ep(t,i);return t}s(U,"aggregateChecks");var hy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gy=new Map([[In,Bi],[mr,Ji]]),np=s(e=>gy.get(e)??e,"exactPattern"),Vc=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:u,format:c,patterns:a,contentEncoding:l,laxFormat:f}=U(e);if(typeof i=="number"&&(o.minLength=i),typeof u=="number"&&(o.maxLength=u),c&&(o.format=hy[c]??c,o.format===""&&delete o.format,(c==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let p=[...a].map(np);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},"stringProcessor"),Mc=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:u,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:f}=U(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof a=="number"&&a<=(u??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p?m?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof u=="number"&&(o.maximum=u),c){let g=new Set;for(let z of c)Number.isFinite(z)&&z!==0?g.add(Math.abs(z)):K(e,t,o,n,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[y,...$]=g;y!==void 0&&(o.multipleOf=y),$.length&&(o.allOf=[...o.allOf??[],...$.map(z=>({multipleOf:z}))])}},"numberProcessor"),Fc=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),Kc=s((e,t,r,n)=>{K(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Uc=s((e,t,r,n)=>{K(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Bc=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Jc=s((e,t,r,n)=>{K(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Gc=s((e,t,r,n)=>{K(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),qc=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Wc=s((e,t,r,n)=>{},"anyProcessor"),Xc=s((e,t,r,n)=>{},"unknownProcessor"),Hc=s((e,t,r,n)=>{K(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Yc=s((e,t,r,n)=>{let o=e._zod.def,i=ut(o.entries);if(i.length===0){r.not={};return}i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Qc=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let u of o.values)if(u===void 0){if(K(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof u=="bigint"){if(K(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(u))}else i.push(u);if(i.length!==0)if(i.length===1){let u=i[0];r.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[u]:r.const=u}else i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),i.every(u=>typeof u=="boolean")&&(r.type="boolean"),i.every(u=>u===null)&&(r.type="null"),r.enum=i},"literalProcessor"),ea=s((e,t,r,n)=>{K(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),ta=s((e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),ra=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:u,mime:c}=U(e);i!==void 0&&(o.minLength=i),u!==void 0&&(o.maxLength=u),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},"fileProcessor"),na=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),oa=s((e,t,r,n)=>{K(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),ia=s((e,t,r,n)=>{K(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),sa=s((e,t,r,n)=>{K(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),ua=s((e,t,r,n)=>{K(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),ca=s((e,t,r,n)=>{K(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),aa=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:u,maximum:c}=U(e);typeof u=="number"&&(o.minItems=u),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=D(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");function Or(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Or(t.out):t.type==="catch"?Or(t.innerType):e._zod.optin}s(Or,"inputOptin");var la=s((e,t,r,n)=>{let o=r,i=e._zod.def,u=i.shape;if(Object.getOwnPropertySymbols(u).length&&K(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in u)J(o.properties,l,D(u[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(u)){let f=i.shape[l];(t.io==="input"?Or(f)===void 0:f._zod.optout===void 0)&&a.push(l)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),xo=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,u=o.options.map((c,a)=>D(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=u:r.anyOf=u},"unionProcessor"),fa=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,"allOf",0]}),u=D(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),a=[...c(i)?i.allOf:[i],...c(u)?u.allOf:[u]];r.allOf=a,t.intersections.push(a)},"intersectionProcessor"),pa=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let u=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,$)=>D(y,t,{...n,path:[...n.path,u,$]})),l=i.rest?D(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let y=i.items[f-1];if(!(t.io==="input"?Or(y)!==void 0:y._zod.optout==="optional"))break;f--}let p=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,d?o.items=!1:l&&(o.items=l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:a},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):(o.items=a,d?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),d&&(o.maxItems=p));let{minimum:m,maximum:g}=U(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function Lc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Lc(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let $=y.map(z=>Lc(e,z,r));$.some((z,x)=>z!==y[x])&&(t={...t,[g]:$})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.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:u,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:f,format:p,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?be:ur).source)),m}s(Lc,"stringifyKeyNames");var jc=new WeakMap;function yy(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of jc.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let u=Lc(t,i,new Set);u!==i&&r.set(i,u)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}s(yy,"rewriteKeyNames");var da=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let u=i.keyType,c=U(u).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=D(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)J(o.patternProperties,np(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let f=jc.get(t);f||(f=[],jc.set(t,f),t.deferred.push(()=>yy(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=u._zod.values,l=t.io==="input"&&Or(i.valueType)!==void 0;if(a&&!i.partial&&!l){let f=[...a].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(o.required=f.map(String))}},"recordProcessor"),ma=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),ha=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),ga=Symbol();function op(e,t,r,n,o){let i=!1,u=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(K(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ga):JSON.parse(u)}s(op,"serializeDefaultValue");var ya=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u=op(o.defaultValue,e,t,r,n);u!==ga&&(r.default=u)},"defaultProcessor"),_a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let u=op(o.defaultValue,e,t,r,n);u!==ga&&(r._prefault=u)},"prefaultProcessor"),$a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{K(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=u},"catchProcessor"),wa=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),u=t.io==="input"?i?o.out:o.in:o.out;D(u,t,n);let c=t.seen.get(e);c.ref=u},"pipeProcessor"),ba=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},"readonlyProcessor"),va=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),ko=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),xa=s((e,t,r,n)=>{let o=e._zod.innerType;D(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),vo={string:Vc,number:Mc,boolean:Fc,bigint:Kc,symbol:Uc,null:Bc,undefined:Jc,void:Gc,never:qc,any:Wc,unknown:Xc,date:Hc,enum:Yc,literal:Qc,nan:ea,template_literal:ta,file:ra,success:na,custom:oa,function:ia,transform:sa,map:ua,set:ca,array:aa,object:la,union:xo,intersection:fa,tuple:pa,record:da,nullable:ma,nonoptional:ha,default:ya,prefault:_a,catch:$a,pipe:wa,readonly:ba,promise:va,optional:ko,lazy:xa};function zo(e,t){if("_idmap"in e){let n=e,o=Ze({...t,processors:vo}),i={};for(let a of n._idmap.entries()){let[l,f]=a;D(f,o)}let u={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[l,f]=a;Ne(o,f),J(u,l,Ee(o,f))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[a]:i}}return{schemas:u}}let r=Ze({...t,processors:vo});return D(e,r),Ne(r,e),Ee(r,e)}s(zo,"toJSONSchema");var So=class{static{s(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Ze({processors:vo,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return D(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ne(this.ctx,t);let n=Ee(this.ctx,t),{"~standard":o,...i}=n;return i}};var ip={};var Kt={};_e(Kt,{ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>rt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>nt,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,codec:()=>dd,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,float32:()=>jp,float64:()=>Vp,function:()=>yd,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,literal:()=>cd,looseObject:()=>ed,looseRecord:()=>od,mac:()=>kp,map:()=>id,meta:()=>bd,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,never:()=>Xo,nonoptional:()=>ml,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>et,partialRecord:()=>nd,pipe:()=>Oo,prefault:()=>dl,preprocess:()=>zd,promise:()=>gd,readonly:()=>bl,record:()=>rl,refine:()=>Pl,set:()=>sd,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,transform:()=>Yo,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>Qe,url:()=>mp,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,void:()=>Wp,xid:()=>bp,xor:()=>td});var Po={};_e(Po,{endsWith:()=>zt,gt:()=>he,gte:()=>ue,includes:()=>xt,length:()=>He,lowercase:()=>bt,lt:()=>me,lte:()=>se,maxLength:()=>Xe,maxSize:()=>Oe,mime:()=>Pt,minLength:()=>ve,minSize:()=>ge,multipleOf:()=>Ae,negative:()=>_o,nonnegative:()=>wo,nonpositive:()=>$o,normalize:()=>It,overwrite:()=>de,positive:()=>yo,properties:()=>St,property:()=>bo,regex:()=>wt,size:()=>We,slugify:()=>Nt,startsWith:()=>kt,toLowerCase:()=>Ot,toUpperCase:()=>Zt,trim:()=>At,uppercase:()=>vt});var sp=new WeakSet([Object.prototype,Error.prototype]);function Io(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}s(Io,"_lazyMethod");var up=s((e,t)=>{zi.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);sp.has(r)||(sp.add(r),Io(r,"format",n=>o=>nr(n,o)),Io(r,"flatten",n=>o=>rr(n,o)),Io(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ct,2)}),Io(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ct,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),$y=h("ZodError",up),ie=h("ZodError",up,void 0,{Parent:Error});var ka=pt(ie),za=dt(ie),Sa=mt(ie),Pa=ht(ie),Ia=on(ie),Aa=sn(ie),Oa=un(ie),Za=cn(ie),Na=an(ie),Ea=ln(ie),Ca=fn(ie),Ta=pn(ie);function by(){B.localeError||M(vr())}s(by,"_ensureDefaultLocale");function tt(){B.memoizer||M({memoizer:br()})}s(tt,"_ensureDefaultMemoizer");var A=h("ZodType",(e,t)=>(by(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return C(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pl(e,t))},superRefine(e,t){return this.check(Il(e,t))},overwrite(e){return this.check(de(e))},optional(){return et(this)},exactOptional(){return cl(this)},nullable(){return Nr(this)},nullish(){return et(Nr(this))},nonoptional(e){return ml(this,e)},array(){return Tr(this)},or(e){return Ft([this,e])},and(e){return Qa(this,e)},transform(e){return Oo(this,Yo(e))},default(e){return fl(this,e)},prefault(e){return dl(this,e)},catch(e){return yl(this,e)},pipe(e){return Oo(this,e)},readonly(){return bl(this)},describe(e){let t=this.clone();return G.add(t,{description:e}),t},meta(...e){if(e.length===0)return G.get(this);let t=this.clone();return G.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 v.hide(this,"~standard",{...xn(this),jsonSchema:{input:Et(this,"input"),output:Et(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:s(function e(t,r){return ka(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await za(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return Sa(this,e,t)},async safeParseAsync(e,t){return Pa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return or(this,e,t)},validateAsync(e,t){return ir(this,e,t)},encode:s(function e(t,r){return Ia(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return Aa(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await Oa(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await Za(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return Na(this,e,t)},safeDecode(e,t){return Ea(this,e,t)},async safeEncodeAsync(e,t){return Ca(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),Zo=h("_ZodString",(e,t)=>{Ue.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o)},v.derived({format:s(e=>U(e).format??null,"format"),minLength:s(e=>U(e).minimum??null,"minLength"),maxLength:s(e=>U(e).maximum??null,"maxLength")},{regex(...e){return this.check(wt(...e))},includes(...e){return this.check(xt(...e))},startsWith(...e){return this.check(kt(...e))},endsWith(...e){return this.check(zt(...e))},min(...e){return this.check(ve(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(He(...e))},nonempty(...e){return this.check(ve(1,...e))},lowercase(e){return this.check(bt(e))},uppercase(e){return this.check(vt(e))},trim(){return this.check(At())},normalize(...e){return this.check(It(...e))},toLowerCase(){return this.check(Ot())},toUpperCase(){return this.check(Zt())},slugify(){return this.check(Nt())}})),Lt=h("ZodString",(e,t)=>{Ue.init(e,t),Zo.init(e,t)},{email(e){return this.check(Wn(No,e))},url(e){return this.check(kr(Er,e))},jwt(e){return this.check(go(qo,e))},emoji(e){return this.check(to(Co,e))},guid(e){return this.check(Xn(Eo,e))},uuid(e){return this.check(Hn(ye,e))},uuidv4(e){return this.check(Yn(ye,e))},uuidv6(e){return this.check(Qn(ye,e))},uuidv7(e){return this.check(eo(ye,e))},nanoid(e){return this.check(ro(To,e))},cuid(e){return this.check(no(Do,e))},cuid2(e){return this.check(oo(Ro,e))},ulid(e){return this.check(io(Lo,e))},base64(e){return this.check(po(Bo,e))},base64url(e){return this.check(mo(Jo,e))},xid(e){return this.check(so(jo,e))},ksuid(e){return this.check(uo(Vo,e))},ipv4(e){return this.check(co(Mo,e))},ipv6(e){return this.check(ao(Fo,e))},cidrv4(e){return this.check(lo(Ko,e))},cidrv6(e){return this.check(fo(Uo,e))},e164(e){return this.check(ho(Go,e))},datetime(e){return this.check(zr(Ce,e))},date(e){return this.check(Sr(Te,e))},time(e){return this.check(Pr(De,e))},duration(e){return this.check(Ir(Re,e))}});function Zr(e){return Qu(Lt,e)}s(Zr,"string");var R=h("ZodStringFormat",(e,t)=>{T.init(e,t),Zo.init(e,t)}),Ce=h("ZodISODateTime",(e,t)=>{Bs.init(e,t),R.init(e,t)}),Te=h("ZodISODate",(e,t)=>{Js.init(e,t),R.init(e,t)}),De=h("ZodISOTime",(e,t)=>{Gs.init(e,t),R.init(e,t)}),Re=h("ZodISODuration",(e,t)=>{qs.init(e,t),R.init(e,t)}),No=h("ZodEmail",(e,t)=>{Cs.init(e,t),R.init(e,t)});function cp(e){return Wn(No,e)}s(cp,"email");var Eo=h("ZodGUID",(e,t)=>{Ns.init(e,t),R.init(e,t)});function ap(e){return Xn(Eo,e)}s(ap,"guid");var ye=h("ZodUUID",(e,t)=>{Es.init(e,t),R.init(e,t)});function lp(e){return Hn(ye,e)}s(lp,"uuid");function fp(e){return Yn(ye,e)}s(fp,"uuidv4");function pp(e){return Qn(ye,e)}s(pp,"uuidv6");function dp(e){return eo(ye,e)}s(dp,"uuidv7");var Er=h("ZodURL",(e,t)=>{Rs.init(e,t),R.init(e,t)});function mp(e){return kr(Er,e)}s(mp,"url");function hp(e){return kr(Er,{protocol:sr,hostname:qi,...v.normalizeParams(e)})}s(hp,"httpUrl");var Co=h("ZodEmoji",(e,t)=>{Ls.init(e,t),R.init(e,t)});function gp(e){return to(Co,e)}s(gp,"emoji");var To=h("ZodNanoID",(e,t)=>{js.init(e,t),R.init(e,t)});function yp(e){return ro(To,e)}s(yp,"nanoid");var Do=h("ZodCUID",(e,t)=>{Vs.init(e,t),R.init(e,t)});function _p(e){return no(Do,e)}s(_p,"cuid");var Ro=h("ZodCUID2",(e,t)=>{Ms.init(e,t),R.init(e,t)});function $p(e){return oo(Ro,e)}s($p,"cuid2");var Lo=h("ZodULID",(e,t)=>{Fs.init(e,t),R.init(e,t)});function wp(e){return io(Lo,e)}s(wp,"ulid");var jo=h("ZodXID",(e,t)=>{Ks.init(e,t),R.init(e,t)});function bp(e){return so(jo,e)}s(bp,"xid");var Vo=h("ZodKSUID",(e,t)=>{Us.init(e,t),R.init(e,t)});function vp(e){return uo(Vo,e)}s(vp,"ksuid");var Mo=h("ZodIPv4",(e,t)=>{Ws.init(e,t),R.init(e,t)});function xp(e){return co(Mo,e)}s(xp,"ipv4");var Da=h("ZodMAC",(e,t)=>{Hs.init(e,t),R.init(e,t)});function kp(e){return tc(Da,e)}s(kp,"mac");var Fo=h("ZodIPv6",(e,t)=>{Xs.init(e,t),R.init(e,t)});function zp(e){return ao(Fo,e)}s(zp,"ipv6");var Ko=h("ZodCIDRv4",(e,t)=>{Ys.init(e,t),R.init(e,t)});function Sp(e){return lo(Ko,e)}s(Sp,"cidrv4");var Uo=h("ZodCIDRv6",(e,t)=>{Qs.init(e,t),R.init(e,t)});function Pp(e){return fo(Uo,e)}s(Pp,"cidrv6");var Bo=h("ZodBase64",(e,t)=>{eu.init(e,t),R.init(e,t)});function Ip(e){return po(Bo,e)}s(Ip,"base64");var Jo=h("ZodBase64URL",(e,t)=>{tu.init(e,t),R.init(e,t)});function Ap(e){return mo(Jo,e)}s(Ap,"base64url");var Go=h("ZodE164",(e,t)=>{ru.init(e,t),R.init(e,t)});function Op(e){return ho(Go,e)}s(Op,"e164");var Ra=h("ZodCreditCard",(e,t)=>{nu.init(e,t),R.init(e,t)});function Zp(e){return rc(Ra,e)}s(Zp,"creditCard");var La=h("ZodIBAN",(e,t)=>{ou.init(e,t),R.init(e,t)});function Np(e){return nc(La,e)}s(Np,"iban");var qo=h("ZodJWT",(e,t)=>{iu.init(e,t),R.init(e,t)});function Ep(e){return go(qo,e)}s(Ep,"jwt");var rt=h("ZodCustomStringFormat",(e,t)=>{su.init(e,t),R.init(e,t)});function Cp(e,t,r={}){return Ye(rt,e,t,r)}s(Cp,"stringFormat");function Tp(e){return Ye(rt,"hostname",Gi,e)}s(Tp,"hostname");function Dp(e){return Ye(rt,"hex",cs,e)}s(Dp,"hex");function Rp(e){return Ye(rt,"currency_code",Xi,e)}s(Rp,"currencyCode");function Lp(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=le[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Ye(rt,n,o,t)}s(Lp,"hash");var jt=h("ZodNumber",(e,t)=>{En.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},v.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=U(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=U(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=U(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>U(e).format??null,"format")},{gt(e,t){return this.check(he(e,t))},gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},int(e){return this.check(Ao(e))},safe(e){return this.check(Ao(e))},positive(e){return this.check(he(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(me(0,e))},nonpositive(e){return this.check(se(0,e))},multipleOf(e,t){return this.check(Ae(e,t))},step(e,t){return this.check(Ae(e,t))},finite(){return this}}));function ja(e){return ic(jt,e)}s(ja,"number");var nt=h("ZodNumberFormat",(e,t)=>{uu.init(e,t),jt.init(e,t)});function Ao(e){return uc(nt,e)}s(Ao,"int");function jp(e){return cc(nt,e)}s(jp,"float32");function Vp(e){return ac(nt,e)}s(Vp,"float64");function Mp(e){return lc(nt,e)}s(Mp,"int32");function Fp(e){return fc(nt,e)}s(Fp,"uint32");var Vt=h("ZodBoolean",(e,t)=>{hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function Va(e){return pc(Vt,e)}s(Va,"boolean");var Mt=h("ZodBigInt",(e,t)=>{Cn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o)},v.derived({minValue:s(e=>U(e).minimum??null,"minValue"),maxValue:s(e=>U(e).maximum??null,"maxValue"),format:s(e=>U(e).format??null,"format")},{gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},gt(e,t){return this.check(he(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},positive(e){return this.check(he(BigInt(0),e))},negative(e){return this.check(me(BigInt(0),e))},nonpositive(e){return this.check(se(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,t){return this.check(Ae(e,t))}}));function Kp(e){return mc(Mt,e)}s(Kp,"bigint");var Wo=h("ZodBigIntFormat",(e,t)=>{cu.init(e,t),Mt.init(e,t)});function Up(e){return gc(Wo,e)}s(Up,"int64");function Bp(e){return yc(Wo,e)}s(Bp,"uint64");var Ma=h("ZodSymbol",(e,t)=>{au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uc(e,r,n,o)});function Jp(e){return _c(Ma,e)}s(Jp,"symbol");var Fa=h("ZodUndefined",(e,t)=>{lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o)});function Gp(e){return $c(Fa,e)}s(Gp,"_undefined");var Ka=h("ZodNull",(e,t)=>{fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o)});function Ua(e){return wc(Ka,e)}s(Ua,"_null");var Ba=h("ZodAny",(e,t)=>{pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function qp(){return bc(Ba)}s(qp,"any");var Ja=h("ZodUnknown",(e,t)=>{du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o)});function Qe(){return vc(Ja)}s(Qe,"unknown");var Ga=h("ZodNever",(e,t)=>{mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function Xo(e){return xc(Ga,e)}s(Xo,"never");var qa=h("ZodVoid",(e,t)=>{hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o)});function Wp(e){return kc(qa,e)}s(Wp,"_void");var Cr=h("ZodDate",(e,t)=>{gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.min=(r,n)=>e.check(ue(r,n)),e.max=(r,n)=>e.check(se(r,n))},v.derived({minDate:s(e=>{let{minimum:t}=U(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=U(e);return t?new Date(t):null},"maxDate")},{}));function Xp(e){return zc(Cr,e)}s(Xp,"date");var Wa=h("ZodArray",(e,t)=>{tt(),yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ve(e,t))},nonempty(e){return this.check(ve(1,e))},max(e,t){return this.check(Xe(e,t))},length(e,t){return this.check(He(e,t))},unwrap(){return this.element}});function Tr(e,t){return Ic(Wa,e,t)}s(Tr,"array");function Hp(e){let t=e._zod.def.shape;return Ho(Object.keys(t))}s(Hp,"keyof");var Dr=h("ZodObject",(e,t)=>{tt(),_u.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ho(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Xo()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Lr,this,e[0])},exactPartial(...e){return v.partial(Qo,this,e[0],"exactPartial")},required(...e){return v.required(ei,this,e[0])}});function Yp(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Dr(r)}s(Yp,"object");function Qp(e,t){return new Dr({type:"object",shape:e,catchall:Xo(),...v.normalizeParams(t)})}s(Qp,"strictObject");function ed(e,t){return new Dr({type:"object",shape:e,catchall:Qe(),...v.normalizeParams(t)})}s(ed,"looseObject");var Rr=h("ZodUnion",(e,t)=>{gr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function Ft(e,t){return new Rr({type:"union",options:e,...v.normalizeParams(t)})}s(Ft,"union");var Xa=h("ZodXor",(e,t)=>{Rr.init(e,t),$u.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function td(e,t){return new Xa({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}s(td,"xor");var Ha=h("ZodDiscriminatedUnion",(e,t)=>{Rr.init(e,t),bu.init(e,t)});function rd(e,t,r){return new Ha({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}s(rd,"discriminatedUnion");var Ya=h("ZodIntersection",(e,t)=>{vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r,n,o)});function Qa(e,t){return new Ya({type:"intersection",left:e,right:t})}s(Qa,"intersection");var el=h("ZodTuple",(e,t)=>{tt(),Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Lr({type:"optional",innerType:t}))})}});function tl(e,t,r){let n=t instanceof P,o=n?r:t,i=n?t:null;return new el({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}s(tl,"tuple");var Dt=h("ZodRecord",(e,t)=>{tt(),xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>da(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function rl(e,t,r){return!t||!t._zod?new Dt({type:"record",keyType:Zr(),valueType:e,...v.normalizeParams(t)}):new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}s(rl,"record");function nd(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}s(nd,"partialRecord");function od(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}s(od,"looseRecord");var nl=h("ZodMap",(e,t)=>{tt(),ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ua(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function id(e,t,r){return new nl({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}s(id,"map");var ol=h("ZodSet",(e,t)=>{tt(),zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca(e,r,n,o),e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function sd(e,t){return new ol({type:"set",valueType:e,...v.normalizeParams(t)})}s(sd,"set");var Rt=h("ZodEnum",(e,t)=>{Su.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Yc(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let u of n)if(r.has(u))i[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let u of n)if(r.has(u))delete i[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})}});function Ho(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rt({type:"enum",entries:r,...v.normalizeParams(t)})}s(Ho,"_enum");function ud(e,t){return new Rt({type:"enum",entries:e,...v.normalizeParams(t)})}s(ud,"nativeEnum");var il=h("ZodLiteral",(e,t)=>{Pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function cd(e,t){return new il({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}s(cd,"literal");var sl=h("ZodFile",(e,t)=>{Iu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ra(e,r,n,o),e.min=(r,n)=>e.check(ge(r,n)),e.max=(r,n)=>e.check(Oe(r,n)),e.mime=(r,n)=>e.check(Pt(Array.isArray(r)?r:[r],n))});function ad(e){return Ac(sl,e)}s(ad,"file");var ul=h("ZodTransform",(e,t)=>{tt(),Au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let u=i;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),"input"in u||(u.input=r.value),u.inst??(u.inst=e),r.issues.push(v.issue(u))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Yo(e){return new ul({type:"transform",transform:e})}s(Yo,"transform");var Lr=h("ZodOptional",(e,t)=>{Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function et(e){return new Lr({type:"optional",innerType:e})}s(et,"optional");var Qo=h("ZodExactOptional",(e,t)=>{Ou.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new Qo({type:"optional",innerType:e})}s(cl,"exactOptional");var al=h("ZodNullable",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ma(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new al({type:"nullable",innerType:e})}s(Nr,"nullable");function ld(e){return et(Nr(e))}s(ld,"nullish");var ll=h("ZodDefault",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fl(e,t){return new ll({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(fl,"_default");var pl=h("ZodPrefault",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dl(e,t){return new pl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(dl,"prefault");var ei=h("ZodNonOptional",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ha(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new ei({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}s(ml,"nonoptional");var hl=h("ZodSuccess",(e,t)=>{Tu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>na(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fd(e){return new hl({type:"success",innerType:e})}s(fd,"success");var gl=h("ZodCatch",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yl(e,t){return new gl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}s(yl,"_catch");var _l=h("ZodNaN",(e,t)=>{Ru.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ea(e,r,n,o)});function pd(e){return Pc(_l,e)}s(pd,"nan");var jr=h("ZodPipe",(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wa(e,r,n,o),e.in=t.in,e.out=t.out});function Oo(e,t){return new jr({type:"pipe",in:e,out:t})}s(Oo,"pipe");var Vr=h("ZodCodec",(e,t)=>{jr.init(e,t),yr.init(e,t)});function dd(e,t,r){return new Vr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(dd,"codec");function md(e){let t=e._zod.def;return new Vr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(md,"invertCodec");var $l=h("ZodPreprocess",(e,t)=>{jr.init(e,t),Lu.init(e,t)}),wl=h("ZodReadonly",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ba(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new wl({type:"readonly",innerType:e})}s(bl,"readonly");var vl=h("ZodTemplateLiteral",(e,t)=>{Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ta(e,r,n,o)});function hd(e,t){return new vl({type:"template_literal",parts:e,...v.normalizeParams(t)})}s(hd,"templateLiteral");var xl=h("ZodLazy",(e,t)=>{_r.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xa(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function kl(e){return new xl({type:"lazy",getter:e})}s(kl,"lazy");var zl=h("ZodPromise",(e,t)=>{Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gd(e){return new zl({type:"promise",innerType:e})}s(gd,"promise");var Sl=h("ZodFunction",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ia(e,r,n,o)});function yd(e){return new Sl({type:"function",input:Array.isArray(e?.input)?tl(e?.input):e?.input??Tr(Qe()),output:e?.output??Qe()})}s(yd,"_function");var Mr=h("ZodCustom",(e,t)=>{Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oa(e,r,n,o)});function _d(e){let t=new L({check:"custom"});return t._zod.check=e,t}s(_d,"check");function $d(e,t){return Oc(Mr,e??(()=>!0),t)}s($d,"custom");function Pl(e,t={}){return Zc(Mr,e,t)}s(Pl,"refine");function Il(e,t){return Nc(e,t)}s(Il,"superRefine");var wd=Ec,bd=Cc,Al=h("ZodInstanceOf",(e,t)=>{Mr.init(e,t)},{properties(e,t){return this.check(St(e,t))}});function vd(e,t={}){let r=new Al({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...v.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}s(vd,"_instanceof");var xd=s((...e)=>Tc({Codec:Vr,Boolean:Vt,String:Lt},...e),"stringbool");function kd(e){let t=kl(()=>Ft([Zr(e),ja(),Va(),Ua(),Tr(t),rl(Zr(),t)]));return t}s(kd,"json");function zd(e,t){return new $l({type:"pipe",in:Yo(e),out:t})}s(zd,"preprocess");var vy={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function xy(e){M({customError:e})}s(xy,"setErrorMap");function ky(){return M().customError}s(ky,"getErrorMap");var Ol;Ol||(Ol={});var Fr={};_e(Fr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,date:()=>Sy,datetime:()=>zy,duration:()=>Iy,time:()=>Py});function zy(e){return zr(Ce,e)}s(zy,"datetime");function Sy(e){return Sr(Te,e)}s(Sy,"date");function Py(e){return Pr(De,e)}s(Py,"time");function Iy(e){return Ir(Re,e)}s(Iy,"duration");var w={...Kt,...Po,iso:Fr},Ay=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Oy(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(Oy,"detectVersion");function Sd(e,t){return e.map((r,n)=>n<t?r:r.optional())}s(Sd,"applyMinItems");function Zy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(Zy,"decodeJSONPointerSegment");function Ny(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:Zy(r[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}s(Ny,"resolveRef");function Ey(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&n.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let u of i){let c=t.keySchema.safeParse(u);c.success||n.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:u,path:[u],continue:!0})}}).pipe(e)}s(Ey,"checkObjectGuards");function Zl(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let u of e){let c=Zl(u,t);if(c===null)return null;i.push(c)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let u=Zl(e[i],t);if(u===null)return null;o.push(`${i.length}:${i}=${u}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(Zl,"canonicalKey");var Cy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Ty=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Kr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Kr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Cy.has(t)?Kr(r):!Ty.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Kr))}s(Kr,"containsRef");function Pd(e){return e===1?"element":"elements"}s(Pd,"plural");function Dy(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let u=0;u<o.length;u++){let c=Zl(o[u],new Set);if(c===null)continue;let a=i.get(c);if(a===void 0){i.set(c,u);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${u} duplicates the one at index ${a}`,input:o,path:[u],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,u=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let a of o)if(t.containsSchema.safeParse(a).success&&++c>=u)break;c<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Pd(i)}; found ${c}`,input:o,continue:!0}),t.maxContains!==void 0&&c>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Pd(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(Dy,"checkArrayGuards");function Id(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ee(e,t)}s(Id,"getTupleRest");var Ry=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ad(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return w.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return w.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=Ny(o,t),u=ee(i,t);return t.refs.set(o,u),t.processing.delete(o),u}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return w.null();if(o.length===0)return w.never();if(o.length===1)return w.literal(o[0]);if(o.every(u=>typeof u=="string"))return w.enum(o);let i=o.map(u=>w.literal(u));return i.length<2?i[0]:w.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let u={...e,type:i};return Ad(u,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!r)return w.any();let n;switch(r){case"string":{let o=w.string();if(e.format){let i=e.format;i==="email"?o=o.check(w.email()):i==="uri"||i==="uri-reference"?o=o.check(w.url()):i==="uuid"||i==="guid"?o=o.check(w.uuid()):i==="date-time"?o=o.check(w.iso.datetime({offset:!0})):i==="date"?o=o.check(w.iso.date()):i==="time"?o=o.check(w.regex(Ry)):i==="duration"?o=o.check(w.iso.duration()):i==="hostname"?o=o.check(w.hostname()):i==="ipv4"?o=o.check(w.ipv4()):i==="ipv6"?o=o.check(w.ipv6()):i==="mac"?o=o.check(w.mac()):i==="cidr"?o=o.check(w.cidrv4()):i==="cidr-v6"?o=o.check(w.cidrv6()):i==="base64"?o=o.check(w.base64()):i==="base64url"?o=o.check(w.base64url()):i==="e164"?o=o.check(w.e164()):i==="credit_card"?o=o.check(w.creditCard()):i==="iban"?o=o.check(w.iban()):i==="jwt"?o=o.check(w.jwt()):i==="emoji"?o=o.check(w.emoji()):i==="nanoid"?o=o.check(w.nanoid()):i==="cuid"?o=o.check(w.cuid()):i==="cuid2"?o=o.check(w.cuid2()):i==="ulid"?o=o.check(w.ulid()):i==="xid"?o=o.check(w.xid()):i==="ksuid"&&(o=o.check(w.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),n=o;break}case"number":case"integer":{let o=r==="integer"?w.number().int():w.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),n=o;break}case"boolean":{n=w.boolean();break}case"null":{n=w.null();break}case"object":{let o={},i=e.properties||{},u=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?ee(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=ee(d,t);J(o,p,u.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let $=ee(p[y],t),z=w.string().regex(new RegExp(y));m.push(w.looseRecord(z,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)n=w.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)y=w.intersection(y,g[$]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),$=d.map(x=>new RegExp(x)),z=n;n=n.check(x=>{if(!ce(x.value))return;let I=[];for(let E of Object.keys(x.value))y.includes(E)||$.some(j=>j.test(E))||I.push(E);I.length&&x.issues.push({code:"unrecognized_keys",keys:I,input:x.value,inst:z})})}}else{let p=w.object(o);e.additionalProperties===!1?n=p.strict():c?n=p.catchall(c):n=p.passthrough()}let a=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,f=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(a||l!==void 0||f!==void 0){let p;if(a){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=ee(d,t)}n=Ey(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let u=typeof e.minItems=="number"?e.minItems:0,c=o.map(p=>ee(p,t)),a=Sd(c,u),l=Array.isArray(i)?void 0:Id(i,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let u=typeof e.minItems=="number"?e.minItems:0,c=i.map(p=>ee(p,t)),a=Sd(c,u),l=Id(e.additionalItems,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let u=ee(i,t),c=w.array(u);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),n=c}else n=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=Dy(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return n}s(Ad,"convertBaseSchema");function ee(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r=Ad(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>ee(l,t)),a=w.union(c);r=n?w.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>ee(l,t)),a=w.xor(c);r=n?w.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:w.any();else{let c=n?r:ee(e.allOf[0],t),a=n?0:1;for(let l=a;l<e.allOf.length;l++)c=w.intersection(c,ee(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=w.nullable(r)),e.readOnly===!0&&(r=w.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(o[c]=e[c]);let u=["contentEncoding","contentMediaType","contentSchema"];for(let c of u)c in e&&(o[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Kr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(o[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Kr(e.contains)&&(o.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(o[c]=e[c])}for(let c of Object.keys(e))Ay.has(c)||J(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}s(ee,"convertSchema");function Od(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=Oy(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??G};return ee(r,i)}s(Od,"fromJSONSchema");var Zd=Symbol("z.visit/resolving");function Ur(e,t){let r=typeof t=="function"?t:(u,c)=>{let a=t[u._zod.def.type];return a?a(u,c):u},n=new Map;function o(u){let c=n.get(u);if(c===Zd)return new _r({type:"lazy",getter:s(()=>n.get(u),"getter")});if(c!==void 0)return c;n.set(u,Zd);let a=i(u),l=r(a,a!==u);return n.set(u,l),l}s(o,"run");function i(u){let c=u._zod.def,a=c.type;switch(a){case"object":{let l=c.shape,f=Object.keys(l),p=!1,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?C(u,{...c,shape:d,catchall:m}):u}case"array":{let l=o(c.element);return l===c.element?u:C(u,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?C(u,{...c,items:p,rest:d}):u}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?u:C(u,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?u:C(u,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?C(u,{...c,options:p}):u}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?u:C(u,{...c,left:l,right:f})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=o(c.innerType);return l===c.innerType?u:C(u,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?u:C(u,{...c,in:l,out:f})}case"function":{let l=o(c.input),f=o(c.output);return l===c.input&&f===c.output?u:C(u,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return C(u,{...p,getter:s(()=>o(l()),"getter")})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return u;default:return u}}return s(i,"mapInner"),o(e)}s(Ur,"visit");function Nd(e){return Ur(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:Ft(r.options)},"union")})}s(Nd,"deepPartial");function Ly(e,t){if(!t?.length)return e;let r=e._zod.def;return C(e,fe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}s(Ly,"withChecks");function Ed(e){return Ly(e.out,e.checks)}s(Ed,"outSide");function jy(e){return e.in._zod.traits.has("$ZodTransform")?Ed(e):e.in}s(jy,"inSide");function Cd(e){return Ur(e,{pipe:s(t=>jy(t._zod.def),"pipe"),default:s((t,r)=>r?et(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}s(Cd,"input");function Td(e){return Ur(e,{pipe:s(t=>Ed(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}s(Td,"output");var Nl={};_e(Nl,{bigint:()=>Ky,boolean:()=>Fy,date:()=>Uy,number:()=>My,string:()=>Vy});function Vy(e){return ec(Lt,e)}s(Vy,"string");function My(e){return sc(jt,e)}s(My,"number");function Fy(e){return dc(Vt,e)}s(Fy,"boolean");function Ky(e){return hc(Mt,e)}s(Ky,"bigint");function Uy(e){return Sc(Cr,e)}s(Uy,"date");var El=1e4,Dd=b.string().min(1).max(1024),ke=b.array(Dd).max(El),By=b.enum(["project","chronological","machine"]),Jy=b.enum(["updated","created","alpha","none"]),Gy=b.enum(["default","ascending","descending"]),qy=b.enum(["active","archived"]),Wy=b.enum(["muted","colour","hidden"]),Xy=b.enum(["blocked","everything"]),Hy=b.array(b.union([b.literal("threads"),Dd.regex(/^(project|section|machine):\S+$/)])).max(El).transform(e=>[...new Set(e)]);function F(e,t,r){return{schema:e,defaultValue:t,description:r}}s(F,"define");var ot={threadLifecycles:F(b.array(qy).min(1).max(2).refine(e=>new Set(e).size===e.length,"Lifecycles must be unique"),["active"],'Threads shown: ["active"], ["archived"] or both. At least one is required.'),organizationMode:F(By,"project","How top-level groups are formed: project, chronological (custom sections) or machine."),environmentGrouping:F(b.boolean(),!1,"Worktrees as folders: whether sibling threads sharing a worktree environment fold into a folder row."),chronologicalSort:F(Jy,"updated","Sort field inside a group: updated, created or alpha. none is read as updated."),sortDirection:F(Gy,"default","Sort direction: ascending or descending. A saved default reads as the field's own direction (descending for dates, ascending for alpha)."),sectionOrder:F(ke,["pinned","projects","threads"],"Top-level group order when organized by project."),manualSectionOrder:F(ke,["pinned","sections","threads"],"Top-level group order when organized chronologically."),machineSectionOrder:F(ke,["pinned","machines","threads"],"Top-level group order when organized by machine."),hiddenGroups:F(Hy,[],"Groups moved into More: threads, project:<id>, section:<id> or machine:<id>."),collapsedSections:F(b.array(b.enum(["pinned","threads"])).max(El),[],"Built-in groups (pinned, threads) that are collapsed."),collapsedProjects:F(ke,[],"Project ids whose group is collapsed."),collapsedThreadSections:F(ke,[],"Custom section keys (section:<id>) whose group is collapsed."),collapsedMachines:F(ke,[],"Machine ids whose group is collapsed."),collapsedEnvironments:F(ke,[],"Environment ids whose folder row is collapsed."),foldOlder:F(b.boolean(),!0,"Collapse older threads: whether each group's quiet roots past its 5 newest fold behind an N older row."),workingFirst:F(b.boolean(),!1,"Working threads first: whether working threads sort first under Updated, as bb's list does."),expandedOlder:F(ke,[],"Group ids and parent thread ids whose N older fold the user opened."),expandedChildren:F(ke,[],"Parent thread ids whose chip the user opened."),showPullRequests:F(b.boolean(),!0,"Whether rows show a pull request badge."),childAttention:F(Xy,"blocked","Needs attention counts every child: blocked counts a child thread that waits on you, is offline or has an orphaned failure; everything also counts every failed or finished-unread child. The same children stay out of a family's older fold, as running ones do."),harnessIcon:F(Wy,"muted","How rows draw the harness logo: muted (monochrome), colour (the provider's tint) or hidden.")},ze=Object.keys(ot);function Cl(e){return Object.hasOwn(ot,e)}s(Cl,"isPreferenceKey");function it(e){return structuredClone(ot[e].defaultValue)}s(it,"preferenceDefault");function Rd(){return Object.fromEntries(ze.map(e=>[e,it(e)]))}s(Rd,"defaultPreferences");function Tl(e){return ot[e].description}s(Tl,"describePreference");function ti(e,t){let r=ot[e].schema.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,message:r.error.issues.map(n=>n.message).join("; ")}}s(ti,"parsePreference");function Dl(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};let t=e,r={};for(let[n,o]of Object.entries(t)){if(n==="collapsedThreads"||!Cl(n))continue;let u=ti(n,n==="environmentGrouping"&&o==="auto"?!1:o);u.success&&(r[n]=u.value)}return r}s(Dl,"mapBbPreferences");var ww=b.object({density:b.enum(["compact","comfortable"]).catch("compact")});var ri=b.record(b.string(),b.number()),Ld=b.object({startedAt:ri,finishedAt:ri,pendingAt:ri,seenAt:ri}),Br=140,Rl=b.object({kind:b.enum(["question","approval","plan","input","failed","done"]),text:b.string().max(Br),at:b.number()}),ni=b.object({pending:Rl.optional(),failed:Rl.optional(),done:Rl.optional()}),Le={preferences:"preferences",stamps:"stamps",scheduled:"scheduled",notes:"notes"};var Jr=b.enum(ze),Qy=b.object(Object.fromEntries(ze.map(e=>[e,ot[e].schema]))),e_=b.record(b.string(),b.number()),jd=b.array(b.string().min(1).max(1024)).max(1e4),Vd=Yy({listPreferences:{input:b.null(),output:b.object({preferences:Qy}).strict()},setPreference:{input:b.object({key:Jr,value:b.unknown()}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},resetPreference:{input:b.object({key:Jr}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},importPreferences:{input:b.object({bbMirror:b.unknown().nullable()}).strict(),output:b.object({status:b.enum(["already-imported","imported","defaults"]),source:b.enum(["local-storage","cli","none"]).nullable(),keys:b.array(Jr)}).strict()},listStamps:{input:b.null(),output:b.object({stamps:Ld}).strict()},markSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({at:b.number()}).strict()},clearSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({ok:b.literal(!0)}).strict()},listNotes:{input:b.null(),output:b.object({notes:b.record(b.string(),ni)}).strict()},listScheduled:{input:b.null(),output:b.object({status:b.enum(["ready","error"]),scheduled:e_}).strict()}});import{PluginCliError as Fd,cliCommand as ii,defineCli as r_}from"@get-bb/plugin-sdk";var t_="preference:";function oi(e){return`${t_}${e}`}s(oi,"preferenceKvKey");var Gr=class extends Error{static{s(this,"PreferenceValidationError")}key;detail;constructor(t,r){super(`Invalid value for ${t}: ${r}`),this.name="PreferenceValidationError",this.key=t,this.detail=r}};function Md(e){let{kv:t}=e.storage;function r(o,i){let u={key:o,value:i};e.realtime.publish(Le.preferences,u)}s(r,"publish");async function n(o){let i=await t.get(oi(o));if(i===void 0)return it(o);let u=ti(o,i);return u.success?u.value:(e.log.warn(`stored preference ${o} is invalid (${u.message}); using the default`),it(o))}return s(n,"read"),{read:n,async readAll(){let o=Rd();return await Promise.all(ze.map(async i=>{o[i]=await n(i)})),o},async isStored(o){return await t.get(oi(o))!==void 0},async write(o,i){let u=ti(o,i);if(!u.success)throw new Gr(o,u.message);return await t.set(oi(o),u.value),r(o,u.value),u.value},async reset(o){await t.delete(oi(o));let i=it(o);return r(o,i),i}}}s(Md,"createPreferenceStore");function n_(e){try{return JSON.parse(e)}catch{return e}}s(n_,"parseCliValue");function Ll(e){if(Cl(e))return e;throw new Fd(`Unknown preference: ${e}`,{code:"unknown_preference",hint:`Known preferences: ${ze.join(", ")}.`})}s(Ll,"requirePreferenceKey");var si={type:"boolean",description:"Emit machine-readable JSON"},jl={name:"key",description:"Preference name",required:!0};function Kd(e){function t(r,n,o){return o?JSON.stringify({key:r,value:n}):`${r} = ${JSON.stringify(n)}`}return s(t,"keyValueOutput"),r_({name:"thread-glance",summary:"Inspect and change the Thread Glance sidebar's layout preferences",description:"Organization, sort, group order, hidden and collapsed groups, child-thread folding and which child threads Needs attention counts, for the Thread Glance sidebar. Values are JSON; a bare word is read as a string.",commands:{"prefs list":ii({summary:"List every preference and its current value",options:{json:si},async run(r){let n=await e.readAll();return r.options.json?{exitCode:0,stdout:JSON.stringify(n)}:{exitCode:0,stdout:ze.map(i=>`${i} ${JSON.stringify(n[i])} ${Tl(i)}`).join(`
69
69
  `)}}}),"prefs get":ii({summary:"Print one preference",positionals:[jl],options:{json:si},async run(r){let n=Ll(r.positionals.key),o=await e.read(n);return{exitCode:0,stdout:r.options.json?JSON.stringify({key:n,value:o}):JSON.stringify(o)}}}),"prefs set":ii({summary:"Set one preference",positionals:[jl,{name:"value",description:`JSON value, e.g. '"machine"' or '["pinned","threads"]'`,required:!0}],options:{json:si},async run(r){let n=Ll(r.positionals.key);try{let o=await e.write(n,n_(r.positionals.value));return{exitCode:0,stdout:t(n,o,r.options.json===!0)}}catch(o){throw o instanceof Gr?new Fd(o.message,{code:"invalid_preference_value",hint:Tl(n)}):o}}}),"prefs reset":ii({summary:"Restore one preference to its default",positionals:[jl],options:{json:si},async run(r){let n=Ll(r.positionals.key),o=await e.reset(n);return{exitCode:0,stdout:t(n,o,r.options.json===!0)}}})}})}s(Kd,"createCli");function Ut(){let e=Promise.resolve();return t=>{let r=e.then(t,t);return e=r.catch(()=>{}),r}}s(Ut,"createSerialQueue");var Vl="note:",o_="ask-user-question",Bd="Needs your input";function Ud(e){return`${Vl}${e}`}s(Ud,"noteKvKey");function Bt(e){let t=e.replace(/\s+/g," ").trim();for(;;){let r=t.replace(/^(?:#{1,6}|[-*+>]|\d+[.)])\s+/,"");if(r===t)break;t=r}return t.length<=Br?t:`${t.slice(0,Br-1).trimEnd()}\u2026`}s(Bt,"noteText");function i_(e){for(let t of e.split(`
70
70
  `)){let r=t.replace(/^\s*#+/,"").trim();if(r!=="")return r}return""}s(i_,"firstNonEmptyLine");function Jd(e,t){return t>1?`${e} (+${t-1} more)`:e}s(Jd,"withMore");function s_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e.questions;if(!Array.isArray(t)||t.length===0)return null;let r=t[0]?.prompt;return typeof r=="string"&&r.trim()!==""?Jd(r,t.length):null}s(s_,"questionsText");function u_(e,t){return e.trim()===""&&t?t:e}s(u_,"approvalText");function c_(e){let t=e.payload;switch(e.payload.kind){case"user_question":{let{questions:r}=e.payload,n=r[0]?.prompt??"";return{kind:"question",text:Jd(n,r.length)}}case"approval":{let{subject:r,reason:n}=e.payload;switch(r.kind){case"command":return{kind:"approval",text:u_(r.command,n)};case"file_change":return{kind:"approval",text:`File changes${r.writeScope?` in ${r.writeScope}`:""}`};case"permission_grant":return{kind:"approval",text:`Permissions${r.toolName?` for ${r.toolName}`:""}`};case"tool_use":return{kind:"approval",text:r.presentation.title??r.tool};case"plan":return{kind:"plan",text:i_(r.plan)};default:return{kind:"approval",text:n??""}}}case"plugin":{if(e.origin?.kind!=="plugin")break;let{title:r,presentation:n,data:o}=e.payload;if(e.origin.pluginId===o_)return{kind:"question",text:s_(o)??r};let i=n?.detail?Bt(n.detail):"",u=`${r}: ${i}`;return{kind:"input",text:i!==""&&u.length<=Br?u:r}}}return"title"in t&&typeof t.title=="string"?{kind:"input",text:t.title}:{kind:"input",text:Bd}}s(c_,"describeRaw");function Gd(e){let t=c_(e),r=Bt(t.text);return{kind:t.kind,text:r===""?Bd:r}}s(Gd,"describeInteraction");function Ml(e){let t=e===null?"":Bt(e);return{kind:"failed",text:t===""?"Failed":t}}s(Ml,"describeFailure");function qd(e){let t=e===null?"":Bt(e);return t===""?null:{kind:"done",text:t}}s(qd,"describeDone");function Wd(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let u=new Map;for(let c of await t.list(Vl)){let a=c.slice(Vl.length),l=ni.safeParse(await t.get(c));if(!l.success||Object.keys(l.data).length===0){e.log.warn(`stored notes for ${a} are invalid; dropping them`),await t.delete(c);continue}u.set(a,l.data)}return n=u,u}s(o,"load");async function i(u,c,a){let l=Object.keys(a).length===0;l?(u.delete(c),await t.delete(Ud(c))):(u.set(c,a),await t.set(Ud(c),a));let f={threadId:c,notes:l?null:a};e.realtime.publish(Le.notes,f)}return s(i,"save"),{list:s(()=>r(async()=>Object.fromEntries(await o())),"list"),get:s(u=>r(async()=>(await o()).get(u)),"get"),update:s((u,c)=>r(async()=>{let a=await o(),l=a.get(u)??{},f={...l};for(let[p,d]of Object.entries(c))d===null?delete f[p]:f[p]=d;JSON.stringify(f)!==JSON.stringify(l)&&await i(a,u,f)}),"update"),forget:s(u=>r(async()=>{let c=await o();for(let a of u)c.has(a)&&await i(c,a,{})}),"forget"),prune:s((u,c)=>r(async()=>{let a=await o(),l=[];for(let[f,p]of[...a])u.has(f)||Math.max(...Object.values(p).map(m=>m.at))>=c||(await i(a,f,{}),l.push(f));return l}),"prune")}}s(Wd,"createNoteStore");var a_=20,l_=new Set(["error","failed","provider error","turn failed","unknown error"]);function Xd(e){if(e==null)return!0;let t=e.trim().toLowerCase().replace(/[.!]+$/,"");return t===""||l_.has(t)||/^command [\w./:-]+ failed$/.test(t)}s(Xd,"isGenericError");function f_(e){if(!e)return null;let t=e.httpStatusCode===null?"":` (${e.httpStatusCode})`;switch(e.category){case"rate-limit":return`Rate limited${t}`;case"unauthorized":return"Not signed in";case"billing":case"budget-exceeded":return"Out of credits";case"context-window-exceeded":return"Context window full";case"unknown":return t===""?null:`Error${t}`;default:{let r=e.category.replace(/-/g," ");return`${r.charAt(0).toUpperCase()}${r.slice(1)}${t}`}}}s(f_,"errorInfoLabel");function p_(e,t){for(let r of e){if(r.type==="turn/started"&&t===null)return null;if(!(r.type!=="provider/error"&&r.type!=="system/error")&&!(t!==null&&r.scope?.turnId!==void 0&&r.scope.turnId!==t))return r.data??{}}return null}s(p_,"latestProviderError");function d_(e){let t=[e.error,e.providerError?.detail,e.providerError?.message,f_(e.errorInfo??e.providerError?.errorInfo)];for(let r of t)if(!Xd(r)){let n=Bt(r);if(n!=="")return n}return null}s(d_,"failureText");async function Fl(e,t){let r=null;if(Xd(t.error))try{let n=await e.sdk.threads.events.list({threadId:t.threadId,types:["provider/error","system/error","turn/started"],order:"desc",limit:String(a_)});r=p_(n,t.turnId)}catch(n){e.log.warn(`could not read events of ${t.threadId} for its failure: ${n instanceof Error?n.message:String(n)}`)}return d_({error:t.error,providerError:r,errorInfo:t.errorInfo})}s(Fl,"resolveFailureText");import{execFile as m_}from"node:child_process";var Hd="migration:import:v1",h_=5e3,g_=4*1024*1024;function Yd(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return null}if(t===null||typeof t!="object"||Array.isArray(t))return null;let r=t,n=r.preferences;return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:r}s(Yd,"unwrapBbPreferences");function y_(e=process.env){let t=e.BB_CLI?.trim();return t||"bb"}s(y_,"bbCliPath");function Qd(e,t=process.env){return()=>new Promise(r=>{let n=y_(t);m_(n,["thread-list","prefs","list","--json"],{timeout:h_,maxBuffer:g_,encoding:"utf8"},(o,i)=>{if(o){e.warn(`could not run ${n} thread-list prefs list: ${o.message}`),r(null);return}try{r(JSON.parse(i))}catch{e.warn(`${n} thread-list prefs list printed output that is not JSON`),r(null)}})})}s(Qd,"createBbCliReader");async function em(e,t){if(await e.kv.get(Hd)!==void 0)return{status:"already-imported",source:null,keys:[]};let r="none",n={},o=t===null?null:Yd(t),i=o===null?{}:Dl(o);if(Object.keys(i).length>0)r="local-storage",n=i;else{let c=Yd(await e.readBbCli()),a=c===null?{}:Dl(c);Object.keys(a).length>0&&(r="cli",n=a)}let u=[];for(let[c,a]of Object.entries(n))await e.store.isStored(c)||JSON.stringify(a)!==JSON.stringify(it(c))&&(await e.store.write(c,a),u.push(c));return await e.kv.set(Hd,{source:r,keys:u,at:Date.now()}),e.log.info(r==="none"?"no bb thread-list preferences found; using the defaults":`imported bb thread-list preferences from ${r}: ${u.join(", ")||"none differ from the defaults"}`),{status:r==="none"?"defaults":"imported",source:r,keys:u}}s(em,"importPreferences");function tm(e){let t=e.now??Date.now,r=new Map,n="error",o=null,i=null,u=JSON.stringify({status:n,scheduled:{}});function c(d){switch(d.type){case"upsert":{let{id:m,threadId:g,sendAt:y}=d.row;y!==null&&y>t()?r.set(m,{threadId:g,sendAt:y}):r.delete(m);break}case"remove":r.delete(d.rowId);break;case"remove-thread":for(let[m,g]of r)g.threadId===d.threadId&&r.delete(m);break}}s(c,"apply");function a(){let d=t(),m={};for(let[g,y]of r){if(y.sendAt<=d){r.delete(g);continue}let $=m[y.threadId];($===void 0||y.sendAt<$)&&(m[y.threadId]=y.sendAt)}return{status:n,scheduled:m}}s(a,"current");function l(){let d=a(),m=JSON.stringify(d);m!==u&&(u=m,e.publish(d))}s(l,"publishIfChanged");function f(d){o?.push(d),c(d),l()}s(f,"change");async function p(d){o=[];try{let m=await d(),g=o;r=new Map;for(let y of m)c({type:"upsert",row:y});for(let y of g)c(y);return n="ready",!0}catch{return n="error",!1}finally{o=null,l()}}return s(p,"runSeed"),{queued:s(d=>f({type:"upsert",row:d}),"queued"),removed:s(d=>f({type:"remove",rowId:d}),"removed"),threadGone:s(d=>f({type:"remove-thread",threadId:d}),"threadGone"),seed(d){let m=p(d).finally(()=>{i===m&&(i=null)});return i=m,m},async snapshot(){return i!==null&&await i,a()}}}s(tm,"createScheduledTracker");var Kl="stamp:",nm=["startedAt","finishedAt","pendingAt","seenAt"];function rm(e){return`${Kl}${e}`}s(rm,"stampKvKey");function __(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let n of nm){let o=t[n];typeof o=="number"&&Number.isFinite(o)&&(r[n]=o)}return Object.keys(r).length>0?r:null}s(__,"parseThreadStamps");function om(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let c=new Map;for(let a of await t.list(Kl)){let l=a.slice(Kl.length),f=__(await t.get(a));if(f===null){e.log.warn(`stored stamps for ${l} are invalid; dropping them`),await t.delete(a);continue}c.set(l,f)}return n=c,c}s(o,"load");async function i(c,a,l){if(Object.keys(l).length===0){c.delete(a),await t.delete(rm(a));return}c.set(a,l),await t.set(rm(a),l)}s(i,"save");function u(c){e.realtime.publish(Le.stamps,c)}return s(u,"publish"),{list:s(()=>r(async()=>{let c={startedAt:{},finishedAt:{},pendingAt:{},seenAt:{}};for(let[a,l]of await o())for(let f of nm){let p=l[f];p!==void 0&&(c[f][a]=p)}return c}),"list"),stamp:s((c,a,l)=>r(async()=>{if(a.length===0)return;let f=await o();for(let p of new Set(a))await i(f,p,{...f.get(p),[c]:l});u({kind:c,threadIds:[...a],value:l})}),"stamp"),clear:s((c,a)=>r(async()=>{if(a.length===0)return;let l=await o();for(let f of new Set(a)){let p=l.get(f);if(p?.[c]===void 0)continue;let{[c]:d,...m}=p;await i(l,f,m)}u({kind:c,threadIds:[...a],value:null})}),"clear"),forget:s(c=>r(async()=>{let a=await o();for(let l of c)a.has(l)&&await i(a,l,{})}),"forget"),prune:s((c,a)=>r(async()=>{let l=await o(),f=[];for(let[p,d]of[...l])c.has(p)||Math.max(...Object.values(d))>=a||(await i(l,p,{}),f.push(p));return f}),"prune")}}s(om,"createStampStore");function sm(e){return e instanceof Error?e.message:String(e)}s(sm,"errorMessage");async function $_(e,t){let r=new Set;for(let n of[!1,!0])for(let o=0;;o+=500){let i=await e.threads.list({archived:n,includeHidden:!0,limit:500,offset:o,signal:t});for(let u of i)r.add(u.id);if(i.length<500)break}return r}s($_,"listAllThreadIds");async function w_(e,t,r){let n=Date.now(),o;try{o=await $_(e.sdk,r)}catch(i){e.log.warn(`could not list threads to prune deleted ones: ${sm(i)}`);return}for(let i of t){let u=await i.prune(o,n);u.length>0&&e.log.info(`pruned ${i.name} of ${u.length} deleted threads`)}}s(w_,"pruneDeletedThreads");function im(e,t,r){return t.seed(async()=>{try{return await e.sdk.threads.queue.list({signal:r})}catch(n){throw e.log.warn(`could not list queued messages: ${sm(n)}`),n}})}s(im,"seedScheduled");function b_(e,t){return new Promise(r=>{let n=setTimeout(o,e);function o(){clearTimeout(n),t.removeEventListener("abort",o),r()}s(o,"done"),t.addEventListener("abort",o,{once:!0})})}s(b_,"sleep");function v_(e){return e.aborted?Promise.resolve():new Promise(t=>e.addEventListener("abort",()=>t(),{once:!0}))}s(v_,"waitForAbort");async function um(e,t,r,n,o=6e4){let i=im(e,r,n);await w_(e,t,n);let u=await i;for(;!u&&!n.aborted&&(await b_(o,n),!n.aborted);)u=await im(e,r,n);await v_(n)}s(um,"runStartup");function x_(e){let t=Md(e),r=om(e),n=Wd(e),o=tm({publish:s(a=>e.realtime.publish(Le.scheduled,a),"publish")}),i=Qd(e.log),u=Ut();e.rpc.register(Vd,{async listPreferences(){return{preferences:await t.readAll()}},async setPreference({key:a,value:l}){return{key:a,value:await t.write(a,l)}},async resetPreference({key:a}){return{key:a,value:await t.reset(a)}},importPreferences({bbMirror:a}){return u(()=>em({kv:e.storage.kv,log:e.log,store:t,readBbCli:i},a))},async listStamps(){return{stamps:await r.list()}},async markSeen({threadIds:a}){let l=Date.now();return await r.stamp("seenAt",a,l),{at:l}},async clearSeen({threadIds:a}){return await r.clear("seenAt",a),{ok:!0}},async listNotes(){return{notes:await n.list()}},listScheduled(){return o.snapshot()}}),e.cli.register(Kd(t));let c=s((a,l=Date.now())=>({...a,at:l}),"note");e.events.on("thread.active",async({thread:a})=>{await r.stamp("startedAt",[a.id],Date.now()),await n.update(a.id,{pending:null,failed:null})}),e.events.on("thread.idle",async({thread:a,lastAssistantText:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=qd(l);await n.update(a.id,{pending:null,...f?{done:c(f)}:{}})}),e.events.on("thread.failed",async({thread:a,error:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=await Fl(e,{threadId:a.id,error:l,errorInfo:null,turnId:null});f===null&&(await n.get(a.id))?.failed||await n.update(a.id,{failed:c(Ml(f))})}),e.events.on("turn.failed",async({threadId:a,errorInfo:l,turnId:f})=>{let p=await Fl(e,{threadId:a,error:null,errorInfo:l,turnId:f});p!==null&&await n.update(a,{failed:c(Ml(p))})}),e.events.on("interaction.pending",async({thread:a,interaction:l})=>{await r.stamp("pendingAt",[a.id],Date.now()),await n.update(a.id,{pending:c(Gd(l),l.createdAt)})}),e.events.on("thread.deleted",async({thread:a})=>{o.threadGone(a.id),await r.forget([a.id]),await n.forget([a.id])}),e.events.on("thread.archived",({thread:a})=>o.threadGone(a.id)),e.events.on("message.queued",({entry:a})=>o.queued(a)),e.events.on("message.dispatched",({entry:a})=>o.removed(a.id)),e.events.on("message.cancelled",({entry:a})=>o.removed(a.id)),e.background.service("startup",{start:s(a=>um(e,[{name:"stamps",prune:r.prune},{name:"notes",prune:n.prune}],o,a),"start")})}s(x_,"threadGlance");export{x_ as default};
71
71
  //# sourceMappingURL=server.js.map