@shadowclone/cli 0.0.12 → 0.0.14

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.
@@ -1 +0,0 @@
1
- :root{--buncss-light: ;--buncss-dark:initial;color-scheme:dark;color:#e5e4ed;--muted:#929bb3;--accent:#b6a2ee;--line:#303246;--surface:#171923;background:#090a10;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:15px}*{box-sizing:border-box}body{background:radial-gradient(at 50% 45%,#291d3c5c,#0000 65%);min-height:100vh;margin:0;padding:28px 24px}button,input,select,textarea{font:inherit}button,select{cursor:pointer}button{border:0}button:disabled{cursor:wait;opacity:.5}button,a,input,textarea,select{outline-offset:5px}:focus-visible{outline:2px solid var(--accent)}button,a{-webkit-tap-highlight-color:transparent}[hidden]{display:none!important}.frame{overflow:clip;background:#10121b;border:1px solid #373043;border-radius:20px;max-width:1040px;margin:0 auto;box-shadow:0 24px 100px #0008,0 0 100px #9b71d208}.masthead{border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items: center;padding:18px 32px}.brand{display:inline-flex;color:inherit;text-decoration:none;align-items: center;gap:9px;font-weight:650}.brand-mark{filter:drop-shadow(0 0 8px #c0a0ff33);width:28px;height:28px}.local-badge{letter-spacing:.12em;color:var(--muted);font-size:10px}.local-badge span{display:inline-block;background:#8dd0bd;border-radius:50%;width:6px;height:6px;margin-right:6px}main{padding:32px 36px 0}.eyebrow{letter-spacing:.22em;color:var(--accent);margin:0 0 12px;font-size:10px;font-weight:650}h1,h2{font-family:Georgia,Times New Roman,serif;font-weight:400}h1{letter-spacing:-.035em;margin:0 0 12px;font-size:clamp(30px,4vw,44px)}h2{letter-spacing:-.02em;margin:0;font-size:28px}.subtitle{color:var(--muted);margin:0;line-height:1.6}.toolbar{display:flex;align-items: end;gap:14px;margin-top:24px}.scope-field{display:grid;letter-spacing:.04em;color:var(--muted);gap:7px;font-size:10px}.scope-field select{appearance:none;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgdmlld0JveD0iMCAwIDE0IDE0IiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJtMyA1IDQgNCA0LTQiIHN0cm9rZT0iI2I3YWVjOSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K);background-position:right 14px center;background-repeat:no-repeat;min-width:200px;padding-right:40px}input,select,textarea{color:#e5e4ed;border:1px solid var(--line);background-color:#12141f;border-radius:7px;padding:10px 12px;font-size:13px}textarea{resize:vertical;width:100%;line-height:1.6}input::placeholder,textarea::placeholder{color:#747c93}.search-field{flex:1}.search-field input{width:100%}.quiet-button{color:#bec3d4;background:0 0;border-radius:7px;padding:11px 12px;font-size:13px}.quiet-button:hover{color:#fff;background:#222533}.primary-button{color:#181323;background:linear-gradient(145deg,#c3acf5,#aa8dde);border:1px solid #dcc9ff4d;border-radius:8px;padding:14px 22px;transition:box-shadow .2s,transform .2s,background .2s;font-size:13px;font-weight:650;box-shadow:0 3px 20px #b997ec1f,inset 0 1px #f1e6ff30}.primary-button:hover{background:linear-gradient(145deg,#d3c0ff,#b79ae9);transform:translateY(-1px);box-shadow:0 0 26px #ba95f23b}.primary-button span{margin-left:16px}.scope-note{color:var(--muted);min-height:17px;margin:0;font-size:12px;line-height:1.6}.notice{color:#e1d4ab;background:#27231b;border:1px solid #796c44;border-radius:8px;margin-top:20px;padding:12px 16px;font-size:13px;line-height:1.6}.notice.success{color:#abdacb;background:#132722;border-color:#33594d}.visually-hidden{position:absolute;overflow:hidden;clip-path:inset(50%);width:1px;height:1px}.footer{display:flex;border-top:1px solid var(--line);position:sticky;z-index:4;backdrop-filter:blur(18px);background:#171824ed;justify-content:space-between;align-items: center;gap:20px;padding:20px 32px;bottom:0;box-shadow:0 -12px 30px #0b0c1326}.footer strong{font-size:14px;font-weight:600}.footer p{color:var(--muted);margin:8px 0 0;font-size:12px}.footer-actions{display:flex;align-items: center;gap:12px}@media (width<=720px){body{padding:12px}main{padding:26px 18px 0}.masthead,.footer{padding:18px}.toolbar{flex-wrap:wrap}.scope-field,.scope-field select{width:100%}.footer{align-items: flex-start}.footer-actions{flex-direction:column-reverse;align-items: flex-end}.local-badge{font-size:9px}}@media (prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}.workspace{display:grid;grid-template-columns:minmax(0,1fr)290px;align-items: start;gap:32px;margin:28px 0}.constellation{position:relative;padding:20px 4px 8px}.tree{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;min-height:340px}.branch{position:relative;display:flex;flex-direction:column;align-self: start;align-items: center;gap:30px;padding-bottom:8px}.tree-connections{position:absolute;pointer-events:none;z-index:-1;fill:none;stroke:#b299d6;stroke-width:.8;opacity:.65;width:100%;height:100%;inset:0}.branch-title{letter-spacing:.2em;color:#a1abc4;margin:0 0 8px;font-size:10px;font-weight:400}.skill-node{position:relative;color:#cdd2e1;display:flex;background:0 0;flex-direction:column;align-items: center;gap:14px;width:100%;padding:0 2px}.node-gem{position:relative;display:grid;background:linear-gradient(145deg,#1b1b29,#11131e);border:1px solid #5f526f;border-radius:11px;place-items: center;width:42px;height:42px;transition:background .2s,border-color .2s,box-shadow .2s;transform:rotate(45deg)}.node-icon{display:grid;color:#b1a7c6;place-items: center;width:21px;height:21px;line-height:1;transform:rotate(-45deg)}.node-icon svg{width:100%;height:100%}.node-label{z-index:1;text-align:center;background:#10121be6;border-radius:4px;max-width:145px;padding:3px 5px;font-size:12px;line-height:1.45}.skill-node:hover .node-gem{background:#242030;border-color:#a68fd8}.skill-node.active .node-gem{outline:1px solid var(--accent);outline-offset:5px;border-color:#c3b1ef}.skill-node.equipped .node-gem{background:linear-gradient(140deg,#514263,#2b243d);border-color:#b6a2ee;box-shadow:0 0 25px #ad85f223}.skill-node.equipped .node-icon{color:#c9b7f5}.skill-node.equipped:after{content:"";position:absolute;box-sizing:content-box;background:#c4aff4;border:2px solid #11131c;border-radius:50%;width:7px;height:7px;margin-left:58px;top:12px}.skill-node.equipped .node-label{color:#f0eafa}.branch-empty{color:var(--muted);z-index:1;background:#11131c;font-size:12px}.tree-root{position:relative;width:74%;height:40px;margin:12px auto 0}.tree-root span{position:absolute;display:grid;color:#baa6e8;background:radial-gradient(circle,#2b213d,#141522 74%);border:1px solid #bca2e9;border-radius:50%;place-items: center;width:45px;height:45px;font-size:23px;bottom:-23px;left:50%;transform:translate(-50%)}.tree-hint{text-align:center;color:var(--muted);margin:42px 0 0;font-size:12px}@media (width<=900px){.workspace{grid-template-columns:minmax(0,1fr)270px;gap:20px}.branch-title{letter-spacing:.12em;font-size:9px}}@media (width<=720px){.workspace{grid-template-columns:1fr}.tree{min-height:280px}.branch{gap:24px}.node-label{font-size:11px}.constellation{padding-bottom:20px}}.detail{position:sticky;background:linear-gradient(150deg,#1d1b2a,#151720 55%);border:1px solid #53446799;border-radius:14px;padding:24px;top:24px;box-shadow:0 12px 40px #0003,inset 0 1px #d2b9ff0a}.detail h2{font-size:26px;line-height:1.2}.detail-description{color:#a5afc5;display:-webkit-box;-webkit-line-clamp:3;overflow:hidden;-webkit-box-orient:vertical;margin:14px 0 24px;font-size:13px;line-height:1.7}.behavior{border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:21px 0}.behavior p:last-child{color:#c3c5d0;white-space:pre-line;margin:0;font-size:13px;line-height:1.7}.skill-status{color:#8fcaba;margin:18px 0;font-size:11px;line-height:1.6}.detail .primary-button{width:100%}.detail .editor{margin-top:20px}.detail summary{color:#bdb5d2;cursor:pointer;font-size:12px}.detail textarea{min-height:200px;margin-top:12px;font:11px/1.65 ui-monospace,monospace}.detail .quiet-button{width:100%;margin-top:8px}.owner-note{color:var(--muted);font-size:11px;line-height:1.6}.identity{display:flex;border-top:1px solid #292b3d;justify-content:space-between;align-items: center;gap:24px;padding:26px 0}.identity h2{font-size:26px}.identity p:last-child{color:var(--muted);max-width:580px;margin-bottom:0;font-size:12px;line-height:1.7}.traits{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:7px;max-width:300px}.trait{color:#c2b5e7;white-space:nowrap;background:linear-gradient(135deg,#30253f,#211c2e);border:1px solid #3a324a;border-radius:30px;padding:7px 11px;font-size:11px;box-shadow:inset 0 1px #d2b9ff0a}.requirements{border:1px solid var(--line);background:#141824;border-radius:10px;margin:0 0 22px;padding:18px}.requirements h3{color:#b6c4d4;margin:0 0 10px;font-size:12px}.requirements p{color:var(--muted);margin:7px 0 0;font-size:12px;line-height:1.6}dialog{color:#e5e4ed;background:#151720;border:1px solid #414258;border-radius:18px;width:min(780px,100vw - 40px);max-height:88vh;padding:28px;box-shadow:0 35px 120px #0008}dialog::backdrop{backdrop-filter:blur(4px);background:#06070be3}.dialog-heading{display:flex;justify-content:space-between;align-items: flex-start;gap:20px;margin-bottom:25px}.dialog-heading .quiet-button{margin-top:-8px}.dialog-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:24px}#review-content{overflow:auto;max-height:52vh}.file-change{border:1px solid var(--line);border-radius:8px;margin:12px 0;padding:14px}.file-change summary{cursor:pointer;color:#c7b8e8;overflow-wrap:anywhere;font-size:12px}.file-change h4{text-transform:uppercase;letter-spacing:.12em;color:var(--muted);margin-bottom:8px;font-size:10px}.file-change pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#0e1119;border-radius:5px;padding:14px;font:11px/1.6 ui-monospace,monospace}.file-change p,.review-message{color:#a3adc2;font-size:12px;line-height:1.7}.review-warning{color:#dac895;font-size:12px;line-height:1.7}form label{display:grid;color:#bbc3d7;gap:9px;margin-top:20px;font-size:12px}@media (width<=720px){.detail{position:static}.identity{display:block}.traits{justify-content:flex-start;max-width:none;margin-top:18px}dialog{padding:20px}}.constellation{isolation:isolate}.constellation:before{content:"";position:absolute;pointer-events:none;z-index:-1;filter:blur(15px);background:radial-gradient(at 53% 72%,#be85f13d 0%,#0000 42%),radial-gradient(at 28% 52%,#8060c32b 0%,#0000 48%),radial-gradient(at 74% 41%,#59699b1f 0%,#0000 42%),radial-gradient(at 53% 57%,#7c47822e 0%,#0000 65%);inset:30px -35px 5px}.tree-root img{filter:drop-shadow(0 0 7px #bca1f38c);width:31px;height:31px}.tree-root span:before{content:"";position:absolute;border:1px solid #b19bdf26;border-radius:50%;inset:-9px;box-shadow:0 0 35px #be85f12e}.tree-root span{box-shadow:0 0 22px #c7a1ff40,0 0 75px #a776de26}.skill-node:hover .node-gem,.skill-node.active .node-gem{box-shadow:0 0 18px #c7a8fa33,0 0 55px #9773d92b}.skill-node.equipped .node-gem{box-shadow:0 0 16px #c7a8fa38,0 0 40px #a776de38,inset 0 0 12px #c7a8fa0d}.skill-node.equipped .node-icon{filter:drop-shadow(0 0 4px #d6bfff66)}.skill-node.equipped:after{box-shadow:0 0 10px #ceadff99}.scope-meta{display:flex;justify-content:space-between;align-items: start;gap:16px;margin-top:12px}.library-note{text-align:right;color:var(--muted);max-width:270px;font-size:11px;line-height:1.6}.library-note summary{cursor:pointer;color:#a799c3}.library-note p{margin:8px 0}.library-note code{display:block;color:#c8b4f0;font-size:10px}#describe{color:#b2a1d1;margin-top:14px;padding:11px 12px}#model-description:empty{display:none}@media (width<=720px){.scope-meta{display:block}.library-note{text-align:left;margin-top:8px}}.starfield{position:absolute;pointer-events:none;z-index:-1;overflow:hidden;width:100%;height:100%;inset:0}.star{fill:#e6d6ff;opacity:0;transform-box:fill-box;transform-origin:center;animation:9s linear infinite star-drift}.star-rays{stroke:#eadbff;stroke-width:.55;opacity:.75}.star-phase-0{animation-duration:8.3s;animation-delay:-1.2s}.star-phase-1{animation-duration:11.1s;animation-delay:-5.8s}.star-phase-2{animation-duration:9.7s;animation-delay:-8.3s}.star-phase-3{animation-duration:12.4s;animation-delay:-3.4s}.star-phase-4{animation-duration:7.8s;animation-delay:-6.2s}.star-phase-5{animation-duration:10.6s;animation-delay:-2.7s}.star-phase-6{animation-duration:13.2s;animation-delay:-10.4s}.starfield.paused .star{animation-play-state:paused}@keyframes star-drift{0%,to{opacity:0;transform:translate(-8px,5px)scale(.65)}20%{opacity:.45}36%,59%{opacity:.95}45%,72%{opacity:.25}85%{opacity:0;transform:translate(12px,-9px)scale(1)}}@media (prefers-reduced-motion:reduce){.star{animation:none;opacity:.65;transform:none}}.build-panel{position:sticky;display:grid;overflow:auto;scrollbar-width:thin;scrollbar-color:#4d3d65 transparent;gap:16px;max-height:calc(100dvh - 140px);margin:-3px;padding:3px;top:20px}.build-panel .identity{display:block;background:linear-gradient(145deg,#221c30,#14151f 80%);border:1px solid #44364f;border-radius:14px;padding:22px}.build-panel .identity h2{font-size:25px}.build-panel .identity p:last-child{font-size:12px;line-height:1.65}.build-panel .traits{justify-content:flex-start;gap:6px;margin-top:14px}.build-panel .trait{padding:6px 9px;font-size:10px}.build-panel .detail{position:static}.build-panel #model-description{margin-top:16px;margin-bottom:0}@media (width<=720px){.build-panel{position:static;overflow:visible;max-height:none}}
@@ -1,133 +0,0 @@
1
- function Se(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function zt(e,t="|"){return e.map((r)=>St(r)).join(t)}function Ze(e,t){if(typeof t==="bigint")return t.toString();return t}class Or{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Be(e){return new Or(e)}function Ir(e){return e===null||e===void 0}function Fe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function F(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function qe(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Y(e){return qe(e._zod.def)??e._zod.def.shape}function Er(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return F(this,t,n),n},enumerable:!0,configurable:!0})}function Ar(e,t,r){if(t in e)F(e,t,r);else e[t]=r}function ie(e,t,r,n){let o=Y(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Er(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else Ar(e,i,n?n(s.value,i):s.value)}}function mc(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Er(e,r,()=>t[r]);else Ar(e,r,n.value)}}function R(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Tr(e){return JSON.stringify(e)}function Cr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var kt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function $e(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Nr=Be(()=>{if(C.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function se(e){if($e(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if($e(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function $t(e){if(se(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Rr=new Set(["string","number","symbol"]);function de(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function V(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function b(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function St(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Dr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Zt=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Pt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function hc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return ie(i,e,Je(e,t)),V(e,R(r,{shape:i,checks:[]}))}function Je(e,t){let r=Y(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function gc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Je(e,t)),s={};return ie(s,e,Reflect.ownKeys(Y(e)).filter((c)=>!i.has(c))),V(e,R(r,{shape:s,checks:[]}))}function xc(e,t){if(!se(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Y(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return V(e,R(e._zod.def,{shape:Lr(e,t)}))}function Lr(e,t){let r={};return ie(r,e,Reflect.ownKeys(Y(e))),mc(r,t),r}function bc(e,t){if(!se(t))throw Error("Invalid input to safeExtend: expected a plain object");return V(e,R(e._zod.def,{shape:Lr(e,t)}))}function yc(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ie(r,e,Reflect.ownKeys(Y(e))),ie(r,t,Reflect.ownKeys(Y(t)));let n=R(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return V(e,n)}function jr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Je(t,r)):void 0,a={};return ie(a,t,Reflect.ownKeys(Y(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),V(t,R(t._zod.def,{shape:a,checks:[]}))}function vc(e,t,r){let n=r?new Set(Je(t,r)):void 0,o={};return ie(o,t,Reflect.ownKeys(Y(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),V(t,R(t._zod.def,{shape:o}))}function G(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Mr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function te(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ke(e){return typeof e==="string"?e:e?.message}function Ot(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function W(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:ke(e.inst?._zod.def?.error?.(e))??ke(i?.(e))??ke(t?.error?.(e))??ke(r.customError?.(e))??ke(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var _c=/[\uD800-\uDBFF]/;function Ke(e){let t=e.length;if(!_c.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Ve(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ur(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ce(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Br(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else zc(e,r,n.value)}}function X(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ge(e,t,r){return X(e,t,r,!1)}function wc(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return X(this,r,n(this))},set(o){X(this,r,o)}})}return t}function zc(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:X(this,t,r.bind(this))},set(n){X(this,t,n)}})}function kc(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var wt,ee=!1,$c={configurable:!0,get(){ee=!0;return}};function z(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&wt!==e._zod){wt=void 0;return}wt=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,$c);let o=ee;ee=!1;try{let i=r(this);if(ee)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ee=ee||o,i}catch(i){throw delete this[t],ee=ee||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Sc(e,t,r,n){let o=kc(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Zc="~constantCatch";function Fr(e){let t=()=>e;return t[Zc]=!0,t}var qr;var It={value:void 0,enumerable:!1},Jr="captureStackTrace"in Error?Error:null;function Pc(e){let t=Jr;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Jr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(m){this.def=m,this.constr=d,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(m,f){if(!m._zod){It.value=new i(f);try{Object.defineProperty(m,"_zod",It)}finally{It.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),c){let y=Object.getPrototypeOf(m),v=m._zod.constr.prototype,P=y;while(P&&P!==v)P=Object.getPrototypeOf(P);let U=P??y;if(!c.has(U))c.add(U),Br(U,s)}let h=d.prototype;for(let y in h){if(!Object.prototype.hasOwnProperty.call(h,y))continue;if(!(y in m))m[y]=h[y].bind(m)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(m){let f=n?.Parent?Pc(l):this;a(f,m);let h=f._zod.deferred;if(h){for(let v of h)v();f._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(f);return f}return Object.defineProperty(d,"init",{value:a}),Object.defineProperty(d,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Pe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(qr=globalThis).__zod_globalConfig??(qr.__zod_globalConfig={});var C=globalThis.__zod_globalConfig;function D(e){if(e)Object.assign(C,e);return C}function Oc(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ze,2)),e.message}function Ic(e){this._zod.message=e}var Ec={get:Oc,set:Ic,enumerable:!0,configurable:!0},At={value:void 0,enumerable:!1},Kr=new WeakSet([Object.prototype,Error.prototype]),Vr=(e,t)=>{e.name="$ZodError",At.value=t,Object.defineProperty(e,"issues",At),At.value=void 0,Object.defineProperty(e,"message",Ec);let r=Object.getPrototypeOf(e);if(!Kr.has(r))Kr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Gr=p("$ZodError",Vr),tl=p("$ZodError",Vr,void 0,{Parent:Error});function Ac(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Wr(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Ac(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Hr(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;while(u<c.length){let l=c[u],d=u===c.length-1;if(l==="_errors"){if(d)a._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(a,l))Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=a[l];if(d)m._errors.push(t(s));a=m,u++}}}};return n(e),r}function We(e,t){return{callee:t?.callee??e,Err:t?.Err}}var He=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new H;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>W(u,s,D())));throw kt(a,i?.callee??t),a}return c.value};return t};var Ye=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>W(u,s,D())));throw kt(a,i?.callee??t),a}return c.value};return t};var Xe=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new H;return i.issues.length?Yr(e,i.issues,o):{success:!0,data:i.value}};function Yr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>W(o,r,D()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Qe=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Yr(e,i.issues,o):{success:!0,data:i.value}};var Tc=Symbol.for("zod.compile.invalid"),Cc=Symbol.for("zod.compile.fallback"),Tt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Tc)return!0;if(n.definite===!0&&r===void 0)return!1}return Nc(e,t,r)};function Nc(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Cc]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new H;return i.issues.length===0}var Ct=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Xr=(e)=>{let t=He(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,We(r,s))};return r};var Qr=(e)=>{let t=He(e),r=(n,o,i,s)=>t(n,o,i,We(r,s));return r};var en=(e)=>{let t=Ye(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,We(r,s))};return r};var tn=(e)=>{let t=Ye(e),r=async(n,o,i,s)=>await t(n,o,i,We(r,s));return r};var rn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Xe(e)(t,r,o)};var nn=(e)=>(t,r,n)=>Xe(e)(t,r,n);var on=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Qe(e)(t,r,o)};var sn=(e)=>async(t,r,n)=>Qe(e)(t,r,n);var cn=/^[cC][0-9a-z]{6,}$/,an=/^[0-9a-z]+$/,un=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ln=/^[0-9a-vA-V]{20}$/,pn=/^[A-Za-z0-9]{27}$/,dn=/^[a-zA-Z0-9_-]{21}$/;function fn(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var mn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var hn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Rt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var gn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Rc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function xn(){return new RegExp(Rc,"u")}var bn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,yn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var vn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_n=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var kn=/^https?$/,$n=/^\+[1-9]\d{6,14}$/;var Sn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Dc(e){return new RegExp(`^${e}$`)}var Zn=Dc(Sn);function Nt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Pn(e){return new RegExp(`^${Nt(e)}$`)}function On(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Nt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Nt({precision:e.precision})}`:r;return new RegExp(`^${Sn}T(?:${n})$`)}var In=/^[\s\S]{0,}$/;var Dt=/^-?\d+$/,et=/^-?\d+(?:\.\d+)?$/,En=/^(?:true|false)$/i;var An=/^[^A-Z]*$/,Tn=/^[^a-z]*$/;var L=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Lt=(e)=>{let t=e.value;return!Ir(t)&&t.length!==void 0};var Cn=p("$ZodCheckMaxLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Lt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ke(o):i)<=t.maximum)return;let c=Ve(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Nn=p("$ZodCheckMinLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Lt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ke(o):i)>=t.minimum)return;let c=Ve(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Rn=p("$ZodCheckLengthEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Lt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ke(o):i;if(s===t.length)return;let c=Ve(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ie=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(L.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Dn=p("$ZodCheckRegex",(e,t)=>{Ie.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ln=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=An),Ie.init(e,t)}),jn=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Tn),Ie.init(e,t)}),Mn=p("$ZodCheckIncludes",(e,t)=>{L.init(e,t);let r=de(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Un=p("$ZodCheckStartsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`^${de(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Bn=p("$ZodCheckEndsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${de(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Fn=p("$ZodCheckOverwrite",(e,t)=>{L.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class jt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
2
- `).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
3
- ${t.join(`
4
- `)}
5
- };`)(...Object.values(this.closed))}}var Jn={major:4,minor:6,patch:5};var O=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jn;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let l=G(c),d;for(let m of a){if(m._zod.def.when){if(Mr(c))continue;if(!m._zod.def.when(c))continue}else if(l)continue;let f=c.issues.length,h=m._zod.check(c);if(h instanceof Promise&&u?.async===!1)throw new H;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await h,c.issues.length===f)return;if(Ot(c.issues,f,e),!l)l=G(c,f)});else{if(c.issues.length===f)continue;if(Ot(c.issues,f,e),!l)l=G(c,f)}}if(d)return d.then(()=>c);return c},s=(c,a,u)=>{if(G(c))return c.aborted=!0,c;let l=i(a,o,u);if(l instanceof Promise){if(u.async===!1)throw new H;return l.then((d)=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>s(d,c,a));return s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new H;return u.then((l)=>i(l,o,a))}return i(u,o,a)}}},{get "~standard"(){return Ge(this,"~standard",Ut(this))},set "~standard"(e){X(this,"~standard",e)}}),ro=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>W(r,t,D()))}:{value:e.value};async function Lc(e,t){let r={async:!0};return ro(await e._zod.run({value:t,issues:[]},r),r)}function Ut(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return ro(n,r)}catch(n){}return Lc(e,t)},vendor:"zod",version:1}}var ot=p("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??In,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),S=p("$ZodStringFormat",(e,t)=>{Ie.init(e,t),ot.init(e,t)}),no=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=hn),S.init(e,t)}),oo=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Rt(n))}else t.pattern??(t.pattern=Rt());S.init(e,t)}),io=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=gn),S.init(e,t)}),so=1,rt=2;function co(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function jc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return co(e)||rt;return Mc(e,t)}function Mc(e,t){if(!t.normalize&&t.protocol?.source===kn.source&&!/^https?:\/\//i.test(e))return so;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??rt}return new URL(e)}catch{return rt}}var Uc=/[\t\n\r]/g;function Kn(e){return e.replace(Uc,"")}function Bc(e,t){return t.lastIndex=0,t.test(e.hostname)}function Fc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ao=p("$ZodURL",(e,t)=>{S.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=jc(n,t);if(o===so){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===rt){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Kn(n);return}if(t.hostname&&!Bc(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Fc(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Kn(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),uo=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=xn()),S.init(e,t)}),lo=p("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?dn:fn(t.length)),S.init(e,t)}),po=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=cn),S.init(e,t)}),fo=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=an),S.init(e,t)}),mo=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=un),S.init(e,t)}),ho=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ln),S.init(e,t)}),go=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=pn),S.init(e,t)}),xo=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=On(t)),S.init(e,t)}),bo=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Zn),S.init(e,t)}),yo=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Pn(t)),S.init(e,t)}),vo=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=mn),S.init(e,t)}),_o=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=bn),S.init(e,t)}),qc=/^[0-9a-fA-F:.]+$/;function wo(e){if(!qc.test(e))return!1;return co(`http://[${e}]`)}var zo=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=yn),S.init(e,t),e._zod.check=(r)=>{if(!wo(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var ko=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=vn),S.init(e,t)});function Jc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return wo(r)}var $o=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=_n),S.init(e,t),e._zod.check=(r)=>{if(!Jc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function So(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bt=/^[0-9a-zA-Z+/]*={0,2}$/,Zo=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bt),S.init(e,t),e._zod.check=(r)=>{if(So(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),it=/^[A-Za-z0-9_-]*$/;function Kc(e){if(!it.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return So(r)}var Po=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=it),S.init(e,t),e._zod.check=(r)=>{if(Kc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Oo=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=$n),S.init(e,t)});function Vc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Io=p("$ZodJWT",(e,t)=>{S.init(e,t),e._zod.check=(r)=>{if(Vc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Eo=p("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=En,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Ao=p("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=(r)=>r}),To=p("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Vn(e,t,r){if(e.issues.length)t.issues.push(...te(r,e.issues));t.value[r]=e.value}var Co=p("$ZodArray",(e,t)=>{O.init(e,t);let r=C.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then((d)=>Vn(d,n,a)));else if(Vn(l,n,a),c&&l.issues.length!==0&&G(l))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function nt(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...te(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var Gc=[];function No(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Gc,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Dr(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Ro(e,t,r,n,o,i,s){let c=[],a=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:d,optout:m}=u,f=0;for(let h in t){if(s&&r.issues.length!==f){if(G(r,f))break;f=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let y=u.run({value:t[h],issues:[]},n);if(y instanceof Promise)e.push(y.then((v)=>nt(v,r,h,t,d,m)));else nt(y,r,h,t,d,m)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Wc=p("$ZodObject",(e,t)=>{O.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=Be(()=>No(t));z(e,"propValues",(u)=>{let l=u.def.shape,d={};for(let m in l){let f=l[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(d,m))F(d,m,new Set);for(let h of f.values)d[m].add(h);if(f.optin!==void 0)d[m].add(void 0)}}return d});let i=$e,s=t.catchall,c,a=C.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=o.value);let d=u.value;if(!i(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let m=[],f=c.shape,h=l?.abortEarly,y=u.issues.length;for(let v of c.allKeys){if(h&&u.issues.length!==y){if(G(u,y))break;y=u.issues.length}if(v==="__proto__")continue;let P=f[v],U=P._zod.optin,we=P._zod.optout,ze=P._zod.run({value:d[v],issues:[]},l);if(ze instanceof Promise)m.push(ze.then((A)=>nt(A,u,v,d,U,we)));else nt(ze,u,v,d,U,we)}if(!s)return m.length?Promise.all(m).then(()=>u):u;return Ro(m,d,u,l,o.value,e,h===!0)}}),Do=p("$ZodObjectJIT",(e,t)=>{Wc.init(e,t);let r=e._zod.parse,n=Be(()=>No(t)),o=C.memoizer,i=(f)=>{let h=n.value,y=h.symbolKeys,v=new jt(["payload","ctx"],{shape:f,inst:e,memo:o,syms:y}),P=(A)=>`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`,U=(A,k)=>`
6
- let ${A}_ab = false;
7
- for (let i = 0; i < ${A}.issues.length; i++) {
8
- const iss = ${A}.issues[i];
9
- iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
10
- payload.issues.push(iss);
11
- if (iss.continue !== true) ${A}_ab = true;
12
- }
13
- if (${A}_ab && ctx && ctx.abortEarly) {
14
- payload.value = newResult;
15
- return payload;
16
- }`;v.write("const input = payload.value;");let we=Object.create(null),ze=0;for(let A of h.allKeys)we[A]=`key_${ze++}`;v.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let A of h.allKeys){if(A==="__proto__")continue;let k=we[A],K=typeof A==="symbol"?`syms[${y.indexOf(A)}]`:Tr(A),vt=`${K} in input`,Zr=f[A],_t=Zr?._zod?.optin,Pr=_t!==void 0,dc=Zr?._zod?.optout==="optional";if(v.write(`const ${k} = ${P(K)};`),Pr&&dc){let fc=_t==="optional"?`${k}_present`:`${k}.value !== undefined || ${k}_present`;v.write(`
17
- const ${k}_present = ${vt};
18
- if (!${k}.issues.length || ${k}_present) {
19
- if (${k}.issues.length) {${U(k,K)}
20
- }
21
-
22
- if (${fc}) {
23
- newResult[${K}] = ${k}.value;
24
- }
25
- }
26
-
27
- `)}else if(!Pr)v.write(`
28
- const ${k}_present = ${vt};
29
- if (${k}.issues.length) {${U(k,K)}
30
- }
31
- if (!${k}_present && !${k}.issues.length) {
32
- payload.issues.push({
33
- code: "invalid_type",
34
- expected: "nonoptional",
35
- input: undefined,
36
- path: [${K}]
37
- });
38
- if (ctx && ctx.abortEarly) {
39
- payload.value = newResult;
40
- return payload;
41
- }
42
- }
43
-
44
- if (${k}_present) {
45
- newResult[${K}] = ${k}.value;
46
- }
47
-
48
- `);else if(v.write(`
49
- if (${k}.issues.length) {${U(k,K)}
50
- }
51
- `),_t==="defaulted")v.write(`newResult[${K}] = ${k}.value;`);else v.write(`
52
- if (${k}.value !== undefined || ${vt}) {
53
- newResult[${K}] = ${k}.value;
54
- }
55
- `)}return v.write("payload.value = newResult;"),v.write("return payload;"),v.compile()},s,c=$e,a=!C.jitless,l=a&&Nr.value,d=t.catchall,m;e._zod.parse=(f,h)=>{m??(m=n.value);let y=f.value;if(!c(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f;if(a&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(f=s(f,h),!d)return f;return Ro([],y,f,h,m,e,h?.abortEarly===!0)}return r(f,h)}});function Gn(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!G(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>W(s,n,D())))}),t}var Lo=p("$ZodUnion",(e,t)=>{O.init(e,t),z(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),z(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),z(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}),z(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)=>Fe(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,s=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Gn(s,n,e,o);return Promise.all(s).then((c)=>Gn(c,n,e,o))}});var jo=p("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,u])=>Wn(r,a,u));return Wn(r,i,s)}});function Mt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(se(e)&&se(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=Mt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Mt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Wn(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!i.has(m))i.set(m,u);d=[m]}else return!1;for(let m of d){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of r.issues)if(!s(u,"r"))e.issues.push(u);let c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=o?c.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of c)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let a=Mt(t.value,r.value);if(!a.valid){if(G(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var Mo=p("$ZodRecord",(e,t)=>{O.init(e,t);let r=C.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!se(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let l of c)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(a.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((h)=>W(h,o,D())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);if(f instanceof Promise)s.push(f.then((h)=>{if(h.issues.length)n.issues.push(...te(l,h.issues));n.value[m]=h.value}));else{if(f.issues.length)n.issues.push(...te(l,f.issues));n.value[m]=f.value}}let u;for(let l in i)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let u of Reflect.ownKeys(i)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&et.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)l=h}if(l.issues.length){if(t.mode==="loose")n.value[u]=i[u];else if(c)a=a??[],a.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((h)=>W(h,o,D())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[u],issues:[]},o);if(f instanceof Promise)s.push(f.then((h)=>{if(h.issues.length)n.issues.push(...te(u,h.issues));n.value[m]=h.value}));else{if(f.issues.length)n.issues.push(...te(u,f.issues));n.value[m]=f.value}}if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}});var Uo=p("$ZodEnum",(e,t)=>{O.init(e,t);let r=Se(t.entries),n=new Set(r);e._zod.values=n,z(e,"pattern",(o)=>{let i=Se(o.def.entries).filter((s)=>Rr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>de(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var Bo=p("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",C.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new H;return r.value=o,r}});function Hn(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ft=p("$ZodOptional",(e,t)=>{O.init(e,t),z(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",z(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),z(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Fe(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)=>Hn(r,i));return Hn(r,o)}return t.innerType._zod.run(r,n)}}),Fo=p("$ZodExactOptional",(e,t)=>{Ft.init(e,t),z(e,"values",(r)=>r.def.innerType._zod.values),z(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),qo=p("$ZodNullable",(e,t)=>{O.init(e,t),z(e,"optin",(r)=>r.def.innerType._zod.optin),z(e,"optout",(r)=>r.def.innerType._zod.optout),z(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Fe(n.source)}|null)$`):void 0}),z(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)}}),Jo=p("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",z(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)=>Yn(i,t));return Yn(o,t)}});function Yn(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Ko=p("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",z(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)}}),Vo=p("$ZodNonOptional",(e,t)=>{O.init(e,t),z(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)=>Xn(i,e));return Xn(o,e)}});function Xn(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Qn(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>W(o,n,D()))},input:e.value}),e}var Go=p("$ZodCatch",(e,t)=>{O.init(e,t),z(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),z(e,"optout",(r)=>r.def.innerType._zod.optout),z(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)=>Qn(r,i,t,n));return Qn(r,o,t,n)}});var Wo=p("$ZodPipe",(e,t)=>{O.init(e,t),z(e,"values",(r)=>r.def.in._zod.values),z(e,"optin",(r)=>r.def.in._zod.optin),z(e,"optout",(r)=>r.def.out._zod.optout),z(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((s)=>tt(s,t.in,n));return tt(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>tt(i,t.out,n));return tt(o,t.out,n)}});function tt(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Ho=p("$ZodReadonly",(e,t)=>{O.init(e,t),z(e,"propValues",(r)=>r.def.innerType._zod.propValues),z(e,"values",(r)=>r.def.innerType._zod.values),z(e,"optin",(r)=>r.def.innerType?._zod?.optin),z(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(eo);return eo(o)}});function eo(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Yo=p("$ZodCustom",(e,t)=>{L.init(e,t),O.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)=>to(i,r,n,e));to(o,r,n,e);return}});function to(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(ce(o))}}class Qo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Jt="~memo",Xo=[];function ei(e){return e!==null&&typeof e==="object"}function qt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var ti=new WeakMap,Ee=0,at=1,Ae=2;function ut(e,t,r){let n=ti.get(e);if(n!==void 0)return n?Ae:Ee;if(t.has(e))return Ae;t.add(e);let o=Ee,i=(l)=>{if(o!==Ae&&l?._zod){let d=ut(l,t,r);if(d>o)o=d}},s=(l,d)=>{let m=Ee;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(d&&!h.enumerable)continue;let y=h.get?at:h.value?._zod?ut(h.value,t,r):Ee;if(y>m)m=y}return m},c=(l)=>{if(l>o)o=l},a=e._zod.def,u=a.type;switch(u){case"object":{let l=qe(a);c(l?s(l,!0):at),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?ut(l,t,!1):at);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in a){let d=Object.getOwnPropertyDescriptor(a,l);if(!d||d.get)continue;let m=d.value;if(!m||typeof m!=="object")continue;if(m._zod)i(m);else if(Array.isArray(m))for(let f of m)i(f)}}return t.delete(e),Hc(e,o)}function Hc(e,t){if(t!==at)ti.set(e,t===Ae);return t}function Yc(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var st,ct=[],Xc={alloc(e,t,r){let n=st;if(!n)return r;st=void 0;let o={value:r,issues:null};return n.set(t.value,o),ct.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"&&Qc(i,o.value))throw new Qo;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 s=e._zod.parse,c=(a,u)=>{if(r===void 0){let P=ut(e,new Set,!1);if(P===Ee){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,u)}if(P===Ae||n)r=!0;else n=!0}let l=a.value;if(!ei(l))return s(a,u);let d=u[Jt];if(!d)d={buckets:new WeakMap,backEdges:void 0},u[Jt]=d;let m;if(o===u)m=i;else m=Yc(d,e),o=u,i=m;let f=m.get(l);if(f){if(a.value=f.value,f.issues){if(f.issues.length)a.issues.push(...qt(f.issues))}else a.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value);return a}st=m;let h=ct.length,y=s(a,u);st=void 0;let v=ct.length>h?ct.pop():void 0;if(y instanceof Promise)return y.then((P)=>{if(v)v.issues=P.issues.length?qt(P.issues):Xo;return P});if(v)v.issues=y.issues.length?qt(y.issues):Xo;return y};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function ri(){return Xc}function Qc(e,t){let r=e[Jt]?.backEdges;return r!==void 0&&ei(t)&&r.has(t)}var ea=()=>{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,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Ur(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${St(i.values[0])}`;return`Invalid option: expected one of ${zt(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${zt(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((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Kt(){return{localeError:ea()}}var ni;class oi{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 ta(){return new oi}(ni=globalThis).__zod_globalRegistry??(ni.__zod_globalRegistry=ta());var ae=globalThis.__zod_globalRegistry;function ra(e){if(e.checks)e.checks=[...e.checks];return e}function ii(e,t){return new e(ra({type:"string",...b(t)}))}function si(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(t)})}function ci(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(t)})}function Vt(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(t)})}function ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(t)})}function ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(t)})}function li(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(t)})}function pi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(t)})}function di(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(t)})}function fi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(t)})}function mi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(t)})}function hi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(t)})}function gi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(t)})}function xi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(t)})}function bi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(t)})}function yi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(t)})}function vi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(t)})}function _i(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(t)})}function wi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(t)})}function zi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(t)})}function ki(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(t)})}function $i(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(t)})}function Si(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(t)})}function Zi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(t)})}function Pi(e,t){return new e({type:"string",format:"date",check:"string_format",...b(t)})}function Oi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(t)})}function Ii(e,t){return new e({type:"string",format:"duration",check:"string_format",...b(t)})}function Ei(e,t){return new e({type:"boolean",...b(t)})}function Ai(e){return new e({type:"unknown"})}function Ti(e,t){return new e({type:"never",...b(t)})}function lt(e,t){return new Cn({check:"max_length",...b(t),maximum:e})}function fe(e,t){return new Nn({check:"min_length",...b(t),minimum:e})}function pt(e,t){return new Rn({check:"length_equals",...b(t),length:e})}function Gt(e,t){return new Dn({check:"string_format",format:"regex",...b(t),pattern:e})}function Wt(e){return new Ln({check:"string_format",format:"lowercase",...b(e)})}function Ht(e){return new jn({check:"string_format",format:"uppercase",...b(e)})}function Yt(e,t){return new Mn({check:"string_format",format:"includes",...b(t),includes:e})}function Xt(e,t){return new Un({check:"string_format",format:"starts_with",...b(t),prefix:e})}function Qt(e,t){return new Bn({check:"string_format",format:"ends_with",...b(t),suffix:e})}function re(e){return new Fn({check:"overwrite",tx:e})}function er(e){return re((t)=>t.normalize(e))}function tr(){return re((e)=>e.trim())}function rr(){return re((e)=>e.toLowerCase())}function nr(){return re((e)=>e.toUpperCase())}function or(){return re((e)=>Cr(e))}function Ci(e,t,r){return new e({type:"array",element:t,...b(r)})}function Ni(e,t,r){return new e({type:"custom",check:"custom",fn:t,...b(r)})}function Ri(e,t){let r=na((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ce(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(ce(i))}},e(n.value,n)),t);return r}function na(e,t){let r=new L({check:"custom",...b(t)});return r._zod.check=e,r}function Te(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))F(e,n,r[n]);return e}function sr(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??ae,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 me(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 I(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 s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,f=t.processors[o.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;I(d,t,l),t.seen.get(d).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)Te(s.schema,a);if(t.io==="input"&&T(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Di(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function cr(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 s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,m=e.external.uri??((h)=>h);if(d)return{ref:m(d)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${c}/${Di(f)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Di(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=o(s);if(c.def={...c.schema},u)c.defId=u;let l=c.schema;for(let d in l)delete l[d];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
56
-
57
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Mi(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;Mi(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Ui=new Set(["type","properties","required","additionalProperties"]),Li=["oneOf","anyOf"];function ji(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function ir(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Ui.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let l=u.properties?.[s]??ji(u);if(l===null||l===void 0)continue;if(!c.some((d)=>JSON.stringify(d)===JSON.stringify(l)))c.push(l)}let a=c.length===1?c[0]:ir(c)??{allOf:c};F(r,s,a)}for(let s of i.required??[])n.add(s)}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 s of t){let c=ji(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function oa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Ui)if(o in e)return;let r=t.filter((o)=>Li.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=ir(t);else{let o=r[0],i=Li.find((a)=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter((a)=>a!==o),c=o[i].map((a)=>ir([...s,a]));if(c.some((a)=>!a))return;n={[i]:c}}if(!n)return;delete e.allOf,Te(e,n)}function ar(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},d=a.ref;if(a.ref=null,d){n(d);let f=e.seen.get(d),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else Te(u,h);if(Te(u,l),c._zod.parent===d)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in l))delete u[v]}if(h.$ref&&f.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in f.def&&JSON.stringify(u[v])===JSON.stringify(f.def[v]))delete u[v]}}let m=c._zod.parent;if(m&&m!==d){n(m);let f=e.seen.get(m);if(f?.schema.$ref){if(u.$ref=f.schema.$ref,f.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in f.def&&JSON.stringify(u[h])===JSON.stringify(f.def[h]))delete u[h]}}}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Mi(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=c.get(l);if(d)d.push(u);else c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])oa(u)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Te(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 s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;F(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ce(t,"input",e.processors),output:Ce(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function T(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 T(n.element,r);if(n.type==="set")return T(n.valueType,r);if(n.type==="lazy")return T(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 T(n.innerType,r);if(n.type==="intersection")return T(n.left,r)||T(n.right,r);if(n.type==="record"||n.type==="map")return T(n.keyType,r)||T(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return T(n.in,r)||T(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(T(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(T(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(T(o,r))return!0;if(n.rest&&T(n.rest,r))return!0;return!1}return!1}var Bi=(e,t={})=>(r)=>{let n=sr({...r,processors:t});return I(e,n),cr(n,e),ar(n,e)},Ce=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=sr({...o??{},target:i,io:t,processors:r});return I(e,s),cr(s,e),ar(s,e)};var he=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ge=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Fi=(e,t)=>{he(e,"minimum",t),ge(e,"maximum",t)},Vi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Gi=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Wi=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Hi=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},qi=(e,t)=>he(e,"minimum",t.minimum),Ji=(e,t)=>ge(e,"maximum",t.maximum),Ki=(e)=>(t,r)=>{Hi(t,r.format);let[n,o]=e[r.format];he(t,"minimum",n),ge(t,"maximum",o)},ia={greater_than:(e,t)=>he(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ge(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Vi(e,t.value),number_format:Ki(Zt),bigint_format:Ki(Pt),min_length:qi,max_length:Ji,length_equals:(e,t)=>Fi(e,t.length),min_size:qi,max_size:Ji,size_equals:(e,t)=>Fi(e,t.size),string_format:(e,t)=>{if(Hi(e,t.format),t.pattern)Gi(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)=>Wi(e,t.mime)};function ue(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)ia[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)he(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)he(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ge(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ge(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Vi(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)Wi(t,o.mime);for(let i of o.patterns??[])Gi(t,i);return t}var sa={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ca=new Map([[Bt,wn],[it,zn]]),Yi=(e)=>ca.get(e)??e,Xi=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=ue(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=sa[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(a&&a.size>0){let d=[...a].map(Yi);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}};var Qi=(e,t,r,n)=>{r.type="boolean"};var es=(e,t,r,n)=>{r.not={}};var ts=(e,t,r,n)=>{};var rs=(e,t,r,n)=>{let o=e._zod.def,i=Se(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i};var ns=(e,t,r,n)=>{me(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var os=(e,t,r,n)=>{me(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var is=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=ue(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=I(i.element,t,{...n,path:[...n.path,"items"]})};function dt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return dt(t.out);if(t.type==="catch")return dt(t.innerType);return e._zod.optin}var ss=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&me(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)F(o.properties,u,I(s[u],t,{...n,path:[...n.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?dt(l)===void 0:l._zod.optout===void 0)a.push(u)}if(a.length>0)o.required=a;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=I(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},cs=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>I(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},as=(e,t,r,n)=>{let o=e._zod.def,i=I(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=I(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};function ur(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=ur(e,h,r);return y===h?t:y}for(let h of["anyOf","oneOf"]){let y=t[h];if(!Array.isArray(y))continue;let v=y.map((P)=>ur(e,P,r));if(v.some((P,U)=>P!==y[U]))t={...t,[h]:v}}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:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:d,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof f.const==="number")f.const=String(f.const);if(!o)return f;if(f.type="string",!i)f.pattern=(n.includes("number")?et:Dt).source;return f}var lr=new WeakMap;function aa(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 lr.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=ur(t,i,new Set);if(s!==i)r.set(i,s)}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}}var us=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=ue(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=I(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)F(o.patternProperties,Yi(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=I(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=lr.get(t);if(!l)l=[],lr.set(t,l),t.deferred.push(()=>aa(t));l.push(e)}o.additionalProperties=I(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,u=t.io==="input"&&dt(i.valueType)!==void 0;if(a&&!i.partial&&!u){let l=[...a].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l.map(String)}},ls=(e,t,r,n)=>{let o=e._zod.def,i=I(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},ps=(e,t,r,n)=>{let o=e._zod.def;I(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},pr=Symbol();function ds(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return me(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),pr}var fs=(e,t,r,n)=>{let o=e._zod.def;I(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=ds(o.defaultValue,e,t,r,n);if(s!==pr)r.default=s},ms=(e,t,r,n)=>{let o=e._zod.def;I(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=ds(o.defaultValue,e,t,r,n);if(s!==pr)r._prefault=s},hs=(e,t,r,n)=>{let o=e._zod.def;I(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{me(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},gs=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;I(s,t,n);let c=t.seen.get(e);c.ref=s},xs=(e,t,r,n)=>{let o=e._zod.def;I(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var dr=(e,t,r,n)=>{let o=e._zod.def;I(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var bs=new WeakSet([Object.prototype,Error.prototype]);function ft(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 _a=(e,t)=>{Gr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(bs.has(r))return;bs.add(r),ft(r,"format",(n)=>(o)=>Hr(n,o)),ft(r,"flatten",(n)=>(o)=>Wr(n,o)),ft(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ze,2)}),ft(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Ze,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var j=p("ZodError",_a,void 0,{Parent:Error});var ys=He(j),vs=Ye(j),_s=Xe(j),ws=Qe(j),zs=Xr(j),ks=Qr(j),$s=en(j),Ss=tn(j),Zs=rn(j),Ps=nn(j),Os=on(j),Is=sn(j);function za(){if(!C.localeError)D(Kt())}function mt(){if(!C.memoizer)D({memoizer:ri()})}var E=p("ZodType",(e,t)=>(za(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(R(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 V(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(xu(e,t))},superRefine(e,t){return this.check(bu(e,t))},overwrite(e){return this.check(re(e))},optional(){return Ts(this)},exactOptional(){return ou(this)},nullable(){return Cs(this)},nullish(){return Ts(Cs(this))},nonoptional(e){return lu(this,e)},array(){return ne(this)},or(e){return Qa([this,e])},and(e){return tu(this,e)},transform(e){return Ns(this,nu(e))},default(e){return cu(this,e)},prefault(e){return uu(this,e)},catch(e){return du(this,e)},pipe(e){return Ns(this,e)},readonly(){return hu(this)},describe(e){let t=this.clone();return ae.add(t,{description:e}),t},meta(...e){if(e.length===0)return ae.get(this);let t=this.clone();return ae.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 Ge(this,"~standard",{...Ut(this),jsonSchema:{input:Ce(this,"input"),output:Ce(this,"output")}})},set "~standard"(e){X(this,"~standard",e)},parse:function e(t,r){return ys(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await vs(this,t,r,{callee:e})},safeParse(e,t){return _s(this,e,t)},async safeParseAsync(e,t){return ws(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){X(this,"spa",e)},validate(e,t){return Tt(this,e,t)},validateAsync(e,t){return Ct(this,e,t)},encode:function e(t,r){return zs(this,t,r,{callee:e})},decode:function e(t,r){return ks(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await $s(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Ss(this,t,r,{callee:e})},safeEncode(e,t){return Zs(this,e,t)},safeDecode(e,t){return Ps(this,e,t)},async safeEncodeAsync(e,t){return Os(this,e,t)},async safeDecodeAsync(e,t){return Is(this,e,t)},toJSONSchema(e){return Bi(this,{})(e)},get description(){return ae.get(this)?.description},get _def(){return this._zod.def}}),Rs=p("_ZodString",(e,t)=>{ot.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xi(e,r,n,o)},wc({format:(e)=>ue(e).format??null,minLength:(e)=>ue(e).minimum??null,maxLength:(e)=>ue(e).maximum??null},{regex(...e){return this.check(Gt(...e))},includes(...e){return this.check(Yt(...e))},startsWith(...e){return this.check(Xt(...e))},endsWith(...e){return this.check(Qt(...e))},min(...e){return this.check(fe(...e))},max(...e){return this.check(lt(...e))},length(...e){return this.check(pt(...e))},nonempty(...e){return this.check(fe(1,...e))},lowercase(e){return this.check(Wt(e))},uppercase(e){return this.check(Ht(e))},trim(){return this.check(tr())},normalize(...e){return this.check(er(...e))},toLowerCase(){return this.check(rr())},toUpperCase(){return this.check(nr())},slugify(){return this.check(or())}})),ka=p("ZodString",(e,t)=>{ot.init(e,t),Rs.init(e,t)},{email(e){return this.check(si(Oa,e))},url(e){return this.check(pi(Ea,e))},jwt(e){return this.check(Si(Ka,e))},emoji(e){return this.check(di(Aa,e))},guid(e){return this.check(ci(Ia,e))},uuid(e){return this.check(Vt(Ne,e))},uuidv4(e){return this.check(ai(Ne,e))},uuidv6(e){return this.check(ui(Ne,e))},uuidv7(e){return this.check(li(Ne,e))},nanoid(e){return this.check(fi(Ta,e))},cuid(e){return this.check(mi(Ca,e))},cuid2(e){return this.check(hi(Na,e))},ulid(e){return this.check(gi(Ra,e))},base64(e){return this.check(zi(Fa,e))},base64url(e){return this.check(ki(qa,e))},xid(e){return this.check(xi(Da,e))},ksuid(e){return this.check(bi(La,e))},ipv4(e){return this.check(yi(ja,e))},ipv6(e){return this.check(vi(Ma,e))},cidrv4(e){return this.check(_i(Ua,e))},cidrv6(e){return this.check(wi(Ba,e))},e164(e){return this.check($i(Ja,e))},datetime(e){return this.check(Zi($a,e))},date(e){return this.check(Pi(Sa,e))},time(e){return this.check(Oi(Za,e))},duration(e){return this.check(Ii(Pa,e))}});function w(e){return ii(ka,e)}var Z=p("ZodStringFormat",(e,t)=>{S.init(e,t),Rs.init(e,t)}),$a=p("ZodISODateTime",(e,t)=>{xo.init(e,t),Z.init(e,t)}),Sa=p("ZodISODate",(e,t)=>{bo.init(e,t),Z.init(e,t)}),Za=p("ZodISOTime",(e,t)=>{yo.init(e,t),Z.init(e,t)}),Pa=p("ZodISODuration",(e,t)=>{vo.init(e,t),Z.init(e,t)}),Oa=p("ZodEmail",(e,t)=>{io.init(e,t),Z.init(e,t)});var Ia=p("ZodGUID",(e,t)=>{no.init(e,t),Z.init(e,t)});var Ne=p("ZodUUID",(e,t)=>{oo.init(e,t),Z.init(e,t)});function hr(e){return Vt(Ne,e)}var Ea=p("ZodURL",(e,t)=>{ao.init(e,t),Z.init(e,t)});var Aa=p("ZodEmoji",(e,t)=>{uo.init(e,t),Z.init(e,t)});var Ta=p("ZodNanoID",(e,t)=>{lo.init(e,t),Z.init(e,t)});var Ca=p("ZodCUID",(e,t)=>{po.init(e,t),Z.init(e,t)});var Na=p("ZodCUID2",(e,t)=>{fo.init(e,t),Z.init(e,t)});var Ra=p("ZodULID",(e,t)=>{mo.init(e,t),Z.init(e,t)});var Da=p("ZodXID",(e,t)=>{ho.init(e,t),Z.init(e,t)});var La=p("ZodKSUID",(e,t)=>{go.init(e,t),Z.init(e,t)});var ja=p("ZodIPv4",(e,t)=>{_o.init(e,t),Z.init(e,t)});var Ma=p("ZodIPv6",(e,t)=>{zo.init(e,t),Z.init(e,t)});var Ua=p("ZodCIDRv4",(e,t)=>{ko.init(e,t),Z.init(e,t)});var Ba=p("ZodCIDRv6",(e,t)=>{$o.init(e,t),Z.init(e,t)});var Fa=p("ZodBase64",(e,t)=>{Zo.init(e,t),Z.init(e,t)});var qa=p("ZodBase64URL",(e,t)=>{Po.init(e,t),Z.init(e,t)});var Ja=p("ZodE164",(e,t)=>{Oo.init(e,t),Z.init(e,t)});var Ka=p("ZodJWT",(e,t)=>{Io.init(e,t),Z.init(e,t)});var Va=p("ZodBoolean",(e,t)=>{Eo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o)});function xe(e){return Ei(Va,e)}var Ga=p("ZodUnknown",(e,t)=>{Ao.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ts(e,r,n,o)});function Es(){return Ai(Ga)}var Wa=p("ZodNever",(e,t)=>{To.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>es(e,r,n,o)});function Ds(e){return Ti(Wa,e)}var Ha=p("ZodArray",(e,t)=>{mt(),Co.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>is(e,r,n,o),e.element=t.element},{min(e,t){return this.check(fe(e,t))},nonempty(e){return this.check(fe(1,e))},max(e,t){return this.check(lt(e,t))},length(e,t){return this.check(pt(e,t))},unwrap(){return this.element}});function ne(e,t){return Ci(Ha,e,t)}var Ls=p("ZodObject",(e,t)=>{mt(),Do.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ss(e,r,n,o),Sc(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Re(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(R(this._zod.def,{catchall:e}))},passthrough(){return this.clone(R(this._zod.def,{catchall:Es()}))},loose(){return this.clone(R(this._zod.def,{catchall:Es()}))},strict(){return this.clone(R(this._zod.def,{catchall:Ds()}))},strip(){return this.clone(R(this._zod.def,{catchall:void 0}))},extend(e){return xc(this,e)},safeExtend(e){return bc(this,e)},merge(e){return yc(this,e)},pick(e){return hc(this,e)},omit(e){return gc(this,e)},partial(...e){return jr(js,this,e[0])},exactPartial(...e){return jr(Ms,this,e[0],"exactPartial")},required(...e){return vc(Us,this,e[0])}});function Ya(e,t){let r={type:"object",shape:e??{},...b(t)};return new Ls(r)}function M(e,t){return new Ls({type:"object",shape:e,catchall:Ds(),...b(t)})}var Xa=p("ZodUnion",(e,t)=>{Lo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cs(e,r,n,o),e.options=t.options});function Qa(e,t){return new Xa({type:"union",options:e,...b(t)})}var eu=p("ZodIntersection",(e,t)=>{jo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>as(e,r,n,o)});function tu(e,t){return new eu({type:"intersection",left:e,right:t})}var As=p("ZodRecord",(e,t)=>{mt(),Mo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>us(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ht(e,t,r){if(!t||!t._zod)return new As({type:"record",keyType:w(),valueType:e,...b(t)});return new As({type:"record",keyType:e,valueType:t,...b(r)})}var mr=p("ZodEnum",(e,t)=>{Uo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,o,i)=>rs(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 s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new mr({...t,checks:[],...b(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new mr({...t,checks:[],...b(o),entries:i})}});function Re(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new mr({type:"enum",entries:r,...b(t)})}var ru=p("ZodTransform",(e,t)=>{mt(),Bo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>os(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ce(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ce(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function nu(e){return new ru({type:"transform",transform:e})}var js=p("ZodOptional",(e,t)=>{Ft.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ts(e){return new js({type:"optional",innerType:e})}var Ms=p("ZodExactOptional",(e,t)=>{Fo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ou(e){return new Ms({type:"optional",innerType:e})}var iu=p("ZodNullable",(e,t)=>{qo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ls(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Cs(e){return new iu({type:"nullable",innerType:e})}var su=p("ZodDefault",(e,t)=>{Jo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cu(e,t){return new su({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():$t(t)}})}var au=p("ZodPrefault",(e,t)=>{Ko.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ms(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function uu(e,t){return new au({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():$t(t)}})}var Us=p("ZodNonOptional",(e,t)=>{Vo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ps(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function lu(e,t){return new Us({type:"nonoptional",innerType:e,...b(t)})}var pu=p("ZodCatch",(e,t)=>{Go.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function du(e,t){return new pu({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Fr(t)})}var fu=p("ZodPipe",(e,t)=>{Wo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gs(e,r,n,o),e.in=t.in,e.out=t.out});function Ns(e,t){return new fu({type:"pipe",in:e,out:t})}var mu=p("ZodReadonly",(e,t)=>{Ho.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hu(e){return new mu({type:"readonly",innerType:e})}var gu=p("ZodCustom",(e,t)=>{Yo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ns(e,r,n,o)});function xu(e,t={}){return Ni(gu,e,t)}function bu(e,t){return Ri(e,t)}var be=Re(["global","private","shared"]),yu=w().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(48),ye=M({name:yu,description:w().trim().min(1).max(300),body:w().trim().min(1).max(24000)}),gr=M({scope:be,choices:ht(w().max(128),xe()),edits:ht(w().max(128),w().min(1).max(48000)).default({}),custom:ne(ye).max(40).default([])}),Ld=gr.extend({directory:w(),id:w()});var vu=M({id:w(),name:w(),title:w(),description:w(),text:w(),kind:Re(["preference","skill"]),branch:Re(["craft","verification","autonomy"]),axis:w().nullable(),owner:Re(["packaged","managed","user","provider"])}),Bs=M({scope:be,input:gr,inherited:ht(w(),xe()),locked:ht(w(),xe()),items:ne(vu),requirements:ne(w()),libraryEnabled:xe(),migrationRequired:xe(),revisionId:w().nullable()}),Fs=M({id:hr(),changes:ne(M({path:w(),before:w().nullable(),after:w().nullable(),internal:xe()})),warnings:ne(w())}),xr=M({revisionId:w().nullable()});var br=window.location.hash.slice(1),_u=br||sessionStorage.getItem("shadowclone-session")||"";if(br)sessionStorage.setItem("shadowclone-session",br),history.replaceState(null,"",`${location.pathname}${location.search}`);async function B(e){let t=await fetch(e.path,{method:e.body===void 0?"GET":"POST",headers:{Authorization:`Bearer ${_u}`,"Content-Type":"application/json"},body:e.body===void 0?void 0:JSON.stringify(e.body),signal:e.signal}),r=await t.json();if(!t.ok){let n=Ya({error:w()}).safeParse(r);throw Error(n.success?n.data.error:"The local editor could not complete this action.")}return e.schema.parse(r)}function _(e){let t=document.getElementById(e);if(t===null)throw Error("The editor is missing a required control");return t}function N(e){let t=_(e);if(!(t instanceof HTMLInputElement))throw Error("Expected an input control");return t}function Le(e){let t=_(e);if(!(t instanceof HTMLSelectElement))throw Error("Expected a selection control");return t}function Q(e){let t=_(e);if(!(t instanceof HTMLTextAreaElement))throw Error("Expected a text editor");return t}function ve(e){let t=_(e);if(!(t instanceof HTMLDialogElement))throw Error("Expected an editor dialog");return t}function g(e){let t=document.createElement(e.tag);if(e.className)t.className=e.className;if(e.text!==void 0)t.textContent=e.text;return t}function oe(e){let t=_("notice");t.textContent=e.message,t.classList.toggle("success",e.success===!0),t.hidden=e.message.length===0}function je(e){oe({message:e instanceof Error?e.message:"The action failed."})}var x={view:null,input:{scope:"global",choices:{},edits:{},custom:[]},activeId:"",search:"",dirty:!1};function J(e){let t=x.view?.locked[e.id];if(t!==void 0)return t;let r=x.input.choices[e.id];if(r!==void 0)return r;if(e.id.startsWith("custom:")&&x.input.custom.some((n)=>e.id===`custom:${n.name}`))return!0;return x.view?.inherited[e.id]===!0}function yr(e){if(x.view?.locked[e.id]!==void 0)return;let t=!J(e);if(x.input.choices[e.id]=t,t&&e.axis){for(let r of x.view?.items??[])if(r.axis===e.axis&&r.id!==e.id)x.input.choices[r.id]=!1,delete x.input.edits[r.id]}if(!t)delete x.input.edits[e.id];x.dirty=!0}function vr(e){_("custom-status").textContent="",N("custom-name").value=e?`my-${e.name}`.slice(0,48):"",N("custom-description").value=e?`Use alongside ${e.name} for my working preferences.`:"",Q("custom-body").value=e?`# Personal guidance for ${e.title}
58
-
59
- `:"",ve("custom-dialog").showModal()}function qs(){let e=ye.parse({name:N("custom-name").value,description:N("custom-description").value,body:Q("custom-body").value}),t=`custom:${e.name}`;if(x.view?.items.some((r)=>r.name===e.name))throw Error("Choose a name that does not replace an existing skill.");x.input.custom.push(e),x.input.choices[t]=!0,x.dirty=!0,x.activeId=t,x.view?.items.push({id:t,name:e.name,title:e.name.replaceAll("-"," "),description:e.description,text:`---
60
- name: ${e.name}
61
- description: ${JSON.stringify(e.description)}
62
- ---
63
-
64
- ${e.body}
65
- `,kind:"skill",branch:"craft",axis:null,owner:"managed"}),ve("custom-dialog").close(),N("custom-name").value="",Q("custom-body").value=""}var Js={"design-deep-modules":{title:"Deep modules",summary:"Keep interfaces small and useful. Put complexity behind a clear boundary so callers have less to understand."},"typescript-type-safety":{title:"Explicit types",summary:"Represent valid states in the type system. Narrow uncertain values and keep unsafe assertions out of the implementation."},"scope-confirmed-changes":{title:"Scoped changes",summary:"Confirm the problem before editing. Keep the change focused, preserve surrounding behavior, and verify the result."},"diagnose-before-editing":{title:"Prove the bug",summary:"Trace the failure and establish its cause before changing code. Use evidence to choose the smallest useful fix."},"prove-regression-tests":{title:"Test the failure",summary:"Prove a regression test detects the original bug. Restore the fix and check that the same test passes."},"verify-and-review":{title:"Verify the finish",summary:"Run the relevant checks, inspect the complete diff, and report what was verified before calling the task done."},"testing-first":{title:"Test first",summary:"Capture the expected behavior at a public boundary before implementing the change. Let the failing test guide the work."},"testing-risk-based":{title:"Test the risk",summary:"Spend testing effort where behavior can break. Choose checks that catch meaningful failures without mirroring the implementation."},"research-primary-sources":{title:"Go to the source",summary:"Check authoritative documentation and original evidence when a technical decision depends on facts that need verification."},"planning-first":{title:"Plan the change",summary:"Establish the approach before implementation so the scope, decisions, and intended outcome are clear."},"planning-when-costly":{title:"Plan when it matters",summary:"Move directly on straightforward tasks. Pause for a plan when the cost, uncertainty, or consequences call for one."},"questions-autonomous":{title:"Keep moving",summary:"Use judgment to resolve routine choices. Ask when missing information changes the outcome or an action needs authorization."},"questions-early":{title:"Ask early",summary:"Resolve meaningful uncertainty with the user before investing in an implementation built on the wrong assumption."},"resolve-conflicts-by-intent":{title:"Preserve intent",summary:"Understand what both sides of a merge are trying to achieve. Resolve the conflict and verify the combined behavior."},"dependencies-existing":{title:"Know your tools",summary:"Look for a solution in the existing stack before adding another dependency."},"dependencies-mature":{title:"Choose proven tools",summary:"Use established, focused packages when they provide substantial reusable logic and justify the dependency."},"refactor-boundaries":{title:"Improve boundaries",summary:"Make a refactor when it improves responsibilities and simplifies the change. Keep its purpose connected to the task."},"refactor-preserve":{title:"Respect the structure",summary:"Work within the current structure and preserve unrelated code while making the requested change."}};function le(e){return Js[e.id]?.title??e.title}function Ks(e){let t=Js[e.item.id];if(t&&e.editedText===void 0&&e.item.owner==="packaged")return t.summary;let r=(e.editedText??e.item.text).replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/,"").split(`
66
- `).filter((n)=>n.trim()&&!n.startsWith("#")&&!n.startsWith("```")).slice(0,2).join(" ").replace(/\*\*/g,"");return r.length>320?`${r.slice(0,317).trimEnd()}…`:r}var _r=["design-deep-modules","typescript-type-safety","refactor-preserve","diagnose-before-editing","testing-first","verify-and-review","planning-first","questions-autonomous","scope-confirmed-changes"];function wu(e){let t=g({tag:"details",className:"editor"});t.append(g({tag:"summary",text:"Edit instructions"}));let r=g({tag:"textarea"});r.value=x.input.edits[e.item.id]??e.item.text,r.maxLength=48000,r.setAttribute("aria-label",`Instructions for ${e.item.title}`);let n=g({tag:"button",className:"quiet-button",text:"Save to draft"});return n.addEventListener("click",()=>{if(!J(e.item))yr(e.item);x.input.edits[e.item.id]=r.value,x.input.choices[e.item.id]=!0,x.dirty=!0,oe({message:"Instructions added to your draft. Review the changes before applying.",success:!0}),e.rerender()}),t.append(r,n),t}function Vs(e){let t=_("detail"),r=x.view?.items.find((c)=>c.id===x.activeId);if(t.replaceChildren(),!r){t.append(g({tag:"h2",text:"Choose a skill."})),t.append(g({tag:"p",className:"detail-description",text:"Inspect a star to see what it teaches your agent."}));return}t.append(g({tag:"p",className:"eyebrow",text:`${r.branch.toUpperCase()} / ${r.kind.toUpperCase()}`}),g({tag:"h2",text:le(r)}),g({tag:"p",className:"detail-description",text:r.description}));let n=g({tag:"div",className:"behavior"});n.append(g({tag:"p",className:"eyebrow",text:"YOUR AGENT WILL"}),g({tag:"p",text:Ks({item:r,editedText:x.input.edits[r.id]})})),t.append(n);let o=r.owner==="provider",i=x.view?.locked[r.id]!==void 0;if(t.append(g({tag:"p",className:"skill-status",text:i?"◇ Shared requirement":o?"◇ Managed by its provider":"◇ Workflow guidance"})),i){t.append(g({tag:"p",className:"owner-note",text:"This choice belongs to the shared repository build. Switch to shared scope to propose a reviewed change."}));return}let s=g({tag:"button",className:"primary-button",text:o?"Create a local companion":J(r)?"Unequip skill":"Equip skill"});if(s.addEventListener("click",()=>{if(o){e.companion(r);return}yr(r),e.rerender()}),t.append(s),o)t.append(g({tag:"p",className:"owner-note",text:"Enable or disable this package in its harness. A companion adds your own instructions without changing the package."}));else t.append(wu({item:r,rerender:e.rerender}))}var Gs=M({title:w().min(1).max(80),summary:w().min(1).max(600),strengths:ne(w().min(1).max(180)).max(3),tradeoffs:ne(w().min(1).max(180)).max(3)}),Ws=M({id:hr(),destination:w(),payload:w(),limits:w(),cached:Gs.nullable()}),Hs=M({description:Gs});function gt(e){let t=!1,r=(n)=>{let o=e.getBoundingClientRect();return n.target===e&&(n.clientX<o.left||n.clientX>o.right||n.clientY<o.top||n.clientY>o.bottom)};e.addEventListener("pointerdown",(n)=>{t=r(n)}),e.addEventListener("click",(n)=>{if(t&&r(n))e.close();t=!1})}function xt(e){let t=g({tag:"dialog"}),r=g({tag:"div",className:"dialog-heading"}),n=g({tag:"button",className:"quiet-button",text:"✕"}),o=g({tag:"details",className:"file-change"}),i=g({tag:"div",className:"dialog-actions"}),s=g({tag:"p",className:"review-message"}),c=g({tag:"button",className:"quiet-button",text:"Keep editing"}),a=g({tag:"button",className:"primary-button",text:e.confirm}),u=new AbortController;t.setAttribute("aria-label",e.title),n.setAttribute("aria-label","Close model request"),s.setAttribute("role","status"),n.addEventListener("click",()=>t.close()),gt(t),r.append(g({tag:"h2",text:e.title}),n),o.append(g({tag:"summary",text:"Exact payload sent to the model"}),g({tag:"pre",text:e.review.payload})),c.addEventListener("click",()=>t.close()),t.addEventListener("close",()=>{u.abort(),t.remove()});async function l(){if(a.disabled)return;a.disabled=!0,a.textContent="Generating…",c.textContent="Cancel generation",s.textContent="Your model is working. You can cancel and keep your original draft.";try{let d=await B({path:e.path,schema:e.schema,body:{previewId:e.review.id},signal:u.signal});if(!u.signal.aborted)e.accept(d),t.close()}catch(d){if(u.signal.aborted)return;s.className="review-warning",s.textContent=d instanceof Error?d.message:"Generation failed. Your draft is unchanged.",a.textContent="Request ended",c.textContent="Back to editing"}}a.addEventListener("click",()=>{l().catch(()=>{s.textContent="Generation failed. Return to editing to try again."})}),i.append(c,a),t.append(r,g({tag:"p",className:"review-message",text:`Destination: ${e.review.destination}`}),g({tag:"p",className:"review-message",text:e.review.limits}),g({tag:"p",className:"review-message",text:e.explanation}),o,s,i),document.body.append(t),t.showModal()}var Ys=null,_e=null;function wr(){let e=_("model-description");if(e.replaceChildren(),!_e||Ys!==JSON.stringify(x.input))return;e.append(g({tag:"h3",text:_e.title}),g({tag:"p",text:_e.summary}));for(let t of _e.strengths)e.append(g({tag:"p",text:`Strength: ${t}`}));for(let t of _e.tradeoffs)e.append(g({tag:"p",text:`Tradeoff: ${t}`}))}async function Xs(){let e=JSON.stringify(x.input),t=await B({path:"/api/description/preview",schema:Ws,body:x.input});xt({review:t,title:"Describe your agent.",explanation:"An interpretation of your selected guidance. It does not change your skills or add personality instructions.",confirm:"Send and describe",path:"/api/description/generate",schema:Hs,accept:(r)=>{_e=r.description,Ys=e,wr()}})}var zr={craft:{title:"The Artisan",trait:"Thoughtful craft"},verification:{title:"The Investigator",trait:"Evidence before confidence"},autonomy:{title:"The Navigator",trait:"Deliberate decisions"}};function Qs(){let e=x.view?.items.filter((s)=>s.owner!=="provider"&&J(s))??[],t=["craft","verification","autonomy"].map((s)=>({branch:s,count:e.filter((c)=>c.branch===s).length})).sort((s,c)=>c.count-s.count),[r]=t,n=r?zr[r.branch]:zr.craft;_("equipped-count").textContent=`${e.length} ${e.length===1?"skill":"skills"} equipped${x.dirty?" · unsaved changes":""}`,_("identity-title").textContent=e.length?n.title:"An open canvas",_("identity-description").textContent=e.length?`Your working style is shaped by ${e.slice(0,3).map((s)=>le(s).toLowerCase()).join(", ")}${e.length>3?`, and ${e.length-3} more equipped skills`:""}.`:"Choose the instincts you want your agent to bring to work.";let o=_("traits");o.replaceChildren();for(let s of t.filter((c)=>c.count>0))o.append(g({tag:"span",className:"trait",text:`${zr[s.branch].trait} · ${s.count}`}));let i=_("requirements");if(i.replaceChildren(),i.hidden=!x.view?.requirements.length,x.view?.requirements.length){i.append(g({tag:"h3",text:"◇ Repository requirements"}));for(let s of x.view.requirements)i.append(g({tag:"p",text:s}))}}var bt=null;async function ec(){let e=await B({path:"/api/preview",schema:Fs,body:x.input});bt=e;let t=_("review-content");t.replaceChildren(),t.append(g({tag:"p",className:"review-message",text:`${e.changes.length} local files will change. Review the instructions and destinations below.`}));for(let r of e.warnings)t.append(g({tag:"p",className:"review-warning",text:r}));for(let r of e.changes){let n=g({tag:"details",className:"file-change"});if(n.append(g({tag:"summary",text:r.path})),r.internal)n.append(g({tag:"p",text:"Local configuration or supporting resource. Its previous version is retained for undo."}));else n.append(g({tag:"h4",text:"Before"}),g({tag:"pre",text:r.before??"New file"}),g({tag:"h4",text:"After"}),g({tag:"pre",text:r.after??"Remove managed file"}));t.append(n)}ve("review-dialog").showModal()}async function tc(){if(bt===null)throw Error("Review your build before applying it.");await B({path:"/api/apply",schema:xr,body:{previewId:bt.id}}),bt=null,ve("review-dialog").close(),oe({message:"Build equipped. Start a fresh agent session to use your updated skills.",success:!0})}async function rc(){let e=x.view?.revisionId;if(!e||!window.confirm("Restore the files from before the last apply? Later edits will be preserved if they conflict."))return;await B({path:"/api/undo",schema:xr,body:{revisionId:e}}),oe({message:"Restored the previous build.",success:!0})}var zu={modules:"M4 4h6v6H4ZM14 4h6v6h-6ZM4 14h6v6H4ZM14 14h6v6h-6Z",code:"m8 5-6 7 6 7m8-14 6 7-6 7m-3-16-2 18",focus:"M8 3H4v4m12-4h4v4M4 17v4h4m12-4v4h-4M8 9h8v6H8Z",bug:"M9 5 7 2m8 3 2-3M8 9V7a4 4 0 0 1 8 0v2M6 9h12v6a6 6 0 0 1-12 0Zm6 0v12M2 10h4m12 0h4M2 15h4m12 0h4M4 21l3-3m10 0 3 3",flask:"M9 3h6m-5 0v7l-6 9q-1 2 2 2h12q3 0 2-2l-6-9V3M7 15h10",check:"m2 12 5 5L19 5M12 17l10-10",route:"M7 5h10a3 3 0 0 1 0 6H7a3 3 0 0 0 0 6h10M7 2a3 3 0 1 0 0 6 3 3 0 0 0 0-6m10 12a3 3 0 1 0 0 6 3 3 0 0 0 0-6",compass:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20m-3 7 8-2-2 8-8 2Z",flag:"M5 22V3q4-3 8 0t7 0v10q-3 3-7 0t-8 0",merge:"M6 2v8q0 5 6 5h6m-4-4 4 4-4 4M6 18v4M18 2v5",layers:"m12 2 10 6-10 6L2 8Zm-9 11 9 5 9-5M3 17l9 5 9-5",link:"m9 15 6-6m-7 4-2 2a4 4 0 0 0 6 6l3-3m1-5 2-2a4 4 0 0 0-6-6L9 8",shield:"m12 2 8 3v7q0 6-8 10-8-4-8-10V5Zm-4 9 3 3 5-6",question:"M8 7a4 4 0 1 1 6 4q-2 1-2 4m0 4v1M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20",spark:"m12 2 3 7 7 3-7 3-3 7-3-7-7-3 7-3Z",search:"M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14m5 12 6 6"},ku={"design-deep-modules":"modules","typescript-type-safety":"code","scope-confirmed-changes":"focus","refactor-boundaries":"layers","refactor-preserve":"shield","dependencies-existing":"link","dependencies-mature":"layers","diagnose-before-editing":"bug","prove-regression-tests":"flask","testing-first":"flask","testing-risk-based":"shield","research-primary-sources":"search","verify-and-review":"check","planning-first":"route","planning-when-costly":"compass","questions-autonomous":"flag","questions-early":"question","resolve-conflicts-by-intent":"merge"};function nc(e){let t=document.createElementNS("http://www.w3.org/2000/svg","svg"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=ku[e.id]??"spark";return t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","1.25"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),t.setAttribute("aria-hidden","true"),r.setAttribute("d",zu[n]),t.append(r),t}var $u={craft:"CRAFT",verification:"VERIFICATION",autonomy:"AUTONOMY"};function Su(e){let t=g({tag:"button",className:"skill-node"});t.classList.toggle("active",x.activeId===e.item.id),t.classList.toggle("equipped",J(e.item)),t.setAttribute("aria-pressed",String(x.activeId===e.item.id)),t.setAttribute("aria-label",`${e.item.title}${J(e.item)?", equipped":""}`);let r=g({tag:"span",className:"node-gem"}),n=g({tag:"span",className:"node-icon"});return n.setAttribute("aria-hidden","true"),n.append(nc(e.item)),r.append(n),t.append(r,g({tag:"span",className:"node-label",text:le(e.item)})),t.addEventListener("click",()=>e.inspect(e.item.id)),t}function oc(e){let t=_("tree");t.replaceChildren();for(let r of["craft","verification","autonomy"]){let n=g({tag:"div",className:"branch"});n.append(g({tag:"h3",className:"branch-title",text:$u[r]}));let o=x.view?.items.filter((i)=>i.branch===r&&`${le(i)} ${i.title} ${i.description}`.toLowerCase().includes(x.search.toLowerCase()))??[];o.sort((i,s)=>{let c=_r.indexOf(i.id),a=_r.indexOf(s.id);return(c<0?100:c)-(a<0?100:a)});for(let i of o)n.append(Su({item:i,inspect:e.inspect}));if(o.length===0)n.append(g({tag:"p",className:"branch-empty",text:"No matching skills"}));t.append(n)}}function ic(){let e=_("starfield");if(e.childElementCount>0)return;for(let r=0;r<54;r+=1){let n=document.createElementNS("http://www.w3.org/2000/svg","g"),o=document.createElementNS("http://www.w3.org/2000/svg","circle"),i=12+(r*137+29)%576,s=8+(r*173+61)%884;if(n.setAttribute("class",`star star-phase-${r%7}`),o.setAttribute("cx",String(i)),o.setAttribute("cy",String(s)),o.setAttribute("r",r%9===0?"1.7":"1"),n.append(o),r%9===0){let c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("d",`M${i-4} ${s}h8M${i} ${s-4}v8`),c.setAttribute("class","star-rays"),n.append(c)}e.append(n)}let t=()=>{e.classList.toggle("paused",document.hidden)};document.addEventListener("visibilitychange",t),t()}function kr(){let e=_("tree-connections"),t=_("constellation").getBoundingClientRect(),r=_("tree-origin").getBoundingClientRect(),n={x:r.x+r.width/2-t.x,y:r.y+r.height/2-t.y};e.setAttribute("viewBox",`0 0 ${t.width} ${t.height}`),e.replaceChildren();for(let o of document.querySelectorAll(".branch")){let i=[...o.querySelectorAll(".node-gem")].map((l)=>{let d=l.getBoundingClientRect();return{x:d.x+d.width/2-t.x,y:d.y+d.height/2-t.y}}),s=i[0],c=i.at(-1);if(!s||!c)continue;let a=document.createElementNS("http://www.w3.org/2000/svg","path"),u=Math.min(n.y-24,c.y+74);a.setAttribute("d",[`M${s.x} ${s.y}`,...i.slice(1).map((l)=>`L${l.x} ${l.y}`),`C${c.x} ${u} ${c.x} ${n.y} ${n.x} ${n.y}`].join(" ")),e.append(a)}}function sc(){new ResizeObserver(kr).observe(_("constellation"))}var Df=M({name:w().trim().max(48),description:w().trim().max(300),body:w().trim().min(1).max(24000)}),cc=M({id:hr(),destination:w(),payload:w(),limits:w(),cached:ye.nullable()}),ac=M({skill:ye});function pe(e){_("custom-status").textContent=e}async function Zu(){let e=Q("custom-body").value;if(!e.trim()){pe("Describe what your agent should do, then use AI to shape it into a skill."),Q("custom-body").focus();return}let t=await B({path:"/api/skill/preview",schema:cc,body:{name:N("custom-name").value,description:N("custom-description").value,body:e}});xt({review:t,title:"Draft your skill with AI.",explanation:"Only the form fields below are sent. The result fills this form for you to edit; adding and applying it remain your choice.",confirm:"Send and draft",path:"/api/skill/generate",schema:ac,accept:({skill:r})=>{N("custom-name").value=r.name,N("custom-description").value=r.description,Q("custom-body").value=r.body,pe("AI draft ready. Edit the instructions before adding the skill to your build."),Q("custom-body").focus()}})}function uc(){let e=_("custom-ai");if(!(e instanceof HTMLButtonElement))return;e.addEventListener("click",()=>{if(e.disabled)return;e.disabled=!0,pe("Preparing your model request…"),Zu().catch((t)=>{pe(t instanceof Error?t.message:"Could not prepare an AI draft. Your text is unchanged.")}).finally(()=>{if(e.disabled=!1,_("custom-status").textContent==="Preparing your model request…")pe("")})})}var $r=!1;async function Sr(e){if($r)return;$r=!0;let t=document.querySelectorAll("button, input, select, textarea"),r=Array.from(t,(n)=>({control:n,disabled:n.disabled}));for(let{control:n}of r)n.disabled=!0;try{await e()}finally{for(let{control:n,disabled:o}of r)n.disabled=o;$r=!1}}function Me(e){_(e.id).addEventListener("click",()=>Sr(e.action).catch(je))}function lc(){let e=document.createElement("template");e.innerHTML=`
67
- <dialog id="review-dialog" aria-labelledby="review-title">
68
- <div class="dialog-heading">
69
- <div>
70
- <p class="eyebrow">READY TO EQUIP</p>
71
- <h2 id="review-title">Review your changes.</h2>
72
- </div>
73
- <button class="close-dialog quiet-button" aria-label="Close review">
74
- ✕
75
- </button>
76
- </div>
77
- <div id="review-content"></div>
78
- <div class="dialog-actions">
79
- <button class="close-dialog quiet-button">Keep editing</button>
80
- <button id="apply" class="primary-button">Apply build</button>
81
- </div>
82
- </dialog>
83
-
84
- <dialog id="custom-dialog" aria-labelledby="custom-title">
85
- <div class="dialog-heading">
86
- <h2 id="custom-title">Create a skill.</h2>
87
- <button
88
- class="close-dialog quiet-button"
89
- aria-label="Close skill editor"
90
- >
91
- ✕
92
- </button>
93
- </div>
94
- <form id="custom-form">
95
- <label>
96
- Skill name
97
- <input
98
- id="custom-name"
99
- pattern="[a-z0-9]+(-[a-z0-9]+)*"
100
- maxlength="48"
101
- placeholder="review-with-evidence"
102
- required
103
- >
104
- </label>
105
- <label>
106
- When should your agent use it?
107
- <input
108
- id="custom-description"
109
- maxlength="300"
110
- placeholder="Use when reviewing an implementation."
111
- required
112
- >
113
- </label>
114
- <label>
115
- What should your agent do?
116
- <textarea
117
- id="custom-body"
118
- rows="9"
119
- maxlength="24000"
120
- placeholder="Describe the decisions, steps, and evidence you expect."
121
- required
122
- ></textarea>
123
- </label>
124
- <p id="custom-status" class="review-message" role="status"></p>
125
- <div class="dialog-actions">
126
- <button id="custom-ai" type="button" class="quiet-button">✦ Use AI</button>
127
- <button type="submit" class="primary-button">
128
- Add to your build
129
- </button>
130
- </div>
131
- </form>
132
- </dialog>
133
- `,document.body.append(e.content);for(let t of document.querySelectorAll("dialog"))gt(t)}lc();function Ue(){oc({inspect:(e)=>{x.activeId=e,Ue()}}),Vs({rerender:Ue,companion:vr}),Qs(),wr(),kr(),_("undo").hidden=x.view?.revisionId===null}async function yt(e){let t=await B({path:`/api/build?scope=${e}`,schema:Bs});if(x.view=t,x.input=structuredClone(t.input),x.dirty=!1,!t.items.some((n)=>n.id===x.activeId))x.activeId=t.items.find(J)?.id??t.items[0]?.id??"";Le("scope").value=e;let r={global:"Your personal build follows you across coding agents.",private:"Only this repository. Stored privately on your machine; shared requirements stay in force.",shared:"A portable build for this repository. Review every file before sharing it with your team."};if(_("scope-note").textContent=r[e],_("library-note").hidden=t.libraryEnabled,t.migrationRequired)oe({message:"Your existing profile needs its reviewed skills migration before this build can be applied. You can explore the editor now."});Ue()}Me({id:"review",action:ec});Me({id:"describe",action:Xs});Me({id:"apply",action:async()=>{await tc(),await yt(x.input.scope)}});Me({id:"undo",action:async()=>{await rc(),await yt(x.input.scope)}});_("new-skill").addEventListener("click",()=>vr());_("custom-form").addEventListener("submit",(e)=>{e.preventDefault();try{qs(),Ue()}catch(t){pe(t instanceof Error?t.message:"The skill could not be added.")}});N("search").addEventListener("input",()=>{x.search=N("search").value,Ue()});Le("scope").addEventListener("change",()=>{if(x.dirty&&!window.confirm("Discard the draft and switch build scope?")){Le("scope").value=x.input.scope;return}let e=be.parse(Le("scope").value);Sr(()=>yt(e)).catch(je)});for(let e of document.querySelectorAll(".close-dialog"))e.addEventListener("click",()=>e.closest("dialog")?.close());window.addEventListener("beforeunload",(e)=>{if(x.dirty)e.preventDefault()});var pc=be.safeParse(new URLSearchParams(location.search).get("scope")??"global");ic();sc();uc();yt(pc.success?pc.data:"global").catch(je);