@shadowclone/cli 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/shadowclone.mjs
CHANGED
|
@@ -11,6 +11,10 @@ const packageDirectory = path.dirname(
|
|
|
11
11
|
);
|
|
12
12
|
const bundle = path.join(packageDirectory, "dist", "shadowclone.js");
|
|
13
13
|
|
|
14
|
+
function runs(command) {
|
|
15
|
+
return spawnSync(command, ["--version"], { stdio: "ignore" }).status === 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
function bundledBunPath() {
|
|
15
19
|
try {
|
|
16
20
|
const manifestPath = require.resolve("bun/package.json");
|
|
@@ -24,16 +28,14 @@ function bundledBunPath() {
|
|
|
24
28
|
|
|
25
29
|
const candidate = path.join(path.dirname(manifestPath), relative);
|
|
26
30
|
|
|
27
|
-
return existsSync(candidate) ? candidate : null;
|
|
31
|
+
return existsSync(candidate) && runs(candidate) ? candidate : null;
|
|
28
32
|
} catch {
|
|
29
33
|
return null;
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
function bunOnPath() {
|
|
34
|
-
return
|
|
35
|
-
? "bun"
|
|
36
|
-
: null;
|
|
38
|
+
return runs("bun") ? "bun" : null;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
const runtime = bundledBunPath() ?? bunOnPath();
|
package/dist/shadowclone.js
CHANGED
|
@@ -56,7 +56,7 @@ ${t.join(`
|
|
|
56
56
|
}
|
|
57
57
|
`)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},a,s=Ci,l=!ct.jitless,d=l&&fx.value,u=t.catchall,p;e._zod.parse=(g,h)=>{p??(p=n.value);let y=g.value;if(!s(y))return g.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),g;if(l&&d&&h?.async===!1&&h.jitless!==!0){if(!a)a=i(t.shape);if(g=a(g,h),!u)return g;return SS([],y,g,h,p,e,h?.abortEarly===!0)}return r(g,h)}});cf=C("$ZodUnion",(e,t)=>{be.init(e,t),pe(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),pe(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),pe(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),pe(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Fc(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,a=[];for(let s of t.options){let l=s._zod.run({value:n.value,issues:[]},o);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}if(!i)return LP(a,n,e,o);return Promise.all(a).then((s)=>LP(s,n,e,o))}});ES=C("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,cf.init(e,t);let r=e._zod.parse;pe(e,"propValues",(o)=>{let i={},a=0;for(let s of o.def.options){let l=s._zod.propValues;if(!l||Object.keys(l).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(s)}"`);if(l[o.def.discriminator]?.has(void 0))a++;for(let[c,d]of Object.entries(l)){if(!Object.prototype.hasOwnProperty.call(i,c))_t(i,c,new Set);for(let u of d)i[c].add(u)}}if(!o.def.unionFallback&&a>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let a=Ka(o._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=Za(()=>Z2(t));e._zod.parse=(o,i)=>{let a=o.value;if(!Ci(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=a?.[t.discriminator],l=n.value.get(s);if(l&&(s!==void 0||i.direction!=="backward"))return l._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((c)=>n.value.get(c)!==null),input:a,path:[t.discriminator],inst:e}),o}}),CS=C("$ZodIntersection",(e,t)=>{be.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||a instanceof Promise)return Promise.all([i,a]).then(([l,c])=>AP(r,l,c));return AP(r,i,a)}});$S=C("$ZodTuple",(e,t)=>{be.init(e,t);let r=t.items,n=ct.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let a=o.value;if(!Array.isArray(a))return o.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let s=[],l=OP(r,"optin"),c=OP(r,"optout");if(!t.rest){if(a.length<l)return o.issues.push({code:"too_small",minimum:l,inclusive:!0,input:a,inst:e,origin:"array"}),o;if(a.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let d=Array(r.length),u=t.rest?i?.abortEarly:void 0,p=!1;for(let g=0;g<r.length;g++){let h=r[g]._zod.run({value:a[g],issues:[]},i);if(h instanceof Promise)s.push(h.then((y)=>{d[g]=y}));else if(d[g]=h,u&&!p&&h.issues.length)p=Zt(h)}if(t.rest&&!p){let g=r.length-1,h=a.slice(r.length),y=o.issues.length;for(let w of h){if(u&&o.issues.length!==y){if(Zt(o,y))break;y=o.issues.length}g++;let x=t.rest._zod.run({value:w,issues:[]},i);if(x instanceof Promise)s.push(x.then((R)=>DP(R,o,g)));else DP(x,o,g)}}if(s.length)return Promise.all(s).then(()=>TP(d,o,r,a,c));return TP(d,o,r,a,c)}});_S=C("$ZodRecord",(e,t)=>{be.init(e,t);let r=ct.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!wo(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let a=[],s=t.keyType._zod.values;if(s&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let l=new Set;for(let d of s)if(typeof d==="string"||typeof d==="number"||typeof d==="symbol"){if(l.add(typeof d==="number"?d.toString():d),d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((h)=>xr(h,o,jt())),input:d,path:[d],inst:e});continue}let p=u.value;if(p==="__proto__")continue;let g=t.valueType._zod.run({value:i[d],issues:[]},o);if(g instanceof Promise)a.push(g.then((h)=>{if(h.issues.length)n.issues.push(...vr(d,h.issues));n.value[p]=h.value}));else{if(g.issues.length)n.issues.push(...vr(d,g.issues));n.value[p]=g.value}}let c;for(let d in i)if(!l.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;n.value[d]=i[d]}else c=c??[],c.push(d);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let l;for(let c of Reflect.ownKeys(i)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,c))continue;let d=t.keyType._zod.run({value:c,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&Va.test(c)&&d.issues.length){let h=t.keyType._zod.run({value:Number(c),issues:[]},o);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)d=h}if(d.issues.length){if(t.mode==="loose")n.value[c]=i[c];else if(s)l=l??[],l.push(c);else n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((h)=>xr(h,o,jt())),input:c,path:[c],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let g=t.valueType._zod.run({value:i[c],issues:[]},o);if(g instanceof Promise)a.push(g.then((h)=>{if(h.issues.length)n.issues.push(...vr(c,h.issues));n.value[p]=h.value}));else{if(g.issues.length)n.issues.push(...vr(c,g.issues));n.value[p]=g.value}}if(l&&l.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}if(a.length)return Promise.all(a).then(()=>n);return n}}),IS=C("$ZodEnum",(e,t)=>{be.init(e,t);let r=qa(t.entries),n=new Set(r);e._zod.values=n,pe(e,"pattern",(o)=>{let i=qa(o.def.entries).filter((a)=>gx.has(typeof a));return new RegExp(i.length?`^(${i.map((a)=>jn(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let a=o.value;if(n.has(a))return o;return o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),jS=C("$ZodLiteral",(e,t)=>{be.init(e,t);let r=new Set(t.values);e._zod.values=r,pe(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?jn(i):i?jn(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),LS=C("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.optin="optional",ct.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ja(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((a)=>(r.value=a,r));if(o instanceof Promise)throw new Pr;return r.value=o,r}});df=C("$ZodOptional",(e,t)=>{be.init(e,t),pe(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",pe(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),pe(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Fc(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>NP(r,i));return NP(r,o)}return t.innerType._zod.run(r,n)}}),AS=C("$ZodExactOptional",(e,t)=>{df.init(e,t),pe(e,"values",(r)=>r.def.innerType._zod.values),pe(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),OS=C("$ZodNullable",(e,t)=>{be.init(e,t),pe(e,"optin",(r)=>r.def.innerType._zod.optin),pe(e,"optout",(r)=>r.def.innerType._zod.optout),pe(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Fc(n.source)}|null)$`):void 0}),pe(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),DS=C("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="defaulted",pe(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>FP(i,t));return FP(o,t)}});TS=C("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="defaulted",pe(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),NS=C("$ZodNonOptional",(e,t)=>{be.init(e,t),pe(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>MP(i,e));return MP(o,e)}});FS=C("$ZodCatch",(e,t)=>{be.init(e,t),pe(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),pe(e,"optout",(r)=>r.def.innerType._zod.optout),pe(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>zP(r,i,t,n));return zP(r,o,t,n)}}),MS=C("$ZodPipe",(e,t)=>{be.init(e,t),pe(e,"values",(r)=>r.def.in._zod.values),pe(e,"optin",(r)=>r.def.in._zod.optin),pe(e,"optout",(r)=>r.def.out._zod.optout),pe(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((a)=>Yc(a,t.in,n));return Yc(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Yc(i,t.out,n));return Yc(o,t.out,n)}});zS=C("$ZodReadonly",(e,t)=>{be.init(e,t),pe(e,"propValues",(r)=>r.def.innerType._zod.propValues),pe(e,"values",(r)=>r.def.innerType._zod.values),pe(e,"optin",(r)=>r.def.innerType?._zod?.optin),pe(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(BP);return BP(o)}});BS=C("$ZodCustom",(e,t)=>{Ye.init(e,t),be.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>UP(i,r,n,e));UP(o,r,n,e);return}})});function HS(e){return e!==null&&typeof e==="object"}function pf(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}function id(e,t,r){let n=qS.get(e);if(n!==void 0)return n?ts:es;if(t.has(e))return ts;t.add(e);let o=es,i=(d)=>{if(o!==ts&&d?._zod){let u=id(d,t,r);if(u>o)o=u}},a=(d,u)=>{let p=es;for(let g of Reflect.ownKeys(d)){let h=Object.getOwnPropertyDescriptor(d,g);if(u&&!h.enumerable)continue;let y=h.get?od:h.value?._zod?id(h.value,t,r):es;if(y>p)p=y}return p},s=(d)=>{if(d>o)o=d},l=e._zod.def,c=l.type;switch(c){case"object":{let d=Ka(l);s(d?a(d,!0):od),i(l.catchall);break}case"array":i(l.element);break;case"tuple":for(let d of l.items)i(d);i(l.rest);break;case"record":case"map":i(l.keyType),i(l.valueType);break;case"set":i(l.valueType);break;case"union":for(let d of l.options)i(d);break;case"intersection":i(l.left),i(l.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(l.innerType);break;case"pipe":i(l.in),i(l.out);break;case"function":i(l.input),i(l.output);break;case"lazy":{let d=l._cachedInner??(r?e._zod.innerType:void 0);s(d?id(d,t,!1):od);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let d in l){let u=Object.getOwnPropertyDescriptor(l,d);if(!u||u.get)continue;let p=u.value;if(!p||typeof p!=="object")continue;if(p._zod)i(p);else if(Array.isArray(p))for(let g of p)i(g)}}return t.delete(e),K2(e,o)}function K2(e,t){if(t!==od)qS.set(e,t===ts);return t}function J2(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}function WS(){return V2}function Y2(e,t){let r=e[mf]?.backEdges;return r!==void 0&&HS(t)&&r.has(t)}var GS,mf="~memo",US,qS,es=0,od=1,ts=2,rd,nd,V2;var ZS=f(()=>{kt();GS=class GS extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}};US=[];qS=new WeakMap;nd=[],V2={alloc(e,t,r){let n=rd;if(!n)return r;rd=void 0;let o={value:r,issues:null};return n.set(t.value,o),nd.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Y2(i,o.value))throw new GS;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,s=(l,c)=>{if(r===void 0){let x=id(e,new Set,!1);if(x===es){if(e._zod.parse=a,e._zod.run===s)e._zod.run=a;return a(l,c)}if(x===ts||n)r=!0;else n=!0}let d=l.value;if(!HS(d))return a(l,c);let u=c[mf];if(!u)u={buckets:new WeakMap,backEdges:void 0},c[mf]=u;let p;if(o===c)p=i;else p=J2(u,e),o=c,i=p;let g=p.get(d);if(g){if(l.value=g.value,g.issues){if(g.issues.length)l.issues.push(...pf(g.issues))}else l.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(g.value);return l}rd=p;let h=nd.length,y=a(l,c);rd=void 0;let w=nd.length>h?nd.pop():void 0;if(y instanceof Promise)return y.then((x)=>{if(w)w.issues=x.issues.length?pf(x.issues):US;return x});if(w)w.issues=y.issues.length?pf(y.issues):US;return y};if(e._zod.parse=s,e._zod.run===a)e._zod.run=s})}}});function ff(){return{localeError:X2()}}var X2=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,a){if(i==="number"&&typeof a==="number"&&!Number.isFinite(a))return String(a);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let a=o(i.expected),s=kx(i.input),l=o(s,i.input);return`Invalid input: expected ${a}, received ${l}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Um(i.values[0])}`;return`Invalid option: expected one of ${Mm(i.values,"|")}`;case"too_big":{let a=i.exact?"exactly ":i.inclusive?"<=":"<",s=t(i.origin);if(s)return`Too big: expected ${i.origin??"value"} to have ${a}${i.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${a}${i.maximum.toString()}`}case"too_small":{let a=i.exact?"exactly ":i.inclusive?">=":">",s=t(i.origin);if(s)return`Too small: expected ${i.origin} to have ${a}${i.minimum.toString()} ${s.unit}`;return`Too small: expected ${i.origin} to be ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;if(a.format==="starts_with")return`Invalid string: must start with "${a.prefix}"`;if(a.format==="ends_with")return`Invalid string: must end with "${a.suffix}"`;if(a.format==="includes")return`Invalid string: must include "${a.includes}"`;if(a.format==="regex")return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Mm(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((s)=>`'${s}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};var KS=f(()=>{kt()});var gf=()=>{};class YS{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Q2(){return new YS}var VS,vo;var yf=f(()=>{(VS=globalThis).__zod_globalRegistry??(VS.__zod_globalRegistry=Q2());vo=globalThis.__zod_globalRegistry});var XS=()=>{};function QS(e){if(e.checks)e.checks=[...e.checks];return e}function eR(e,t){return new e(QS({type:"string",...W(t)}))}function tR(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...W(t)})}function rR(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...W(t)})}function hf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...W(t)})}function nR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...W(t)})}function oR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...W(t)})}function iR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...W(t)})}function wf(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...W(t)})}function aR(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...W(t)})}function sR(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...W(t)})}function lR(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...W(t)})}function cR(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...W(t)})}function dR(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...W(t)})}function uR(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...W(t)})}function pR(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...W(t)})}function mR(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...W(t)})}function fR(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...W(t)})}function gR(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...W(t)})}function yR(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...W(t)})}function hR(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...W(t)})}function wR(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...W(t)})}function bR(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...W(t)})}function kR(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...W(t)})}function ad(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...W(t)})}function sd(e,t){return new e({type:"string",format:"date",check:"string_format",...W(t)})}function ld(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...W(t)})}function cd(e,t){return new e({type:"string",format:"duration",check:"string_format",...W(t)})}function vR(e,t){return new e(QS({type:"number",checks:[],...W(t)}))}function xR(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...W(t)})}function PR(e,t){return new e({type:"boolean",...W(t)})}function SR(e,t){return new e({type:"null",...W(t)})}function RR(e){return new e({type:"unknown"})}function ER(e,t){return new e({type:"never",...W(t)})}function dd(e,t){return new ef({check:"less_than",...W(t),value:e,inclusive:!1})}function rs(e,t){return new ef({check:"less_than",...W(t),value:e,inclusive:!0})}function ud(e,t){return new tf({check:"greater_than",...W(t),value:e,inclusive:!1})}function ns(e,t){return new tf({check:"greater_than",...W(t),value:e,inclusive:!0})}function pd(e,t){return new yP({check:"multiple_of",...W(t),value:e})}function md(e,t){return new wP({check:"max_length",...W(t),maximum:e})}function $i(e,t){return new bP({check:"min_length",...W(t),minimum:e})}function fd(e,t){return new kP({check:"length_equals",...W(t),length:e})}function bf(e,t){return new vP({check:"string_format",format:"regex",...W(t),pattern:e})}function kf(e){return new xP({check:"string_format",format:"lowercase",...W(e)})}function vf(e){return new PP({check:"string_format",format:"uppercase",...W(e)})}function xf(e,t){return new SP({check:"string_format",format:"includes",...W(t),includes:e})}function Pf(e,t){return new RP({check:"string_format",format:"starts_with",...W(t),prefix:e})}function Sf(e,t){return new EP({check:"string_format",format:"ends_with",...W(t),suffix:e})}function Ln(e){return new CP({check:"overwrite",tx:e})}function Rf(e){return Ln((t)=>t.normalize(e))}function Ef(){return Ln((e)=>e.trim())}function Cf(){return Ln((e)=>e.toLowerCase())}function $f(){return Ln((e)=>e.toUpperCase())}function _f(){return Ln((e)=>mx(e))}function CR(e,t,r){return new e({type:"array",element:t,...W(r)})}function $R(e,t,r){return new e({type:"custom",check:"custom",fn:t,...W(r)})}function _R(e,t){let r=e4((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(bo(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(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(bo(i))}},e(n.value,n)),t);return r}function e4(e,t){let r=new Ye({check:"custom",...W(t)});return r._zod.check=e,r}var IR=f(()=>{Vc();kt()});function os(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))_t(e,n,r[n]);return e}function as(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??vo,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ze(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 Error(o);return Object.assign(r,i),!0}function ke(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let p=a.schema,g=t.processors[o.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,p,d)}let u=e._zod.parent;if(u){if(!a.ref)a.ref=u;ke(u,t,d),t.seen.get(u).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)os(a.schema,l);if(t.io==="input"&&dt(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(n=a.schema).default??(n.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function jR(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ss(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let l=n.get(s);if(l&&l!==a[0])throw Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=(a)=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let u=e.external.registry.get(a[0])?.id,p=e.external.uri??((h)=>h);if(u)return{ref:p(u)};let g=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=g,{defId:g,ref:`${p("__shared")}#/${s}/${jR(g)}`}}let l="#",c=`${l}/${s}/`;if(a[1]===r&&!a[1].schema.id)return{ref:l};let d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:c+jR(d)}},i=(a)=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:c}=o(a);if(s.def={...s.schema},c)s.defId=c;let d=s.schema;for(let u in d)delete d[u];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
58
58
|
|
|
59
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(t!==a[0]&&c){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1){if(e.reused==="ref")i(a)}}if(e.external)e.sharedDefsExtractedFor=e.external}function OR(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;OR(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let a of Array.isArray(i)?i:[i]){if(typeof a!=="string")return;if(!r.includes(a))r.push(a)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function AR(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function If(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let a in i)if(!DR.has(a))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let a in i.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let s=[];for(let c of t){let d=c.properties?.[a]??AR(c);if(d===null||d===void 0)continue;if(!s.some((u)=>JSON.stringify(u)===JSON.stringify(d)))s.push(d)}let l=s.length===1?s[0]:If(s)??{allOf:s};_t(r,a,l)}for(let a of i.required??[])n.add(a)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let a of t){let s=AR(a);if(s&&!i.some((l)=>JSON.stringify(l)===JSON.stringify(s)))i.push(s)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function t4(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of DR)if(o in e)return;let r=t.filter((o)=>LR.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=If(t);else{let o=r[0],i=LR.find((l)=>Array.isArray(o[l]));if(Object.keys(o).length!==1)return;let a=t.filter((l)=>l!==o),s=o[i].map((l)=>If([...a,l]));if(s.some((l)=>!l))return;n={[i]:s}}if(!n)return;delete e.allOf,os(e,n)}function ls(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(s)=>{let l=e.seen.get(s);if(l.ref===null)return;let c=l.def??l.schema,d={...c},u=l.ref;if(l.ref=null,u){n(u);let g=e.seen.get(u),h=g.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(h);else os(c,h);if(os(c,d),s._zod.parent===u)for(let w in c){if(w==="$ref"||w==="allOf")continue;if(!(w in d))delete c[w]}if(h.$ref&&g.def)for(let w in c){if(w==="$ref"||w==="allOf")continue;if(w in g.def&&JSON.stringify(c[w])===JSON.stringify(g.def[w]))delete c[w]}}let p=s._zod.parent;if(p&&p!==u){n(p);let g=e.seen.get(p);if(g?.schema.$ref){if(c.$ref=g.schema.$ref,g.def)for(let h in c){if(h==="$ref"||h==="allOf")continue;if(h in g.def&&JSON.stringify(c[h])===JSON.stringify(g.def[h]))delete c[h]}}}e.override({zodSchema:s,jsonSchema:c,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())n(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())OR(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let c of[l.schema,l.def]){let d=c?.allOf;if(!Array.isArray(d))continue;let u=s.get(d);if(u)u.push(c);else s.set(d,[c])}for(let l of e.intersections)for(let c of s.get(l)??[])t4(c)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}os(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;_t(a,l.defId,l.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")o.$defs=a;else o.definitions=a;try{let s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:is(t,"input",e.processors),output:is(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function dt(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 dt(n.element,r);if(n.type==="set")return dt(n.valueType,r);if(n.type==="lazy")return dt(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 dt(n.innerType,r);if(n.type==="intersection")return dt(n.left,r)||dt(n.right,r);if(n.type==="record"||n.type==="map")return dt(n.keyType,r)||dt(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return dt(n.in,r)||dt(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(dt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(dt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(dt(o,r))return!0;if(n.rest&&dt(n.rest,r))return!0;return!1}return!1}var DR,LR,TR=(e,t={})=>(r)=>{let n=as({...r,processors:t});return ke(e,n),ss(n,e),ls(n,e)},is=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},a=as({...o??{},target:i,io:t,processors:r});return ke(e,a),ss(a,e),ls(a,e)};var gd=f(()=>{yf();kt();DR=new Set(["type","properties","required","additionalProperties"]),LR=["oneOf","anyOf"]});function vt(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)r4[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)_i(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)_i(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Ii(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Ii(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)UR(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)HR(t,o.mime);for(let i of o.patterns??[])GR(t,i);return t}function cs(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return cs(t.out);if(t.type==="catch")return cs(t.innerType);return e._zod.optin}function jf(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let y=jf(e,h,r);return y===h?t:y}for(let h of["anyOf","oneOf"]){let y=t[h];if(!Array.isArray(y))continue;let w=y.map((x)=>jf(e,x,r));if(w.some((x,R)=>x!==y[R]))t={...t,[h]:w}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((h)=>typeof h==="number"))return t;let{minimum:a,maximum:s,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:d,format:u,id:p,...g}=t;if(g.enum)g.enum=g.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof g.const==="number")g.const=String(g.const);if(!o)return g;if(g.type="string",!i)g.pattern=(n.includes("number")?Va:Xm).source;return g}function i4(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Lf.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=jf(t,i,new Set);if(a!==i)r.set(i,a)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}function aE(e,t,r,n,o){let i=!1,a=JSON.stringify(e,(s,l)=>{if(typeof l!=="bigint")return l;return i=!0,null});if(!i)return JSON.parse(a);return Ze(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Yf}function ji(e,t){if("_idmap"in e){let n=e,o=as({...t,processors:BR}),i={};for(let l of n._idmap.entries()){let[c,d]=l;ke(d,o)}let a={},s={registry:n,uri:t?.uri,defs:i};o.external=s;for(let l of n._idmap.entries()){let[c,d]=l;ss(o,d),_t(a,c,ls(o,d))}if(Object.keys(i).length>0){let l=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:i}}return{schemas:a}}let r=as({...t,processors:BR});return ke(e,r),ss(r,e),ls(r,e)}var _i=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ii=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},NR=(e,t)=>{_i(e,"minimum",t),Ii(e,"maximum",t)},UR=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},GR=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},HR=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},qR=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},FR=(e,t)=>_i(e,"minimum",t.minimum),MR=(e,t)=>Ii(e,"maximum",t.maximum),zR=(e)=>(t,r)=>{qR(t,r.format);let[n,o]=e[r.format];_i(t,"minimum",n),Ii(t,"maximum",o)},r4,n4,o4,WR=(e)=>o4.get(e)??e,Af=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:c,laxFormat:d}=vt(e);if(typeof i==="number")o.minLength=i;if(typeof a==="number")o.maxLength=a;if(s){if(o.format=n4[s]??s,o.format==="")delete o.format;if(s==="time"||d)delete o.format}if(c)o.contentEncoding=c;if(l&&l.size>0){let u=[...l].map(WR);if(u.length===1)o.pattern=u[0].source;else if(u.length>1)o.allOf=[...u.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},Of=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:d}=vt(e);o.type=d?"integer":"number";let u=typeof c==="number"&&c>=(i??Number.NEGATIVE_INFINITY),p=typeof l==="number"&&l<=(a??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(u)if(g)o.minimum=c,o.exclusiveMinimum=!0;else o.exclusiveMinimum=c;else if(typeof i==="number")o.minimum=i;if(p)if(g)o.maximum=l,o.exclusiveMaximum=!0;else o.exclusiveMaximum=l;else if(typeof a==="number")o.maximum=a;if(s){let h=new Set;for(let x of s)if(Number.isFinite(x)&&x!==0)h.add(Math.abs(x));else Ze(e,t,o,n,`A multipleOf divisor of ${x} cannot be represented in JSON Schema`);let[y,...w]=h;if(y!==void 0)o.multipleOf=y;if(w.length)o.allOf=[...o.allOf??[],...w.map((x)=>({multipleOf:x}))]}},Df=(e,t,r,n)=>{r.type="boolean"},ZR=(e,t,r,n)=>{Ze(e,t,r,n,"BigInt cannot be represented in JSON Schema")},KR=(e,t,r,n)=>{Ze(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Tf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},JR=(e,t,r,n)=>{Ze(e,t,r,n,"Undefined cannot be represented in JSON Schema")},VR=(e,t,r,n)=>{Ze(e,t,r,n,"Void cannot be represented in JSON Schema")},Nf=(e,t,r,n)=>{r.not={}},YR=(e,t,r,n)=>{},Ff=(e,t,r,n)=>{},XR=(e,t,r,n)=>{Ze(e,t,r,n,"Date cannot be represented in JSON Schema")},Mf=(e,t,r,n)=>{let o=e._zod.def,i=qa(o.entries);if(i.length===0){r.not={};return}if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";r.enum=i},zf=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let a of o.values)if(a===void 0){if(Ze(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a==="bigint"){if(Ze(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(a))}else i.push(a);if(i.length===0);else if(i.length===1){let a=i[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";if(i.every((a)=>typeof a==="boolean"))r.type="boolean";if(i.every((a)=>a===null))r.type="null";r.enum=i}},QR=(e,t,r,n)=>{Ze(e,t,r,n,"NaN cannot be represented in JSON Schema")},eE=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},tE=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:a,mime:s}=vt(e);if(i!==void 0)o.minLength=i;if(a!==void 0)o.maxLength=a;if(!s)return;if(s.length===0)o.not={};else if(s.length===1)o.contentMediaType=s[0];else o.anyOf=s.map((l)=>({contentMediaType:l}))},rE=(e,t,r,n)=>{r.type="boolean"},Bf=(e,t,r,n)=>{Ze(e,t,r,n,"Custom types cannot be represented in JSON Schema")},nE=(e,t,r,n)=>{Ze(e,t,r,n,"Function types cannot be represented in JSON Schema")},Uf=(e,t,r,n)=>{Ze(e,t,r,n,"Transforms cannot be represented in JSON Schema")},oE=(e,t,r,n)=>{Ze(e,t,r,n,"Map cannot be represented in JSON Schema")},iE=(e,t,r,n)=>{Ze(e,t,r,n,"Set cannot be represented in JSON Schema")},Gf=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=vt(e);if(typeof a==="number")o.minItems=a;if(typeof s==="number")o.maxItems=s;o.type="array",o.items=ke(i.element,t,{...n,path:[...n.path,"items"]})},Hf=(e,t,r,n)=>{let o=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&Ze(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let c in a)_t(o.properties,c,ke(a[c],t,{...n,path:[...n.path,"properties",c]}));let l=[];for(let c of Object.keys(a)){let d=i.shape[c];if(t.io==="input"?cs(d)===void 0:d._zod.optout===void 0)l.push(c)}if(l.length>0)o.required=l;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=ke(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},qf=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,l)=>ke(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",l]}));if(i)r.oneOf=a;else r.anyOf=a},Wf=(e,t,r,n)=>{let o=e._zod.def,i=ke(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=ke(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=(c)=>("allOf"in c)&&Object.keys(c).length===1,l=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=l,t.intersections.push(l)},Zf=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((y,w)=>ke(y,t,{...n,path:[...n.path,a,w]})),c=i.rest?ke(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,d=i.items.length;while(d>0){let y=i.items[d-1];if(!(t.io==="input"?cs(y)!==void 0:y._zod.optout==="optional"))break;d--}let u=i.items.length,p=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=l,p)o.items=!1;else if(c)o.items=c;if(d>0)o.minItems=d;if(p)o.maxItems=u}else if(t.target==="openapi-3.0"){if(o.items={anyOf:l},c)o.items.anyOf.push(c);if(d>0)o.minItems=d;if(p)o.maxItems=u}else{if(o.items=l,p)o.additionalItems=!1;else if(c)o.additionalItems=c;if(d>0)o.minItems=d;if(p)o.maxItems=u}let{minimum:g,maximum:h}=vt(e);if(typeof g==="number")o.minItems=g;if(typeof h==="number")o.maxItems=h},Lf,Kf=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,s=vt(a).patterns;if(i.mode==="loose"&&s&&s.size>0){let d=ke(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let u of s)_t(o.patternProperties,WR(u).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ke(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let d=Lf.get(t);if(!d)d=[],Lf.set(t,d),t.deferred.push(()=>i4(t));d.push(e)}o.additionalProperties=ke(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=a._zod.values,c=t.io==="input"&&cs(i.valueType)!==void 0;if(l&&!i.partial&&!c){let d=[...l].filter((u)=>typeof u==="string"||typeof u==="number");if(d.length>0)o.required=d.map(String)}},Jf=(e,t,r,n)=>{let o=e._zod.def,i=ke(o.innerType,t,n),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Vf=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Yf,Xf=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a=aE(o.defaultValue,e,t,r,n);if(a!==Yf)r.default=a},Qf=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let a=aE(o.defaultValue,e,t,r,n);if(a!==Yf)r._prefault=a},eg=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{Ze(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},tg=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?o.out:o.in:o.out;ke(a,t,n);let s=t.seen.get(e);s.ref=a},rg=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},sE=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},yd=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},lE=(e,t,r,n)=>{let o=e._zod.innerType;ke(o,t,n);let i=t.seen.get(e);i.ref=o},BR;var ng=f(()=>{Xa();uf();gd();kt();r4={greater_than:(e,t)=>_i(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ii(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>UR(e,t.value),number_format:zR(Mc),bigint_format:zR(Gm),min_length:FR,max_length:MR,length_equals:(e,t)=>NR(e,t.length),min_size:FR,max_size:MR,size_equals:(e,t)=>NR(e,t.size),string_format:(e,t)=>{if(qR(e,t.format),t.pattern)GR(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>HR(e,t.mime)};n4={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o4=new Map([[sf,nP],[td,oP]]);Lf=new WeakMap;Yf=Symbol();BR={string:Af,number:Of,boolean:Df,bigint:ZR,symbol:KR,null:Tf,undefined:JR,void:VR,never:Nf,any:YR,unknown:Ff,date:XR,enum:Mf,literal:zf,nan:QR,template_literal:eE,file:tE,success:rE,custom:Bf,function:nE,transform:Uf,map:oE,set:iE,array:Gf,object:Hf,union:qf,intersection:Wf,tuple:Zf,record:Kf,nullable:Jf,nonoptional:Vf,default:Xf,prefault:Qf,catch:eg,pipe:tg,readonly:rg,promise:sE,optional:yd,lazy:lE}});var cE=()=>{};var Sr=f(()=>{kt();Xa();gf();cE();ko();Bx();jx();uf();ZS();Vc();nf();yf();XS();IR();gd()});var og=f(()=>{Sr()});function hd(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})}})}var dE,uE=(e,t)=>{$x.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(dE.has(r))return;dE.add(r),hd(r,"format",(n)=>(o)=>Ix(n,o)),hd(r,"flatten",(n)=>(o)=>_x(n,o)),hd(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Wa,2)}),hd(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Wa,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},ig,Lt;var ag=f(()=>{Sr();Sr();kt();dE=new WeakSet([Object.prototype,Error.prototype]);ig=C("ZodError",uE),Lt=C("ZodError",uE,void 0,{Parent:Error})});var pE,mE,fE,gE,yE,hE,wE,bE,kE,vE,xE,PE;var sg=f(()=>{Sr();ag();Sr();pE=qc(Lt),mE=Wc(Lt),fE=Zc(Lt),gE=Kc(Lt),yE=Ax(Lt),hE=Ox(Lt),wE=Dx(Lt),bE=Tx(Lt),kE=Nx(Lt),vE=Fx(Lt),xE=Mx(Lt),PE=zx(Lt)});function f4(){if(!ct.localeError)jt(ff())}function ps(){if(!ct.memoizer)jt({memoizer:WS()})}function m(e){return eR(g4,e)}function nt(e){return hf(us,e)}function Rr(e){return wf(IE,e)}function F(e){return vR(jE,e)}function SE(e){return xR(A4,e)}function K(e){return PR(O4,e)}function Li(e){return SR(D4,e)}function Me(){return RR(T4)}function LE(e){return ER(N4,e)}function k(e,t){return CR(F4,e,t)}function P(e,t){let r={type:"object",shape:e??{},...W(t)};return new AE(r)}function _(e,t){return new AE({type:"object",shape:e,catchall:LE(),...W(t)})}function DE(e,t){return new OE({type:"union",options:e,...W(t)})}function Jr(e,t,r){return new M4({type:"union",options:t,discriminator:e,...W(r)})}function TE(e,t){return new z4({type:"intersection",left:e,right:t})}function cg(e,t,r){let n=t instanceof be,o=n?r:t;return new B4({type:"tuple",items:e,rest:n?t:null,...W(o)})}function re(e,t,r){if(!t||!t._zod)return new RE({type:"record",keyType:m(),valueType:e,...W(t)});return new RE({type:"record",keyType:e,valueType:t,...W(r)})}function D(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new lg({type:"enum",entries:r,...W(t)})}function J(e,t){return new U4({type:"literal",values:Array.isArray(e)?e:[e],...W(t)})}function H4(e){return new G4({type:"transform",transform:e})}function EE(e){return new dg({type:"optional",innerType:e})}function q4(e){return new NE({type:"optional",innerType:e})}function CE(e){return new W4({type:"nullable",innerType:e})}function K4(e,t){return new Z4({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Bm(t)}})}function V4(e,t){return new J4({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Bm(t)}})}function Y4(e,t){return new FE({type:"nonoptional",innerType:e,...W(t)})}function Q4(e,t){return new X4({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Px(t)})}function $E(e,t){return new eU({type:"pipe",in:e,out:t})}function rU(e){return new tU({type:"readonly",innerType:e})}function oU(e,t={}){return $R(nU,e,t)}function iU(e,t){return _R(e,t)}var xe,_E,g4,$e,ms,fs,gs,ys,y4,h4,us,IE,w4,b4,k4,v4,x4,P4,S4,R4,E4,C4,$4,_4,I4,j4,L4,jE,A4,O4,D4,T4,N4,F4,AE,OE,M4,z4,B4,RE,lg,U4,G4,dg,NE,W4,Z4,J4,FE,X4,eU,tU,nU;var wd=f(()=>{Sr();Sr();ng();gd();KS();og();sg();xe=C("ZodType",(e,t)=>(f4(),be.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(It(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 kr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(oU(e,t))},superRefine(e,t){return this.check(iU(e,t))},overwrite(e){return this.check(Ln(e))},optional(){return EE(this)},exactOptional(){return q4(this)},nullable(){return CE(this)},nullish(){return EE(CE(this))},nonoptional(e){return Y4(this,e)},array(){return k(this)},or(e){return DE([this,e])},and(e){return TE(this,e)},transform(e){return $E(this,H4(e))},default(e){return K4(this,e)},prefault(e){return V4(this,e)},catch(e){return Q4(this,e)},pipe(e){return $E(this,e)},readonly(){return rU(this)},describe(e){let t=this.clone();return vo.add(t,{description:e}),t},meta(...e){if(e.length===0)return vo.get(this);let t=this.clone();return vo.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 Gc(this,"~standard",{...af(this),jsonSchema:{input:is(this,"input"),output:is(this,"output")}})},set "~standard"(e){Kr(this,"~standard",e)},parse:function e(t,r){return pE(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await mE(this,t,r,{callee:e})},safeParse(e,t){return fE(this,e,t)},async safeParseAsync(e,t){return gE(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Kr(this,"spa",e)},validate(e,t){return Km(this,e,t)},validateAsync(e,t){return Jm(this,e,t)},encode:function e(t,r){return yE(this,t,r,{callee:e})},decode:function e(t,r){return hE(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await wE(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await bE(this,t,r,{callee:e})},safeEncode(e,t){return kE(this,e,t)},safeDecode(e,t){return vE(this,e,t)},async safeEncodeAsync(e,t){return xE(this,e,t)},async safeDecodeAsync(e,t){return PE(this,e,t)},toJSONSchema(e){return TR(this,{})(e)},get description(){return vo.get(this)?.description},get _def(){return this._zod.def}}),_E=C("_ZodString",(e,t)=>{ed.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Af(e,r,n,o)},xx({format:(e)=>vt(e).format??null,minLength:(e)=>vt(e).minimum??null,maxLength:(e)=>vt(e).maximum??null},{regex(...e){return this.check(bf(...e))},includes(...e){return this.check(xf(...e))},startsWith(...e){return this.check(Pf(...e))},endsWith(...e){return this.check(Sf(...e))},min(...e){return this.check($i(...e))},max(...e){return this.check(md(...e))},length(...e){return this.check(fd(...e))},nonempty(...e){return this.check($i(1,...e))},lowercase(e){return this.check(kf(e))},uppercase(e){return this.check(vf(e))},trim(){return this.check(Ef())},normalize(...e){return this.check(Rf(...e))},toLowerCase(){return this.check(Cf())},toUpperCase(){return this.check($f())},slugify(){return this.check(_f())}})),g4=C("ZodString",(e,t)=>{ed.init(e,t),_E.init(e,t)},{email(e){return this.check(tR(y4,e))},url(e){return this.check(wf(IE,e))},jwt(e){return this.check(kR(L4,e))},emoji(e){return this.check(aR(w4,e))},guid(e){return this.check(rR(h4,e))},uuid(e){return this.check(hf(us,e))},uuidv4(e){return this.check(nR(us,e))},uuidv6(e){return this.check(oR(us,e))},uuidv7(e){return this.check(iR(us,e))},nanoid(e){return this.check(sR(b4,e))},cuid(e){return this.check(lR(k4,e))},cuid2(e){return this.check(cR(v4,e))},ulid(e){return this.check(dR(x4,e))},base64(e){return this.check(hR(_4,e))},base64url(e){return this.check(wR(I4,e))},xid(e){return this.check(uR(P4,e))},ksuid(e){return this.check(pR(S4,e))},ipv4(e){return this.check(mR(R4,e))},ipv6(e){return this.check(fR(E4,e))},cidrv4(e){return this.check(gR(C4,e))},cidrv6(e){return this.check(yR($4,e))},e164(e){return this.check(bR(j4,e))},datetime(e){return this.check(ad(ms,e))},date(e){return this.check(sd(fs,e))},time(e){return this.check(ld(gs,e))},duration(e){return this.check(cd(ys,e))}});$e=C("ZodStringFormat",(e,t)=>{ve.init(e,t),_E.init(e,t)}),ms=C("ZodISODateTime",(e,t)=>{nS.init(e,t),$e.init(e,t)}),fs=C("ZodISODate",(e,t)=>{oS.init(e,t),$e.init(e,t)}),gs=C("ZodISOTime",(e,t)=>{iS.init(e,t),$e.init(e,t)}),ys=C("ZodISODuration",(e,t)=>{aS.init(e,t),$e.init(e,t)}),y4=C("ZodEmail",(e,t)=>{WP.init(e,t),$e.init(e,t)}),h4=C("ZodGUID",(e,t)=>{HP.init(e,t),$e.init(e,t)}),us=C("ZodUUID",(e,t)=>{qP.init(e,t),$e.init(e,t)});IE=C("ZodURL",(e,t)=>{JP.init(e,t),$e.init(e,t)});w4=C("ZodEmoji",(e,t)=>{VP.init(e,t),$e.init(e,t)}),b4=C("ZodNanoID",(e,t)=>{YP.init(e,t),$e.init(e,t)}),k4=C("ZodCUID",(e,t)=>{XP.init(e,t),$e.init(e,t)}),v4=C("ZodCUID2",(e,t)=>{QP.init(e,t),$e.init(e,t)}),x4=C("ZodULID",(e,t)=>{eS.init(e,t),$e.init(e,t)}),P4=C("ZodXID",(e,t)=>{tS.init(e,t),$e.init(e,t)}),S4=C("ZodKSUID",(e,t)=>{rS.init(e,t),$e.init(e,t)}),R4=C("ZodIPv4",(e,t)=>{sS.init(e,t),$e.init(e,t)}),E4=C("ZodIPv6",(e,t)=>{cS.init(e,t),$e.init(e,t)}),C4=C("ZodCIDRv4",(e,t)=>{dS.init(e,t),$e.init(e,t)}),$4=C("ZodCIDRv6",(e,t)=>{uS.init(e,t),$e.init(e,t)}),_4=C("ZodBase64",(e,t)=>{mS.init(e,t),$e.init(e,t)}),I4=C("ZodBase64URL",(e,t)=>{fS.init(e,t),$e.init(e,t)}),j4=C("ZodE164",(e,t)=>{gS.init(e,t),$e.init(e,t)}),L4=C("ZodJWT",(e,t)=>{yS.init(e,t),$e.init(e,t)}),jE=C("ZodNumber",(e,t)=>{lf.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Of(e,r,n,o),e.isFinite=!0},xx({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=vt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=vt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=vt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>vt(e).format??null},{gt(e,t){return this.check(ud(e,t))},gte(e,t){return this.check(ns(e,t))},min(e,t){return this.check(ns(e,t))},lt(e,t){return this.check(dd(e,t))},lte(e,t){return this.check(rs(e,t))},max(e,t){return this.check(rs(e,t))},int(e){return this.check(SE(e))},safe(e){return this.check(SE(e))},positive(e){return this.check(ud(0,e))},nonnegative(e){return this.check(ns(0,e))},negative(e){return this.check(dd(0,e))},nonpositive(e){return this.check(rs(0,e))},multipleOf(e,t){return this.check(pd(e,t))},step(e,t){return this.check(pd(e,t))},finite(){return this}}));A4=C("ZodNumberFormat",(e,t)=>{hS.init(e,t),jE.init(e,t)});O4=C("ZodBoolean",(e,t)=>{wS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Df(e,r,n,o)});D4=C("ZodNull",(e,t)=>{bS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tf(e,r,n,o)});T4=C("ZodUnknown",(e,t)=>{kS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o)});N4=C("ZodNever",(e,t)=>{vS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o)});F4=C("ZodArray",(e,t)=>{ps(),xS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o),e.element=t.element},{min(e,t){return this.check($i(e,t))},nonempty(e){return this.check($i(1,e))},max(e,t){return this.check(md(e,t))},length(e,t){return this.check(fd(e,t))},unwrap(){return this.element}});AE=C("ZodObject",(e,t)=>{ps(),RS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),P2(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return D(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(It(this._zod.def,{catchall:e}))},passthrough(){return this.clone(It(this._zod.def,{catchall:Me()}))},loose(){return this.clone(It(this._zod.def,{catchall:Me()}))},strict(){return this.clone(It(this._zod.def,{catchall:LE()}))},strip(){return this.clone(It(this._zod.def,{catchall:void 0}))},extend(e){return g2(this,e)},safeExtend(e){return y2(this,e)},merge(e){return h2(this,e)},pick(e){return m2(this,e)},omit(e){return f2(this,e)},partial(...e){return wx(dg,this,e[0])},exactPartial(...e){return wx(NE,this,e[0],"exactPartial")},required(...e){return w2(FE,this,e[0])}});OE=C("ZodUnion",(e,t)=>{cf.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e.options=t.options});M4=C("ZodDiscriminatedUnion",(e,t)=>{OE.init(e,t),ES.init(e,t)});z4=C("ZodIntersection",(e,t)=>{CS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o)});B4=C("ZodTuple",(e,t)=>{ps(),$S.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zf(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 Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new dg({type:"optional",innerType:t}))})}});RE=C("ZodRecord",(e,t)=>{ps(),_S.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});lg=C("ZodEnum",(e,t)=>{IS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Mf(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 a of n)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new lg({...t,checks:[],...W(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw Error(`Key ${a} not found in enum`);return new lg({...t,checks:[],...W(o),entries:i})}});U4=C("ZodLiteral",(e,t)=>{jS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zf(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});G4=C("ZodTransform",(e,t)=>{ps(),LS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ja(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(bo(i,r.value,t));else{let a=i;if(a.fatal)a.continue=!1;if(a.code??(a.code="custom"),!("input"in a))a.input=r.value;a.inst??(a.inst=e),r.issues.push(bo(a))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});dg=C("ZodOptional",(e,t)=>{df.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});NE=C("ZodExactOptional",(e,t)=>{AS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});W4=C("ZodNullable",(e,t)=>{OS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Z4=C("ZodDefault",(e,t)=>{DS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});J4=C("ZodPrefault",(e,t)=>{TS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});FE=C("ZodNonOptional",(e,t)=>{NS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});X4=C("ZodCatch",(e,t)=>{FS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});eU=C("ZodPipe",(e,t)=>{MS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tg(e,r,n,o),e.in=t.in,e.out=t.out});tU=C("ZodReadonly",(e,t)=>{zS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});nU=C("ZodCustom",(e,t)=>{BS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bf(e,r,n,o)})});var ME;var zE=f(()=>{(function(e){})(ME||(ME={}))});var bd={};Dm(bd,{ZodISODate:()=>fs,ZodISODateTime:()=>ms,ZodISODuration:()=>ys,ZodISOTime:()=>gs,date:()=>sU,datetime:()=>aU,duration:()=>cU,time:()=>lU});function aU(e){return ad(ms,e)}function sU(e){return sd(fs,e)}function lU(e){return ld(gs,e)}function cU(e){return cd(ys,e)}var BE=f(()=>{Sr();wd();wd()});var UE=()=>{};var ug=f(()=>{Sr();ng();gf();BE();UE();wd();og();ag();sg();zE()});var A=f(()=>{ug();ug()});var An;var hs=f(()=>{An={name:"@shadowclone/cli",version:"0.0.27"}});import{stat as pU}from"fs/promises";import On from"path";async function GE(e){return pU(e).then((t)=>t.isDirectory()).catch(()=>!1)}async function qE(e){let t=Bun.file(On.join(e,"package.json"));return await t.exists()?await t.json().catch(()=>null):null}async function WE(e){return await GE(On.join(e,"skills"))&&await GE(On.join(e,"preferences"))}async function yU(e){let t=mU.safeParse(await qE(e));return t.success&&t.data.name===An.name&&await WE(e)}async function hU(e){let t=fU.safeParse(await qE(e));return t.success&&t.data.workspaces.includes(gU)&&await WE(e)}async function wU(e){let t=e;while(!t.split(On.sep).includes("node_modules")){if(await hU(t))return t;let r=On.dirname(t);if(r===t)return null;t=r}return null}function HE(e){return{preferences:On.join(e,"preferences"),skills:On.join(e,"skills")}}async function bU(e){let t=On.resolve(e,"..");if(await yU(t))return HE(t);let r=await wU(t);if(r!==null)return HE(r);throw Error("The packaged seed guidance directories are missing")}async function pg(){return bU(import.meta.dir)}async function Er(){return(await pg()).skills}var mU,fU,gU="packages/*";var ZE=f(()=>{A();hs();mU=P({name:m()}),fU=P({workspaces:k(m())})});var Dn=8388608,Ai=1048576,Tn=8388608,ut=1048576,KE=16777216,JE=1048576,VE=65536;async function YE(e){let t=e.stream.getReader(),r=[],n=0;try{while(!0){let o=await t.read();if(o.done)return Buffer.concat(r).toString("utf8");if(n+=o.value.byteLength,n>e.maximumBytes)throw e.overflow(),new xo("output");r.push(o.value)}}finally{await t.cancel().catch(()=>{return}),t.releaseLock()}}async function Pe(e){let t=AbortSignal.timeout(e.timeoutMilliseconds??600000),r=e.signal?AbortSignal.any([t,e.signal]):t;if(r.aborted)throw new xo("cancelled");let n=Bun.spawn({cmd:[...e.arguments],cwd:e.cwd,env:{...e.environment},stdin:"pipe",stdout:"pipe",stderr:"pipe",detached:process.platform!=="win32"}),o=()=>{try{if(process.platform!=="win32")process.kill(-n.pid,"SIGKILL");else n.kill("SIGKILL")}catch{n.kill("SIGKILL")}};if(r.addEventListener("abort",o,{once:!0}),r.aborted)o();try{let i=await Promise.allSettled([YE({stream:n.stdout,maximumBytes:e.maximumOutputBytes??KE,overflow:o}),YE({stream:n.stderr,maximumBytes:JE,overflow:o}),n.exited,(async()=>{try{n.stdin.write(e.input??""),await n.stdin.flush()}finally{n.stdin.end()}})()]);if(r.aborted)throw new xo("cancelled");let[a,s,l]=i;for(let c of i)if(c.status==="rejected")throw c.reason;if(a?.status!=="fulfilled"||s?.status!=="fulfilled"||l?.status!=="fulfilled")throw Error("Process did not complete");return{exitCode:l.value,stdout:a.value,stderr:s.value.slice(-VE)}}finally{o(),r.removeEventListener("abort",o)}}var xo;var kd=f(()=>{xo=class xo extends Error{constructor(e){super(e==="output"?"Process output limit exceeded":"Process cancelled or timed out");this.name="ProcessLimitError"}}});async function XE(e){let t=[];for(let r of["user.name","user.email"]){let n=await Pe({arguments:["git","config","--get",r],cwd:e.cwd,environment:{...e.environment,GIT_CONFIG_GLOBAL:void 0},timeoutMilliseconds:1e4,maximumOutputBytes:4096}),o=n.stdout.trim();if(n.exitCode===0&&o.length>0)t.push("-c",`${r}=${o}`)}return t}var QE=f(()=>{kd()});function vd(e={}){return{PATH:process.env.PATH,HOME:process.env.HOME,LANG:process.env.LANG,TMPDIR:process.env.TMPDIR,GIT_CONFIG_NOSYSTEM:"1",GIT_CONFIG_GLOBAL:"/dev/null",GIT_TERMINAL_PROMPT:"0",...e.remote?{GH_TOKEN:process.env.GH_TOKEN,GITHUB_TOKEN:process.env.GITHUB_TOKEN,SSH_AUTH_SOCK:process.env.SSH_AUTH_SOCK}:{}}}async function ze(e){let[t,...r]=e.arguments;if(!t)throw Error("Command requires an executable");let n=t==="gh"||r.includes("push"),o=vd({remote:n}),i=[...kU];if(t==="git"&&!r.includes("config")){if((await Pe({arguments:["git",...i,"config","--local","--includes","--name-only","--get-regexp","^(filter\\..*\\.(clean|smudge|process|required)|diff\\..*\\.(command|textconv)|core\\.sshcommand|remote\\..*\\.(vcs|receivepack)|core\\.gitproxy|credential(\\..*)?\\.helper)$"],cwd:e.cwd,environment:o,timeoutMilliseconds:1e4,signal:e.signal})).stdout.trim().length>0)throw Error("Automatic Git commands refuse executable repository configuration")}if(t==="git"&&r.includes("commit"))i.push(...await XE({cwd:e.cwd,environment:o}));if(t==="git"&&r.includes("push"))i.push("-c","credential.helper=","-c","credential.https://github.com.helper=!gh auth git-credential");return Pe({arguments:t==="git"?["git",...i,...r]:[t,...r],cwd:e.cwd,environment:o,timeoutMilliseconds:(e.timeoutSeconds??60)*1000,signal:e.signal})}var kU;var mg=f(()=>{QE();kd();kU=["-c","core.hooksPath=/dev/null","-c","core.fsmonitor=false","-c","core.pager=cat","-c","commit.gpgsign=false","-c","tag.gpgSign=false","-c","protocol.ext.allow=never","-c","protocol.file.allow=never"]});async function ws(e){return ze({arguments:e.command,cwd:e.cwd})}var eC=f(()=>{mg()});import{constants as fg}from"fs";import{lstat as vU,open as xU,realpath as tC}from"fs/promises";import Vr from"path";function rC(e){let t=Vr.relative(e.root,e.target);return t===""||!t.startsWith(`..${Vr.sep}`)&&t!==".."&&!Vr.isAbsolute(t)}async function xd(e){if(!Vr.isAbsolute(e.filePath))return null;let t=await tC(e.filePath).catch(()=>null);if(t===null)return null;for(let r of e.roots){if(!rC({root:Vr.resolve(r),target:Vr.resolve(e.filePath)}))continue;let n=await tC(r).catch(()=>null);if(n===null||!rC({root:n,target:t}))continue;let o=Vr.resolve(e.filePath);while(!0){if((await vU(o)).isSymbolicLink())return null;if(o===Vr.resolve(r))return t;o=Vr.dirname(o)}}return null}async function Xe(e){let t=await xd(e);if(t===null)return null;let r=await xU(t,fg.O_RDONLY|fg.O_NOFOLLOW|fg.O_NONBLOCK);try{let n=await r.stat();if(e.fileIdentity!==void 0&&e.fileIdentity!==`${n.dev}:${n.ino}`)return null;let o=e.offset??0,i=e.length??n.size;if(!n.isFile()||!Number.isSafeInteger(o)||o<0||!Number.isSafeInteger(i)||i<0||i>e.maximumBytes||!Number.isSafeInteger(o+i)||o+i>n.size)return null;let a=Buffer.alloc(i),s=0;while(s<i){let c=await r.read(a,s,i-s,o+s);if(c.bytesRead===0)return null;s+=c.bytesRead}if(e.contentHash!==void 0&&new Bun.CryptoHasher("sha256").update(a).digest("hex")!==e.contentHash)return null;let l=await r.stat();return n.mtimeMs===l.mtimeMs&&n.size===l.size?a.toString("utf8"):null}finally{await r.close()}}var nC=()=>{};var oC=f(()=>{eC();nC();mg();kd()});import{constants as Sd}from"fs";import{lstat as gg,mkdir as PU,open as yg,realpath as SU,rename as RU,rm as EU}from"fs/promises";import Cr from"path";async function Pd(e){let t=Cr.resolve(e),r=await gg(t).catch(()=>null);if(r===null){let o=await Pd(Cr.dirname(t)),i=Cr.join(o,Cr.basename(t));return await PU(i,{mode:Oi,recursive:!0}),Pd(i)}if(r.isSymbolicLink()){if(t==="/tmp"||t==="/var")return SU(t);throw Error("Storage directory must not be a symbolic link")}if(!r.isDirectory())throw Error("Storage parent must be a directory");let n=Cr.dirname(t);if(n===t)return t;return Cr.join(await Pd(n),Cr.basename(t))}async function lr(e){let t=await Pd(e),r=await yg(t,Sd.O_RDONLY|Sd.O_NOFOLLOW);try{if((await r.stat()).uid!==process.getuid?.())throw Error("Storage directory must be owned by the current user");await r.chmod(Oi)}finally{await r.close()}}async function Ke(e){let t=Cr.dirname(e.path);await lr(t);let r=await gg(e.path).catch(()=>null);if(r&&(!r.isFile()||r.isSymbolicLink()))throw Error("Storage target must be a regular file");let n=Cr.join(t,`.${Cr.basename(e.path)}.${crypto.randomUUID()}.partial`);try{let o=await yg(n,"wx",Di);try{await o.writeFile(e.content),await o.sync()}finally{await o.close()}await RU(n,e.path)}finally{await EU(n,{force:!0})}}async function Nn(e){if(await gg(e).catch(()=>null)===null)return;let r=await yg(e,Sd.O_RDONLY|Sd.O_NOFOLLOW);try{let n=await r.stat();if(!n.isFile()||n.uid!==process.getuid?.())throw Error("Storage file must be owned by the current user");await r.chmod(Di)}finally{await r.close()}}var Oi=448,Di=384;var hg=()=>{};import{chmod as iC,lstat as CU,readdir as $U}from"fs/promises";import aC from"path";function _U(e){return typeof e==="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}async function sC(e){let t=await CU(e.entryPath);if(t.isDirectory()){if((t.mode&511)!==Oi)await iC(e.entryPath,Oi),e.summary.directories+=1;if(e.entryPath===aC.join(e.root,"worktrees")){e.summary.skipped+=1;return}let r=await $U(e.entryPath);for(let n of r)await sC({entryPath:aC.join(e.entryPath,n),root:e.root,summary:e.summary});return}if(!t.isFile()){e.summary.skipped+=1;return}if((t.mode&511)!==Di)await iC(e.entryPath,Di),e.summary.files+=1}async function bs(e){let t={directories:0,files:0,skipped:0};try{await sC({entryPath:e,root:e,summary:t})}catch(r){if(!_U(r))throw r}return t}var lC=f(()=>{hg()});var wg=f(()=>{lC();hg()});import{rmdir as IU}from"fs/promises";import Po from"path";function jU(e){let t=e.split(Po.sep),r=t.lastIndexOf("skills");if(r<1||r+2>=t.length)return null;let n=t[r-1]??"",o=t.slice(0,r-1).join(Po.sep).endsWith(`${Po.sep}.shadowclone${Po.sep}builds`);return n.startsWith(".")||n==="config"||o?t.slice(0,r+2).join(Po.sep):null}async function cC(e){let t=jU(e);if(t===null)return;for(let r=Po.dirname(e);r.length>=t.length;r=Po.dirname(r))if(!await IU(r).then(()=>!0,()=>!1))return}var dC=()=>{};import{existsSync as LU,lstatSync as bg,readlinkSync as AU,realpathSync as OU}from"fs";import Yr from"path";function Xr(e){try{return OU(e)}catch{return null}}function kg(e){let t=Yr.resolve(e);for(;;){if(bg(t,{throwIfNoEntry:!1})?.isSymbolicLink())return{path:t,target:AU(t)};let r=Yr.dirname(t);if(r===t)return null;t=r}}function Rd(e){let t=[],r=Yr.resolve(e);while(!LU(r)){let n=Yr.dirname(r);if(n===r)return Yr.resolve(e);t.unshift(Yr.basename(r)),r=n}return Yr.join(Xr(r)??r,...t)}function vg(e){if(!bg(e.filePath,{throwIfNoEntry:!1})?.isSymbolicLink())return null;let t=Xr(e.filePath),r=Xr(e.homeDirectory);if(t===null||r===null||!bg(t).isFile())return null;let n=Yr.relative(r,t);return n!==""&&!n.startsWith("..")&&!Yr.isAbsolute(n)?t:null}var uC=()=>{};import{Database as DU}from"bun:sqlite";import{mkdir as TU}from"fs/promises";import NU from"path";async function q(e){Kt(e),await TU(NU.dirname(e),{recursive:!0});let t=new DU(e,{create:!0});try{t.exec("PRAGMA busy_timeout = 0"),t.exec("BEGIN IMMEDIATE")}catch{return t.close(),null}return{release:()=>{t.exec("ROLLBACK"),t.close()}}}var pC=f(()=>{xg()});import{lstatSync as fC,readlinkSync as FU}from"fs";import{mkdir as MU,open as zU,rename as BU,rm as mC}from"fs/promises";import Ed from"path";function E(e){return new Bun.CryptoHasher("sha256").update(e).digest("hex")}function Kt(e){let t=Ed.resolve(e);for(;;){let r=fC(t,{throwIfNoEntry:!1});if(r?.isSymbolicLink()||t===Ed.resolve(e)&&r&&!r.isFile())throw new Ti(t,r?.isSymbolicLink()?FU(t):null);let n=Ed.dirname(t);if(n===t)return;t=n}}async function v(e){return Be({filePath:e})}async function Be(e){let{filePath:t}=e;Kt(t);let r=Bun.file(t);if(!await r.exists())return null;if(r.size>2000000)throw Error("Local file exceeds the supported size");return e.encoding==="base64"?Buffer.from(await r.arrayBuffer()).toString("base64"):r.text()}async function ne(e){if(await Be(e)!==e.previous)throw Error("Destination changed during the update; retry after reviewing it");if(e.next===e.previous)return;if(e.next===null){await mC(e.filePath,{force:!0}),await cC(e.filePath);return}await MU(Ed.dirname(e.filePath),{recursive:!0});let t=`${e.filePath}.${crypto.randomUUID()}.tmp`;try{let r=fC(e.filePath,{throwIfNoEntry:!1})?.mode,n=await zU(t,"wx",r===void 0?e.mode??384:r&511);try{await n.writeFile(e.encoding==="base64"?Buffer.from(e.next,"base64"):e.next)}finally{await n.close()}if(await Be(e)!==e.previous)throw Error("Destination changed during the update; retry after reviewing it");await BU(t,e.filePath)}finally{await mC(t,{force:!0})}}var Ti;var xg=f(()=>{dC();uC();pC();Ti=class Ti extends Error{path;target;constructor(e,t){super(`Destination must be a regular file without symbolic links: ${e}${t===null?"":` (a link to ${t})`}`);this.path=e,this.target=t}}});function UU(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function GU(e,t,r){let n=e.split(/\r?\n/),o="",i=(Math.log10(t+1)|0)+1;for(let a=t-1;a<=t+1;a++){let s=n[a-1];if(!s)continue;if(o+=a.toString().padEnd(i," "),o+=": ",o+=s,o+=`
|
|
59
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(t!==a[0]&&c){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1){if(e.reused==="ref")i(a)}}if(e.external)e.sharedDefsExtractedFor=e.external}function OR(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;OR(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let a of Array.isArray(i)?i:[i]){if(typeof a!=="string")return;if(!r.includes(a))r.push(a)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function AR(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function If(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let a in i)if(!DR.has(a))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let a in i.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let s=[];for(let c of t){let d=c.properties?.[a]??AR(c);if(d===null||d===void 0)continue;if(!s.some((u)=>JSON.stringify(u)===JSON.stringify(d)))s.push(d)}let l=s.length===1?s[0]:If(s)??{allOf:s};_t(r,a,l)}for(let a of i.required??[])n.add(a)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let a of t){let s=AR(a);if(s&&!i.some((l)=>JSON.stringify(l)===JSON.stringify(s)))i.push(s)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function t4(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of DR)if(o in e)return;let r=t.filter((o)=>LR.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=If(t);else{let o=r[0],i=LR.find((l)=>Array.isArray(o[l]));if(Object.keys(o).length!==1)return;let a=t.filter((l)=>l!==o),s=o[i].map((l)=>If([...a,l]));if(s.some((l)=>!l))return;n={[i]:s}}if(!n)return;delete e.allOf,os(e,n)}function ls(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(s)=>{let l=e.seen.get(s);if(l.ref===null)return;let c=l.def??l.schema,d={...c},u=l.ref;if(l.ref=null,u){n(u);let g=e.seen.get(u),h=g.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(h);else os(c,h);if(os(c,d),s._zod.parent===u)for(let w in c){if(w==="$ref"||w==="allOf")continue;if(!(w in d))delete c[w]}if(h.$ref&&g.def)for(let w in c){if(w==="$ref"||w==="allOf")continue;if(w in g.def&&JSON.stringify(c[w])===JSON.stringify(g.def[w]))delete c[w]}}let p=s._zod.parent;if(p&&p!==u){n(p);let g=e.seen.get(p);if(g?.schema.$ref){if(c.$ref=g.schema.$ref,g.def)for(let h in c){if(h==="$ref"||h==="allOf")continue;if(h in g.def&&JSON.stringify(c[h])===JSON.stringify(g.def[h]))delete c[h]}}}e.override({zodSchema:s,jsonSchema:c,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())n(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())OR(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let c of[l.schema,l.def]){let d=c?.allOf;if(!Array.isArray(d))continue;let u=s.get(d);if(u)u.push(c);else s.set(d,[c])}for(let l of e.intersections)for(let c of s.get(l)??[])t4(c)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}os(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;_t(a,l.defId,l.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")o.$defs=a;else o.definitions=a;try{let s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:is(t,"input",e.processors),output:is(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function dt(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 dt(n.element,r);if(n.type==="set")return dt(n.valueType,r);if(n.type==="lazy")return dt(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 dt(n.innerType,r);if(n.type==="intersection")return dt(n.left,r)||dt(n.right,r);if(n.type==="record"||n.type==="map")return dt(n.keyType,r)||dt(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return dt(n.in,r)||dt(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(dt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(dt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(dt(o,r))return!0;if(n.rest&&dt(n.rest,r))return!0;return!1}return!1}var DR,LR,TR=(e,t={})=>(r)=>{let n=as({...r,processors:t});return ke(e,n),ss(n,e),ls(n,e)},is=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},a=as({...o??{},target:i,io:t,processors:r});return ke(e,a),ss(a,e),ls(a,e)};var gd=f(()=>{yf();kt();DR=new Set(["type","properties","required","additionalProperties"]),LR=["oneOf","anyOf"]});function vt(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)r4[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)_i(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)_i(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Ii(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Ii(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)UR(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)HR(t,o.mime);for(let i of o.patterns??[])GR(t,i);return t}function cs(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return cs(t.out);if(t.type==="catch")return cs(t.innerType);return e._zod.optin}function jf(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let y=jf(e,h,r);return y===h?t:y}for(let h of["anyOf","oneOf"]){let y=t[h];if(!Array.isArray(y))continue;let w=y.map((x)=>jf(e,x,r));if(w.some((x,R)=>x!==y[R]))t={...t,[h]:w}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((h)=>typeof h==="number"))return t;let{minimum:a,maximum:s,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:d,format:u,id:p,...g}=t;if(g.enum)g.enum=g.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof g.const==="number")g.const=String(g.const);if(!o)return g;if(g.type="string",!i)g.pattern=(n.includes("number")?Va:Xm).source;return g}function i4(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Lf.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=jf(t,i,new Set);if(a!==i)r.set(i,a)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}function aE(e,t,r,n,o){let i=!1,a=JSON.stringify(e,(s,l)=>{if(typeof l!=="bigint")return l;return i=!0,null});if(!i)return JSON.parse(a);return Ze(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Yf}function ji(e,t){if("_idmap"in e){let n=e,o=as({...t,processors:BR}),i={};for(let l of n._idmap.entries()){let[c,d]=l;ke(d,o)}let a={},s={registry:n,uri:t?.uri,defs:i};o.external=s;for(let l of n._idmap.entries()){let[c,d]=l;ss(o,d),_t(a,c,ls(o,d))}if(Object.keys(i).length>0){let l=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:i}}return{schemas:a}}let r=as({...t,processors:BR});return ke(e,r),ss(r,e),ls(r,e)}var _i=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ii=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},NR=(e,t)=>{_i(e,"minimum",t),Ii(e,"maximum",t)},UR=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},GR=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},HR=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},qR=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},FR=(e,t)=>_i(e,"minimum",t.minimum),MR=(e,t)=>Ii(e,"maximum",t.maximum),zR=(e)=>(t,r)=>{qR(t,r.format);let[n,o]=e[r.format];_i(t,"minimum",n),Ii(t,"maximum",o)},r4,n4,o4,WR=(e)=>o4.get(e)??e,Af=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:c,laxFormat:d}=vt(e);if(typeof i==="number")o.minLength=i;if(typeof a==="number")o.maxLength=a;if(s){if(o.format=n4[s]??s,o.format==="")delete o.format;if(s==="time"||d)delete o.format}if(c)o.contentEncoding=c;if(l&&l.size>0){let u=[...l].map(WR);if(u.length===1)o.pattern=u[0].source;else if(u.length>1)o.allOf=[...u.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},Of=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:d}=vt(e);o.type=d?"integer":"number";let u=typeof c==="number"&&c>=(i??Number.NEGATIVE_INFINITY),p=typeof l==="number"&&l<=(a??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(u)if(g)o.minimum=c,o.exclusiveMinimum=!0;else o.exclusiveMinimum=c;else if(typeof i==="number")o.minimum=i;if(p)if(g)o.maximum=l,o.exclusiveMaximum=!0;else o.exclusiveMaximum=l;else if(typeof a==="number")o.maximum=a;if(s){let h=new Set;for(let x of s)if(Number.isFinite(x)&&x!==0)h.add(Math.abs(x));else Ze(e,t,o,n,`A multipleOf divisor of ${x} cannot be represented in JSON Schema`);let[y,...w]=h;if(y!==void 0)o.multipleOf=y;if(w.length)o.allOf=[...o.allOf??[],...w.map((x)=>({multipleOf:x}))]}},Df=(e,t,r,n)=>{r.type="boolean"},ZR=(e,t,r,n)=>{Ze(e,t,r,n,"BigInt cannot be represented in JSON Schema")},KR=(e,t,r,n)=>{Ze(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Tf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},JR=(e,t,r,n)=>{Ze(e,t,r,n,"Undefined cannot be represented in JSON Schema")},VR=(e,t,r,n)=>{Ze(e,t,r,n,"Void cannot be represented in JSON Schema")},Nf=(e,t,r,n)=>{r.not={}},YR=(e,t,r,n)=>{},Ff=(e,t,r,n)=>{},XR=(e,t,r,n)=>{Ze(e,t,r,n,"Date cannot be represented in JSON Schema")},Mf=(e,t,r,n)=>{let o=e._zod.def,i=qa(o.entries);if(i.length===0){r.not={};return}if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";r.enum=i},zf=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let a of o.values)if(a===void 0){if(Ze(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a==="bigint"){if(Ze(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(a))}else i.push(a);if(i.length===0);else if(i.length===1){let a=i[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";if(i.every((a)=>typeof a==="boolean"))r.type="boolean";if(i.every((a)=>a===null))r.type="null";r.enum=i}},QR=(e,t,r,n)=>{Ze(e,t,r,n,"NaN cannot be represented in JSON Schema")},eE=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},tE=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:a,mime:s}=vt(e);if(i!==void 0)o.minLength=i;if(a!==void 0)o.maxLength=a;if(!s)return;if(s.length===0)o.not={};else if(s.length===1)o.contentMediaType=s[0];else o.anyOf=s.map((l)=>({contentMediaType:l}))},rE=(e,t,r,n)=>{r.type="boolean"},Bf=(e,t,r,n)=>{Ze(e,t,r,n,"Custom types cannot be represented in JSON Schema")},nE=(e,t,r,n)=>{Ze(e,t,r,n,"Function types cannot be represented in JSON Schema")},Uf=(e,t,r,n)=>{Ze(e,t,r,n,"Transforms cannot be represented in JSON Schema")},oE=(e,t,r,n)=>{Ze(e,t,r,n,"Map cannot be represented in JSON Schema")},iE=(e,t,r,n)=>{Ze(e,t,r,n,"Set cannot be represented in JSON Schema")},Gf=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=vt(e);if(typeof a==="number")o.minItems=a;if(typeof s==="number")o.maxItems=s;o.type="array",o.items=ke(i.element,t,{...n,path:[...n.path,"items"]})},Hf=(e,t,r,n)=>{let o=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&Ze(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let c in a)_t(o.properties,c,ke(a[c],t,{...n,path:[...n.path,"properties",c]}));let l=[];for(let c of Object.keys(a)){let d=i.shape[c];if(t.io==="input"?cs(d)===void 0:d._zod.optout===void 0)l.push(c)}if(l.length>0)o.required=l;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=ke(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},qf=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,l)=>ke(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",l]}));if(i)r.oneOf=a;else r.anyOf=a},Wf=(e,t,r,n)=>{let o=e._zod.def,i=ke(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=ke(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=(c)=>("allOf"in c)&&Object.keys(c).length===1,l=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=l,t.intersections.push(l)},Zf=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((y,w)=>ke(y,t,{...n,path:[...n.path,a,w]})),c=i.rest?ke(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,d=i.items.length;while(d>0){let y=i.items[d-1];if(!(t.io==="input"?cs(y)!==void 0:y._zod.optout==="optional"))break;d--}let u=i.items.length,p=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=l,p)o.items=!1;else if(c)o.items=c;if(d>0)o.minItems=d;if(p)o.maxItems=u}else if(t.target==="openapi-3.0"){if(o.items={anyOf:l},c)o.items.anyOf.push(c);if(d>0)o.minItems=d;if(p)o.maxItems=u}else{if(o.items=l,p)o.additionalItems=!1;else if(c)o.additionalItems=c;if(d>0)o.minItems=d;if(p)o.maxItems=u}let{minimum:g,maximum:h}=vt(e);if(typeof g==="number")o.minItems=g;if(typeof h==="number")o.maxItems=h},Lf,Kf=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,s=vt(a).patterns;if(i.mode==="loose"&&s&&s.size>0){let d=ke(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let u of s)_t(o.patternProperties,WR(u).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ke(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let d=Lf.get(t);if(!d)d=[],Lf.set(t,d),t.deferred.push(()=>i4(t));d.push(e)}o.additionalProperties=ke(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=a._zod.values,c=t.io==="input"&&cs(i.valueType)!==void 0;if(l&&!i.partial&&!c){let d=[...l].filter((u)=>typeof u==="string"||typeof u==="number");if(d.length>0)o.required=d.map(String)}},Jf=(e,t,r,n)=>{let o=e._zod.def,i=ke(o.innerType,t,n),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Vf=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Yf,Xf=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a=aE(o.defaultValue,e,t,r,n);if(a!==Yf)r.default=a},Qf=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let a=aE(o.defaultValue,e,t,r,n);if(a!==Yf)r._prefault=a},eg=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{Ze(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},tg=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?o.out:o.in:o.out;ke(a,t,n);let s=t.seen.get(e);s.ref=a},rg=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},sE=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},yd=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},lE=(e,t,r,n)=>{let o=e._zod.innerType;ke(o,t,n);let i=t.seen.get(e);i.ref=o},BR;var ng=f(()=>{Xa();uf();gd();kt();r4={greater_than:(e,t)=>_i(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ii(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>UR(e,t.value),number_format:zR(Mc),bigint_format:zR(Gm),min_length:FR,max_length:MR,length_equals:(e,t)=>NR(e,t.length),min_size:FR,max_size:MR,size_equals:(e,t)=>NR(e,t.size),string_format:(e,t)=>{if(qR(e,t.format),t.pattern)GR(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>HR(e,t.mime)};n4={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o4=new Map([[sf,nP],[td,oP]]);Lf=new WeakMap;Yf=Symbol();BR={string:Af,number:Of,boolean:Df,bigint:ZR,symbol:KR,null:Tf,undefined:JR,void:VR,never:Nf,any:YR,unknown:Ff,date:XR,enum:Mf,literal:zf,nan:QR,template_literal:eE,file:tE,success:rE,custom:Bf,function:nE,transform:Uf,map:oE,set:iE,array:Gf,object:Hf,union:qf,intersection:Wf,tuple:Zf,record:Kf,nullable:Jf,nonoptional:Vf,default:Xf,prefault:Qf,catch:eg,pipe:tg,readonly:rg,promise:sE,optional:yd,lazy:lE}});var cE=()=>{};var Sr=f(()=>{kt();Xa();gf();cE();ko();Bx();jx();uf();ZS();Vc();nf();yf();XS();IR();gd()});var og=f(()=>{Sr()});function hd(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})}})}var dE,uE=(e,t)=>{$x.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(dE.has(r))return;dE.add(r),hd(r,"format",(n)=>(o)=>Ix(n,o)),hd(r,"flatten",(n)=>(o)=>_x(n,o)),hd(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Wa,2)}),hd(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Wa,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},ig,Lt;var ag=f(()=>{Sr();Sr();kt();dE=new WeakSet([Object.prototype,Error.prototype]);ig=C("ZodError",uE),Lt=C("ZodError",uE,void 0,{Parent:Error})});var pE,mE,fE,gE,yE,hE,wE,bE,kE,vE,xE,PE;var sg=f(()=>{Sr();ag();Sr();pE=qc(Lt),mE=Wc(Lt),fE=Zc(Lt),gE=Kc(Lt),yE=Ax(Lt),hE=Ox(Lt),wE=Dx(Lt),bE=Tx(Lt),kE=Nx(Lt),vE=Fx(Lt),xE=Mx(Lt),PE=zx(Lt)});function f4(){if(!ct.localeError)jt(ff())}function ps(){if(!ct.memoizer)jt({memoizer:WS()})}function m(e){return eR(g4,e)}function nt(e){return hf(us,e)}function Rr(e){return wf(IE,e)}function F(e){return vR(jE,e)}function SE(e){return xR(A4,e)}function K(e){return PR(O4,e)}function Li(e){return SR(D4,e)}function Me(){return RR(T4)}function LE(e){return ER(N4,e)}function k(e,t){return CR(F4,e,t)}function P(e,t){let r={type:"object",shape:e??{},...W(t)};return new AE(r)}function _(e,t){return new AE({type:"object",shape:e,catchall:LE(),...W(t)})}function DE(e,t){return new OE({type:"union",options:e,...W(t)})}function Jr(e,t,r){return new M4({type:"union",options:t,discriminator:e,...W(r)})}function TE(e,t){return new z4({type:"intersection",left:e,right:t})}function cg(e,t,r){let n=t instanceof be,o=n?r:t;return new B4({type:"tuple",items:e,rest:n?t:null,...W(o)})}function re(e,t,r){if(!t||!t._zod)return new RE({type:"record",keyType:m(),valueType:e,...W(t)});return new RE({type:"record",keyType:e,valueType:t,...W(r)})}function D(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new lg({type:"enum",entries:r,...W(t)})}function J(e,t){return new U4({type:"literal",values:Array.isArray(e)?e:[e],...W(t)})}function H4(e){return new G4({type:"transform",transform:e})}function EE(e){return new dg({type:"optional",innerType:e})}function q4(e){return new NE({type:"optional",innerType:e})}function CE(e){return new W4({type:"nullable",innerType:e})}function K4(e,t){return new Z4({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Bm(t)}})}function V4(e,t){return new J4({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Bm(t)}})}function Y4(e,t){return new FE({type:"nonoptional",innerType:e,...W(t)})}function Q4(e,t){return new X4({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Px(t)})}function $E(e,t){return new eU({type:"pipe",in:e,out:t})}function rU(e){return new tU({type:"readonly",innerType:e})}function oU(e,t={}){return $R(nU,e,t)}function iU(e,t){return _R(e,t)}var xe,_E,g4,$e,ms,fs,gs,ys,y4,h4,us,IE,w4,b4,k4,v4,x4,P4,S4,R4,E4,C4,$4,_4,I4,j4,L4,jE,A4,O4,D4,T4,N4,F4,AE,OE,M4,z4,B4,RE,lg,U4,G4,dg,NE,W4,Z4,J4,FE,X4,eU,tU,nU;var wd=f(()=>{Sr();Sr();ng();gd();KS();og();sg();xe=C("ZodType",(e,t)=>(f4(),be.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(It(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 kr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(oU(e,t))},superRefine(e,t){return this.check(iU(e,t))},overwrite(e){return this.check(Ln(e))},optional(){return EE(this)},exactOptional(){return q4(this)},nullable(){return CE(this)},nullish(){return EE(CE(this))},nonoptional(e){return Y4(this,e)},array(){return k(this)},or(e){return DE([this,e])},and(e){return TE(this,e)},transform(e){return $E(this,H4(e))},default(e){return K4(this,e)},prefault(e){return V4(this,e)},catch(e){return Q4(this,e)},pipe(e){return $E(this,e)},readonly(){return rU(this)},describe(e){let t=this.clone();return vo.add(t,{description:e}),t},meta(...e){if(e.length===0)return vo.get(this);let t=this.clone();return vo.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 Gc(this,"~standard",{...af(this),jsonSchema:{input:is(this,"input"),output:is(this,"output")}})},set "~standard"(e){Kr(this,"~standard",e)},parse:function e(t,r){return pE(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await mE(this,t,r,{callee:e})},safeParse(e,t){return fE(this,e,t)},async safeParseAsync(e,t){return gE(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Kr(this,"spa",e)},validate(e,t){return Km(this,e,t)},validateAsync(e,t){return Jm(this,e,t)},encode:function e(t,r){return yE(this,t,r,{callee:e})},decode:function e(t,r){return hE(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await wE(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await bE(this,t,r,{callee:e})},safeEncode(e,t){return kE(this,e,t)},safeDecode(e,t){return vE(this,e,t)},async safeEncodeAsync(e,t){return xE(this,e,t)},async safeDecodeAsync(e,t){return PE(this,e,t)},toJSONSchema(e){return TR(this,{})(e)},get description(){return vo.get(this)?.description},get _def(){return this._zod.def}}),_E=C("_ZodString",(e,t)=>{ed.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Af(e,r,n,o)},xx({format:(e)=>vt(e).format??null,minLength:(e)=>vt(e).minimum??null,maxLength:(e)=>vt(e).maximum??null},{regex(...e){return this.check(bf(...e))},includes(...e){return this.check(xf(...e))},startsWith(...e){return this.check(Pf(...e))},endsWith(...e){return this.check(Sf(...e))},min(...e){return this.check($i(...e))},max(...e){return this.check(md(...e))},length(...e){return this.check(fd(...e))},nonempty(...e){return this.check($i(1,...e))},lowercase(e){return this.check(kf(e))},uppercase(e){return this.check(vf(e))},trim(){return this.check(Ef())},normalize(...e){return this.check(Rf(...e))},toLowerCase(){return this.check(Cf())},toUpperCase(){return this.check($f())},slugify(){return this.check(_f())}})),g4=C("ZodString",(e,t)=>{ed.init(e,t),_E.init(e,t)},{email(e){return this.check(tR(y4,e))},url(e){return this.check(wf(IE,e))},jwt(e){return this.check(kR(L4,e))},emoji(e){return this.check(aR(w4,e))},guid(e){return this.check(rR(h4,e))},uuid(e){return this.check(hf(us,e))},uuidv4(e){return this.check(nR(us,e))},uuidv6(e){return this.check(oR(us,e))},uuidv7(e){return this.check(iR(us,e))},nanoid(e){return this.check(sR(b4,e))},cuid(e){return this.check(lR(k4,e))},cuid2(e){return this.check(cR(v4,e))},ulid(e){return this.check(dR(x4,e))},base64(e){return this.check(hR(_4,e))},base64url(e){return this.check(wR(I4,e))},xid(e){return this.check(uR(P4,e))},ksuid(e){return this.check(pR(S4,e))},ipv4(e){return this.check(mR(R4,e))},ipv6(e){return this.check(fR(E4,e))},cidrv4(e){return this.check(gR(C4,e))},cidrv6(e){return this.check(yR($4,e))},e164(e){return this.check(bR(j4,e))},datetime(e){return this.check(ad(ms,e))},date(e){return this.check(sd(fs,e))},time(e){return this.check(ld(gs,e))},duration(e){return this.check(cd(ys,e))}});$e=C("ZodStringFormat",(e,t)=>{ve.init(e,t),_E.init(e,t)}),ms=C("ZodISODateTime",(e,t)=>{nS.init(e,t),$e.init(e,t)}),fs=C("ZodISODate",(e,t)=>{oS.init(e,t),$e.init(e,t)}),gs=C("ZodISOTime",(e,t)=>{iS.init(e,t),$e.init(e,t)}),ys=C("ZodISODuration",(e,t)=>{aS.init(e,t),$e.init(e,t)}),y4=C("ZodEmail",(e,t)=>{WP.init(e,t),$e.init(e,t)}),h4=C("ZodGUID",(e,t)=>{HP.init(e,t),$e.init(e,t)}),us=C("ZodUUID",(e,t)=>{qP.init(e,t),$e.init(e,t)});IE=C("ZodURL",(e,t)=>{JP.init(e,t),$e.init(e,t)});w4=C("ZodEmoji",(e,t)=>{VP.init(e,t),$e.init(e,t)}),b4=C("ZodNanoID",(e,t)=>{YP.init(e,t),$e.init(e,t)}),k4=C("ZodCUID",(e,t)=>{XP.init(e,t),$e.init(e,t)}),v4=C("ZodCUID2",(e,t)=>{QP.init(e,t),$e.init(e,t)}),x4=C("ZodULID",(e,t)=>{eS.init(e,t),$e.init(e,t)}),P4=C("ZodXID",(e,t)=>{tS.init(e,t),$e.init(e,t)}),S4=C("ZodKSUID",(e,t)=>{rS.init(e,t),$e.init(e,t)}),R4=C("ZodIPv4",(e,t)=>{sS.init(e,t),$e.init(e,t)}),E4=C("ZodIPv6",(e,t)=>{cS.init(e,t),$e.init(e,t)}),C4=C("ZodCIDRv4",(e,t)=>{dS.init(e,t),$e.init(e,t)}),$4=C("ZodCIDRv6",(e,t)=>{uS.init(e,t),$e.init(e,t)}),_4=C("ZodBase64",(e,t)=>{mS.init(e,t),$e.init(e,t)}),I4=C("ZodBase64URL",(e,t)=>{fS.init(e,t),$e.init(e,t)}),j4=C("ZodE164",(e,t)=>{gS.init(e,t),$e.init(e,t)}),L4=C("ZodJWT",(e,t)=>{yS.init(e,t),$e.init(e,t)}),jE=C("ZodNumber",(e,t)=>{lf.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Of(e,r,n,o),e.isFinite=!0},xx({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=vt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=vt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=vt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>vt(e).format??null},{gt(e,t){return this.check(ud(e,t))},gte(e,t){return this.check(ns(e,t))},min(e,t){return this.check(ns(e,t))},lt(e,t){return this.check(dd(e,t))},lte(e,t){return this.check(rs(e,t))},max(e,t){return this.check(rs(e,t))},int(e){return this.check(SE(e))},safe(e){return this.check(SE(e))},positive(e){return this.check(ud(0,e))},nonnegative(e){return this.check(ns(0,e))},negative(e){return this.check(dd(0,e))},nonpositive(e){return this.check(rs(0,e))},multipleOf(e,t){return this.check(pd(e,t))},step(e,t){return this.check(pd(e,t))},finite(){return this}}));A4=C("ZodNumberFormat",(e,t)=>{hS.init(e,t),jE.init(e,t)});O4=C("ZodBoolean",(e,t)=>{wS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Df(e,r,n,o)});D4=C("ZodNull",(e,t)=>{bS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tf(e,r,n,o)});T4=C("ZodUnknown",(e,t)=>{kS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o)});N4=C("ZodNever",(e,t)=>{vS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o)});F4=C("ZodArray",(e,t)=>{ps(),xS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o),e.element=t.element},{min(e,t){return this.check($i(e,t))},nonempty(e){return this.check($i(1,e))},max(e,t){return this.check(md(e,t))},length(e,t){return this.check(fd(e,t))},unwrap(){return this.element}});AE=C("ZodObject",(e,t)=>{ps(),RS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),P2(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return D(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(It(this._zod.def,{catchall:e}))},passthrough(){return this.clone(It(this._zod.def,{catchall:Me()}))},loose(){return this.clone(It(this._zod.def,{catchall:Me()}))},strict(){return this.clone(It(this._zod.def,{catchall:LE()}))},strip(){return this.clone(It(this._zod.def,{catchall:void 0}))},extend(e){return g2(this,e)},safeExtend(e){return y2(this,e)},merge(e){return h2(this,e)},pick(e){return m2(this,e)},omit(e){return f2(this,e)},partial(...e){return wx(dg,this,e[0])},exactPartial(...e){return wx(NE,this,e[0],"exactPartial")},required(...e){return w2(FE,this,e[0])}});OE=C("ZodUnion",(e,t)=>{cf.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e.options=t.options});M4=C("ZodDiscriminatedUnion",(e,t)=>{OE.init(e,t),ES.init(e,t)});z4=C("ZodIntersection",(e,t)=>{CS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o)});B4=C("ZodTuple",(e,t)=>{ps(),$S.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zf(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 Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new dg({type:"optional",innerType:t}))})}});RE=C("ZodRecord",(e,t)=>{ps(),_S.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});lg=C("ZodEnum",(e,t)=>{IS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Mf(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 a of n)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new lg({...t,checks:[],...W(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw Error(`Key ${a} not found in enum`);return new lg({...t,checks:[],...W(o),entries:i})}});U4=C("ZodLiteral",(e,t)=>{jS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zf(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});G4=C("ZodTransform",(e,t)=>{ps(),LS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ja(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(bo(i,r.value,t));else{let a=i;if(a.fatal)a.continue=!1;if(a.code??(a.code="custom"),!("input"in a))a.input=r.value;a.inst??(a.inst=e),r.issues.push(bo(a))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});dg=C("ZodOptional",(e,t)=>{df.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});NE=C("ZodExactOptional",(e,t)=>{AS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});W4=C("ZodNullable",(e,t)=>{OS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Z4=C("ZodDefault",(e,t)=>{DS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});J4=C("ZodPrefault",(e,t)=>{TS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});FE=C("ZodNonOptional",(e,t)=>{NS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});X4=C("ZodCatch",(e,t)=>{FS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});eU=C("ZodPipe",(e,t)=>{MS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tg(e,r,n,o),e.in=t.in,e.out=t.out});tU=C("ZodReadonly",(e,t)=>{zS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});nU=C("ZodCustom",(e,t)=>{BS.init(e,t),xe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bf(e,r,n,o)})});var ME;var zE=f(()=>{(function(e){})(ME||(ME={}))});var bd={};Dm(bd,{ZodISODate:()=>fs,ZodISODateTime:()=>ms,ZodISODuration:()=>ys,ZodISOTime:()=>gs,date:()=>sU,datetime:()=>aU,duration:()=>cU,time:()=>lU});function aU(e){return ad(ms,e)}function sU(e){return sd(fs,e)}function lU(e){return ld(gs,e)}function cU(e){return cd(ys,e)}var BE=f(()=>{Sr();wd();wd()});var UE=()=>{};var ug=f(()=>{Sr();ng();gf();BE();UE();wd();og();ag();sg();zE()});var A=f(()=>{ug();ug()});var An;var hs=f(()=>{An={name:"@shadowclone/cli",version:"0.0.28"}});import{stat as pU}from"fs/promises";import On from"path";async function GE(e){return pU(e).then((t)=>t.isDirectory()).catch(()=>!1)}async function qE(e){let t=Bun.file(On.join(e,"package.json"));return await t.exists()?await t.json().catch(()=>null):null}async function WE(e){return await GE(On.join(e,"skills"))&&await GE(On.join(e,"preferences"))}async function yU(e){let t=mU.safeParse(await qE(e));return t.success&&t.data.name===An.name&&await WE(e)}async function hU(e){let t=fU.safeParse(await qE(e));return t.success&&t.data.workspaces.includes(gU)&&await WE(e)}async function wU(e){let t=e;while(!t.split(On.sep).includes("node_modules")){if(await hU(t))return t;let r=On.dirname(t);if(r===t)return null;t=r}return null}function HE(e){return{preferences:On.join(e,"preferences"),skills:On.join(e,"skills")}}async function bU(e){let t=On.resolve(e,"..");if(await yU(t))return HE(t);let r=await wU(t);if(r!==null)return HE(r);throw Error("The packaged seed guidance directories are missing")}async function pg(){return bU(import.meta.dir)}async function Er(){return(await pg()).skills}var mU,fU,gU="packages/*";var ZE=f(()=>{A();hs();mU=P({name:m()}),fU=P({workspaces:k(m())})});var Dn=8388608,Ai=1048576,Tn=8388608,ut=1048576,KE=16777216,JE=1048576,VE=65536;async function YE(e){let t=e.stream.getReader(),r=[],n=0;try{while(!0){let o=await t.read();if(o.done)return Buffer.concat(r).toString("utf8");if(n+=o.value.byteLength,n>e.maximumBytes)throw e.overflow(),new xo("output");r.push(o.value)}}finally{await t.cancel().catch(()=>{return}),t.releaseLock()}}async function Pe(e){let t=AbortSignal.timeout(e.timeoutMilliseconds??600000),r=e.signal?AbortSignal.any([t,e.signal]):t;if(r.aborted)throw new xo("cancelled");let n=Bun.spawn({cmd:[...e.arguments],cwd:e.cwd,env:{...e.environment},stdin:"pipe",stdout:"pipe",stderr:"pipe",detached:process.platform!=="win32"}),o=()=>{try{if(process.platform!=="win32")process.kill(-n.pid,"SIGKILL");else n.kill("SIGKILL")}catch{n.kill("SIGKILL")}};if(r.addEventListener("abort",o,{once:!0}),r.aborted)o();try{let i=await Promise.allSettled([YE({stream:n.stdout,maximumBytes:e.maximumOutputBytes??KE,overflow:o}),YE({stream:n.stderr,maximumBytes:JE,overflow:o}),n.exited,(async()=>{try{n.stdin.write(e.input??""),await n.stdin.flush()}finally{n.stdin.end()}})()]);if(r.aborted)throw new xo("cancelled");let[a,s,l]=i;for(let c of i)if(c.status==="rejected")throw c.reason;if(a?.status!=="fulfilled"||s?.status!=="fulfilled"||l?.status!=="fulfilled")throw Error("Process did not complete");return{exitCode:l.value,stdout:a.value,stderr:s.value.slice(-VE)}}finally{o(),r.removeEventListener("abort",o)}}var xo;var kd=f(()=>{xo=class xo extends Error{constructor(e){super(e==="output"?"Process output limit exceeded":"Process cancelled or timed out");this.name="ProcessLimitError"}}});async function XE(e){let t=[];for(let r of["user.name","user.email"]){let n=await Pe({arguments:["git","config","--get",r],cwd:e.cwd,environment:{...e.environment,GIT_CONFIG_GLOBAL:void 0},timeoutMilliseconds:1e4,maximumOutputBytes:4096}),o=n.stdout.trim();if(n.exitCode===0&&o.length>0)t.push("-c",`${r}=${o}`)}return t}var QE=f(()=>{kd()});function vd(e={}){return{PATH:process.env.PATH,HOME:process.env.HOME,LANG:process.env.LANG,TMPDIR:process.env.TMPDIR,GIT_CONFIG_NOSYSTEM:"1",GIT_CONFIG_GLOBAL:"/dev/null",GIT_TERMINAL_PROMPT:"0",...e.remote?{GH_TOKEN:process.env.GH_TOKEN,GITHUB_TOKEN:process.env.GITHUB_TOKEN,SSH_AUTH_SOCK:process.env.SSH_AUTH_SOCK}:{}}}async function ze(e){let[t,...r]=e.arguments;if(!t)throw Error("Command requires an executable");let n=t==="gh"||r.includes("push"),o=vd({remote:n}),i=[...kU];if(t==="git"&&!r.includes("config")){if((await Pe({arguments:["git",...i,"config","--local","--includes","--name-only","--get-regexp","^(filter\\..*\\.(clean|smudge|process|required)|diff\\..*\\.(command|textconv)|core\\.sshcommand|remote\\..*\\.(vcs|receivepack)|core\\.gitproxy|credential(\\..*)?\\.helper)$"],cwd:e.cwd,environment:o,timeoutMilliseconds:1e4,signal:e.signal})).stdout.trim().length>0)throw Error("Automatic Git commands refuse executable repository configuration")}if(t==="git"&&r.includes("commit"))i.push(...await XE({cwd:e.cwd,environment:o}));if(t==="git"&&r.includes("push"))i.push("-c","credential.helper=","-c","credential.https://github.com.helper=!gh auth git-credential");return Pe({arguments:t==="git"?["git",...i,...r]:[t,...r],cwd:e.cwd,environment:o,timeoutMilliseconds:(e.timeoutSeconds??60)*1000,signal:e.signal})}var kU;var mg=f(()=>{QE();kd();kU=["-c","core.hooksPath=/dev/null","-c","core.fsmonitor=false","-c","core.pager=cat","-c","commit.gpgsign=false","-c","tag.gpgSign=false","-c","protocol.ext.allow=never","-c","protocol.file.allow=never"]});async function ws(e){return ze({arguments:e.command,cwd:e.cwd})}var eC=f(()=>{mg()});import{constants as fg}from"fs";import{lstat as vU,open as xU,realpath as tC}from"fs/promises";import Vr from"path";function rC(e){let t=Vr.relative(e.root,e.target);return t===""||!t.startsWith(`..${Vr.sep}`)&&t!==".."&&!Vr.isAbsolute(t)}async function xd(e){if(!Vr.isAbsolute(e.filePath))return null;let t=await tC(e.filePath).catch(()=>null);if(t===null)return null;for(let r of e.roots){if(!rC({root:Vr.resolve(r),target:Vr.resolve(e.filePath)}))continue;let n=await tC(r).catch(()=>null);if(n===null||!rC({root:n,target:t}))continue;let o=Vr.resolve(e.filePath);while(!0){if((await vU(o)).isSymbolicLink())return null;if(o===Vr.resolve(r))return t;o=Vr.dirname(o)}}return null}async function Xe(e){let t=await xd(e);if(t===null)return null;let r=await xU(t,fg.O_RDONLY|fg.O_NOFOLLOW|fg.O_NONBLOCK);try{let n=await r.stat();if(e.fileIdentity!==void 0&&e.fileIdentity!==`${n.dev}:${n.ino}`)return null;let o=e.offset??0,i=e.length??n.size;if(!n.isFile()||!Number.isSafeInteger(o)||o<0||!Number.isSafeInteger(i)||i<0||i>e.maximumBytes||!Number.isSafeInteger(o+i)||o+i>n.size)return null;let a=Buffer.alloc(i),s=0;while(s<i){let c=await r.read(a,s,i-s,o+s);if(c.bytesRead===0)return null;s+=c.bytesRead}if(e.contentHash!==void 0&&new Bun.CryptoHasher("sha256").update(a).digest("hex")!==e.contentHash)return null;let l=await r.stat();return n.mtimeMs===l.mtimeMs&&n.size===l.size?a.toString("utf8"):null}finally{await r.close()}}var nC=()=>{};var oC=f(()=>{eC();nC();mg();kd()});import{constants as Sd}from"fs";import{lstat as gg,mkdir as PU,open as yg,realpath as SU,rename as RU,rm as EU}from"fs/promises";import Cr from"path";async function Pd(e){let t=Cr.resolve(e),r=await gg(t).catch(()=>null);if(r===null){let o=await Pd(Cr.dirname(t)),i=Cr.join(o,Cr.basename(t));return await PU(i,{mode:Oi,recursive:!0}),Pd(i)}if(r.isSymbolicLink()){if(t==="/tmp"||t==="/var")return SU(t);throw Error("Storage directory must not be a symbolic link")}if(!r.isDirectory())throw Error("Storage parent must be a directory");let n=Cr.dirname(t);if(n===t)return t;return Cr.join(await Pd(n),Cr.basename(t))}async function lr(e){let t=await Pd(e),r=await yg(t,Sd.O_RDONLY|Sd.O_NOFOLLOW);try{if((await r.stat()).uid!==process.getuid?.())throw Error("Storage directory must be owned by the current user");await r.chmod(Oi)}finally{await r.close()}}async function Ke(e){let t=Cr.dirname(e.path);await lr(t);let r=await gg(e.path).catch(()=>null);if(r&&(!r.isFile()||r.isSymbolicLink()))throw Error("Storage target must be a regular file");let n=Cr.join(t,`.${Cr.basename(e.path)}.${crypto.randomUUID()}.partial`);try{let o=await yg(n,"wx",Di);try{await o.writeFile(e.content),await o.sync()}finally{await o.close()}await RU(n,e.path)}finally{await EU(n,{force:!0})}}async function Nn(e){if(await gg(e).catch(()=>null)===null)return;let r=await yg(e,Sd.O_RDONLY|Sd.O_NOFOLLOW);try{let n=await r.stat();if(!n.isFile()||n.uid!==process.getuid?.())throw Error("Storage file must be owned by the current user");await r.chmod(Di)}finally{await r.close()}}var Oi=448,Di=384;var hg=()=>{};import{chmod as iC,lstat as CU,readdir as $U}from"fs/promises";import aC from"path";function _U(e){return typeof e==="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}async function sC(e){let t=await CU(e.entryPath);if(t.isDirectory()){if((t.mode&511)!==Oi)await iC(e.entryPath,Oi),e.summary.directories+=1;if(e.entryPath===aC.join(e.root,"worktrees")){e.summary.skipped+=1;return}let r=await $U(e.entryPath);for(let n of r)await sC({entryPath:aC.join(e.entryPath,n),root:e.root,summary:e.summary});return}if(!t.isFile()){e.summary.skipped+=1;return}if((t.mode&511)!==Di)await iC(e.entryPath,Di),e.summary.files+=1}async function bs(e){let t={directories:0,files:0,skipped:0};try{await sC({entryPath:e,root:e,summary:t})}catch(r){if(!_U(r))throw r}return t}var lC=f(()=>{hg()});var wg=f(()=>{lC();hg()});import{rmdir as IU}from"fs/promises";import Po from"path";function jU(e){let t=e.split(Po.sep),r=t.lastIndexOf("skills");if(r<1||r+2>=t.length)return null;let n=t[r-1]??"",o=t.slice(0,r-1).join(Po.sep).endsWith(`${Po.sep}.shadowclone${Po.sep}builds`);return n.startsWith(".")||n==="config"||o?t.slice(0,r+2).join(Po.sep):null}async function cC(e){let t=jU(e);if(t===null)return;for(let r=Po.dirname(e);r.length>=t.length;r=Po.dirname(r))if(!await IU(r).then(()=>!0,()=>!1))return}var dC=()=>{};import{existsSync as LU,lstatSync as bg,readlinkSync as AU,realpathSync as OU}from"fs";import Yr from"path";function Xr(e){try{return OU(e)}catch{return null}}function kg(e){let t=Yr.resolve(e);for(;;){if(bg(t,{throwIfNoEntry:!1})?.isSymbolicLink())return{path:t,target:AU(t)};let r=Yr.dirname(t);if(r===t)return null;t=r}}function Rd(e){let t=[],r=Yr.resolve(e);while(!LU(r)){let n=Yr.dirname(r);if(n===r)return Yr.resolve(e);t.unshift(Yr.basename(r)),r=n}return Yr.join(Xr(r)??r,...t)}function vg(e){if(!bg(e.filePath,{throwIfNoEntry:!1})?.isSymbolicLink())return null;let t=Xr(e.filePath),r=Xr(e.homeDirectory);if(t===null||r===null||!bg(t).isFile())return null;let n=Yr.relative(r,t);return n!==""&&!n.startsWith("..")&&!Yr.isAbsolute(n)?t:null}var uC=()=>{};import{Database as DU}from"bun:sqlite";import{mkdir as TU}from"fs/promises";import NU from"path";async function q(e){Kt(e),await TU(NU.dirname(e),{recursive:!0});let t=new DU(e,{create:!0});try{t.exec("PRAGMA busy_timeout = 0"),t.exec("BEGIN IMMEDIATE")}catch{return t.close(),null}return{release:()=>{t.exec("ROLLBACK"),t.close()}}}var pC=f(()=>{xg()});import{lstatSync as fC,readlinkSync as FU}from"fs";import{mkdir as MU,open as zU,rename as BU,rm as mC}from"fs/promises";import Ed from"path";function E(e){return new Bun.CryptoHasher("sha256").update(e).digest("hex")}function Kt(e){let t=Ed.resolve(e);for(;;){let r=fC(t,{throwIfNoEntry:!1});if(r?.isSymbolicLink()||t===Ed.resolve(e)&&r&&!r.isFile())throw new Ti(t,r?.isSymbolicLink()?FU(t):null);let n=Ed.dirname(t);if(n===t)return;t=n}}async function v(e){return Be({filePath:e})}async function Be(e){let{filePath:t}=e;Kt(t);let r=Bun.file(t);if(!await r.exists())return null;if(r.size>2000000)throw Error("Local file exceeds the supported size");return e.encoding==="base64"?Buffer.from(await r.arrayBuffer()).toString("base64"):r.text()}async function ne(e){if(await Be(e)!==e.previous)throw Error("Destination changed during the update; retry after reviewing it");if(e.next===e.previous)return;if(e.next===null){await mC(e.filePath,{force:!0}),await cC(e.filePath);return}await MU(Ed.dirname(e.filePath),{recursive:!0});let t=`${e.filePath}.${crypto.randomUUID()}.tmp`;try{let r=fC(e.filePath,{throwIfNoEntry:!1})?.mode,n=await zU(t,"wx",r===void 0?e.mode??384:r&511);try{await n.writeFile(e.encoding==="base64"?Buffer.from(e.next,"base64"):e.next)}finally{await n.close()}if(await Be(e)!==e.previous)throw Error("Destination changed during the update; retry after reviewing it");await BU(t,e.filePath)}finally{await mC(t,{force:!0})}}var Ti;var xg=f(()=>{dC();uC();pC();Ti=class Ti extends Error{path;target;constructor(e,t){super(`Destination must be a regular file without symbolic links: ${e}${t===null?"":` (a link to ${t})`}`);this.path=e,this.target=t}}});function UU(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function GU(e,t,r){let n=e.split(/\r?\n/),o="",i=(Math.log10(t+1)|0)+1;for(let a=t-1;a<=t+1;a++){let s=n[a-1];if(!s)continue;if(o+=a.toString().padEnd(i," "),o+=": ",o+=s,o+=`
|
|
60
60
|
`,a===t)o+=" ".repeat(i+r+2),o+=`^
|
|
61
61
|
`}return o}var V;var So=f(()=>{/*!
|
|
62
62
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "shadowclone",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.28",
|
|
5
5
|
"description": "Set up and maintain portable coding-agent skills with explicit local consent.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Shadowclone",
|