@shadowclone/cli 0.0.29 → 0.0.30

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.
@@ -56,7 +56,7 @@ ${t.join(`
56
56
  }
57
57
  `)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},a,s=_i,l=!ut.jitless,d=l&&xx.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 LS([],y,g,h,p,e,h?.abortEarly===!0)}return r(g,h)}});ff=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)=>Uc(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 zP(a,n,e,o);return Promise.all(a).then((s)=>zP(s,n,e,o))}});OS=C("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ff.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))jt(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=Va(o._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=Ja(()=>v4(t));e._zod.parse=(o,i)=>{let a=o.value;if(!_i(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}}),DS=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])=>BP(r,l,c));return BP(r,i,a)}});TS=C("$ZodTuple",(e,t)=>{be.init(e,t);let r=t.items,n=ut.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=UP(r,"optin"),c=UP(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=Jt(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(Jt(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)=>GP(R,o,g)));else GP(x,o,g)}}if(s.length)return Promise.all(s).then(()=>HP(d,o,r,a,c));return HP(d,o,r,a,c)}});NS=C("$ZodRecord",(e,t)=>{be.init(e,t);let r=ut.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!bo(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)=>Sr(h,o,At())),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(...Pr(d,h.issues));n.value[p]=h.value}));else{if(g.issues.length)n.issues.push(...Pr(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"&&Xa.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)=>Sr(h,o,At())),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(...Pr(c,h.issues));n.value[p]=h.value}));else{if(g.issues.length)n.issues.push(...Pr(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}}),FS=C("$ZodEnum",(e,t)=>{be.init(e,t);let r=Za(t.entries),n=new Set(r);e._zod.values=n,pe(e,"pattern",(o)=>{let i=Za(o.def.entries).filter((a)=>Px.has(typeof a));return new RegExp(i.length?`^(${i.map((a)=>An(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}}),MS=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"?An(i):i?An(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}}),zS=C("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.optin="optional",ut.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ya(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 Rr;return r.value=o,r}});gf=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(`^(${Uc(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)=>qP(r,i));return qP(r,o)}return t.innerType._zod.run(r,n)}}),BS=C("$ZodExactOptional",(e,t)=>{gf.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)}),US=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(`^(${Uc(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)}}),GS=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)=>WP(i,t));return WP(o,t)}});HS=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)}}),qS=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)=>ZP(i,e));return ZP(o,e)}});WS=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)=>KP(r,i,t,n));return KP(r,o,t,n)}}),ZS=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)=>td(a,t.in,n));return td(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>td(i,t.out,n));return td(o,t.out,n)}});KS=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(JP);return JP(o)}});JS=C("$ZodCustom",(e,t)=>{Xe.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)=>VP(i,r,n,e));VP(o,r,n,e);return}})});function XS(e){return e!==null&&typeof e==="object"}function hf(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}function cd(e,t,r){let n=QS.get(e);if(n!==void 0)return n?ns:rs;if(t.has(e))return ns;t.add(e);let o=rs,i=(d)=>{if(o!==ns&&d?._zod){let u=cd(d,t,r);if(u>o)o=u}},a=(d,u)=>{let p=rs;for(let g of Reflect.ownKeys(d)){let h=Object.getOwnPropertyDescriptor(d,g);if(u&&!h.enumerable)continue;let y=h.get?ld:h.value?._zod?cd(h.value,t,r):rs;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=Va(l);s(d?a(d,!0):ld),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?cd(d,t,!1):ld);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),x4(e,o)}function x4(e,t){if(t!==ld)QS.set(e,t===ns);return t}function P4(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}function eR(){return S4}function R4(e,t){let r=e[wf]?.backEdges;return r!==void 0&&XS(t)&&r.has(t)}var YS,wf="~memo",VS,QS,rs=0,ld=1,ns=2,ad,sd,S4;var tR=m(()=>{xt();YS=class YS extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}};VS=[];QS=new WeakMap;sd=[],S4={alloc(e,t,r){let n=ad;if(!n)return r;ad=void 0;let o={value:r,issues:null};return n.set(t.value,o),sd.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"&&R4(i,o.value))throw new YS;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=cd(e,new Set,!1);if(x===rs){if(e._zod.parse=a,e._zod.run===s)e._zod.run=a;return a(l,c)}if(x===ns||n)r=!0;else n=!0}let d=l.value;if(!XS(d))return a(l,c);let u=c[wf];if(!u)u={buckets:new WeakMap,backEdges:void 0},c[wf]=u;let p;if(o===c)p=i;else p=P4(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(...hf(g.issues))}else l.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(g.value);return l}ad=p;let h=sd.length,y=a(l,c);ad=void 0;let w=sd.length>h?sd.pop():void 0;if(y instanceof Promise)return y.then((x)=>{if(w)w.issues=x.issues.length?hf(x.issues):VS;return x});if(w)w.issues=y.issues.length?hf(y.issues):VS;return y};if(e._zod.parse=s,e._zod.run===a)e._zod.run=s})}}});function bf(){return{localeError:E4()}}var E4=()=>{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=$x(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 ${Zm(i.values[0])}`;return`Invalid option: expected one of ${Hm(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":""}: ${Hm(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 rR=m(()=>{xt()});var kf=()=>{};class iR{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 C4(){return new iR}var oR,xo;var vf=m(()=>{(oR=globalThis).__zod_globalRegistry??(oR.__zod_globalRegistry=C4());xo=globalThis.__zod_globalRegistry});var aR=()=>{};function sR(e){if(e.checks)e.checks=[...e.checks];return e}function lR(e,t){return new e(sR({type:"string",...W(t)}))}function cR(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...W(t)})}function dR(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...W(t)})}function xf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...W(t)})}function uR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...W(t)})}function pR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...W(t)})}function mR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...W(t)})}function Pf(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...W(t)})}function fR(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...W(t)})}function gR(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...W(t)})}function yR(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...W(t)})}function hR(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...W(t)})}function wR(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...W(t)})}function bR(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...W(t)})}function kR(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...W(t)})}function vR(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...W(t)})}function xR(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...W(t)})}function PR(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...W(t)})}function SR(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...W(t)})}function RR(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...W(t)})}function ER(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...W(t)})}function CR(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...W(t)})}function $R(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...W(t)})}function dd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...W(t)})}function ud(e,t){return new e({type:"string",format:"date",check:"string_format",...W(t)})}function pd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...W(t)})}function md(e,t){return new e({type:"string",format:"duration",check:"string_format",...W(t)})}function _R(e,t){return new e(sR({type:"number",checks:[],...W(t)}))}function IR(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...W(t)})}function jR(e,t){return new e({type:"boolean",...W(t)})}function LR(e,t){return new e({type:"null",...W(t)})}function AR(e){return new e({type:"unknown"})}function OR(e,t){return new e({type:"never",...W(t)})}function fd(e,t){return new af({check:"less_than",...W(t),value:e,inclusive:!1})}function os(e,t){return new af({check:"less_than",...W(t),value:e,inclusive:!0})}function gd(e,t){return new sf({check:"greater_than",...W(t),value:e,inclusive:!1})}function is(e,t){return new sf({check:"greater_than",...W(t),value:e,inclusive:!0})}function yd(e,t){return new SP({check:"multiple_of",...W(t),value:e})}function hd(e,t){return new EP({check:"max_length",...W(t),maximum:e})}function Ii(e,t){return new CP({check:"min_length",...W(t),minimum:e})}function wd(e,t){return new $P({check:"length_equals",...W(t),length:e})}function Sf(e,t){return new _P({check:"string_format",format:"regex",...W(t),pattern:e})}function Rf(e){return new IP({check:"string_format",format:"lowercase",...W(e)})}function Ef(e){return new jP({check:"string_format",format:"uppercase",...W(e)})}function Cf(e,t){return new LP({check:"string_format",format:"includes",...W(t),includes:e})}function $f(e,t){return new AP({check:"string_format",format:"starts_with",...W(t),prefix:e})}function _f(e,t){return new OP({check:"string_format",format:"ends_with",...W(t),suffix:e})}function On(e){return new DP({check:"overwrite",tx:e})}function If(e){return On((t)=>t.normalize(e))}function jf(){return On((e)=>e.trim())}function Lf(){return On((e)=>e.toLowerCase())}function Af(){return On((e)=>e.toUpperCase())}function Of(){return On((e)=>vx(e))}function DR(e,t,r){return new e({type:"array",element:t,...W(r)})}function TR(e,t,r){return new e({type:"custom",check:"custom",fn:t,...W(r)})}function NR(e,t){let r=$4((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ko(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(ko(i))}},e(n.value,n)),t);return r}function $4(e,t){let r=new Xe({check:"custom",...W(t)});return r._zod.check=e,r}var FR=m(()=>{ed();xt()});function as(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))jt(e,n,r[n]);return e}function ls(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??xo,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)as(a.schema,l);if(t.io==="input"&&pt(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 MR(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function cs(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}/${MR(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+MR(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 UR(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;UR(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 BR(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 Df(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let a in i)if(!GR.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]??BR(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]:Df(s)??{allOf:s};jt(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=BR(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 _4(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of GR)if(o in e)return;let r=t.filter((o)=>zR.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Df(t);else{let o=r[0],i=zR.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)=>Df([...a,l]));if(s.some((l)=>!l))return;n={[i]:s}}if(!n)return;delete e.allOf,as(e,n)}function ds(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 as(c,h);if(as(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())UR(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)??[])_4(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)}as(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;jt(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:ss(t,"input",e.processors),output:ss(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function pt(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 pt(n.element,r);if(n.type==="set")return pt(n.valueType,r);if(n.type==="lazy")return pt(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 pt(n.innerType,r);if(n.type==="intersection")return pt(n.left,r)||pt(n.right,r);if(n.type==="record"||n.type==="map")return pt(n.keyType,r)||pt(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return pt(n.in,r)||pt(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(pt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(pt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(pt(o,r))return!0;if(n.rest&&pt(n.rest,r))return!0;return!1}return!1}var GR,zR,HR=(e,t={})=>(r)=>{let n=ls({...r,processors:t});return ke(e,n),cs(n,e),ds(n,e)},ss=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},a=ls({...o??{},target:i,io:t,processors:r});return ke(e,a),cs(a,e),ds(a,e)};var bd=m(()=>{vf();xt();GR=new Set(["type","properties","required","additionalProperties"]),zR=["oneOf","anyOf"]});function Pt(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)I4[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ji(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ji(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Li(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Li(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)VR(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)XR(t,o.mime);for(let i of o.patterns??[])YR(t,i);return t}function us(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return us(t.out);if(t.type==="catch")return us(t.innerType);return e._zod.optin}function Tf(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=Tf(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)=>Tf(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")?Xa:nf).source;return g}function A4(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 Nf.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=Tf(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 fE(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"),rg}function Ai(e,t){if("_idmap"in e){let n=e,o=ls({...t,processors:JR}),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;cs(o,d),jt(a,c,ds(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=ls({...t,processors:JR});return ke(e,r),cs(r,e),ds(r,e)}var ji=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Li=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},qR=(e,t)=>{ji(e,"minimum",t),Li(e,"maximum",t)},VR=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},YR=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},XR=(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},WR=(e,t)=>ji(e,"minimum",t.minimum),ZR=(e,t)=>Li(e,"maximum",t.maximum),KR=(e)=>(t,r)=>{QR(t,r.format);let[n,o]=e[r.format];ji(t,"minimum",n),Li(t,"maximum",o)},I4,j4,L4,eE=(e)=>L4.get(e)??e,Ff=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:c,laxFormat:d}=Pt(e);if(typeof i==="number")o.minLength=i;if(typeof a==="number")o.maxLength=a;if(s){if(o.format=j4[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(eE);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}))]}},Mf=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:d}=Pt(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}))]}},zf=(e,t,r,n)=>{r.type="boolean"},tE=(e,t,r,n)=>{Ze(e,t,r,n,"BigInt cannot be represented in JSON Schema")},rE=(e,t,r,n)=>{Ze(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Bf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},nE=(e,t,r,n)=>{Ze(e,t,r,n,"Undefined cannot be represented in JSON Schema")},oE=(e,t,r,n)=>{Ze(e,t,r,n,"Void cannot be represented in JSON Schema")},Uf=(e,t,r,n)=>{r.not={}},iE=(e,t,r,n)=>{},Gf=(e,t,r,n)=>{},aE=(e,t,r,n)=>{Ze(e,t,r,n,"Date cannot be represented in JSON Schema")},Hf=(e,t,r,n)=>{let o=e._zod.def,i=Za(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},qf=(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}},sE=(e,t,r,n)=>{Ze(e,t,r,n,"NaN cannot be represented in JSON Schema")},lE=(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},cE=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:a,mime:s}=Pt(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}))},dE=(e,t,r,n)=>{r.type="boolean"},Wf=(e,t,r,n)=>{Ze(e,t,r,n,"Custom types cannot be represented in JSON Schema")},uE=(e,t,r,n)=>{Ze(e,t,r,n,"Function types cannot be represented in JSON Schema")},Zf=(e,t,r,n)=>{Ze(e,t,r,n,"Transforms cannot be represented in JSON Schema")},pE=(e,t,r,n)=>{Ze(e,t,r,n,"Map cannot be represented in JSON Schema")},mE=(e,t,r,n)=>{Ze(e,t,r,n,"Set cannot be represented in JSON Schema")},Kf=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=Pt(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"]})},Jf=(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)jt(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"?us(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"]})},Vf=(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},Yf=(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)},Xf=(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"?us(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}=Pt(e);if(typeof g==="number")o.minItems=g;if(typeof h==="number")o.maxItems=h},Nf,Qf=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,s=Pt(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)jt(o.patternProperties,eE(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=Nf.get(t);if(!d)d=[],Nf.set(t,d),t.deferred.push(()=>A4(t));d.push(e)}o.additionalProperties=ke(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=a._zod.values,c=t.io==="input"&&us(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)}},eg=(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"}]},tg=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},rg,ng=(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=fE(o.defaultValue,e,t,r,n);if(a!==rg)r.default=a},og=(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=fE(o.defaultValue,e,t,r,n);if(a!==rg)r._prefault=a},ig=(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},ag=(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},sg=(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},gE=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},kd=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},yE=(e,t,r,n)=>{let o=e._zod.innerType;ke(o,t,n);let i=t.seen.get(e);i.ref=o},JR;var lg=m(()=>{es();yf();bd();xt();I4={greater_than:(e,t)=>ji(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Li(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>VR(e,t.value),number_format:KR(Gc),bigint_format:KR(Km),min_length:WR,max_length:ZR,length_equals:(e,t)=>qR(e,t.length),min_size:WR,max_size:ZR,size_equals:(e,t)=>qR(e,t.size),string_format:(e,t)=>{if(QR(e,t.format),t.pattern)YR(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)=>XR(e,t.mime)};j4={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},L4=new Map([[pf,uP],[id,pP]]);Nf=new WeakMap;rg=Symbol();JR={string:Ff,number:Mf,boolean:zf,bigint:tE,symbol:rE,null:Bf,undefined:nE,void:oE,never:Uf,any:iE,unknown:Gf,date:aE,enum:Hf,literal:qf,nan:sE,template_literal:lE,file:cE,success:dE,custom:Wf,function:uE,transform:Zf,map:pE,set:mE,array:Kf,object:Jf,union:Vf,intersection:Yf,tuple:Xf,record:Qf,nullable:eg,nonoptional:tg,default:ng,prefault:og,catch:ig,pipe:ag,readonly:sg,promise:gE,optional:kd,lazy:yE}});var hE=()=>{};var Er=m(()=>{xt();es();kf();hE();vo();Jx();Mx();yf();tR();ed();cf();vf();aR();FR();bd()});var cg=m(()=>{Er()});function vd(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 wE,bE=(e,t)=>{Tx.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(wE.has(r))return;wE.add(r),vd(r,"format",(n)=>(o)=>Fx(n,o)),vd(r,"flatten",(n)=>(o)=>Nx(n,o)),vd(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ka,2)}),vd(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Ka,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},dg,Ot;var ug=m(()=>{Er();Er();xt();wE=new WeakSet([Object.prototype,Error.prototype]);dg=C("ZodError",bE),Ot=C("ZodError",bE,void 0,{Parent:Error})});var kE,vE,xE,PE,SE,RE,EE,CE,$E,_E,IE,jE;var pg=m(()=>{Er();ug();Er();kE=Jc(Ot),vE=Vc(Ot),xE=Yc(Ot),PE=Xc(Ot),SE=Bx(Ot),RE=Ux(Ot),EE=Gx(Ot),CE=Hx(Ot),$E=qx(Ot),_E=Wx(Ot),IE=Zx(Ot),jE=Kx(Ot)});function U4(){if(!ut.localeError)At(bf())}function fs(){if(!ut.memoizer)At({memoizer:eR()})}function f(e){return lR(G4,e)}function it(e){return xf(ms,e)}function Cr(e){return Pf(FE,e)}function F(e){return _R(ME,e)}function LE(e){return IR(s6,e)}function K(e){return jR(l6,e)}function Oi(e){return LR(c6,e)}function Me(){return AR(d6)}function zE(e){return OR(u6,e)}function k(e,t){return DR(p6,e,t)}function P(e,t){let r={type:"object",shape:e??{},...W(t)};return new BE(r)}function _(e,t){return new BE({type:"object",shape:e,catchall:zE(),...W(t)})}function GE(e,t){return new UE({type:"union",options:e,...W(t)})}function Yr(e,t,r){return new m6({type:"union",options:t,discriminator:e,...W(r)})}function HE(e,t){return new f6({type:"intersection",left:e,right:t})}function fg(e,t,r){let n=t instanceof be,o=n?r:t;return new g6({type:"tuple",items:e,rest:n?t:null,...W(o)})}function re(e,t,r){if(!t||!t._zod)return new AE({type:"record",keyType:f(),valueType:e,...W(t)});return new AE({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 mg({type:"enum",entries:r,...W(t)})}function J(e,t){return new y6({type:"literal",values:Array.isArray(e)?e:[e],...W(t)})}function w6(e){return new h6({type:"transform",transform:e})}function OE(e){return new gg({type:"optional",innerType:e})}function b6(e){return new qE({type:"optional",innerType:e})}function DE(e){return new k6({type:"nullable",innerType:e})}function x6(e,t){return new v6({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Wm(t)}})}function S6(e,t){return new P6({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Wm(t)}})}function R6(e,t){return new WE({type:"nonoptional",innerType:e,...W(t)})}function C6(e,t){return new E6({type:"catch",innerType:e,catchValue:typeof t==="function"?t:jx(t)})}function TE(e,t){return new $6({type:"pipe",in:e,out:t})}function I6(e){return new _6({type:"readonly",innerType:e})}function L6(e,t={}){return TR(j6,e,t)}function A6(e,t){return NR(e,t)}var Pe,NE,G4,_e,gs,ys,hs,ws,H4,q4,ms,FE,W4,Z4,K4,J4,V4,Y4,X4,Q4,e6,t6,r6,n6,o6,i6,a6,ME,s6,l6,c6,d6,u6,p6,BE,UE,m6,f6,g6,AE,mg,y6,h6,gg,qE,k6,v6,P6,WE,E6,$6,_6,j6;var xd=m(()=>{Er();Er();lg();bd();rR();cg();pg();Pe=C("ZodType",(e,t)=>(U4(),be.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Lt(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 xr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(L6(e,t))},superRefine(e,t){return this.check(A6(e,t))},overwrite(e){return this.check(On(e))},optional(){return OE(this)},exactOptional(){return b6(this)},nullable(){return DE(this)},nullish(){return OE(DE(this))},nonoptional(e){return R6(this,e)},array(){return k(this)},or(e){return GE([this,e])},and(e){return HE(this,e)},transform(e){return TE(this,w6(e))},default(e){return x6(this,e)},prefault(e){return S6(this,e)},catch(e){return C6(this,e)},pipe(e){return TE(this,e)},readonly(){return I6(this)},describe(e){let t=this.clone();return xo.add(t,{description:e}),t},meta(...e){if(e.length===0)return xo.get(this);let t=this.clone();return xo.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 Zc(this,"~standard",{...uf(this),jsonSchema:{input:ss(this,"input"),output:ss(this,"output")}})},set "~standard"(e){Vr(this,"~standard",e)},parse:function e(t,r){return kE(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await vE(this,t,r,{callee:e})},safeParse(e,t){return xE(this,e,t)},async safeParseAsync(e,t){return PE(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Vr(this,"spa",e)},validate(e,t){return Qm(this,e,t)},validateAsync(e,t){return ef(this,e,t)},encode:function e(t,r){return SE(this,t,r,{callee:e})},decode:function e(t,r){return RE(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await EE(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await CE(this,t,r,{callee:e})},safeEncode(e,t){return $E(this,e,t)},safeDecode(e,t){return _E(this,e,t)},async safeEncodeAsync(e,t){return IE(this,e,t)},async safeDecodeAsync(e,t){return jE(this,e,t)},toJSONSchema(e){return HR(this,{})(e)},get description(){return xo.get(this)?.description},get _def(){return this._zod.def}}),NE=C("_ZodString",(e,t)=>{od.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o)},Ix({format:(e)=>Pt(e).format??null,minLength:(e)=>Pt(e).minimum??null,maxLength:(e)=>Pt(e).maximum??null},{regex(...e){return this.check(Sf(...e))},includes(...e){return this.check(Cf(...e))},startsWith(...e){return this.check($f(...e))},endsWith(...e){return this.check(_f(...e))},min(...e){return this.check(Ii(...e))},max(...e){return this.check(hd(...e))},length(...e){return this.check(wd(...e))},nonempty(...e){return this.check(Ii(1,...e))},lowercase(e){return this.check(Rf(e))},uppercase(e){return this.check(Ef(e))},trim(){return this.check(jf())},normalize(...e){return this.check(If(...e))},toLowerCase(){return this.check(Lf())},toUpperCase(){return this.check(Af())},slugify(){return this.check(Of())}})),G4=C("ZodString",(e,t)=>{od.init(e,t),NE.init(e,t)},{email(e){return this.check(cR(H4,e))},url(e){return this.check(Pf(FE,e))},jwt(e){return this.check($R(a6,e))},emoji(e){return this.check(fR(W4,e))},guid(e){return this.check(dR(q4,e))},uuid(e){return this.check(xf(ms,e))},uuidv4(e){return this.check(uR(ms,e))},uuidv6(e){return this.check(pR(ms,e))},uuidv7(e){return this.check(mR(ms,e))},nanoid(e){return this.check(gR(Z4,e))},cuid(e){return this.check(yR(K4,e))},cuid2(e){return this.check(hR(J4,e))},ulid(e){return this.check(wR(V4,e))},base64(e){return this.check(RR(n6,e))},base64url(e){return this.check(ER(o6,e))},xid(e){return this.check(bR(Y4,e))},ksuid(e){return this.check(kR(X4,e))},ipv4(e){return this.check(vR(Q4,e))},ipv6(e){return this.check(xR(e6,e))},cidrv4(e){return this.check(PR(t6,e))},cidrv6(e){return this.check(SR(r6,e))},e164(e){return this.check(CR(i6,e))},datetime(e){return this.check(dd(gs,e))},date(e){return this.check(ud(ys,e))},time(e){return this.check(pd(hs,e))},duration(e){return this.check(md(ws,e))}});_e=C("ZodStringFormat",(e,t)=>{xe.init(e,t),NE.init(e,t)}),gs=C("ZodISODateTime",(e,t)=>{uS.init(e,t),_e.init(e,t)}),ys=C("ZodISODate",(e,t)=>{pS.init(e,t),_e.init(e,t)}),hs=C("ZodISOTime",(e,t)=>{mS.init(e,t),_e.init(e,t)}),ws=C("ZodISODuration",(e,t)=>{fS.init(e,t),_e.init(e,t)}),H4=C("ZodEmail",(e,t)=>{eS.init(e,t),_e.init(e,t)}),q4=C("ZodGUID",(e,t)=>{XP.init(e,t),_e.init(e,t)}),ms=C("ZodUUID",(e,t)=>{QP.init(e,t),_e.init(e,t)});FE=C("ZodURL",(e,t)=>{nS.init(e,t),_e.init(e,t)});W4=C("ZodEmoji",(e,t)=>{oS.init(e,t),_e.init(e,t)}),Z4=C("ZodNanoID",(e,t)=>{iS.init(e,t),_e.init(e,t)}),K4=C("ZodCUID",(e,t)=>{aS.init(e,t),_e.init(e,t)}),J4=C("ZodCUID2",(e,t)=>{sS.init(e,t),_e.init(e,t)}),V4=C("ZodULID",(e,t)=>{lS.init(e,t),_e.init(e,t)}),Y4=C("ZodXID",(e,t)=>{cS.init(e,t),_e.init(e,t)}),X4=C("ZodKSUID",(e,t)=>{dS.init(e,t),_e.init(e,t)}),Q4=C("ZodIPv4",(e,t)=>{gS.init(e,t),_e.init(e,t)}),e6=C("ZodIPv6",(e,t)=>{hS.init(e,t),_e.init(e,t)}),t6=C("ZodCIDRv4",(e,t)=>{wS.init(e,t),_e.init(e,t)}),r6=C("ZodCIDRv6",(e,t)=>{bS.init(e,t),_e.init(e,t)}),n6=C("ZodBase64",(e,t)=>{vS.init(e,t),_e.init(e,t)}),o6=C("ZodBase64URL",(e,t)=>{xS.init(e,t),_e.init(e,t)}),i6=C("ZodE164",(e,t)=>{PS.init(e,t),_e.init(e,t)}),a6=C("ZodJWT",(e,t)=>{SS.init(e,t),_e.init(e,t)}),ME=C("ZodNumber",(e,t)=>{mf.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mf(e,r,n,o),e.isFinite=!0},Ix({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Pt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Pt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Pt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Pt(e).format??null},{gt(e,t){return this.check(gd(e,t))},gte(e,t){return this.check(is(e,t))},min(e,t){return this.check(is(e,t))},lt(e,t){return this.check(fd(e,t))},lte(e,t){return this.check(os(e,t))},max(e,t){return this.check(os(e,t))},int(e){return this.check(LE(e))},safe(e){return this.check(LE(e))},positive(e){return this.check(gd(0,e))},nonnegative(e){return this.check(is(0,e))},negative(e){return this.check(fd(0,e))},nonpositive(e){return this.check(os(0,e))},multipleOf(e,t){return this.check(yd(e,t))},step(e,t){return this.check(yd(e,t))},finite(){return this}}));s6=C("ZodNumberFormat",(e,t)=>{RS.init(e,t),ME.init(e,t)});l6=C("ZodBoolean",(e,t)=>{ES.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zf(e,r,n,o)});c6=C("ZodNull",(e,t)=>{CS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bf(e,r,n,o)});d6=C("ZodUnknown",(e,t)=>{$S.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o)});u6=C("ZodNever",(e,t)=>{_S.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o)});p6=C("ZodArray",(e,t)=>{fs(),IS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kf(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Ii(e,t))},nonempty(e){return this.check(Ii(1,e))},max(e,t){return this.check(hd(e,t))},length(e,t){return this.check(wd(e,t))},unwrap(){return this.element}});BE=C("ZodObject",(e,t)=>{fs(),AS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o),Y2(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return D(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Lt(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Lt(this._zod.def,{catchall:Me()}))},loose(){return this.clone(Lt(this._zod.def,{catchall:Me()}))},strict(){return this.clone(Lt(this._zod.def,{catchall:zE()}))},strip(){return this.clone(Lt(this._zod.def,{catchall:void 0}))},extend(e){return G2(this,e)},safeExtend(e){return H2(this,e)},merge(e){return q2(this,e)},pick(e){return B2(this,e)},omit(e){return U2(this,e)},partial(...e){return Ex(gg,this,e[0])},exactPartial(...e){return Ex(qE,this,e[0],"exactPartial")},required(...e){return W2(WE,this,e[0])}});UE=C("ZodUnion",(e,t)=>{ff.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o),e.options=t.options});m6=C("ZodDiscriminatedUnion",(e,t)=>{UE.init(e,t),OS.init(e,t)});f6=C("ZodIntersection",(e,t)=>{DS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yf(e,r,n,o)});g6=C("ZodTuple",(e,t)=>{fs(),TS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(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 gg({type:"optional",innerType:t}))})}});AE=C("ZodRecord",(e,t)=>{fs(),NS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});mg=C("ZodEnum",(e,t)=>{FS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Hf(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 mg({...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 mg({...t,checks:[],...W(o),entries:i})}});y6=C("ZodLiteral",(e,t)=>{MS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(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]}})});h6=C("ZodTransform",(e,t)=>{fs(),zS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ya(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ko(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(ko(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}});gg=C("ZodOptional",(e,t)=>{gf.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});qE=C("ZodExactOptional",(e,t)=>{BS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});k6=C("ZodNullable",(e,t)=>{US.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});v6=C("ZodDefault",(e,t)=>{GS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ng(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});P6=C("ZodPrefault",(e,t)=>{HS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>og(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});WE=C("ZodNonOptional",(e,t)=>{qS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});E6=C("ZodCatch",(e,t)=>{WS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ig(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});$6=C("ZodPipe",(e,t)=>{ZS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ag(e,r,n,o),e.in=t.in,e.out=t.out});_6=C("ZodReadonly",(e,t)=>{KS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});j6=C("ZodCustom",(e,t)=>{JS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o)})});var ZE;var KE=m(()=>{(function(e){})(ZE||(ZE={}))});var Pd={};zm(Pd,{ZodISODate:()=>ys,ZodISODateTime:()=>gs,ZodISODuration:()=>ws,ZodISOTime:()=>hs,date:()=>D6,datetime:()=>O6,duration:()=>N6,time:()=>T6});function O6(e){return dd(gs,e)}function D6(e){return ud(ys,e)}function T6(e){return pd(hs,e)}function N6(e){return md(ws,e)}var JE=m(()=>{Er();xd();xd()});var VE=()=>{};var yg=m(()=>{Er();lg();kf();JE();VE();xd();cg();ug();pg();KE()});var A=m(()=>{yg();yg()});var Dn;var bs=m(()=>{Dn={name:"@shadowclone/cli",version:"0.0.29"}});import{stat as z6}from"fs/promises";import Tn from"path";async function YE(e){return z6(e).then((t)=>t.isDirectory()).catch(()=>!1)}async function QE(e){let t=Bun.file(Tn.join(e,"package.json"));return await t.exists()?await t.json().catch(()=>null):null}async function e0(e){return await YE(Tn.join(e,"skills"))&&await YE(Tn.join(e,"preferences"))}async function H6(e){let t=B6.safeParse(await QE(e));return t.success&&t.data.name===Dn.name&&await e0(e)}async function q6(e){let t=U6.safeParse(await QE(e));return t.success&&t.data.workspaces.includes(G6)&&await e0(e)}async function W6(e){let t=e;while(!t.split(Tn.sep).includes("node_modules")){if(await q6(t))return t;let r=Tn.dirname(t);if(r===t)return null;t=r}return null}function XE(e){return{preferences:Tn.join(e,"preferences"),skills:Tn.join(e,"skills")}}async function Z6(e){let t=Tn.resolve(e,"..");if(await H6(t))return XE(t);let r=await W6(t);if(r!==null)return XE(r);throw Error("The packaged seed guidance directories are missing")}async function hg(){return Z6(import.meta.dir)}async function $r(){return(await hg()).skills}var B6,U6,G6="packages/*";var t0=m(()=>{A();bs();B6=P({name:f()}),U6=P({workspaces:k(f())})});var Nn=8388608,Di=1048576,Fn=8388608,mt=1048576,r0=16777216,n0=1048576,o0=65536;async function i0(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 Po("output");r.push(o.value)}}finally{await t.cancel().catch(()=>{return}),t.releaseLock()}}async function Se(e){let t=AbortSignal.timeout(e.timeoutMilliseconds??600000),r=e.signal?AbortSignal.any([t,e.signal]):t;if(r.aborted)throw new Po("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([i0({stream:n.stdout,maximumBytes:e.maximumOutputBytes??r0,overflow:o}),i0({stream:n.stderr,maximumBytes:n0,overflow:o}),n.exited,(async()=>{try{n.stdin.write(e.input??""),await n.stdin.flush()}finally{n.stdin.end()}})()]);if(r.aborted)throw new Po("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(-o0)}}finally{o(),r.removeEventListener("abort",o)}}var Po;var Sd=m(()=>{Po=class Po extends Error{constructor(e){super(e==="output"?"Process output limit exceeded":"Process cancelled or timed out");this.name="ProcessLimitError"}}});async function a0(e){let t=[];for(let r of["user.name","user.email"]){let n=await Se({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 s0=m(()=>{Sd()});function Rd(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=Rd({remote:n}),i=[...K6];if(t==="git"&&!r.includes("config")){if((await Se({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 a0({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 Se({arguments:t==="git"?["git",...i,...r]:[t,...r],cwd:e.cwd,environment:o,timeoutMilliseconds:(e.timeoutSeconds??60)*1000,signal:e.signal})}var K6;var wg=m(()=>{s0();Sd();K6=["-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 ks(e){return ze({arguments:e.command,cwd:e.cwd})}var l0=m(()=>{wg()});import{constants as bg}from"fs";import{lstat as J6,open as V6,realpath as c0}from"fs/promises";import Xr from"path";function d0(e){let t=Xr.relative(e.root,e.target);return t===""||!t.startsWith(`..${Xr.sep}`)&&t!==".."&&!Xr.isAbsolute(t)}async function Ed(e){if(!Xr.isAbsolute(e.filePath))return null;let t=await c0(e.filePath).catch(()=>null);if(t===null)return null;for(let r of e.roots){if(!d0({root:Xr.resolve(r),target:Xr.resolve(e.filePath)}))continue;let n=await c0(r).catch(()=>null);if(n===null||!d0({root:n,target:t}))continue;let o=Xr.resolve(e.filePath);while(!0){if((await J6(o)).isSymbolicLink())return null;if(o===Xr.resolve(r))return t;o=Xr.dirname(o)}}return null}async function Qe(e){let t=await Ed(e);if(t===null)return null;let r=await V6(t,bg.O_RDONLY|bg.O_NOFOLLOW|bg.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 u0=()=>{};var p0=m(()=>{l0();u0();wg();Sd()});import{constants as $d}from"fs";import{lstat as kg,mkdir as Y6,open as vg,realpath as X6,rename as Q6,rm as e3}from"fs/promises";import _r from"path";async function Cd(e){let t=_r.resolve(e),r=await kg(t).catch(()=>null);if(r===null){let o=await Cd(_r.dirname(t)),i=_r.join(o,_r.basename(t));return await Y6(i,{mode:Ti,recursive:!0}),Cd(i)}if(r.isSymbolicLink()){if(t==="/tmp"||t==="/var")return X6(t);throw Error("Storage directory must not be a symbolic link")}if(!r.isDirectory())throw Error("Storage parent must be a directory");let n=_r.dirname(t);if(n===t)return t;return _r.join(await Cd(n),_r.basename(t))}async function dr(e){let t=await Cd(e),r=await vg(t,$d.O_RDONLY|$d.O_NOFOLLOW);try{if((await r.stat()).uid!==process.getuid?.())throw Error("Storage directory must be owned by the current user");await r.chmod(Ti)}finally{await r.close()}}async function Ke(e){let t=_r.dirname(e.path);await dr(t);let r=await kg(e.path).catch(()=>null);if(r&&(!r.isFile()||r.isSymbolicLink()))throw Error("Storage target must be a regular file");let n=_r.join(t,`.${_r.basename(e.path)}.${crypto.randomUUID()}.partial`);try{let o=await vg(n,"wx",Ni);try{await o.writeFile(e.content),await o.sync()}finally{await o.close()}await Q6(n,e.path)}finally{await e3(n,{force:!0})}}async function Mn(e){if(await kg(e).catch(()=>null)===null)return;let r=await vg(e,$d.O_RDONLY|$d.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(Ni)}finally{await r.close()}}var Ti=448,Ni=384;var xg=()=>{};import{chmod as m0,lstat as t3,readdir as r3}from"fs/promises";import f0 from"path";function n3(e){return typeof e==="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}async function g0(e){let t=await t3(e.entryPath);if(t.isDirectory()){if((t.mode&511)!==Ti)await m0(e.entryPath,Ti),e.summary.directories+=1;if(e.entryPath===f0.join(e.root,"worktrees")){e.summary.skipped+=1;return}let r=await r3(e.entryPath);for(let n of r)await g0({entryPath:f0.join(e.entryPath,n),root:e.root,summary:e.summary});return}if(!t.isFile()){e.summary.skipped+=1;return}if((t.mode&511)!==Ni)await m0(e.entryPath,Ni),e.summary.files+=1}async function vs(e){let t={directories:0,files:0,skipped:0};try{await g0({entryPath:e,root:e,summary:t})}catch(r){if(!n3(r))throw r}return t}var y0=m(()=>{xg()});var Pg=m(()=>{y0();xg()});import{rmdir as o3}from"fs/promises";import So from"path";function i3(e){let t=e.split(So.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(So.sep).endsWith(`${So.sep}.shadowclone${So.sep}builds`);return n.startsWith(".")||n==="config"||o?t.slice(0,r+2).join(So.sep):null}async function h0(e){let t=i3(e);if(t===null)return;for(let r=So.dirname(e);r.length>=t.length;r=So.dirname(r))if(!await o3(r).then(()=>!0,()=>!1))return}var w0=()=>{};import{existsSync as a3,lstatSync as Sg,readlinkSync as s3,realpathSync as l3}from"fs";import Qr from"path";function en(e){try{return l3(e)}catch{return null}}function Rg(e){let t=Qr.resolve(e);for(;;){if(Sg(t,{throwIfNoEntry:!1})?.isSymbolicLink())return{path:t,target:s3(t)};let r=Qr.dirname(t);if(r===t)return null;t=r}}function _d(e){let t=[],r=Qr.resolve(e);while(!a3(r)){let n=Qr.dirname(r);if(n===r)return Qr.resolve(e);t.unshift(Qr.basename(r)),r=n}return Qr.join(en(r)??r,...t)}function Eg(e){if(!Sg(e.filePath,{throwIfNoEntry:!1})?.isSymbolicLink())return null;let t=en(e.filePath),r=en(e.homeDirectory);if(t===null||r===null||!Sg(t).isFile())return null;let n=Qr.relative(r,t);return n!==""&&!n.startsWith("..")&&!Qr.isAbsolute(n)?t:null}var b0=()=>{};import{Database as c3}from"bun:sqlite";import{mkdir as d3}from"fs/promises";import u3 from"path";async function q(e){Vt(e),await d3(u3.dirname(e),{recursive:!0});let t=new c3(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 k0=m(()=>{Cg()});import{lstatSync as x0,readlinkSync as p3}from"fs";import{mkdir as m3,open as f3,rename as g3,rm as v0}from"fs/promises";import Id from"path";function E(e){return new Bun.CryptoHasher("sha256").update(e).digest("hex")}function Vt(e){let t=Id.resolve(e);for(;;){let r=x0(t,{throwIfNoEntry:!1});if(r?.isSymbolicLink()||t===Id.resolve(e)&&r&&!r.isFile())throw new Fi(t,r?.isSymbolicLink()?p3(t):null);let n=Id.dirname(t);if(n===t)return;t=n}}async function v(e){return Be({filePath:e})}async function Be(e){let{filePath:t}=e;Vt(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 v0(e.filePath,{force:!0}),await h0(e.filePath);return}await m3(Id.dirname(e.filePath),{recursive:!0});let t=`${e.filePath}.${crypto.randomUUID()}.tmp`;try{let r=x0(e.filePath,{throwIfNoEntry:!1})?.mode,n=await f3(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 g3(t,e.filePath)}finally{await v0(t,{force:!0})}}var Fi;var Cg=m(()=>{w0();b0();k0();Fi=class Fi 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 y3(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function h3(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 UR(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;UR(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 BR(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 Df(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let a in i)if(!GR.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]??BR(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]:Df(s)??{allOf:s};jt(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=BR(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 _4(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of GR)if(o in e)return;let r=t.filter((o)=>zR.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Df(t);else{let o=r[0],i=zR.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)=>Df([...a,l]));if(s.some((l)=>!l))return;n={[i]:s}}if(!n)return;delete e.allOf,as(e,n)}function ds(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 as(c,h);if(as(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())UR(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)??[])_4(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)}as(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;jt(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:ss(t,"input",e.processors),output:ss(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function pt(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 pt(n.element,r);if(n.type==="set")return pt(n.valueType,r);if(n.type==="lazy")return pt(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 pt(n.innerType,r);if(n.type==="intersection")return pt(n.left,r)||pt(n.right,r);if(n.type==="record"||n.type==="map")return pt(n.keyType,r)||pt(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return pt(n.in,r)||pt(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(pt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(pt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(pt(o,r))return!0;if(n.rest&&pt(n.rest,r))return!0;return!1}return!1}var GR,zR,HR=(e,t={})=>(r)=>{let n=ls({...r,processors:t});return ke(e,n),cs(n,e),ds(n,e)},ss=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},a=ls({...o??{},target:i,io:t,processors:r});return ke(e,a),cs(a,e),ds(a,e)};var bd=m(()=>{vf();xt();GR=new Set(["type","properties","required","additionalProperties"]),zR=["oneOf","anyOf"]});function Pt(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)I4[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ji(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ji(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Li(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Li(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)VR(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)XR(t,o.mime);for(let i of o.patterns??[])YR(t,i);return t}function us(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return us(t.out);if(t.type==="catch")return us(t.innerType);return e._zod.optin}function Tf(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=Tf(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)=>Tf(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")?Xa:nf).source;return g}function A4(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 Nf.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=Tf(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 fE(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"),rg}function Ai(e,t){if("_idmap"in e){let n=e,o=ls({...t,processors:JR}),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;cs(o,d),jt(a,c,ds(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=ls({...t,processors:JR});return ke(e,r),cs(r,e),ds(r,e)}var ji=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Li=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},qR=(e,t)=>{ji(e,"minimum",t),Li(e,"maximum",t)},VR=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},YR=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},XR=(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},WR=(e,t)=>ji(e,"minimum",t.minimum),ZR=(e,t)=>Li(e,"maximum",t.maximum),KR=(e)=>(t,r)=>{QR(t,r.format);let[n,o]=e[r.format];ji(t,"minimum",n),Li(t,"maximum",o)},I4,j4,L4,eE=(e)=>L4.get(e)??e,Ff=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:l,contentEncoding:c,laxFormat:d}=Pt(e);if(typeof i==="number")o.minLength=i;if(typeof a==="number")o.maxLength=a;if(s){if(o.format=j4[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(eE);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}))]}},Mf=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:d}=Pt(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}))]}},zf=(e,t,r,n)=>{r.type="boolean"},tE=(e,t,r,n)=>{Ze(e,t,r,n,"BigInt cannot be represented in JSON Schema")},rE=(e,t,r,n)=>{Ze(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Bf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},nE=(e,t,r,n)=>{Ze(e,t,r,n,"Undefined cannot be represented in JSON Schema")},oE=(e,t,r,n)=>{Ze(e,t,r,n,"Void cannot be represented in JSON Schema")},Uf=(e,t,r,n)=>{r.not={}},iE=(e,t,r,n)=>{},Gf=(e,t,r,n)=>{},aE=(e,t,r,n)=>{Ze(e,t,r,n,"Date cannot be represented in JSON Schema")},Hf=(e,t,r,n)=>{let o=e._zod.def,i=Za(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},qf=(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}},sE=(e,t,r,n)=>{Ze(e,t,r,n,"NaN cannot be represented in JSON Schema")},lE=(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},cE=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:a,mime:s}=Pt(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}))},dE=(e,t,r,n)=>{r.type="boolean"},Wf=(e,t,r,n)=>{Ze(e,t,r,n,"Custom types cannot be represented in JSON Schema")},uE=(e,t,r,n)=>{Ze(e,t,r,n,"Function types cannot be represented in JSON Schema")},Zf=(e,t,r,n)=>{Ze(e,t,r,n,"Transforms cannot be represented in JSON Schema")},pE=(e,t,r,n)=>{Ze(e,t,r,n,"Map cannot be represented in JSON Schema")},mE=(e,t,r,n)=>{Ze(e,t,r,n,"Set cannot be represented in JSON Schema")},Kf=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=Pt(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"]})},Jf=(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)jt(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"?us(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"]})},Vf=(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},Yf=(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)},Xf=(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"?us(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}=Pt(e);if(typeof g==="number")o.minItems=g;if(typeof h==="number")o.maxItems=h},Nf,Qf=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,s=Pt(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)jt(o.patternProperties,eE(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=Nf.get(t);if(!d)d=[],Nf.set(t,d),t.deferred.push(()=>A4(t));d.push(e)}o.additionalProperties=ke(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=a._zod.values,c=t.io==="input"&&us(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)}},eg=(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"}]},tg=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},rg,ng=(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=fE(o.defaultValue,e,t,r,n);if(a!==rg)r.default=a},og=(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=fE(o.defaultValue,e,t,r,n);if(a!==rg)r._prefault=a},ig=(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},ag=(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},sg=(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},gE=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},kd=(e,t,r,n)=>{let o=e._zod.def;ke(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},yE=(e,t,r,n)=>{let o=e._zod.innerType;ke(o,t,n);let i=t.seen.get(e);i.ref=o},JR;var lg=m(()=>{es();yf();bd();xt();I4={greater_than:(e,t)=>ji(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Li(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>VR(e,t.value),number_format:KR(Gc),bigint_format:KR(Km),min_length:WR,max_length:ZR,length_equals:(e,t)=>qR(e,t.length),min_size:WR,max_size:ZR,size_equals:(e,t)=>qR(e,t.size),string_format:(e,t)=>{if(QR(e,t.format),t.pattern)YR(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)=>XR(e,t.mime)};j4={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},L4=new Map([[pf,uP],[id,pP]]);Nf=new WeakMap;rg=Symbol();JR={string:Ff,number:Mf,boolean:zf,bigint:tE,symbol:rE,null:Bf,undefined:nE,void:oE,never:Uf,any:iE,unknown:Gf,date:aE,enum:Hf,literal:qf,nan:sE,template_literal:lE,file:cE,success:dE,custom:Wf,function:uE,transform:Zf,map:pE,set:mE,array:Kf,object:Jf,union:Vf,intersection:Yf,tuple:Xf,record:Qf,nullable:eg,nonoptional:tg,default:ng,prefault:og,catch:ig,pipe:ag,readonly:sg,promise:gE,optional:kd,lazy:yE}});var hE=()=>{};var Er=m(()=>{xt();es();kf();hE();vo();Jx();Mx();yf();tR();ed();cf();vf();aR();FR();bd()});var cg=m(()=>{Er()});function vd(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 wE,bE=(e,t)=>{Tx.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(wE.has(r))return;wE.add(r),vd(r,"format",(n)=>(o)=>Fx(n,o)),vd(r,"flatten",(n)=>(o)=>Nx(n,o)),vd(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ka,2)}),vd(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Ka,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},dg,Ot;var ug=m(()=>{Er();Er();xt();wE=new WeakSet([Object.prototype,Error.prototype]);dg=C("ZodError",bE),Ot=C("ZodError",bE,void 0,{Parent:Error})});var kE,vE,xE,PE,SE,RE,EE,CE,$E,_E,IE,jE;var pg=m(()=>{Er();ug();Er();kE=Jc(Ot),vE=Vc(Ot),xE=Yc(Ot),PE=Xc(Ot),SE=Bx(Ot),RE=Ux(Ot),EE=Gx(Ot),CE=Hx(Ot),$E=qx(Ot),_E=Wx(Ot),IE=Zx(Ot),jE=Kx(Ot)});function U4(){if(!ut.localeError)At(bf())}function fs(){if(!ut.memoizer)At({memoizer:eR()})}function f(e){return lR(G4,e)}function it(e){return xf(ms,e)}function Cr(e){return Pf(FE,e)}function F(e){return _R(ME,e)}function LE(e){return IR(s6,e)}function K(e){return jR(l6,e)}function Oi(e){return LR(c6,e)}function Me(){return AR(d6)}function zE(e){return OR(u6,e)}function k(e,t){return DR(p6,e,t)}function P(e,t){let r={type:"object",shape:e??{},...W(t)};return new BE(r)}function _(e,t){return new BE({type:"object",shape:e,catchall:zE(),...W(t)})}function GE(e,t){return new UE({type:"union",options:e,...W(t)})}function Yr(e,t,r){return new m6({type:"union",options:t,discriminator:e,...W(r)})}function HE(e,t){return new f6({type:"intersection",left:e,right:t})}function fg(e,t,r){let n=t instanceof be,o=n?r:t;return new g6({type:"tuple",items:e,rest:n?t:null,...W(o)})}function re(e,t,r){if(!t||!t._zod)return new AE({type:"record",keyType:f(),valueType:e,...W(t)});return new AE({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 mg({type:"enum",entries:r,...W(t)})}function J(e,t){return new y6({type:"literal",values:Array.isArray(e)?e:[e],...W(t)})}function w6(e){return new h6({type:"transform",transform:e})}function OE(e){return new gg({type:"optional",innerType:e})}function b6(e){return new qE({type:"optional",innerType:e})}function DE(e){return new k6({type:"nullable",innerType:e})}function x6(e,t){return new v6({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Wm(t)}})}function S6(e,t){return new P6({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Wm(t)}})}function R6(e,t){return new WE({type:"nonoptional",innerType:e,...W(t)})}function C6(e,t){return new E6({type:"catch",innerType:e,catchValue:typeof t==="function"?t:jx(t)})}function TE(e,t){return new $6({type:"pipe",in:e,out:t})}function I6(e){return new _6({type:"readonly",innerType:e})}function L6(e,t={}){return TR(j6,e,t)}function A6(e,t){return NR(e,t)}var Pe,NE,G4,_e,gs,ys,hs,ws,H4,q4,ms,FE,W4,Z4,K4,J4,V4,Y4,X4,Q4,e6,t6,r6,n6,o6,i6,a6,ME,s6,l6,c6,d6,u6,p6,BE,UE,m6,f6,g6,AE,mg,y6,h6,gg,qE,k6,v6,P6,WE,E6,$6,_6,j6;var xd=m(()=>{Er();Er();lg();bd();rR();cg();pg();Pe=C("ZodType",(e,t)=>(U4(),be.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Lt(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 xr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(L6(e,t))},superRefine(e,t){return this.check(A6(e,t))},overwrite(e){return this.check(On(e))},optional(){return OE(this)},exactOptional(){return b6(this)},nullable(){return DE(this)},nullish(){return OE(DE(this))},nonoptional(e){return R6(this,e)},array(){return k(this)},or(e){return GE([this,e])},and(e){return HE(this,e)},transform(e){return TE(this,w6(e))},default(e){return x6(this,e)},prefault(e){return S6(this,e)},catch(e){return C6(this,e)},pipe(e){return TE(this,e)},readonly(){return I6(this)},describe(e){let t=this.clone();return xo.add(t,{description:e}),t},meta(...e){if(e.length===0)return xo.get(this);let t=this.clone();return xo.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 Zc(this,"~standard",{...uf(this),jsonSchema:{input:ss(this,"input"),output:ss(this,"output")}})},set "~standard"(e){Vr(this,"~standard",e)},parse:function e(t,r){return kE(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await vE(this,t,r,{callee:e})},safeParse(e,t){return xE(this,e,t)},async safeParseAsync(e,t){return PE(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Vr(this,"spa",e)},validate(e,t){return Qm(this,e,t)},validateAsync(e,t){return ef(this,e,t)},encode:function e(t,r){return SE(this,t,r,{callee:e})},decode:function e(t,r){return RE(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await EE(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await CE(this,t,r,{callee:e})},safeEncode(e,t){return $E(this,e,t)},safeDecode(e,t){return _E(this,e,t)},async safeEncodeAsync(e,t){return IE(this,e,t)},async safeDecodeAsync(e,t){return jE(this,e,t)},toJSONSchema(e){return HR(this,{})(e)},get description(){return xo.get(this)?.description},get _def(){return this._zod.def}}),NE=C("_ZodString",(e,t)=>{od.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o)},Ix({format:(e)=>Pt(e).format??null,minLength:(e)=>Pt(e).minimum??null,maxLength:(e)=>Pt(e).maximum??null},{regex(...e){return this.check(Sf(...e))},includes(...e){return this.check(Cf(...e))},startsWith(...e){return this.check($f(...e))},endsWith(...e){return this.check(_f(...e))},min(...e){return this.check(Ii(...e))},max(...e){return this.check(hd(...e))},length(...e){return this.check(wd(...e))},nonempty(...e){return this.check(Ii(1,...e))},lowercase(e){return this.check(Rf(e))},uppercase(e){return this.check(Ef(e))},trim(){return this.check(jf())},normalize(...e){return this.check(If(...e))},toLowerCase(){return this.check(Lf())},toUpperCase(){return this.check(Af())},slugify(){return this.check(Of())}})),G4=C("ZodString",(e,t)=>{od.init(e,t),NE.init(e,t)},{email(e){return this.check(cR(H4,e))},url(e){return this.check(Pf(FE,e))},jwt(e){return this.check($R(a6,e))},emoji(e){return this.check(fR(W4,e))},guid(e){return this.check(dR(q4,e))},uuid(e){return this.check(xf(ms,e))},uuidv4(e){return this.check(uR(ms,e))},uuidv6(e){return this.check(pR(ms,e))},uuidv7(e){return this.check(mR(ms,e))},nanoid(e){return this.check(gR(Z4,e))},cuid(e){return this.check(yR(K4,e))},cuid2(e){return this.check(hR(J4,e))},ulid(e){return this.check(wR(V4,e))},base64(e){return this.check(RR(n6,e))},base64url(e){return this.check(ER(o6,e))},xid(e){return this.check(bR(Y4,e))},ksuid(e){return this.check(kR(X4,e))},ipv4(e){return this.check(vR(Q4,e))},ipv6(e){return this.check(xR(e6,e))},cidrv4(e){return this.check(PR(t6,e))},cidrv6(e){return this.check(SR(r6,e))},e164(e){return this.check(CR(i6,e))},datetime(e){return this.check(dd(gs,e))},date(e){return this.check(ud(ys,e))},time(e){return this.check(pd(hs,e))},duration(e){return this.check(md(ws,e))}});_e=C("ZodStringFormat",(e,t)=>{xe.init(e,t),NE.init(e,t)}),gs=C("ZodISODateTime",(e,t)=>{uS.init(e,t),_e.init(e,t)}),ys=C("ZodISODate",(e,t)=>{pS.init(e,t),_e.init(e,t)}),hs=C("ZodISOTime",(e,t)=>{mS.init(e,t),_e.init(e,t)}),ws=C("ZodISODuration",(e,t)=>{fS.init(e,t),_e.init(e,t)}),H4=C("ZodEmail",(e,t)=>{eS.init(e,t),_e.init(e,t)}),q4=C("ZodGUID",(e,t)=>{XP.init(e,t),_e.init(e,t)}),ms=C("ZodUUID",(e,t)=>{QP.init(e,t),_e.init(e,t)});FE=C("ZodURL",(e,t)=>{nS.init(e,t),_e.init(e,t)});W4=C("ZodEmoji",(e,t)=>{oS.init(e,t),_e.init(e,t)}),Z4=C("ZodNanoID",(e,t)=>{iS.init(e,t),_e.init(e,t)}),K4=C("ZodCUID",(e,t)=>{aS.init(e,t),_e.init(e,t)}),J4=C("ZodCUID2",(e,t)=>{sS.init(e,t),_e.init(e,t)}),V4=C("ZodULID",(e,t)=>{lS.init(e,t),_e.init(e,t)}),Y4=C("ZodXID",(e,t)=>{cS.init(e,t),_e.init(e,t)}),X4=C("ZodKSUID",(e,t)=>{dS.init(e,t),_e.init(e,t)}),Q4=C("ZodIPv4",(e,t)=>{gS.init(e,t),_e.init(e,t)}),e6=C("ZodIPv6",(e,t)=>{hS.init(e,t),_e.init(e,t)}),t6=C("ZodCIDRv4",(e,t)=>{wS.init(e,t),_e.init(e,t)}),r6=C("ZodCIDRv6",(e,t)=>{bS.init(e,t),_e.init(e,t)}),n6=C("ZodBase64",(e,t)=>{vS.init(e,t),_e.init(e,t)}),o6=C("ZodBase64URL",(e,t)=>{xS.init(e,t),_e.init(e,t)}),i6=C("ZodE164",(e,t)=>{PS.init(e,t),_e.init(e,t)}),a6=C("ZodJWT",(e,t)=>{SS.init(e,t),_e.init(e,t)}),ME=C("ZodNumber",(e,t)=>{mf.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mf(e,r,n,o),e.isFinite=!0},Ix({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Pt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Pt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Pt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Pt(e).format??null},{gt(e,t){return this.check(gd(e,t))},gte(e,t){return this.check(is(e,t))},min(e,t){return this.check(is(e,t))},lt(e,t){return this.check(fd(e,t))},lte(e,t){return this.check(os(e,t))},max(e,t){return this.check(os(e,t))},int(e){return this.check(LE(e))},safe(e){return this.check(LE(e))},positive(e){return this.check(gd(0,e))},nonnegative(e){return this.check(is(0,e))},negative(e){return this.check(fd(0,e))},nonpositive(e){return this.check(os(0,e))},multipleOf(e,t){return this.check(yd(e,t))},step(e,t){return this.check(yd(e,t))},finite(){return this}}));s6=C("ZodNumberFormat",(e,t)=>{RS.init(e,t),ME.init(e,t)});l6=C("ZodBoolean",(e,t)=>{ES.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zf(e,r,n,o)});c6=C("ZodNull",(e,t)=>{CS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bf(e,r,n,o)});d6=C("ZodUnknown",(e,t)=>{$S.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o)});u6=C("ZodNever",(e,t)=>{_S.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o)});p6=C("ZodArray",(e,t)=>{fs(),IS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kf(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Ii(e,t))},nonempty(e){return this.check(Ii(1,e))},max(e,t){return this.check(hd(e,t))},length(e,t){return this.check(wd(e,t))},unwrap(){return this.element}});BE=C("ZodObject",(e,t)=>{fs(),AS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o),Y2(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return D(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Lt(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Lt(this._zod.def,{catchall:Me()}))},loose(){return this.clone(Lt(this._zod.def,{catchall:Me()}))},strict(){return this.clone(Lt(this._zod.def,{catchall:zE()}))},strip(){return this.clone(Lt(this._zod.def,{catchall:void 0}))},extend(e){return G2(this,e)},safeExtend(e){return H2(this,e)},merge(e){return q2(this,e)},pick(e){return B2(this,e)},omit(e){return U2(this,e)},partial(...e){return Ex(gg,this,e[0])},exactPartial(...e){return Ex(qE,this,e[0],"exactPartial")},required(...e){return W2(WE,this,e[0])}});UE=C("ZodUnion",(e,t)=>{ff.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o),e.options=t.options});m6=C("ZodDiscriminatedUnion",(e,t)=>{UE.init(e,t),OS.init(e,t)});f6=C("ZodIntersection",(e,t)=>{DS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yf(e,r,n,o)});g6=C("ZodTuple",(e,t)=>{fs(),TS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(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 gg({type:"optional",innerType:t}))})}});AE=C("ZodRecord",(e,t)=>{fs(),NS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});mg=C("ZodEnum",(e,t)=>{FS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Hf(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 mg({...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 mg({...t,checks:[],...W(o),entries:i})}});y6=C("ZodLiteral",(e,t)=>{MS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(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]}})});h6=C("ZodTransform",(e,t)=>{fs(),zS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ya(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ko(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(ko(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}});gg=C("ZodOptional",(e,t)=>{gf.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});qE=C("ZodExactOptional",(e,t)=>{BS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kd(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});k6=C("ZodNullable",(e,t)=>{US.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});v6=C("ZodDefault",(e,t)=>{GS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ng(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});P6=C("ZodPrefault",(e,t)=>{HS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>og(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});WE=C("ZodNonOptional",(e,t)=>{qS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});E6=C("ZodCatch",(e,t)=>{WS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ig(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});$6=C("ZodPipe",(e,t)=>{ZS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ag(e,r,n,o),e.in=t.in,e.out=t.out});_6=C("ZodReadonly",(e,t)=>{KS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});j6=C("ZodCustom",(e,t)=>{JS.init(e,t),Pe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o)})});var ZE;var KE=m(()=>{(function(e){})(ZE||(ZE={}))});var Pd={};zm(Pd,{ZodISODate:()=>ys,ZodISODateTime:()=>gs,ZodISODuration:()=>ws,ZodISOTime:()=>hs,date:()=>D6,datetime:()=>O6,duration:()=>N6,time:()=>T6});function O6(e){return dd(gs,e)}function D6(e){return ud(ys,e)}function T6(e){return pd(hs,e)}function N6(e){return md(ws,e)}var JE=m(()=>{Er();xd();xd()});var VE=()=>{};var yg=m(()=>{Er();lg();kf();JE();VE();xd();cg();ug();pg();KE()});var A=m(()=>{yg();yg()});var Dn;var bs=m(()=>{Dn={name:"@shadowclone/cli",version:"0.0.30"}});import{stat as z6}from"fs/promises";import Tn from"path";async function YE(e){return z6(e).then((t)=>t.isDirectory()).catch(()=>!1)}async function QE(e){let t=Bun.file(Tn.join(e,"package.json"));return await t.exists()?await t.json().catch(()=>null):null}async function e0(e){return await YE(Tn.join(e,"skills"))&&await YE(Tn.join(e,"preferences"))}async function H6(e){let t=B6.safeParse(await QE(e));return t.success&&t.data.name===Dn.name&&await e0(e)}async function q6(e){let t=U6.safeParse(await QE(e));return t.success&&t.data.workspaces.includes(G6)&&await e0(e)}async function W6(e){let t=e;while(!t.split(Tn.sep).includes("node_modules")){if(await q6(t))return t;let r=Tn.dirname(t);if(r===t)return null;t=r}return null}function XE(e){return{preferences:Tn.join(e,"preferences"),skills:Tn.join(e,"skills")}}async function Z6(e){let t=Tn.resolve(e,"..");if(await H6(t))return XE(t);let r=await W6(t);if(r!==null)return XE(r);throw Error("The packaged seed guidance directories are missing")}async function hg(){return Z6(import.meta.dir)}async function $r(){return(await hg()).skills}var B6,U6,G6="packages/*";var t0=m(()=>{A();bs();B6=P({name:f()}),U6=P({workspaces:k(f())})});var Nn=8388608,Di=1048576,Fn=8388608,mt=1048576,r0=16777216,n0=1048576,o0=65536;async function i0(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 Po("output");r.push(o.value)}}finally{await t.cancel().catch(()=>{return}),t.releaseLock()}}async function Se(e){let t=AbortSignal.timeout(e.timeoutMilliseconds??600000),r=e.signal?AbortSignal.any([t,e.signal]):t;if(r.aborted)throw new Po("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([i0({stream:n.stdout,maximumBytes:e.maximumOutputBytes??r0,overflow:o}),i0({stream:n.stderr,maximumBytes:n0,overflow:o}),n.exited,(async()=>{try{n.stdin.write(e.input??""),await n.stdin.flush()}finally{n.stdin.end()}})()]);if(r.aborted)throw new Po("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(-o0)}}finally{o(),r.removeEventListener("abort",o)}}var Po;var Sd=m(()=>{Po=class Po extends Error{constructor(e){super(e==="output"?"Process output limit exceeded":"Process cancelled or timed out");this.name="ProcessLimitError"}}});async function a0(e){let t=[];for(let r of["user.name","user.email"]){let n=await Se({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 s0=m(()=>{Sd()});function Rd(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=Rd({remote:n}),i=[...K6];if(t==="git"&&!r.includes("config")){if((await Se({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 a0({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 Se({arguments:t==="git"?["git",...i,...r]:[t,...r],cwd:e.cwd,environment:o,timeoutMilliseconds:(e.timeoutSeconds??60)*1000,signal:e.signal})}var K6;var wg=m(()=>{s0();Sd();K6=["-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 ks(e){return ze({arguments:e.command,cwd:e.cwd})}var l0=m(()=>{wg()});import{constants as bg}from"fs";import{lstat as J6,open as V6,realpath as c0}from"fs/promises";import Xr from"path";function d0(e){let t=Xr.relative(e.root,e.target);return t===""||!t.startsWith(`..${Xr.sep}`)&&t!==".."&&!Xr.isAbsolute(t)}async function Ed(e){if(!Xr.isAbsolute(e.filePath))return null;let t=await c0(e.filePath).catch(()=>null);if(t===null)return null;for(let r of e.roots){if(!d0({root:Xr.resolve(r),target:Xr.resolve(e.filePath)}))continue;let n=await c0(r).catch(()=>null);if(n===null||!d0({root:n,target:t}))continue;let o=Xr.resolve(e.filePath);while(!0){if((await J6(o)).isSymbolicLink())return null;if(o===Xr.resolve(r))return t;o=Xr.dirname(o)}}return null}async function Qe(e){let t=await Ed(e);if(t===null)return null;let r=await V6(t,bg.O_RDONLY|bg.O_NOFOLLOW|bg.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 u0=()=>{};var p0=m(()=>{l0();u0();wg();Sd()});import{constants as $d}from"fs";import{lstat as kg,mkdir as Y6,open as vg,realpath as X6,rename as Q6,rm as e3}from"fs/promises";import _r from"path";async function Cd(e){let t=_r.resolve(e),r=await kg(t).catch(()=>null);if(r===null){let o=await Cd(_r.dirname(t)),i=_r.join(o,_r.basename(t));return await Y6(i,{mode:Ti,recursive:!0}),Cd(i)}if(r.isSymbolicLink()){if(t==="/tmp"||t==="/var")return X6(t);throw Error("Storage directory must not be a symbolic link")}if(!r.isDirectory())throw Error("Storage parent must be a directory");let n=_r.dirname(t);if(n===t)return t;return _r.join(await Cd(n),_r.basename(t))}async function dr(e){let t=await Cd(e),r=await vg(t,$d.O_RDONLY|$d.O_NOFOLLOW);try{if((await r.stat()).uid!==process.getuid?.())throw Error("Storage directory must be owned by the current user");await r.chmod(Ti)}finally{await r.close()}}async function Ke(e){let t=_r.dirname(e.path);await dr(t);let r=await kg(e.path).catch(()=>null);if(r&&(!r.isFile()||r.isSymbolicLink()))throw Error("Storage target must be a regular file");let n=_r.join(t,`.${_r.basename(e.path)}.${crypto.randomUUID()}.partial`);try{let o=await vg(n,"wx",Ni);try{await o.writeFile(e.content),await o.sync()}finally{await o.close()}await Q6(n,e.path)}finally{await e3(n,{force:!0})}}async function Mn(e){if(await kg(e).catch(()=>null)===null)return;let r=await vg(e,$d.O_RDONLY|$d.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(Ni)}finally{await r.close()}}var Ti=448,Ni=384;var xg=()=>{};import{chmod as m0,lstat as t3,readdir as r3}from"fs/promises";import f0 from"path";function n3(e){return typeof e==="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}async function g0(e){let t=await t3(e.entryPath);if(t.isDirectory()){if((t.mode&511)!==Ti)await m0(e.entryPath,Ti),e.summary.directories+=1;if(e.entryPath===f0.join(e.root,"worktrees")){e.summary.skipped+=1;return}let r=await r3(e.entryPath);for(let n of r)await g0({entryPath:f0.join(e.entryPath,n),root:e.root,summary:e.summary});return}if(!t.isFile()){e.summary.skipped+=1;return}if((t.mode&511)!==Ni)await m0(e.entryPath,Ni),e.summary.files+=1}async function vs(e){let t={directories:0,files:0,skipped:0};try{await g0({entryPath:e,root:e,summary:t})}catch(r){if(!n3(r))throw r}return t}var y0=m(()=>{xg()});var Pg=m(()=>{y0();xg()});import{rmdir as o3}from"fs/promises";import So from"path";function i3(e){let t=e.split(So.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(So.sep).endsWith(`${So.sep}.shadowclone${So.sep}builds`);return n.startsWith(".")||n==="config"||o?t.slice(0,r+2).join(So.sep):null}async function h0(e){let t=i3(e);if(t===null)return;for(let r=So.dirname(e);r.length>=t.length;r=So.dirname(r))if(!await o3(r).then(()=>!0,()=>!1))return}var w0=()=>{};import{existsSync as a3,lstatSync as Sg,readlinkSync as s3,realpathSync as l3}from"fs";import Qr from"path";function en(e){try{return l3(e)}catch{return null}}function Rg(e){let t=Qr.resolve(e);for(;;){if(Sg(t,{throwIfNoEntry:!1})?.isSymbolicLink())return{path:t,target:s3(t)};let r=Qr.dirname(t);if(r===t)return null;t=r}}function _d(e){let t=[],r=Qr.resolve(e);while(!a3(r)){let n=Qr.dirname(r);if(n===r)return Qr.resolve(e);t.unshift(Qr.basename(r)),r=n}return Qr.join(en(r)??r,...t)}function Eg(e){if(!Sg(e.filePath,{throwIfNoEntry:!1})?.isSymbolicLink())return null;let t=en(e.filePath),r=en(e.homeDirectory);if(t===null||r===null||!Sg(t).isFile())return null;let n=Qr.relative(r,t);return n!==""&&!n.startsWith("..")&&!Qr.isAbsolute(n)?t:null}var b0=()=>{};import{Database as c3}from"bun:sqlite";import{mkdir as d3}from"fs/promises";import u3 from"path";async function q(e){Vt(e),await d3(u3.dirname(e),{recursive:!0});let t=new c3(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 k0=m(()=>{Cg()});import{lstatSync as x0,readlinkSync as p3}from"fs";import{mkdir as m3,open as f3,rename as g3,rm as v0}from"fs/promises";import Id from"path";function E(e){return new Bun.CryptoHasher("sha256").update(e).digest("hex")}function Vt(e){let t=Id.resolve(e);for(;;){let r=x0(t,{throwIfNoEntry:!1});if(r?.isSymbolicLink()||t===Id.resolve(e)&&r&&!r.isFile())throw new Fi(t,r?.isSymbolicLink()?p3(t):null);let n=Id.dirname(t);if(n===t)return;t=n}}async function v(e){return Be({filePath:e})}async function Be(e){let{filePath:t}=e;Vt(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 v0(e.filePath,{force:!0}),await h0(e.filePath);return}await m3(Id.dirname(e.filePath),{recursive:!0});let t=`${e.filePath}.${crypto.randomUUID()}.tmp`;try{let r=x0(e.filePath,{throwIfNoEntry:!1})?.mode,n=await f3(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 g3(t,e.filePath)}finally{await v0(t,{force:!0})}}var Fi;var Cg=m(()=>{w0();b0();k0();Fi=class Fi 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 y3(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function h3(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 Ro=m(()=>{/*!
62
62
  * Copyright (c) Squirrel Chat et al., All rights reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shadowclone/cli",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "type": "module",
5
5
  "description": "Turns how you work into a portable, tested environment for the coding agents you already use.",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadowclone",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "Set up and maintain portable coding-agent skills with explicit local consent.",
5
5
  "author": {
6
6
  "name": "Shadowclone"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadowclone",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "Set up and maintain portable coding-agent skills with explicit local consent.",
5
5
  "author": {
6
6
  "name": "Shadowclone",
@@ -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.29",
4
+ "version": "0.0.30",
5
5
  "description": "Set up and maintain portable coding-agent skills with explicit local consent.",
6
6
  "author": {
7
7
  "name": "Shadowclone",