@jayyuen66/dsh-scrapling 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import{accessSync as e,constants as t,existsSync as n,readFileSync as r,statSync as i}from"node:fs";import{access as a,chmod as o,cp as s,mkdir as c,open as l,readFile as u,readdir as d,rename as f,rm as p,rmdir as m,stat as h,writeFile as ee}from"node:fs/promises";import te from"node:os";import g from"node:path";import{AsyncLocalStorage as ne}from"node:async_hooks";import{createHash as re,randomUUID as _}from"node:crypto";import{createRequire as ie}from"node:module";import{spawn as ae}from"node:child_process";var oe=Object.create,se=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,le=Object.getOwnPropertyNames,ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,fe=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),pe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=le(t),a=0,o=i.length,s;a<o;a++)s=i[a],!de.call(e,s)&&s!==n&&se(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ce(t,s))||r.enumerable});return e},me=(e,t,n)=>(n=e==null?{}:oe(ue(e)),pe(t||!e||!e.__esModule||!de.call(e,`default`)?se(n,`default`,{value:e,enumerable:!0}):n,e));const he=`scrapling`,ge=`streamable-http`,_e=`stdio`,ve=`DSH_SCRAPLING_MCP_TOKEN`,v=`@deepseek-ai/dsh-mcp-client`,ye=`0.2.2-rc.5`,be=Object.freeze([ye,`0.2.2-rc.1`,`next`]),xe=[`native`,`mcp`,`official-mcp`],Se=new Set(xe);function Ce(e){return Se.has(e)}function we(e,t){if(!Number.isInteger(e)||e<1||e>65535)throw Error(`MCP port must be an integer in 1..65535, got ${String(e)}`);if(t.trim().length===0)throw Error(`MCP host must not be blank`);if(t.includes(`://`))throw Error(`MCP host must be a bare host, got ${JSON.stringify(t)}`);if(t.startsWith(`[`)&&!t.endsWith(`]`))throw Error(`MCP host has an unterminated bracket, got ${JSON.stringify(t)}`);if(t.includes(`%`))throw Error(`MCP host must percent-encode its zone id as %25 (RFC 6874), got ${JSON.stringify(t)}`);return`http://${t.includes(`:`)&&!t.startsWith(`[`)?`[${t}]`:t}:${String(e)}/mcp`}function Te(e=ye){if(!be.includes(e))throw Error(`unsupported MCP client pin: ${JSON.stringify(e)}`);return`dsh plugin --profile <profile> add ${v}@${e}`}var Ee=class extends Error{code;constructor(e,t){super(t),this.name=`OfficialMcpError`,this.code=e}};function De(e){if(!g.isAbsolute(e))throw new Ee(`OFFICIAL_MCP_DATA_DIR`,`官方 server 的入口要绝对 dataDir 才能拼:现在给的是 ${JSON.stringify(e)}。相对路径会被宿主按它自己的 cwd 解析,写进 patch 的 command 就不是这个文件了。`);let t=g.join(e,`runtime`,`venv`);return process.platform===`win32`?g.join(t,`Scripts`,`scrapling-mcp.exe`):g.join(t,`bin`,`scrapling-mcp`)}function Oe(e){switch(e){case`"`:return String.raw`\"`;case`\\`:return String.raw`\\`;case`
3
- `:return String.raw`\n`;case`\r`:return String.raw`\r`;case` `:return String.raw`\t`;default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`}}const ke=/[\u0000-\u001F\u007F-\u009F\u2028\u2029"\\]/gu;function Ae(e){return`"${e.replaceAll(ke,e=>Oe(e))}"`}const je="official-mcp 直连官方 scrapling-mcp:它的全部工具不经本插件的 URL 守卫与会话闸门(钉住的 scrapling 版本里有 `browser_evaluate` 这类任意 JS 执行),用的是它自己的会话与状态,本插件既不复用也不拦截。";function Me(e){if(!e.enabled)throw new Ee(`OFFICIAL_MCP_DISABLED`,`official-mcp 未启用:部署配置里把 officialMcpEnabled 设为 true 才会生成接入配置`);if(!e.acceptedRisk)throw new Ee(`RISK_NOT_ACCEPTED`,`${je} 确认接受请再跑一次 setup 并带 --accept-risk。`);let t=De(e.dataDir),n=[],r=he;return{command:t,args:n,serverName:r,risk:je,installCommand:Te(`0.2.2-rc.5`),patch:[`- insert:`,` - id: scrapling-official-mcp`,` name: '${v}'`,` config:`,` serverName: ${r}`,` transport: ${_e}`,` command: ${Ae(t)}`,` args: ${JSON.stringify(n)}`,` failOnStartupError: true`,``].join(`
4
- `)}}function Ne(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Pe=/\r\n|\n|\r/u,Fe=/:(?<port>\d+)/u,Ie=/[\t ]#.*$/u,Le=/^(?:"(?<double>[^"]*)"|'(?<single>[^']*)')$/u,Re=/^(?:-[\t ]*)?name:(?<value>.*)$/u,ze=/^(?<key>[\w-]+):[\t ]+(?<value>\S.*)$/u;function Be(e,t,n){return e||t===void 0||n<=t}function Ve(e){let t=e.trim(),n=Le.exec(t)?.groups;if(n!==void 0)return n.double??n.single;let r=t.replace(Ie,``).trim(),i=Le.exec(r)?.groups,a=i?.double??i?.single;return a===void 0?r.length===0?void 0:r:a}function He(e){return e.split(Pe)}function Ue(e){let t=[],n;for(let r of He(e)){let e=r.length-r.trimStart().length,i=r.slice(e),a=i.startsWith(`-`),o=Ve(Re.exec(i)?.groups?.value??``),s=ze.exec(i)?.groups;o!==void 0&&Be(a,n?.indent,e)?(n={entry:{name:o,config:{}},indent:e},t.push(n.entry)):s?.key!==void 0&&s.value!==void 0&&n!==void 0&&e>n.indent&&(n.entry.config[s.key]=Ve(s.value))}return t}function We(e){let{url:t}=e.config,n;if(t!==void 0)try{let{port:e,protocol:r}=new URL(t);e===``?r===`http:`?n=`80`:r===`https:`&&(n=`443`):n=e}catch{n=Fe.exec(t)?.groups?.port}return n}function Ge(e){return e.config.transport===_e}function Ke(e){let t=[];if(e.clientVersionBroken===!0)return t.push({code:`MCP_CLIENT_MANIFEST_BROKEN`,detail:`profile 的 package.json 读不懂(JSON 语法错误或顶层不是对象)——这不是「没装客户端」,先把这份文件修好`}),t;e.mode!==`native`&&e.clientVersion===void 0&&t.push({code:`MCP_CLIENT_MISSING`,detail:`profile 没有 ${v}:跑 ${Te()} 装上它`});let n=e.clientVersion;return n!==void 0&&!be.includes(n)&&t.push({code:`MCP_CLIENT_UNPINNED`,detail:`客户端钉的是 ${e.clientVersion},只接受 ${be.join(` 或 `)} —— 宿主对不匹配的对端拒绝装载`}),t}function qe(e,t){let n=[];t.length>1&&n.push({code:`DUPLICATE_SCRAPLING_ENTRY`,detail:`serverName 为 scrapling 的条目有 ${String(t.length)} 条,一个名字只能有一个 server`}),t.some(e=>Ge(e))&&t.some(e=>!Ge(e))&&n.push({code:`MCP_MODE_CONFLICT`,detail:`本插件的 ${ge} 条目与官方 ${_e} 条目并存;同一时刻只能一种`});let r=e.mode===`official-mcp`,i=t.some(e=>r===Ge(e));return e.mode===`native`&&t.length>0?n.push({code:`MCP_MODE_ENTRY_MISMATCH`,detail:`integrationMode=native 却留着 scrapling 的 MCP 条目:模型会同时看到两套工具`}):e.mode!==`native`&&!i&&n.push({code:`MCP_MODE_ENTRY_MISMATCH`,detail:`integrationMode=${e.mode} 需要 ${r?_e:ge} 条目,profile 里没有`}),r&&!e.officialMcpEnabled&&t.some(e=>Ge(e))&&n.push({code:`MCP_OFFICIAL_SWITCH_OFF`,detail:`留着官方 stdio 条目但 officialMcpEnabled=false:官方 server 的工具不经本插件守卫,开关要明说`}),n}function Je(e,t){let n=[...new Set(e.map(e=>We(e)).filter(e=>e!==void 0))];if(n.length===0){let n=e.filter(e=>!Ge(e));return t!==void 0&&n.length>0?[{code:`MCP_PORT_UNREADABLE`,detail:`给了 --port ${String(t)},但 profile 里 ${String(n.length)} 条 ${ge} 条目都读不出端口(url 为空、写成占位符或被引号/注释截断):端口一致性没法比对,客户端连哪个端口取决于 patch 里那条 url`}]:[]}let r=t===void 0?void 0:String(t);return n.length<2&&(r===void 0||n.includes(r))?[]:[{code:`MCP_PORT_MISMATCH`,detail:`条目里的端口是 ${n.join(`, `)}${r===void 0?``:`,--port 说的是 ${r}`};改过 mcpPort 就要重新应用 patch`}]}function Ye(e){let t=Ue(e.patchText).filter(e=>e.name===`@deepseek-ai/dsh-mcp-client`&&e.config.serverName===`scrapling`);return[...Ke(e),...qe(e,t),...Je(t,e.expectedPort)]}const Xe=/^(?<indent>[\t ]*)officialMcpEnabled:(?<value>[^\r\n]*)$/gmu;function Ze(e){let t,n;for(let r of e.matchAll(Xe)){
2
+ import{accessSync as e,constants as t,existsSync as n,readFileSync as r,statSync as i}from"node:fs";import{access as a,chmod as o,cp as s,mkdir as c,open as l,readFile as u,readdir as d,rename as f,rm as p,rmdir as m,stat as h,writeFile as ee}from"node:fs/promises";import te from"node:os";import g from"node:path";import{AsyncLocalStorage as ne}from"node:async_hooks";import{createHash as re,randomUUID as ie}from"node:crypto";import{createRequire as ae}from"node:module";import{spawn as oe}from"node:child_process";var se=Object.create,ce=Object.defineProperty,le=Object.getOwnPropertyDescriptor,ue=Object.getOwnPropertyNames,de=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,pe=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),me=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ue(t),a=0,o=i.length,s;a<o;a++)s=i[a],!fe.call(e,s)&&s!==n&&ce(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=le(t,s))||r.enumerable});return e},he=(e,t,n)=>(n=e==null?{}:se(de(e)),me(t||!e||!e.__esModule||!fe.call(e,`default`)?ce(n,`default`,{value:e,enumerable:!0}):n,e));const ge=`scrapling`,_e=[`eager`,`on-demand`],ve=`streamable-http`,ye=`stdio`,be=`DSH_SCRAPLING_MCP_TOKEN`,_=`@deepseek-ai/dsh-mcp-client`,xe=`0.2.3-alpha.2`,Se=Object.freeze([xe,`0.2.2-rc.5`,`0.2.2-rc.1`,`next`]),Ce=[`native`,`mcp`,`official-mcp`],we=new Set(Ce);function Te(e){return we.has(e)}function Ee(e,t){if(!Number.isInteger(e)||e<1||e>65535)throw Error(`MCP port must be an integer in 1..65535, got ${String(e)}`);if(t.trim().length===0)throw Error(`MCP host must not be blank`);if(t.includes(`://`))throw Error(`MCP host must be a bare host, got ${JSON.stringify(t)}`);if(t.startsWith(`[`)&&!t.endsWith(`]`))throw Error(`MCP host has an unterminated bracket, got ${JSON.stringify(t)}`);if(t.includes(`%`))throw Error(`MCP host must percent-encode its zone id as %25 (RFC 6874), got ${JSON.stringify(t)}`);return`http://${t.includes(`:`)&&!t.startsWith(`[`)?`[${t}]`:t}:${String(e)}/mcp`}function De(e=xe){if(!Se.includes(e))throw Error(`unsupported MCP client pin: ${JSON.stringify(e)}`);return`dsh plugin --profile <profile> add ${_}@${e}`}var Oe=class extends Error{code;constructor(e,t){super(t),this.name=`OfficialMcpError`,this.code=e}};function ke(e){if(!g.isAbsolute(e))throw new Oe(`OFFICIAL_MCP_DATA_DIR`,`官方 server 的入口要绝对 dataDir 才能拼:现在给的是 ${JSON.stringify(e)}。相对路径会被宿主按它自己的 cwd 解析,写进 patch 的 command 就不是这个文件了。`);let t=g.join(e,`runtime`,`venv`);return process.platform===`win32`?g.join(t,`Scripts`,`scrapling-mcp.exe`):g.join(t,`bin`,`scrapling-mcp`)}function Ae(e){switch(e){case`"`:return String.raw`\"`;case`\\`:return String.raw`\\`;case`
3
+ `:return String.raw`\n`;case`\r`:return String.raw`\r`;case` `:return String.raw`\t`;default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`}}const je=/[\u0000-\u001F\u007F-\u009F\u2028\u2029"\\]/gu;function Me(e){return`"${e.replaceAll(je,e=>Ae(e))}"`}const Ne="official-mcp 直连官方 scrapling-mcp:它的全部工具不经本插件的 URL 守卫与会话闸门(钉住的 scrapling 版本里有 `browser_evaluate` 这类任意 JS 执行),用的是它自己的会话与状态,本插件既不复用也不拦截。";function Pe(e){if(!e.enabled)throw new Oe(`OFFICIAL_MCP_DISABLED`,`official-mcp 未启用:部署配置里把 officialMcpEnabled 设为 true 才会生成接入配置`);if(!e.acceptedRisk)throw new Oe(`RISK_NOT_ACCEPTED`,`${Ne} 确认接受请再跑一次 setup 并带 --accept-risk。`);let t=ke(e.dataDir),n=[],r=ge;return{command:t,args:n,serverName:r,risk:Ne,installCommand:De(`0.2.3-alpha.2`),patch:[`- insert:`,` - id: scrapling-official-mcp`,` name: '${_}'`,` config:`,` serverName: ${r}`,` transport: ${ye}`,` command: ${Me(t)}`,` args: ${JSON.stringify(n)}`,` failOnStartupError: true`,` toolLoading: ${e.toolLoading??`eager`}`,``].join(`
4
+ `)}}function Fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ie=/\r\n|\n|\r/u,Le=/:(?<port>\d+)/u,Re=/[\t ]#.*$/u,ze=/^(?:"(?<double>[^"]*)"|'(?<single>[^']*)')$/u,Be=/^(?:-[\t ]*)?name:(?<value>.*)$/u,Ve=/^(?<key>[\w-]+):[\t ]+(?<value>\S.*)$/u;function He(e,t,n){return e||t===void 0||n<=t}function Ue(e){let t=e.trim(),n=ze.exec(t)?.groups;if(n!==void 0)return n.double??n.single;let r=t.replace(Re,``).trim(),i=ze.exec(r)?.groups,a=i?.double??i?.single;return a===void 0?r.length===0?void 0:r:a}function We(e){return e.split(Ie)}function Ge(e){let t=[],n;for(let r of We(e)){let e=r.length-r.trimStart().length,i=r.slice(e),a=i.startsWith(`-`),o=Ue(Be.exec(i)?.groups?.value??``),s=Ve.exec(i)?.groups;o!==void 0&&He(a,n?.indent,e)?(n={entry:{name:o,config:{}},indent:e},t.push(n.entry)):s?.key!==void 0&&s.value!==void 0&&n!==void 0&&e>n.indent&&(n.entry.config[s.key]=Ue(s.value))}return t}function Ke(e){let{url:t}=e.config,n;if(t!==void 0)try{let{port:e,protocol:r}=new URL(t);e===``?r===`http:`?n=`80`:r===`https:`&&(n=`443`):n=e}catch{n=Le.exec(t)?.groups?.port}return n}function qe(e){return e.config.transport===ye}function Je(e){let t=[];if(e.clientVersionBroken===!0)return t.push({code:`MCP_CLIENT_MANIFEST_BROKEN`,detail:`profile 的 package.json 读不懂(JSON 语法错误或顶层不是对象)——这不是「没装客户端」,先把这份文件修好`}),t;e.mode!==`native`&&e.clientVersion===void 0&&t.push({code:`MCP_CLIENT_MISSING`,detail:`profile 没有 ${_}:跑 ${De()} 装上它`});let n=e.clientVersion;return n!==void 0&&!Se.includes(n)&&t.push({code:`MCP_CLIENT_UNPINNED`,detail:`客户端钉的是 ${e.clientVersion},只接受 ${Se.join(` 或 `)} —— 宿主对不匹配的对端拒绝装载`}),t}function Ye(e,t){let n=[];t.length>1&&n.push({code:`DUPLICATE_SCRAPLING_ENTRY`,detail:`serverName 为 scrapling 的条目有 ${String(t.length)} 条,一个名字只能有一个 server`}),t.some(e=>qe(e))&&t.some(e=>!qe(e))&&n.push({code:`MCP_MODE_CONFLICT`,detail:`本插件的 ${ve} 条目与官方 ${ye} 条目并存;同一时刻只能一种`});let r=e.mode===`official-mcp`,i=t.some(e=>r===qe(e));return e.mode===`native`&&t.length>0?n.push({code:`MCP_MODE_ENTRY_MISMATCH`,detail:`integrationMode=native 却留着 scrapling 的 MCP 条目:模型会同时看到两套工具`}):e.mode!==`native`&&!i&&n.push({code:`MCP_MODE_ENTRY_MISMATCH`,detail:`integrationMode=${e.mode} 需要 ${r?ye:ve} 条目,profile 里没有`}),r&&!e.officialMcpEnabled&&t.some(e=>qe(e))&&n.push({code:`MCP_OFFICIAL_SWITCH_OFF`,detail:`留着官方 stdio 条目但 officialMcpEnabled=false:官方 server 的工具不经本插件守卫,开关要明说`}),n}function Xe(e,t){let n=[...new Set(e.map(e=>Ke(e)).filter(e=>e!==void 0))];if(n.length===0){let n=e.filter(e=>!qe(e));return t!==void 0&&n.length>0?[{code:`MCP_PORT_UNREADABLE`,detail:`给了 --port ${String(t)},但 profile 里 ${String(n.length)} 条 ${ve} 条目都读不出端口(url 为空、写成占位符或被引号/注释截断):端口一致性没法比对,客户端连哪个端口取决于 patch 里那条 url`}]:[]}let r=t===void 0?void 0:String(t);return n.length<2&&(r===void 0||n.includes(r))?[]:[{code:`MCP_PORT_MISMATCH`,detail:`条目里的端口是 ${n.join(`, `)}${r===void 0?``:`,--port 说的是 ${r}`};改过 mcpPort 就要重新应用 patch`}]}function Ze(e){let t=Ge(e.patchText).filter(e=>e.name===`@deepseek-ai/dsh-mcp-client`&&e.config.serverName===`scrapling`);return[...Je(e),...Ye(e,t),...Xe(t,e.expectedPort)]}const Qe=/^(?<indent>[\t ]*)officialMcpEnabled:(?<value>[^\r\n]*)$/gmu,$e=/^(?<indent>[\t ]*)mcpToolLoading:(?<value>[^\r\n]*)$/gmu;function et(e,t){let n,r;for(let i of e.matchAll(t)){
5
5
  /* v8 ignore next -- 命名组恒存在(`indent` 在模式里是无条件的),`?? ""` 只是类型收窄 */
6
- let e=r.groups?.indent??``;t??=e,e===t&&(n=r.groups?.value)}let r=n?.replace(Ie,``).trim(),i=r===void 0?void 0:Le.exec(r)?.groups;return i?.double??i?.single??r}function Qe(e){let t=Ze(e);return t===`true`||t===`True`||t===`TRUE`}async function $e(e){try{return await u(e,`utf8`)}catch(t){if(Ne(t)&&t.code===`ENOENT`)return``;throw Error(`读不出 ${e}:${String(t)}`,{cause:t})}}function et(e){if(e.trim().length===0)return{broken:!1};let t;try{t=JSON.parse(e)}catch{return{broken:!0}}if(!Ne(t))return{broken:!0};let{dependencies:n}=t,r=Ne(n)?n[v]:void 0;return{version:typeof r==`string`?r:void 0,broken:!1}}async function tt(e){let t=await h(e).catch(()=>null);if(t!==null&&!t.isDirectory())throw Error(`profile 不是目录:${e}`)}async function nt(e){await tt(e);let[t,n]=await Promise.all([$e(g.join(e,`cordis.patch.yml`)),$e(g.join(e,`package.json`))]),r=et(n);return{patchText:t,clientVersion:r.version,clientVersionBroken:r.broken,officialMcpEnabled:Qe(t)}}function rt(e){return`${e}.patch.yml`}function it(e){let t=[`- insert:`,` - id: scrapling-mcp`,` name: '${v}'`,` config:`,` serverName: ${he}`,` transport: ${ge}`,` url: ${we(e.port,`127.0.0.1`)}`,` failOnStartupError: false`];return e.withAuth&&t.push(` headers:`,` Authorization: !!js '\`Bearer \${process.env.${ve}}\`'`),`${t.join(`
7
- `)}\n`}function at(){return[`# integrationMode=native:profile 里不留 scrapling 的 MCP 条目。`,`# 留着条目时模型会同时看到原生工具与 mcp__scrapling__* 两套同名不同层的工具。`,`# 这份文本本身不删任何东西:profile 里若已有 name: '${v}' 的条目,`,"# 要手工删掉它再重启宿主,否则 `doctor --mode native` 会按事实报 MCP_MODE_ENTRY_MISMATCH。",``].join(`
8
- `)}const ot=[`auto`,`tavily`,`bing`,`brave`,`serper`,`duckduckgo`,`searxng`];function st(e){return ot.includes(e)}function ct(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function lt(e,t=`|`){return e.map(e=>Dt(e)).join(t)}function ut(e,t){return typeof t==`bigint`?t.toString():t}var dt=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ft(e){return new dt(e)}function pt(e){return e==null}function mt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ht(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function y(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function b(e){return gt(e._zod.def)??e._zod.def.shape}function _t(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return y(this,t,e),e},enumerable:!0,configurable:!0})}function vt(e,t,n){t in e?y(e,t,n):e[t]=n}function x(e,t,n,r){let i=b(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?_t(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):vt(e,a,r?r(n.value,a):n.value))}}function yt(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?_t(e,n,()=>t[n]):vt(e,n,r.value))}}function S(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function bt(e){return JSON.stringify(e)}function xt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const St=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ct(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const wt=/* @__PURE__*/ ft(()=>{if(P.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function C(e){if(Ct(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ct(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Tt(e){return C(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Et=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function w(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function T(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function E(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Dt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ot(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const kt={safeint:[-(2**53-1),2**53-1],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},At={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function jt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return x(i,e,Mt(e,t)),T(e,S(n,{shape:i,checks:[]}))}function Mt(e,t){let n=b(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Nt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Mt(e,t)),a={};return x(a,e,Reflect.ownKeys(b(e)).filter(e=>!i.has(e))),T(e,S(n,{shape:a,checks:[]}))}function Pt(e,t){if(!C(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=b(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return T(e,S(e._zod.def,{shape:Ft(e,t)}))}function Ft(e,t){let n={};return x(n,e,Reflect.ownKeys(b(e))),yt(n,t),n}function It(e,t){if(!C(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return T(e,S(e._zod.def,{shape:Ft(e,t)}))}function Lt(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return x(n,e,Reflect.ownKeys(b(e))),x(n,t,Reflect.ownKeys(b(t))),T(e,S(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Rt(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Mt(t,n)):void 0,o={};return x(o,t,Reflect.ownKeys(b(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),T(t,S(t._zod.def,{shape:o,checks:[]}))}function zt(e,t,n){let r=n?new Set(Mt(t,n)):void 0,i={};return x(i,t,Reflect.ownKeys(b(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),T(t,S(t._zod.def,{shape:i}))}function D(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Bt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Vt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ht(e){return typeof e==`string`?e:e?.message}function Ut(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Wt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function O(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Ht(e.inst?._zod.def?.error?.(e))??Ht(a?.(e))??Ht(t?.error?.(e))??Ht(n.customError?.(e))??Ht(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const Gt=/[\uD800-\uDBFF]/;function Kt(e){let t=e.length;if(!Gt.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function qt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Jt(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Yt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Xt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):$t(e,n,r.value)}}function k(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Zt(e,t,n){return k(e,t,n,!1)}/* @__NO_SIDE_EFFECTS__ */
9
- function Qt(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return k(this,n,r(this))},set(e){k(this,n,e)}})}return t}function $t(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:k(this,t,n.bind(this))},set(e){k(this,t,e)}})}function en(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let tn,A=!1;const nn={configurable:!0,get(){A=!0}};function j(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&tn!==e._zod?tn=void 0:(tn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,nn);let e=A;A=!1;try{let r=n(this);return A?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),A||=e,r}catch(n){throw delete this[t],A||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function rn(e,t,n,r){let i=en(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function an(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var on;const sn={value:void 0,enumerable:!1};let cn=`captureStackTrace`in Error?Error:null;function ln(e){let t=cn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return cn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
10
- function M(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){sn.value=new a(r);try{Object.defineProperty(n,"_zod",sn)}finally{sn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Xt(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ln(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var N=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},un=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(on=globalThis).__zod_globalConfig??(on.__zod_globalConfig={});const P=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(P,e),P}function dn(){let e=this._zod;return e.message??=JSON.stringify(e.def,ut,2),e.message}function fn(e){this._zod.message=e}const pn={get:dn,set:fn,enumerable:!0,configurable:!0},mn={value:void 0,enumerable:!1},hn=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),gn=/* @__PURE__ */ M(`$ZodError`,(e,t)=>{e.name=`$ZodError`,mn.value=t,Object.defineProperty(e,"issues",mn),mn.value=void 0,Object.defineProperty(e,"message",pn);let n=Object.getPrototypeOf(e);hn.has(n)||(hn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function _n(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function vn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?_n(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function yn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function bn(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function xn(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${bn(e.path)}`);return t.join(`
11
- `)}function Sn(e,t){return{callee:t?.callee??e,Err:t?.Err}}const Cn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new N;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,F())));throw St(n,a?.callee??t),n}return s.value};return t},wn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,F())));throw St(n,a?.callee??t),n}return s.value};return t},Tn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new N;return a.issues.length?En(e,a.issues,i):{success:!0,data:a.value}};function En(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>O(e,n,F()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const Dn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?En(e,a.issues,i):{success:!0,data:a.value}},On=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),kn=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),An=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==On)return!0;if(r.definite===!0&&n===void 0)return!1}return jn(e,t,n)});function jn(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[kn]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new N;return a.issues.length===0}const Mn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Nn=e=>{let t=Cn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Sn(n,a))};return n},Pn=e=>{let t=Cn(e),n=(e,r,i,a)=>t(e,r,i,Sn(n,a));return n},Fn=e=>{let t=wn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Sn(n,a))};return n},In=e=>{let t=wn(e),n=async(e,r,i,a)=>await t(e,r,i,Sn(n,a));return n},Ln=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Tn(e)(t,n,i)},Rn=e=>(t,n,r)=>Tn(e)(t,n,r),zn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Dn(e)(t,n,i)},Bn=e=>async(t,n,r)=>Dn(e)(t,n,r),Vn=/^[cC][0-9a-z]{6,}$/,Hn=/^[0-9a-z]+$/,Un=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Wn=/^[0-9a-vA-V]{20}$/,Gn=/^[A-Za-z0-9]{27}$/,Kn=/^[a-zA-Z0-9_-]{21}$/;function qn(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Jn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Qn(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const $n=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,er=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ir=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ar=/^https?$/,or=/^\+[1-9]\d{6,14}$/,sr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function cr(e){return RegExp(`^${e}$`)}const lr=/*@__PURE__*/ cr(sr);function ur(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dr(e){return RegExp(`^${ur(e)}$`)}function fr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${ur({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${ur({precision:e.precision})}`:n;return RegExp(`^${sr}T(?:${r})$`)}const pr=/^[\s\S]{0,}$/,mr=/^-?\d+$/,hr=/^-?\d+(?:\.\d+)?$/,gr=/^[^A-Z]*$/,_r=/^[^a-z]*$/,I=/*@__PURE__*/ M(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),vr=e=>{let t=e.value;return!pt(t)&&t.length!==void 0},yr={number:`number`,bigint:`bigint`,object:`date`},br=/*@__PURE__*/ M(`$ZodCheckLessThan`,(e,t)=>{I.init(e,t);let n=yr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:yr[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xr=/*@__PURE__*/ M(`$ZodCheckGreaterThan`,(e,t)=>{I.init(e,t);let n=yr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:yr[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sr=/*@__PURE__*/ M(`$ZodCheckMultipleOf`,(e,t)=>{I.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ht(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Cr=/*@__PURE__*/ M(`$ZodCheckNumberFormat`,(e,t)=>{I.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=kt[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),wr=/*@__PURE__*/ M(`$ZodCheckMaxLength`,(e,t)=>{var n;I.init(e,t),(n=e._zod.def).when??(n.when=vr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Kt(r):i)<=t.maximum)return;let a=qt(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Tr=/*@__PURE__*/ M(`$ZodCheckMinLength`,(e,t)=>{var n;I.init(e,t),(n=e._zod.def).when??(n.when=vr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Kt(r):i)>=t.minimum)return;let a=qt(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Er=/*@__PURE__*/ M(`$ZodCheckLengthEquals`,(e,t)=>{var n;I.init(e,t),(n=e._zod.def).when??(n.when=vr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Kt(r):i;if(a===t.length)return;let o=qt(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Dr=/*@__PURE__*/ M(`$ZodCheckStringFormat`,(e,t)=>{var n,r;I.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Or=/*@__PURE__*/ M(`$ZodCheckRegex`,(e,t)=>{Dr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),kr=/*@__PURE__*/ M(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gr,Dr.init(e,t)}),Ar=/*@__PURE__*/ M(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_r,Dr.init(e,t)}),jr=/*@__PURE__*/ M(`$ZodCheckIncludes`,(e,t)=>{I.init(e,t);let n=w(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Mr=/*@__PURE__*/ M(`$ZodCheckStartsWith`,(e,t)=>{I.init(e,t);let n=RegExp(`^${w(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Nr=/*@__PURE__*/ M(`$ZodCheckEndsWith`,(e,t)=>{I.init(e,t);let n=RegExp(`.*${w(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Pr=/*@__PURE__*/ M(`$ZodCheckOverwrite`,(e,t)=>{I.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Fr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
6
+ let e=i.groups?.indent??``;n??=e,e===n&&(r=i.groups?.value)}let i=r?.replace(Re,``).trim(),a=i===void 0?void 0:ze.exec(i)?.groups;return a?.double??a?.single??i}function tt(e){return et(e,Qe)}function nt(e){let t=et(e,$e);if(t===void 0||t===`eager`)return`eager`;if(t===`on-demand`)return t;throw Error(`mcpToolLoading 配置非法:${JSON.stringify(t)};只接受 ${_e.join(` / `)}`)}function rt(e){let t=tt(e);return t===`true`||t===`True`||t===`TRUE`}async function it(e){try{return await u(e,`utf8`)}catch(t){if(Fe(t)&&t.code===`ENOENT`)return``;throw Error(`读不出 ${e}:${String(t)}`,{cause:t})}}function at(e){if(e.trim().length===0)return{broken:!1};let t;try{t=JSON.parse(e)}catch{return{broken:!0}}if(!Fe(t))return{broken:!0};let{dependencies:n}=t,r=Fe(n)?n[_]:void 0;return{version:typeof r==`string`?r:void 0,broken:!1}}async function ot(e){let t=await h(e).catch(()=>null);if(t!==null&&!t.isDirectory())throw Error(`profile 不是目录:${e}`)}async function st(e){await ot(e);let[t,n]=await Promise.all([it(g.join(e,`cordis.patch.yml`)),it(g.join(e,`package.json`))]),r=at(n);return{patchText:t,clientVersion:r.version,clientVersionBroken:r.broken,officialMcpEnabled:rt(t),mcpToolLoading:nt(t)}}function ct(e){return`${e}.patch.yml`}function lt(e){let t=[`- insert:`,` - id: scrapling-mcp`,` name: '${_}'`,` config:`,` serverName: ${ge}`,` transport: ${ve}`,` url: ${Ee(e.port,`127.0.0.1`)}`,` failOnStartupError: false`,` toolLoading: ${e.toolLoading??`eager`}`];return e.withAuth&&t.push(` headers:`,` Authorization: !!js '\`Bearer \${process.env.${be}}\`'`),`${t.join(`
7
+ `)}\n`}function ut(){return[`# integrationMode=native:profile 里不留 scrapling 的 MCP 条目。`,`# 留着条目时模型会同时看到原生工具与 mcp__scrapling__* 两套同名不同层的工具。`,`# 这份文本本身不删任何东西:profile 里若已有 name: '${_}' 的条目,`,"# 要手工删掉它再重启宿主,否则 `doctor --mode native` 会按事实报 MCP_MODE_ENTRY_MISMATCH。",``].join(`
8
+ `)}const dt=[`auto`,`tavily`,`bing`,`brave`,`serper`,`duckduckgo`,`searxng`,`deepseek`];function ft(e){return dt.includes(e)}function pt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function mt(e,t=`|`){return e.map(e=>Pt(e)).join(t)}function ht(e,t){return typeof t==`bigint`?t.toString():t}var gt=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function _t(e){return new gt(e)}function vt(e){return e==null}function yt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function bt(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function v(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function xt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function y(e){return xt(e._zod.def)??e._zod.def.shape}function St(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return v(this,t,e),e},enumerable:!0,configurable:!0})}function Ct(e,t,n){t in e?v(e,t,n):e[t]=n}function b(e,t,n,r){let i=y(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?St(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Ct(e,a,r?r(n.value,a):n.value))}}function wt(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?St(e,n,()=>t[n]):Ct(e,n,r.value))}}function x(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Tt(e){return JSON.stringify(e)}function Et(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Dt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ot(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const kt=/* @__PURE__*/ _t(()=>{if(M.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function At(e){if(Ot(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ot(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function jt(e){return At(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Mt=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function S(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Pt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ft(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const It={safeint:[-(2**53-1),2**53-1],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Lt={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function Rt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return b(i,e,zt(e,t)),S(e,x(n,{shape:i,checks:[]}))}function zt(e,t){let n=y(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Bt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(zt(e,t)),a={};return b(a,e,Reflect.ownKeys(y(e)).filter(e=>!i.has(e))),S(e,x(n,{shape:a,checks:[]}))}function Vt(e,t){if(!At(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=y(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return S(e,x(e._zod.def,{shape:Ht(e,t)}))}function Ht(e,t){let n={};return b(n,e,Reflect.ownKeys(y(e))),wt(n,t),n}function Ut(e,t){if(!At(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return S(e,x(e._zod.def,{shape:Ht(e,t)}))}function Wt(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return b(n,e,Reflect.ownKeys(y(e))),b(n,t,Reflect.ownKeys(y(t))),S(e,x(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Gt(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(zt(t,n)):void 0,o={};return b(o,t,Reflect.ownKeys(y(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),S(t,x(t._zod.def,{shape:o,checks:[]}))}function Kt(e,t,n){let r=n?new Set(zt(t,n)):void 0,i={};return b(i,t,Reflect.ownKeys(y(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),S(t,x(t._zod.def,{shape:i}))}function w(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function qt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function T(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Jt(e){return typeof e==`string`?e:e?.message}function Yt(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Xt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function E(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Jt(e.inst?._zod.def?.error?.(e))??Jt(a?.(e))??Jt(t?.error?.(e))??Jt(n.customError?.(e))??Jt(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const Zt=/[\uD800-\uDBFF]/;function Qt(e){let t=e.length;if(!Zt.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function $t(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function en(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function tn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function nn(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):on(e,n,r.value)}}function D(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function rn(e,t,n){return D(e,t,n,!1)}/* @__NO_SIDE_EFFECTS__ */
9
+ function an(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return D(this,n,r(this))},set(e){D(this,n,e)}})}return t}function on(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:D(this,t,n.bind(this))},set(e){D(this,t,e)}})}function sn(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let cn,O=!1;const ln={configurable:!0,get(){O=!0}};function k(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&cn!==e._zod?cn=void 0:(cn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ln);let e=O;O=!1;try{let r=n(this);return O?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),O||=e,r}catch(n){throw delete this[t],O||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function un(e,t,n,r){let i=sn(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function dn(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var fn;const pn={value:void 0,enumerable:!1};let mn=`captureStackTrace`in Error?Error:null;function hn(e){let t=mn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return mn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
10
+ function A(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){pn.value=new a(r);try{Object.defineProperty(n,"_zod",pn)}finally{pn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),nn(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?hn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var j=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},gn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(fn=globalThis).__zod_globalConfig??(fn.__zod_globalConfig={});const M=globalThis.__zod_globalConfig;function N(e){return e&&Object.assign(M,e),M}function _n(){let e=this._zod;return e.message??=JSON.stringify(e.def,ht,2),e.message}function vn(e){this._zod.message=e}const yn={get:_n,set:vn,enumerable:!0,configurable:!0},bn={value:void 0,enumerable:!1},xn=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),Sn=/* @__PURE__ */ A(`$ZodError`,(e,t)=>{e.name=`$ZodError`,bn.value=t,Object.defineProperty(e,"issues",bn),bn.value=void 0,Object.defineProperty(e,"message",yn);let n=Object.getPrototypeOf(e);xn.has(n)||(xn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function Cn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function wn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Cn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Tn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function En(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function Dn(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${En(e.path)}`);return t.join(`
11
+ `)}function On(e,t){return{callee:t?.callee??e,Err:t?.Err}}const kn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new j;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>E(e,o,N())));throw Dt(n,a?.callee??t),n}return s.value};return t},An=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>E(e,o,N())));throw Dt(n,a?.callee??t),n}return s.value};return t},jn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new j;return a.issues.length?Mn(e,a.issues,i):{success:!0,data:a.value}};function Mn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>E(e,n,N()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const Nn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Mn(e,a.issues,i):{success:!0,data:a.value}},Pn=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),Fn=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),In=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Pn)return!0;if(r.definite===!0&&n===void 0)return!1}return Ln(e,t,n)});function Ln(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Fn]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new j;return a.issues.length===0}const Rn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},zn=e=>{let t=kn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,On(n,a))};return n},Bn=e=>{let t=kn(e),n=(e,r,i,a)=>t(e,r,i,On(n,a));return n},Vn=e=>{let t=An(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,On(n,a))};return n},Hn=e=>{let t=An(e),n=async(e,r,i,a)=>await t(e,r,i,On(n,a));return n},Un=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jn(e)(t,n,i)},Wn=e=>(t,n,r)=>jn(e)(t,n,r),Gn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Nn(e)(t,n,i)},Kn=e=>async(t,n,r)=>Nn(e)(t,n,r),qn=/^[cC][0-9a-z]{6,}$/,Jn=/^[0-9a-z]+$/,Yn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Xn=/^[0-9a-vA-V]{20}$/,Zn=/^[A-Za-z0-9]{27}$/,Qn=/^[a-zA-Z0-9_-]{21}$/;function $n(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const er=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nr=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function ir(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const ar=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,or=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,sr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,cr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ur=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,dr=/^https?$/,fr=/^\+[1-9]\d{6,14}$/,pr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function mr(e){return RegExp(`^${e}$`)}const hr=/*@__PURE__*/ mr(pr);function gr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _r(e){return RegExp(`^${gr(e)}$`)}function vr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${gr({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${gr({precision:e.precision})}`:n;return RegExp(`^${pr}T(?:${r})$`)}const yr=/^[\s\S]{0,}$/,br=/^-?\d+$/,xr=/^-?\d+(?:\.\d+)?$/,Sr=/^[^A-Z]*$/,Cr=/^[^a-z]*$/,P=/*@__PURE__*/ A(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),wr=e=>{let t=e.value;return!vt(t)&&t.length!==void 0},Tr={number:`number`,bigint:`bigint`,object:`date`},Er=/*@__PURE__*/ A(`$ZodCheckLessThan`,(e,t)=>{P.init(e,t);let n=Tr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Tr[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dr=/*@__PURE__*/ A(`$ZodCheckGreaterThan`,(e,t)=>{P.init(e,t);let n=Tr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Tr[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Or=/*@__PURE__*/ A(`$ZodCheckMultipleOf`,(e,t)=>{P.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):bt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kr=/*@__PURE__*/ A(`$ZodCheckNumberFormat`,(e,t)=>{P.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=It[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ar=/*@__PURE__*/ A(`$ZodCheckMaxLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=wr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Qt(r):i)<=t.maximum)return;let a=$t(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jr=/*@__PURE__*/ A(`$ZodCheckMinLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=wr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Qt(r):i)>=t.minimum)return;let a=$t(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mr=/*@__PURE__*/ A(`$ZodCheckLengthEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=wr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Qt(r):i;if(a===t.length)return;let o=$t(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nr=/*@__PURE__*/ A(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pr=/*@__PURE__*/ A(`$ZodCheckRegex`,(e,t)=>{Nr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Fr=/*@__PURE__*/ A(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Sr,Nr.init(e,t)}),Ir=/*@__PURE__*/ A(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Cr,Nr.init(e,t)}),Lr=/*@__PURE__*/ A(`$ZodCheckIncludes`,(e,t)=>{P.init(e,t);let n=Nt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rr=/*@__PURE__*/ A(`$ZodCheckStartsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`^${Nt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zr=/*@__PURE__*/ A(`$ZodCheckEndsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`.*${Nt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Br=/*@__PURE__*/ A(`$ZodCheckOverwrite`,(e,t)=>{P.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Vr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
12
12
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
13
- `)}\n};`)(...Object.values(this.closed))}};const Ir={major:4,minor:6,patch:7},L=/*@__PURE__*/ M(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ir;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=D(t),a;for(let o of n){if(o._zod.def.when){if(Bt(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new N;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Wt(t.issues,n,e),i||=D(t,n))});else{if(t.issues.length===n)continue;Wt(t.issues,n,e),i||=D(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(D(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new N;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new N;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Zt(this,`~standard`,zr(this))},set"~standard"(e){k(this,`~standard`,e)}}),Lr=(e,t)=>e.issues.length?{issues:e.issues.map(e=>O(e,t,F()))}:{value:e.value};async function Rr(e,t){let n={async:!0};return Lr(await e._zod.run({value:t,issues:[]},n),n)}function zr(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Lr(r,n)}catch{}return Rr(e,t)},vendor:`zod`,version:1}}const Br=/*@__PURE__*/ M(`$ZodString`,(e,t)=>{L.init(e,t),e._zod.pattern=t.pattern??pr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),R=/*@__PURE__*/ M(`$ZodStringFormat`,(e,t)=>{Dr.init(e,t),Br.init(e,t)}),Vr=/*@__PURE__*/ M(`$ZodGUID`,(e,t)=>{t.pattern??=Yn,R.init(e,t)}),Hr=/*@__PURE__*/ M(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Xn(e)}else t.pattern??=Xn();R.init(e,t)}),Ur=/*@__PURE__*/ M(`$ZodEmail`,(e,t)=>{t.pattern??=Zn,R.init(e,t)});function Wr(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Gr(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Wr(e)||2:Kr(e,t)}function Kr(e,t){if(!t.normalize&&t.protocol?.source===ar.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const qr=/[\t\n\r]/g;function Jr(e){return e.replace(qr,``)}function Yr(e,t){return t.lastIndex=0,t.test(e.hostname)}function Xr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Zr=/*@__PURE__*/ M(`$ZodURL`,(e,t)=>{R.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Gr(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Jr(r);return}t.hostname&&!Yr(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Xr(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Jr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Qr=/*@__PURE__*/ M(`$ZodEmoji`,(e,t)=>{t.pattern??=Qn(),R.init(e,t)}),$r=/*@__PURE__*/ M(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Kn:qn(t.length),R.init(e,t)}),ei=/*@__PURE__*/ M(`$ZodCUID`,(e,t)=>{t.pattern??=Vn,R.init(e,t)}),ti=/*@__PURE__*/ M(`$ZodCUID2`,(e,t)=>{t.pattern??=Hn,R.init(e,t)}),ni=/*@__PURE__*/ M(`$ZodULID`,(e,t)=>{t.pattern??=Un,R.init(e,t)}),ri=/*@__PURE__*/ M(`$ZodXID`,(e,t)=>{t.pattern??=Wn,R.init(e,t)}),ii=/*@__PURE__*/ M(`$ZodKSUID`,(e,t)=>{t.pattern??=Gn,R.init(e,t)}),ai=/*@__PURE__*/ M(`$ZodISODateTime`,(e,t)=>{t.pattern??=fr(t),R.init(e,t)}),oi=/*@__PURE__*/ M(`$ZodISODate`,(e,t)=>{t.pattern??=lr,R.init(e,t)}),si=/*@__PURE__*/ M(`$ZodISOTime`,(e,t)=>{t.pattern??=dr(t),R.init(e,t)}),ci=/*@__PURE__*/ M(`$ZodISODuration`,(e,t)=>{t.pattern??=Jn,R.init(e,t)}),li=/*@__PURE__*/ M(`$ZodIPv4`,(e,t)=>{t.pattern??=$n,R.init(e,t)}),ui=/^[0-9a-fA-F:.]+$/;function di(e){return ui.test(e)?Wr(`http://[${e}]`):!1}const fi=/*@__PURE__*/ M(`$ZodIPv6`,(e,t)=>{t.pattern??=er,R.init(e,t),e._zod.check=n=>{di(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),pi=/*@__PURE__*/ M(`$ZodCIDRv4`,(e,t)=>{t.pattern??=tr,R.init(e,t)});function mi(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:di(n)}const hi=/*@__PURE__*/ M(`$ZodCIDRv6`,(e,t)=>{t.pattern??=nr,R.init(e,t),e._zod.check=n=>{mi(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function gi(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const _i=/^[0-9a-zA-Z+/]*={0,2}$/,vi=/*@__PURE__*/ M(`$ZodBase64`,(e,t)=>{t.pattern??=_i,R.init(e,t),e._zod.check=n=>{gi(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),yi=/^[A-Za-z0-9_-]*$/;function bi(e){if(!yi.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return gi(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const xi=/*@__PURE__*/ M(`$ZodBase64URL`,(e,t)=>{t.pattern??=yi,R.init(e,t),e._zod.check=n=>{bi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Si=/*@__PURE__*/ M(`$ZodE164`,(e,t)=>{t.pattern??=or,R.init(e,t)});function Ci(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const wi=/*@__PURE__*/ M(`$ZodJWT`,(e,t)=>{R.init(e,t),e._zod.check=n=>{Ci(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ti=/*@__PURE__*/ M(`$ZodNumber`,(e,t)=>{L.init(e,t),e._zod.pattern=hr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ei=/*@__PURE__*/ M(`$ZodNumberFormat`,(e,t)=>{Cr.init(e,t),Ti.init(e,t)}),Di=/*@__PURE__*/ M(`$ZodUnknown`,(e,t)=>{L.init(e,t),e._zod.parse=e=>e}),Oi=/*@__PURE__*/ M(`$ZodNever`,(e,t)=>{L.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ki(e,t){let n=Ut(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ut(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Wt(n.issues,t,e),n}}return i(n,a)}}const Ai=e=>Array.isArray(e)?e.length:-1;function ji(e,t,n){e.issues.length&&t.issues.push(...Vt(n,e.issues)),t.value[n]=e.value}const Mi=/*@__PURE__*/ M(`$ZodArray`,(e,t)=>{L.init(e,t);let n=P.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>ji(t,r,e)));else if(ji(c,r,e),s&&c.issues.length!==0&&D(c))break}return o.length?Promise.all(o).then(()=>r):r},ki(e,Ai)});function Ni(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Vt(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const Pi=[];function Fi(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Pi,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Ot(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ii(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(D(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ni(e,n,i,t,d,f))):Ni(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const Li=/*@__PURE__*/ M(`$ZodObject`,(e,t)=>{L.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ft(()=>Fi(t));j(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||y(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Ct,o=t.catchall,s,c=P.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(D(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Ni(n,t,e,r,a,o))):Ni(s,t,e,r,a,o)}return o?Ii(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ri=/*@__PURE__*/ M(`$ZodObjectJIT`,(e,t)=>{Li.init(e,t);let n=e._zod.parse,r=ft(()=>Fi(t)),i=P.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Fr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
13
+ `)}\n};`)(...Object.values(this.closed))}};const Hr={major:4,minor:6,patch:7},F=/*@__PURE__*/ A(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Hr;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=w(t),a;for(let o of n){if(o._zod.def.when){if(qt(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new j;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Xt(t.issues,n,e),i||=w(t,n))});else{if(t.issues.length===n)continue;Xt(t.issues,n,e),i||=w(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(w(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new j;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new j;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return rn(this,`~standard`,Gr(this))},set"~standard"(e){D(this,`~standard`,e)}}),Ur=(e,t)=>e.issues.length?{issues:e.issues.map(e=>E(e,t,N()))}:{value:e.value};async function Wr(e,t){let n={async:!0};return Ur(await e._zod.run({value:t,issues:[]},n),n)}function Gr(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ur(r,n)}catch{}return Wr(e,t)},vendor:`zod`,version:1}}const Kr=/*@__PURE__*/ A(`$ZodString`,(e,t)=>{F.init(e,t),e._zod.pattern=t.pattern??yr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),I=/*@__PURE__*/ A(`$ZodStringFormat`,(e,t)=>{Nr.init(e,t),Kr.init(e,t)}),qr=/*@__PURE__*/ A(`$ZodGUID`,(e,t)=>{t.pattern??=tr,I.init(e,t)}),Jr=/*@__PURE__*/ A(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=nr(e)}else t.pattern??=nr();I.init(e,t)}),Yr=/*@__PURE__*/ A(`$ZodEmail`,(e,t)=>{t.pattern??=rr,I.init(e,t)});function Xr(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Zr(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Xr(e)||2:Qr(e,t)}function Qr(e,t){if(!t.normalize&&t.protocol?.source===dr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const $r=/[\t\n\r]/g;function ei(e){return e.replace($r,``)}function ti(e,t){return t.lastIndex=0,t.test(e.hostname)}function ni(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const ri=/*@__PURE__*/ A(`$ZodURL`,(e,t)=>{I.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Zr(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ei(r);return}t.hostname&&!ti(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ni(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ei(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ii=/*@__PURE__*/ A(`$ZodEmoji`,(e,t)=>{t.pattern??=ir(),I.init(e,t)}),ai=/*@__PURE__*/ A(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Qn:$n(t.length),I.init(e,t)}),oi=/*@__PURE__*/ A(`$ZodCUID`,(e,t)=>{t.pattern??=qn,I.init(e,t)}),si=/*@__PURE__*/ A(`$ZodCUID2`,(e,t)=>{t.pattern??=Jn,I.init(e,t)}),ci=/*@__PURE__*/ A(`$ZodULID`,(e,t)=>{t.pattern??=Yn,I.init(e,t)}),li=/*@__PURE__*/ A(`$ZodXID`,(e,t)=>{t.pattern??=Xn,I.init(e,t)}),ui=/*@__PURE__*/ A(`$ZodKSUID`,(e,t)=>{t.pattern??=Zn,I.init(e,t)}),di=/*@__PURE__*/ A(`$ZodISODateTime`,(e,t)=>{t.pattern??=vr(t),I.init(e,t)}),fi=/*@__PURE__*/ A(`$ZodISODate`,(e,t)=>{t.pattern??=hr,I.init(e,t)}),pi=/*@__PURE__*/ A(`$ZodISOTime`,(e,t)=>{t.pattern??=_r(t),I.init(e,t)}),mi=/*@__PURE__*/ A(`$ZodISODuration`,(e,t)=>{t.pattern??=er,I.init(e,t)}),hi=/*@__PURE__*/ A(`$ZodIPv4`,(e,t)=>{t.pattern??=ar,I.init(e,t)}),gi=/^[0-9a-fA-F:.]+$/;function _i(e){return gi.test(e)?Xr(`http://[${e}]`):!1}const vi=/*@__PURE__*/ A(`$ZodIPv6`,(e,t)=>{t.pattern??=or,I.init(e,t),e._zod.check=n=>{_i(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),yi=/*@__PURE__*/ A(`$ZodCIDRv4`,(e,t)=>{t.pattern??=sr,I.init(e,t)});function bi(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:_i(n)}const xi=/*@__PURE__*/ A(`$ZodCIDRv6`,(e,t)=>{t.pattern??=cr,I.init(e,t),e._zod.check=n=>{bi(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Si(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Ci=/^[0-9a-zA-Z+/]*={0,2}$/,wi=/*@__PURE__*/ A(`$ZodBase64`,(e,t)=>{t.pattern??=Ci,I.init(e,t),e._zod.check=n=>{Si(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ti=/^[A-Za-z0-9_-]*$/;function Ei(e){if(!Ti.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Si(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Di=/*@__PURE__*/ A(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ti,I.init(e,t),e._zod.check=n=>{Ei(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Oi=/*@__PURE__*/ A(`$ZodE164`,(e,t)=>{t.pattern??=fr,I.init(e,t)});function ki(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Ai=/*@__PURE__*/ A(`$ZodJWT`,(e,t)=>{I.init(e,t),e._zod.check=n=>{ki(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ji=/*@__PURE__*/ A(`$ZodNumber`,(e,t)=>{F.init(e,t),e._zod.pattern=xr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Mi=/*@__PURE__*/ A(`$ZodNumberFormat`,(e,t)=>{kr.init(e,t),ji.init(e,t)}),Ni=/*@__PURE__*/ A(`$ZodUnknown`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),Pi=/*@__PURE__*/ A(`$ZodNever`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Fi(e,t){let n=Yt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Yt(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Xt(n.issues,t,e),n}}return i(n,a)}}const Ii=e=>Array.isArray(e)?e.length:-1;function Li(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}const Ri=/*@__PURE__*/ A(`$ZodArray`,(e,t)=>{F.init(e,t);let n=M.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Li(t,r,e)));else if(Li(c,r,e),s&&c.issues.length!==0&&w(c))break}return o.length?Promise.all(o).then(()=>r):r},Fi(e,Ii)});function zi(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...T(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const Bi=[];function Vi(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Bi,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Ft(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Hi(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(w(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>zi(e,n,i,t,d,f))):zi(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const Ui=/*@__PURE__*/ A(`$ZodObject`,(e,t)=>{F.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=_t(()=>Vi(t));k(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||v(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Ot,o=t.catchall,s,c=M.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(w(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>zi(n,t,e,r,a,o))):zi(s,t,e,r,a,o)}return o?Hi(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Wi=/*@__PURE__*/ A(`$ZodObjectJIT`,(e,t)=>{Ui.init(e,t);let n=e._zod.parse,r=_t(()=>Vi(t)),i=M.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Vr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
14
14
  let ${e}_ab = false;
15
15
  for (let i = 0; i < ${e}.issues.length; i++) {
16
16
  const iss = ${e}.issues[i];
@@ -21,7 +21,7 @@ function M(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=
21
21
  if (${e}_ab && ctx && ctx.abortEarly) {
22
22
  payload.value = newResult;
23
23
  return payload;
24
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:bt(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
24
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Tt(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
25
25
  const ${n}_present = ${i};
26
26
  if (!${n}.issues.length || ${n}_present) {
27
27
  if (${n}.issues.length) {${c(n,r)}
@@ -60,66 +60,66 @@ function M(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=
60
60
  newResult[${r}] = ${n}.value;
61
61
  }
62
62
 
63
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Ct,c=!P.jitless,l=c&&wt.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Ii([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function zi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!D(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>O(e,r,F())))}),t)}const Bi=/*@__PURE__*/ M(`$ZodUnion`,(e,t)=>{L.init(e,t),j(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),j(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),j(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),j(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>mt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>zi(t,r,e,i)):zi(o,r,e,i)}}),Vi=/*@__PURE__*/ M(`$ZodIntersection`,(e,t)=>{L.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ui(e,t,n)):Ui(e,i,a)}});function Hi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(C(e)&&C(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Hi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=Hi(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ui(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Hi(t.value,n.value);if(!c.valid){if(D(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Wi=/*@__PURE__*/ M(`$ZodRecord`,(e,t)=>{L.init(e,t);let n=P.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!C(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>O(e,i,F())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Vt(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Vt(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&hr.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>O(e,i,F())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Vt(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Vt(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Gi=/*@__PURE__*/ M(`$ZodEnum`,(e,t)=>{L.init(e,t);let n=ct(t.entries),r=new Set(n);e._zod.values=r,j(e,`pattern`,e=>{let t=ct(e.def.entries).filter(e=>Et.has(typeof e));return RegExp(t.length?`^(${t.map(e=>w(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ki=/*@__PURE__*/ M(`$ZodLiteral`,(e,t)=>{L.init(e,t);let n=new Set(t.values);e._zod.values=n,j(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?w(e):e?w(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),qi=/*@__PURE__*/ M(`$ZodTransform`,(e,t)=>{L.init(e,t),e._zod.optin=`optional`,P.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new un(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new N;return n.value=i,n}});function Ji(e,t){return e.value=t.issues.length?void 0:t.value,e}const Yi=/*@__PURE__*/ M(`$ZodOptional`,(e,t)=>{L.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,j(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),j(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${mt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Ji(e,t)):Ji(e,r)}return t.innerType._zod.run(e,n)}}),Xi=/*@__PURE__*/ M(`$ZodExactOptional`,(e,t)=>{Yi.init(e,t),j(e,`values`,e=>e.def.innerType._zod.values),j(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Zi=/*@__PURE__*/ M(`$ZodNullable`,(e,t)=>{L.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin),j(e,`optout`,e=>e.def.innerType._zod.optout),j(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${mt(t.source)}|null)$`):void 0}),j(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Qi=/*@__PURE__*/ M(`$ZodDefault`,(e,t)=>{L.init(e,t),e._zod.optin=`defaulted`,j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>$i(e,t)):$i(r,t)}});function $i(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ea=/*@__PURE__*/ M(`$ZodPrefault`,(e,t)=>{L.init(e,t),e._zod.optin=`defaulted`,j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ta=/*@__PURE__*/ M(`$ZodNonOptional`,(e,t)=>{L.init(e,t),j(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>na(t,e)):na(i,e)}});function na(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ra(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>O(e,r,F()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const ia=/*@__PURE__*/ M(`$ZodCatch`,(e,t)=>{L.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),j(e,`optout`,e=>e.def.innerType._zod.optout),j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ra(e,r,t,n)):ra(e,r,t,n)}}),aa=/*@__PURE__*/ M(`$ZodPipe`,(e,t)=>{L.init(e,t),j(e,`values`,e=>e.def.in._zod.values),j(e,`optin`,e=>e.def.in._zod.optin),j(e,`optout`,e=>e.def.out._zod.optout),j(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>oa(e,t.in,n)):oa(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>oa(e,t.out,n)):oa(r,t.out,n)}});function oa(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const sa=/*@__PURE__*/ M(`$ZodReadonly`,(e,t)=>{L.init(e,t),j(e,`propValues`,e=>e.def.innerType._zod.propValues),j(e,`values`,e=>e.def.innerType._zod.values),j(e,`optin`,e=>e.def.innerType?._zod?.optin),j(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ca):ca(r)}});function ca(e){return e.memo||(e.value=Object.freeze(e.value)),e}const la=/*@__PURE__*/ M(`$ZodCustom`,(e,t)=>{I.init(e,t),L.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ua(t,n,r,e));ua(i,n,r,e)}});function ua(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Yt(e))}}var da=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const fa=`~memo`,pa=[];function ma(e){return typeof e==`object`&&!!e}function ha(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const ga=/*@__PURE__*/ new WeakMap;function _a(e,t,n){let r=ga.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=_a(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?_a(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=gt(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?_a(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),va(e,i)}function va(e,t){return t!==1&&ga.set(e,t===2),t}function ya(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let ba;const xa=[],Sa={alloc(e,t,n){let r=ba;if(!r)return n;ba=void 0;let i={value:n,issues:null};return r.set(t.value,i),xa.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&wa(n,e.value))throw new da;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=_a(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!ma(l))return t(s,c);let u=c[fa];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[fa]=u);let d;i===c?d=a:(d=ya(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ha(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;ba=d;let p=xa.length,m=t(s,c);ba=void 0;let h=xa.length>p?xa.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ha(e.issues):pa),e)):(h&&(h.issues=m.issues.length?ha(m.issues):pa),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ca(){return Sa}function wa(e,t){let n=e[fa]?.backEdges;return n!==void 0&&ma(t)&&n.has(t)}const Ta=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Jt(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Dt(e.values[0])}`:`Invalid option: expected one of ${lt(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${lt(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ea(){return{localeError:Ta()}}var Da,Oa=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ka(){return new Oa}(Da=globalThis).__zod_globalRegistry??(Da.__zod_globalRegistry=ka());const Aa=globalThis.__zod_globalRegistry;function ja(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
64
- function Ma(e,t){return new e(ja({type:`string`,...E(t)}))}// @__NO_SIDE_EFFECTS__
65
- function Na(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
66
- function Pa(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
67
- function Fa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
68
- function Ia(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...E(t)})}// @__NO_SIDE_EFFECTS__
69
- function La(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...E(t)})}// @__NO_SIDE_EFFECTS__
70
- function Ra(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...E(t)})}// @__NO_SIDE_EFFECTS__
71
- function za(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
72
- function Ba(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
73
- function Va(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
74
- function Ha(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
75
- function Ua(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
76
- function Wa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
77
- function Ga(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
78
- function Ka(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
79
- function qa(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
80
- function Ja(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
81
- function Ya(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
82
- function Xa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
83
- function Za(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
84
- function Qa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
85
- function $a(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
86
- function eo(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...E(t)})}// @__NO_SIDE_EFFECTS__
87
- function to(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...E(t)})}// @__NO_SIDE_EFFECTS__
88
- function no(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...E(t)})}// @__NO_SIDE_EFFECTS__
89
- function ro(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...E(t)})}// @__NO_SIDE_EFFECTS__
90
- function io(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...E(t)})}// @__NO_SIDE_EFFECTS__
91
- function ao(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...E(t)})}// @__NO_SIDE_EFFECTS__
92
- function oo(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
93
- function so(e,t){return new e({type:`never`,...E(t)})}// @__NO_SIDE_EFFECTS__
94
- function co(e,t){return new br({check:`less_than`,...E(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
95
- function lo(e,t){return new br({check:`less_than`,...E(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
96
- function uo(e,t){return new xr({check:`greater_than`,...E(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
97
- function fo(e,t){return new xr({check:`greater_than`,...E(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
98
- function po(e,t){return new Sr({check:`multiple_of`,...E(t),value:e})}// @__NO_SIDE_EFFECTS__
99
- function mo(e,t){return new wr({check:`max_length`,...E(t),maximum:e})}// @__NO_SIDE_EFFECTS__
100
- function ho(e,t){return new Tr({check:`min_length`,...E(t),minimum:e})}// @__NO_SIDE_EFFECTS__
101
- function go(e,t){return new Er({check:`length_equals`,...E(t),length:e})}// @__NO_SIDE_EFFECTS__
102
- function _o(e,t){return new Or({check:`string_format`,format:`regex`,...E(t),pattern:e})}// @__NO_SIDE_EFFECTS__
103
- function vo(e){return new kr({check:`string_format`,format:`lowercase`,...E(e)})}// @__NO_SIDE_EFFECTS__
104
- function yo(e){return new Ar({check:`string_format`,format:`uppercase`,...E(e)})}// @__NO_SIDE_EFFECTS__
105
- function bo(e,t){return new jr({check:`string_format`,format:`includes`,...E(t),includes:e})}// @__NO_SIDE_EFFECTS__
106
- function xo(e,t){return new Mr({check:`string_format`,format:`starts_with`,...E(t),prefix:e})}// @__NO_SIDE_EFFECTS__
107
- function So(e,t){return new Nr({check:`string_format`,format:`ends_with`,...E(t),suffix:e})}// @__NO_SIDE_EFFECTS__
108
- function z(e){return new Pr({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
109
- function Co(e){return/* @__PURE__ */ z(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
110
- function wo(){return/* @__PURE__ */ z(e=>e.trim())}// @__NO_SIDE_EFFECTS__
111
- function To(){return/* @__PURE__ */ z(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
112
- function Eo(){return/* @__PURE__ */ z(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
113
- function Do(){return/* @__PURE__ */ z(e=>xt(e))}// @__NO_SIDE_EFFECTS__
114
- function Oo(e,t,n){return new e({type:`array`,element:t,...E(n)})}// @__NO_SIDE_EFFECTS__
115
- function ko(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...E(n)})}// @__NO_SIDE_EFFECTS__
116
- function Ao(e,t){let n=/* @__PURE__ */ jo(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Yt(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Yt(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
117
- function jo(e,t){let n=new I({check:`custom`,...E(t)});return n._zod.check=e,n}function Mo(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&y(e,t,n[t]);return e}function No(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??Aa,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function B(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function V(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,V(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Mo(o.schema,c),t.io===`input`&&H(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Po(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Fo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Po(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Po(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
63
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Ot,c=!M.jitless,l=c&&kt.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Hi([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Gi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!w(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>E(e,r,N())))}),t)}const Ki=/*@__PURE__*/ A(`$ZodUnion`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),k(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),k(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),k(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>yt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Gi(t,r,e,i)):Gi(o,r,e,i)}}),qi=/*@__PURE__*/ A(`$ZodIntersection`,(e,t)=>{F.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Yi(e,t,n)):Yi(e,i,a)}});function Ji(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(At(e)&&At(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Ji(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=Ji(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Yi(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Ji(t.value,n.value);if(!c.valid){if(w(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Xi=/*@__PURE__*/ A(`$ZodRecord`,(e,t)=>{F.init(e,t);let n=M.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!At(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>E(e,i,N())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...T(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...T(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&xr.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>E(e,i,N())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...T(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...T(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Zi=/*@__PURE__*/ A(`$ZodEnum`,(e,t)=>{F.init(e,t);let n=pt(t.entries),r=new Set(n);e._zod.values=r,k(e,`pattern`,e=>{let t=pt(e.def.entries).filter(e=>Mt.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Nt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Qi=/*@__PURE__*/ A(`$ZodLiteral`,(e,t)=>{F.init(e,t);let n=new Set(t.values);e._zod.values=n,k(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Nt(e):e?Nt(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),$i=/*@__PURE__*/ A(`$ZodTransform`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,M.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new gn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new j;return n.value=i,n}});function ea(e,t){return e.value=t.issues.length?void 0:t.value,e}const ta=/*@__PURE__*/ A(`$ZodOptional`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${yt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ea(e,t)):ea(e,r)}return t.innerType._zod.run(e,n)}}),na=/*@__PURE__*/ A(`$ZodExactOptional`,(e,t)=>{ta.init(e,t),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ra=/*@__PURE__*/ A(`$ZodNullable`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${yt(t.source)}|null)$`):void 0}),k(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ia=/*@__PURE__*/ A(`$ZodDefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>aa(e,t)):aa(r,t)}});function aa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const oa=/*@__PURE__*/ A(`$ZodPrefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),sa=/*@__PURE__*/ A(`$ZodNonOptional`,(e,t)=>{F.init(e,t),k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ca(t,e)):ca(i,e)}});function ca(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function la(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>E(e,r,N()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const ua=/*@__PURE__*/ A(`$ZodCatch`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>la(e,r,t,n)):la(e,r,t,n)}}),da=/*@__PURE__*/ A(`$ZodPipe`,(e,t)=>{F.init(e,t),k(e,`values`,e=>e.def.in._zod.values),k(e,`optin`,e=>e.def.in._zod.optin),k(e,`optout`,e=>e.def.out._zod.optout),k(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>fa(e,t.in,n)):fa(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>fa(e,t.out,n)):fa(r,t.out,n)}});function fa(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const pa=/*@__PURE__*/ A(`$ZodReadonly`,(e,t)=>{F.init(e,t),k(e,`propValues`,e=>e.def.innerType._zod.propValues),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`optin`,e=>e.def.innerType?._zod?.optin),k(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ma):ma(r)}});function ma(e){return e.memo||(e.value=Object.freeze(e.value)),e}const ha=/*@__PURE__*/ A(`$ZodCustom`,(e,t)=>{P.init(e,t),F.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ga(t,n,r,e));ga(i,n,r,e)}});function ga(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(tn(e))}}var _a=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const va=`~memo`,ya=[];function ba(e){return typeof e==`object`&&!!e}function xa(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Sa=/*@__PURE__*/ new WeakMap;function Ca(e,t,n){let r=Sa.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=Ca(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?Ca(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=xt(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ca(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),wa(e,i)}function wa(e,t){return t!==1&&Sa.set(e,t===2),t}function Ta(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let Ea;const Da=[],Oa={alloc(e,t,n){let r=Ea;if(!r)return n;Ea=void 0;let i={value:n,issues:null};return r.set(t.value,i),Da.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Aa(n,e.value))throw new _a;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ca(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!ba(l))return t(s,c);let u=c[va];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[va]=u);let d;i===c?d=a:(d=Ta(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...xa(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;Ea=d;let p=Da.length,m=t(s,c);Ea=void 0;let h=Da.length>p?Da.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?xa(e.issues):ya),e)):(h&&(h.issues=m.issues.length?xa(m.issues):ya),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function ka(){return Oa}function Aa(e,t){let n=e[va]?.backEdges;return n!==void 0&&ba(t)&&n.has(t)}const ja=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(en(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Pt(e.values[0])}`:`Invalid option: expected one of ${mt(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${mt(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ma(){return{localeError:ja()}}var Na,Pa=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Fa(){return new Pa}(Na=globalThis).__zod_globalRegistry??(Na.__zod_globalRegistry=Fa());const Ia=globalThis.__zod_globalRegistry;function La(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
64
+ function Ra(e,t){return new e(La({type:`string`,...C(t)}))}// @__NO_SIDE_EFFECTS__
65
+ function za(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
66
+ function Ba(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
67
+ function Va(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
68
+ function Ha(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...C(t)})}// @__NO_SIDE_EFFECTS__
69
+ function Ua(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...C(t)})}// @__NO_SIDE_EFFECTS__
70
+ function Wa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...C(t)})}// @__NO_SIDE_EFFECTS__
71
+ function Ga(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
72
+ function Ka(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
73
+ function qa(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
74
+ function Ja(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
75
+ function Ya(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
76
+ function Xa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
77
+ function Za(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
78
+ function Qa(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
79
+ function $a(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
80
+ function eo(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
81
+ function to(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
82
+ function no(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
83
+ function ro(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
84
+ function io(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
85
+ function ao(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
86
+ function oo(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...C(t)})}// @__NO_SIDE_EFFECTS__
87
+ function so(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...C(t)})}// @__NO_SIDE_EFFECTS__
88
+ function co(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...C(t)})}// @__NO_SIDE_EFFECTS__
89
+ function lo(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...C(t)})}// @__NO_SIDE_EFFECTS__
90
+ function uo(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...C(t)})}// @__NO_SIDE_EFFECTS__
91
+ function fo(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...C(t)})}// @__NO_SIDE_EFFECTS__
92
+ function po(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
93
+ function mo(e,t){return new e({type:`never`,...C(t)})}// @__NO_SIDE_EFFECTS__
94
+ function ho(e,t){return new Er({check:`less_than`,...C(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
95
+ function go(e,t){return new Er({check:`less_than`,...C(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
96
+ function _o(e,t){return new Dr({check:`greater_than`,...C(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
97
+ function vo(e,t){return new Dr({check:`greater_than`,...C(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
98
+ function yo(e,t){return new Or({check:`multiple_of`,...C(t),value:e})}// @__NO_SIDE_EFFECTS__
99
+ function bo(e,t){return new Ar({check:`max_length`,...C(t),maximum:e})}// @__NO_SIDE_EFFECTS__
100
+ function xo(e,t){return new jr({check:`min_length`,...C(t),minimum:e})}// @__NO_SIDE_EFFECTS__
101
+ function So(e,t){return new Mr({check:`length_equals`,...C(t),length:e})}// @__NO_SIDE_EFFECTS__
102
+ function Co(e,t){return new Pr({check:`string_format`,format:`regex`,...C(t),pattern:e})}// @__NO_SIDE_EFFECTS__
103
+ function wo(e){return new Fr({check:`string_format`,format:`lowercase`,...C(e)})}// @__NO_SIDE_EFFECTS__
104
+ function To(e){return new Ir({check:`string_format`,format:`uppercase`,...C(e)})}// @__NO_SIDE_EFFECTS__
105
+ function Eo(e,t){return new Lr({check:`string_format`,format:`includes`,...C(t),includes:e})}// @__NO_SIDE_EFFECTS__
106
+ function Do(e,t){return new Rr({check:`string_format`,format:`starts_with`,...C(t),prefix:e})}// @__NO_SIDE_EFFECTS__
107
+ function Oo(e,t){return new zr({check:`string_format`,format:`ends_with`,...C(t),suffix:e})}// @__NO_SIDE_EFFECTS__
108
+ function L(e){return new Br({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
109
+ function ko(e){return/* @__PURE__ */ L(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
110
+ function Ao(){return/* @__PURE__ */ L(e=>e.trim())}// @__NO_SIDE_EFFECTS__
111
+ function jo(){return/* @__PURE__ */ L(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
112
+ function Mo(){return/* @__PURE__ */ L(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
113
+ function No(){return/* @__PURE__ */ L(e=>Et(e))}// @__NO_SIDE_EFFECTS__
114
+ function Po(e,t,n){return new e({type:`array`,element:t,...C(n)})}// @__NO_SIDE_EFFECTS__
115
+ function Fo(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...C(n)})}// @__NO_SIDE_EFFECTS__
116
+ function Io(e,t){let n=/* @__PURE__ */ Lo(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(tn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(tn(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
117
+ function Lo(e,t){let n=new P({check:`custom`,...C(t)});return n._zod.check=e,n}function Ro(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&v(e,t,n[t]);return e}function zo(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??Ia,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function R(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function z(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,z(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ro(o.schema,c),t.io===`input`&&B(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Bo(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Vo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Bo(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Bo(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
118
118
 
119
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Io(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Io(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const Lo=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Ro=[`oneOf`,`anyOf`];function zo(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Bo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Lo.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??zo(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}y(n,r,e.length===1?e[0]:Bo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=zo(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Vo(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Lo)if(t in e)return;let n=t.filter(e=>Ro.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Bo(t);else{let e=n[0],i=Ro.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Bo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Mo(e,r))}function Ho(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Mo(i,s),Mo(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Io(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Vo(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Mo(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,y(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Wo(t,`input`,e.processors),output:Wo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function H(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return H(r.element,n);if(r.type===`set`)return H(r.valueType,n);if(r.type===`lazy`)return H(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return H(r.innerType,n);if(r.type===`intersection`)return H(r.left,n)||H(r.right,n);if(r.type===`record`||r.type===`map`)return H(r.keyType,n)||H(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:H(r.in,n)||H(r.out,n);if(r.type===`object`){for(let e in r.shape)if(H(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(H(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(H(e,n))return!0;return!!(r.rest&&H(r.rest,n))}return!1}const Uo=(e,t={})=>n=>{let r=No({...n,processors:t});return V(e,r),Fo(r,e),Ho(r,e)},Wo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=No({...i??{},target:a,io:t,processors:n});return V(e,o),Fo(o,e),Ho(o,e)},U=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Go=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ko=(e,t)=>{U(e,`minimum`,t),Go(e,`maximum`,t)},qo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Jo=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},Yo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Xo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Zo=(e,t)=>U(e,`minimum`,t.minimum),Qo=(e,t)=>Go(e,`maximum`,t.maximum),$o=e=>(t,n)=>{Xo(t,n.format);let[r,i]=e[n.format];U(t,`minimum`,r),Go(t,`maximum`,i)},es={greater_than:(e,t)=>U(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Go(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>qo(e,t.value),number_format:$o(kt),bigint_format:$o(At),min_length:Zo,max_length:Qo,length_equals:(e,t)=>Ko(e,t.length),min_size:Zo,max_size:Qo,size_equals:(e,t)=>Ko(e,t.size),string_format:(e,t)=>{Xo(e,t.format),t.pattern&&Jo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Yo(e,t.mime)};function W(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)es[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&U(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&U(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Go(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Go(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&qo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Yo(t,i.mime);for(let e of i.patterns??[])Jo(t,e);return t}const ts={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ns=/* @__PURE__ */ new Map([[_i,rr],[yi,ir]]),rs=e=>ns.get(e)??e,is=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=W(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ts[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(rs);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},as=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=W(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):B(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},os=(e,t,n,r)=>{n.not={}},ss=(e,t,n,r)=>{let i=ct(e._zod.def.entries);i.length===0?n.not={}:(i.every(e=>typeof e==`number`)&&(n.type=`number`),i.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=i)},cs=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(B(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(B(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ls=(e,t,n,r)=>{B(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},us=(e,t,n,r)=>{B(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ds=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=W(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=V(a.element,t,{...r,path:[...r.path,`items`]})};function fs(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?fs(t.out):t.type===`catch`?fs(t.innerType):e._zod.optin}const ps=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&B(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)y(i.properties,e,V(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?fs(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=V(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ms=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>V(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},hs=(e,t,n,r)=>{let i=e._zod.def,a=V(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=V(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function gs(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=gs(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>gs(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?hr:mr).source)),p}const _s=/* @__PURE__ */ new WeakMap;function vs(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of _s.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=gs(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const ys=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=W(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=V(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)y(i.patternProperties,rs(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=V(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=_s.get(t);n||(n=[],_s.set(t,n),t.deferred.push(()=>vs(t))),n.push(e)}i.additionalProperties=V(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&fs(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},bs=(e,t,n,r)=>{let i=e._zod.def,a=V(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},xs=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ss=Symbol();function Cs(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(B(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ss):JSON.parse(o)}const ws=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Cs(i.defaultValue,e,t,n,r);o!==Ss&&(n.default=o)},Ts=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Cs(i.defaultValue,e,t,n,r);o!==Ss&&(n._prefault=o)},Es=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{B(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ds=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;V(o,t,r);let s=t.seen.get(e);s.ref=o},Os=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ks=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},As=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function js(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const G=/*@__PURE__*/ M(`ZodError`,(e,t)=>{gn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);As.has(n)||(As.add(n),js(n,`format`,e=>t=>yn(e,t)),js(n,`flatten`,e=>t=>vn(e,t)),js(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ut,2)}),js(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ut,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Ms=/* @__PURE__ */ Cn(G),Ns=/* @__PURE__ */ wn(G),Ps=/* @__PURE__ */ Tn(G),Fs=/* @__PURE__ */ Dn(G),Is=/* @__PURE__ */ Nn(G),Ls=/* @__PURE__ */ Pn(G),Rs=/* @__PURE__ */ Fn(G),zs=/* @__PURE__ */ In(G),Bs=/* @__PURE__ */ Ln(G),Vs=/* @__PURE__ */ Rn(G),Hs=/* @__PURE__ */ zn(G),Us=/* @__PURE__ */ Bn(G);function Ws(){P.localeError||F(Ea())}function Gs(){P.memoizer||F({memoizer:Ca()})}const K=/*@__PURE__*/ M(`ZodType`,(e,t)=>(Ws(),L.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(S(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return T(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(sl(e,t))},superRefine(e,t){return this.check(cl(e,t))},overwrite(e){return this.check(/* @__PURE__ */ z(e))},optional(){return Uc(this)},exactOptional(){return Gc(this)},nullable(){return qc(this)},nullish(){return Uc(qc(this))},nonoptional(e){return $c(this,e)},array(){return Dc(this)},or(e){return jc([this,e])},and(e){return Nc(this,e)},transform(e){return rl(this,Vc(e))},default(e){return Yc(this,e)},prefault(e){return Zc(this,e)},catch(e){return tl(this,e)},pipe(e){return rl(this,e)},readonly(){return al(this)},describe(e){let t=this.clone();return Aa.add(t,{description:e}),t},meta(...e){if(e.length===0)return Aa.get(this);let t=this.clone();return Aa.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 Zt(this,`~standard`,{...zr(this),jsonSchema:{input:Wo(this,`input`),output:Wo(this,`output`)}})},set"~standard"(e){k(this,`~standard`,e)},parse:function e(t,n){return Ms(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ns(this,t,n,{callee:e})},safeParse(e,t){return Ps(this,e,t)},async safeParseAsync(e,t){return Fs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){k(this,`spa`,e)},validate(e,t){return An(this,e,t)},validateAsync(e,t){return Mn(this,e,t)},encode:function e(t,n){return Is(this,t,n,{callee:e})},decode:function e(t,n){return Ls(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Rs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await zs(this,t,n,{callee:e})},safeEncode(e,t){return Bs(this,e,t)},safeDecode(e,t){return Vs(this,e,t)},async safeEncodeAsync(e,t){return Hs(this,e,t)},async safeDecodeAsync(e,t){return Us(this,e,t)},toJSONSchema(e){return Uo(this,{})(e)},get description(){return Aa.get(this)?.description},get _def(){return this._zod.def}}),Ks=/*@__PURE__*/ M(`_ZodString`,(e,t)=>{Br.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r)},/*@__PURE__*/ Qt({format:e=>W(e).format??null,minLength:e=>W(e).minimum??null,maxLength:e=>W(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ _o(...e))},includes(...e){return this.check(/* @__PURE__ */ bo(...e))},startsWith(...e){return this.check(/* @__PURE__ */ xo(...e))},endsWith(...e){return this.check(/* @__PURE__ */ So(...e))},min(...e){return this.check(/* @__PURE__ */ ho(...e))},max(...e){return this.check(/* @__PURE__ */ mo(...e))},length(...e){return this.check(/* @__PURE__ */ go(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ho(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ vo(e))},uppercase(e){return this.check(/* @__PURE__ */ yo(e))},trim(){return this.check(/* @__PURE__ */ wo())},normalize(...e){return this.check(/* @__PURE__ */ Co(...e))},toLowerCase(){return this.check(/* @__PURE__ */ To())},toUpperCase(){return this.check(/* @__PURE__ */ Eo())},slugify(){return this.check(/* @__PURE__ */ Do())}})),qs=/*@__PURE__*/ M(`ZodString`,(e,t)=>{Br.init(e,t),Ks.init(e,t)},{email(e){return this.check(/* @__PURE__ */ Na($s,e))},url(e){return this.check(/* @__PURE__ */ za(nc,e))},jwt(e){return this.check(/* @__PURE__ */ eo(vc,e))},emoji(e){return this.check(/* @__PURE__ */ Ba(ic,e))},guid(e){return this.check(/* @__PURE__ */ Pa(ec,e))},uuid(e){return this.check(/* @__PURE__ */ Fa(tc,e))},uuidv4(e){return this.check(/* @__PURE__ */ Ia(tc,e))},uuidv6(e){return this.check(/* @__PURE__ */ La(tc,e))},uuidv7(e){return this.check(/* @__PURE__ */ Ra(tc,e))},nanoid(e){return this.check(/* @__PURE__ */ Va(ac,e))},cuid(e){return this.check(/* @__PURE__ */ Ha(oc,e))},cuid2(e){return this.check(/* @__PURE__ */ Ua(sc,e))},ulid(e){return this.check(/* @__PURE__ */ Wa(cc,e))},base64(e){return this.check(/* @__PURE__ */ Za(hc,e))},base64url(e){return this.check(/* @__PURE__ */ Qa(gc,e))},xid(e){return this.check(/* @__PURE__ */ Ga(lc,e))},ksuid(e){return this.check(/* @__PURE__ */ Ka(uc,e))},ipv4(e){return this.check(/* @__PURE__ */ qa(dc,e))},ipv6(e){return this.check(/* @__PURE__ */ Ja(fc,e))},cidrv4(e){return this.check(/* @__PURE__ */ Ya(pc,e))},cidrv6(e){return this.check(/* @__PURE__ */ Xa(mc,e))},e164(e){return this.check(/* @__PURE__ */ $a(_c,e))},datetime(e){return this.check(/* @__PURE__ */ to(Ys,e))},date(e){return this.check(/* @__PURE__ */ no(Xs,e))},time(e){return this.check(/* @__PURE__ */ ro(Zs,e))},duration(e){return this.check(/* @__PURE__ */ io(Qs,e))}});function Js(e){return/* @__PURE__ */ Ma(qs,e)}const q=/*@__PURE__*/ M(`ZodStringFormat`,(e,t)=>{R.init(e,t),Ks.init(e,t)}),Ys=/*@__PURE__*/ M(`ZodISODateTime`,(e,t)=>{ai.init(e,t),q.init(e,t)}),Xs=/*@__PURE__*/ M(`ZodISODate`,(e,t)=>{oi.init(e,t),q.init(e,t)}),Zs=/*@__PURE__*/ M(`ZodISOTime`,(e,t)=>{si.init(e,t),q.init(e,t)}),Qs=/*@__PURE__*/ M(`ZodISODuration`,(e,t)=>{ci.init(e,t),q.init(e,t)}),$s=/*@__PURE__*/ M(`ZodEmail`,(e,t)=>{Ur.init(e,t),q.init(e,t)}),ec=/*@__PURE__*/ M(`ZodGUID`,(e,t)=>{Vr.init(e,t),q.init(e,t)}),tc=/*@__PURE__*/ M(`ZodUUID`,(e,t)=>{Hr.init(e,t),q.init(e,t)}),nc=/*@__PURE__*/ M(`ZodURL`,(e,t)=>{Zr.init(e,t),q.init(e,t)});function rc(e){return/* @__PURE__ */ za(nc,e)}const ic=/*@__PURE__*/ M(`ZodEmoji`,(e,t)=>{Qr.init(e,t),q.init(e,t)}),ac=/*@__PURE__*/ M(`ZodNanoID`,(e,t)=>{$r.init(e,t),q.init(e,t)}),oc=/*@__PURE__*/ M(`ZodCUID`,(e,t)=>{ei.init(e,t),q.init(e,t)}),sc=/*@__PURE__*/ M(`ZodCUID2`,(e,t)=>{ti.init(e,t),q.init(e,t)}),cc=/*@__PURE__*/ M(`ZodULID`,(e,t)=>{ni.init(e,t),q.init(e,t)}),lc=/*@__PURE__*/ M(`ZodXID`,(e,t)=>{ri.init(e,t),q.init(e,t)}),uc=/*@__PURE__*/ M(`ZodKSUID`,(e,t)=>{ii.init(e,t),q.init(e,t)}),dc=/*@__PURE__*/ M(`ZodIPv4`,(e,t)=>{li.init(e,t),q.init(e,t)}),fc=/*@__PURE__*/ M(`ZodIPv6`,(e,t)=>{fi.init(e,t),q.init(e,t)}),pc=/*@__PURE__*/ M(`ZodCIDRv4`,(e,t)=>{pi.init(e,t),q.init(e,t)}),mc=/*@__PURE__*/ M(`ZodCIDRv6`,(e,t)=>{hi.init(e,t),q.init(e,t)}),hc=/*@__PURE__*/ M(`ZodBase64`,(e,t)=>{vi.init(e,t),q.init(e,t)}),gc=/*@__PURE__*/ M(`ZodBase64URL`,(e,t)=>{xi.init(e,t),q.init(e,t)}),_c=/*@__PURE__*/ M(`ZodE164`,(e,t)=>{Si.init(e,t),q.init(e,t)}),vc=/*@__PURE__*/ M(`ZodJWT`,(e,t)=>{wi.init(e,t),q.init(e,t)}),yc=/*@__PURE__*/ M(`ZodNumber`,(e,t)=>{Ti.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ Qt({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=W(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=W(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=W(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>W(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ uo(e,t))},gte(e,t){return this.check(/* @__PURE__ */ fo(e,t))},min(e,t){return this.check(/* @__PURE__ */ fo(e,t))},lt(e,t){return this.check(/* @__PURE__ */ co(e,t))},lte(e,t){return this.check(/* @__PURE__ */ lo(e,t))},max(e,t){return this.check(/* @__PURE__ */ lo(e,t))},int(e){return this.check(xc(e))},safe(e){return this.check(xc(e))},positive(e){return this.check(/* @__PURE__ */ uo(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ fo(0,e))},negative(e){return this.check(/* @__PURE__ */ co(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ lo(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ po(e,t))},step(e,t){return this.check(/* @__PURE__ */ po(e,t))},finite(){return this}})),bc=/*@__PURE__*/ M(`ZodNumberFormat`,(e,t)=>{Ei.init(e,t),yc.init(e,t)});function xc(e){return/* @__PURE__ */ ao(bc,e)}const Sc=/*@__PURE__*/ M(`ZodUnknown`,(e,t)=>{Di.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Cc(){return/* @__PURE__ */ oo(Sc)}const wc=/*@__PURE__*/ M(`ZodNever`,(e,t)=>{Oi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r)});function Tc(e){return/* @__PURE__ */ so(wc,e)}const Ec=/*@__PURE__*/ M(`ZodArray`,(e,t)=>{Gs(),Mi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ ho(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ho(1,e))},max(e,t){return this.check(/* @__PURE__ */ mo(e,t))},length(e,t){return this.check(/* @__PURE__ */ go(e,t))},unwrap(){return this.element}});function Dc(e,t){return/* @__PURE__ */ Oo(Ec,e,t)}const Oc=/*@__PURE__*/ M(`ZodObject`,(e,t)=>{Gs(),Ri.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r),rn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Lc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(S(this._zod.def,{catchall:e}))},passthrough(){return this.clone(S(this._zod.def,{catchall:Cc()}))},loose(){return this.clone(S(this._zod.def,{catchall:Cc()}))},strict(){return this.clone(S(this._zod.def,{catchall:Tc()}))},strip(){return this.clone(S(this._zod.def,{catchall:void 0}))},extend(e){return Pt(this,e)},safeExtend(e){return It(this,e)},merge(e){return Lt(this,e)},pick(e){return jt(this,e)},omit(e){return Nt(this,e)},partial(...e){return Rt(Hc,this,e[0])},exactPartial(...e){return Rt(Wc,this,e[0],`exactPartial`)},required(...e){return zt(Qc,this,e[0])}});function kc(e,t){let n={type:`object`,shape:e??{},...E(t)};return new Oc(n)}const Ac=/*@__PURE__*/ M(`ZodUnion`,(e,t)=>{Bi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ms(e,t,n,r),e.options=t.options});function jc(e,t){return new Ac({type:`union`,options:e,...E(t)})}const Mc=/*@__PURE__*/ M(`ZodIntersection`,(e,t)=>{Vi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r)});function Nc(e,t){return new Mc({type:`intersection`,left:e,right:t})}const Pc=/*@__PURE__*/ M(`ZodRecord`,(e,t)=>{Gs(),Wi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Fc(e,t,n){return!t||!t._zod?new Pc({type:`record`,keyType:Js(),valueType:e,...E(t)}):new Pc({type:`record`,keyType:e,valueType:t,...E(n)})}const Ic=/*@__PURE__*/ M(`ZodEnum`,(e,t)=>{Gi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ic({...t,checks:[],...E(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ic({...t,checks:[],...E(r),entries:i})}});function Lc(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ic({type:`enum`,entries:n,...E(t)})}const Rc=/*@__PURE__*/ M(`ZodLiteral`,(e,t)=>{Ki.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cs(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function zc(e,t){return new Rc({type:`literal`,values:Array.isArray(e)?e:[e],...E(t)})}const Bc=/*@__PURE__*/ M(`ZodTransform`,(e,t)=>{Gs(),qi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new un(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Yt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Yt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Vc(e){return new Bc({type:`transform`,transform:e})}const Hc=/*@__PURE__*/ M(`ZodOptional`,(e,t)=>{Yi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Uc(e){return new Hc({type:`optional`,innerType:e})}const Wc=/*@__PURE__*/ M(`ZodExactOptional`,(e,t)=>{Xi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new Wc({type:`optional`,innerType:e})}const Kc=/*@__PURE__*/ M(`ZodNullable`,(e,t)=>{Zi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qc(e){return new Kc({type:`nullable`,innerType:e})}const Jc=/*@__PURE__*/ M(`ZodDefault`,(e,t)=>{Qi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Yc(e,t){return new Jc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Tt(t)}})}const Xc=/*@__PURE__*/ M(`ZodPrefault`,(e,t)=>{ea.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zc(e,t){return new Xc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Tt(t)}})}const Qc=/*@__PURE__*/ M(`ZodNonOptional`,(e,t)=>{ta.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $c(e,t){return new Qc({type:`nonoptional`,innerType:e,...E(t)})}const el=/*@__PURE__*/ M(`ZodCatch`,(e,t)=>{ia.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function tl(e,t){return new el({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:an(t)})}const nl=/*@__PURE__*/ M(`ZodPipe`,(e,t)=>{aa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r),e.in=t.in,e.out=t.out});function rl(e,t){return new nl({type:`pipe`,in:e,out:t})}const il=/*@__PURE__*/ M(`ZodReadonly`,(e,t)=>{sa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function al(e){return new il({type:`readonly`,innerType:e})}const ol=/*@__PURE__*/ M(`ZodCustom`,(e,t)=>{la.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r)});function sl(e,t={}){return/* @__PURE__ */ ko(ol,e,t)}function cl(e,t){return/* @__PURE__ */ Ao(e,t)}const ll=kc({darwinArm64:kc({platform:zc(`darwin`),arch:zc(`arm64`),pythonVersion:Js().regex(/^\d+\.\d+\.\d+$/u,`pythonVersion 必须是三段数字的版本号`),release:Js(),url:rc({protocol:/^https$/u}).describe(`托管资产只允许 https 下载:http/file 会让安装器去取明文或本机文件`),sha256:Js().regex(/^[0-9a-f]{64}$/u,`sha256 必须是 64 位小写十六进制`),sizeBytes:xc().positive()}),unsupported:Fc(Js(),Js())}),ul=n(g.join(import.meta.dirname,`runtime-manifest.json`))?import.meta.dirname:g.resolve(import.meta.dirname,`..`);function dl(e){let t;try{t=JSON.parse(e)}catch(e){throw Error(`runtime-manifest.json is invalid: ${String(e)}`,{cause:e})}let n=ll.safeParse(t);if(!n.success)throw Error(`runtime-manifest.json is invalid: ${xn(n.error)}`);return n.data}let fl;const pl=/^version\s*=\s*(?<version>\S+)\s*$/mu;function ml(){return g.join(ul,`runtime-manifest.json`)}function hl(e=ml()){try{return r(e,`utf8`)}catch(t){throw Error(`runtime-manifest.json is unreadable: ${e}`,{cause:t})}}function gl(){return fl??=dl(hl()),fl}const J={get darwinArm64(){return gl().darwinArm64},get unsupported(){return gl().unsupported}};function _l(e){return g.join(e,`runtime`,`python`,J.darwinArm64.pythonVersion,`bin`,`python3`)}function vl(e){let t=g.join(e,`runtime`,`venv`);return process.platform===`win32`?g.join(t,`Scripts`,`python.exe`):g.join(t,`bin`,`python3`)}function Y(n){try{return i(n).isFile()?(e(n,t.X_OK),!0):!1}catch{return!1}}function yl(e){return process.platform===`win32`?g.join(e,`_env`,`.venv`,`Scripts`,`python.exe`):g.join(e,`_env`,`.venv`,`bin`,`python`)}function bl(e){let t=g.join(e,`runtime`,`venv`,`pyvenv.cfg`),n;try{n=r(t,`utf8`)}catch{n=void 0}return(n===void 0?null:pl.exec(n))?.groups?.version}function xl(){let e;try{e=J.unsupported[`${process.platform}-${process.arch}`]}catch{
119
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ho(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ho(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const Uo=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Wo=[`oneOf`,`anyOf`];function Go(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ko(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Uo.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Go(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}v(n,r,e.length===1?e[0]:Ko(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Go(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function qo(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Uo)if(t in e)return;let n=t.filter(e=>Wo.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ko(t);else{let e=n[0],i=Wo.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ko([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ro(e,r))}function Jo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ro(i,s),Ro(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ho(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])qo(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ro(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,v(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Xo(t,`input`,e.processors),output:Xo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function B(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return B(r.element,n);if(r.type===`set`)return B(r.valueType,n);if(r.type===`lazy`)return B(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return B(r.innerType,n);if(r.type===`intersection`)return B(r.left,n)||B(r.right,n);if(r.type===`record`||r.type===`map`)return B(r.keyType,n)||B(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:B(r.in,n)||B(r.out,n);if(r.type===`object`){for(let e in r.shape)if(B(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(B(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(B(e,n))return!0;return!!(r.rest&&B(r.rest,n))}return!1}const Yo=(e,t={})=>n=>{let r=zo({...n,processors:t});return z(e,r),Vo(r,e),Jo(r,e)},Xo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=zo({...i??{},target:a,io:t,processors:n});return z(e,o),Vo(o,e),Jo(o,e)},V=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},H=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Zo=(e,t)=>{V(e,`minimum`,t),H(e,`maximum`,t)},Qo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},$o=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},es=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ts=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},ns=(e,t)=>V(e,`minimum`,t.minimum),rs=(e,t)=>H(e,`maximum`,t.maximum),is=e=>(t,n)=>{ts(t,n.format);let[r,i]=e[n.format];V(t,`minimum`,r),H(t,`maximum`,i)},as={greater_than:(e,t)=>V(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>H(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Qo(e,t.value),number_format:is(It),bigint_format:is(Lt),min_length:ns,max_length:rs,length_equals:(e,t)=>Zo(e,t.length),min_size:ns,max_size:rs,size_equals:(e,t)=>Zo(e,t.size),string_format:(e,t)=>{ts(e,t.format),t.pattern&&$o(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>es(e,t.mime)};function U(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)as[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&V(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&V(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&H(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&H(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Qo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&es(t,i.mime);for(let e of i.patterns??[])$o(t,e);return t}const os={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ss=/* @__PURE__ */ new Map([[Ci,lr],[Ti,ur]]),cs=e=>ss.get(e)??e,ls=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=U(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=os[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(cs);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},us=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=U(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):R(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},ds=(e,t,n,r)=>{n.not={}},fs=(e,t,n,r)=>{let i=pt(e._zod.def.entries);i.length===0?n.not={}:(i.every(e=>typeof e==`number`)&&(n.type=`number`),i.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=i)},ps=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(R(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(R(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ms=(e,t,n,r)=>{R(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},hs=(e,t,n,r)=>{R(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},gs=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=U(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=z(a.element,t,{...r,path:[...r.path,`items`]})};function _s(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?_s(t.out):t.type===`catch`?_s(t.innerType):e._zod.optin}const vs=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&R(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)v(i.properties,e,z(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?_s(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=z(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ys=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>z(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},bs=(e,t,n,r)=>{let i=e._zod.def,a=z(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=z(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function xs(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=xs(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>xs(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?xr:br).source)),p}const Ss=/* @__PURE__ */ new WeakMap;function Cs(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of Ss.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=xs(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const ws=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=U(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=z(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)v(i.patternProperties,cs(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=z(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ss.get(t);n||(n=[],Ss.set(t,n),t.deferred.push(()=>Cs(t))),n.push(e)}i.additionalProperties=z(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&_s(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ts=(e,t,n,r)=>{let i=e._zod.def,a=z(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Es=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ds=Symbol();function Os(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(R(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ds):JSON.parse(o)}const ks=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Os(i.defaultValue,e,t,n,r);o!==Ds&&(n.default=o)},As=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Os(i.defaultValue,e,t,n,r);o!==Ds&&(n._prefault=o)},js=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{R(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ms=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;z(o,t,r);let s=t.seen.get(e);s.ref=o},Ns=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ps=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fs=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function Is(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const W=/*@__PURE__*/ A(`ZodError`,(e,t)=>{Sn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Fs.has(n)||(Fs.add(n),Is(n,`format`,e=>t=>Tn(e,t)),Is(n,`flatten`,e=>t=>wn(e,t)),Is(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ht,2)}),Is(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ht,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Ls=/* @__PURE__ */ kn(W),Rs=/* @__PURE__ */ An(W),zs=/* @__PURE__ */ jn(W),Bs=/* @__PURE__ */ Nn(W),Vs=/* @__PURE__ */ zn(W),Hs=/* @__PURE__ */ Bn(W),Us=/* @__PURE__ */ Vn(W),Ws=/* @__PURE__ */ Hn(W),Gs=/* @__PURE__ */ Un(W),Ks=/* @__PURE__ */ Wn(W),qs=/* @__PURE__ */ Gn(W),Js=/* @__PURE__ */ Kn(W);function Ys(){M.localeError||N(Ma())}function Xs(){M.memoizer||N({memoizer:ka()})}const G=/*@__PURE__*/ A(`ZodType`,(e,t)=>(Ys(),F.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(x(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return S(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(dl(e,t))},superRefine(e,t){return this.check(fl(e,t))},overwrite(e){return this.check(/* @__PURE__ */ L(e))},optional(){return qc(this)},exactOptional(){return Yc(this)},nullable(){return Zc(this)},nullish(){return qc(Zc(this))},nonoptional(e){return rl(this,e)},array(){return jc(this)},or(e){return Fc([this,e])},and(e){return Lc(this,e)},transform(e){return sl(this,Gc(e))},default(e){return $c(this,e)},prefault(e){return tl(this,e)},catch(e){return al(this,e)},pipe(e){return sl(this,e)},readonly(){return ll(this)},describe(e){let t=this.clone();return Ia.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ia.get(this);let t=this.clone();return Ia.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 rn(this,`~standard`,{...Gr(this),jsonSchema:{input:Xo(this,`input`),output:Xo(this,`output`)}})},set"~standard"(e){D(this,`~standard`,e)},parse:function e(t,n){return Ls(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Rs(this,t,n,{callee:e})},safeParse(e,t){return zs(this,e,t)},async safeParseAsync(e,t){return Bs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){D(this,`spa`,e)},validate(e,t){return In(this,e,t)},validateAsync(e,t){return Rn(this,e,t)},encode:function e(t,n){return Vs(this,t,n,{callee:e})},decode:function e(t,n){return Hs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Us(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ws(this,t,n,{callee:e})},safeEncode(e,t){return Gs(this,e,t)},safeDecode(e,t){return Ks(this,e,t)},async safeEncodeAsync(e,t){return qs(this,e,t)},async safeDecodeAsync(e,t){return Js(this,e,t)},toJSONSchema(e){return Yo(this,{})(e)},get description(){return Ia.get(this)?.description},get _def(){return this._zod.def}}),Zs=/*@__PURE__*/ A(`_ZodString`,(e,t)=>{Kr.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r)},/*@__PURE__*/ an({format:e=>U(e).format??null,minLength:e=>U(e).minimum??null,maxLength:e=>U(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ Co(...e))},includes(...e){return this.check(/* @__PURE__ */ Eo(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Do(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Oo(...e))},min(...e){return this.check(/* @__PURE__ */ xo(...e))},max(...e){return this.check(/* @__PURE__ */ bo(...e))},length(...e){return this.check(/* @__PURE__ */ So(...e))},nonempty(...e){return this.check(/* @__PURE__ */ xo(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ wo(e))},uppercase(e){return this.check(/* @__PURE__ */ To(e))},trim(){return this.check(/* @__PURE__ */ Ao())},normalize(...e){return this.check(/* @__PURE__ */ ko(...e))},toLowerCase(){return this.check(/* @__PURE__ */ jo())},toUpperCase(){return this.check(/* @__PURE__ */ Mo())},slugify(){return this.check(/* @__PURE__ */ No())}})),Qs=/*@__PURE__*/ A(`ZodString`,(e,t)=>{Kr.init(e,t),Zs.init(e,t)},{email(e){return this.check(/* @__PURE__ */ za(rc,e))},url(e){return this.check(/* @__PURE__ */ Ga(oc,e))},jwt(e){return this.check(/* @__PURE__ */ oo(Sc,e))},emoji(e){return this.check(/* @__PURE__ */ Ka(cc,e))},guid(e){return this.check(/* @__PURE__ */ Ba(ic,e))},uuid(e){return this.check(/* @__PURE__ */ Va(ac,e))},uuidv4(e){return this.check(/* @__PURE__ */ Ha(ac,e))},uuidv6(e){return this.check(/* @__PURE__ */ Ua(ac,e))},uuidv7(e){return this.check(/* @__PURE__ */ Wa(ac,e))},nanoid(e){return this.check(/* @__PURE__ */ qa(lc,e))},cuid(e){return this.check(/* @__PURE__ */ Ja(uc,e))},cuid2(e){return this.check(/* @__PURE__ */ Ya(dc,e))},ulid(e){return this.check(/* @__PURE__ */ Xa(fc,e))},base64(e){return this.check(/* @__PURE__ */ ro(yc,e))},base64url(e){return this.check(/* @__PURE__ */ io(bc,e))},xid(e){return this.check(/* @__PURE__ */ Za(pc,e))},ksuid(e){return this.check(/* @__PURE__ */ Qa(mc,e))},ipv4(e){return this.check(/* @__PURE__ */ $a(hc,e))},ipv6(e){return this.check(/* @__PURE__ */ eo(gc,e))},cidrv4(e){return this.check(/* @__PURE__ */ to(_c,e))},cidrv6(e){return this.check(/* @__PURE__ */ no(vc,e))},e164(e){return this.check(/* @__PURE__ */ ao(xc,e))},datetime(e){return this.check(/* @__PURE__ */ so($s,e))},date(e){return this.check(/* @__PURE__ */ co(ec,e))},time(e){return this.check(/* @__PURE__ */ lo(tc,e))},duration(e){return this.check(/* @__PURE__ */ uo(nc,e))}});function K(e){return/* @__PURE__ */ Ra(Qs,e)}const q=/*@__PURE__*/ A(`ZodStringFormat`,(e,t)=>{I.init(e,t),Zs.init(e,t)}),$s=/*@__PURE__*/ A(`ZodISODateTime`,(e,t)=>{di.init(e,t),q.init(e,t)}),ec=/*@__PURE__*/ A(`ZodISODate`,(e,t)=>{fi.init(e,t),q.init(e,t)}),tc=/*@__PURE__*/ A(`ZodISOTime`,(e,t)=>{pi.init(e,t),q.init(e,t)}),nc=/*@__PURE__*/ A(`ZodISODuration`,(e,t)=>{mi.init(e,t),q.init(e,t)}),rc=/*@__PURE__*/ A(`ZodEmail`,(e,t)=>{Yr.init(e,t),q.init(e,t)}),ic=/*@__PURE__*/ A(`ZodGUID`,(e,t)=>{qr.init(e,t),q.init(e,t)}),ac=/*@__PURE__*/ A(`ZodUUID`,(e,t)=>{Jr.init(e,t),q.init(e,t)}),oc=/*@__PURE__*/ A(`ZodURL`,(e,t)=>{ri.init(e,t),q.init(e,t)});function sc(e){return/* @__PURE__ */ Ga(oc,e)}const cc=/*@__PURE__*/ A(`ZodEmoji`,(e,t)=>{ii.init(e,t),q.init(e,t)}),lc=/*@__PURE__*/ A(`ZodNanoID`,(e,t)=>{ai.init(e,t),q.init(e,t)}),uc=/*@__PURE__*/ A(`ZodCUID`,(e,t)=>{oi.init(e,t),q.init(e,t)}),dc=/*@__PURE__*/ A(`ZodCUID2`,(e,t)=>{si.init(e,t),q.init(e,t)}),fc=/*@__PURE__*/ A(`ZodULID`,(e,t)=>{ci.init(e,t),q.init(e,t)}),pc=/*@__PURE__*/ A(`ZodXID`,(e,t)=>{li.init(e,t),q.init(e,t)}),mc=/*@__PURE__*/ A(`ZodKSUID`,(e,t)=>{ui.init(e,t),q.init(e,t)}),hc=/*@__PURE__*/ A(`ZodIPv4`,(e,t)=>{hi.init(e,t),q.init(e,t)}),gc=/*@__PURE__*/ A(`ZodIPv6`,(e,t)=>{vi.init(e,t),q.init(e,t)}),_c=/*@__PURE__*/ A(`ZodCIDRv4`,(e,t)=>{yi.init(e,t),q.init(e,t)}),vc=/*@__PURE__*/ A(`ZodCIDRv6`,(e,t)=>{xi.init(e,t),q.init(e,t)}),yc=/*@__PURE__*/ A(`ZodBase64`,(e,t)=>{wi.init(e,t),q.init(e,t)}),bc=/*@__PURE__*/ A(`ZodBase64URL`,(e,t)=>{Di.init(e,t),q.init(e,t)}),xc=/*@__PURE__*/ A(`ZodE164`,(e,t)=>{Oi.init(e,t),q.init(e,t)}),Sc=/*@__PURE__*/ A(`ZodJWT`,(e,t)=>{Ai.init(e,t),q.init(e,t)}),Cc=/*@__PURE__*/ A(`ZodNumber`,(e,t)=>{ji.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ an({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=U(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=U(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=U(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>U(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ _o(e,t))},gte(e,t){return this.check(/* @__PURE__ */ vo(e,t))},min(e,t){return this.check(/* @__PURE__ */ vo(e,t))},lt(e,t){return this.check(/* @__PURE__ */ ho(e,t))},lte(e,t){return this.check(/* @__PURE__ */ go(e,t))},max(e,t){return this.check(/* @__PURE__ */ go(e,t))},int(e){return this.check(Tc(e))},safe(e){return this.check(Tc(e))},positive(e){return this.check(/* @__PURE__ */ _o(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ vo(0,e))},negative(e){return this.check(/* @__PURE__ */ ho(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ go(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ yo(e,t))},step(e,t){return this.check(/* @__PURE__ */ yo(e,t))},finite(){return this}})),wc=/*@__PURE__*/ A(`ZodNumberFormat`,(e,t)=>{Mi.init(e,t),Cc.init(e,t)});function Tc(e){return/* @__PURE__ */ fo(wc,e)}const Ec=/*@__PURE__*/ A(`ZodUnknown`,(e,t)=>{Ni.init(e,t),G.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Dc(){return/* @__PURE__ */ po(Ec)}const Oc=/*@__PURE__*/ A(`ZodNever`,(e,t)=>{Pi.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r)});function kc(e){return/* @__PURE__ */ mo(Oc,e)}const Ac=/*@__PURE__*/ A(`ZodArray`,(e,t)=>{Xs(),Ri.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gs(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ xo(e,t))},nonempty(e){return this.check(/* @__PURE__ */ xo(1,e))},max(e,t){return this.check(/* @__PURE__ */ bo(e,t))},length(e,t){return this.check(/* @__PURE__ */ So(e,t))},unwrap(){return this.element}});function jc(e,t){return/* @__PURE__ */ Po(Ac,e,t)}const Mc=/*@__PURE__*/ A(`ZodObject`,(e,t)=>{Xs(),Wi.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vs(e,t,n,r),un(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Vc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(x(this._zod.def,{catchall:e}))},passthrough(){return this.clone(x(this._zod.def,{catchall:Dc()}))},loose(){return this.clone(x(this._zod.def,{catchall:Dc()}))},strict(){return this.clone(x(this._zod.def,{catchall:kc()}))},strip(){return this.clone(x(this._zod.def,{catchall:void 0}))},extend(e){return Vt(this,e)},safeExtend(e){return Ut(this,e)},merge(e){return Wt(this,e)},pick(e){return Rt(this,e)},omit(e){return Bt(this,e)},partial(...e){return Gt(Kc,this,e[0])},exactPartial(...e){return Gt(Jc,this,e[0],`exactPartial`)},required(...e){return Kt(nl,this,e[0])}});function Nc(e,t){let n={type:`object`,shape:e??{},...C(t)};return new Mc(n)}const Pc=/*@__PURE__*/ A(`ZodUnion`,(e,t)=>{Ki.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r),e.options=t.options});function Fc(e,t){return new Pc({type:`union`,options:e,...C(t)})}const Ic=/*@__PURE__*/ A(`ZodIntersection`,(e,t)=>{qi.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r)});function Lc(e,t){return new Ic({type:`intersection`,left:e,right:t})}const Rc=/*@__PURE__*/ A(`ZodRecord`,(e,t)=>{Xs(),Xi.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function zc(e,t,n){return!t||!t._zod?new Rc({type:`record`,keyType:K(),valueType:e,...C(t)}):new Rc({type:`record`,keyType:e,valueType:t,...C(n)})}const Bc=/*@__PURE__*/ A(`ZodEnum`,(e,t)=>{Zi.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fs(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Bc({...t,checks:[],...C(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Bc({...t,checks:[],...C(r),entries:i})}});function Vc(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Bc({type:`enum`,entries:n,...C(t)})}const Hc=/*@__PURE__*/ A(`ZodLiteral`,(e,t)=>{Qi.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Uc(e,t){return new Hc({type:`literal`,values:Array.isArray(e)?e:[e],...C(t)})}const Wc=/*@__PURE__*/ A(`ZodTransform`,(e,t)=>{Xs(),$i.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new gn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(tn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(tn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Gc(e){return new Wc({type:`transform`,transform:e})}const Kc=/*@__PURE__*/ A(`ZodOptional`,(e,t)=>{ta.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qc(e){return new Kc({type:`optional`,innerType:e})}const Jc=/*@__PURE__*/ A(`ZodExactOptional`,(e,t)=>{na.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new Jc({type:`optional`,innerType:e})}const Xc=/*@__PURE__*/ A(`ZodNullable`,(e,t)=>{ra.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zc(e){return new Xc({type:`nullable`,innerType:e})}const Qc=/*@__PURE__*/ A(`ZodDefault`,(e,t)=>{ia.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $c(e,t){return new Qc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():jt(t)}})}const el=/*@__PURE__*/ A(`ZodPrefault`,(e,t)=>{oa.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tl(e,t){return new el({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():jt(t)}})}const nl=/*@__PURE__*/ A(`ZodNonOptional`,(e,t)=>{sa.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rl(e,t){return new nl({type:`nonoptional`,innerType:e,...C(t)})}const il=/*@__PURE__*/ A(`ZodCatch`,(e,t)=>{ua.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function al(e,t){return new il({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:dn(t)})}const ol=/*@__PURE__*/ A(`ZodPipe`,(e,t)=>{da.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r),e.in=t.in,e.out=t.out});function sl(e,t){return new ol({type:`pipe`,in:e,out:t})}const cl=/*@__PURE__*/ A(`ZodReadonly`,(e,t)=>{pa.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ll(e){return new cl({type:`readonly`,innerType:e})}const ul=/*@__PURE__*/ A(`ZodCustom`,(e,t)=>{ha.init(e,t),G.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ms(e,t,n,r)});function dl(e,t={}){return/* @__PURE__ */ Fo(ul,e,t)}function fl(e,t){return/* @__PURE__ */ Io(e,t)}const pl=/^[0-9a-f]{64}$/u,ml=Nc({darwinArm64:Nc({platform:Uc(`darwin`),arch:Uc(`arm64`),pythonVersion:K().regex(/^\d+\.\d+\.\d+$/u,`pythonVersion 必须是三段数字的版本号`),release:K(),url:sc({protocol:/^https$/u}).describe(`托管资产只允许 https 下载:http/file 会让安装器去取明文或本机文件`),sha256:K().regex(pl,`sha256 必须是 64 位小写十六进制`),sizeBytes:Tc().positive()}),documents:Nc({requirements:Uc(`py/documents-requirements.txt`),distribution:Uc(`pypdf`),version:K().regex(/^\d+\.\d+\.\d+$/u,`version 必须是三段数字的版本号`),sha256:K().regex(pl,`sha256 必须是 64 位小写十六进制`)}),unsupported:zc(K(),K())}),hl=n(g.join(import.meta.dirname,`runtime-manifest.json`))?import.meta.dirname:g.resolve(import.meta.dirname,`..`);function gl(e){let t;try{t=JSON.parse(e)}catch(e){throw Error(`runtime-manifest.json is invalid: ${String(e)}`,{cause:e})}let n=ml.safeParse(t);if(!n.success)throw Error(`runtime-manifest.json is invalid: ${Dn(n.error)}`);return n.data}let _l;const vl=/^version\s*=\s*(?<version>\S+)\s*$/mu;function yl(){return g.join(hl,`runtime-manifest.json`)}function bl(e=yl()){try{return r(e,`utf8`)}catch(t){throw Error(`runtime-manifest.json is unreadable: ${e}`,{cause:t})}}function xl(){return _l??=gl(bl()),_l}const J={get darwinArm64(){return xl().darwinArm64},get documents(){return xl().documents},get unsupported(){return xl().unsupported}};function Sl(e){return g.join(e,`runtime`,`python`,J.darwinArm64.pythonVersion,`bin`,`python3`)}function Cl(e){let t=g.join(e,`runtime`,`venv`);return process.platform===`win32`?g.join(t,`Scripts`,`python.exe`):g.join(t,`bin`,`python3`)}function Y(n){try{return i(n).isFile()?(e(n,t.X_OK),!0):!1}catch{return!1}}function wl(e){return process.platform===`win32`?g.join(e,`_env`,`.venv`,`Scripts`,`python.exe`):g.join(e,`_env`,`.venv`,`bin`,`python`)}function Tl(e){let t=g.join(e,`runtime`,`venv`,`pyvenv.cfg`),n;try{n=r(t,`utf8`)}catch{n=void 0}return(n===void 0?null:vl.exec(n))?.groups?.version}function El(){let e;try{e=J.unsupported[`${process.platform}-${process.arch}`]}catch{
120
120
  /* v8 ignore next 2 -- 清单读不到才走到这条兜底:正常装配里它必须存在,要在用例里造出来
121
121
  得清掉模块级缓存,代价与「这条兜底不吞异常」的收益不成比例 */
122
- e=void 0}return e}function Sl(e){let t=e.pythonBin.trim();if(t.length>0)return{pythonPath:t,via:`configured`,version:`unknown`};if(process.platform===`darwin`&&process.arch===`arm64`&&e.dataDir.length>0){let t=vl(e.dataDir);if(Y(t))return{pythonPath:t,via:`managed-venv`,version:bl(e.dataDir)??J.darwinArm64.pythonVersion};let n=_l(e.dataDir);if(Y(n))return{pythonPath:n,via:`managed`,version:J.darwinArm64.pythonVersion}}let n=e.repoRoot.length>0?yl(e.repoRoot):``;if(n.length>0&&Y(n))return{pythonPath:n,via:`repo`,version:`unknown`};let r=process.platform===`win32`?`python`:`python3`,i=xl();return i===void 0?{pythonPath:r,via:`path`,version:`unknown`}:{pythonPath:r,via:`path`,version:`unknown`,assetNote:i}}var Cl=/* @__PURE__ */ me((/* @__PURE__ */ fe(((e,t,n)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=/* @__PURE__ */ RegExp(`^0[0-7]+$`,`i`),a=/* @__PURE__ */ RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>=t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(t[e].length>4?NaN:parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>0xffffffff||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t=0;for(;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>0xffffff||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=``;this.zoneId&&(t=`%${this.zoneId}`);let n=this.toNormalizedString(),r=n.slice(0,n.length-t.length),i=0,a=-1,o=-1,s;for(;s=e.exec(r);){let e=(s[0].match(/0/g)||[]).length;e>o&&(o=e,i=s.index,a=s[0].length)}return a<0?r+t:`${r.substring(0,i)}::${r.substring(i+a)}${t}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t&&t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch(e){throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`,{cause:e})}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(n)})))(),1);const wl=/(?<scheme>[a-z][a-z0-9+.!-]*:\/\/)[^\s/?#]*@/giu;function Tl(e){return e.toByteArray().reduce((e,t)=>e*256+t,0)}Tl(Cl.default.IPv4.parse(`198.18.0.0`)),Tl(Cl.default.IPv4.parse(`198.19.255.255`)),Tl(Cl.default.IPv4.parse(`100.64.0.0`)),Tl(Cl.default.IPv4.parse(`100.127.255.255`));function El(e){let t=e.trimStart(),n=e.slice(0,e.length-t.length),r=t.replaceAll(wl,`$<scheme>***@`);if(r!==t)return`${n}${r}`;let i=t.indexOf(`@`),a=t.startsWith(`//`)?2:0;return i>a&&!t.slice(a,i).includes(`/`)?`${n}${t.slice(0,a)}***@${t.slice(i+1)}`:e}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Dl=`state.json`,Ol=/No matching distribution|Could not find a version/iu,kl=/Network|Temporary failure|Connection|timed out/iu;function Al(e){return El(e)}function jl(){return process.platform===`darwin`&&process.arch===`arm64`}const Ml=/* @__PURE__ */ new Set([`Chromium`,`chrome`,`chrome.exe`,`Google Chrome for Testing`]);var Z=class extends Error{code;constructor(e,t,n){super(t,n),this.name=`InstallError`,this.code=e}};function Nl(e){return X(e)&&typeof e.code==`string`?e.code:void 0}const Pl=65536,Fl=`
123
- [installer] 输出过长,后续内容已丢弃`;function Il(e,t){if(e.endsWith(Fl))return e;let n=e+t;return n.length>Pl?`${n.slice(0,Pl)}${Fl}`:n}async function Ll(e,t={}){let n=t.timeoutMs??18e5;return new Promise(r=>{let i=ae(e[0]??``,e.slice(1),{env:{...process.env,...t.env},stdio:[`ignore`,`pipe`,`pipe`]}),a=``,o=``,s=!1,c={},l=e=>{s||(s=!0,clearTimeout(c.timer),r(e))};c.timer=setTimeout(()=>{i.kill(`SIGKILL`),l({code:null,stdout:a,stderr:`${o}\n[installer] ${String(n)}ms 内没有结束,已终止`})},n),i.stdout.on(`data`,e=>{a=Il(a,e.toString(`utf8`))}),i.stderr.on(`data`,e=>{o=Il(o,e.toString(`utf8`))}),i.on(`error`,e=>{l({code:null,stdout:a,stderr:`${o}${String(e)}`})}),i.on(`close`,e=>{l({code:e,stdout:a,stderr:o})})})}function Rl(e){return async t=>{let n=g.join(te.tmpdir(),`dsh-scrapling-dl-${_()}`),r=await e([`curl`,`--fail`,`--location`,`--silent`,`--show-error`,`--connect-timeout`,`20`,`--max-time`,`900`,`--output`,n,t]);if(r.code===0)try{return new Uint8Array(await u(n))}finally{await p(n,{force:!0})}if(await p(n,{force:!0}),r.code!==null)throw new Z(`INSTALL_NETWORK`,`curl failed for ${El(t)}: ${Al(r.stderr).slice(0,400)}`);let i=await fetch(t,{signal:AbortSignal.timeout(9e5)});if(!i.ok)throw new Z(`INSTALL_NETWORK`,`${El(t)} answered HTTP ${i.status}`);return new Uint8Array(await i.arrayBuffer())}}const zl={download:Rl(Ll),extract:async(e,t)=>{let n=await Ll([`tar`,`-xzf`,e,`-C`,t]);if(n.code!==0)throw new Z(`INSTALL_FAILED`,`tar failed: ${Al(n.stderr).slice(0,400)}`)},spawn:Ll};async function Bl(e){try{return await a(e,t.F_OK),!0}catch{return!1}}function Vl(e=ie(import.meta.url)){let t;try{t=e(`fs-native-extensions`)}catch{t=void 0}if(X(t)){let e=t.tryLock,n=t.unlock;if(typeof e==`function`&&typeof n==`function`)return{tryLock:n=>!!e.call(t,n),unlock:e=>{n.call(t,e)}}}return null}const Hl=Vl();function Ul(e,t=Hl){if(t===null)throw new Z(`INSTALL_LOCK_UNREADABLE`,`fs-native-extensions is not loadable`);try{return t.tryLock(e)}catch(e){throw new Z(`INSTALL_LOCK_UNREADABLE`,`cannot lock install fd: ${String(e)}`)}}async function Wl(e,t=Hl){let n;try{n=await l(e,`a+`)}catch(t){throw new Z(`INSTALL_LOCK_UNREADABLE`,`cannot open install lock ${e}: ${String(t)}`)}let r;try{r=Ul(n.fd,t)}catch(e){throw await n.close(),e}if(!r)throw await n.close(),new Z(`INSTALL_BUSY`,`another install holds ${e}`);return{release:async()=>{try{t?.unlock(n.fd)}catch{}await n.close()}}}async function Gl(e){let t=g.join(e,`runtime`);return await c(t,{recursive:!0}),process.platform!==`win32`&&await o(t,448),t}const Kl=new ne;async function ql(e,t){let n=g.join(e,`runtime`),r=g.join(n,`install.lock`),i=g.resolve(r),a=Kl.getStore();if(a?.has(i)===!0)return t();await Gl(e);let o=await Wl(r),s=/* @__PURE__ */ new Set([...a??[],i]);try{return await Kl.run(s,t)}finally{await o.release()}}async function Jl(e,t){if(!URL.canParse(t))throw new Z(`INSTALL_OFFLINE_ASSETS`,`manifest archive URL is not parseable: ${t}`);let n=g.basename(new URL(t).pathname),r;try{r=decodeURIComponent(n)}catch{throw new Z(`INSTALL_OFFLINE_ASSETS`,`manifest archive name has invalid percent-encoding: ${n}`)}let i=n===r?[n]:[r,n],a=(await Promise.all(i.map(async t=>({name:t,bytes:await u(g.join(e,t)).catch(()=>null)})))).find(e=>e.bytes!==null)?.bytes;if(a==null)throw new Z(`INSTALL_OFFLINE_ASSETS`,`offline python archive missing under ${e}: expected ${i.join(` or `)}`);return new Uint8Array(a)}async function Yl(e,t,n,r){return ql(t,async()=>{let i=g.join(t,`runtime`,`.tmp`,_());await c(i,{recursive:!0});let a=g.join(i,`python.tar.gz`);try{let o=r===void 0?await n.download(e.url):await Jl(r,e.url),l=re(`sha256`).update(o).digest(`hex`);if(l!==e.sha256)throw new Z(`INSTALL_HASH_MISMATCH`,`python archive hash ${l} does not match ${e.sha256}`);await ee(a,o);let u=g.join(i,`extract`);await c(u,{recursive:!0}),await n.extract(a,u);let d=g.join(u,`python`),m=Y(g.join(d,`bin`,`python3`))?d:u;if(e.pythonVersion!==J.darwinArm64.pythonVersion)throw new Z(`INSTALL_FAILED`,`python asset version ${e.pythonVersion} is not the manifest version ${J.darwinArm64.pythonVersion}`);let h=g.dirname(g.dirname(_l(t)));await c(g.dirname(h),{recursive:!0});let te=`${h}.new-${_()}`;try{await s(m,te,{recursive:!0,dereference:!0}),await p(h,{recursive:!0,force:!0}),await f(te,h)}catch(e){throw await p(te,{recursive:!0,force:!0}),e}let ne=_l(t);if(!Y(ne))throw new Z(`INSTALL_FAILED`,`python archive did not contain bin/python3`);return{pythonPath:ne,version:J.darwinArm64.pythonVersion}}finally{await p(i,{recursive:!0,force:!0}),await m(g.join(t,`runtime`,`.tmp`)).catch(()=>null)}})}async function Xl(e){let t=g.join(e,`runtime`,Dl),n;try{n=await u(t,`utf8`)}catch(e){if(Nl(e)===`ENOENT`)return{packs:{}};throw new Z(`INSTALL_STATE_CORRUPT`,`cannot read ${t}: ${String(e)}; delete it and install again`,{cause:e})}let r;try{r=JSON.parse(n)}catch(e){throw new Z(`INSTALL_STATE_CORRUPT`,`${t} is not valid JSON; delete it and install again`,{cause:e})}if(!X(r))throw new Z(`INSTALL_STATE_CORRUPT`,`${t} does not hold a JSON object; delete it and install again`);return r}async function Zl(e,t){let n=await Gl(e),r=g.join(n,Dl),i=`${r}.${_()}.tmp`;try{await ee(i,JSON.stringify(t,null,2),`utf8`),await f(i,r)}finally{try{await p(i,{force:!0})}catch{}}}async function Ql(e,t,n,r=e=>u(e,`utf8`)){let i=g.join(e,`bin`),a=`#!${t}/`,o=(await d(i,{withFileTypes:!0}).catch(()=>[])).filter(e=>e.isFile()).map(e=>g.join(i,e.name));await Promise.all(o.map(async e=>{let t=await r(e).catch(()=>``),i=t.indexOf(`
124
- `),o=i===-1?t:t.slice(0,i);if(!o.startsWith(a))return;let s=i===-1?``:t.slice(i);await ee(e,`#!${n}/${o.slice(a.length)}${s}`,`utf8`)}))}async function $l(e,t){let n=!1;if(t){try{await p(e.venv,{recursive:!0,force:!0})}catch{}try{await f(e.previousVenv,e.venv)}catch{n=!0}}if(!n)try{await p(e.previousVenv,{recursive:!0,force:!0})}catch{}try{await p(e.staging,{recursive:!0,force:!0})}catch{}}async function eu(e){let{io:t}=e;await ql(e.dataDir,async()=>{let n=await Gl(e.dataDir),r=g.join(n,`venv`),i=g.join(n,`.tmp`,`venv-${_()}`),a=g.join(n,`.tmp`,`venv-previous-${_()}`),o=g.join(e.repoRoot,`py`,`runtime-requirements.txt`),s=!1,c=!1;try{let n=await t.spawn([e.pythonPath,`-m`,`venv`,i]);if(n.code!==0)throw new Z(`INSTALL_FAILED`,`venv failed: ${Al(n.stderr).slice(0,400)}`);let l=g.join(i,`bin`,`python3`),u=e.assets===void 0?[]:[`--no-index`,`--find-links`,g.join(e.assets,`wheels`)],d=await t.spawn([l,`-m`,`pip`,`install`,`--only-binary=:all:`,`--require-hashes`,`-r`,o,...u],{env:{PIP_DISABLE_PIP_VERSION_CHECK:`1`}});if(d.code!==0){let e=`${d.stdout}\n${d.stderr}`;throw Ol.test(e)?new Z(`INSTALL_NO_WHEEL`,`a dependency has no wheel for this platform`):kl.test(e)?new Z(`INSTALL_NETWORK`,`pip could not reach the package index`):new Z(`INSTALL_FAILED`,`pip failed: ${Al(d.stderr).slice(0,400)}`)}await Ql(i,i,r);try{await Bl(r)&&(await f(r,a),s=!0),await f(i,r)}catch(e){throw new Z(`INSTALL_FAILED`,`cannot replace ${r}: ${String(e)}`,{cause:e})}let p=await Xl(e.dataDir),m={...X(p.packs)?p.packs:{},core:`ready`};await Zl(e.dataDir,{...p,packs:m,python:e.pythonPath}),c=!0}finally{await $l({venv:r,previousVenv:a,staging:i},s&&!c)}})}async function tu(e){try{return(await d(e,{recursive:!0})).some(e=>Ml.has(g.basename(e)))}catch{return!1}}async function nu(e){return tu(g.join(e,`runtime`,`browsers`))}async function ru(e){let{io:t}=e;return ql(e.dataDir,async()=>{let n=g.join(e.dataDir,`runtime`,`browsers`);await c(n,{recursive:!0});let r=await t.spawn([e.pythonPath,`-m`,`patchright`,`install`,`chromium`],{env:{PLAYWRIGHT_BROWSERS_PATH:n}});if(r.code!==0)throw new Z(`INSTALL_BROWSER_FAILED`,`chromium install failed: ${Al(r.stderr).slice(0,400)}`);if(!await tu(n))throw new Z(`INSTALL_BROWSER_FAILED`,`no chromium executable found under ${n}`);let i=await Xl(e.dataDir),a={...X(i.packs)?i.packs:{},browser:`ready`};return await Zl(e.dataDir,{...i,packs:a,browsersPath:n}),{browsersPath:n}})}function iu(e,t){return e===`ready`?t?`ready`:`corrupt`:`missing`}async function au(e,t){if(!jl())return{core:`blocked`,browser:`blocked`,search:`blocked`,media:`blocked`,"adaptive-redis":`blocked`,mcp:`blocked`};let n=(await Xl(e)).packs,r=X(n)?n:{},i=iu(r.core,Y(vl(e))),a={core:i,browser:iu(r.browser,await nu(e)),search:i,media:i,"adaptive-redis":i,mcp:i};return t!==void 0&&(a[t]=`installing`),a}function ou(e){if(e?.aborted===!0)throw new Z(`INSTALL_CANCELLED`,`install cancelled`)}async function su(e,t,n,r,i){let a=_l(e);return Y(a)?a:(ou(n),(await Yl(r,e,t,i)).pythonPath)}async function cu(e,t){if(!jl())throw new Z(`INSTALL_PACK_BLOCKED`,`runtime packs are verified on macOS arm64 only; this host is ${process.platform}/${process.arch}`);let{dataDir:n,repoRoot:r,io:i,signal:a,onProgress:o,assets:s}=t,c=t.asset??J.darwinArm64;if(s!==void 0&&!await Bl(g.join(s,`wheels`)))throw new Z(`INSTALL_OFFLINE_ASSETS`,`offline wheelhouse missing: ${g.join(s,`wheels`)}`);ou(a),o?.(`installing ${e}`);let l=await su(n,i,a,c,s);ou(a),o?.(`installing core packages into ${l}`),await eu({pythonPath:l,dataDir:n,repoRoot:r,io:i,...s===void 0?{}:{assets:s}}),ou(a),e===`browser`&&(o?.(`installing full chromium`),await ru({pythonPath:vl(n),dataDir:n,io:i}),ou(a)),o?.(`${e} ready`)}const lu=cu;async function uu(e,t){await ql(t.dataDir,async()=>{let n=g.join(t.dataDir,`runtime`),r=e===`browser`?`browsers`:`venv`;await p(g.join(n,r),{recursive:!0,force:!0}),t.purge&&(await Promise.all([``,`-wal`,`-shm`].map(e=>p(g.join(t.dataDir,`elements_storage.db${e}`),{force:!0}))),await p(g.join(t.dataDir,`downloads`),{recursive:!0,force:!0}));let i=await Xl(t.dataDir);if(!X(i.packs))return;let a={...i.packs};Reflect.deleteProperty(a,e),await Zl(t.dataDir,{...i,packs:a})})}const du=/\r\n|\n|\r/u,fu=/[\t ]#.*$/u,pu=[`core`,`browser`,`search`,`media`,`adaptive-redis`,`mcp`],mu=new Set(pu),hu=/* @__PURE__ */ new Set([`setup`,`doctor`]),gu=/* @__PURE__ */ new Set([`status`,`apply`,`repair`,`purge`,`dry-run`,`with-auth`,`accept-risk`]),_u=/* @__PURE__ */ new Set([`port`,`mode`,`profile`,`offline`,`uninstall`,`feature`]);function vu(){let e=process.env.DSH_SCRAPLING_DATA_DIR;return e===void 0||e===``?g.join(te.homedir(),`.dsh-scrapling`):g.resolve(e)}function yu(e){return mu.has(e)}function bu(e,t){if(!e.startsWith(`--`))return{kind:`invalid`};let n=e.slice(2);return gu.has(n)?{kind:`boolean`,name:n}:!_u.has(n)||t===void 0||t.startsWith(`--`)?{kind:`invalid`}:{kind:`value`,name:n,value:t}}function xu(e){let[t,...n]=e;if(t===void 0||!hu.has(t))return null;let r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set;for(let[e,t]of n.entries())if(!i.has(e)){let a=bu(t,n[e+1]);if(a.kind===`invalid`)return null;r.set(a.name,a.kind!==`value`||a.value),a.kind===`value`&&i.add(e+1)}return{command:t,flags:r}}function Su(e){return{io:zl,dataDir:vu(),repoRoot:g.resolve(import.meta.dirname,`..`),log:e=>{console.info(e)},installPackFn:cu,repairPackFn:lu,uninstallPackFn:uu,...e}}function Q(e,t){let n=e.get(t);return typeof n==`string`?n:void 0}function Cu(e){let t=Q(e,`port`);if(t===void 0)return{invalid:!1};let n=Number(t);return Number.isInteger(n)&&n>0&&n<=65535?{port:n,invalid:!1}:{invalid:!0}}function wu(e){let t=Q(e,`mode`);return t===void 0||!Ce(t)?null:t}function Tu(e,t,n){let r=typeof n==`string`?JSON.stringify(n):`(缺省)`;return`--${e} 要写 ${t.join(` / `)} 之一;现在给的是 ${r}`}function Eu(e){return Tu(`mode`,xe,e.get(`mode`))}function Du(e,t){return Tu(e,pu,t.get(e))}function Ou(e){return e.has(`apply`)&&!e.has(`dry-run`)}function ku(e,t){return e.has(`dry-run`)&&e.has(`apply`)?`dry-run:--dry-run 压过 --apply,${t.suppressed}`:t.missingApply}function Au(e){if(e.mode===`native`)return{text:at(),note:`native 模式不留 dsh-mcp-client 条目:原生工具已经在宿主名册里,再端一份就是两套。`,install:``};if(e.mode===`mcp`){let t=e.withAuth?`Authorization 在宿主装载时从宿主进程环境的 ${ve} 求值:变量缺席会写成 "Bearer undefined",加鉴权前先确认宿主环境里已设置它。`:``;return{text:it({port:e.port,withAuth:e.withAuth}),note:`mcp 模式起的是本插件的 server,URL 里的端口要与部署项 mcpPort 同值(当前按 ${String(e.port)} 生成)。${t}`,install:Te()}}let t=Me({dataDir:e.dataDir,enabled:e.enabled,acceptedRisk:e.acceptRisk});return{text:t.patch,note:t.risk,install:t.installCommand}}async function ju(e,t){await c(g.dirname(e),{recursive:!0}),await ee(e,t,`utf8`)}async function Mu(e,t){let r=wu(e);if(r===null)return t.log(Eu(e)),2;let i=Cu(e);if(i.invalid)return t.log(`--port 要写 1 到 65535 之间的整数;现在给的是 ${String(Q(e,`port`))}`),2;let a=i.port??39217,o=Q(e,`profile`),s=o===void 0?void 0:await nt(o),c=Au({mode:r,port:a,withAuth:e.has(`with-auth`),acceptRisk:e.has(`accept-risk`),dataDir:t.dataDir,enabled:s?.officialMcpEnabled===!0});t.log(c.text),t.log(c.note),c.install!==``&&(t.log(`客户端没装就先跑:${c.install}`),t.log(`只接受 ${be.join(` 或 `)}:npm 的 latest 比宿主线旧,宿主拒绝装载不匹配的对端。`));let l=g.join(t.dataDir,`mcp`,rt(r));if(r===`official-mcp`){let e=De(t.dataDir);n(e)||t.log(`${e} 现在还不存在:先跑 setup --feature mcp --apply 把官方 server 装进托管 venv;在那之前这条条目连不上(failOnStartupError: true 会让宿主把这条报成红)。`)}return Ou(e)?(await ju(l,c.text),t.log(`wrote ${l}`),t.log(`profile 不会被这条命令改写:把这段并进 <profile>/cordis.patch.yml,再重启宿主。`),0):(t.log(ku(e,{suppressed:`只打印条目,不写 ${l}`,missingApply:`dry-run; add --apply to write ${l}`})),0)}function Nu(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/gu,String.raw`\$&`)}function Pu(e){let t=e.trim(),n=t.charAt(0);if(n===`"`||n===`'`){let e=t.indexOf(n,1);if(e>0)return t.slice(1,e)}return t.replace(fu,``).trim()}function $(e,t){let n=RegExp(`^[\\t ]*(?:-[\\t ]+)?${Nu(t)}:(?<value>[^\\r\\n]*)$`,`u`);return e.split(du).filter(e=>!e.trimStart().startsWith(`#`)).map(e=>Pu(n.exec(e)?.groups?.value??``)).filter(e=>e!==``).at(-1)}function Fu(e,t){return $(e,t)!==void 0}function Iu(e,t){let n=$(e,t);return n===`true`||n===`True`||n===`TRUE`}function Lu(e){return!e.includes(`/`)&&!e.includes(`\\`)?{value:e,relative:!1}:{value:g.resolve(e),relative:!g.isAbsolute(e)}}async function Ru(e){let t=Q(e,`profile`);if(t===void 0)return{profile:{path:null,pythonBin:null,dataDir:null,note:`未读 profile:runtime 只按 CLI 自身的解析链(pythonBin 配置 → 托管 venv → 裸托管解释器 → 仓内 _env/.venv → PATH python3);要看部署配置解析出的解释器就加 --profile <目录>`},pythonBin:``};let n=await nt(t),r=$(n.patchText,`pythonBin`)??``,i=$(n.patchText,`dataDir`)??``,a=Lu(r),o=Lu(i),s=a.value,c=[...r===``?[`profile 里没有 scrapling 的 pythonBin:runtime 回落到 CLI 自身的解析链(托管 venv → 裸托管解释器 → 仓内 _env/.venv → PATH python3)`]:[],...a.relative||o.relative?[`profile 里的 pythonBin / dataDir 写的是相对路径:CLI 已按自己进程的 cwd 展开,而宿主按它自己的 cwd 展开,两处可能不是同一个目录;改写成绝对路径才没有这层歧义`]:[]];return{profile:{path:t,pythonBin:r===``?null:r,dataDir:i===``?null:i,...c.length===0?{}:{note:c.join(`;`)}},pythonBin:s,...i===``?{}:{dataDirOverride:o.value}}}async function zu(e,t){let{profile:n,pythonBin:r,dataDirOverride:i}=await Ru(e),a=i??t.dataDir,o=Sl({pythonBin:r,dataDir:a,repoRoot:t.repoRoot}),s=await Xl(a),c=await au(a);return t.log(JSON.stringify({dataDir:a,profile:n,runtime:o,packs:c,state:s},null,2)),0}const Bu={tavily:`tavilyApiKey`,brave:`braveApiKey`,serper:`serperApiKey`,searxng:`searxngEndpoint`};function Vu(e){return e===void 0||st(e)?[]:[{code:`SEARCH_BACKEND_INVALID`,detail:`searchBackend=${e} 不是本包实现的后端:可写的取值是 ${ot.join(` / `)},删掉这一行即回到 auto。`}]}function Hu(e){let t=`searchProvider 已指向 scrapling,但能力包没装好:web_search 会报 WEB_PROVIDER_CONFIGURED_UNAVAILABLE。`;return e===`blocked`?`${t}原因是这台机器不在安装器支持的范围内(只验过 macOS arm64),所以 core 被标成 blocked —— 这不是「没装」,重跑安装计划在那台机器上也修不好。修复:把 profile 里 - id: scrapling 的 pythonBin 指到一个装好 scrapling 的解释器,或把 searchProvider 从 scrapling 改回宿主自己的 provider。`:`${t}修复:dsh-scrapling setup --feature core --apply。`}function Uu(e,t){let n=$(e,`searchProvider`),r=$(e,`searchBackend`),i=r??`auto`,a=Iu(e,`searchPublicFallback`),o=Fu(e,`tavilyApiKey`),s=Fu(e,`searxngEndpoint`),c=i===`auto`&&!o&&!s&&!a,l=i===`auto`?void 0:Bu[i],u=l!==void 0&&!Fu(e,l),d=n===`scrapling`,f=[],p=[];return n===void 0&&f.push(`SEARCH_PROVIDER_NOT_CONFIGURED 部署配置里还没写 searchProvider: scrapling:内置 web_search 仍走宿主自己选的 provider(base 层默认 deepseek-official),本插件的 search provider 只是备选。要接管它,给 <profile>/cordis.patch.yml 里 - id: web 的 config 加一行 searchProvider: scrapling,再重启宿主。`),c&&!d&&f.push(`SEARCH_BACKEND_MISSING 搜索后端未配置(预期行为):searchBackend=auto 但没配 tavilyApiKey、也没设 searxngEndpoint,且 searchPublicFallback=false,所以本插件的 search provider 不可用。修复:配 tavilyApiKey、设 searxngEndpoint,或显式把 searchPublicFallback 设为 true(会把查询词发给公共引擎)。`),u&&!d&&f.push(`SEARCH_AUTH searchBackend=${i} 但 ${l} 没配:查询会报 SEARCH_AUTH。修复:配 ${l},或换一个后端。`),p.push(...Vu(r)),d&&t!==`ready`&&p.push({code:`WEB_PROVIDER_CONFIGURED_UNAVAILABLE`,detail:Hu(t)}),d&&c&&p.push({code:`WEB_PROVIDER_CONFIGURED_UNAVAILABLE`,detail:`searchProvider 已指向 scrapling,但搜索后端不可用(没配 key/SearXNG,且 searchPublicFallback=false):web_search 会报 WEB_PROVIDER_CONFIGURED_UNAVAILABLE。修复:配 tavilyApiKey、设 searxngEndpoint,或显式打开 searchPublicFallback。`}),d&&u&&p.push({code:`SEARCH_AUTH`,detail:`searchBackend=${i} 但 ${l} 没配:provider 会注册成功,而每次查询都会报 SEARCH_AUTH。修复:配 ${l},或换一个后端。`}),{hints:f,findings:p}}async function Wu(e,t){let n=wu(e);if(n===null)return t.log(Eu(e)),2;let r=Q(e,`profile`);if(r===void 0)return t.log(`doctor 要 --profile <目录>:判据来自那份 profile 自己写下的 cordis.patch.yml。`),2;let i=Cu(e);if(i.invalid)return t.log(`--port 要写 1 到 65535 之间的整数;现在给的是 ${String(Q(e,`port`))}`),2;let a=await nt(r),o=await au($(a.patchText,`dataDir`)??t.dataDir),s=Ye({mode:n,expectedPort:i.port,...a}),c=Uu(a.patchText,o.core);for(let e of c.hints)t.log(e);for(let e of s)t.log(`${e.code} ${e.detail}`);for(let e of c.findings)t.log(`${e.code} ${e.detail}`);let l=s.length+c.findings.length;return l===0?(t.log(`${r} 与 integrationMode=${n} 一致。`),0):(t.log(s.length>0?`${String(l)} 处不一致:改完重跑 setup --mode ${n} --apply,并把条目并进 profile 后重启宿主。`:`${String(l)} 处搜索配置不一致:按上面逐条的修复动作改 ${r} 里 web 条目的 config,重启宿主生效。`),1)}async function Gu(e,t){let n=e.get(`uninstall`);if(typeof n!=`string`||!yu(n))return t.log(Du(`uninstall`,e)),2;let r=e.has(`purge`);return t.log(`uninstall ${n}${r?` (and purge user data)`:``} from ${g.join(t.dataDir,`runtime`)}`),Ou(e)?(await ql(t.dataDir,async()=>{await t.uninstallPackFn(n,{dataDir:t.dataDir,purge:r})}),t.log(`uninstalled ${n}${r?` (purged data)`:``}`),0):(t.log(ku(e,{suppressed:`只打印计划,不删任何 runtime 文件`,missingApply:`dry-run; add --apply to uninstall`})),0)}function Ku(e,t){let n=J.darwinArm64,r=g.join(t.repoRoot,`py`,`runtime-requirements.txt`);return[`python ${n.pythonVersion}(清单声明 ${String(n.sizeBytes)} 字节,sha256 前 12 位 ${n.sha256.slice(0,12)})`,e===`browser`?`core venv 依赖:${r},再装一份完整 Chromium(patchright)`:`core venv 依赖:${r}`,`落地位置:${g.join(t.dataDir,`runtime`)}(Python 在 runtime/python/,wheel 在 runtime/venv/)`].join(`
125
- `)}async function qu(e,t,n,r){await(n?t.repairPackFn:t.installPackFn)(e,{dataDir:t.dataDir,repoRoot:t.repoRoot,io:t.io,onProgress:t.log,...r===void 0?{}:{assets:r}})}async function Ju(e,t){let n=e.get(`feature`);if(typeof n!=`string`||!yu(n))return t.log(Du(`feature`,e)),2;let r=Q(e,`offline`);return r===``?(t.log(`--offline 要给一个资产目录`),2):(t.log(Ku(n,t)),r!==void 0&&t.log(`离线资产目录:${r}`),Ou(e)?(await qu(n,t,e.has(`repair`),r),t.log(`installed ${n}`),0):(t.log(ku(e,{suppressed:`只打印计划,不下载也不写 runtime`,missingApply:`dry-run; add --apply to install`})),0))}function Yu(e,t){return t.log(e instanceof Z||e instanceof Ee?`${e.code}: ${e.message}`:`command failed: ${String(e)}`),1}async function Xu(e,t={}){let n=Su(t),r=xu(e);if(r===null)return n.log(`用法:dsh-scrapling setup [--feature <core|browser|search|media|adaptive-redis|mcp>] [--mode <native|mcp|official-mcp>] [--profile <目录>] [--port <1-65535>] [--offline <资产目录>] [--apply] [--dry-run] [--repair] [--status] [--with-auth] [--accept-risk] [--uninstall <core|browser|search|media|adaptive-redis|mcp> [--purge]];dsh-scrapling doctor --mode <native|mcp|official-mcp> --profile <目录>;--apply 才落地,--dry-run(缺省)只打印计划,两者同时给时 --dry-run 胜。`),2;let{flags:i}=r;try{return r.command===`doctor`?await Wu(i,n):i.has(`status`)?await zu(i,n):i.has(`mode`)?await Mu(i,n):i.has(`uninstall`)?await Gu(i,n):await Ju(i,n)}catch(e){return Yu(e,n)}}try{process.exitCode=await Xu(process.argv.slice(2))}catch(e){console.error(`command failed: ${String(e)}`),process.exitCode=1}export{};
122
+ e=void 0}return e}function Dl(e){let t=e.pythonBin.trim();if(t.length>0)return{pythonPath:t,via:`configured`,version:`unknown`};if(process.platform===`darwin`&&process.arch===`arm64`&&e.dataDir.length>0){let t=Cl(e.dataDir);if(Y(t))return{pythonPath:t,via:`managed-venv`,version:Tl(e.dataDir)??J.darwinArm64.pythonVersion};let n=Sl(e.dataDir);if(Y(n))return{pythonPath:n,via:`managed`,version:J.darwinArm64.pythonVersion}}let n=e.repoRoot.length>0?wl(e.repoRoot):``;if(n.length>0&&Y(n))return{pythonPath:n,via:`repo`,version:`unknown`};let r=process.platform===`win32`?`python`:`python3`,i=El();return i===void 0?{pythonPath:r,via:`path`,version:`unknown`}:{pythonPath:r,via:`path`,version:`unknown`,assetNote:i}}var Ol=/* @__PURE__ */ he((/* @__PURE__ */ pe(((e,t,n)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=/* @__PURE__ */ RegExp(`^0[0-7]+$`,`i`),a=/* @__PURE__ */ RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>=t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(t[e].length>4?NaN:parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>0xffffffff||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t=0;for(;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>0xffffff||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=``;this.zoneId&&(t=`%${this.zoneId}`);let n=this.toNormalizedString(),r=n.slice(0,n.length-t.length),i=0,a=-1,o=-1,s;for(;s=e.exec(r);){let e=(s[0].match(/0/g)||[]).length;e>o&&(o=e,i=s.index,a=s[0].length)}return a<0?r+t:`${r.substring(0,i)}::${r.substring(i+a)}${t}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t&&t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch(e){throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`,{cause:e})}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(n)})))(),1);const kl=/(?<scheme>[a-z][a-z0-9+.!-]*:\/\/)[^\s/?#]*@/giu;function Al(e){return e.toByteArray().reduce((e,t)=>e*256+t,0)}Al(Ol.default.IPv4.parse(`198.18.0.0`)),Al(Ol.default.IPv4.parse(`198.19.255.255`)),Al(Ol.default.IPv4.parse(`100.64.0.0`)),Al(Ol.default.IPv4.parse(`100.127.255.255`));function jl(e){let t=e.trimStart(),n=e.slice(0,e.length-t.length),r=t.replaceAll(kl,`$<scheme>***@`);if(r!==t)return`${n}${r}`;let i=t.indexOf(`@`),a=t.startsWith(`//`)?2:0;return i>a&&!t.slice(a,i).includes(`/`)?`${n}${t.slice(0,a)}***@${t.slice(i+1)}`:e}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ml=`state.json`,Nl=/No matching distribution|Could not find a version/iu,Pl=/Network|Temporary failure|Connection|timed out/iu;function Fl(e){return jl(e)}function Il(){return process.platform===`darwin`&&process.arch===`arm64`}const Ll=/* @__PURE__ */ new Set([`Chromium`,`chrome`,`chrome.exe`,`Google Chrome for Testing`]);var Z=class extends Error{code;constructor(e,t,n){super(t,n),this.name=`InstallError`,this.code=e}};function Rl(e){return X(e)&&typeof e.code==`string`?e.code:void 0}const zl=65536,Bl=`
123
+ [installer] 输出过长,后续内容已丢弃`;function Vl(e,t){if(e.endsWith(Bl))return e;let n=e+t;return n.length>zl?`${n.slice(0,zl)}${Bl}`:n}async function Hl(e,t={}){let n=t.timeoutMs??18e5;return new Promise(r=>{let i=oe(e[0]??``,e.slice(1),{env:{...process.env,...t.env},stdio:[`ignore`,`pipe`,`pipe`]}),a=``,o=``,s=!1,c={},l=e=>{s||(s=!0,clearTimeout(c.timer),r(e))};c.timer=setTimeout(()=>{i.kill(`SIGKILL`),l({code:null,stdout:a,stderr:`${o}\n[installer] ${String(n)}ms 内没有结束,已终止`})},n),i.stdout.on(`data`,e=>{a=Vl(a,e.toString(`utf8`))}),i.stderr.on(`data`,e=>{o=Vl(o,e.toString(`utf8`))}),i.on(`error`,e=>{l({code:null,stdout:a,stderr:`${o}${String(e)}`})}),i.on(`close`,e=>{l({code:e,stdout:a,stderr:o})})})}function Ul(e){return async t=>{let n=g.join(te.tmpdir(),`dsh-scrapling-dl-${ie()}`),r=await e([`curl`,`--fail`,`--location`,`--silent`,`--show-error`,`--connect-timeout`,`20`,`--max-time`,`900`,`--output`,n,t]);if(r.code===0)try{return new Uint8Array(await u(n))}finally{await p(n,{force:!0})}if(await p(n,{force:!0}),r.code!==null)throw new Z(`INSTALL_NETWORK`,`curl failed for ${jl(t)}: ${Fl(r.stderr).slice(0,400)}`);let i=await fetch(t,{signal:AbortSignal.timeout(9e5)});if(!i.ok)throw new Z(`INSTALL_NETWORK`,`${jl(t)} answered HTTP ${i.status}`);return new Uint8Array(await i.arrayBuffer())}}const Wl={download:Ul(Hl),extract:async(e,t)=>{let n=await Hl([`tar`,`-xzf`,e,`-C`,t]);if(n.code!==0)throw new Z(`INSTALL_FAILED`,`tar failed: ${Fl(n.stderr).slice(0,400)}`)},spawn:Hl};async function Gl(e){try{return await a(e,t.F_OK),!0}catch{return!1}}function Kl(e=ae(import.meta.url)){let t;try{t=e(`fs-native-extensions`)}catch{t=void 0}if(X(t)){let e=t.tryLock,n=t.unlock;if(typeof e==`function`&&typeof n==`function`)return{tryLock:n=>!!e.call(t,n),unlock:e=>{n.call(t,e)}}}return null}const ql=Kl();function Jl(e,t=ql){if(t===null)throw new Z(`INSTALL_LOCK_UNREADABLE`,`fs-native-extensions is not loadable`);try{return t.tryLock(e)}catch(e){throw new Z(`INSTALL_LOCK_UNREADABLE`,`cannot lock install fd: ${String(e)}`)}}async function Yl(e,t=ql){let n;try{n=await l(e,`a+`)}catch(t){throw new Z(`INSTALL_LOCK_UNREADABLE`,`cannot open install lock ${e}: ${String(t)}`)}let r;try{r=Jl(n.fd,t)}catch(e){throw await n.close(),e}if(!r)throw await n.close(),new Z(`INSTALL_BUSY`,`another install holds ${e}`);return{release:async()=>{try{t?.unlock(n.fd)}catch{}await n.close()}}}async function Xl(e){let t=g.join(e,`runtime`);return await c(t,{recursive:!0}),process.platform!==`win32`&&await o(t,448),t}const Zl=new ne;async function Ql(e,t){let n=g.join(e,`runtime`),r=g.join(n,`install.lock`),i=g.resolve(r),a=Zl.getStore();if(a?.has(i)===!0)return t();await Xl(e);let o=await Yl(r),s=/* @__PURE__ */ new Set([...a??[],i]);try{return await Zl.run(s,t)}finally{await o.release()}}async function $l(e,t){if(!URL.canParse(t))throw new Z(`INSTALL_OFFLINE_ASSETS`,`manifest archive URL is not parseable: ${t}`);let n=g.basename(new URL(t).pathname),r;try{r=decodeURIComponent(n)}catch{throw new Z(`INSTALL_OFFLINE_ASSETS`,`manifest archive name has invalid percent-encoding: ${n}`)}let i=n===r?[n]:[r,n],a=(await Promise.all(i.map(async t=>({name:t,bytes:await u(g.join(e,t)).catch(()=>null)})))).find(e=>e.bytes!==null)?.bytes;if(a==null)throw new Z(`INSTALL_OFFLINE_ASSETS`,`offline python archive missing under ${e}: expected ${i.join(` or `)}`);return new Uint8Array(a)}async function eu(e,t,n,r){return Ql(t,async()=>{let i=g.join(t,`runtime`,`.tmp`,ie());await c(i,{recursive:!0});let a=g.join(i,`python.tar.gz`);try{let o=r===void 0?await n.download(e.url):await $l(r,e.url),l=re(`sha256`).update(o).digest(`hex`);if(l!==e.sha256)throw new Z(`INSTALL_HASH_MISMATCH`,`python archive hash ${l} does not match ${e.sha256}`);await ee(a,o);let u=g.join(i,`extract`);await c(u,{recursive:!0}),await n.extract(a,u);let d=g.join(u,`python`),m=Y(g.join(d,`bin`,`python3`))?d:u;if(e.pythonVersion!==J.darwinArm64.pythonVersion)throw new Z(`INSTALL_FAILED`,`python asset version ${e.pythonVersion} is not the manifest version ${J.darwinArm64.pythonVersion}`);let h=g.dirname(g.dirname(Sl(t)));await c(g.dirname(h),{recursive:!0});let te=`${h}.new-${ie()}`;try{await s(m,te,{recursive:!0,dereference:!0}),await p(h,{recursive:!0,force:!0}),await f(te,h)}catch(e){throw await p(te,{recursive:!0,force:!0}),e}let ne=Sl(t);if(!Y(ne))throw new Z(`INSTALL_FAILED`,`python archive did not contain bin/python3`);return{pythonPath:ne,version:J.darwinArm64.pythonVersion}}finally{await p(i,{recursive:!0,force:!0}),await m(g.join(t,`runtime`,`.tmp`)).catch(()=>null)}})}async function tu(e){let t=g.join(e,`runtime`,Ml),n;try{n=await u(t,`utf8`)}catch(e){if(Rl(e)===`ENOENT`)return{packs:{}};throw new Z(`INSTALL_STATE_CORRUPT`,`cannot read ${t}: ${String(e)}; delete it and install again`,{cause:e})}let r;try{r=JSON.parse(n)}catch(e){throw new Z(`INSTALL_STATE_CORRUPT`,`${t} is not valid JSON; delete it and install again`,{cause:e})}if(!X(r))throw new Z(`INSTALL_STATE_CORRUPT`,`${t} does not hold a JSON object; delete it and install again`);return r}async function nu(e,t){let n=await Xl(e),r=g.join(n,Ml),i=`${r}.${ie()}.tmp`;try{await ee(i,JSON.stringify(t,null,2),`utf8`),await f(i,r)}finally{try{await p(i,{force:!0})}catch{}}}async function ru(e,t,n,r=e=>u(e,`utf8`)){let i=g.join(e,`bin`),a=`#!${t}/`,o=(await d(i,{withFileTypes:!0}).catch(()=>[])).filter(e=>e.isFile()).map(e=>g.join(i,e.name));await Promise.all(o.map(async e=>{let t=await r(e).catch(()=>``),i=t.indexOf(`
124
+ `),o=i===-1?t:t.slice(0,i);if(!o.startsWith(a))return;let s=i===-1?``:t.slice(i);await ee(e,`#!${n}/${o.slice(a.length)}${s}`,`utf8`)}))}async function iu(e,t){let n=!1;if(t){try{await p(e.venv,{recursive:!0,force:!0})}catch{}try{await f(e.previousVenv,e.venv)}catch{n=!0}}if(!n)try{await p(e.previousVenv,{recursive:!0,force:!0})}catch{}try{await p(e.staging,{recursive:!0,force:!0})}catch{}}async function au(e){let{io:t}=e;await Ql(e.dataDir,async()=>{let n=await Xl(e.dataDir),r=g.join(n,`venv`),i=g.join(n,`.tmp`,`venv-${ie()}`),a=g.join(n,`.tmp`,`venv-previous-${ie()}`),o=[g.join(e.repoRoot,`py`,`runtime-requirements.txt`)];if(e.documents===!0){let t=g.join(e.repoRoot,J.documents.requirements),n=await u(t),r=re(`sha256`).update(n).digest(`hex`);if(r!==J.documents.sha256)throw new Z(`INSTALL_HASH_MISMATCH`,`documents requirements hash ${r} does not match ${J.documents.sha256}`);o.push(t)}let s=!1,c=!1;try{let n=await t.spawn([e.pythonPath,`-m`,`venv`,i]);if(n.code!==0)throw new Z(`INSTALL_FAILED`,`venv failed: ${Fl(n.stderr).slice(0,400)}`);let l=g.join(i,`bin`,`python3`),u=e.assets===void 0?[]:[`--no-index`,`--find-links`,g.join(e.assets,`wheels`)],d=await t.spawn([l,`-m`,`pip`,`install`,`--only-binary=:all:`,`--require-hashes`,...o.flatMap(e=>[`-r`,e]),...u],{env:{PIP_DISABLE_PIP_VERSION_CHECK:`1`}});if(d.code!==0){let e=`${d.stdout}\n${d.stderr}`;throw Nl.test(e)?new Z(`INSTALL_NO_WHEEL`,`a dependency has no wheel for this platform`):Pl.test(e)?new Z(`INSTALL_NETWORK`,`pip could not reach the package index`):new Z(`INSTALL_FAILED`,`pip failed: ${Fl(d.stderr).slice(0,400)}`)}await ru(i,i,r);try{await Gl(r)&&(await f(r,a),s=!0),await f(i,r)}catch(e){throw new Z(`INSTALL_FAILED`,`cannot replace ${r}: ${String(e)}`,{cause:e})}let p=await tu(e.dataDir),m={...X(p.packs)?p.packs:{},core:`ready`,...e.markDocuments===!0?{documents:`ready`}:{}};await nu(e.dataDir,{...p,packs:m,python:e.pythonPath}),c=!0}finally{await iu({venv:r,previousVenv:a,staging:i},s&&!c)}})}async function ou(e){try{return(await d(e,{recursive:!0})).some(e=>Ll.has(g.basename(e)))}catch{return!1}}async function su(e){return ou(g.join(e,`runtime`,`browsers`))}async function cu(e){let t=`${J.documents.distribution}-${J.documents.version}.dist-info`;try{return(await d(g.join(e,`runtime`,`venv`),{recursive:!0})).some(e=>g.basename(e)===t)}catch{return!1}}async function lu(e){let{io:t}=e;return Ql(e.dataDir,async()=>{let n=g.join(e.dataDir,`runtime`,`browsers`);await c(n,{recursive:!0});let r=await t.spawn([e.pythonPath,`-m`,`patchright`,`install`,`chromium`],{env:{PLAYWRIGHT_BROWSERS_PATH:n}});if(r.code!==0)throw new Z(`INSTALL_BROWSER_FAILED`,`chromium install failed: ${Fl(r.stderr).slice(0,400)}`);if(!await ou(n))throw new Z(`INSTALL_BROWSER_FAILED`,`no chromium executable found under ${n}`);let i=await tu(e.dataDir),a={...X(i.packs)?i.packs:{},browser:`ready`};return await nu(e.dataDir,{...i,packs:a,browsersPath:n}),{browsersPath:n}})}function uu(e,t){return e===`ready`?t?`ready`:`corrupt`:`missing`}async function du(e,t){if(!Il())return{core:`blocked`,browser:`blocked`,search:`blocked`,media:`blocked`,documents:`blocked`,"adaptive-redis":`blocked`,mcp:`blocked`};let n=(await tu(e)).packs,r=X(n)?n:{},i=uu(r.core,Y(Cl(e))),a={core:i,browser:uu(r.browser,await su(e)),search:i,media:i,documents:uu(r.documents,i===`ready`&&await cu(e)),"adaptive-redis":i,mcp:i};return t!==void 0&&(a[t]=`installing`),a}function fu(e){if(e?.aborted===!0)throw new Z(`INSTALL_CANCELLED`,`install cancelled`)}async function pu(e,t,n,r,i){let a=Sl(e);return Y(a)?a:(fu(n),(await eu(r,e,t,i)).pythonPath)}async function mu(e,t){if(!Il())throw new Z(`INSTALL_PACK_BLOCKED`,`runtime packs are verified on macOS arm64 only; this host is ${process.platform}/${process.arch}`);let{dataDir:n,repoRoot:r,io:i,signal:a,onProgress:o,assets:s}=t,c=t.asset??J.darwinArm64;if(s!==void 0&&!await Gl(g.join(s,`wheels`)))throw new Z(`INSTALL_OFFLINE_ASSETS`,`offline wheelhouse missing: ${g.join(s,`wheels`)}`);fu(a),o?.(`installing ${e}`);let l=await pu(n,i,a,c,s);fu(a),o?.(`installing core packages into ${l}`);let u=await tu(n),d=X(u.packs)?u.packs:{};await au({pythonPath:l,dataDir:n,repoRoot:r,io:i,documents:e===`documents`||d.documents===`ready`,markDocuments:e===`documents`,...s===void 0?{}:{assets:s}}),fu(a),e===`browser`&&(o?.(`installing full chromium`),await lu({pythonPath:Cl(n),dataDir:n,io:i}),fu(a)),o?.(`${e} ready`)}const hu=mu;async function gu(e,t){await Ql(t.dataDir,async()=>{let n=g.join(t.dataDir,`runtime`),r=e===`browser`?`browsers`:`venv`;await p(g.join(n,r),{recursive:!0,force:!0}),t.purge&&(await Promise.all([``,`-wal`,`-shm`].map(e=>p(g.join(t.dataDir,`elements_storage.db${e}`),{force:!0}))),await p(g.join(t.dataDir,`downloads`),{recursive:!0,force:!0}));let i=await tu(t.dataDir);if(!X(i.packs))return;let a={...i.packs};Reflect.deleteProperty(a,e),await nu(t.dataDir,{...i,packs:a})})}const _u=[`core`,`browser`,`search`,`media`,`documents`,`adaptive-redis`,`mcp`];new Set(_u);const vu=/\r\n|\n|\r/u,yu=/[\t ]#.*$/u,bu=_u,xu=new Set(bu),Su=/* @__PURE__ */ new Set([`setup`,`doctor`]),Cu=/* @__PURE__ */ new Set([`status`,`apply`,`repair`,`purge`,`dry-run`,`with-auth`,`accept-risk`]),wu=/* @__PURE__ */ new Set([`port`,`mode`,`profile`,`offline`,`uninstall`,`feature`]);function Tu(){let e=process.env.DSH_SCRAPLING_DATA_DIR;return e===void 0||e===``?g.join(te.homedir(),`.dsh-scrapling`):g.resolve(e)}function Eu(e){return xu.has(e)}function Du(e,t){if(!e.startsWith(`--`))return{kind:`invalid`};let n=e.slice(2);return Cu.has(n)?{kind:`boolean`,name:n}:!wu.has(n)||t===void 0||t.startsWith(`--`)?{kind:`invalid`}:{kind:`value`,name:n,value:t}}function Ou(e){let[t,...n]=e;if(t===void 0||!Su.has(t))return null;let r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set;for(let[e,t]of n.entries())if(!i.has(e)){let a=Du(t,n[e+1]);if(a.kind===`invalid`)return null;r.set(a.name,a.kind!==`value`||a.value),a.kind===`value`&&i.add(e+1)}return{command:t,flags:r}}function ku(e){return{io:Wl,dataDir:Tu(),repoRoot:g.resolve(import.meta.dirname,`..`),log:e=>{console.info(e)},installPackFn:mu,repairPackFn:hu,uninstallPackFn:gu,...e}}function Q(e,t){let n=e.get(t);return typeof n==`string`?n:void 0}function Au(e){let t=Q(e,`port`);if(t===void 0)return{invalid:!1};let n=Number(t);return Number.isInteger(n)&&n>0&&n<=65535?{port:n,invalid:!1}:{invalid:!0}}function ju(e){let t=Q(e,`mode`);return t===void 0||!Te(t)?null:t}function Mu(e,t,n){let r=typeof n==`string`?JSON.stringify(n):`(缺省)`;return`--${e} 要写 ${t.join(` / `)} 之一;现在给的是 ${r}`}function Nu(e){return Mu(`mode`,Ce,e.get(`mode`))}function Pu(e,t){return Mu(e,bu,t.get(e))}function Fu(e){return e.has(`apply`)&&!e.has(`dry-run`)}function Iu(e,t){return e.has(`dry-run`)&&e.has(`apply`)?`dry-run:--dry-run 压过 --apply,${t.suppressed}`:t.missingApply}function Lu(e){if(e.mode===`native`)return{text:ut(),note:`native 模式不留 dsh-mcp-client 条目:原生工具已经在宿主名册里,再端一份就是两套。`,install:``};if(e.mode===`mcp`){let t=e.withAuth?`Authorization 在宿主装载时从宿主进程环境的 ${be} 求值:变量缺席会写成 "Bearer undefined",加鉴权前先确认宿主环境里已设置它。`:``;return{text:lt({port:e.port,withAuth:e.withAuth,toolLoading:e.toolLoading}),note:`mcp 模式起的是本插件的 server,URL 里的端口要与部署项 mcpPort 同值(当前按 ${String(e.port)} 生成)。${t}`,install:De()}}let t=Pe({dataDir:e.dataDir,enabled:e.enabled,acceptedRisk:e.acceptRisk,toolLoading:e.toolLoading});return{text:t.patch,note:t.risk,install:t.installCommand}}async function Ru(e,t){await c(g.dirname(e),{recursive:!0}),await ee(e,t,`utf8`)}async function zu(e,t){let r=ju(e);if(r===null)return t.log(Nu(e)),2;let i=Au(e);if(i.invalid)return t.log(`--port 要写 1 到 65535 之间的整数;现在给的是 ${String(Q(e,`port`))}`),2;let a=i.port??39217,o=Q(e,`profile`),s=o===void 0?void 0:await st(o),c=Lu({mode:r,port:a,withAuth:e.has(`with-auth`),acceptRisk:e.has(`accept-risk`),dataDir:t.dataDir,enabled:s?.officialMcpEnabled===!0,toolLoading:s?.mcpToolLoading??`eager`});t.log(c.text),t.log(c.note),c.install!==``&&(t.log(`客户端没装就先跑:${c.install}`),t.log(`只接受 ${Se.join(` 或 `)}:npm 的 latest 比宿主线旧,宿主拒绝装载不匹配的对端。`));let l=g.join(t.dataDir,`mcp`,ct(r));if(r===`official-mcp`){let e=ke(t.dataDir);n(e)||t.log(`${e} 现在还不存在:先跑 setup --feature mcp --apply 把官方 server 装进托管 venv;在那之前这条条目连不上(failOnStartupError: true 会让宿主把这条报成红)。`)}return Fu(e)?(await Ru(l,c.text),t.log(`wrote ${l}`),t.log(`profile 不会被这条命令改写:把这段并进 <profile>/cordis.patch.yml,再重启宿主。`),0):(t.log(Iu(e,{suppressed:`只打印条目,不写 ${l}`,missingApply:`dry-run; add --apply to write ${l}`})),0)}function Bu(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/gu,String.raw`\$&`)}function Vu(e){let t=e.trim(),n=t.charAt(0);if(n===`"`||n===`'`){let e=t.indexOf(n,1);if(e>0)return t.slice(1,e)}return t.replace(yu,``).trim()}function $(e,t){let n=RegExp(`^[\\t ]*(?:-[\\t ]+)?${Bu(t)}:(?<value>[^\\r\\n]*)$`,`u`);return e.split(vu).filter(e=>!e.trimStart().startsWith(`#`)).map(e=>Vu(n.exec(e)?.groups?.value??``)).filter(e=>e!==``).at(-1)}function Hu(e,t){return $(e,t)!==void 0}function Uu(e,t){let n=$(e,t);return n===`true`||n===`True`||n===`TRUE`}function Wu(e){return!e.includes(`/`)&&!e.includes(`\\`)?{value:e,relative:!1}:{value:g.resolve(e),relative:!g.isAbsolute(e)}}async function Gu(e){let t=Q(e,`profile`);if(t===void 0)return{profile:{path:null,pythonBin:null,dataDir:null,note:`未读 profile:runtime 只按 CLI 自身的解析链(pythonBin 配置 → 托管 venv → 裸托管解释器 → 仓内 _env/.venv → PATH python3);要看部署配置解析出的解释器就加 --profile <目录>`},pythonBin:``};let n=await st(t),r=$(n.patchText,`pythonBin`)??``,i=$(n.patchText,`dataDir`)??``,a=Wu(r),o=Wu(i),s=a.value,c=[...r===``?[`profile 里没有 scrapling 的 pythonBin:runtime 回落到 CLI 自身的解析链(托管 venv → 裸托管解释器 → 仓内 _env/.venv → PATH python3)`]:[],...a.relative||o.relative?[`profile 里的 pythonBin / dataDir 写的是相对路径:CLI 已按自己进程的 cwd 展开,而宿主按它自己的 cwd 展开,两处可能不是同一个目录;改写成绝对路径才没有这层歧义`]:[]];return{profile:{path:t,pythonBin:r===``?null:r,dataDir:i===``?null:i,...c.length===0?{}:{note:c.join(`;`)}},pythonBin:s,...i===``?{}:{dataDirOverride:o.value}}}async function Ku(e,t){let{profile:n,pythonBin:r,dataDirOverride:i}=await Gu(e),a=i??t.dataDir,o=Dl({pythonBin:r,dataDir:a,repoRoot:t.repoRoot}),s=await tu(a),c=await du(a);return t.log(JSON.stringify({dataDir:a,profile:n,runtime:o,packs:c,state:s},null,2)),0}const qu={tavily:`tavilyApiKey`,brave:`braveApiKey`,serper:`serperApiKey`,searxng:`searxngEndpoint`};function Ju(e){return e===void 0||ft(e)?[]:[{code:`SEARCH_BACKEND_INVALID`,detail:`searchBackend=${e} 不是本包实现的后端:可写的取值是 ${dt.join(` / `)},删掉这一行即回到 auto。`}]}function Yu(e){let t=`searchProvider 已指向 scrapling,但能力包没装好:web_search 会报 WEB_PROVIDER_CONFIGURED_UNAVAILABLE。`;return e===`blocked`?`${t}原因是这台机器不在安装器支持的范围内(只验过 macOS arm64),所以 core 被标成 blocked —— 这不是「没装」,重跑安装计划在那台机器上也修不好。修复:把 profile 里 - id: scrapling 的 pythonBin 指到一个装好 scrapling 的解释器,或把 searchProvider 从 scrapling 改回宿主自己的 provider。`:`${t}修复:dsh-scrapling setup --feature core --apply。`}function Xu(e,t){let n=$(e,`searchProvider`),r=$(e,`searchBackend`),i=r??`auto`,a=Uu(e,`searchPublicFallback`),o=Hu(e,`tavilyApiKey`),s=Hu(e,`searxngEndpoint`),c=i===`auto`&&!o&&!s&&!a,l=i===`auto`?void 0:qu[i],u=l!==void 0&&!Hu(e,l),d=n===`scrapling`,f=[],p=[];return n===void 0&&f.push(`SEARCH_PROVIDER_NOT_CONFIGURED 部署配置里还没写 searchProvider: scrapling:内置 web_search 仍走宿主自己选的 provider(base 层默认 deepseek-official),本插件的 search provider 只是备选。要接管它,给 <profile>/cordis.patch.yml 里 - id: web 的 config 加一行 searchProvider: scrapling,再重启宿主。`),c&&!d&&f.push(`SEARCH_BACKEND_MISSING 搜索后端未配置(预期行为):searchBackend=auto 但没配 tavilyApiKey、也没设 searxngEndpoint,且 searchPublicFallback=false,所以本插件的 search provider 不可用。修复:配 tavilyApiKey、设 searxngEndpoint,或显式把 searchPublicFallback 设为 true(会把查询词发给公共引擎)。`),u&&!d&&f.push(`SEARCH_AUTH searchBackend=${i} 但 ${l} 没配:查询会报 SEARCH_AUTH。修复:配 ${l},或换一个后端。`),p.push(...Ju(r)),d&&t!==`ready`&&p.push({code:`WEB_PROVIDER_CONFIGURED_UNAVAILABLE`,detail:Yu(t)}),d&&c&&p.push({code:`WEB_PROVIDER_CONFIGURED_UNAVAILABLE`,detail:`searchProvider 已指向 scrapling,但搜索后端不可用(没配 key/SearXNG,且 searchPublicFallback=false):web_search 会报 WEB_PROVIDER_CONFIGURED_UNAVAILABLE。修复:配 tavilyApiKey、设 searxngEndpoint,或显式打开 searchPublicFallback。`}),d&&u&&p.push({code:`SEARCH_AUTH`,detail:`searchBackend=${i} 但 ${l} 没配:provider 会注册成功,而每次查询都会报 SEARCH_AUTH。修复:配 ${l},或换一个后端。`}),{hints:f,findings:p}}async function Zu(e,t){let n=ju(e);if(n===null)return t.log(Nu(e)),2;let r=Q(e,`profile`);if(r===void 0)return t.log(`doctor 要 --profile <目录>:判据来自那份 profile 自己写下的 cordis.patch.yml。`),2;let i=Au(e);if(i.invalid)return t.log(`--port 要写 1 到 65535 之间的整数;现在给的是 ${String(Q(e,`port`))}`),2;let a=await st(r),o=await du($(a.patchText,`dataDir`)??t.dataDir),s=Ze({mode:n,expectedPort:i.port,...a}),c=Xu(a.patchText,o.core);for(let e of c.hints)t.log(e);for(let e of s)t.log(`${e.code} ${e.detail}`);for(let e of c.findings)t.log(`${e.code} ${e.detail}`);let l=s.length+c.findings.length;return l===0?(t.log(`${r} 与 integrationMode=${n} 一致。`),0):(t.log(s.length>0?`${String(l)} 处不一致:改完重跑 setup --mode ${n} --apply,并把条目并进 profile 后重启宿主。`:`${String(l)} 处搜索配置不一致:按上面逐条的修复动作改 ${r} 里 web 条目的 config,重启宿主生效。`),1)}async function Qu(e,t){let n=e.get(`uninstall`);if(typeof n!=`string`||!Eu(n))return t.log(Pu(`uninstall`,e)),2;let r=e.has(`purge`);return t.log(`uninstall ${n}${r?` (and purge user data)`:``} from ${g.join(t.dataDir,`runtime`)}`),Fu(e)?(await Ql(t.dataDir,async()=>{await t.uninstallPackFn(n,{dataDir:t.dataDir,purge:r})}),t.log(`uninstalled ${n}${r?` (purged data)`:``}`),0):(t.log(Iu(e,{suppressed:`只打印计划,不删任何 runtime 文件`,missingApply:`dry-run; add --apply to uninstall`})),0)}function $u(e,t){let n=J.darwinArm64,r=g.join(t.repoRoot,`py`,`runtime-requirements.txt`);return[`python ${n.pythonVersion}(清单声明 ${String(n.sizeBytes)} 字节,sha256 前 12 位 ${n.sha256.slice(0,12)})`,e===`browser`?`core venv 依赖:${r},再装一份完整 Chromium(patchright)`:`core venv 依赖:${r}`,...e===`documents`?[`documents 依赖:${g.join(t.repoRoot,J.documents.requirements)}`]:[],`落地位置:${g.join(t.dataDir,`runtime`)}(Python 在 runtime/python/,wheel 在 runtime/venv/)`].join(`
125
+ `)}async function ed(e,t,n,r){await(n?t.repairPackFn:t.installPackFn)(e,{dataDir:t.dataDir,repoRoot:t.repoRoot,io:t.io,onProgress:t.log,...r===void 0?{}:{assets:r}})}async function td(e,t){let n=e.get(`feature`);if(typeof n!=`string`||!Eu(n))return t.log(Pu(`feature`,e)),2;let r=Q(e,`offline`);return r===``?(t.log(`--offline 要给一个资产目录`),2):(t.log($u(n,t)),r!==void 0&&t.log(`离线资产目录:${r}`),Fu(e)?(await ed(n,t,e.has(`repair`),r),t.log(`installed ${n}`),0):(t.log(Iu(e,{suppressed:`只打印计划,不下载也不写 runtime`,missingApply:`dry-run; add --apply to install`})),0))}function nd(e,t){return t.log(e instanceof Z||e instanceof Oe?`${e.code}: ${e.message}`:`command failed: ${String(e)}`),1}async function rd(e,t={}){let n=ku(t),r=Ou(e);if(r===null)return n.log(`用法:dsh-scrapling setup [--feature <core|browser|search|media|adaptive-redis|mcp>] [--mode <native|mcp|official-mcp>] [--profile <目录>] [--port <1-65535>] [--offline <资产目录>] [--apply] [--dry-run] [--repair] [--status] [--with-auth] [--accept-risk] [--uninstall <core|browser|search|media|adaptive-redis|mcp> [--purge]];dsh-scrapling doctor --mode <native|mcp|official-mcp> --profile <目录>;--apply 才落地,--dry-run(缺省)只打印计划,两者同时给时 --dry-run 胜。`),2;let{flags:i}=r;try{return r.command===`doctor`?await Zu(i,n):i.has(`status`)?await Ku(i,n):i.has(`mode`)?await zu(i,n):i.has(`uninstall`)?await Qu(i,n):await td(i,n)}catch(e){return nd(e,n)}}try{process.exitCode=await rd(process.argv.slice(2))}catch(e){console.error(`command failed: ${String(e)}`),process.exitCode=1}export{};