lshed 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.1 — 2026-09-05
4
+
5
+ Two things `lshed status` got wrong on a real machine after a one-plugin marketplace was added.
6
+
7
+ - A marketplace and a plugin with the same name (`llm-guidelines` from `llm-guidelines@llm-guidelines`) were both recorded as `packages/llm-guidelines`. The marketplace keeps the name (its own commands need it); the plugin becomes `llm-guidelines@llm-guidelines`. Installer order is fixed, so every machine derives the same ids.
8
+ - `extraKnownMarketplaces` in `settings.json` is state Claude Code writes when a marketplace is added, like `enabledPlugins`; `init` and `add` no longer offer it. The `claude-marketplace:` package brings it back on `restore`.
9
+ - An empty JSON entry file (Antigravity creates `mcp_config.json` with no content) reads as `{}` instead of failing `status` and `restore`.
10
+
3
11
  ## 0.14.0 — 2026-09-05
4
12
 
5
13
  `--agent codex` now puts skills in `~/.agents/skills/`, the location Codex documents, instead of `~/.codex/skills/`.
package/README.md CHANGED
@@ -553,8 +553,8 @@ $ lshed add
553
553
  settings/theme
554
554
  ```
555
555
 
556
- - `enabledPlugins` is never taken: the plugin packages own it, and `restore` rebuilds it by installing them.
557
- `enabledPlugins`는 담지 않습니다. 플러그인 패키지의 몫이고, `restore`가 설치하면서 다시 만듭니다.
556
+ - `enabledPlugins` and `extraKnownMarketplaces` are never taken: the plugin and marketplace packages own them, and `restore` rebuilds them by installing those.
557
+ `enabledPlugins`와 `extraKnownMarketplaces`는 담지 않습니다. 플러그인·마켓플레이스 패키지의 몫이고, `restore`가 설치하면서 다시 만듭니다.
558
558
  - Absolute paths under your home directory become `${HOME}/…` in the shed, so a hook command written on one machine works on another. Claude Code does not expand variables in `settings.json`, so `restore` fills `${HOME}` and any `${VAR}` itself from your shell; unset variables are reported and left as placeholders.
559
559
  홈 아래 절대 경로는 창고에서 `${HOME}/…`가 되어, 한 기기에서 쓴 훅 명령이 다른 기기에서도 돕니다. Claude Code는 `settings.json`의 변수를 채우지 않으므로 `restore`가 `${HOME}`과 `${VAR}`를 셸에서 직접 채우고, 없는 변수는 알린 뒤 자리표시자로 둡니다.
560
560
  - `env` is treated as a secret map: keys that look secret are masked, the rest (`CLAUDE_CODE_MAX_OUTPUT_TOKENS`, …) travel as they are.
package/dist/cli.js CHANGED
@@ -164,8 +164,8 @@ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._life
164
164
  `),this.outputHelp({error:!0}));let i=n||{},r=i.exitCode||1,o=i.code||"commander.error";this._exit(r,o,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in K.env){let n=t.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,K.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Ao(this.options),n=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&n(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(r=>!n(r)).forEach(r=>{this.setOptionValueWithSource(r,i.implied[r],"implied")})})}missingArgument(t){let n=`error: missing required argument '${t}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(t){let n=`error: option '${t.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let n=`error: required option '${t.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,n){let i=s=>{let a=s.attributeName(),c=this.getOptionValue(a),u=this.options.find(d=>d.negate&&a===d.attributeName()),l=this.options.find(d=>!d.negate&&a===d.attributeName());return u&&(u.presetArg===void 0&&c===!1||u.presetArg!==void 0&&c===u.presetArg)?u:l||s},r=s=>{let a=i(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${r(t)} cannot be used with ${r(n)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let n="";if(t.startsWith("--")&&this._showSuggestionAfterError){let r=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);r=r.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);n=_u(t,r)}let i=`error: unknown option '${t}'${n}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,i=n===1?"":"s",r=t.length,o=this.parent?` for '${this.name()}'`:"",s=t.join(", "),a=`error: too many arguments${o}. Expected ${n} argument${i} but got ${r}: ${s}.`;this.error(a,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],n="";if(this._showSuggestionAfterError){let r=[];this.createHelp().visibleCommands(this).forEach(o=>{r.push(o.name()),o.alias()&&r.push(o.alias())}),n=_u(t,r)}let i=`error: unknown command '${t}'${n}`;this.error(i,{code:"commander.unknownCommand"})}version(t,n,i){if(t===void 0)return this._version;this._version=t,n=n||"-V, --version",i=i||"output the version number";let r=this.createOption(n,i);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${t}
165
165
  `),this._exit(0,"commander.version",t)}),this}description(t,n){return t===void 0&&n===void 0?this._description:(this._description=t,n&&(this._argsDescription=n),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let n=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(n=this.commands[this.commands.length-1]),t===n._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let r=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${r}'`)}return n._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(n=>this.alias(n)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(i=>Oo(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?n:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=ft.basename(t,ft.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let n=this.createHelp(),i=this._getOutputContext(t);n.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let r=n.formatHelp(this,n);return i.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(t){t=t||{};let n=!!t.error,i,r,o;return n?(i=a=>this._outputConfiguration.writeErr(a),r=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(i=a=>this._outputConfiguration.writeOut(a),r=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:n,write:a=>(r||(a=this._outputConfiguration.stripColor(a)),i(a)),hasColors:r,helpWidth:o}}outputHelp(t){let n;typeof t=="function"&&(n=t,t=void 0);let i=this._getOutputContext(t),r={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let o=this.helpInformation({error:i.error});if(n&&(o=n(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",r),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",r))}helpOption(t,n){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",n??"display help for command"),(t||n)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let n=Number(K.exitCode??0);n===0&&t&&typeof t!="function"&&t.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(t,n){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
166
166
  Expecting one of '${i.join("', '")}'`);let r=`${t}Help`;return this.on(r,o=>{let s;typeof n=="function"?s=n({error:o.error,command:o.command}):s=n,s&&o.write(`${s}
167
- `)}),this}_outputHelpIfRequested(t){let n=this._getHelpOption();n&&t.find(r=>n.is(r))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function $v(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let n,i="127.0.0.1",r="9229",o;return(o=t.match(/^(--inspect(-brk)?)$/))!==null?n=o[1]:(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=o[1],/^\d+$/.test(o[3])?r=o[3]:i=o[3]):(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=o[1],i=o[3],r=o[4]),n&&r!=="0"?`${n}=${i}:${parseInt(r)+1}`:t})}function bv(){if(K.env.NO_COLOR||K.env.FORCE_COLOR==="0"||K.env.FORCE_COLOR==="false")return!1;if(K.env.FORCE_COLOR||K.env.CLICOLOR_FORCE!==void 0)return!0}var yT=new Ar;import Vj from"os";import ko from"path";import{promises as Fj}from"fs";import{promises as Tv}from"fs";import Dn from"path";import cx from"os";import{promises as ox}from"fs";import xv from"path";var ix=/^([\w.-]+)\/([\w.-]+)(?:@([^#]+))?(?:#(.+))?$/;function Oe(e){let t=e.indexOf(":");if(t<=0)throw new Error(`source\uC5D0 \uC2A4\uD0B4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: "${e}" (\uC608: file:./skills/x, github:user/repo@v1)`);let n=e.slice(0,t),i=e.slice(t+1);switch(n){case"file":if(!i)throw new Error(`file: \uB4A4\uC5D0 \uACBD\uB85C\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4: "${e}"`);return{scheme:n,path:i};case"github":{let r=ix.exec(i);if(!r)throw new Error(`github: \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4: "${e}" (\uC608: github:user/repo@v1.0#sub/path)`);let[,o,s,a,c]=r;return{scheme:n,owner:o,repo:s,ref:a,subpath:c}}case"git":{let r=i.lastIndexOf("#"),o=r>=0?i.slice(0,r):i,s=r>=0?i.slice(r+1):void 0;if(!o)throw new Error(`git: \uB4A4\uC5D0 URL \uC774 \uC5C6\uC2B5\uB2C8\uB2E4: "${e}"`);return{scheme:n,url:o,ref:s||void 0}}default:if(!/^[a-z][\w-]*$/.test(n))throw new Error(`\uC54C \uC218 \uC5C6\uB294 \uC2A4\uD0B4 "${n}": "${e}"`);return{scheme:"other",name:n,rest:i}}}function wv(e){return e.scheme==="file"||e.scheme==="github"||e.scheme==="git"}function _v(e){switch(e.scheme){case"file":return`file:${e.path}`;case"github":return`github:${e.owner}/${e.repo}${e.ref?`@${e.ref}`:""}${e.subpath?`#${e.subpath}`:""}`;case"git":return`git:${e.url}${e.ref?`#${e.ref}`:""}`;case"other":return`${e.name}:${e.rest}`}}function ku(e){if(e.scheme==="github")return{url:`https://github.com/${e.owner}/${e.repo}.git`,ref:e.ref};if(e.scheme==="git")return{url:e.url,ref:e.ref};throw new Error("file: \uCD9C\uCC98\uB294 clone \uB300\uC0C1\uC774 \uC544\uB2D9\uB2C8\uB2E4")}function kv(e,t){let n=/^(?:https?:\/\/github\.com\/|git@github\.com:)([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(e);return _v(n?{scheme:"github",owner:n[1],repo:n[2],ref:t}:{scheme:"git",url:e,ref:t})}async function Po(e,t){try{return JSON.parse(await ox.readFile(e,"utf8"))}catch{return t}}var Sv=e=>xv.join(e.adapter.root,"plugins","installed_plugins.json"),Iv=e=>xv.join(e.adapter.root,"plugins","known_marketplaces.json");function er(e){let t=Oe(e.source);if(t.scheme!=="other")throw new Error(`package ${e.id}: ${e.source} \uB294 \uD50C\uB7EC\uADF8\uC778 \uCD9C\uCC98\uAC00 \uC544\uB2D9\uB2C8\uB2E4`);return t.rest}async function Eo(e,t){try{await e.exec("claude",t)}catch(n){throw n.code==="ENOENT"?new Error("claude CLI \uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. Claude Code \uAC00 \uC124\uCE58\uB418\uC5B4 \uC788\uC5B4\uC57C \uD50C\uB7EC\uADF8\uC778\uC744 \uBCF5\uC6D0\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."):n}}var Ov={name:"claude-marketplace",schemes:["claude-marketplace"],priority:10,async detect(e){let t=await Po(Iv(e),{}),n=[];for(let[i,r]of Object.entries(t)){let o=r.source;o.source==="github"&&o.repo?n.push({id:i,source:`claude-marketplace:${o.repo}`,rev:o.repo}):e.log(` ! marketplace ${i}: ${o.source} \uCD9C\uCC98\uB294 \uC544\uC9C1 \uAE30\uB85D\uD558\uC9C0 \uBABB\uD569\uB2C8\uB2E4 (\uAC74\uB108\uB700)`)}return n},async status(e,t){let i=(await Po(Iv(e),{}))[t.id];return{present:!!i,rev:i?.source.repo}},async install(e,t,n,i){let r=er(t);return await Eo(e,["plugin","marketplace","add",r,"--scope","user"]),r},async update(e,t){return await Eo(e,["plugin","marketplace","update",t.id]),er(t)},describe(e){return`claude plugin marketplace add ${er(e)}`},cwd(e){return e.adapter.root}},Av={name:"claude-plugin",schemes:["claude-plugin"],priority:20,async detect(e){let t=await Po(Sv(e),{version:2,plugins:{}}),n=[];for(let[i,r]of Object.entries(t.plugins)){let o=r.find(a=>a.scope==="user");if(!o)continue;let[s]=i.split("@");n.push({id:s,source:`claude-plugin:${i}`,rev:o.version})}return n},async status(e,t){let i=(await Po(Sv(e),{version:2,plugins:{}})).plugins[er(t)]?.find(r=>r.scope==="user");return{present:!!i,rev:i?.version}},async install(e,t,n,i){return await Eo(e,["plugin","install",er(t),"--scope","user",...i.yes?["-y"]:[]]),(await this.status(e,t)).rev??"?"},async update(e,t){return await Eo(e,["plugin","update",er(t)]),(await this.status(e,t)).rev??"?"},describe(e,t){return`claude plugin install ${er(e)}${t?` (\uC804\uC5D0 ${t}; \uACE0\uC815\uC740 \uC548 \uB428)`:""}`},cwd(e){return e.adapter.root}};import{promises as No}from"fs";import sx from"path";var tr=class{constructor(t){this.spec=t;this.name=t.name,this.secretKeys=t.secretKeys,this.secretRootIds=t.secretRootIds,this.expandsEnv=t.expandsEnv}spec;kind="entry";name;secretKeys;secretRootIds;expandsEnv;file(){return this.spec.file()}async load(){let t=await this.file();try{return JSON.parse(await No.readFile(t,"utf8"))}catch(n){if(n.code==="ENOENT")return{};throw new Error(`${t} \uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${n.message}`)}}section(t){let n=this.spec.under?t[this.spec.under]:t;return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}async read(){let t={...this.section(await this.load())};for(let n of this.spec.skip??[])delete t[n];if(this.spec.fromLocal)for(let[n,i]of Object.entries(t))t[n]=this.spec.fromLocal(n,i);return t}async write(t,n){let i=await this.file(),r=await this.load(),o={...this.section(r)};n===null?delete o[t]:o[t]=this.spec.toLocal?this.spec.toLocal(t,n):n;let s=this.spec.under?{...r,[this.spec.under]:o}:o;await No.mkdir(sx.dirname(i),{recursive:!0});let a=`${i}.lshed-${process.pid}.tmp`;await No.writeFile(a,JSON.stringify(s,null,2)+`
168
- `),await No.rename(a,i)}};import{promises as oe}from"fs";import{createHash as Pv}from"crypto";import de from"path";var pt=["node_modules",".git","__pycache__",".venv",".mypy_cache",".pytest_cache",".DS_Store","*.log"];function ax(e,t){return t.startsWith("*.")?e.endsWith(t.slice(1)):e===t}function Su(e,t){return e?e.split("/").some(n=>t.some(i=>ax(n,i))):!1}function Co(e){let t=de.resolve(e.replace(/^\\\\\?\\/,""));return process.platform==="win32"?t.toLowerCase():t}async function xu(e){let t=de.resolve(e),n=[];for(;;)try{return de.join(await oe.realpath(t),...n.reverse())}catch{let i=de.dirname(t);if(i===t)return de.resolve(e);n.push(de.basename(t)),t=i}}function jo(e,t){let n=Co(e),i=Co(t);return n===i||i.startsWith(n.endsWith(de.sep)?n:n+de.sep)}async function se(e){try{return await oe.access(e),!0}catch{return!1}}async function Ev(e){try{return(await oe.stat(e)).isDirectory()}catch{return!1}}async function Iu(e,t=pt){if(!await se(e))return[];if(!await Ev(e))return[""];let n=[];async function i(r,o){let s=await oe.readdir(r,{withFileTypes:!0});for(let a of s){let c=o?`${o}/${a.name}`:a.name;if(Su(c,t))continue;let u=de.join(r,a.name),l;try{l=await oe.stat(u)}catch{continue}l.isDirectory()?await i(u,c):l.isFile()&&n.push(c)}}return await i(e,""),n.sort()}async function zv(e){return Pv("sha256").update(await oe.readFile(e)).digest("hex")}async function zr(e,t=pt){if(!await se(e))return null;let n=Pv("sha256");for(let i of await Iu(e,t))n.update(i).update("\0").update(await oe.readFile(i?de.join(e,i):e)).update("\0");return n.digest("hex")}async function tt(e,t,n=pt){await oe.rm(t,{recursive:!0,force:!0}),await oe.mkdir(de.dirname(t),{recursive:!0});let i=de.resolve(e);await oe.cp(e,t,{recursive:!0,dereference:!0,filter:async r=>{let o=de.relative(i,de.resolve(r)).split(de.sep).join("/");if(Su(o,n))return!1;try{(await oe.lstat(r)).isSymbolicLink()&&await oe.stat(r)}catch{return!1}return!0}})}async function To(e){await oe.rm(e,{recursive:!0,force:!0})}async function Do(e){try{return(await oe.lstat(e)).isSymbolicLink()}catch{return!1}}async function Nv(e,t){try{return(await oe.lstat(e)).isSymbolicLink()?Co(await oe.realpath(e))===Co(await oe.realpath(t)):!1}catch{return!1}}async function Cv(e,t,n=pt){await oe.rm(t,{recursive:!0,force:!0}),await oe.mkdir(de.dirname(t),{recursive:!0});let i=de.resolve(e),r=await Ev(i);try{return await oe.symlink(i,t,r?process.platform==="win32"?"junction":"dir":"file"),"link"}catch{return await tt(e,t,n),"copy"}}async function jv(e,t,n=pt){let i=new Set(await Iu(e,n)),r=new Set(await Iu(t,n)),o=[];for(let s of[...new Set([...i,...r])].sort()){let a=s?de.join(e,s):e,c=s?de.join(t,s):t;i.has(s)&&!r.has(s)?o.push({status:"A",file:s}):!i.has(s)&&r.has(s)?o.push({status:"D",file:s}):await zv(a)!==await zv(c)&&o.push({status:"M",file:s})}return o}var Dv=[{name:"skills",root:"skills",kind:"dir"},{name:"agents",root:"agents",kind:"file"},{name:"commands",root:"commands",kind:"file"}],Lo=class{name="claude-code";root;entryCats;constructor(t){this.root=t??process.env.CLAUDE_CONFIG_DIR??Dn.join(cx.homedir(),".claude");let n=this.root,i=!t&&!!process.env.CLAUDE_CONFIG_DIR;this.entryCats=[new tr({name:"mcp",file:async()=>{let r=Dn.join(n,".claude.json");return i||await se(r)?r:`${n}.json`},under:"mcpServers",secretKeys:["env","headers"],expandsEnv:!0}),new tr({name:"settings",file:async()=>Dn.join(n,"settings.json"),secretKeys:[],secretRootIds:["env"],expandsEnv:!1,skip:["enabledPlugins"]})]}entries(){return this.entryCats}categories(){return Dv}instructionsStrategy(){return"import"}instructionsFileName(){return"CLAUDE.md"}installers(){return[Ov,Av]}async scan(){let t=[];for(let n of Dv)await this.walk(n,Dn.join(this.root,n.root),"",t);return t}async walk(t,n,i,r){let o;try{o=await Tv.readdir(n,{withFileTypes:!0})}catch{return}o.sort((s,a)=>s.name<a.name?-1:s.name>a.name?1:0);for(let s of o){if(s.name.startsWith("."))continue;let a=Dn.join(n,s.name),c=i?`${i}/${s.name}`:s.name,u;try{u=await Tv.stat(a)}catch{continue}t.kind==="dir"?u.isDirectory()&&r.push({category:t.name,id:c,path:a}):u.isDirectory()?await this.walk(t,a,c,r):u.isFile()&&s.name.endsWith(".md")&&r.push({category:t.name,id:c.slice(0,-3),path:a})}}};import{promises as Jv}from"fs";import It from"path";import Kv from"os";import{promises as Vo}from"fs";import wx from"path";var ux=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Ln=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let n=!0,i=!0,r="Z";if(typeof t=="string"){let o=t.match(ux);o?(o[1]||(n=!1,t=`0000-01-01T${t}`),i=!!o[2],i&&t[10]===" "&&(t=t.replace(" ","T")),o[2]&&+o[2]>23?t="":(r=o[3]||null,t=t.toUpperCase(),!r&&i&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=n,this.#r=i,this.#e=r)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,n="Z"){let i=new e(t);return i.#e=n,i}static wrapAsLocalDateTime(t){let n=new e(t);return n.#e=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#t=!1,n.#e=null,n}};function lx(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function dx(e,t,n){let i=e.split(/\r\n|\n|\r/g),r="",o=(Math.log10(t+1)|0)+1;for(let s=t-1;s<=t+1;s++){let a=i[s-1];a&&(r+=s.toString().padEnd(o," "),r+=": ",r+=a,r+=`
167
+ `)}),this}_outputHelpIfRequested(t){let n=this._getHelpOption();n&&t.find(r=>n.is(r))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function $v(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let n,i="127.0.0.1",r="9229",o;return(o=t.match(/^(--inspect(-brk)?)$/))!==null?n=o[1]:(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=o[1],/^\d+$/.test(o[3])?r=o[3]:i=o[3]):(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=o[1],i=o[3],r=o[4]),n&&r!=="0"?`${n}=${i}:${parseInt(r)+1}`:t})}function bv(){if(K.env.NO_COLOR||K.env.FORCE_COLOR==="0"||K.env.FORCE_COLOR==="false")return!1;if(K.env.FORCE_COLOR||K.env.CLICOLOR_FORCE!==void 0)return!0}var yT=new Ar;import Vj from"os";import ko from"path";import{promises as Fj}from"fs";import{promises as Tv}from"fs";import Dn from"path";import cx from"os";import{promises as ox}from"fs";import xv from"path";var ix=/^([\w.-]+)\/([\w.-]+)(?:@([^#]+))?(?:#(.+))?$/;function Oe(e){let t=e.indexOf(":");if(t<=0)throw new Error(`source\uC5D0 \uC2A4\uD0B4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: "${e}" (\uC608: file:./skills/x, github:user/repo@v1)`);let n=e.slice(0,t),i=e.slice(t+1);switch(n){case"file":if(!i)throw new Error(`file: \uB4A4\uC5D0 \uACBD\uB85C\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4: "${e}"`);return{scheme:n,path:i};case"github":{let r=ix.exec(i);if(!r)throw new Error(`github: \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4: "${e}" (\uC608: github:user/repo@v1.0#sub/path)`);let[,o,s,a,c]=r;return{scheme:n,owner:o,repo:s,ref:a,subpath:c}}case"git":{let r=i.lastIndexOf("#"),o=r>=0?i.slice(0,r):i,s=r>=0?i.slice(r+1):void 0;if(!o)throw new Error(`git: \uB4A4\uC5D0 URL \uC774 \uC5C6\uC2B5\uB2C8\uB2E4: "${e}"`);return{scheme:n,url:o,ref:s||void 0}}default:if(!/^[a-z][\w-]*$/.test(n))throw new Error(`\uC54C \uC218 \uC5C6\uB294 \uC2A4\uD0B4 "${n}": "${e}"`);return{scheme:"other",name:n,rest:i}}}function wv(e){return e.scheme==="file"||e.scheme==="github"||e.scheme==="git"}function _v(e){switch(e.scheme){case"file":return`file:${e.path}`;case"github":return`github:${e.owner}/${e.repo}${e.ref?`@${e.ref}`:""}${e.subpath?`#${e.subpath}`:""}`;case"git":return`git:${e.url}${e.ref?`#${e.ref}`:""}`;case"other":return`${e.name}:${e.rest}`}}function ku(e){if(e.scheme==="github")return{url:`https://github.com/${e.owner}/${e.repo}.git`,ref:e.ref};if(e.scheme==="git")return{url:e.url,ref:e.ref};throw new Error("file: \uCD9C\uCC98\uB294 clone \uB300\uC0C1\uC774 \uC544\uB2D9\uB2C8\uB2E4")}function kv(e,t){let n=/^(?:https?:\/\/github\.com\/|git@github\.com:)([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(e);return _v(n?{scheme:"github",owner:n[1],repo:n[2],ref:t}:{scheme:"git",url:e,ref:t})}async function Po(e,t){try{return JSON.parse(await ox.readFile(e,"utf8"))}catch{return t}}var Sv=e=>xv.join(e.adapter.root,"plugins","installed_plugins.json"),Iv=e=>xv.join(e.adapter.root,"plugins","known_marketplaces.json");function er(e){let t=Oe(e.source);if(t.scheme!=="other")throw new Error(`package ${e.id}: ${e.source} \uB294 \uD50C\uB7EC\uADF8\uC778 \uCD9C\uCC98\uAC00 \uC544\uB2D9\uB2C8\uB2E4`);return t.rest}async function Eo(e,t){try{await e.exec("claude",t)}catch(n){throw n.code==="ENOENT"?new Error("claude CLI \uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. Claude Code \uAC00 \uC124\uCE58\uB418\uC5B4 \uC788\uC5B4\uC57C \uD50C\uB7EC\uADF8\uC778\uC744 \uBCF5\uC6D0\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."):n}}var Ov={name:"claude-marketplace",schemes:["claude-marketplace"],priority:10,async detect(e){let t=await Po(Iv(e),{}),n=[];for(let[i,r]of Object.entries(t)){let o=r.source;o.source==="github"&&o.repo?n.push({id:i,source:`claude-marketplace:${o.repo}`,rev:o.repo}):e.log(` ! marketplace ${i}: ${o.source} \uCD9C\uCC98\uB294 \uC544\uC9C1 \uAE30\uB85D\uD558\uC9C0 \uBABB\uD569\uB2C8\uB2E4 (\uAC74\uB108\uB700)`)}return n},async status(e,t){let i=(await Po(Iv(e),{}))[t.id];return{present:!!i,rev:i?.source.repo}},async install(e,t,n,i){let r=er(t);return await Eo(e,["plugin","marketplace","add",r,"--scope","user"]),r},async update(e,t){return await Eo(e,["plugin","marketplace","update",t.id]),er(t)},describe(e){return`claude plugin marketplace add ${er(e)}`},cwd(e){return e.adapter.root}},Av={name:"claude-plugin",schemes:["claude-plugin"],priority:20,async detect(e){let t=await Po(Sv(e),{version:2,plugins:{}}),n=[];for(let[i,r]of Object.entries(t.plugins)){let o=r.find(a=>a.scope==="user");if(!o)continue;let[s]=i.split("@");n.push({id:s,source:`claude-plugin:${i}`,rev:o.version})}return n},async status(e,t){let i=(await Po(Sv(e),{version:2,plugins:{}})).plugins[er(t)]?.find(r=>r.scope==="user");return{present:!!i,rev:i?.version}},async install(e,t,n,i){return await Eo(e,["plugin","install",er(t),"--scope","user",...i.yes?["-y"]:[]]),(await this.status(e,t)).rev??"?"},async update(e,t){return await Eo(e,["plugin","update",er(t)]),(await this.status(e,t)).rev??"?"},describe(e,t){return`claude plugin install ${er(e)}${t?` (\uC804\uC5D0 ${t}; \uACE0\uC815\uC740 \uC548 \uB428)`:""}`},cwd(e){return e.adapter.root}};import{promises as No}from"fs";import sx from"path";var tr=class{constructor(t){this.spec=t;this.name=t.name,this.secretKeys=t.secretKeys,this.secretRootIds=t.secretRootIds,this.expandsEnv=t.expandsEnv}spec;kind="entry";name;secretKeys;secretRootIds;expandsEnv;file(){return this.spec.file()}async load(){let t=await this.file();try{let n=await No.readFile(t,"utf8");return n.trim()?JSON.parse(n):{}}catch(n){if(n.code==="ENOENT")return{};throw new Error(`${t} \uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${n.message}`)}}section(t){let n=this.spec.under?t[this.spec.under]:t;return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}async read(){let t={...this.section(await this.load())};for(let n of this.spec.skip??[])delete t[n];if(this.spec.fromLocal)for(let[n,i]of Object.entries(t))t[n]=this.spec.fromLocal(n,i);return t}async write(t,n){let i=await this.file(),r=await this.load(),o={...this.section(r)};n===null?delete o[t]:o[t]=this.spec.toLocal?this.spec.toLocal(t,n):n;let s=this.spec.under?{...r,[this.spec.under]:o}:o;await No.mkdir(sx.dirname(i),{recursive:!0});let a=`${i}.lshed-${process.pid}.tmp`;await No.writeFile(a,JSON.stringify(s,null,2)+`
168
+ `),await No.rename(a,i)}};import{promises as oe}from"fs";import{createHash as Pv}from"crypto";import de from"path";var pt=["node_modules",".git","__pycache__",".venv",".mypy_cache",".pytest_cache",".DS_Store","*.log"];function ax(e,t){return t.startsWith("*.")?e.endsWith(t.slice(1)):e===t}function Su(e,t){return e?e.split("/").some(n=>t.some(i=>ax(n,i))):!1}function Co(e){let t=de.resolve(e.replace(/^\\\\\?\\/,""));return process.platform==="win32"?t.toLowerCase():t}async function xu(e){let t=de.resolve(e),n=[];for(;;)try{return de.join(await oe.realpath(t),...n.reverse())}catch{let i=de.dirname(t);if(i===t)return de.resolve(e);n.push(de.basename(t)),t=i}}function jo(e,t){let n=Co(e),i=Co(t);return n===i||i.startsWith(n.endsWith(de.sep)?n:n+de.sep)}async function se(e){try{return await oe.access(e),!0}catch{return!1}}async function Ev(e){try{return(await oe.stat(e)).isDirectory()}catch{return!1}}async function Iu(e,t=pt){if(!await se(e))return[];if(!await Ev(e))return[""];let n=[];async function i(r,o){let s=await oe.readdir(r,{withFileTypes:!0});for(let a of s){let c=o?`${o}/${a.name}`:a.name;if(Su(c,t))continue;let u=de.join(r,a.name),l;try{l=await oe.stat(u)}catch{continue}l.isDirectory()?await i(u,c):l.isFile()&&n.push(c)}}return await i(e,""),n.sort()}async function zv(e){return Pv("sha256").update(await oe.readFile(e)).digest("hex")}async function zr(e,t=pt){if(!await se(e))return null;let n=Pv("sha256");for(let i of await Iu(e,t))n.update(i).update("\0").update(await oe.readFile(i?de.join(e,i):e)).update("\0");return n.digest("hex")}async function tt(e,t,n=pt){await oe.rm(t,{recursive:!0,force:!0}),await oe.mkdir(de.dirname(t),{recursive:!0});let i=de.resolve(e);await oe.cp(e,t,{recursive:!0,dereference:!0,filter:async r=>{let o=de.relative(i,de.resolve(r)).split(de.sep).join("/");if(Su(o,n))return!1;try{(await oe.lstat(r)).isSymbolicLink()&&await oe.stat(r)}catch{return!1}return!0}})}async function To(e){await oe.rm(e,{recursive:!0,force:!0})}async function Do(e){try{return(await oe.lstat(e)).isSymbolicLink()}catch{return!1}}async function Nv(e,t){try{return(await oe.lstat(e)).isSymbolicLink()?Co(await oe.realpath(e))===Co(await oe.realpath(t)):!1}catch{return!1}}async function Cv(e,t,n=pt){await oe.rm(t,{recursive:!0,force:!0}),await oe.mkdir(de.dirname(t),{recursive:!0});let i=de.resolve(e),r=await Ev(i);try{return await oe.symlink(i,t,r?process.platform==="win32"?"junction":"dir":"file"),"link"}catch{return await tt(e,t,n),"copy"}}async function jv(e,t,n=pt){let i=new Set(await Iu(e,n)),r=new Set(await Iu(t,n)),o=[];for(let s of[...new Set([...i,...r])].sort()){let a=s?de.join(e,s):e,c=s?de.join(t,s):t;i.has(s)&&!r.has(s)?o.push({status:"A",file:s}):!i.has(s)&&r.has(s)?o.push({status:"D",file:s}):await zv(a)!==await zv(c)&&o.push({status:"M",file:s})}return o}var Dv=[{name:"skills",root:"skills",kind:"dir"},{name:"agents",root:"agents",kind:"file"},{name:"commands",root:"commands",kind:"file"}],Lo=class{name="claude-code";root;entryCats;constructor(t){this.root=t??process.env.CLAUDE_CONFIG_DIR??Dn.join(cx.homedir(),".claude");let n=this.root,i=!t&&!!process.env.CLAUDE_CONFIG_DIR;this.entryCats=[new tr({name:"mcp",file:async()=>{let r=Dn.join(n,".claude.json");return i||await se(r)?r:`${n}.json`},under:"mcpServers",secretKeys:["env","headers"],expandsEnv:!0}),new tr({name:"settings",file:async()=>Dn.join(n,"settings.json"),secretKeys:[],secretRootIds:["env"],expandsEnv:!1,skip:["enabledPlugins","extraKnownMarketplaces"]})]}entries(){return this.entryCats}categories(){return Dv}instructionsStrategy(){return"import"}instructionsFileName(){return"CLAUDE.md"}installers(){return[Ov,Av]}async scan(){let t=[];for(let n of Dv)await this.walk(n,Dn.join(this.root,n.root),"",t);return t}async walk(t,n,i,r){let o;try{o=await Tv.readdir(n,{withFileTypes:!0})}catch{return}o.sort((s,a)=>s.name<a.name?-1:s.name>a.name?1:0);for(let s of o){if(s.name.startsWith("."))continue;let a=Dn.join(n,s.name),c=i?`${i}/${s.name}`:s.name,u;try{u=await Tv.stat(a)}catch{continue}t.kind==="dir"?u.isDirectory()&&r.push({category:t.name,id:c,path:a}):u.isDirectory()?await this.walk(t,a,c,r):u.isFile()&&s.name.endsWith(".md")&&r.push({category:t.name,id:c.slice(0,-3),path:a})}}};import{promises as Jv}from"fs";import It from"path";import Kv from"os";import{promises as Vo}from"fs";import wx from"path";var ux=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Ln=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let n=!0,i=!0,r="Z";if(typeof t=="string"){let o=t.match(ux);o?(o[1]||(n=!1,t=`0000-01-01T${t}`),i=!!o[2],i&&t[10]===" "&&(t=t.replace(" ","T")),o[2]&&+o[2]>23?t="":(r=o[3]||null,t=t.toUpperCase(),!r&&i&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=n,this.#r=i,this.#e=r)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,n="Z"){let i=new e(t);return i.#e=n,i}static wrapAsLocalDateTime(t){let n=new e(t);return n.#e=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#t=!1,n.#e=null,n}};function lx(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function dx(e,t,n){let i=e.split(/\r\n|\n|\r/g),r="",o=(Math.log10(t+1)|0)+1;for(let s=t-1;s<=t+1;s++){let a=i[s-1];a&&(r+=s.toString().padEnd(o," "),r+=": ",r+=a,r+=`
169
169
  `,s===t&&(r+=" ".repeat(o+n+2),r+=`^
170
170
  `))}return r}var F=class extends Error{line;column;codeblock;constructor(t,n){let[i,r]=lx(n.toml,n.ptr),o=dx(n.toml,i,r);super(`Invalid TOML document: ${t}
171
171
 
@@ -244,7 +244,7 @@ ${c}`:c:"",l=Function,d=`return (input) => {
244
244
  ${c}
245
245
  }`,f;try{f=new l(...s,d)(...a)}catch(p){throw new q(`this schema (generated code failed to evaluate: ${p.message})`)}return t?.debug&&(f.code=u),f}function T(e,t){for(let[i,r]of e.constants)if(r===t)return i;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function D(e){return`v${e.varCounter++}`}function bA(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return Ue;let i=n;return i.issues.length===0?i.value:Ue}function ke(e,t,n,i,r=!0){let o=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return te(e,t,n,i,r)}catch(u){if(!(u instanceof q)||!u.islandable)throw u;if(e.content.length=o,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let d of l)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=c,_A(e,t,n,i)}}function _A(e,t,n,i){let r=T(t,n),o=T(t,bA),s=D(t);return e.write(`const ${s} = ${o}(${r}, ${i});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var wA=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function kA(e,t,n,i){let r=n._zod.def.checks;if(!r||r.length===0)return i;let o=i;for(let s of r){let a=s._zod.def;if(a.when&&!wA.has(a.check))throw new q('check with a custom "when" condition');switch(a.check){case"greater_than":SA(e,t,a,o);break;case"less_than":IA(e,t,a,o);break;case"multiple_of":xA(e,t,a,o);break;case"number_format":G$(e,a,o);break;case"min_length":{let c=ar(a.minimum,"min_length"),u=wf(e,t,o,`${o}.length >= ${c} && ${o}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=ar(a.maximum,"max_length"),u=wf(e,t,o,`${o}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=ar(a.length,"length_equals"),u=wf(e,t,o,`${o}.length >= ${c} && ${o}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${o}.size < ${ar(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${o}.size > ${ar(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${o}.size !== ${ar(a.size,"size_equals")}) return INVALID;`);break;case"string_format":o=W$(e,t,a,o);break;case"custom":o=EA(e,t,s,o);break;case"bigint_format":OA(e,a,o);break;case"mime_type":AA(e,t,a,o);break;case"property":zA(e,t,a,o);break;case"overwrite":{let c=D(t);PA(e,t,s,o,c),o=c;break}default:throw new q(`check type ${a.check}`)}}return o}function wf(e,t,n,i){let r=T(t,nr),o=D(t);return e.write(`const ${o} = typeof ${n} === "string" && ${i} ? ${r}(${n}) : ${n}.length;`),o}function ar(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new q(`${t} bound of type ${typeof e}`);return`${e}`}function B$(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new q("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new q("comparison check with Invalid Date bound");return T(e,t)}throw new q(`comparison check bound of type ${typeof t}`)}function SA(e,t,n,i){let r=n.inclusive?"<":"<=";e.write(`if (${i} ${r} ${B$(t,n.value)}) return INVALID;`)}function IA(e,t,n,i){let r=n.inclusive?">":">=";e.write(`if (${i} ${r} ${B$(t,n.value)}) return INVALID;`)}function xA(e,t,n,i){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new q("multiple_of check with a zero divisor");e.write(`if (${i} % ${n.value}n !== 0n) return INVALID;`)}else{let r=T(t,Gn);e.write(`if (${r}(${i}, ${ar(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function G$(e,t,n){let i=t.format;switch(i){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new q(`number format ${i}`)}}function OA(e,t,n){let i=t.format;if(i)switch(i){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new q(`bigint format ${i}`)}}function AA(e,t,n,i){let r=n.mime;if(r&&r.length>0){let o=T(t,new Set(r));e.write(`if (!${o}.has(${i}.type)) return INVALID;`)}}function zA(e,t,n,i){let r=`${i}[${JSON.stringify(n.property)}]`;te(e,t,n.schema,r)}function PA(e,t,n,i,r){let o=n._zod.def.tx;if(!o)throw new q("overwrite check without a transform function");if(lr(o))throw new Be("z.compile: async overwrite transforms are not supported");let s=T(t,o);e.write(`const ${r} = ${s}(${i});`)}function kf(){throw new Ee}function xf(e){this.issues.push(e)}function EA(e,t,n,i){let r=n._zod.def;if(r.fn){if(lr(r.fn))throw new Be("z.compile: async .refine() predicates are not supported");let o=T(t,r.fn),s=T(t,kf),a=D(t);return e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),i}if(n._zod.check){if(lr(n._zod.check))throw new Be("z.compile: async .superRefine() / check functions are not supported");let o=n._zod.check,a=T(t,u=>{let l={value:u,issues:[],addIssue:xf};return o(l)instanceof Promise&&kf(),l.issues.length===0?l.value:Ue}),c=D(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new q("custom check without a predicate or check function")}var NA=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function W$(e,t,n,i){let r=n.format;if(r==="base64"){let c=T(t,si);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(r==="base64url"){let c=T(t,xs);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(r==="jwt"){let c=T(t,As),u=T(t,n.alg??null);return e.write(`if (!${c}(${i}, ${u})) return INVALID;`),i}if(r==="ipv6"){let c=T(t,oi);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(r==="cidrv6"){let c=T(t,Is);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(r==="credit_card"){let c=T(t,Os);return e.write(`if (!${c}(${i})) return INVALID;`),i}let o=n;if(r==="url"||r==="httpurl"||o.normalize||o.hostname!==void 0||o.protocol!==void 0){let c=T(t,_s),u=T(t,n),l=D(t),d=D(t);if(e.write(`const ${l} = ${i}.trim();`),e.write(`const ${d} = ${c}(${l}, ${u});`),e.write(`if (typeof ${d} === "number") return INVALID;`),o.hostname!==void 0){let m=T(t,ks);e.write(`if (!${m}(${d}, ${u}.hostname)) return INVALID;`)}if(o.protocol!==void 0){let m=T(t,Ss);e.write(`if (!${m}(${d}, ${u}.protocol)) return INVALID;`)}let f=D(t),p=o.normalize?`${d}.href`:`${T(t,ws)}(${l})`;return e.write(`const ${f} = ${p};`),f}let s=n.fn;if(s){if(lr(s))throw new q(`async string format ${r}`);let c=T(t,s);return e.write(`if (!${c}(${i})) return INVALID;`),i}if(NA.has(r)&&n.pattern){let c=T(t,n.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${i})) return INVALID;`),i}let a=n.format;switch(a){case"regex":throw new q("regex format without a pattern");case"lowercase":e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${i}.includes(${Ae(n.includes)})) return INVALID;`);break;case"starts_with":{let c=n.prefix;e.write(`if (${i}.slice(0, ${c.length}) !== ${Ae(c)}) return INVALID;`);break}case"ends_with":{let c=n.suffix;e.write(`if (${i}.slice(-${c.length}) !== ${Ae(c)}) return INVALID;`);break}default:throw new q(`string format ${a}`)}return i}function te(e,t,n,i,r=!0){let o=n._zod.def,s=o.type;if(o.coerce)throw new q(`coercion (z.coerce.${s}())`);let a=r||!!o.checks?.length,c;switch(s){case"string":c=CA(e,t,n,i);break;case"number":c=jA(e,n,i);break;case"boolean":c=TA(e,i);break;case"bigint":c=DA(e,n,i);break;case"symbol":c=LA(e,i);break;case"undefined":c=UA(e,i);break;case"null":c=MA(e,i);break;case"any":case"unknown":c=i;break;case"never":e.write("return INVALID;"),c=i;break;case"void":c=RA(e,i);break;case"nan":c=VA(e,i);break;case"date":c=FA(e,i);break;case"object":c=ZA(e,t,n,i,a);break;case"optional":c=qA(e,t,n,i,a);break;case"nullable":c=BA(e,t,n,i,a);break;case"array":c=GA(e,t,n,i,a);break;case"literal":c=WA(e,t,n,i);break;case"enum":c=HA(e,t,n,i);break;case"readonly":{let u=J$(e,t,n,i),l=D(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":J$(e,t,n,i),c="true";break;case"default":case"prefault":c=YA(e,t,n,i);break;case"nonoptional":c=XA(e,t,n,i);break;case"tuple":c=QA(e,t,n,i);break;case"union":c=ez(e,t,n,i);break;case"intersection":c=nz(e,t,n,i);break;case"record":c=iz(e,t,n,i);break;case"map":c=sz(e,t,n,i);break;case"set":c=az(e,t,n,i);break;case"file":c=cz(e,i);break;case"template_literal":c=uz(e,t,n,i);break;case"lazy":c=lz(e,t,n,i);break;case"pipe":c=dz(e,t,n,i);break;case"custom":c=fz(e,t,n,i);break;case"transform":c=hz(e,t,n,i);break;case"catch":c=mz(e,t,n,i);break;default:throw new q(`schema type ${s}`)}return c===null?null:kA(e,t,n,c)}function CA(e,t,n,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let r=n._zod.def;return r.format===void 0?i:W$(e,t,r,i)}function jA(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let i=t._zod.def;return i.check==="number_format"&&i.format&&G$(e,{format:i.format},n),n}function TA(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function DA(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let i=t._zod.def;if(i.format)switch(i.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function LA(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function UA(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function MA(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function RA(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function VA(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function FA(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function ZA(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let s=o.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=$=>typeof $=="symbol"?T(t,$):Ae($),d=$=>typeof $=="symbol"?`[${l($)}]`:Ae($),f=s;if(a.includes("__proto__"))throw new q('object shape key "__proto__"');let p=new Map;for(let $ of u){let k=f[$],O=l($),x=D(t);if(e.write(`const ${x} = ${i}[${O}];`),k._zod.optin!==void 0){let I=D(t);e.write(`let ${I} = (() => {`),e.indented(j=>{let z=ke(j,t,k,x);j.write(`return ${z};`)}),e.write("})();"),k._zod.optout==="optional"?(e.write(`if (${I} === INVALID) {`),e.indented(j=>{j.write(`if (${O} in ${i}) return INVALID;`),j.write(`${I} = undefined;`)}),e.write("}")):e.write(`if (${I} === INVALID) return INVALID;`),p.set($,I)}else{KA(k)&&e.write(`if (!(${O} in ${i})) return INVALID;`);let I=ke(e,t,k,x,r);I!==null&&p.set($,I)}}let m=o.catchall,h="none";if(m){let $=m._zod.def.type;if($==="never"){let k=a.map(O=>`k !== ${Ae(O)}`).join(" && ")||"true";e.write(`for (const k in ${i}) {`),e.indented(O=>{O.write(`if (${k}) return INVALID;`)}),e.write("}")}else($==="unknown"||$==="any")&&!m._zod.def.checks?.length?h="passthrough":h="schema"}let g=D(t),S=u.some($=>ur(f[$])||Sf(f[$]));if(!r){if(h==="schema"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(k=>{k.write('if (k === "__proto__") continue;'),$&&k.write(`if (${$}.has(k)) continue;`);let O=D(t);k.write(`const ${O} = ${i}[k];`),ke(k,t,m,O,!1)}),e.write("}")}return null}if(S){e.write(`const ${g} = {};`);for(let $ of u){let k=l($),O=p.get($);Sf(f[$])?e.write(`if (${k} in ${i}) ${g}[${k}] = ${O};`):ur(f[$])?e.write(`if (${O} !== undefined || ${k} in ${i}) ${g}[${k}] = ${O};`):e.write(`${g}[${k}] = ${O};`)}}else{let $=u.map(k=>`${d(k)}: ${p.get(k)}`).join(", ");e.write(`const ${g} = { ${$} };`)}if(h!=="none"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(k=>{if(k.write('if (k === "__proto__") continue;'),$&&k.write(`if (${$}.has(k)) continue;`),h==="passthrough")k.write(`${g}[k] = ${i}[k];`);else{let O=D(t);k.write(`const ${O} = ${i}[k];`);let x=ke(k,t,m,O);k.write(`${g}[k] = ${x};`)}}),e.write("}")}return g}function qA(e,t,n,i,r=!0){let o=n._zod.def;if(JA(n))return te(e,t,o.innerType,i,r);if(o.innerType._zod.optin==="defaulted"){let a=D(t),c=D(t);return e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let d=te(l,t,o.innerType,i);l.write(`return ${d};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=te(u,t,o.innerType,i);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=r?D(t):null;return s&&e.write(`let ${s};`),e.write(`if (${i} !== undefined) {`),e.indented(a=>{let c=te(a,t,o.innerType,i,r);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function JA(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function KA(e){return e._zod.optin===void 0&&cr(e)}function cr(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?cr(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?cr(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(cr):!0;case"intersection":return!t.left||!t.right?!0:cr(t.left)&&cr(t.right);case"pipe":return t.in?cr(t.in):!0;default:return!0}}function Sf(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function ur(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?ur(t.innerType):!0;case"union":return t.options?t.options.some(ur):!0;case"intersection":return!t.left||!t.right||ur(t.left)||ur(t.right);case"pipe":return t.out?ur(t.out):!0;default:return!0}}function BA(e,t,n,i,r=!0){let o=n._zod.def,s=r?D(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${i} !== null) {`),e.indented(a=>{let c=te(a,t,o.innerType,i,r);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function GA(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (!Array.isArray(${i})) return INVALID;`);let s=r?D(t):null,a=D(t),c=D(t);return s&&e.write(`const ${s} = new Array(${i}.length);`),e.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${i}[${a}];`);let l=ke(u,t,o.element,c,r);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function WA(e,t,n,i){let o=n._zod.def.values;if(o.length!==1){let a=T(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}let s=o[0];if(typeof s=="number"&&Number.isNaN(s)){let a=T(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof s=="string")e.write(`if (${i} !== ${Ae(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${i} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${i} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${i} !== ${s}n) return INVALID;`);else throw new q(`literal type ${typeof s}`);return i}function HA(e,t,n,i){let r=n._zod.values;if(!r)throw new q("enum schema without enumerated values");let o=T(t,r);return e.write(`if (!${o}.has(${i})) return INVALID;`),i}function J$(e,t,n,i){let r=n._zod.def;return te(e,t,r.innerType,i)}function YA(e,t,n,i){let r=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return te(e,t,r.innerType,i);let c=T(t,s),u=D(t);return e.write(`let ${u} = ${i};`),e.write(`if (${i} === undefined) ${u} = ${c}();`),te(e,t,r.innerType,u)}let a=D(t);if(s){let c=T(t,s),u=T(t,Wn);e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let d=te(l,t,r.innerType,i);l.write(`${a} = ${d} === undefined ? ${u}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${i} !== undefined) {`),e.indented(c=>{let u=te(c,t,r.innerType,i);c.write(`${a} = ${u};`)}),e.write("}");return a}function XA(e,t,n,i){let r=n._zod.def,o=te(e,t,r.innerType,i),s=D(t);return e.write(`const ${s} = ${o};`),e.write(`if (${s} === undefined) return INVALID;`),s}function QA(e,t,n,i){let r=n._zod.def,o=r.items,s=r.rest;e.write(`if (!Array.isArray(${i})) return INVALID;`);let a=K$(o,"optin"),c=K$(o,"optout");s?e.write(`if (${i}.length < ${a}) return INVALID;`):e.write(`if (${i}.length < ${a} || ${i}.length > ${o.length}) return INVALID;`);let u=D(t);e.write(`const ${u} = [];`);for(let l=0;l<o.length;l++){let d=o[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${i}.length) {`),f.indented(p=>{let m=D(t);p.write(`const ${m} = ${i}[${l}];`);let h=ke(p,t,d,m);p.write(`${u}[${l}] = ${h};`)}),f.write("} else {"),f.indented(p=>{if(Sf(d)){p.write(`${u}.length = ${l};`);return}let m=D(t),h=D(t);p.write(`const ${m} = undefined;`),p.write(`const ${h} = (() => {`),p.indented(g=>{let S=ke(g,t,d,m);g.write(`return ${S};`)}),p.write("})();"),p.write(`if (${h} === INVALID || ${h} === undefined) ${u}.length = ${l};`),p.write(`else ${u}[${l}] = ${h};`)}),f.write("}")}),e.write("}");else{let f=D(t);e.write(`const ${f} = ${i}[${l}];`);let p=ke(e,t,d,f);e.write(`${u}[${l}] = ${p};`)}}if(s){let l=D(t),d=D(t);e.write(`for (let ${l} = ${o.length}; ${l} < ${i}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${i}[${l}];`);let p=ke(f,t,s,d);f.write(`${u}[${l}] = ${p};`)}),e.write("}")}return u}function K$(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function ez(e,t,n,i){let r=n._zod.def,o=r.options;if(r.discriminator)return tz(e,t,r,i);if(r.inclusive===!1)throw new q("exclusive unions (z.xor)");if(o.length===0)return e.write("return INVALID;"),i;if(o.length===1)return te(e,t,o[0],i);if(o.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(o.flatMap(l=>l._zod.def.values)),u=T(t,c);return e.write(`if (!${u}.has(${i})) return INVALID;`),i}let a=D(t);e.write(`let ${a};`);for(let c=0;c<o.length;c++){let u=o[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let d=te(l,t,u,i);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function tz(e,t,n,i){if(n.unionFallback)throw new q("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),i;let r=D(t),o=D(t);e.write(`const ${r} = ${i}?.[${Ae(n.discriminator)}];`),e.write(`let ${o};`);let s=!0,a=new Set;for(let c of n.options){let u=c._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new q("discriminated union option without static discriminator values");for(let f of u){if(a.has(f))throw new q(`duplicate discriminator value ${String(f)}`);a.add(f)}let l=Array.from(u,f=>rz(t,r,f)),d=s?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let p=te(f,t,c,i);f.write(`${o} = ${p};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),o}function rz(e,t,n){if(typeof n=="string")return`${t} === ${Ae(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let i=T(e,n);return`${t} === ${i}`}throw new q(`literal discriminator value ${String(n)}`)}function nz(e,t,n,i){let r=n._zod.def,o=ke(e,t,r.left,i),s=ke(e,t,r.right,i),a=T(t,Vr),c=D(t);return e.write(`const ${c} = ${a}(${o}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function iz(e,t,n,i){let r=n._zod.def,o=T(t,Fe);e.write(`if (!${o}(${i})) return INVALID;`);let s=D(t),a=D(t),c=D(t);e.write(`const ${s} = {};`);let u=r,l=u.partial?void 0:r.keyType._zod.values;if(l){let m=[];for(let g of l){if(!(typeof g=="string"||typeof g=="number"||typeof g=="symbol"))throw new q(`record key value ${String(g)}`);let S=typeof g=="number"?g.toString():g;if(S==="__proto__")throw new q('record key "__proto__"');m.push(S);let $=T(t,g),k=te(e,t,r.keyType,$),O=D(t);e.write(`const ${O} = ${i}[${oz(t,S)}];`);let x=ke(e,t,r.valueType,O);e.write(`${s}[${k}] = ${x};`)}let h=T(t,new Set(m));return e.write(`for (const ${a} in ${i}) {`),e.indented(g=>{g.write(`if (${h}.has(${a})) continue;`),u.mode==="loose"?g.write(`if (${a} !== "__proto__") ${s}[${a}] = ${i}[${a}];`):g.write("return INVALID;")}),e.write("}"),s}let d=r.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let m=r.mode==="loose",h=T(t,Zs(r.keyType)),g=T(t,zt),S=T(t,Object.prototype.propertyIsEnumerable),$=D(t);return e.write(`for (const ${a} of Reflect.ownKeys(${i})) {`),e.indented(k=>{k.write(`if (${a} === "__proto__") continue;`),k.write(`if (!${S}.call(${i}, ${a})) continue;`),k.write(`let ${$} = ${h}(${a});`),k.write(`if (${$} === INVALID && typeof ${a} === "string" && ${g}.test(${a})) ${$} = ${h}(Number(${a}));`),m?k.write(`if (${$} === INVALID) { ${s}[${a}] = ${i}[${a}]; continue; }`):k.write(`if (${$} === INVALID) return INVALID;`),k.write(`if (${$} === "__proto__") continue;`);let O=D(t);k.write(`const ${O} = ${i}[${a}];`);let x=ke(k,t,r.valueType,O);k.write(`${s}[${$}] = ${x};`)}),e.write("}"),s}let p=T(t,Object.prototype.propertyIsEnumerable);return e.write(`for (const ${a} of Reflect.ownKeys(${i})) {`),e.indented(m=>{m.write(`if (${a} === "__proto__") continue;`),m.write(`if (!${p}.call(${i}, ${a})) continue;`),m.write(`if (typeof ${a} !== "string") return INVALID;`),m.write(`const ${c} = ${i}[${a}];`);let h=ke(m,t,r.valueType,c);m.write(`${s}[${a}] = ${h};`)}),e.write("}"),s}function oz(e,t){return typeof t=="string"?Ae(t):T(e,t)}function sz(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Map)) return INVALID;`);let o=D(t),s=D(t),a=D(t);return e.write(`const ${o} = new Map();`),e.write(`for (const [${s}, ${a}] of ${i}) {`),e.indented(c=>{let u=te(c,t,r.keyType,s),l=te(c,t,r.valueType,a);c.write(`${o}.set(${u}, ${l});`)}),e.write("}"),o}function az(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Set)) return INVALID;`);let o=D(t),s=D(t);return e.write(`const ${o} = new Set();`),e.write(`for (const ${s} of ${i}) {`),e.indented(a=>{let c=te(a,t,r.valueType,s);a.write(`${o}.add(${c});`)}),e.write("}"),o}function cz(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function uz(e,t,n,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let r=n._zod.pattern;if(r){let o=T(t,r);e.write(`${o}.lastIndex = 0;`),e.write(`if (!${o}.test(${i})) return INVALID;`)}return i}function lz(e,t,n,i){let r=n._zod.def,o=T(t,r.getter),s=T(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${o}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=D(t);return e.write(`const ${a} = ${s}.parser(${i});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function dz(e,t,n,i){let r=n._zod.def,o=te(e,t,r.in,i);if(r.transform){if(lr(r.transform))throw new Be("z.compile: async transforms in pipes are not supported");let s=r.transform,c=T(t,l=>{let d={value:l,issues:[],addIssue:xf},f=s(l,d);return f instanceof Promise?Ue:d.issues.length===0?f:Ue}),u=D(t);return e.write(`const ${u} = ${c}(${o});`),e.write(`if (${u} === INVALID) return INVALID;`),te(e,t,r.out,u)}else return te(e,t,r.out,o)}function lr(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function fz(e,t,n,i){let r=n._zod.def;if(r.fn){if(lr(r.fn))throw new Be("z.compile: async custom predicates are not supported");let o=T(t,r.fn),s=T(t,kf),a=D(t);e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new q("custom schema without a predicate function");return i}function pz(e,t,n){let i=e._zod.run({value:n,issues:[]},{});if(i&&typeof i.then=="function")return Ue;let r=i;return r.issues.length===0?r.value:t()}function mz(e,t,n,i){let r=n._zod.def;if(!r.catchValue[Xo])throw new q("catch with a callback (only a constant catch value compiles)",!1);let o=D(t);e.write(`let ${o} = (() => {`),e.indented(u=>{let l=ke(u,t,r.innerType,i);u.write(`return ${l};`)}),e.write("})();");let s=T(t,r.innerType),a=T(t,r.catchValue),c=T(t,pz);return e.write(`if (${o} === INVALID) {`),e.indented(u=>{u.write(`${o} = ${c}(${s}, ${a}, ${i});`),u.write(`if (${o} === INVALID) return INVALID;`)}),e.write("}"),o}function hz(e,t,n,i){let r=n._zod.def;if(r.transform){if(lr(r.transform))throw new Be("z.compile: async transforms are not supported");let o=r.transform,a=T(t,u=>{let l={value:u,issues:[],addIssue:xf},d=o(u,l);return d instanceof Promise?Ue:l.issues.length===0?d:Ue}),c=D(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return i}function Of(e,t){return new e({type:"string",...A(t)})}function Af(e,t){return new e({type:"string",coerce:!0,...A(t)})}function qs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Js(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Ks(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Bs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Ws(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function mi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function Hs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Ys(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function Xs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function Qs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function ea(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function ta(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function ra(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function na(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function ia(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function zf(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...A(t)})}function oa(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function sa(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function aa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function ca(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function ua(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function Pf(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...A(t)})}function la(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}var Ef={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function hi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function gi(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function vi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function yi(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function Nf(e,t){return new e({type:"number",checks:[],...A(t)})}function Cf(e,t){return new e({type:"number",coerce:!0,checks:[],...A(t)})}function jf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function Tf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...A(t)})}function Df(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...A(t)})}function Lf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...A(t)})}function Uf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...A(t)})}function Mf(e,t){return new e({type:"boolean",...A(t)})}function Rf(e,t){return new e({type:"boolean",coerce:!0,...A(t)})}function Vf(e,t){return new e({type:"bigint",...A(t)})}function Ff(e,t){return new e({type:"bigint",coerce:!0,...A(t)})}function Zf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...A(t)})}function qf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...A(t)})}function Jf(e,t){return new e({type:"symbol",...A(t)})}function Kf(e,t){return new e({type:"undefined",...A(t)})}function Bf(e,t){return new e({type:"null",...A(t)})}function Gf(e){return new e({type:"any"})}function Wf(e){return new e({type:"unknown"})}function Hf(e,t){return new e({type:"never",...A(t)})}function Yf(e,t){return new e({type:"void",...A(t)})}function Xf(e,t){return new e({type:"date",...A(t)})}function Qf(e,t){return new e({type:"date",coerce:!0,...A(t)})}function ep(e,t){return new e({type:"nan",...A(t)})}function nt(e,t){return new ps({check:"less_than",...A(t),value:e,inclusive:!1})}function Me(e,t){return new ps({check:"less_than",...A(t),value:e,inclusive:!0})}function it(e,t){return new ms({check:"greater_than",...A(t),value:e,inclusive:!1})}function Re(e,t){return new ms({check:"greater_than",...A(t),value:e,inclusive:!0})}function da(e){return it(0,e)}function fa(e){return nt(0,e)}function pa(e){return Me(0,e)}function ma(e){return Re(0,e)}function Pt(e,t){return new Ml({check:"multiple_of",...A(t),value:e})}function Et(e,t){return new Fl({check:"max_size",...A(t),maximum:e})}function ot(e,t){return new Zl({check:"min_size",...A(t),minimum:e})}function dr(e,t){return new ql({check:"size_equals",...A(t),size:e})}function fr(e,t){return new Jl({check:"max_length",...A(t),maximum:e})}function mt(e,t){return new Kl({check:"min_length",...A(t),minimum:e})}function pr(e,t){return new Bl({check:"length_equals",...A(t),length:e})}function Zr(e,t){return new Gl({check:"string_format",format:"regex",...A(t),pattern:e})}function qr(e){return new Wl({check:"string_format",format:"lowercase",...A(e)})}function Jr(e){return new Hl({check:"string_format",format:"uppercase",...A(e)})}function Kr(e,t){return new Yl({check:"string_format",format:"includes",...A(t),includes:e})}function Br(e,t){return new Xl({check:"string_format",format:"starts_with",...A(t),prefix:e})}function Gr(e,t){return new Ql({check:"string_format",format:"ends_with",...A(t),suffix:e})}function ha(e,t,n){return new hs({check:"property",property:e,schema:t,...A(n)})}function ga(e){return Object.entries(e).map(([t,n])=>new hs({check:"property",property:t,schema:n}))}function Wr(e,t){return new ed({check:"mime_type",mime:e,...A(t)})}function Ge(e){return new td({check:"overwrite",tx:e})}function Hr(e){return Ge(t=>t.normalize(e))}function Yr(){return Ge(e=>e.trim())}function Xr(){return Ge(e=>e.toLowerCase())}function Qr(){return Ge(e=>e.toUpperCase())}function en(){return Ge(e=>Mu(e))}function tp(e,t,n){return new e({type:"array",element:t,...A(n)})}function gz(e,t,n){return new e({type:"union",options:t,...A(n)})}function vz(e,t,n){return new e({type:"union",options:t,inclusive:!1,...A(n)})}function yz(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...A(i)})}function $z(e,t,n){return new e({type:"intersection",left:t,right:n})}function bz(e,t,n,i){let r=n instanceof M,o=r?i:n,s=r?n:null;return new e({type:"tuple",items:t,rest:s,...A(o)})}function _z(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...A(i)})}function wz(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...A(i)})}function kz(e,t,n){return new e({type:"set",valueType:t,...A(n)})}function Sz(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:i,...A(n)})}function Iz(e,t,n){return new e({type:"enum",entries:t,...A(n)})}function xz(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...A(n)})}function rp(e,t){return new e({type:"file",...A(t)})}function Oz(e,t){return new e({type:"transform",transform:t})}function Az(e,t){return new e({type:"optional",innerType:t})}function zz(e,t){return new e({type:"nullable",innerType:t})}function Pz(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():Wn(n)}})}function Ez(e,t,n){return new e({type:"nonoptional",innerType:t,...A(n)})}function Nz(e,t){return new e({type:"success",innerType:t})}function Cz(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:Gu(n)})}function jz(e,t,n){return new e({type:"pipe",in:t,out:n})}function Tz(e,t){return new e({type:"readonly",innerType:t})}function Dz(e,t,n){return new e({type:"template_literal",parts:t,...A(n)})}function Lz(e,t){return new e({type:"lazy",getter:t})}function Uz(e,t){return new e({type:"promise",innerType:t})}function np(e,t,n){let i=A(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function ip(e,t,n){return new e({type:"custom",check:"custom",fn:t,...A(n)})}function op(e,t){let n=H$(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(Tr(r,i.value,n._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=i.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),i.issues.push(Tr(o))}},e(i.value,i)),t);return n}function H$(e,t){let n=new Q({check:"custom",...A(t)});return n._zod.check=e,n}function sp(e){let t=new Q({check:"describe"});return t._zod.onattach=[n=>{let i=ye.get(n)??{};ye.add(n,{...i,description:e})}],t._zod.check=()=>{},t}function ap(e){let t=new Q({check:"meta"});return t._zod.onattach=[n=>{let i=ye.get(n)??{};ye.add(n,{...i,...e})}],t._zod.check=()=>{},t}function cp(e,t){let n=A(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(p=>typeof p=="string"?p.toLowerCase():p),r=r.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(i),s=new Set(r),a=e.Codec??ui,c=e.Boolean??ai,u=e.String??sr,l=new u({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return n.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?i[0]||"true":r[0]||"false"),error:n.error});return f._zod.bag.truthy=i,f._zod.bag.falsy=r,f._zod.bag.case=n.case??"insensitive",f}function tn(e,t,n,i={}){let r=A(i),o={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...r};return n instanceof RegExp&&(o.pattern=n),new e(o)}function $i(e,...t){for(let n of t)for(let i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&ne(e,i,n[i]);return e}function Nt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ye,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 fe(e,t,n,i,r){let o=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:r}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(r);return Object.assign(n,o),!0}function G(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let f=s.schema,p=t.processors[r.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);p(e,t,f,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),G(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&$i(s.schema,c),t.io==="input"&&Se(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Y$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ct(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=i.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let r=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,f=e.external.uri??(m=>m);if(d)return{ref:f(d)};let p=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${Y$(p)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Y$(l)}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=r(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
246
246
 
247
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function eb(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!="object")return;eb(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var tb=new Set(["type","properties","required","additionalProperties"]),X$=["oneOf","anyOf"];function Q$(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function up(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!tb.has(s))return null;t.push(o)}let n={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Q$(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:up(a)??{allOf:a};ne(n,s,c)}for(let s of o.required??[])i.add(s)}let r={type:"object",properties:n};if(i.size&&(r.required=[...i]),t.every(o=>o.additionalProperties===!1))r.additionalProperties=!1;else{let o=[];for(let s of t){let a=Q$(s);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?r.additionalProperties=o[0]:o.length>1&&(r.additionalProperties={allOf:o})}return r}function Mz(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of tb)if(r in e)return;let n=t.filter(r=>X$.some(o=>Array.isArray(r[o]))),i=null;if(!n.length)i=up(t);else{let r=n[0],o=X$.find(c=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let s=t.filter(c=>c!==r),a=r[o].map(c=>up([...s,c]));if(a.some(c=>!c))return;i={[o]:a}}i&&(delete e.allOf,$i(e,i))}function jt(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){i(d);let p=e.seen.get(d),m=p.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):$i(u,m),$i(u,l),a._zod.parent===d)for(let g in u)g==="$ref"||g==="allOf"||g in l||delete u[g];if(m.$ref&&p.def)for(let g in u)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(u[g])===JSON.stringify(p.def[g])&&delete u[g]}let f=a._zod.parent;if(f&&f!==d){i(f);let p=e.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let m in u)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(u[m])===JSON.stringify(p.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())eb(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Mz(u)}}let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}$i(r,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ne(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:rn(t,"input",e.processors),output:rn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Se(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Se(i.element,n);if(i.type==="set")return Se(i.valueType,n);if(i.type==="lazy")return Se(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Se(i.innerType,n);if(i.type==="intersection")return Se(i.left,n)||Se(i.right,n);if(i.type==="record"||i.type==="map")return Se(i.keyType,n)||Se(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Se(i.in,n)||Se(i.out,n);if(i.type==="object"){for(let r in i.shape)if(Se(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Se(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Se(r,n))return!0;return!!(i.rest&&Se(i.rest,n))}return!1}var lp=(e,t={})=>n=>{let i=Nt({...n,processors:t});return G(e,i),Ct(i,e),jt(i,e)},rn=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},s=Nt({...r??{},target:o,io:t,processors:n});return G(e,s),Ct(s,e),jt(s,e)};var Rz={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},pp=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=e._zod.bag;if(typeof o=="number"&&(r.minLength=o),typeof s=="number"&&(r.maxLength=s),a&&(r.format=Rz[a]??a,r.format===""&&delete r.format,(a==="time"||l)&&delete r.format),u&&(r.contentEncoding=u),c&&c.size>0){let d=[...c];d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},mp=(e,t,n,i)=>{let r=n,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?r.type="integer":r.type="number";let d=typeof l=="number"&&l>=(o??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:typeof o=="number"&&(r.minimum=o),f?p?(r.maximum=u,r.exclusiveMaximum=!0):r.exclusiveMaximum=u:typeof s=="number"&&(r.maximum=s),typeof c=="number"&&(Number.isFinite(c)&&c!==0?r.multipleOf=Math.abs(c):fe(e,t,r,i,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},hp=(e,t,n,i)=>{n.type="boolean"},gp=(e,t,n,i)=>{fe(e,t,n,i,"BigInt cannot be represented in JSON Schema")},vp=(e,t,n,i)=>{fe(e,t,n,i,"Symbols cannot be represented in JSON Schema")},yp=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},$p=(e,t,n,i)=>{fe(e,t,n,i,"Undefined cannot be represented in JSON Schema")},bp=(e,t,n,i)=>{fe(e,t,n,i,"Void cannot be represented in JSON Schema")},_p=(e,t,n,i)=>{n.not={}},wp=(e,t,n,i)=>{},kp=(e,t,n,i)=>{},Sp=(e,t,n,i)=>{fe(e,t,n,i,"Date cannot be represented in JSON Schema")},Ip=(e,t,n,i)=>{let r=e._zod.def,o=Kn(r.entries);if(o.length===0){n.not={};return}o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},xp=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let o=[];for(let s of r.values)if(s===void 0){if(fe(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(fe(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),o.every(s=>typeof s=="boolean")&&(n.type="boolean"),o.every(s=>s===null)&&(n.type="null"),n.enum=o},Op=(e,t,n,i)=>{fe(e,t,n,i,"NaN cannot be represented in JSON Schema")},Ap=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},zp=(e,t,n,i)=>{let r=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=e._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(r,o)):(Object.assign(r,o),r.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(r,o)},Pp=(e,t,n,i)=>{n.type="boolean"},Ep=(e,t,n,i)=>{fe(e,t,n,i,"Custom types cannot be represented in JSON Schema")},Np=(e,t,n,i)=>{fe(e,t,n,i,"Function types cannot be represented in JSON Schema")},Cp=(e,t,n,i)=>{fe(e,t,n,i,"Transforms cannot be represented in JSON Schema")},jp=(e,t,n,i)=>{fe(e,t,n,i,"Map cannot be represented in JSON Schema")},Tp=(e,t,n,i)=>{fe(e,t,n,i,"Set cannot be represented in JSON Schema")},Dp=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(r.minItems=s),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=G(o.element,t,{...i,path:[...i.path,"items"]})};function bi(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?bi(t.out):t.type==="catch"?bi(t.innerType):e._zod.optin}var Lp=(e,t,n,i)=>{let r=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&fe(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let l in s)ne(r.properties,l,G(s[l],t,{...i,path:[...i.path,"properties",l]}));let c=new Set(Object.keys(s)),u=new Set([...c].filter(l=>{let d=o.shape[l];return t.io==="input"?bi(d)===void 0:d._zod.optout===void 0}));u.size>0&&(r.required=Array.from(u)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=G(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},ya=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,s=r.options.map((a,c)=>G(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?n.oneOf=s:n.anyOf=s},Up=(e,t,n,i)=>{let r=e._zod.def,o=G(r.left,t,{...i,path:[...i.path,"allOf",0]}),s=G(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Mp=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((h,g)=>G(h,t,{...i,path:[...i.path,s,g]})),u=o.rest?G(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;for(;l>0;){let h=o.items[l-1];if(!(t.io==="input"?bi(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=o.items.length,f=!o.rest;t.target==="draft-2020-12"?(r.prefixItems=c,f?r.items=!1:u&&(r.items=u),l>0&&(r.minItems=l),f&&(r.maxItems=d)):t.target==="openapi-3.0"?(r.items={anyOf:c},u&&r.items.anyOf.push(u),l>0&&(r.minItems=l),f&&(r.maxItems=d)):(r.items=c,f?r.additionalItems=!1:u&&(r.additionalItems=u),l>0&&(r.minItems=l),f&&(r.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p=="number"&&(r.minItems=p),typeof m=="number"&&(r.maxItems=m)};function dp(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let m=e.get(t)?.def;if(!m)return t;let h=dp(e,m,n);return h===m?t:h}for(let m of["anyOf","oneOf"]){let h=t[m];if(!Array.isArray(h))continue;let g=h.map(S=>dp(e,S,n));g.some((S,$)=>S!==h[$])&&(t={...t,[m]:g})}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some(m=>m==="number"||m==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!o?.some(m=>typeof m=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(m=>typeof m=="number"?String(m):m):typeof p.const=="number"&&(p.const=String(p.const)),r&&(p.type="string",o||(p.pattern=(i.includes("number")?zt:ri).source)),p}var fp=new WeakMap;function Vz(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let n=new Map;for(let i of fp.get(e)??[]){let r=e.seen.get(i),o=(r?.def??r?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let s=dp(t,o,new Set);s!==o&&n.set(o,s)}if(n.size)for(let i of e.seen.values())for(let r of[i.schema,i.def]){let o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}var Rp=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let d=G(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let f of c)ne(r.patternProperties,f.source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=G(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let d=fp.get(t);d||(d=[],fp.set(t,d),t.deferred.push(()=>Vz(t))),d.push(e)}r.additionalProperties=G(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let u=s._zod.values,l=t.io==="input"&&bi(o.valueType)!==void 0;if(u&&!o.partial&&!l){let d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(r.required=d.map(String))}},Vp=(e,t,n,i)=>{let r=e._zod.def,o=G(r.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Fp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Zp=Symbol();function rb(e,t,n,i,r){let o=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(fe(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),Zp):JSON.parse(s)}var qp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s=rb(r.defaultValue,e,t,n,i);s!==Zp&&(n.default=s)},Jp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);if(o.ref=r.innerType,t.io!=="input")return;let s=rb(r.defaultValue,e,t,n,i);s!==Zp&&(n._prefault=s)},Kp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{fe(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},Bp=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?r.out:r.in:r.out;G(s,t,i);let a=t.seen.get(e);a.ref=s},Gp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},Wp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},$a=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Hp=(e,t,n,i)=>{let r=e._zod.innerType;G(r,t,i);let o=t.seen.get(e);o.ref=r},va={string:pp,number:mp,boolean:hp,bigint:gp,symbol:vp,null:yp,undefined:$p,void:bp,never:_p,any:wp,unknown:kp,date:Sp,enum:Ip,literal:xp,nan:Op,template_literal:Ap,file:zp,success:Pp,custom:Ep,function:Np,transform:Cp,map:jp,set:Tp,array:Dp,object:Lp,union:ya,intersection:Up,tuple:Mp,record:Rp,nullable:Vp,nonoptional:Fp,default:qp,prefault:Jp,catch:Kp,pipe:Bp,readonly:Gp,promise:Wp,optional:$a,lazy:Hp};function ba(e,t){if("_idmap"in e){let i=e,r=Nt({...t,processors:va}),o={};for(let c of i._idmap.entries()){let[u,l]=c;G(l,r)}let s={},a={registry:i,uri:t?.uri,defs:o};r.external=a;for(let c of i._idmap.entries()){let[u,l]=c;Ct(r,l),ne(s,u,jt(r,l))}if(Object.keys(o).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let n=Nt({...t,processors:va});return G(e,n),Ct(n,e),jt(n,e)}var _a=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Nt({processors:va,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return G(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ct(this.ctx,t);let i=jt(this.ctx,t),{"~standard":r,...o}=i;return o}};var nb={};var fn={};dt(fn,{ZodAny:()=>vm,ZodArray:()=>_m,ZodBase64:()=>Ra,ZodBase64URL:()=>Va,ZodBigInt:()=>ln,ZodBigIntFormat:()=>qa,ZodBoolean:()=>un,ZodCIDRv4:()=>Ua,ZodCIDRv6:()=>Ma,ZodCUID:()=>Ea,ZodCUID2:()=>Na,ZodCatch:()=>Fm,ZodCodec:()=>Pi,ZodCreditCard:()=>lm,ZodCustom:()=>Ei,ZodCustomStringFormat:()=>an,ZodDate:()=>Si,ZodDefault:()=>Dm,ZodDiscriminatedUnion:()=>km,ZodE164:()=>Fa,ZodEmail:()=>Oa,ZodEmoji:()=>za,ZodEnum:()=>on,ZodExactOptional:()=>Ga,ZodFile:()=>Nm,ZodFunction:()=>Xm,ZodGUID:()=>Aa,ZodIPv4:()=>Da,ZodIPv6:()=>La,ZodISODate:()=>Dt,ZodISODateTime:()=>Tt,ZodISODuration:()=>Ut,ZodISOTime:()=>Lt,ZodIntersection:()=>Sm,ZodJWT:()=>Za,ZodKSUID:()=>Ta,ZodLazy:()=>Wm,ZodLiteral:()=>Em,ZodMAC:()=>um,ZodMap:()=>zm,ZodNaN:()=>qm,ZodNanoID:()=>Pa,ZodNever:()=>$m,ZodNonOptional:()=>Wa,ZodNull:()=>hm,ZodNullable:()=>Tm,ZodNumber:()=>cn,ZodNumberFormat:()=>vr,ZodObject:()=>xi,ZodOptional:()=>Ai,ZodPipe:()=>zi,ZodPrefault:()=>Um,ZodPreprocess:()=>Jm,ZodPromise:()=>Ym,ZodReadonly:()=>Km,ZodRecord:()=>nn,ZodSet:()=>Pm,ZodString:()=>sn,ZodStringFormat:()=>Y,ZodSuccess:()=>Vm,ZodSymbol:()=>pm,ZodTemplateLiteral:()=>Gm,ZodTransform:()=>Cm,ZodTuple:()=>xm,ZodType:()=>R,ZodULID:()=>Ca,ZodURL:()=>ki,ZodUUID:()=>st,ZodUndefined:()=>mm,ZodUnion:()=>Oi,ZodUnknown:()=>ym,ZodVoid:()=>bm,ZodXID:()=>ja,ZodXor:()=>wm,_ZodString:()=>xa,_default:()=>Lm,_function:()=>p_,any:()=>qb,array:()=>Ii,base64:()=>xb,base64url:()=>Ob,bigint:()=>Mb,boolean:()=>fm,catch:()=>Zm,check:()=>m_,cidrv4:()=>Sb,cidrv6:()=>Ib,codec:()=>u_,creditCard:()=>zb,cuid:()=>gb,cuid2:()=>vb,custom:()=>h_,date:()=>Kb,describe:()=>g_,discriminatedUnion:()=>Xb,e164:()=>Ab,email:()=>sb,emoji:()=>mb,enum:()=>Ka,exactOptional:()=>jm,file:()=>o_,float32:()=>Tb,float64:()=>Db,function:()=>p_,guid:()=>ab,hash:()=>jb,hex:()=>Cb,hostname:()=>Nb,httpUrl:()=>pb,instanceof:()=>y_,int:()=>Sa,int32:()=>Lb,int64:()=>Rb,intersection:()=>Im,invertCodec:()=>l_,ipv4:()=>_b,ipv6:()=>kb,json:()=>b_,jwt:()=>Pb,keyof:()=>Bb,ksuid:()=>bb,lazy:()=>Hm,literal:()=>i_,looseObject:()=>Hb,looseRecord:()=>e_,mac:()=>wb,map:()=>t_,meta:()=>v_,nan:()=>c_,nanoid:()=>hb,nativeEnum:()=>n_,never:()=>Ja,nonoptional:()=>Rm,null:()=>gm,nullable:()=>wi,nullish:()=>s_,number:()=>dm,object:()=>Gb,optional:()=>hr,partialRecord:()=>Qb,pipe:()=>Ia,prefault:()=>Mm,preprocess:()=>__,promise:()=>f_,readonly:()=>Bm,record:()=>Am,refine:()=>Qm,set:()=>r_,strictObject:()=>Wb,string:()=>_i,stringFormat:()=>Eb,stringbool:()=>$_,success:()=>a_,superRefine:()=>eh,symbol:()=>Fb,templateLiteral:()=>d_,transform:()=>Ba,tuple:()=>Om,uint32:()=>Ub,uint64:()=>Vb,ulid:()=>yb,undefined:()=>Zb,union:()=>dn,unknown:()=>mr,url:()=>fb,uuid:()=>cb,uuidv4:()=>ub,uuidv6:()=>lb,uuidv7:()=>db,void:()=>Jb,xid:()=>$b,xor:()=>Yb});var wa={};dt(wa,{endsWith:()=>Gr,gt:()=>it,gte:()=>Re,includes:()=>Kr,length:()=>pr,lowercase:()=>qr,lt:()=>nt,lte:()=>Me,maxLength:()=>fr,maxSize:()=>Et,mime:()=>Wr,minLength:()=>mt,minSize:()=>ot,multipleOf:()=>Pt,negative:()=>fa,nonnegative:()=>ma,nonpositive:()=>pa,normalize:()=>Hr,overwrite:()=>Ge,positive:()=>da,properties:()=>ga,property:()=>ha,regex:()=>Zr,size:()=>dr,slugify:()=>en,startsWith:()=>Br,toLowerCase:()=>Xr,toUpperCase:()=>Qr,trim:()=>Yr,uppercase:()=>Jr});var ib=new WeakSet([Object.prototype,Error.prototype]);function ka(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var ob=(e,t)=>{Qn.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);ib.has(n)||(ib.add(n),ka(n,"format",i=>r=>ti(i,r)),ka(n,"flatten",i=>r=>ei(i,r)),ka(n,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,Cr,2)}),ka(n,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,Cr,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Zz=v("ZodError",ob),Ce=v("ZodError",ob,void 0,{Parent:Error});var Yp=Dr(Ce),Xp=Lr(Ce),Qp=Ur(Ce),em=Mr(Ce),tm=rs(Ce),rm=ns(Ce),nm=is(Ce),im=os(Ce),om=ss(Ce),sm=as(Ce),am=cs(Ce),cm=us(Ce);function Jz(){he.localeError||ie(Us())}function gr(){he.memoizer||ie({memoizer:di()})}var R=v("ZodType",(e,t)=>(Jz(),M.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(w.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return B(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Qm(e,t))},superRefine(e,t){return this.check(eh(e,t))},overwrite(e){return this.check(Ge(e))},optional(){return hr(this)},exactOptional(){return jm(this)},nullable(){return wi(this)},nullish(){return hr(wi(this))},nonoptional(e){return Rm(this,e)},array(){return Ii(this)},or(e){return dn([this,e])},and(e){return Im(this,e)},transform(e){return Ia(this,Ba(e))},default(e){return Lm(this,e)},prefault(e){return Mm(this,e)},catch(e){return Zm(this,e)},pipe(e){return Ia(this,e)},readonly(){return Bm(this)},describe(e){let t=this.clone();return ye.add(t,{description:e}),t},meta(...e){if(e.length===0)return ye.get(this);let t=this.clone();return ye.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 w.hide(this,"~standard",{...bs(this),jsonSchema:{input:rn(this,"input"),output:rn(this,"output")}})},set"~standard"(e){w.own(this,"~standard",e)},parse:function e(t,n){return Yp(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Xp(this,t,n,{callee:e})},safeParse(e,t){return Qp(this,e,t)},async safeParseAsync(e,t){return em(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){w.own(this,"spa",e)},encode:function e(t,n){return tm(this,t,n,{callee:e})},decode:function e(t,n){return rm(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await nm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await im(this,t,n,{callee:e})},safeEncode(e,t){return om(this,e,t)},safeDecode(e,t){return sm(this,e,t)},async safeEncodeAsync(e,t){return am(this,e,t)},async safeDecodeAsync(e,t){return cm(this,e,t)},toJSONSchema(e){return lp(this,{})(e)},get description(){return ye.get(this)?.description},get _def(){return this._zod.def}}),xa=v("_ZodString",(e,t)=>{sr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>pp(e,i,r,o);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(Zr(...e))},includes(...e){return this.check(Kr(...e))},startsWith(...e){return this.check(Br(...e))},endsWith(...e){return this.check(Gr(...e))},min(...e){return this.check(mt(...e))},max(...e){return this.check(fr(...e))},length(...e){return this.check(pr(...e))},nonempty(...e){return this.check(mt(1,...e))},lowercase(e){return this.check(qr(e))},uppercase(e){return this.check(Jr(e))},trim(){return this.check(Yr())},normalize(...e){return this.check(Hr(...e))},toLowerCase(){return this.check(Xr())},toUpperCase(){return this.check(Qr())},slugify(){return this.check(en())}}),sn=v("ZodString",(e,t)=>{sr.init(e,t),xa.init(e,t)},{email(e){return this.check(qs(Oa,e))},url(e){return this.check(mi(ki,e))},jwt(e){return this.check(la(Za,e))},emoji(e){return this.check(Hs(za,e))},guid(e){return this.check(Js(Aa,e))},uuid(e){return this.check(Ks(st,e))},uuidv4(e){return this.check(Bs(st,e))},uuidv6(e){return this.check(Gs(st,e))},uuidv7(e){return this.check(Ws(st,e))},nanoid(e){return this.check(Ys(Pa,e))},cuid(e){return this.check(Xs(Ea,e))},cuid2(e){return this.check(Qs(Na,e))},ulid(e){return this.check(ea(Ca,e))},base64(e){return this.check(aa(Ra,e))},base64url(e){return this.check(ca(Va,e))},xid(e){return this.check(ta(ja,e))},ksuid(e){return this.check(ra(Ta,e))},ipv4(e){return this.check(na(Da,e))},ipv6(e){return this.check(ia(La,e))},cidrv4(e){return this.check(oa(Ua,e))},cidrv6(e){return this.check(sa(Ma,e))},e164(e){return this.check(ua(Fa,e))},datetime(e){return this.check(hi(Tt,e))},date(e){return this.check(gi(Dt,e))},time(e){return this.check(vi(Lt,e))},duration(e){return this.check(yi(Ut,e))}});function _i(e){return Of(sn,e)}var Y=v("ZodStringFormat",(e,t)=>{H.init(e,t),xa.init(e,t)}),Tt=v("ZodISODateTime",(e,t)=>{vd.init(e,t),Y.init(e,t)}),Dt=v("ZodISODate",(e,t)=>{yd.init(e,t),Y.init(e,t)}),Lt=v("ZodISOTime",(e,t)=>{$d.init(e,t),Y.init(e,t)}),Ut=v("ZodISODuration",(e,t)=>{bd.init(e,t),Y.init(e,t)}),Oa=v("ZodEmail",(e,t)=>{sd.init(e,t),Y.init(e,t)});function sb(e){return qs(Oa,e)}var Aa=v("ZodGUID",(e,t)=>{id.init(e,t),Y.init(e,t)});function ab(e){return Js(Aa,e)}var st=v("ZodUUID",(e,t)=>{od.init(e,t),Y.init(e,t)});function cb(e){return Ks(st,e)}function ub(e){return Bs(st,e)}function lb(e){return Gs(st,e)}function db(e){return Ws(st,e)}var ki=v("ZodURL",(e,t)=>{ud.init(e,t),Y.init(e,t)});function fb(e){return mi(ki,e)}function pb(e){return mi(ki,{protocol:we.httpProtocol,hostname:we.domain,...w.normalizeParams(e)})}var za=v("ZodEmoji",(e,t)=>{ld.init(e,t),Y.init(e,t)});function mb(e){return Hs(za,e)}var Pa=v("ZodNanoID",(e,t)=>{dd.init(e,t),Y.init(e,t)});function hb(e){return Ys(Pa,e)}var Ea=v("ZodCUID",(e,t)=>{fd.init(e,t),Y.init(e,t)});function gb(e){return Xs(Ea,e)}var Na=v("ZodCUID2",(e,t)=>{pd.init(e,t),Y.init(e,t)});function vb(e){return Qs(Na,e)}var Ca=v("ZodULID",(e,t)=>{md.init(e,t),Y.init(e,t)});function yb(e){return ea(Ca,e)}var ja=v("ZodXID",(e,t)=>{hd.init(e,t),Y.init(e,t)});function $b(e){return ta(ja,e)}var Ta=v("ZodKSUID",(e,t)=>{gd.init(e,t),Y.init(e,t)});function bb(e){return ra(Ta,e)}var Da=v("ZodIPv4",(e,t)=>{_d.init(e,t),Y.init(e,t)});function _b(e){return na(Da,e)}var um=v("ZodMAC",(e,t)=>{kd.init(e,t),Y.init(e,t)});function wb(e){return zf(um,e)}var La=v("ZodIPv6",(e,t)=>{wd.init(e,t),Y.init(e,t)});function kb(e){return ia(La,e)}var Ua=v("ZodCIDRv4",(e,t)=>{Sd.init(e,t),Y.init(e,t)});function Sb(e){return oa(Ua,e)}var Ma=v("ZodCIDRv6",(e,t)=>{Id.init(e,t),Y.init(e,t)});function Ib(e){return sa(Ma,e)}var Ra=v("ZodBase64",(e,t)=>{xd.init(e,t),Y.init(e,t)});function xb(e){return aa(Ra,e)}var Va=v("ZodBase64URL",(e,t)=>{Od.init(e,t),Y.init(e,t)});function Ob(e){return ca(Va,e)}var Fa=v("ZodE164",(e,t)=>{Ad.init(e,t),Y.init(e,t)});function Ab(e){return ua(Fa,e)}var lm=v("ZodCreditCard",(e,t)=>{zd.init(e,t),Y.init(e,t)});function zb(e){return Pf(lm,e)}var Za=v("ZodJWT",(e,t)=>{Pd.init(e,t),Y.init(e,t)});function Pb(e){return la(Za,e)}var an=v("ZodCustomStringFormat",(e,t)=>{Ed.init(e,t),Y.init(e,t)});function Eb(e,t,n={}){return tn(an,e,t,n)}function Nb(e){return tn(an,"hostname",we.hostname,e)}function Cb(e){return tn(an,"hex",we.hex,e)}function jb(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=we[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return tn(an,i,r,t)}var cn=v("ZodNumber",(e,t)=>{zs.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>mp(e,i,r,o);let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(it(e,t))},gte(e,t){return this.check(Re(e,t))},min(e,t){return this.check(Re(e,t))},lt(e,t){return this.check(nt(e,t))},lte(e,t){return this.check(Me(e,t))},max(e,t){return this.check(Me(e,t))},int(e){return this.check(Sa(e))},safe(e){return this.check(Sa(e))},positive(e){return this.check(it(0,e))},nonnegative(e){return this.check(Re(0,e))},negative(e){return this.check(nt(0,e))},nonpositive(e){return this.check(Me(0,e))},multipleOf(e,t){return this.check(Pt(e,t))},step(e,t){return this.check(Pt(e,t))},finite(){return this}});function dm(e){return Nf(cn,e)}var vr=v("ZodNumberFormat",(e,t)=>{Nd.init(e,t),cn.init(e,t)});function Sa(e){return jf(vr,e)}function Tb(e){return Tf(vr,e)}function Db(e){return Df(vr,e)}function Lb(e){return Lf(vr,e)}function Ub(e){return Uf(vr,e)}var un=v("ZodBoolean",(e,t)=>{ai.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>hp(e,n,i,r)});function fm(e){return Mf(un,e)}var ln=v("ZodBigInt",(e,t)=>{Ps.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>gp(e,i,r,o);let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null},{gte(e,t){return this.check(Re(e,t))},min(e,t){return this.check(Re(e,t))},gt(e,t){return this.check(it(e,t))},lt(e,t){return this.check(nt(e,t))},lte(e,t){return this.check(Me(e,t))},max(e,t){return this.check(Me(e,t))},positive(e){return this.check(it(BigInt(0),e))},negative(e){return this.check(nt(BigInt(0),e))},nonpositive(e){return this.check(Me(BigInt(0),e))},nonnegative(e){return this.check(Re(BigInt(0),e))},multipleOf(e,t){return this.check(Pt(e,t))}});function Mb(e){return Vf(ln,e)}var qa=v("ZodBigIntFormat",(e,t)=>{Cd.init(e,t),ln.init(e,t)});function Rb(e){return Zf(qa,e)}function Vb(e){return qf(qa,e)}var pm=v("ZodSymbol",(e,t)=>{jd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>vp(e,n,i,r)});function Fb(e){return Jf(pm,e)}var mm=v("ZodUndefined",(e,t)=>{Td.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$p(e,n,i,r)});function Zb(e){return Kf(mm,e)}var hm=v("ZodNull",(e,t)=>{Dd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>yp(e,n,i,r)});function gm(e){return Bf(hm,e)}var vm=v("ZodAny",(e,t)=>{Ld.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wp(e,n,i,r)});function qb(){return Gf(vm)}var ym=v("ZodUnknown",(e,t)=>{Ud.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>kp(e,n,i,r)});function mr(){return Wf(ym)}var $m=v("ZodNever",(e,t)=>{Md.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>_p(e,n,i,r)});function Ja(e){return Hf($m,e)}var bm=v("ZodVoid",(e,t)=>{Rd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>bp(e,n,i,r)});function Jb(e){return Yf(bm,e)}var Si=v("ZodDate",(e,t)=>{Vd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Sp(e,i,r,o),e.min=(i,r)=>e.check(Re(i,r)),e.max=(i,r)=>e.check(Me(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function Kb(e){return Xf(Si,e)}var _m=v("ZodArray",(e,t)=>{gr(),Fd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Dp(e,n,i,r),e.element=t.element},{min(e,t){return this.check(mt(e,t))},nonempty(e){return this.check(mt(1,e))},max(e,t){return this.check(fr(e,t))},length(e,t){return this.check(pr(e,t))},unwrap(){return this.element}});function Ii(e,t){return tp(_m,e,t)}function Bb(e){let t=e._zod.def.shape;return Ka(Object.keys(t))}var xi=v("ZodObject",(e,t)=>{gr(),Zd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Lp(e,n,i,r),w.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ka(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:mr()})},loose(){return this.clone({...this._zod.def,catchall:mr()})},strict(){return this.clone({...this._zod.def,catchall:Ja()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return w.extend(this,e)},safeExtend(e){return w.safeExtend(this,e)},merge(e){return w.merge(this,e)},pick(e){return w.pick(this,e)},omit(e){return w.omit(this,e)},partial(...e){return w.partial(Ai,this,e[0])},exactPartial(...e){return w.partial(Ga,this,e[0],"exactPartial")},required(...e){return w.required(Wa,this,e[0])}});function Gb(e,t){let n={type:"object",shape:e??{},...w.normalizeParams(t)};return new xi(n)}function Wb(e,t){return new xi({type:"object",shape:e,catchall:Ja(),...w.normalizeParams(t)})}function Hb(e,t){return new xi({type:"object",shape:e,catchall:mr(),...w.normalizeParams(t)})}var Oi=v("ZodUnion",(e,t)=>{ci.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ya(e,n,i,r),e.options=t.options});function dn(e,t){return new Oi({type:"union",options:e,...w.normalizeParams(t)})}var wm=v("ZodXor",(e,t)=>{Oi.init(e,t),qd.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ya(e,n,i,r),e.options=t.options});function Yb(e,t){return new wm({type:"union",options:e,inclusive:!1,...w.normalizeParams(t)})}var km=v("ZodDiscriminatedUnion",(e,t)=>{Oi.init(e,t),Kd.init(e,t)});function Xb(e,t,n){return new km({type:"union",options:t,discriminator:e,...w.normalizeParams(n)})}var Sm=v("ZodIntersection",(e,t)=>{Bd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Up(e,n,i,r)});function Im(e,t){return new Sm({type:"intersection",left:e,right:t})}var xm=v("ZodTuple",(e,t)=>{gr(),Es.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Mp(e,n,i,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Ai({type:"optional",innerType:t}))})}});function Om(e,t,n){let i=t instanceof M,r=i?n:t,o=i?t:null;return new xm({type:"tuple",items:e,rest:o,...w.normalizeParams(r)})}var nn=v("ZodRecord",(e,t)=>{gr(),Gd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Rp(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function Am(e,t,n){return!t||!t._zod?new nn({type:"record",keyType:_i(),valueType:e,...w.normalizeParams(t)}):new nn({type:"record",keyType:e,valueType:t,...w.normalizeParams(n)})}function Qb(e,t,n){return new nn({type:"record",keyType:e,valueType:t,...w.normalizeParams(n),partial:!0})}function e_(e,t,n){return new nn({type:"record",keyType:e,valueType:t,mode:"loose",...w.normalizeParams(n)})}var zm=v("ZodMap",(e,t)=>{gr(),Wd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jp(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(ot(...n)),e.nonempty=n=>e.check(ot(1,n)),e.max=(...n)=>e.check(Et(...n)),e.size=(...n)=>e.check(dr(...n))});function t_(e,t,n){return new zm({type:"map",keyType:e,valueType:t,...w.normalizeParams(n)})}var Pm=v("ZodSet",(e,t)=>{gr(),Hd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Tp(e,n,i,r),e.min=(...n)=>e.check(ot(...n)),e.nonempty=n=>e.check(ot(1,n)),e.max=(...n)=>e.check(Et(...n)),e.size=(...n)=>e.check(dr(...n))});function r_(e,t){return new Pm({type:"set",valueType:e,...w.normalizeParams(t)})}var on=v("ZodEnum",(e,t)=>{Yd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Ip(e,i,r,o),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let s of i)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new on({...t,checks:[],...w.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let s of i)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new on({...t,checks:[],...w.normalizeParams(r),entries:o})}});function Ka(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new on({type:"enum",entries:n,...w.normalizeParams(t)})}function n_(e,t){return new on({type:"enum",entries:e,...w.normalizeParams(t)})}var Em=v("ZodLiteral",(e,t)=>{Xd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xp(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function i_(e,t){return new Em({type:"literal",values:Array.isArray(e)?e:[e],...w.normalizeParams(t)})}var Nm=v("ZodFile",(e,t)=>{Qd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zp(e,n,i,r),e.min=(n,i)=>e.check(ot(n,i)),e.max=(n,i)=>e.check(Et(n,i)),e.mime=(n,i)=>e.check(Wr(Array.isArray(n)?n:[n],i))});function o_(e){return rp(Nm,e)}var Cm=v("ZodTransform",(e,t)=>{gr(),ef.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Cp(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new At(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(w.issue(o,n.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(w.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});function Ba(e){return new Cm({type:"transform",transform:e})}var Ai=v("ZodOptional",(e,t)=>{Ns.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$a(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function hr(e){return new Ai({type:"optional",innerType:e})}var Ga=v("ZodExactOptional",(e,t)=>{tf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$a(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function jm(e){return new Ga({type:"optional",innerType:e})}var Tm=v("ZodNullable",(e,t)=>{rf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Vp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function wi(e){return new Tm({type:"nullable",innerType:e})}function s_(e){return hr(wi(e))}var Dm=v("ZodDefault",(e,t)=>{nf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Lm(e,t){return new Dm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Um=v("ZodPrefault",(e,t)=>{of.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Jp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Mm(e,t){return new Um({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Wa=v("ZodNonOptional",(e,t)=>{sf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Fp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Rm(e,t){return new Wa({type:"nonoptional",innerType:e,...w.normalizeParams(t)})}var Vm=v("ZodSuccess",(e,t)=>{af.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Pp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function a_(e){return new Vm({type:"success",innerType:e})}var Fm=v("ZodCatch",(e,t)=>{cf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Kp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Zm(e,t){return new Fm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:w.constantCatch(t)})}var qm=v("ZodNaN",(e,t)=>{uf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Op(e,n,i,r)});function c_(e){return ep(qm,e)}var zi=v("ZodPipe",(e,t)=>{Cs.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Bp(e,n,i,r),e.in=t.in,e.out=t.out});function Ia(e,t){return new zi({type:"pipe",in:e,out:t})}var Pi=v("ZodCodec",(e,t)=>{zi.init(e,t),ui.init(e,t)});function u_(e,t,n){return new Pi({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function l_(e){let t=e._zod.def;return new Pi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Jm=v("ZodPreprocess",(e,t)=>{zi.init(e,t),lf.init(e,t)}),Km=v("ZodReadonly",(e,t)=>{df.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Gp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Bm(e){return new Km({type:"readonly",innerType:e})}var Gm=v("ZodTemplateLiteral",(e,t)=>{ff.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ap(e,n,i,r)});function d_(e,t){return new Gm({type:"template_literal",parts:e,...w.normalizeParams(t)})}var Wm=v("ZodLazy",(e,t)=>{li.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Hp(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function Hm(e){return new Wm({type:"lazy",getter:e})}var Ym=v("ZodPromise",(e,t)=>{mf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Wp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function f_(e){return new Ym({type:"promise",innerType:e})}var Xm=v("ZodFunction",(e,t)=>{pf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Np(e,n,i,r)});function p_(e){return new Xm({type:"function",input:Array.isArray(e?.input)?Om(e?.input):e?.input??Ii(mr()),output:e?.output??mr()})}var Ei=v("ZodCustom",(e,t)=>{hf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ep(e,n,i,r)});function m_(e){let t=new Q({check:"custom"});return t._zod.check=e,t}function h_(e,t){return np(Ei,e??(()=>!0),t)}function Qm(e,t={}){return ip(Ei,e,t)}function eh(e,t){return op(e,t)}var g_=sp,v_=ap;function y_(e,t={}){let n=new Ei({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...w.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var $_=(...e)=>cp({Codec:Pi,Boolean:un,String:sn},...e);function b_(e){let t=Hm(()=>dn([_i(e),dm(),fm(),gm(),Ii(t),Am(_i(),t)]));return t}function __(e,t){return new Jm({type:"pipe",in:Ba(e),out:t})}var Kz={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Bz(e){ie({customError:e})}function Gz(){return ie().customError}var th;th||(th={});var Ni={};dt(Ni,{ZodISODate:()=>Dt,ZodISODateTime:()=>Tt,ZodISODuration:()=>Ut,ZodISOTime:()=>Lt,date:()=>Hz,datetime:()=>Wz,duration:()=>Xz,time:()=>Yz});function Wz(e){return hi(Tt,e)}function Hz(e){return gi(Dt,e)}function Yz(e){return vi(Lt,e)}function Xz(e){return yi(Ut,e)}var C={...fn,...wa,iso:Ni},Qz=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function eP(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function w_(e,t){return e.map((n,i)=>i<t?n:n.optional())}function tP(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function rP(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1]===void 0?void 0:tP(n[1]);if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function nP(e,t){return C.transform(i=>i).check(i=>{let r=i.value;if(!(typeof r!="object"||r===null||Array.isArray(r)))for(let o of Object.getOwnPropertyNames(r)){let s=t.safeParse(o);s.success||i.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function k_(e,t){if(e!==!1)return e===void 0||e===!0?C.any():je(e,t)}var iP=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function S_(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return C.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return C.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=rP(r,t),s=je(o,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return C.null();if(r.length===0)return C.never();if(r.length===1)return C.literal(r[0]);if(r.every(s=>typeof s=="string"))return C.enum(r);let o=r.map(s=>C.literal(s));return o.length<2?o[0]:C.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return C.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let s={...e,type:o};return S_(s,t)});return r.length===0?C.never():r.length===1?r[0]:C.union(r)}if(!n)return C.any();let i;switch(n){case"string":{let r=C.string();if(e.format){let o=e.format;o==="email"?r=r.check(C.email()):o==="uri"||o==="uri-reference"?r=r.check(C.url()):o==="uuid"||o==="guid"?r=r.check(C.uuid()):o==="date-time"?r=r.check(C.iso.datetime({offset:!0})):o==="date"?r=r.check(C.iso.date()):o==="time"?r=r.check(C.regex(iP)):o==="duration"?r=r.check(C.iso.duration()):o==="hostname"?r=r.check(C.hostname()):o==="ipv4"?r=r.check(C.ipv4()):o==="ipv6"?r=r.check(C.ipv6()):o==="mac"?r=r.check(C.mac()):o==="cidr"?r=r.check(C.cidrv4()):o==="cidr-v6"?r=r.check(C.cidrv6()):o==="base64"?r=r.check(C.base64()):o==="base64url"?r=r.check(C.base64url()):o==="e164"?r=r.check(C.e164()):o==="credit_card"?r=r.check(C.creditCard()):o==="jwt"?r=r.check(C.jwt()):o==="emoji"?r=r.check(C.emoji()):o==="nanoid"?r=r.check(C.nanoid()):o==="cuid"?r=r.check(C.cuid()):o==="cuid2"?r=r.check(C.cuid2()):o==="ulid"?r=r.check(C.ulid()):o==="xid"?r=r.check(C.xid()):o==="ksuid"&&(r=r.check(C.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?C.number().int():C.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=C.boolean();break}case"null":{i=C.null();break}case"object":{let r={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?je(e.additionalProperties,t):void 0;for(let[c,u]of Object.entries(o)){let l=je(u,t);ne(r,c,s.has(c)?l:l.optional())}if(e.patternProperties){let c=e.patternProperties,u=Object.keys(c),l=[];for(let f of u){let p=je(c[f],t),m=C.string().regex(new RegExp(f));l.push(C.looseRecord(m,p))}let d=[];if(Object.keys(r).length>0&&d.push(C.object(r).passthrough()),d.push(...l),d.length===0)i=C.object({}).passthrough();else if(d.length===1)i=d[0];else{let f=C.intersection(d[0],d[1]);for(let p=2;p<d.length;p++)f=C.intersection(f,d[p]);i=f}if(e.additionalProperties===!1){let f=Object.keys(r),p=u.map(h=>new RegExp(h)),m=i;i=i.check(h=>{if(!Fe(h.value))return;let g=[];for(let S of Object.keys(h.value))f.includes(S)||p.some($=>$.test(S))||g.push(S);g.length&&h.issues.push({code:"unrecognized_keys",keys:g,input:h.value,inst:m})})}}else{let c=C.object(r);e.additionalProperties===!1?i=c.strict():a?i=c.catchall(a):i=c.passthrough()}if(e.propertyNames!==void 0&&e.propertyNames!==!0){let c=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;i=nP(i,je(c,t))}break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let s=typeof e.minItems=="number"?e.minItems:0,a=r.map(d=>je(d,t)),c=w_(a,s),u=Array.isArray(o)?void 0:k_(o,t),l=C.tuple(c);i=u?l.rest(u):l,typeof e.minItems=="number"&&(i=i.check(C.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(C.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>je(d,t)),c=w_(a,s),u=k_(e.additionalItems,t),l=C.tuple(c);i=u?l.rest(u):l,typeof e.minItems=="number"&&(i=i.check(C.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(C.maxLength(e.maxItems)))}else if(o!==void 0){let s=je(o,t),a=C.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=C.array(C.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function je(e,t){if(typeof e=="boolean")return e?C.any():C.never();let n=S_(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>je(u,t)),c=C.union(a);n=i?C.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>je(u,t)),c=C.xor(a);n=i?C.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:C.any();else{let a=i?n:je(e.allOf[0],t),c=i?0:1;for(let u=c;u<e.allOf.length;u++)a=C.intersection(a,je(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=C.nullable(n)),e.readOnly===!0&&(n=C.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(r[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(r[a]=e[a]);e.propertyNames!==void 0&&e.type==="object"&&e.$ref===void 0&&(r.propertyNames=e.propertyNames);for(let a of Object.keys(e))Qz.has(a)||ne(r,a,e[a]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function I_(e,t){if(typeof e=="boolean")return e?C.any():C.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=eP(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??ye};return je(n,o)}var x_=Symbol("z.visit/resolving");function Ci(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},i=new Map;function r(s){let a=i.get(s);if(a===x_)return new li({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,x_);let c=o(s),u=n(c,c!==s);return i.set(s,u),u}function o(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),d=!1,f={};for(let m of l){let h=r(u[m]);h!==u[m]&&(d=!0),f[m]=h}let p=a.catchall;return a.catchall&&(p=r(a.catchall),p!==a.catchall&&(d=!0)),d?B(s,{...a,shape:f,catchall:p}):s}case"array":{let u=r(a.element);return u===a.element?s:B(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,d=[];for(let p of u){let m=r(p);m!==p&&(l=!0),d.push(m)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(l=!0)),l?B(s,{...a,items:d,rest:f}):s}case"record":case"map":{let u=r(a.keyType),l=r(a.valueType);return u===a.keyType&&l===a.valueType?s:B(s,{...a,keyType:u,valueType:l})}case"set":{let u=r(a.valueType);return u===a.valueType?s:B(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,d=[];for(let f of u){let p=r(f);p!==f&&(l=!0),d.push(p)}return l?B(s,{...a,options:d}):s}case"intersection":{let u=r(a.left),l=r(a.right);return u===a.left&&l===a.right?s:B(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=r(a.innerType);return u===a.innerType?s:B(s,{...a,innerType:u})}case"pipe":{let u=r(a.in),l=r(a.out);return u===a.in&&l===a.out?s:B(s,{...a,in:u,out:l})}case"function":{let u=r(a.input),l=r(a.output);return u===a.input&&l===a.output?s:B(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...d}=a;return B(s,{...d,getter:()=>r(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return r(e)}function O_(e){return Ci(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:dn(n.options)}})}function oP(e,t){if(!t?.length)return e;let n=e._zod.def;return B(e,Ke(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function A_(e){return oP(e.out,e.checks)}function sP(e){return e.in._zod.traits.has("$ZodTransform")?A_(e):e.in}function z_(e){return Ci(e,{pipe:t=>sP(t._zod.def),default:(t,n)=>n?hr(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function P_(e){return Ci(e,{pipe:t=>A_(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var rh={};dt(rh,{bigint:()=>lP,boolean:()=>uP,date:()=>dP,number:()=>cP,string:()=>aP});function aP(e){return Af(sn,e)}function cP(e){return Cf(cn,e)}function uP(e){return Rf(un,e)}function lP(e){return Ff(ln,e)}function dP(e){return Qf(Si,e)}var $S=et(yt(),1);var M1=/^[\w.-]+(?:\/[\w.-]+)*$/;function Sn(e){let t=e.indexOf("/");return t<0?{id:e}:{category:e.slice(0,t),id:e.slice(t+1)}}var R1=L.object({id:L.string().regex(M1,"id\uB294 \uC601\uBB38\xB7\uC22B\uC790\xB7._- \uC640 \uAD6C\uAC04 \uC0AC\uC774\uC758 / \uB9CC \uD5C8\uC6A9"),source:L.string().optional(),tags:L.array(L.string()).optional()}),V1=L.object({id:L.string().regex(/^[\w.-]+$/,"id\uB294 \uC601\uBB38\xB7\uC22B\uC790\xB7._- \uB9CC \uD5C8\uC6A9"),source:L.string(),into:L.string().regex(/^[^/\\][^\\]*$/,"into \uB294 \uB8E8\uD2B8 \uAE30\uC900 \uC0C1\uB300 \uACBD\uB85C (POSIX)").optional(),install:L.string().optional()}),ue="packages",F1=L.record(L.string(),L.array(R1)),$t="extends",Z1=L.preprocess(e=>e&&typeof e=="object"&&!Array.isArray(e)&&typeof e[$t]=="string"?{...e,[$t]:[e[$t]]}:e,L.record(L.string(),L.array(L.string()))),q1=L.object({version:L.literal(1),agent:L.string().default("claude-code"),ignore:L.array(L.string()).optional(),exclude:L.array(L.string()).optional(),components:F1.default({}),packages:L.array(V1).default([]),profiles:L.record(L.string(),Z1).default({})}),lo=class extends Error{};function Gc(e,t,n){let i=$S.default.parse(e),r=q1.safeParse(i);if(!r.success){let c=r.error.issues.map(u=>` ${u.path.join(".")||"(root)"}: ${u.message}`);throw new lo(`lshed.yaml \uD615\uC2DD \uC624\uB958:
247
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function eb(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!="object")return;eb(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var tb=new Set(["type","properties","required","additionalProperties"]),X$=["oneOf","anyOf"];function Q$(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function up(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!tb.has(s))return null;t.push(o)}let n={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Q$(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:up(a)??{allOf:a};ne(n,s,c)}for(let s of o.required??[])i.add(s)}let r={type:"object",properties:n};if(i.size&&(r.required=[...i]),t.every(o=>o.additionalProperties===!1))r.additionalProperties=!1;else{let o=[];for(let s of t){let a=Q$(s);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?r.additionalProperties=o[0]:o.length>1&&(r.additionalProperties={allOf:o})}return r}function Mz(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of tb)if(r in e)return;let n=t.filter(r=>X$.some(o=>Array.isArray(r[o]))),i=null;if(!n.length)i=up(t);else{let r=n[0],o=X$.find(c=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let s=t.filter(c=>c!==r),a=r[o].map(c=>up([...s,c]));if(a.some(c=>!c))return;i={[o]:a}}i&&(delete e.allOf,$i(e,i))}function jt(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){i(d);let p=e.seen.get(d),m=p.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):$i(u,m),$i(u,l),a._zod.parent===d)for(let g in u)g==="$ref"||g==="allOf"||g in l||delete u[g];if(m.$ref&&p.def)for(let g in u)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(u[g])===JSON.stringify(p.def[g])&&delete u[g]}let f=a._zod.parent;if(f&&f!==d){i(f);let p=e.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let m in u)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(u[m])===JSON.stringify(p.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())eb(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Mz(u)}}let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}$i(r,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ne(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:rn(t,"input",e.processors),output:rn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Se(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Se(i.element,n);if(i.type==="set")return Se(i.valueType,n);if(i.type==="lazy")return Se(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Se(i.innerType,n);if(i.type==="intersection")return Se(i.left,n)||Se(i.right,n);if(i.type==="record"||i.type==="map")return Se(i.keyType,n)||Se(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Se(i.in,n)||Se(i.out,n);if(i.type==="object"){for(let r in i.shape)if(Se(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Se(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Se(r,n))return!0;return!!(i.rest&&Se(i.rest,n))}return!1}var lp=(e,t={})=>n=>{let i=Nt({...n,processors:t});return G(e,i),Ct(i,e),jt(i,e)},rn=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},s=Nt({...r??{},target:o,io:t,processors:n});return G(e,s),Ct(s,e),jt(s,e)};var Rz={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},pp=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=e._zod.bag;if(typeof o=="number"&&(r.minLength=o),typeof s=="number"&&(r.maxLength=s),a&&(r.format=Rz[a]??a,r.format===""&&delete r.format,(a==="time"||l)&&delete r.format),u&&(r.contentEncoding=u),c&&c.size>0){let d=[...c];d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},mp=(e,t,n,i)=>{let r=n,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?r.type="integer":r.type="number";let d=typeof l=="number"&&l>=(o??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:typeof o=="number"&&(r.minimum=o),f?p?(r.maximum=u,r.exclusiveMaximum=!0):r.exclusiveMaximum=u:typeof s=="number"&&(r.maximum=s),typeof c=="number"&&(Number.isFinite(c)&&c!==0?r.multipleOf=Math.abs(c):fe(e,t,r,i,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},hp=(e,t,n,i)=>{n.type="boolean"},gp=(e,t,n,i)=>{fe(e,t,n,i,"BigInt cannot be represented in JSON Schema")},vp=(e,t,n,i)=>{fe(e,t,n,i,"Symbols cannot be represented in JSON Schema")},yp=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},$p=(e,t,n,i)=>{fe(e,t,n,i,"Undefined cannot be represented in JSON Schema")},bp=(e,t,n,i)=>{fe(e,t,n,i,"Void cannot be represented in JSON Schema")},_p=(e,t,n,i)=>{n.not={}},wp=(e,t,n,i)=>{},kp=(e,t,n,i)=>{},Sp=(e,t,n,i)=>{fe(e,t,n,i,"Date cannot be represented in JSON Schema")},Ip=(e,t,n,i)=>{let r=e._zod.def,o=Kn(r.entries);if(o.length===0){n.not={};return}o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},xp=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let o=[];for(let s of r.values)if(s===void 0){if(fe(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(fe(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),o.every(s=>typeof s=="boolean")&&(n.type="boolean"),o.every(s=>s===null)&&(n.type="null"),n.enum=o},Op=(e,t,n,i)=>{fe(e,t,n,i,"NaN cannot be represented in JSON Schema")},Ap=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},zp=(e,t,n,i)=>{let r=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=e._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(r,o)):(Object.assign(r,o),r.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(r,o)},Pp=(e,t,n,i)=>{n.type="boolean"},Ep=(e,t,n,i)=>{fe(e,t,n,i,"Custom types cannot be represented in JSON Schema")},Np=(e,t,n,i)=>{fe(e,t,n,i,"Function types cannot be represented in JSON Schema")},Cp=(e,t,n,i)=>{fe(e,t,n,i,"Transforms cannot be represented in JSON Schema")},jp=(e,t,n,i)=>{fe(e,t,n,i,"Map cannot be represented in JSON Schema")},Tp=(e,t,n,i)=>{fe(e,t,n,i,"Set cannot be represented in JSON Schema")},Dp=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(r.minItems=s),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=G(o.element,t,{...i,path:[...i.path,"items"]})};function bi(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?bi(t.out):t.type==="catch"?bi(t.innerType):e._zod.optin}var Lp=(e,t,n,i)=>{let r=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&fe(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let l in s)ne(r.properties,l,G(s[l],t,{...i,path:[...i.path,"properties",l]}));let c=new Set(Object.keys(s)),u=new Set([...c].filter(l=>{let d=o.shape[l];return t.io==="input"?bi(d)===void 0:d._zod.optout===void 0}));u.size>0&&(r.required=Array.from(u)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=G(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},ya=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,s=r.options.map((a,c)=>G(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?n.oneOf=s:n.anyOf=s},Up=(e,t,n,i)=>{let r=e._zod.def,o=G(r.left,t,{...i,path:[...i.path,"allOf",0]}),s=G(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Mp=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((h,g)=>G(h,t,{...i,path:[...i.path,s,g]})),u=o.rest?G(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;for(;l>0;){let h=o.items[l-1];if(!(t.io==="input"?bi(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=o.items.length,f=!o.rest;t.target==="draft-2020-12"?(r.prefixItems=c,f?r.items=!1:u&&(r.items=u),l>0&&(r.minItems=l),f&&(r.maxItems=d)):t.target==="openapi-3.0"?(r.items={anyOf:c},u&&r.items.anyOf.push(u),l>0&&(r.minItems=l),f&&(r.maxItems=d)):(r.items=c,f?r.additionalItems=!1:u&&(r.additionalItems=u),l>0&&(r.minItems=l),f&&(r.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p=="number"&&(r.minItems=p),typeof m=="number"&&(r.maxItems=m)};function dp(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let m=e.get(t)?.def;if(!m)return t;let h=dp(e,m,n);return h===m?t:h}for(let m of["anyOf","oneOf"]){let h=t[m];if(!Array.isArray(h))continue;let g=h.map(S=>dp(e,S,n));g.some((S,$)=>S!==h[$])&&(t={...t,[m]:g})}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some(m=>m==="number"||m==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!o?.some(m=>typeof m=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(m=>typeof m=="number"?String(m):m):typeof p.const=="number"&&(p.const=String(p.const)),r&&(p.type="string",o||(p.pattern=(i.includes("number")?zt:ri).source)),p}var fp=new WeakMap;function Vz(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let n=new Map;for(let i of fp.get(e)??[]){let r=e.seen.get(i),o=(r?.def??r?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let s=dp(t,o,new Set);s!==o&&n.set(o,s)}if(n.size)for(let i of e.seen.values())for(let r of[i.schema,i.def]){let o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}var Rp=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let d=G(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let f of c)ne(r.patternProperties,f.source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=G(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let d=fp.get(t);d||(d=[],fp.set(t,d),t.deferred.push(()=>Vz(t))),d.push(e)}r.additionalProperties=G(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let u=s._zod.values,l=t.io==="input"&&bi(o.valueType)!==void 0;if(u&&!o.partial&&!l){let d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(r.required=d.map(String))}},Vp=(e,t,n,i)=>{let r=e._zod.def,o=G(r.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Fp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Zp=Symbol();function rb(e,t,n,i,r){let o=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(fe(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),Zp):JSON.parse(s)}var qp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s=rb(r.defaultValue,e,t,n,i);s!==Zp&&(n.default=s)},Jp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);if(o.ref=r.innerType,t.io!=="input")return;let s=rb(r.defaultValue,e,t,n,i);s!==Zp&&(n._prefault=s)},Kp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{fe(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},Bp=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?r.out:r.in:r.out;G(s,t,i);let a=t.seen.get(e);a.ref=s},Gp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},Wp=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},$a=(e,t,n,i)=>{let r=e._zod.def;G(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Hp=(e,t,n,i)=>{let r=e._zod.innerType;G(r,t,i);let o=t.seen.get(e);o.ref=r},va={string:pp,number:mp,boolean:hp,bigint:gp,symbol:vp,null:yp,undefined:$p,void:bp,never:_p,any:wp,unknown:kp,date:Sp,enum:Ip,literal:xp,nan:Op,template_literal:Ap,file:zp,success:Pp,custom:Ep,function:Np,transform:Cp,map:jp,set:Tp,array:Dp,object:Lp,union:ya,intersection:Up,tuple:Mp,record:Rp,nullable:Vp,nonoptional:Fp,default:qp,prefault:Jp,catch:Kp,pipe:Bp,readonly:Gp,promise:Wp,optional:$a,lazy:Hp};function ba(e,t){if("_idmap"in e){let i=e,r=Nt({...t,processors:va}),o={};for(let c of i._idmap.entries()){let[u,l]=c;G(l,r)}let s={},a={registry:i,uri:t?.uri,defs:o};r.external=a;for(let c of i._idmap.entries()){let[u,l]=c;Ct(r,l),ne(s,u,jt(r,l))}if(Object.keys(o).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let n=Nt({...t,processors:va});return G(e,n),Ct(n,e),jt(n,e)}var _a=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Nt({processors:va,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return G(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ct(this.ctx,t);let i=jt(this.ctx,t),{"~standard":r,...o}=i;return o}};var nb={};var fn={};dt(fn,{ZodAny:()=>vm,ZodArray:()=>_m,ZodBase64:()=>Ra,ZodBase64URL:()=>Va,ZodBigInt:()=>ln,ZodBigIntFormat:()=>qa,ZodBoolean:()=>un,ZodCIDRv4:()=>Ua,ZodCIDRv6:()=>Ma,ZodCUID:()=>Ea,ZodCUID2:()=>Na,ZodCatch:()=>Fm,ZodCodec:()=>Pi,ZodCreditCard:()=>lm,ZodCustom:()=>Ei,ZodCustomStringFormat:()=>an,ZodDate:()=>Si,ZodDefault:()=>Dm,ZodDiscriminatedUnion:()=>km,ZodE164:()=>Fa,ZodEmail:()=>Oa,ZodEmoji:()=>za,ZodEnum:()=>on,ZodExactOptional:()=>Ga,ZodFile:()=>Nm,ZodFunction:()=>Xm,ZodGUID:()=>Aa,ZodIPv4:()=>Da,ZodIPv6:()=>La,ZodISODate:()=>Dt,ZodISODateTime:()=>Tt,ZodISODuration:()=>Ut,ZodISOTime:()=>Lt,ZodIntersection:()=>Sm,ZodJWT:()=>Za,ZodKSUID:()=>Ta,ZodLazy:()=>Wm,ZodLiteral:()=>Em,ZodMAC:()=>um,ZodMap:()=>zm,ZodNaN:()=>qm,ZodNanoID:()=>Pa,ZodNever:()=>$m,ZodNonOptional:()=>Wa,ZodNull:()=>hm,ZodNullable:()=>Tm,ZodNumber:()=>cn,ZodNumberFormat:()=>vr,ZodObject:()=>xi,ZodOptional:()=>Ai,ZodPipe:()=>zi,ZodPrefault:()=>Um,ZodPreprocess:()=>Jm,ZodPromise:()=>Ym,ZodReadonly:()=>Km,ZodRecord:()=>nn,ZodSet:()=>Pm,ZodString:()=>sn,ZodStringFormat:()=>Y,ZodSuccess:()=>Vm,ZodSymbol:()=>pm,ZodTemplateLiteral:()=>Gm,ZodTransform:()=>Cm,ZodTuple:()=>xm,ZodType:()=>R,ZodULID:()=>Ca,ZodURL:()=>ki,ZodUUID:()=>st,ZodUndefined:()=>mm,ZodUnion:()=>Oi,ZodUnknown:()=>ym,ZodVoid:()=>bm,ZodXID:()=>ja,ZodXor:()=>wm,_ZodString:()=>xa,_default:()=>Lm,_function:()=>p_,any:()=>qb,array:()=>Ii,base64:()=>xb,base64url:()=>Ob,bigint:()=>Mb,boolean:()=>fm,catch:()=>Zm,check:()=>m_,cidrv4:()=>Sb,cidrv6:()=>Ib,codec:()=>u_,creditCard:()=>zb,cuid:()=>gb,cuid2:()=>vb,custom:()=>h_,date:()=>Kb,describe:()=>g_,discriminatedUnion:()=>Xb,e164:()=>Ab,email:()=>sb,emoji:()=>mb,enum:()=>Ka,exactOptional:()=>jm,file:()=>o_,float32:()=>Tb,float64:()=>Db,function:()=>p_,guid:()=>ab,hash:()=>jb,hex:()=>Cb,hostname:()=>Nb,httpUrl:()=>pb,instanceof:()=>y_,int:()=>Sa,int32:()=>Lb,int64:()=>Rb,intersection:()=>Im,invertCodec:()=>l_,ipv4:()=>_b,ipv6:()=>kb,json:()=>b_,jwt:()=>Pb,keyof:()=>Bb,ksuid:()=>bb,lazy:()=>Hm,literal:()=>i_,looseObject:()=>Hb,looseRecord:()=>e_,mac:()=>wb,map:()=>t_,meta:()=>v_,nan:()=>c_,nanoid:()=>hb,nativeEnum:()=>n_,never:()=>Ja,nonoptional:()=>Rm,null:()=>gm,nullable:()=>wi,nullish:()=>s_,number:()=>dm,object:()=>Gb,optional:()=>hr,partialRecord:()=>Qb,pipe:()=>Ia,prefault:()=>Mm,preprocess:()=>__,promise:()=>f_,readonly:()=>Bm,record:()=>Am,refine:()=>Qm,set:()=>r_,strictObject:()=>Wb,string:()=>_i,stringFormat:()=>Eb,stringbool:()=>$_,success:()=>a_,superRefine:()=>eh,symbol:()=>Fb,templateLiteral:()=>d_,transform:()=>Ba,tuple:()=>Om,uint32:()=>Ub,uint64:()=>Vb,ulid:()=>yb,undefined:()=>Zb,union:()=>dn,unknown:()=>mr,url:()=>fb,uuid:()=>cb,uuidv4:()=>ub,uuidv6:()=>lb,uuidv7:()=>db,void:()=>Jb,xid:()=>$b,xor:()=>Yb});var wa={};dt(wa,{endsWith:()=>Gr,gt:()=>it,gte:()=>Re,includes:()=>Kr,length:()=>pr,lowercase:()=>qr,lt:()=>nt,lte:()=>Me,maxLength:()=>fr,maxSize:()=>Et,mime:()=>Wr,minLength:()=>mt,minSize:()=>ot,multipleOf:()=>Pt,negative:()=>fa,nonnegative:()=>ma,nonpositive:()=>pa,normalize:()=>Hr,overwrite:()=>Ge,positive:()=>da,properties:()=>ga,property:()=>ha,regex:()=>Zr,size:()=>dr,slugify:()=>en,startsWith:()=>Br,toLowerCase:()=>Xr,toUpperCase:()=>Qr,trim:()=>Yr,uppercase:()=>Jr});var ib=new WeakSet([Object.prototype,Error.prototype]);function ka(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var ob=(e,t)=>{Qn.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);ib.has(n)||(ib.add(n),ka(n,"format",i=>r=>ti(i,r)),ka(n,"flatten",i=>r=>ei(i,r)),ka(n,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,Cr,2)}),ka(n,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,Cr,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Zz=v("ZodError",ob),Ce=v("ZodError",ob,void 0,{Parent:Error});var Yp=Dr(Ce),Xp=Lr(Ce),Qp=Ur(Ce),em=Mr(Ce),tm=rs(Ce),rm=ns(Ce),nm=is(Ce),im=os(Ce),om=ss(Ce),sm=as(Ce),am=cs(Ce),cm=us(Ce);function Jz(){he.localeError||ie(Us())}function gr(){he.memoizer||ie({memoizer:di()})}var R=v("ZodType",(e,t)=>(Jz(),M.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(w.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return B(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Qm(e,t))},superRefine(e,t){return this.check(eh(e,t))},overwrite(e){return this.check(Ge(e))},optional(){return hr(this)},exactOptional(){return jm(this)},nullable(){return wi(this)},nullish(){return hr(wi(this))},nonoptional(e){return Rm(this,e)},array(){return Ii(this)},or(e){return dn([this,e])},and(e){return Im(this,e)},transform(e){return Ia(this,Ba(e))},default(e){return Lm(this,e)},prefault(e){return Mm(this,e)},catch(e){return Zm(this,e)},pipe(e){return Ia(this,e)},readonly(){return Bm(this)},describe(e){let t=this.clone();return ye.add(t,{description:e}),t},meta(...e){if(e.length===0)return ye.get(this);let t=this.clone();return ye.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 w.hide(this,"~standard",{...bs(this),jsonSchema:{input:rn(this,"input"),output:rn(this,"output")}})},set"~standard"(e){w.own(this,"~standard",e)},parse:function e(t,n){return Yp(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Xp(this,t,n,{callee:e})},safeParse(e,t){return Qp(this,e,t)},async safeParseAsync(e,t){return em(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){w.own(this,"spa",e)},encode:function e(t,n){return tm(this,t,n,{callee:e})},decode:function e(t,n){return rm(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await nm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await im(this,t,n,{callee:e})},safeEncode(e,t){return om(this,e,t)},safeDecode(e,t){return sm(this,e,t)},async safeEncodeAsync(e,t){return am(this,e,t)},async safeDecodeAsync(e,t){return cm(this,e,t)},toJSONSchema(e){return lp(this,{})(e)},get description(){return ye.get(this)?.description},get _def(){return this._zod.def}}),xa=v("_ZodString",(e,t)=>{sr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>pp(e,i,r,o);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(Zr(...e))},includes(...e){return this.check(Kr(...e))},startsWith(...e){return this.check(Br(...e))},endsWith(...e){return this.check(Gr(...e))},min(...e){return this.check(mt(...e))},max(...e){return this.check(fr(...e))},length(...e){return this.check(pr(...e))},nonempty(...e){return this.check(mt(1,...e))},lowercase(e){return this.check(qr(e))},uppercase(e){return this.check(Jr(e))},trim(){return this.check(Yr())},normalize(...e){return this.check(Hr(...e))},toLowerCase(){return this.check(Xr())},toUpperCase(){return this.check(Qr())},slugify(){return this.check(en())}}),sn=v("ZodString",(e,t)=>{sr.init(e,t),xa.init(e,t)},{email(e){return this.check(qs(Oa,e))},url(e){return this.check(mi(ki,e))},jwt(e){return this.check(la(Za,e))},emoji(e){return this.check(Hs(za,e))},guid(e){return this.check(Js(Aa,e))},uuid(e){return this.check(Ks(st,e))},uuidv4(e){return this.check(Bs(st,e))},uuidv6(e){return this.check(Gs(st,e))},uuidv7(e){return this.check(Ws(st,e))},nanoid(e){return this.check(Ys(Pa,e))},cuid(e){return this.check(Xs(Ea,e))},cuid2(e){return this.check(Qs(Na,e))},ulid(e){return this.check(ea(Ca,e))},base64(e){return this.check(aa(Ra,e))},base64url(e){return this.check(ca(Va,e))},xid(e){return this.check(ta(ja,e))},ksuid(e){return this.check(ra(Ta,e))},ipv4(e){return this.check(na(Da,e))},ipv6(e){return this.check(ia(La,e))},cidrv4(e){return this.check(oa(Ua,e))},cidrv6(e){return this.check(sa(Ma,e))},e164(e){return this.check(ua(Fa,e))},datetime(e){return this.check(hi(Tt,e))},date(e){return this.check(gi(Dt,e))},time(e){return this.check(vi(Lt,e))},duration(e){return this.check(yi(Ut,e))}});function _i(e){return Of(sn,e)}var Y=v("ZodStringFormat",(e,t)=>{H.init(e,t),xa.init(e,t)}),Tt=v("ZodISODateTime",(e,t)=>{vd.init(e,t),Y.init(e,t)}),Dt=v("ZodISODate",(e,t)=>{yd.init(e,t),Y.init(e,t)}),Lt=v("ZodISOTime",(e,t)=>{$d.init(e,t),Y.init(e,t)}),Ut=v("ZodISODuration",(e,t)=>{bd.init(e,t),Y.init(e,t)}),Oa=v("ZodEmail",(e,t)=>{sd.init(e,t),Y.init(e,t)});function sb(e){return qs(Oa,e)}var Aa=v("ZodGUID",(e,t)=>{id.init(e,t),Y.init(e,t)});function ab(e){return Js(Aa,e)}var st=v("ZodUUID",(e,t)=>{od.init(e,t),Y.init(e,t)});function cb(e){return Ks(st,e)}function ub(e){return Bs(st,e)}function lb(e){return Gs(st,e)}function db(e){return Ws(st,e)}var ki=v("ZodURL",(e,t)=>{ud.init(e,t),Y.init(e,t)});function fb(e){return mi(ki,e)}function pb(e){return mi(ki,{protocol:we.httpProtocol,hostname:we.domain,...w.normalizeParams(e)})}var za=v("ZodEmoji",(e,t)=>{ld.init(e,t),Y.init(e,t)});function mb(e){return Hs(za,e)}var Pa=v("ZodNanoID",(e,t)=>{dd.init(e,t),Y.init(e,t)});function hb(e){return Ys(Pa,e)}var Ea=v("ZodCUID",(e,t)=>{fd.init(e,t),Y.init(e,t)});function gb(e){return Xs(Ea,e)}var Na=v("ZodCUID2",(e,t)=>{pd.init(e,t),Y.init(e,t)});function vb(e){return Qs(Na,e)}var Ca=v("ZodULID",(e,t)=>{md.init(e,t),Y.init(e,t)});function yb(e){return ea(Ca,e)}var ja=v("ZodXID",(e,t)=>{hd.init(e,t),Y.init(e,t)});function $b(e){return ta(ja,e)}var Ta=v("ZodKSUID",(e,t)=>{gd.init(e,t),Y.init(e,t)});function bb(e){return ra(Ta,e)}var Da=v("ZodIPv4",(e,t)=>{_d.init(e,t),Y.init(e,t)});function _b(e){return na(Da,e)}var um=v("ZodMAC",(e,t)=>{kd.init(e,t),Y.init(e,t)});function wb(e){return zf(um,e)}var La=v("ZodIPv6",(e,t)=>{wd.init(e,t),Y.init(e,t)});function kb(e){return ia(La,e)}var Ua=v("ZodCIDRv4",(e,t)=>{Sd.init(e,t),Y.init(e,t)});function Sb(e){return oa(Ua,e)}var Ma=v("ZodCIDRv6",(e,t)=>{Id.init(e,t),Y.init(e,t)});function Ib(e){return sa(Ma,e)}var Ra=v("ZodBase64",(e,t)=>{xd.init(e,t),Y.init(e,t)});function xb(e){return aa(Ra,e)}var Va=v("ZodBase64URL",(e,t)=>{Od.init(e,t),Y.init(e,t)});function Ob(e){return ca(Va,e)}var Fa=v("ZodE164",(e,t)=>{Ad.init(e,t),Y.init(e,t)});function Ab(e){return ua(Fa,e)}var lm=v("ZodCreditCard",(e,t)=>{zd.init(e,t),Y.init(e,t)});function zb(e){return Pf(lm,e)}var Za=v("ZodJWT",(e,t)=>{Pd.init(e,t),Y.init(e,t)});function Pb(e){return la(Za,e)}var an=v("ZodCustomStringFormat",(e,t)=>{Ed.init(e,t),Y.init(e,t)});function Eb(e,t,n={}){return tn(an,e,t,n)}function Nb(e){return tn(an,"hostname",we.hostname,e)}function Cb(e){return tn(an,"hex",we.hex,e)}function jb(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=we[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return tn(an,i,r,t)}var cn=v("ZodNumber",(e,t)=>{zs.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>mp(e,i,r,o);let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(it(e,t))},gte(e,t){return this.check(Re(e,t))},min(e,t){return this.check(Re(e,t))},lt(e,t){return this.check(nt(e,t))},lte(e,t){return this.check(Me(e,t))},max(e,t){return this.check(Me(e,t))},int(e){return this.check(Sa(e))},safe(e){return this.check(Sa(e))},positive(e){return this.check(it(0,e))},nonnegative(e){return this.check(Re(0,e))},negative(e){return this.check(nt(0,e))},nonpositive(e){return this.check(Me(0,e))},multipleOf(e,t){return this.check(Pt(e,t))},step(e,t){return this.check(Pt(e,t))},finite(){return this}});function dm(e){return Nf(cn,e)}var vr=v("ZodNumberFormat",(e,t)=>{Nd.init(e,t),cn.init(e,t)});function Sa(e){return jf(vr,e)}function Tb(e){return Tf(vr,e)}function Db(e){return Df(vr,e)}function Lb(e){return Lf(vr,e)}function Ub(e){return Uf(vr,e)}var un=v("ZodBoolean",(e,t)=>{ai.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>hp(e,n,i,r)});function fm(e){return Mf(un,e)}var ln=v("ZodBigInt",(e,t)=>{Ps.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>gp(e,i,r,o);let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null},{gte(e,t){return this.check(Re(e,t))},min(e,t){return this.check(Re(e,t))},gt(e,t){return this.check(it(e,t))},lt(e,t){return this.check(nt(e,t))},lte(e,t){return this.check(Me(e,t))},max(e,t){return this.check(Me(e,t))},positive(e){return this.check(it(BigInt(0),e))},negative(e){return this.check(nt(BigInt(0),e))},nonpositive(e){return this.check(Me(BigInt(0),e))},nonnegative(e){return this.check(Re(BigInt(0),e))},multipleOf(e,t){return this.check(Pt(e,t))}});function Mb(e){return Vf(ln,e)}var qa=v("ZodBigIntFormat",(e,t)=>{Cd.init(e,t),ln.init(e,t)});function Rb(e){return Zf(qa,e)}function Vb(e){return qf(qa,e)}var pm=v("ZodSymbol",(e,t)=>{jd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>vp(e,n,i,r)});function Fb(e){return Jf(pm,e)}var mm=v("ZodUndefined",(e,t)=>{Td.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$p(e,n,i,r)});function Zb(e){return Kf(mm,e)}var hm=v("ZodNull",(e,t)=>{Dd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>yp(e,n,i,r)});function gm(e){return Bf(hm,e)}var vm=v("ZodAny",(e,t)=>{Ld.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wp(e,n,i,r)});function qb(){return Gf(vm)}var ym=v("ZodUnknown",(e,t)=>{Ud.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>kp(e,n,i,r)});function mr(){return Wf(ym)}var $m=v("ZodNever",(e,t)=>{Md.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>_p(e,n,i,r)});function Ja(e){return Hf($m,e)}var bm=v("ZodVoid",(e,t)=>{Rd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>bp(e,n,i,r)});function Jb(e){return Yf(bm,e)}var Si=v("ZodDate",(e,t)=>{Vd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Sp(e,i,r,o),e.min=(i,r)=>e.check(Re(i,r)),e.max=(i,r)=>e.check(Me(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function Kb(e){return Xf(Si,e)}var _m=v("ZodArray",(e,t)=>{gr(),Fd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Dp(e,n,i,r),e.element=t.element},{min(e,t){return this.check(mt(e,t))},nonempty(e){return this.check(mt(1,e))},max(e,t){return this.check(fr(e,t))},length(e,t){return this.check(pr(e,t))},unwrap(){return this.element}});function Ii(e,t){return tp(_m,e,t)}function Bb(e){let t=e._zod.def.shape;return Ka(Object.keys(t))}var xi=v("ZodObject",(e,t)=>{gr(),Zd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Lp(e,n,i,r),w.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ka(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:mr()})},loose(){return this.clone({...this._zod.def,catchall:mr()})},strict(){return this.clone({...this._zod.def,catchall:Ja()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return w.extend(this,e)},safeExtend(e){return w.safeExtend(this,e)},merge(e){return w.merge(this,e)},pick(e){return w.pick(this,e)},omit(e){return w.omit(this,e)},partial(...e){return w.partial(Ai,this,e[0])},exactPartial(...e){return w.partial(Ga,this,e[0],"exactPartial")},required(...e){return w.required(Wa,this,e[0])}});function Gb(e,t){let n={type:"object",shape:e??{},...w.normalizeParams(t)};return new xi(n)}function Wb(e,t){return new xi({type:"object",shape:e,catchall:Ja(),...w.normalizeParams(t)})}function Hb(e,t){return new xi({type:"object",shape:e,catchall:mr(),...w.normalizeParams(t)})}var Oi=v("ZodUnion",(e,t)=>{ci.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ya(e,n,i,r),e.options=t.options});function dn(e,t){return new Oi({type:"union",options:e,...w.normalizeParams(t)})}var wm=v("ZodXor",(e,t)=>{Oi.init(e,t),qd.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ya(e,n,i,r),e.options=t.options});function Yb(e,t){return new wm({type:"union",options:e,inclusive:!1,...w.normalizeParams(t)})}var km=v("ZodDiscriminatedUnion",(e,t)=>{Oi.init(e,t),Kd.init(e,t)});function Xb(e,t,n){return new km({type:"union",options:t,discriminator:e,...w.normalizeParams(n)})}var Sm=v("ZodIntersection",(e,t)=>{Bd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Up(e,n,i,r)});function Im(e,t){return new Sm({type:"intersection",left:e,right:t})}var xm=v("ZodTuple",(e,t)=>{gr(),Es.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Mp(e,n,i,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Ai({type:"optional",innerType:t}))})}});function Om(e,t,n){let i=t instanceof M,r=i?n:t,o=i?t:null;return new xm({type:"tuple",items:e,rest:o,...w.normalizeParams(r)})}var nn=v("ZodRecord",(e,t)=>{gr(),Gd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Rp(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function Am(e,t,n){return!t||!t._zod?new nn({type:"record",keyType:_i(),valueType:e,...w.normalizeParams(t)}):new nn({type:"record",keyType:e,valueType:t,...w.normalizeParams(n)})}function Qb(e,t,n){return new nn({type:"record",keyType:e,valueType:t,...w.normalizeParams(n),partial:!0})}function e_(e,t,n){return new nn({type:"record",keyType:e,valueType:t,mode:"loose",...w.normalizeParams(n)})}var zm=v("ZodMap",(e,t)=>{gr(),Wd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jp(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(ot(...n)),e.nonempty=n=>e.check(ot(1,n)),e.max=(...n)=>e.check(Et(...n)),e.size=(...n)=>e.check(dr(...n))});function t_(e,t,n){return new zm({type:"map",keyType:e,valueType:t,...w.normalizeParams(n)})}var Pm=v("ZodSet",(e,t)=>{gr(),Hd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Tp(e,n,i,r),e.min=(...n)=>e.check(ot(...n)),e.nonempty=n=>e.check(ot(1,n)),e.max=(...n)=>e.check(Et(...n)),e.size=(...n)=>e.check(dr(...n))});function r_(e,t){return new Pm({type:"set",valueType:e,...w.normalizeParams(t)})}var on=v("ZodEnum",(e,t)=>{Yd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Ip(e,i,r,o),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let s of i)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new on({...t,checks:[],...w.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let s of i)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new on({...t,checks:[],...w.normalizeParams(r),entries:o})}});function Ka(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new on({type:"enum",entries:n,...w.normalizeParams(t)})}function n_(e,t){return new on({type:"enum",entries:e,...w.normalizeParams(t)})}var Em=v("ZodLiteral",(e,t)=>{Xd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xp(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function i_(e,t){return new Em({type:"literal",values:Array.isArray(e)?e:[e],...w.normalizeParams(t)})}var Nm=v("ZodFile",(e,t)=>{Qd.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zp(e,n,i,r),e.min=(n,i)=>e.check(ot(n,i)),e.max=(n,i)=>e.check(Et(n,i)),e.mime=(n,i)=>e.check(Wr(Array.isArray(n)?n:[n],i))});function o_(e){return rp(Nm,e)}var Cm=v("ZodTransform",(e,t)=>{gr(),ef.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Cp(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new At(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(w.issue(o,n.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(w.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});function Ba(e){return new Cm({type:"transform",transform:e})}var Ai=v("ZodOptional",(e,t)=>{Ns.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$a(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function hr(e){return new Ai({type:"optional",innerType:e})}var Ga=v("ZodExactOptional",(e,t)=>{tf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$a(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function jm(e){return new Ga({type:"optional",innerType:e})}var Tm=v("ZodNullable",(e,t)=>{rf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Vp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function wi(e){return new Tm({type:"nullable",innerType:e})}function s_(e){return hr(wi(e))}var Dm=v("ZodDefault",(e,t)=>{nf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Lm(e,t){return new Dm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Um=v("ZodPrefault",(e,t)=>{of.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Jp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Mm(e,t){return new Um({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Wa=v("ZodNonOptional",(e,t)=>{sf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Fp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Rm(e,t){return new Wa({type:"nonoptional",innerType:e,...w.normalizeParams(t)})}var Vm=v("ZodSuccess",(e,t)=>{af.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Pp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function a_(e){return new Vm({type:"success",innerType:e})}var Fm=v("ZodCatch",(e,t)=>{cf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Kp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Zm(e,t){return new Fm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:w.constantCatch(t)})}var qm=v("ZodNaN",(e,t)=>{uf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Op(e,n,i,r)});function c_(e){return ep(qm,e)}var zi=v("ZodPipe",(e,t)=>{Cs.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Bp(e,n,i,r),e.in=t.in,e.out=t.out});function Ia(e,t){return new zi({type:"pipe",in:e,out:t})}var Pi=v("ZodCodec",(e,t)=>{zi.init(e,t),ui.init(e,t)});function u_(e,t,n){return new Pi({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function l_(e){let t=e._zod.def;return new Pi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Jm=v("ZodPreprocess",(e,t)=>{zi.init(e,t),lf.init(e,t)}),Km=v("ZodReadonly",(e,t)=>{df.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Gp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Bm(e){return new Km({type:"readonly",innerType:e})}var Gm=v("ZodTemplateLiteral",(e,t)=>{ff.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ap(e,n,i,r)});function d_(e,t){return new Gm({type:"template_literal",parts:e,...w.normalizeParams(t)})}var Wm=v("ZodLazy",(e,t)=>{li.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Hp(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function Hm(e){return new Wm({type:"lazy",getter:e})}var Ym=v("ZodPromise",(e,t)=>{mf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Wp(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function f_(e){return new Ym({type:"promise",innerType:e})}var Xm=v("ZodFunction",(e,t)=>{pf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Np(e,n,i,r)});function p_(e){return new Xm({type:"function",input:Array.isArray(e?.input)?Om(e?.input):e?.input??Ii(mr()),output:e?.output??mr()})}var Ei=v("ZodCustom",(e,t)=>{hf.init(e,t),R.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ep(e,n,i,r)});function m_(e){let t=new Q({check:"custom"});return t._zod.check=e,t}function h_(e,t){return np(Ei,e??(()=>!0),t)}function Qm(e,t={}){return ip(Ei,e,t)}function eh(e,t){return op(e,t)}var g_=sp,v_=ap;function y_(e,t={}){let n=new Ei({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...w.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var $_=(...e)=>cp({Codec:Pi,Boolean:un,String:sn},...e);function b_(e){let t=Hm(()=>dn([_i(e),dm(),fm(),gm(),Ii(t),Am(_i(),t)]));return t}function __(e,t){return new Jm({type:"pipe",in:Ba(e),out:t})}var Kz={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Bz(e){ie({customError:e})}function Gz(){return ie().customError}var th;th||(th={});var Ni={};dt(Ni,{ZodISODate:()=>Dt,ZodISODateTime:()=>Tt,ZodISODuration:()=>Ut,ZodISOTime:()=>Lt,date:()=>Hz,datetime:()=>Wz,duration:()=>Xz,time:()=>Yz});function Wz(e){return hi(Tt,e)}function Hz(e){return gi(Dt,e)}function Yz(e){return vi(Lt,e)}function Xz(e){return yi(Ut,e)}var C={...fn,...wa,iso:Ni},Qz=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function eP(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function w_(e,t){return e.map((n,i)=>i<t?n:n.optional())}function tP(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function rP(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1]===void 0?void 0:tP(n[1]);if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function nP(e,t){return C.transform(i=>i).check(i=>{let r=i.value;if(!(typeof r!="object"||r===null||Array.isArray(r)))for(let o of Object.getOwnPropertyNames(r)){let s=t.safeParse(o);s.success||i.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function k_(e,t){if(e!==!1)return e===void 0||e===!0?C.any():je(e,t)}var iP=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function S_(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return C.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return C.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=rP(r,t),s=je(o,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return C.null();if(r.length===0)return C.never();if(r.length===1)return C.literal(r[0]);if(r.every(s=>typeof s=="string"))return C.enum(r);let o=r.map(s=>C.literal(s));return o.length<2?o[0]:C.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return C.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let s={...e,type:o};return S_(s,t)});return r.length===0?C.never():r.length===1?r[0]:C.union(r)}if(!n)return C.any();let i;switch(n){case"string":{let r=C.string();if(e.format){let o=e.format;o==="email"?r=r.check(C.email()):o==="uri"||o==="uri-reference"?r=r.check(C.url()):o==="uuid"||o==="guid"?r=r.check(C.uuid()):o==="date-time"?r=r.check(C.iso.datetime({offset:!0})):o==="date"?r=r.check(C.iso.date()):o==="time"?r=r.check(C.regex(iP)):o==="duration"?r=r.check(C.iso.duration()):o==="hostname"?r=r.check(C.hostname()):o==="ipv4"?r=r.check(C.ipv4()):o==="ipv6"?r=r.check(C.ipv6()):o==="mac"?r=r.check(C.mac()):o==="cidr"?r=r.check(C.cidrv4()):o==="cidr-v6"?r=r.check(C.cidrv6()):o==="base64"?r=r.check(C.base64()):o==="base64url"?r=r.check(C.base64url()):o==="e164"?r=r.check(C.e164()):o==="credit_card"?r=r.check(C.creditCard()):o==="jwt"?r=r.check(C.jwt()):o==="emoji"?r=r.check(C.emoji()):o==="nanoid"?r=r.check(C.nanoid()):o==="cuid"?r=r.check(C.cuid()):o==="cuid2"?r=r.check(C.cuid2()):o==="ulid"?r=r.check(C.ulid()):o==="xid"?r=r.check(C.xid()):o==="ksuid"&&(r=r.check(C.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?C.number().int():C.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=C.boolean();break}case"null":{i=C.null();break}case"object":{let r={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?je(e.additionalProperties,t):void 0;for(let[c,u]of Object.entries(o)){let l=je(u,t);ne(r,c,s.has(c)?l:l.optional())}if(e.patternProperties){let c=e.patternProperties,u=Object.keys(c),l=[];for(let f of u){let p=je(c[f],t),m=C.string().regex(new RegExp(f));l.push(C.looseRecord(m,p))}let d=[];if(Object.keys(r).length>0&&d.push(C.object(r).passthrough()),d.push(...l),d.length===0)i=C.object({}).passthrough();else if(d.length===1)i=d[0];else{let f=C.intersection(d[0],d[1]);for(let p=2;p<d.length;p++)f=C.intersection(f,d[p]);i=f}if(e.additionalProperties===!1){let f=Object.keys(r),p=u.map(h=>new RegExp(h)),m=i;i=i.check(h=>{if(!Fe(h.value))return;let g=[];for(let S of Object.keys(h.value))f.includes(S)||p.some($=>$.test(S))||g.push(S);g.length&&h.issues.push({code:"unrecognized_keys",keys:g,input:h.value,inst:m})})}}else{let c=C.object(r);e.additionalProperties===!1?i=c.strict():a?i=c.catchall(a):i=c.passthrough()}if(e.propertyNames!==void 0&&e.propertyNames!==!0){let c=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;i=nP(i,je(c,t))}break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let s=typeof e.minItems=="number"?e.minItems:0,a=r.map(d=>je(d,t)),c=w_(a,s),u=Array.isArray(o)?void 0:k_(o,t),l=C.tuple(c);i=u?l.rest(u):l,typeof e.minItems=="number"&&(i=i.check(C.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(C.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>je(d,t)),c=w_(a,s),u=k_(e.additionalItems,t),l=C.tuple(c);i=u?l.rest(u):l,typeof e.minItems=="number"&&(i=i.check(C.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(C.maxLength(e.maxItems)))}else if(o!==void 0){let s=je(o,t),a=C.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=C.array(C.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function je(e,t){if(typeof e=="boolean")return e?C.any():C.never();let n=S_(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>je(u,t)),c=C.union(a);n=i?C.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>je(u,t)),c=C.xor(a);n=i?C.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:C.any();else{let a=i?n:je(e.allOf[0],t),c=i?0:1;for(let u=c;u<e.allOf.length;u++)a=C.intersection(a,je(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=C.nullable(n)),e.readOnly===!0&&(n=C.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(r[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(r[a]=e[a]);e.propertyNames!==void 0&&e.type==="object"&&e.$ref===void 0&&(r.propertyNames=e.propertyNames);for(let a of Object.keys(e))Qz.has(a)||ne(r,a,e[a]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function I_(e,t){if(typeof e=="boolean")return e?C.any():C.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=eP(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??ye};return je(n,o)}var x_=Symbol("z.visit/resolving");function Ci(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},i=new Map;function r(s){let a=i.get(s);if(a===x_)return new li({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,x_);let c=o(s),u=n(c,c!==s);return i.set(s,u),u}function o(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),d=!1,f={};for(let m of l){let h=r(u[m]);h!==u[m]&&(d=!0),f[m]=h}let p=a.catchall;return a.catchall&&(p=r(a.catchall),p!==a.catchall&&(d=!0)),d?B(s,{...a,shape:f,catchall:p}):s}case"array":{let u=r(a.element);return u===a.element?s:B(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,d=[];for(let p of u){let m=r(p);m!==p&&(l=!0),d.push(m)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(l=!0)),l?B(s,{...a,items:d,rest:f}):s}case"record":case"map":{let u=r(a.keyType),l=r(a.valueType);return u===a.keyType&&l===a.valueType?s:B(s,{...a,keyType:u,valueType:l})}case"set":{let u=r(a.valueType);return u===a.valueType?s:B(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,d=[];for(let f of u){let p=r(f);p!==f&&(l=!0),d.push(p)}return l?B(s,{...a,options:d}):s}case"intersection":{let u=r(a.left),l=r(a.right);return u===a.left&&l===a.right?s:B(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=r(a.innerType);return u===a.innerType?s:B(s,{...a,innerType:u})}case"pipe":{let u=r(a.in),l=r(a.out);return u===a.in&&l===a.out?s:B(s,{...a,in:u,out:l})}case"function":{let u=r(a.input),l=r(a.output);return u===a.input&&l===a.output?s:B(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...d}=a;return B(s,{...d,getter:()=>r(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return r(e)}function O_(e){return Ci(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:dn(n.options)}})}function oP(e,t){if(!t?.length)return e;let n=e._zod.def;return B(e,Ke(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function A_(e){return oP(e.out,e.checks)}function sP(e){return e.in._zod.traits.has("$ZodTransform")?A_(e):e.in}function z_(e){return Ci(e,{pipe:t=>sP(t._zod.def),default:(t,n)=>n?hr(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function P_(e){return Ci(e,{pipe:t=>A_(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var rh={};dt(rh,{bigint:()=>lP,boolean:()=>uP,date:()=>dP,number:()=>cP,string:()=>aP});function aP(e){return Af(sn,e)}function cP(e){return Cf(cn,e)}function uP(e){return Rf(un,e)}function lP(e){return Ff(ln,e)}function dP(e){return Qf(Si,e)}var $S=et(yt(),1);var M1=/^[\w.-]+(?:\/[\w.-]+)*$/;function Sn(e){let t=e.indexOf("/");return t<0?{id:e}:{category:e.slice(0,t),id:e.slice(t+1)}}var R1=L.object({id:L.string().regex(M1,"id\uB294 \uC601\uBB38\xB7\uC22B\uC790\xB7._- \uC640 \uAD6C\uAC04 \uC0AC\uC774\uC758 / \uB9CC \uD5C8\uC6A9"),source:L.string().optional(),tags:L.array(L.string()).optional()}),V1=L.object({id:L.string().regex(/^[\w.@-]+$/,"id\uB294 \uC601\uBB38\xB7\uC22B\uC790\xB7._@- \uB9CC \uD5C8\uC6A9"),source:L.string(),into:L.string().regex(/^[^/\\][^\\]*$/,"into \uB294 \uB8E8\uD2B8 \uAE30\uC900 \uC0C1\uB300 \uACBD\uB85C (POSIX)").optional(),install:L.string().optional()}),ue="packages",F1=L.record(L.string(),L.array(R1)),$t="extends",Z1=L.preprocess(e=>e&&typeof e=="object"&&!Array.isArray(e)&&typeof e[$t]=="string"?{...e,[$t]:[e[$t]]}:e,L.record(L.string(),L.array(L.string()))),q1=L.object({version:L.literal(1),agent:L.string().default("claude-code"),ignore:L.array(L.string()).optional(),exclude:L.array(L.string()).optional(),components:F1.default({}),packages:L.array(V1).default([]),profiles:L.record(L.string(),Z1).default({})}),lo=class extends Error{};function Gc(e,t,n){let i=$S.default.parse(e),r=q1.safeParse(i);if(!r.success){let c=r.error.issues.map(u=>` ${u.path.join(".")||"(root)"}: ${u.message}`);throw new lo(`lshed.yaml \uD615\uC2DD \uC624\uB958:
248
248
  ${c.join(`
249
249
  `)}`)}let o=r.data,s=[];for(let[c,u]of Object.entries(o.components)){t&&!t.includes(c)&&s.push(`\uC54C \uC218 \uC5C6\uB294 \uCE74\uD14C\uACE0\uB9AC "${c}" (\uC5B4\uB311\uD130 ${o.agent}: ${t.join(", ")})`);let l=new Set;for(let d of u){l.has(d.id)&&s.push(`${c}: id "${d.id}" \uC911\uBCF5`),l.add(d.id);try{wv(Oe(fo(c,d)))||s.push(`${c}/${d.id}: \uBD80\uD488 \uCD9C\uCC98\uB294 file:/github:/git: \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`)}catch(f){s.push(`${c}/${d.id}: ${f.message}`)}}}let a=new Set;for(let c of o.packages){a.has(c.id)&&s.push(`packages: id "${c.id}" \uC911\uBCF5`),a.add(c.id);try{let u=Oe(c.source),l=u.scheme==="other"?u.name:u.scheme;l==="file"?s.push(`packages/${c.id}: \uD328\uD0A4\uC9C0 \uCD9C\uCC98\uB294 file: \uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4`):n&&!n.includes(l)&&s.push(`packages/${c.id}: \uC2A4\uD0B4 "${l}" \uC744 \uB2E4\uB8F0 \uC124\uCE58\uAE30\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 (${n.join(", ")})`),(l==="github"||l==="git")&&!c.into&&s.push(`packages/${c.id}: ${l}: \uD328\uD0A4\uC9C0\uB294 into \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4`)}catch(u){s.push(`packages/${c.id}: ${u.message}`)}}for(let[c,u]of Object.entries(o.profiles)){for(let l of u[$t]??[])l in o.profiles||s.push(`profiles.${c}.extends: \uD504\uB85C\uD544 "${l}" \uC774 \uC5C6\uC74C`);if(u[$t]?.length){let l=bS(o,c);l&&s.push(`profiles.${c}.extends: \uC21C\uD658 \uC0C1\uC18D (${l.join(" \u2192 ")})`)}for(let[l,d]of Object.entries(u)){if(l===$t)continue;if(l===ue){for(let p of d)a.has(p)||s.push(`profiles.${c}.packages: "${p}" \uB294 packages \uC5D0 \uC5C6\uC74C`);continue}let f=new Set((o.components[l]??[]).map(p=>p.id));for(let p of d)f.has(p)||s.push(`profiles.${c}.${l}: "${p}" \uB294 components\uC5D0 \uC5C6\uC74C`)}}if(s.length)throw new lo(`lshed.yaml \uCC38\uC870 \uC624\uB958:
250
250
  ${s.map(c=>" "+c).join(`
@@ -259,7 +259,7 @@ ${s.map(c=>" "+c).join(`
259
259
  ${r.content.trimEnd()}
260
260
  `).join(`
261
261
  `)}var Kg=et(yt(),1);import{promises as ES}from"fs";import NS from"path";var H1=L.object({source:L.string(),rev:L.string().optional(),commit:L.string().optional()}).transform(e=>({source:e.source,rev:e.rev??e.commit??""})),Y1=L.object({version:L.literal(1),packages:L.record(L.string(),H1).default({})}),Jg="lshed.lock";async function bt(e){try{return Y1.parse(Kg.default.parse(await ES.readFile(NS.join(e,Jg),"utf8")))}catch(t){if(t.code==="ENOENT")return{version:1,packages:{}};throw new Error(`${Jg} \uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${t.message}`)}}async function _t(e,t){let n={version:1,packages:Object.fromEntries(Object.entries(t.packages).sort())};await ES.writeFile(NS.join(e,Jg),`# generated by lshed \u2014 do not edit; 'lshed update' refreshes it
262
- `+Kg.default.stringify(n))}import S2 from"path";import{promises as Xc}from"fs";import Bg from"path";async function CS(e,t){let n=[];for(let i of Wc(e))n.push(...await i.detect(e,t));return n}async function jS(e,t){let n=new Map,i=t.filter(o=>o.path);if(!i.length)return n;let r=await Promise.all(i.map(async o=>({id:o.id,real:await xu(o.path)})));for(let o of e){if(i.some(a=>a.path===o.path))continue;let s;try{if(!(await Xc.stat(o.path)).isDirectory())continue;s=await Xc.readdir(o.path)}catch{continue}for(let a of s){let c=Bg.join(o.path,a),u;try{if(!(await Xc.lstat(c)).isSymbolicLink())continue;u=await xu(Bg.resolve(o.path,await Xc.readlink(c)))}catch{continue}let l=r.find(d=>jo(d.real,u));if(l){n.set(`${o.category}/${o.id}`,l.id);break}}}return n}async function Qc(e,t,n){let i=await mo(e,t.source).status(e,t);return{pkg:t,...i,locked:n.packages[t.id]?.rev||void 0}}var Sr=e=>e&&/^[0-9a-f]{40}$/.test(e)?e.slice(0,7):e;function TS(e,t){return t.map((n,i)=>({p:n,i,pr:mo(e,n.source).priority})).sort((n,i)=>n.pr-i.pr||n.i-i.i).map(n=>n.p)}async function DS(e,t,n={}){let i=await bt(e.shed),r={installed:[],pendingInstalls:[],lockChanged:!1};for(let o of TS(e,t)){let s=mo(e,o.source),a=await Qc(e,o,i);if(a.present){let u=a.locked&&a.rev!==a.locked?` (${Sr(a.rev)} \u2260 lock ${Sr(a.locked)})`:"";e.log(` = package ${o.id}${u}`);continue}if(e.log(` + package ${o.id} (${s.describe(o,a.locked)})`),n.dryRun)continue;let c=await s.install(e,o,a.locked,n);c!==a.locked&&(a.locked&&e.log(` \uB77D\uC740 ${Sr(a.locked)} \uC774\uC9C0\uB9CC ${Sr(c)} \uC774 \uC124\uCE58\uB428. \uB77D\uC744 \uB530\uB77C\uAC00\uAC8C \uAC31\uC2E0`),i.packages[o.id]={source:o.source,rev:c},r.lockChanged=!0),r.installed.push(o.id),await LS(e,o,s.cwd(e,o),n,r)}return r.lockChanged&&await _t(e.shed,i),r}async function LS(e,t,n,i,r){t.install&&(i.yes?(e.log(` $ (${Bg.relative(e.adapter.root,n)||"."}) ${t.install}`),await Qv(t.install,n)):r.pendingInstalls.push({id:t.id,dir:n,cmd:t.install}))}function yo(e,t){if(t.pendingInstalls.length){e.log(`
262
+ `+Kg.default.stringify(n))}import S2 from"path";import{promises as Xc}from"fs";import Bg from"path";async function CS(e,t){let n=[];for(let r of Wc(e))n.push(...await r.detect(e,t));let i=new Set;for(let r of n){if(i.has(r.id)){let o=r.source.indexOf(":"),s=r.source.slice(0,o),a=r.source.slice(o+1);r.id=s==="claude-plugin"?a:`${r.id}-${s}`}i.add(r.id)}return n}async function jS(e,t){let n=new Map,i=t.filter(o=>o.path);if(!i.length)return n;let r=await Promise.all(i.map(async o=>({id:o.id,real:await xu(o.path)})));for(let o of e){if(i.some(a=>a.path===o.path))continue;let s;try{if(!(await Xc.stat(o.path)).isDirectory())continue;s=await Xc.readdir(o.path)}catch{continue}for(let a of s){let c=Bg.join(o.path,a),u;try{if(!(await Xc.lstat(c)).isSymbolicLink())continue;u=await xu(Bg.resolve(o.path,await Xc.readlink(c)))}catch{continue}let l=r.find(d=>jo(d.real,u));if(l){n.set(`${o.category}/${o.id}`,l.id);break}}}return n}async function Qc(e,t,n){let i=await mo(e,t.source).status(e,t);return{pkg:t,...i,locked:n.packages[t.id]?.rev||void 0}}var Sr=e=>e&&/^[0-9a-f]{40}$/.test(e)?e.slice(0,7):e;function TS(e,t){return t.map((n,i)=>({p:n,i,pr:mo(e,n.source).priority})).sort((n,i)=>n.pr-i.pr||n.i-i.i).map(n=>n.p)}async function DS(e,t,n={}){let i=await bt(e.shed),r={installed:[],pendingInstalls:[],lockChanged:!1};for(let o of TS(e,t)){let s=mo(e,o.source),a=await Qc(e,o,i);if(a.present){let u=a.locked&&a.rev!==a.locked?` (${Sr(a.rev)} \u2260 lock ${Sr(a.locked)})`:"";e.log(` = package ${o.id}${u}`);continue}if(e.log(` + package ${o.id} (${s.describe(o,a.locked)})`),n.dryRun)continue;let c=await s.install(e,o,a.locked,n);c!==a.locked&&(a.locked&&e.log(` \uB77D\uC740 ${Sr(a.locked)} \uC774\uC9C0\uB9CC ${Sr(c)} \uC774 \uC124\uCE58\uB428. \uB77D\uC744 \uB530\uB77C\uAC00\uAC8C \uAC31\uC2E0`),i.packages[o.id]={source:o.source,rev:c},r.lockChanged=!0),r.installed.push(o.id),await LS(e,o,s.cwd(e,o),n,r)}return r.lockChanged&&await _t(e.shed,i),r}async function LS(e,t,n,i,r){t.install&&(i.yes?(e.log(` $ (${Bg.relative(e.adapter.root,n)||"."}) ${t.install}`),await Qv(t.install,n)):r.pendingInstalls.push({id:t.id,dir:n,cmd:t.install}))}function yo(e,t){if(t.pendingInstalls.length){e.log(`
263
263
  \uC124\uCE58 \uBA85\uB839 ${t.pendingInstalls.length}\uAC1C\uB97C \uC2E4\uD589\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uD655\uC778 \uD6C4 '--yes' \uB85C \uB2E4\uC2DC \uC2E4\uD589\uD558\uAC70\uB098 \uC9C1\uC811 \uB3CC\uB9AC\uC138\uC694:`);for(let n of t.pendingInstalls)e.log(` cd ${n.dir} && ${n.cmd}`)}}async function US(e,t,n={}){let i=await bt(e.shed),r={installed:[],pendingInstalls:[],lockChanged:!1};for(let o of TS(e,t)){let s=mo(e,o.source);if(!(await Qc(e,o,i)).present){e.log(` ! package ${o.id}: \uC124\uCE58\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC74C. \uBA3C\uC800 restore \uD558\uC138\uC694`);continue}if(n.dryRun){e.log(` ~ package ${o.id} (${s.name} update)`);continue}let c=await s.update(e,o,n),u=i.packages[o.id]?.rev;c!==u?(i.packages[o.id]={source:o.source,rev:c},r.lockChanged=!0,e.log(` \u2191 package ${o.id} ${u?Sr(u):"(\uC5C6\uC74C)"} \u2192 ${Sr(c)}`),await LS(e,o,s.cwd(e,o),n,r)):e.log(` = package ${o.id} ${Sr(c)} (\uCD5C\uC2E0)`)}return r.lockChanged&&await _t(e.shed,i),r}var wt=e=>`${e.category}/${e.id}`;function Gg(e,t=[]){if(typeof e=="string")t.push(e);else if(Array.isArray(e))for(let n of e)Gg(n,t);else if(e&&typeof e=="object")for(let n of Object.values(e))Gg(n,t);return t}async function eu(e,t=[]){let n=(u,l)=>t.some(d=>d===l||d===`${u}/${l}`),i=[],r=[],o=await e.adapter.scan(),s=await CS(e,o),a=s.filter(u=>n("packages",u.id)?(i.push(`packages/${u.id}`),!1):!0),c=await jS(o,a);for(let u of a)r.push({kind:"package",category:"packages",id:u.id,pkg:u});for(let u of e.adapter.categories())for(let l of o.filter(d=>d.category===u.name))if(!(s.some(d=>d.path===l.path)||c.has(wt(l)))){if(n(l.category,l.id)){i.push(wt(l));continue}r.push({kind:"component",category:u.name,id:l.id,path:l.path,cat:u})}for(let u of e.adapter.entries()){let l=await u.read();for(let d of Object.keys(l).sort()){if(n(u.name,d)){i.push(`${u.name}/${d}`);continue}if(!/^[\w.-]+$/.test(d)){e.log(` ! ${u.name}/${d}: \uC774\uB984\uC5D0 \uC4F8 \uC218 \uC5C6\uB294 \uBB38\uC790\uAC00 \uC788\uC5B4 \uAC74\uB108\uB700`);continue}let f=a.find(m=>m.path&&Gg(l[d]).some(h=>jo(m.path,h))),p=f?`\uD328\uD0A4\uC9C0 ${f.id} \uC548\uC744 \uAC00\uB9AC\uD0B5\uB2C8\uB2E4. \uADF8 \uC124\uCE58\uAC00 \uB9CC\uB4E0 \uAC83\uC774\uBA74 exclude \uD558\uC138\uC694: ${u.name}/${d}`:void 0;r.push({kind:"entry",category:u.name,id:d,value:l[d],cat:u,warn:p})}}return{items:r,generated:c,excluded:i}}function Wg(e,t){return t.items.filter(n=>n.kind==="package"?!e.packages.some(i=>i.id===n.id):!(e.components[n.category]??[]).some(i=>i.id===n.id))}function MS(e,t,n){let i=t in e.profiles?Ye(e,t):{};return n.items.filter(r=>!Wg(e,n).includes(r)).filter(r=>!(i[r.category]??[]).includes(r.id)).map(wt)}function RS(e){return/^[0-9a-f]{40}$/.test(e)?e.slice(0,7):e}var xr=et(yt(),1);import BS from"path";import{promises as Hg}from"fs";import tu from"os";import X1 from"path";var Q1=new Set(["key","apikey","token","secret","password","passwd","auth","authorization","credential","credentials","cookie","session"]);function ej(e){return e.split(/[^A-Za-z0-9]+|(?<=[a-z0-9])(?=[A-Z])/).some(t=>Q1.has(t.toLowerCase()))}var Ht=/\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g;function ru(e){let t=new Set;return An(e,n=>{for(let i of n.matchAll(Ht))t.add(i[1]);return n}),[...t]}function An(e,t,n=[]){return typeof e=="string"?t(e,n):Array.isArray(e)?e.map((i,r)=>An(i,t,[...n,String(r)])):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([i,r])=>[i,An(r,t,[...n,i])])):e}var VS=(...e)=>e.join("_").replace(/[^A-Za-z0-9]+/g,"_").replace(/^_+|_+$/g,"").toUpperCase();function Yg(e,t,n,i=tu.homedir()){if(t=FS(t,i),!t||typeof t!="object"||Array.isArray(t))return t;let r=(s,a)=>{let c={};for(let[u,l]of Object.entries(s)){if(typeof l!="string"||!ej(u)||Ht.test(l)){c[u]=l,Ht.lastIndex=0;continue}let d=a?VS(u):VS(e,u),f=/^(\w+) \S+$/.exec(l);c[u]=f?`${f[1]} \${${d}}`:`\${${d}}`}return c};if(n.secretRootIds?.includes(e))return r(t,!0);let o={...t};for(let s of n.secretKeys){let a=o[s];!a||typeof a!="object"||Array.isArray(a)||(o[s]=r(a,s==="env"))}return o}function FS(e,t=tu.homedir()){return!t||t==="/"?e:An(e,n=>n===t||n.startsWith(t+"/")||n.startsWith(t+"\\")?"${HOME}"+n.slice(t.length):n)}function nu(e=process.env){return{HOME:tu.homedir(),...e}}function ZS(e){let t=[];return An(e,(n,i)=>(/^(sk-|ghp_|github_pat_|xox[abp]-|AKIA|glpat-|ntn_|secret_)[A-Za-z0-9_-]{8,}/.test(n)&&t.push(i.join(".")),n)),t}function iu(e,t=process.env){let n=new Set;return{value:An(e,r=>r.replace(Ht,(o,s,a)=>t[s]!==void 0?t[s]:a!==void 0?a:(n.add(s),o))),missing:[...n]}}function qS(e,t){if(e===t)return!0;if(!Ht.test(e))return Ht.lastIndex=0,!1;Ht.lastIndex=0;let n="^"+e.split(Ht).map((i,r)=>r%3===0?i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):r%3===1?".+":"").join("")+"$";return new RegExp(n).test(t)}function Ir(e,t){if(typeof e=="string"&&typeof t=="string")return qS(e,t);if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((n,i)=>Ir(n,t[i]));if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let n=Object.keys(e).sort(),i=Object.keys(t).sort();return n.length===i.length&&n.every((r,o)=>r===i[o]&&Ir(e[r],t[r]))}return e===t}function JS(e,t,n,i,r=tu.homedir()){let o=(s,a)=>typeof s=="string"&&typeof a=="string"&&qS(a,s)?a:Array.isArray(s)&&Array.isArray(a)?s.map((c,u)=>o(c,a[u])):s&&a&&typeof s=="object"&&typeof a=="object"&&!Array.isArray(s)&&!Array.isArray(a)?Object.fromEntries(Object.entries(s).map(([c,u])=>[c,o(u,a[c])])):s;return Yg(e,n===null?t:o(t,FS(n,r)),i,r)}function KS(e,t){let n=[],i=(r,o,s)=>{if(r===void 0){n.push({status:"A",file:s||"(entry)"});return}if(o===void 0){n.push({status:"D",file:s||"(entry)"});return}if(r&&o&&typeof r=="object"&&typeof o=="object"&&!Array.isArray(r)&&!Array.isArray(o)){for(let c of new Set([...Object.keys(r),...Object.keys(o)]).values())i(r[c],o[c],s?`${s}.${c}`:c);return}Ir(r,o)||n.push({status:"M",file:s||"(entry)"})};return i(e,t,""),n.sort((r,o)=>r.file.localeCompare(o.file))}async function Yt(e){try{return JSON.parse(await Hg.readFile(e,"utf8"))}catch(t){if(t.code==="ENOENT")return null;throw new Error(`${e}: JSON \uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${t.message}`)}}async function zn(e,t){await Hg.mkdir(X1.dirname(e),{recursive:!0}),await Hg.writeFile(e,JSON.stringify(t,null,2)+`
264
264
  `)}function ou(e,t){let n=e.getIn(t);return(0,xr.isSeq)(n)||(n=e.createNode([]),e.setIn(t,n)),n}function GS(e,t){e.items.some(n=>((0,xr.isMap)(n)?n.get("id"):String(n))===t)||e.add(t)}async function su(e,t,n,i,r){let o={managed:[],copied:0,packages:[]};for(let s of i){if(s.kind==="package"){let c=s.pkg,u=t.createNode(c.into?{id:c.id,source:c.source,into:c.into}:{id:c.id,source:c.source});c.into&&(u.comment=" install: ./setup # \u2190 \uBCF5\uC6D0 \uD6C4 \uC2E4\uD589\uD560 \uBA85\uB839\uC774 \uC788\uC73C\uBA74 \uCC44\uC6B0\uC138\uC694 (--yes \uB85C \uC2E4\uD589)");let l=ou(t,[ue]);l.items.some(d=>(0,xr.isMap)(d)&&d.get("id")===c.id)||l.add(u),GS(ou(t,["profiles",n,ue]),c.id),r.packages[c.id]={source:c.source,rev:c.rev},o.packages.push(c.id),e.log(` \u2261 package ${c.id} ${c.source} @${RS(c.rev)} (\uCC38\uC870\uB9CC \uAE30\uB85D)`);continue}if(s.kind==="component"){let c=BS.join(e.shed,s.cat.name,s.cat.kind==="dir"?s.id:`${s.id}.md`);await tt(s.path,c,_e(e)),e.log(` + ${s.category}/${s.id}`)}else{let c=Yg(s.id,s.value,s.cat);await zn(BS.join(e.shed,s.category,`${s.id}.json`),c);let u=ru(c).filter(l=>l!=="HOME");e.log(` + ${s.category}/${s.id}${u.length?` (\uC2DC\uD06C\uB9BF \u2192 ${u.map(l=>"${"+l+"}").join(", ")})`:""}`);for(let l of ZS(c))e.log(` ! ${l} \uAC00 \uC2DC\uD06C\uB9BF\uCC98\uB7FC \uBCF4\uC785\uB2C8\uB2E4. \uCC3D\uACE0\uC758 ${s.category}/${s.id}.json \uC5D0\uC11C \${VAR} \uB85C \uBC14\uAFB8\uC138\uC694`);s.warn&&e.log(` ! ${s.warn}`)}let a=ou(t,["components",s.category]);a.items.some(c=>(0,xr.isMap)(c)&&c.get("id")===s.id)||a.add(t.createNode({id:s.id})),GS(ou(t,["profiles",n,s.category]),s.id),o.managed.push(vo(s.cat,s.id)),o.copied++}return o}function au(e){let t=e.get(ue);(0,xr.isSeq)(t)&&!t.items.length&&e.delete(ue)}var tj=`# lshed manifest \u2014 edit freely. Reference: https://github.com/LeeSongHeon-LSH/lshed
265
265
  `;async function HS(e,t={}){let n=t.profile??"default";if(await se(Ie(e)))throw new Error(`\uC774\uBBF8 \uCD08\uAE30\uD654\uB41C \uCC3D\uACE0\uC785\uB2C8\uB2E4: ${Ie(e)}
@@ -335,7 +335,7 @@ ${r.length}\uAC1C \uC81C\uAC70. \uCC3D\uACE0\uB97C \uCEE4\uBC0B\uD558\uC138\uC69
335
335
  \uCC3D\uACE0\uAC00 \uBC14\uB00C\uC5C8\uC2B5\uB2C8\uB2E4. \uC774 \uAE30\uAE30\uC5D0 \uC801\uC6A9\uD558\uB824\uBA74: lshed restore`),r}function Mj(e,t){let n=[...new Set(e.map(r=>r.split("/").slice(0,2).join("/")))];return`lshed sync: ${n.slice(0,3).join(", ")+(n.length>3?` +${n.length-3}`:"")}
336
336
 
337
337
  ${Uj.hostname()}${t?` \xB7 profile ${t}`:""}`}var Rj=e=>e.split(`
338
- `).find(t=>t.trim()&&!t.startsWith("Command failed"))??e;var Zj="0.14.0";for(let e of[process.stdout,process.stderr])e.on("error",t=>{t.code==="EPIPE"&&process.exit(0)});var xe=new Ar().name("lshed").description("Keep your coding-agent harness (skills, agents, commands, instructions) in a shed and restore it anywhere by profile.").version(Zj).option("--shed <dir>","shed directory (default: $LSHED_HOME, then the shed recorded by the last restore)").option("--agent <name>",`which agent to place into: ${Pr().join(", ")} (default: $LSHED_AGENT, then the shed's agent, then ${Fn})`).option("--root <dir>","agent config root (default: the agent's own, e.g. ~/.claude or ~/.codex)");async function hv(){let{root:e,agent:t,shed:n}=xe.opts(),i=t??process.env.LSHED_AGENT,r=n??process.env.LSHED_HOME;if(!i&&r)try{i=Rg(await Fj.readFile(ko.join(ko.resolve(r),xn),"utf8"))}catch{}return Ko(i??Fn,e?ko.resolve(e):void 0)}async function Qe(e){let t=await hv(),{shed:n}=xe.opts(),i=n??process.env.LSHED_HOME;if(!i&&e==="other"&&(i=(await le(t))?.shed),!i&&e==="init"&&(i=ko.join(Vj.homedir(),"lshed")),!i)throw new Error("\uCC3D\uACE0 \uC704\uCE58\uB97C \uBAA8\uB985\uB2C8\uB2E4. --shed <dir> \uB610\uB294 LSHED_HOME \uC744 \uC9C0\uC815\uD558\uC138\uC694.");return{adapter:t,shed:ko.resolve(i),log:r=>console.log(r),exec:OS}}async function Je(e){try{await e()}catch(t){console.error(`\uC624\uB958: ${t.message}`),process.exitCode=1}}xe.command("init").description("scan the current environment into a shed and write lshed.yaml").option("--profile <name>","name of the initial profile","default").option("--exclude <id...>","components to leave out (id or category/id)").action(e=>Je(async()=>{let t=await Qe("init");console.log(`\uC2A4\uCE94: ${t.adapter.root} \u2192 \uCC3D\uACE0: ${t.shed}`),await HS(t,{profile:e.profile,exclude:e.exclude}),console.log(`
338
+ `).find(t=>t.trim()&&!t.startsWith("Command failed"))??e;var Zj="0.14.1";for(let e of[process.stdout,process.stderr])e.on("error",t=>{t.code==="EPIPE"&&process.exit(0)});var xe=new Ar().name("lshed").description("Keep your coding-agent harness (skills, agents, commands, instructions) in a shed and restore it anywhere by profile.").version(Zj).option("--shed <dir>","shed directory (default: $LSHED_HOME, then the shed recorded by the last restore)").option("--agent <name>",`which agent to place into: ${Pr().join(", ")} (default: $LSHED_AGENT, then the shed's agent, then ${Fn})`).option("--root <dir>","agent config root (default: the agent's own, e.g. ~/.claude or ~/.codex)");async function hv(){let{root:e,agent:t,shed:n}=xe.opts(),i=t??process.env.LSHED_AGENT,r=n??process.env.LSHED_HOME;if(!i&&r)try{i=Rg(await Fj.readFile(ko.join(ko.resolve(r),xn),"utf8"))}catch{}return Ko(i??Fn,e?ko.resolve(e):void 0)}async function Qe(e){let t=await hv(),{shed:n}=xe.opts(),i=n??process.env.LSHED_HOME;if(!i&&e==="other"&&(i=(await le(t))?.shed),!i&&e==="init"&&(i=ko.join(Vj.homedir(),"lshed")),!i)throw new Error("\uCC3D\uACE0 \uC704\uCE58\uB97C \uBAA8\uB985\uB2C8\uB2E4. --shed <dir> \uB610\uB294 LSHED_HOME \uC744 \uC9C0\uC815\uD558\uC138\uC694.");return{adapter:t,shed:ko.resolve(i),log:r=>console.log(r),exec:OS}}async function Je(e){try{await e()}catch(t){console.error(`\uC624\uB958: ${t.message}`),process.exitCode=1}}xe.command("init").description("scan the current environment into a shed and write lshed.yaml").option("--profile <name>","name of the initial profile","default").option("--exclude <id...>","components to leave out (id or category/id)").action(e=>Je(async()=>{let t=await Qe("init");console.log(`\uC2A4\uCE94: ${t.adapter.root} \u2192 \uCC3D\uACE0: ${t.shed}`),await HS(t,{profile:e.profile,exclude:e.exclude}),console.log(`
339
339
  \uB2E4\uC74C: \uCC3D\uACE0\uB97C git \uC73C\uB85C \uAD00\uB9AC\uD558\uC138\uC694. cd ${t.shed} && git init`)}));function qj(){let e=t=>gu(t)?void 0:t;return{async multiselect(t){return e(await PI({message:`${t.title} \u2014 \uC774 \uAE30\uAE30\uC5D0 \uB458 \uAC83\uC744 \uACE0\uB974\uC138\uC694 (space \uC120\uD0DD, a \uC804\uCCB4, enter \uB2E4\uC74C)`,options:t.options.map(n=>({value:n.id,label:n.id,hint:n.hint})),initialValues:t.options.filter(n=>n.checked).map(n=>n.id),required:!1}))},async text(t,n,i){return e(await EI({message:t,placeholder:n,defaultValue:n,validate:r=>i(r??"")}))},async confirm(t){return e(await zI({message:t}))}}}xe.command("restore [profile]").description("apply a profile (defaults to the last applied one; with no profile at all, opens the picker)").option("--pick","choose parts category by category and save the choice as a profile ([profile] pre-checks that profile)").option("--link","place file parts as links into the shed instead of copies (edits land in the shed; remembered for later restores)").option("--no-link","go back to copies on a machine that used --link").option("--dry-run","print what would change without touching anything").option("--no-backup","skip backing up files that get replaced or removed").option("--yes","run package install commands (they are shown, not run, without this)").action((e,t)=>Je(async()=>{let n=await Qe("other"),i=!!(process.stdin.isTTY&&process.stdout.isTTY),r=!e&&!await le(n.adapter);if(t.pick||r&&i){if(!i)throw new Error("--pick \uC740 \uB300\uD654\uD615 \uD130\uBBF8\uB110\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uD504\uB85C\uD544 \uC774\uB984\uC744 \uC9C1\uC811 \uC9C0\uC815\uD558\uC138\uC694: lshed restore <profile>");r&&!t.pick&&console.log(`\uC801\uC6A9\uD55C \uD504\uB85C\uD544\uC774 \uC5C6\uC5B4 \uACE0\uB974\uB294 \uD654\uBA74\uC744 \uC5FD\uB2C8\uB2E4. \uD504\uB85C\uD544\uC744 \uBC14\uB85C \uC801\uC6A9\uD558\uB824\uBA74: lshed restore <profile>
340
340
  `),await nI(n,qj(),{base:e,dryRun:t.dryRun,backup:t.backup,yes:t.yes,link:t.link});return}await cu(n,e,{dryRun:t.dryRun,backup:t.backup,yes:t.yes,link:t.link})}));xe.command("update [ids...]").description("pull packages to their latest upstream and refresh lshed.lock").option("--dry-run","show what would be updated").option("--yes","run package install commands after updating").action((e,t)=>Je(async()=>{let n=await Qe("other"),i=await le(n.adapter);if(!i)throw new Error("\uC801\uC6A9\uB41C \uD504\uB85C\uD544\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. \uBA3C\uC800 'lshed restore <profile>' \uC744 \uC2E4\uD589\uD558\uC138\uC694.");let r=await ge(n),o=On(n,r,i.profile);for(let c of o.skipped)console.log(` \xB7 package ${c.id} (${go(c.source)}: \uB294 ${n.adapter.name} \uB85C \uB2E4\uB8F0 \uC218 \uC5C6\uC5B4 \uAC74\uB108\uB700)`);let s=o.packages;if(e.length&&(s=e.map(c=>{let u=r.packages.find(l=>l.id===c);if(!u)throw new Error(`\uD328\uD0A4\uC9C0 "${c}" \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4`);return u})),!s.length){console.log("\uAC31\uC2E0\uD560 \uD328\uD0A4\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");return}let a=await US(n,s,{dryRun:t.dryRun,yes:t.yes});yo(n,a)}));xe.command("status").description("show the applied profile, managed paths and drift").action(()=>Je(async()=>{let e=await hv();if(!await le(e)){console.log(pv({state:null,drifted:[],packages:[],missingEnv:[],fresh:[]},e.root,e.name));return}let n=await Qe("other");console.log(pv(await DI(n),e.root,e.name))}));xe.command("diff").description("list files that differ between the local harness and the shed").action(()=>Je(async()=>{let e=await Qe("other");console.log(NI(await Nn(e)))}));xe.command("save [ids...]").description("copy local edits back into the shed (file: sources only)").action(e=>Je(async()=>{let t=await Qe("other");await LI(t,e)}));xe.command("add [keys...]").description("put things that appeared locally since init into the shed and the current profile (lists candidates without keys)").option("--all","add every candidate").action((e,t)=>Je(async()=>{let n=await Qe("other");await TI(n,e,{all:t.all})}));xe.command("sync").description("commit the shed, pull --rebase and push (the shed must be a git repo with origin)").option("-m, --message <msg>","commit message (default: names the changed parts)").option("--no-push","commit and pull only").option("--dry-run","show what would be committed and pushed").action(e=>Je(async()=>{let t=await Qe("other");await VI(t,{message:e.message,push:e.push,dryRun:e.dryRun})}));xe.command("list").description("everything in the shed and which profiles use it").option("--unused","only things no profile uses").action(e=>Je(async()=>{let t=await Qe("other"),n=await ge(t),i=Cn(n).filter(r=>!e.unused||!r.usedBy.length);console.log(e.unused&&!i.length?"\uBBF8\uC0AC\uC6A9 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.":UI(i,n))}));xe.command("remove <key>").description("delete a component or package from the shed (refused while a profile uses it)").action(e=>Je(async()=>{let t=await Qe("other");await mv(t,e)}));xe.command("prune").description("remove everything no profile uses").option("--yes","actually delete; without it, just list").action(e=>Je(async()=>{let t=await Qe("other");await RI(t,{yes:e.yes})}));xe.command("scan").description("(debug) list components found in the agent config root").action(()=>Je(async()=>{let e=await hv(),t=await e.scan();for(let i of t)console.log(`${i.category}/${i.id} ${i.path}`);let n=t.length;for(let i of e.entries())for(let r of Object.keys(await i.read()))console.log(`${i.name}/${r} (entry)`),n++;console.error(`${n}\uAC1C \uBC1C\uACAC (root: ${e.root})`)}));xe.parseAsync();
341
341
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lshed",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Portable harness environment manager for coding agents",
5
5
  "license": "MIT",
6
6
  "author": "leesongheon <leesongheon1209@gmail.com>",